FreeFOAM The Cross-Platform CFD Toolkit
ReactingCloud_.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
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.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "ReactingCloud_.H"
27 
30 
31 // * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
32 
33 template<class ParcelType>
35 (
36  const scalarField& YSupplied,
37  const scalarField& Y,
38  const word& YName
39 )
40 {
41  if (YSupplied.size() != Y.size())
42  {
44  (
45  "ReactingCloud<ParcelType>::checkSuppliedComposition"
46  "("
47  "const scalarField&, "
48  "const scalarField&, "
49  "const word&"
50  ")"
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
55  << abort(FatalError);
56  }
57 }
58 
59 
60 template<class ParcelType>
62 {
64 }
65 
66 
67 template<class ParcelType>
69 {
70  const volScalarField& T = this->carrierThermo().T();
71  const volScalarField cp = this->carrierThermo().Cp();
72  const volScalarField& p = this->carrierThermo().p();
73 
75  (
76  this->interpolationSchemes(),
77  this->rho()
78  );
79 
81  (
82  this->interpolationSchemes(),
83  this->U()
84  );
85 
87  (
88  this->interpolationSchemes(),
89  this->mu()
90  );
91 
93  (
94  this->interpolationSchemes(),
95  T
96  );
97 
99  (
100  this->interpolationSchemes(),
101  cp
102  );
103 
105  (
106  this->interpolationSchemes(),
107  p
108  );
109 
110  typename ParcelType::trackData td
111  (
112  *this,
113  constProps_,
114  rhoInterp(),
115  UInterp(),
116  muInterp(),
117  TInterp(),
118  cpInterp(),
119  pInterp(),
120  this->g().value()
121  );
122 
123  this->injection().inject(td);
124 
125  if (this->coupled())
126  {
127  resetSourceTerms();
128  }
129 
131 }
132 
133 
134 template<class ParcelType>
136 {
138 }
139 
140 
141 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
142 
143 template<class ParcelType>
145 (
146  const word& cloudName,
147  const volScalarField& rho,
148  const volVectorField& U,
149  const dimensionedVector& g,
151  bool readFields
152 )
153 :
155  reactingCloud(),
156  constProps_(this->particleProperties()),
157  mcCarrierThermo_
158  (
159  dynamic_cast<multiComponentMixture<thermoType>&>(thermo)
160  ),
161  compositionModel_
162  (
164  (
165  this->particleProperties(),
166  *this
167  )
168  ),
169  phaseChangeModel_
170  (
172  (
173  this->particleProperties(),
174  *this
175  )
176  ),
177  rhoTrans_(mcCarrierThermo_.species().size()),
178  dMassPhaseChange_(0.0)
179 {
180  // Set storage for mass source fields and initialise to zero
181  forAll(rhoTrans_, i)
182  {
183  rhoTrans_.set
184  (
185  i,
187  (
188  IOobject
189  (
190  this->name() + "rhoTrans_" + mcCarrierThermo_.species()[i],
191  this->db().time().timeName(),
192  this->db(),
193  IOobject::NO_READ,
194  IOobject::NO_WRITE,
195  false
196  ),
197  this->mesh(),
198  dimensionedScalar("zero", dimMass, 0.0)
199  )
200  );
201  }
202 
203  if (readFields)
204  {
205  ParcelType::readFields(*this);
206  }
207 }
208 
209 
210 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
211 
212 template<class ParcelType>
214 {}
215 
216 
217 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
218 
219 template<class ParcelType>
221 (
222  ParcelType& parcel,
223  const scalar lagrangianDt,
224  const bool fullyDescribed
225 )
226 {
228  (
229  parcel,
230  lagrangianDt,
231  fullyDescribed
232  );
233 
234  if (!fullyDescribed)
235  {
236  parcel.Y() = composition().YMixture0();
237  }
238  else
239  {
240  checkSuppliedComposition
241  (
242  parcel.Y(),
243  composition().YMixture0(),
244  "YMixture"
245  );
246  }
247 
248  // derived information - store initial mass
249  parcel.mass0() = parcel.mass();
250 }
251 
252 
253 template<class ParcelType>
255 {
257  forAll(rhoTrans_, i)
258  {
259  rhoTrans_[i].field() = 0.0;
260  }
261 }
262 
263 
264 template<class ParcelType>
266 {
267  if (this->active())
268  {
269  preEvolve();
270 
271  evolveCloud();
272 
273  postEvolve();
274 
275  info();
276  Info<< endl;
277  }
278 }
279 
280 
281 template<class ParcelType>
283 {
285 
286  Info<< " Mass transfer phase change = "
287  << returnReduce(dMassPhaseChange_, sumOp<scalar>()) << nl;
288 }
289 
290 
291 template<class ParcelType>
293 {
294  dMassPhaseChange_ += dMass;
295 }
296 
297 
298 // ************************ vim: set sw=4 sts=4 et: ************************ //