1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend 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 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "ReactingCloudTemplate.H"
28 #include "CompositionModel.H"
29 #include "PhaseChangeModel.H"
31 // * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
33 template<class ParcelType>
34 void Foam::ReactingCloud<ParcelType>::checkSuppliedComposition
36 const scalarField& YSupplied,
41 if (YSupplied.size() != Y.size())
45 "ReactingCloud<ParcelType>::checkSuppliedComposition"
47 "const scalarField&, "
48 "const scalarField&, "
51 ) << YName << " supplied, but size is not compatible with "
52 << "parcel composition: " << nl << " "
53 << YName << "(" << YSupplied.size() << ") vs required composition "
54 << YName << "(" << Y.size() << ")" << nl
60 template<class ParcelType>
61 void Foam::ReactingCloud<ParcelType>::preEvolve()
63 ThermoCloud<ParcelType>::preEvolve();
67 template<class ParcelType>
68 void Foam::ReactingCloud<ParcelType>::evolveCloud()
70 const volScalarField& T = this->carrierThermo().T();
71 const volScalarField cp = this->carrierThermo().Cp();
72 const volScalarField& p = this->carrierThermo().p();
74 autoPtr<interpolation<scalar> > rhoInterp = interpolation<scalar>::New
76 this->interpolationSchemes(),
80 autoPtr<interpolation<vector> > UInterp = interpolation<vector>::New
82 this->interpolationSchemes(),
86 autoPtr<interpolation<scalar> > muInterp = interpolation<scalar>::New
88 this->interpolationSchemes(),
92 autoPtr<interpolation<scalar> > TInterp = interpolation<scalar>::New
94 this->interpolationSchemes(),
98 autoPtr<interpolation<scalar> > cpInterp = interpolation<scalar>::New
100 this->interpolationSchemes(),
104 autoPtr<interpolation<scalar> > pInterp = interpolation<scalar>::New
106 this->interpolationSchemes(),
110 typename ParcelType::trackData td
123 this->injection().inject(td);
130 Cloud<ParcelType>::move(td);
134 template<class ParcelType>
135 void Foam::ReactingCloud<ParcelType>::postEvolve()
137 ThermoCloud<ParcelType>::postEvolve();
141 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
143 template<class ParcelType>
144 Foam::ReactingCloud<ParcelType>::ReactingCloud
146 const word& cloudName,
147 const volScalarField& rho,
148 const volVectorField& U,
149 const dimensionedVector& g,
154 ThermoCloud<ParcelType>(cloudName, rho, U, g, thermo, false),
156 constProps_(this->particleProperties()),
159 dynamic_cast<multiComponentMixture<thermoType>&>(thermo)
163 CompositionModel<ReactingCloud<ParcelType> >::New
165 this->particleProperties(),
171 PhaseChangeModel<ReactingCloud<ParcelType> >::New
173 this->particleProperties(),
177 rhoTrans_(mcCarrierThermo_.species().size()),
178 dMassPhaseChange_(0.0)
180 // Set storage for mass source fields and initialise to zero
186 new DimensionedField<scalar, volMesh>
190 this->name() + "rhoTrans_" + mcCarrierThermo_.species()[i],
191 this->db().time().timeName(),
198 dimensionedScalar("zero", dimMass, 0.0)
205 ParcelType::readFields(*this);
210 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
212 template<class ParcelType>
213 Foam::ReactingCloud<ParcelType>::~ReactingCloud()
217 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
219 template<class ParcelType>
220 void Foam::ReactingCloud<ParcelType>::checkParcelProperties
223 const scalar lagrangianDt,
224 const bool fullyDescribed
227 ThermoCloud<ParcelType>::checkParcelProperties
236 parcel.Y() = composition().YMixture0();
240 checkSuppliedComposition
243 composition().YMixture0(),
248 // derived information - store initial mass
249 parcel.mass0() = parcel.mass();
253 template<class ParcelType>
254 void Foam::ReactingCloud<ParcelType>::resetSourceTerms()
256 ThermoCloud<ParcelType>::resetSourceTerms();
259 rhoTrans_[i].field() = 0.0;
264 template<class ParcelType>
265 void Foam::ReactingCloud<ParcelType>::evolve()
281 template<class ParcelType>
282 void Foam::ReactingCloud<ParcelType>::info() const
284 ThermoCloud<ParcelType>::info();
286 Info<< " Mass transfer phase change = "
287 << returnReduce(dMassPhaseChange_, sumOp<scalar>()) << nl;
291 template<class ParcelType>
292 void Foam::ReactingCloud<ParcelType>::addToMassPhaseChange(const scalar dMass)
294 dMassPhaseChange_ += dMass;
298 // ************************************************************************* //