initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / lagrangian / intermediate / clouds / Templates / ReactingMultiphaseCloud / ReactingMultiphaseCloud.C
blob5e7dee64bcf6f593cde895c9e3f5d34220c269c7
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2008-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
11     OpenFOAM is free software; you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
16     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "ReactingMultiphaseCloud.H"
29 #include "DevolatilisationModel.H"
30 #include "SurfaceReactionModel.H"
32 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
34 template<class ParcelType>
35 Foam::ReactingMultiphaseCloud<ParcelType>::ReactingMultiphaseCloud
37     const word& cloudName,
38     const volScalarField& rho,
39     const volVectorField& U,
40     const dimensionedVector& g,
41     basicThermo& thermo
44     ReactingCloud<ParcelType>(cloudName, rho, U, g, thermo),
45     reactingMultiphaseCloud(),
46     constProps_(this->particleProperties()),
47     devolatilisationModel_
48     (
49         DevolatilisationModel<ReactingMultiphaseCloud<ParcelType> >::New
50         (
51             this->particleProperties(),
52             *this
53         )
54     ),
55     surfaceReactionModel_
56     (
57         SurfaceReactionModel<ReactingMultiphaseCloud<ParcelType> >::New
58         (
59             this->particleProperties(),
60             *this
61         )
62     ),
63     dMassDevolatilisation_(0.0)
67 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
69 template<class ParcelType>
70 Foam::ReactingMultiphaseCloud<ParcelType>::~ReactingMultiphaseCloud()
74 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
76 template<class ParcelType>
77 void Foam::ReactingMultiphaseCloud<ParcelType>::checkParcelProperties
79     ParcelType& parcel,
80     const scalar lagrangianDt,
81     const bool fullyDescribed
84     ReactingCloud<ParcelType>::checkParcelProperties
85     (
86         parcel,
87         lagrangianDt,
88         fullyDescribed
89     );
91     label idGas = this->composition().idGas();
92     label idLiquid = this->composition().idLiquid();
93     label idSolid = this->composition().idSolid();
95     if (!fullyDescribed)
96     {
97         parcel.YGas() = this->composition().Y0(idGas);
98         parcel.YLiquid() = this->composition().Y0(idLiquid);
99         parcel.YSolid() = this->composition().Y0(idSolid);
100     }
101     else
102     {
103         this->checkSuppliedComposition
104         (
105             parcel.YGas(),
106             this->composition().Y0(idGas),
107             "YGas"
108         );
109         this->checkSuppliedComposition
110         (
111             parcel.YLiquid(),
112             this->composition().Y0(idLiquid),
113             "YLiquid"
114         );
115         this->checkSuppliedComposition
116         (
117             parcel.YSolid(),
118             this->composition().Y0(idSolid),
119             "YSolid"
120         );
121     }
125 template<class ParcelType>
126 void Foam::ReactingMultiphaseCloud<ParcelType>::resetSourceTerms()
128     ReactingCloud<ParcelType>::resetSourceTerms();
132 template<class ParcelType>
133 void Foam::ReactingMultiphaseCloud<ParcelType>::preEvolve()
135     ReactingCloud<ParcelType>::preEvolve();
139 template<class ParcelType>
140 void Foam::ReactingMultiphaseCloud<ParcelType>::postEvolve()
142     ReactingCloud<ParcelType>::postEvolve();
146 template<class ParcelType>
147 void Foam::ReactingMultiphaseCloud<ParcelType>::evolve()
149     preEvolve();
151     const volScalarField& T = this->carrierThermo().T();
152     const volScalarField cp = this->carrierThermo().Cp();
153     const volScalarField& p = this->carrierThermo().p();
155     autoPtr<interpolation<scalar> > rhoInterp = interpolation<scalar>::New
156     (
157         this->interpolationSchemes(),
158         this->rho()
159     );
161     autoPtr<interpolation<vector> > UInterp = interpolation<vector>::New
162     (
163         this->interpolationSchemes(),
164         this->U()
165     );
167     autoPtr<interpolation<scalar> > muInterp = interpolation<scalar>::New
168     (
169         this->interpolationSchemes(),
170         this->mu()
171     );
173     autoPtr<interpolation<scalar> > TInterp = interpolation<scalar>::New
174     (
175         this->interpolationSchemes(),
176         T
177     );
179     autoPtr<interpolation<scalar> > cpInterp = interpolation<scalar>::New
180     (
181         this->interpolationSchemes(),
182         cp
183     );
185     autoPtr<interpolation<scalar> > pInterp = interpolation<scalar>::New
186     (
187         this->interpolationSchemes(),
188         p
189     );
191     typename ParcelType::trackData td
192     (
193         *this,
194         constProps_,
195         rhoInterp(),
196         UInterp(),
197         muInterp(),
198         TInterp(),
199         cpInterp(),
200         pInterp(),
201         this->g().value()
202     );
204     this->injection().inject(td);
206     if (this->coupled())
207     {
208         resetSourceTerms();
209     }
211     Cloud<ParcelType>::move(td);
213     postEvolve();
217 template<class ParcelType>
218 void Foam::ReactingMultiphaseCloud<ParcelType>::info() const
220     ReactingCloud<ParcelType>::info();
221     Info<< "    Mass transfer devolatilisation  = "
222         << returnReduce(dMassDevolatilisation_, sumOp<scalar>()) << nl;
223     Info<< "    Mass transfer surface reaction  = "
224         << returnReduce(dMassSurfaceReaction_, sumOp<scalar>()) << nl;
228 template<class ParcelType>
229 void Foam::ReactingMultiphaseCloud<ParcelType>::addToMassDevolatilisation
231     const scalar dMass
234     dMassDevolatilisation_ += dMass;
238 template<class ParcelType>
239 void Foam::ReactingMultiphaseCloud<ParcelType>::addToMassSurfaceReaction
241     const scalar dMass
244     dMassSurfaceReaction_ += dMass;
248 // ************************************************************************* //