1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
7 -------------------------------------------------------------------------------
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
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 "ReactingCloud.H"
29 #include "CompositionModel.H"
30 #include "PhaseChangeModel.H"
32 // * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
34 template<class ParcelType>
35 void Foam::ReactingCloud<ParcelType>::checkSuppliedComposition
37 const scalarField& YSupplied,
42 if (YSupplied.size() != Y.size())
46 "ReactingCloud<ParcelType>::checkSuppliedComposition"
48 "const scalarField&, "
49 "const scalarField&, "
52 ) << YName << " supplied, but size is not compatible with "
53 << "parcel composition: " << nl << " "
54 << YName << "(" << YSupplied.size() << ") vs required composition "
55 << YName << "(" << Y.size() << ")" << nl
61 template<class ParcelType>
62 void Foam::ReactingCloud<ParcelType>::preEvolve()
64 ThermoCloud<ParcelType>::preEvolve();
68 template<class ParcelType>
69 void Foam::ReactingCloud<ParcelType>::evolveCloud()
71 const volScalarField& T = this->carrierThermo().T();
72 const volScalarField cp = this->carrierThermo().Cp();
73 const volScalarField& p = this->carrierThermo().p();
75 autoPtr<interpolation<scalar> > rhoInterp = interpolation<scalar>::New
77 this->interpolationSchemes(),
81 autoPtr<interpolation<vector> > UInterp = interpolation<vector>::New
83 this->interpolationSchemes(),
87 autoPtr<interpolation<scalar> > muInterp = interpolation<scalar>::New
89 this->interpolationSchemes(),
93 autoPtr<interpolation<scalar> > TInterp = interpolation<scalar>::New
95 this->interpolationSchemes(),
99 autoPtr<interpolation<scalar> > cpInterp = interpolation<scalar>::New
101 this->interpolationSchemes(),
105 autoPtr<interpolation<scalar> > pInterp = interpolation<scalar>::New
107 this->interpolationSchemes(),
111 typename ParcelType::trackData td
124 this->injection().inject(td);
131 Cloud<ParcelType>::move(td);
135 template<class ParcelType>
136 void Foam::ReactingCloud<ParcelType>::postEvolve()
138 ThermoCloud<ParcelType>::postEvolve();
142 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
144 template<class ParcelType>
145 Foam::ReactingCloud<ParcelType>::ReactingCloud
147 const word& cloudName,
148 const volScalarField& rho,
149 const volVectorField& U,
150 const dimensionedVector& g,
155 ThermoCloud<ParcelType>(cloudName, rho, U, g, thermo, false),
157 constProps_(this->particleProperties()),
160 dynamic_cast<multiComponentMixture<thermoType>&>(thermo)
164 CompositionModel<ReactingCloud<ParcelType> >::New
166 this->particleProperties(),
172 PhaseChangeModel<ReactingCloud<ParcelType> >::New
174 this->particleProperties(),
178 rhoTrans_(mcCarrierThermo_.species().size()),
179 dMassPhaseChange_(0.0)
181 // Set storage for mass source fields and initialise to zero
187 new DimensionedField<scalar, volMesh>
191 this->name() + "rhoTrans_" + mcCarrierThermo_.species()[i],
192 this->db().time().timeName(),
199 dimensionedScalar("zero", dimMass, 0.0)
206 ParcelType::readFields(*this);
211 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
213 template<class ParcelType>
214 Foam::ReactingCloud<ParcelType>::~ReactingCloud()
218 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
220 template<class ParcelType>
221 void Foam::ReactingCloud<ParcelType>::checkParcelProperties
224 const scalar lagrangianDt,
225 const bool fullyDescribed
228 ThermoCloud<ParcelType>::checkParcelProperties
237 parcel.Y() = composition().YMixture0();
241 checkSuppliedComposition
244 composition().YMixture0(),
249 // derived information - store initial mass
250 parcel.mass0() = parcel.mass();
254 template<class ParcelType>
255 void Foam::ReactingCloud<ParcelType>::resetSourceTerms()
257 ThermoCloud<ParcelType>::resetSourceTerms();
260 rhoTrans_[i].field() = 0.0;
265 template<class ParcelType>
266 void Foam::ReactingCloud<ParcelType>::evolve()
282 template<class ParcelType>
283 void Foam::ReactingCloud<ParcelType>::info() const
285 ThermoCloud<ParcelType>::info();
287 Info<< " Mass transfer phase change = "
288 << returnReduce(dMassPhaseChange_, sumOp<scalar>()) << nl;
292 template<class ParcelType>
293 void Foam::ReactingCloud<ParcelType>::addToMassPhaseChange(const scalar dMass)
295 dMassPhaseChange_ += dMass;
299 // ************************************************************************* //