ThermoCloudI.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
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 
27 
28 using namespace Foam::constant;
29 
30 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
31 
32 template<class CloudType>
33 inline const Foam::ThermoCloud<CloudType>&
35 {
36  return cloudCopyPtr_();
37 }
38 
39 
40 template<class CloudType>
41 inline const typename CloudType::particleType::constantProperties&
43 {
44  return constProps_;
45 }
46 
47 
48 template<class CloudType>
49 inline typename CloudType::particleType::constantProperties&
51 {
52  return constProps_;
53 }
54 
55 
56 template<class CloudType>
58 {
59  return thermo_;
60 }
61 
62 
63 template<class CloudType>
65 {
66  return T_;
67 }
68 
69 
70 template<class CloudType>
72 {
73  return p_;
74 }
75 
76 
77 template<class CloudType>
80 {
81  return heatTransferModel_;
82 }
83 
84 
85 template<class CloudType>
86 inline const Foam::integrationScheme&
88 {
89  return TIntegrator_;
90 }
91 
92 
93 template<class CloudType>
95 {
96  return radiation_;
97 }
98 
99 
100 template<class CloudType>
103 {
104  if (!radiation_)
105  {
107  << "Radiation field requested, but radiation model not active"
108  << abort(FatalError);
109  }
110 
111  return radAreaP_();
112 }
113 
114 
115 template<class CloudType>
118 {
119  if (!radiation_)
120  {
122  << "Radiation field requested, but radiation model not active"
123  << abort(FatalError);
124  }
125 
126  return radAreaP_();
127 }
128 
129 
130 template<class CloudType>
133 {
134  if (!radiation_)
135  {
137  << "Radiation field requested, but radiation model not active"
138  << abort(FatalError);
139  }
140 
141  return radT4_();
142 }
143 
144 
145 template<class CloudType>
148 {
149  if (!radiation_)
150  {
152  << "Radiation field requested, but radiation model not active"
153  << abort(FatalError);
154  }
155 
156  return radT4_();
157 }
158 
159 
160 template<class CloudType>
163 {
164  if (!radiation_)
165  {
167  << "Radiation field requested, but radiation model not active"
168  << abort(FatalError);
169  }
170 
171  return radAreaPT4_();
172 }
173 
174 
175 template<class CloudType>
178 {
179  if (!radiation_)
180  {
182  << "Radiation field requested, but radiation model not active"
183  << abort(FatalError);
184  }
185 
186  return radAreaPT4_();
187 }
188 
189 
190 template<class CloudType>
193 {
194  return hsTrans_();
195 }
196 
197 
198 template<class CloudType>
201 {
202  return hsTrans_();
203 }
204 
205 
206 template<class CloudType>
209 {
210  return hsCoeff_();
211 }
212 
213 
214 template<class CloudType>
217 {
218  return hsCoeff_();
219 }
220 
221 
222 template<class CloudType>
225 {
226  if (debug)
227  {
228  Info<< "hsTrans min/max = " << min(hsTrans()).value() << ", "
229  << max(hsTrans()).value() << nl
230  << "hsCoeff min/max = " << min(hsCoeff()).value() << ", "
231  << max(hsCoeff()).value() << endl;
232  }
233 
234  if (this->solution().coupled())
235  {
236  if (this->solution().semiImplicit("h"))
237  {
238  const volScalarField Cp(thermo_.thermo().Cp());
240  Vdt(this->mesh().V()*this->db().time().deltaT());
241 
242  return
243  hsTrans()/Vdt
244  - fvm::SuSp(hsCoeff()/(Cp*Vdt), hs)
245  + hsCoeff()/(Cp*Vdt)*hs;
246  }
247  else
248  {
250  fvScalarMatrix& fvm = tfvm.ref();
251 
252  fvm.source() = -hsTrans()/(this->db().time().deltaT());
253 
254  return tfvm;
255  }
256  }
257 
259 }
260 
261 
262 template<class CloudType>
264 {
266  (
268  (
269  this->name() + ":radiation:Ep",
270  this->mesh(),
272  )
273  );
274 
275  if (radiation_)
276  {
277  scalarField& Ep = tEp.ref().primitiveFieldRef();
278  const scalar dt = this->db().time().deltaTValue();
279  const scalarField& V = this->mesh().V();
280  const scalar epsilon = constProps_.epsilon0();
281  const scalarField& sumAreaPT4 = radAreaPT4_->field();
282 
283  Ep = sumAreaPT4*epsilon*physicoChemical::sigma.value()/V/dt;
284  }
285 
286  return tEp;
287 }
288 
289 
290 template<class CloudType>
292 {
294  (
296  (
297  this->name() + ":radiation:ap",
298  this->mesh(),
300  )
301  );
302 
303  if (radiation_)
304  {
305  scalarField& ap = tap.ref().primitiveFieldRef();
306  const scalar dt = this->db().time().deltaTValue();
307  const scalarField& V = this->mesh().V();
308  const scalar epsilon = constProps_.epsilon0();
309  const scalarField& sumAreaP = radAreaP_->field();
310 
311  ap = sumAreaP*epsilon/V/dt;
312  }
313 
314  return tap;
315 }
316 
317 
318 template<class CloudType>
321 {
322  tmp<volScalarField> tsigmap
323  (
325  (
326  this->name() + ":radiation:sigmap",
327  this->mesh(),
329  )
330  );
331 
332  if (radiation_)
333  {
334  scalarField& sigmap = tsigmap.ref().primitiveFieldRef();
335  const scalar dt = this->db().time().deltaTValue();
336  const scalarField& V = this->mesh().V();
337  const scalar epsilon = constProps_.epsilon0();
338  const scalar f = constProps_.f0();
339  const scalarField& sumAreaP = radAreaP_->field();
340 
341  sigmap *= sumAreaP*(1.0 - f)*(1.0 - epsilon)/V/dt;
342  }
343 
344  return tsigmap;
345 }
346 
347 
348 template<class CloudType>
349 inline Foam::scalar Foam::ThermoCloud<CloudType>::Tmax() const
350 {
351  scalar T = -great;
352  label n = 0;
353  forAllConstIter(typename ThermoCloud<CloudType>, *this, iter)
354  {
355  const parcelType& p = iter();
356  T = max(T, p.T());
357  n++;
358  }
359 
360  reduce(T, maxOp<scalar>());
361  reduce(n, sumOp<label>());
362 
363  if (n > 0)
364  {
365  return T;
366  }
367  else
368  {
369  return 0.0;
370  }
371 }
372 
373 
374 template<class CloudType>
375 inline Foam::scalar Foam::ThermoCloud<CloudType>::Tmin() const
376 {
377  scalar T = great;
378  label n = 0;
379  forAllConstIter(typename ThermoCloud<CloudType>, *this, iter)
380  {
381  const parcelType& p = iter();
382  T = min(T, p.T());
383  n++;
384  }
385 
386  reduce(T, minOp<scalar>());
387  reduce(n, sumOp<label>());
388 
389  if (n > 0)
390  {
391  return T;
392  }
393  else
394  {
395  return 0.0;
396  }
397 }
398 
399 
400 // ************************************************************************* //
Collection of constants.
fvMatrix< scalar > fvScalarMatrix
Definition: fvMatricesFwd.H:42
tmp< fvMatrix< Type > > SuSp(const volScalarField::Internal &, const GeometricField< Type, fvPatchField, volMesh > &)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Templated heat transfer model class.
Definition: ThermoCloud.H:53
volScalarField::Internal & hsTrans()
Sensible enthalpy transfer [J/kg].
Definition: ThermoCloudI.H:192
const ThermoCloud & cloudCopy() const
Return a reference to the cloud copy.
Definition: ThermoCloudI.H:34
error FatalError
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:319
tmp< volScalarField > sigmap() const
Return tmp equivalent particulate scattering factor.
Definition: ThermoCloudI.H:320
T & ref() const
Return non-const reference or generate a fatal error.
Definition: tmpI.H:174
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:256
const volScalarField & p() const
Return const access to the carrier prressure field.
Definition: ThermoCloudI.H:71
const dimensionedScalar sigma
Stefan-Boltzmann constant: default SI units: [W/m^2/K^4].
volScalarField::Internal & radAreaPT4()
Radiation sum of parcel projected area*temperature^4 [m2K4].
Definition: ThermoCloudI.H:162
Templated base class for thermodynamic cloud.
Definition: ThermoCloud.H:60
static tmp< GeometricField< scalar, fvPatchField, volMesh > > New(const word &name, const Mesh &, const dimensionSet &, const word &patchFieldType=fvPatchField< scalar >::calculatedType())
Return a temporary field constructed from name, mesh, dimensionSet.
const HeatTransferModel< ThermoCloud< CloudType > > & heatTransfer() const
Return reference to heat transfer model.
Definition: ThermoCloudI.H:79
volScalarField::Internal & radAreaP()
Radiation sum of parcel projected areas [m^2].
Definition: ThermoCloudI.H:102
volScalarField::Internal & radT4()
Radiation sum of parcel temperature^4 [K4].
Definition: ThermoCloudI.H:132
tmp< volScalarField > ap() const
Return tmp equivalent particulate absorption.
Definition: ThermoCloudI.H:291
dynamicFvMesh & mesh
const parcelType::constantProperties & constProps() const
Return the constant properties.
Definition: ThermoCloudI.H:42
const Type & value() const
Return const reference to value.
A special matrix type and solver, designed for finite volume solutions of scalar equations. Face addressing is used to make all matrix assembly and solution loops vectorise.
Definition: fvPatchField.H:72
Thermo package for (S)olids (L)iquids and (G)ases Takes reference to thermo package, and provides:
Definition: SLGThermo.H:62
bool radiation() const
Radiation flag.
Definition: ThermoCloudI.H:94
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
Definition: pEqn.H:29
errorManip< error > abort(error &err)
Definition: errorManip.H:131
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:215
static const char nl
Definition: Ostream.H:265
const integrationScheme & TIntegrator() const
Return reference to velocity integration.
Definition: ThermoCloudI.H:87
Field< Type > & source()
Definition: fvMatrix.H:292
labelList f(nPoints)
const SLGThermo & thermo() const
Return const access to thermo package.
Definition: ThermoCloudI.H:57
const volScalarField & T() const
Return const access to the carrier temperature field.
Definition: ThermoCloudI.H:64
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
const dimensionSet dimEnergy
Base for a set of schemes which integrate simple ODEs which arise from semi-implcit rate expressions...
tmp< fvScalarMatrix > Sh(volScalarField &hs) const
Return sensible enthalpy source term [J/kg/m^3/s].
Definition: ThermoCloudI.H:224
dimensionedScalar pow3(const dimensionedScalar &ds)
scalar Tmax() const
Maximum temperature.
Definition: ThermoCloudI.H:349
tmp< volScalarField > Ep() const
Return tmp equivalent particulate emission.
Definition: ThermoCloudI.H:263
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:47
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:50
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
scalar epsilon
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
scalar Cp(const scalar p, const scalar T) const
Definition: EtoHthermo.H:2
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:51
messageStream Info
label n
Selector class for relaxation factors, solver type and solution.
Definition: solution.H:48
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:49
volScalarField & p
A class for managing temporary objects.
Definition: PtrList.H:53
volScalarField::Internal & hsCoeff()
Return coefficient for carrier phase hs equation.
Definition: ThermoCloudI.H:208
scalar Tmin() const
Minimum temperature.
Definition: ThermoCloudI.H:375