1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
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 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
63 template<class ParcelType>
64 Foam::ReactingCloud<ParcelType>::ReactingCloud
66 const word& cloudName,
67 const volScalarField& rho,
68 const volVectorField& U,
69 const dimensionedVector& g,
73 ThermoCloud<ParcelType>(cloudName, rho, U, g, thermo),
75 constProps_(this->particleProperties()),
78 dynamic_cast<multiComponentMixture<thermoType>&>(thermo)
82 CompositionModel<ReactingCloud<ParcelType> >::New
84 this->particleProperties(),
90 PhaseChangeModel<ReactingCloud<ParcelType> >::New
92 this->particleProperties(),
96 rhoTrans_(mcCarrierThermo_.species().size()),
97 dMassPhaseChange_(0.0)
99 // Set storage for mass source fields and initialise to zero
105 new DimensionedField<scalar, volMesh>
109 this->name() + "rhoTrans_" + mcCarrierThermo_.species()[i],
110 this->db().time().timeName(),
117 dimensionedScalar("zero", dimMass, 0.0)
124 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
126 template<class ParcelType>
127 Foam::ReactingCloud<ParcelType>::~ReactingCloud()
131 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
133 template<class ParcelType>
134 void Foam::ReactingCloud<ParcelType>::checkParcelProperties
137 const scalar lagrangianDt,
138 const bool fullyDescribed
141 ThermoCloud<ParcelType>::checkParcelProperties
150 parcel.Y() = composition().YMixture0();
154 checkSuppliedComposition
157 composition().YMixture0(),
162 // derived information - store initial mass
163 parcel.mass0() = parcel.mass();
167 template<class ParcelType>
168 void Foam::ReactingCloud<ParcelType>::resetSourceTerms()
170 ThermoCloud<ParcelType>::resetSourceTerms();
173 rhoTrans_[i].field() = 0.0;
178 template<class ParcelType>
179 void Foam::ReactingCloud<ParcelType>::preEvolve()
181 ThermoCloud<ParcelType>::preEvolve();
185 template<class ParcelType>
186 void Foam::ReactingCloud<ParcelType>::postEvolve()
188 ThermoCloud<ParcelType>::postEvolve();
192 template<class ParcelType>
193 void Foam::ReactingCloud<ParcelType>::evolve()
197 const volScalarField& T = this->carrierThermo().T();
198 const volScalarField cp = this->carrierThermo().Cp();
199 const volScalarField& p = this->carrierThermo().p();
201 autoPtr<interpolation<scalar> > rhoInterp = interpolation<scalar>::New
203 this->interpolationSchemes(),
207 autoPtr<interpolation<vector> > UInterp = interpolation<vector>::New
209 this->interpolationSchemes(),
213 autoPtr<interpolation<scalar> > muInterp = interpolation<scalar>::New
215 this->interpolationSchemes(),
219 autoPtr<interpolation<scalar> > TInterp = interpolation<scalar>::New
221 this->interpolationSchemes(),
225 autoPtr<interpolation<scalar> > cpInterp = interpolation<scalar>::New
227 this->interpolationSchemes(),
231 autoPtr<interpolation<scalar> > pInterp = interpolation<scalar>::New
233 this->interpolationSchemes(),
237 typename ParcelType::trackData td
250 this->injection().inject(td);
257 Cloud<ParcelType>::move(td);
263 template<class ParcelType>
264 void Foam::ReactingCloud<ParcelType>::info() const
266 ThermoCloud<ParcelType>::info();
268 Info<< " Mass transfer phase change = "
269 << returnReduce(dMassPhaseChange_, sumOp<scalar>()) << nl;
273 template<class ParcelType>
274 void Foam::ReactingCloud<ParcelType>::addToMassPhaseChange(const scalar dMass)
276 dMassPhaseChange_ += dMass;
280 // ************************************************************************* //