Loading...
Searching...
No Matches
ThermoCloudI.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011-2017 OpenFOAM Foundation
9 Copyright (C) 2019-2023 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27\*---------------------------------------------------------------------------*/
28
31using namespace Foam::constant;
32
33// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
34
35template<class CloudType>
39 return *cloudCopyPtr_;
40}
41
42
43template<class CloudType>
44inline const typename CloudType::particleType::constantProperties&
47 return constProps_;
48}
49
50
51template<class CloudType>
52inline typename CloudType::particleType::constantProperties&
57
58
59template<class CloudType>
61{
62 return thermo_;
63}
64
65
66template<class CloudType>
68{
69 return T_;
70}
71
72
73template<class CloudType>
76 return p_;
77}
78
79
80template<class CloudType>
84 return *heatTransferModel_;
85}
86
87
88template<class CloudType>
89inline const Foam::integrationScheme&
94
95
96template<class CloudType>
99 return radiation_;
100}
101
102
103template<class CloudType>
106{
107 if (!radiation_)
108 {
110 << "Radiation field requested, but radiation model not active"
111 << abort(FatalError);
112 }
114 return *radAreaP_;
115}
116
117
118template<class CloudType>
121{
122 if (!radiation_)
123 {
125 << "Radiation field requested, but radiation model not active"
126 << abort(FatalError);
127 }
129 return *radAreaP_;
130}
131
132
133template<class CloudType>
136{
137 if (!radiation_)
138 {
140 << "Radiation field requested, but radiation model not active"
141 << abort(FatalError);
142 }
144 return *radT4_;
145}
146
147
148template<class CloudType>
151{
152 if (!radiation_)
153 {
155 << "Radiation field requested, but radiation model not active"
156 << abort(FatalError);
157 }
159 return *radT4_;
160}
161
162
163template<class CloudType>
166{
167 if (!radiation_)
168 {
170 << "Radiation field requested, but radiation model not active"
171 << abort(FatalError);
172 }
174 return *radAreaPT4_;
175}
176
177
178template<class CloudType>
181{
182 if (!radiation_)
183 {
185 << "Radiation field requested, but radiation model not active"
186 << abort(FatalError);
188
189 return *radAreaPT4_;
190}
191
192
193template<class CloudType>
195(
196 const parcelType& p,
197 const typename parcelType::trackingData& td
198)
199{
200 CloudType::transferToCarrier(p, td);
202 hsTrans()[p.cell()] += p.nParticle()*p.mass()*p.hs();
203}
204
205
206template<class CloudType>
210 return *hsTrans_;
211}
212
213
214template<class CloudType>
218 return *hsTrans_;
219}
220
221
222template<class CloudType>
226 return *hsCoeff_;
227}
228
229
230template<class CloudType>
234 return *hsCoeff_;
235}
236
237
238template<class CloudType>
241{
243 << "hsTrans min/max = " << min(hsTrans()).value() << ", "
244 << max(hsTrans()).value() << nl
245 << "hsCoeff min/max = " << min(hsCoeff()).value() << ", "
246 << max(hsCoeff()).value() << endl;
247
248 if (this->solution().coupled())
249 {
250 if (this->solution().semiImplicit("h"))
251 {
252 const volScalarField Cp(thermo_.thermo().Cp());
254 Vdt(this->mesh().V()*this->db().time().deltaT());
255
256 return
257 hsTrans()/Vdt
258 - fvm::SuSp(hsCoeff()/(Cp*Vdt), hs)
259 + hsCoeff()/(Cp*Vdt)*hs;
260 }
261 else
262 {
264 auto& fvm = tfvm.ref();
265
266 fvm.source() = -hsTrans()/(this->db().time().deltaT());
267
268 return tfvm;
269 }
271
273}
274
275
276template<class CloudType>
278{
279 auto tEp = tmp<volScalarField>::New
280 (
281 this->newIOobject
282 (
283 IOobject::scopedName(this->name(), "radiation", "Ep")
284 ),
285 this->mesh(),
287 );
288
289 if (radiation_)
290 {
291 scalarField& Ep = tEp.ref().primitiveFieldRef();
292 const scalar dt = this->db().time().deltaTValue();
293 const scalarField& V = this->mesh().V();
294 const scalar epsilon = constProps_.epsilon0();
295 const scalarField& sumAreaPT4 = radAreaPT4_->field();
296
297 Ep = sumAreaPT4*epsilon*physicoChemical::sigma.value()/V/dt;
299
300 return tEp;
301}
302
304template<class CloudType>
306{
307 auto tap = tmp<volScalarField>::New
308 (
309 this->newIOobject
310 (
311 IOobject::scopedName(this->name(), "radiation", "ap")
312 ),
313 this->mesh(),
315 );
316
317 if (radiation_)
318 {
319 scalarField& ap = tap.ref().primitiveFieldRef();
320 const scalar dt = this->db().time().deltaTValue();
321 const scalarField& V = this->mesh().V();
322 const scalar epsilon = constProps_.epsilon0();
323 const scalarField& sumAreaP = radAreaP_->field();
324
325 ap = sumAreaP*epsilon/V/dt;
326 }
328 return tap;
329}
330
331
332template<class CloudType>
335{
336 auto tsigmap = tmp<volScalarField>::New
337 (
338 this->newIOobject
339 (
340 IOobject::scopedName(this->name(), "radiation", "sigmap")
341 ),
342 this->mesh(),
344 );
345
346 if (radiation_)
347 {
348 scalarField& sigmap = tsigmap.ref().primitiveFieldRef();
349 const scalar dt = this->db().time().deltaTValue();
350 const scalarField& V = this->mesh().V();
351 const scalar epsilon = constProps_.epsilon0();
352 const scalar f = constProps_.f0();
353 const scalarField& sumAreaP = radAreaP_->field();
355 sigmap = sumAreaP*(1.0 - f)*(1.0 - epsilon)/V/dt;
357
358 return tsigmap;
359}
360
361
362template<class CloudType>
363inline Foam::scalar Foam::ThermoCloud<CloudType>::Tmax() const
364{
365 scalar val = -GREAT;
366 bool nonEmpty = false;
367
368 for (const parcelType& p : *this)
369 {
370 val = max(val, p.T());
371 nonEmpty = true;
372 }
373
374 if (returnReduceOr(nonEmpty))
375 {
376 return returnReduce(val, maxOp<scalar>());
378
379 return 0;
381
382
383template<class CloudType>
384inline Foam::scalar Foam::ThermoCloud<CloudType>::Tmin() const
385{
386 scalar val = GREAT;
387 bool nonEmpty = false;
388
389 for (const parcelType& p : *this)
390 {
391 val = min(val, p.T());
392 nonEmpty = true;
393 }
394
395 if (returnReduceOr(nonEmpty))
396 {
397 return returnReduce(val, minOp<scalar>());
398 }
399
400 return 0;
401}
403
404// ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
DimensionedField< scalar, volMesh > Internal
Templated class to calculate the fluid-particle heat transfer coefficients based on a specified Nusse...
const objectRegistry & db() const noexcept
Return the local objectRegistry.
Definition IOobject.C:450
static word scopedName(const std::string &scope, const word &name)
Create scope:name or scope_name string.
Definition IOobjectI.H:50
Thermo package for (S)olids (L)iquids and (G)ases Takes reference to thermo package,...
Definition SLGThermo.H:63
Templated base class for thermodynamic cloud.
Definition ThermoCloud.H:66
const parcelType::constantProperties & constProps() const
Return the constant properties.
volScalarField::Internal & radAreaP()
Radiation sum of parcel projected areas [m2].
volScalarField::Internal & hsCoeff()
Return coefficient for carrier phase hs equation.
volScalarField::Internal & radAreaPT4()
Radiation sum of parcel projected area*temperature^4 [m2K4].
const volScalarField & T() const
Return const access to the carrier temperature field.
bool radiation() const
Radiation flag.
scalar Tmin() const
Minimum temperature.
const volScalarField & p_
Pressure [Pa].
volScalarField::Internal & radT4()
Radiation sum of parcel temperature^4 [K4].
autoPtr< volScalarField::Internal > hsCoeff_
Coefficient for carrier phase hs equation [W/K].
autoPtr< volScalarField::Internal > radT4_
Radiation sum of parcel temperature^4.
autoPtr< integrationScheme > TIntegrator_
Temperature integration.
CloudType::particleType parcelType
Type of parcel the cloud was instantiated for.
Definition ThermoCloud.H:79
Switch radiation_
Include radiation.
const SLGThermo & thermo() const
Return const access to thermo package.
const integrationScheme & TIntegrator() const
Return reference to velocity integration.
const ThermoCloud & cloudCopy() const
Return a reference to the cloud copy.
scalar Tmax() const
Maximum temperature.
tmp< volScalarField > sigmap() const
Return tmp equivalent particulate scattering factor.
const HeatTransferModel< ThermoCloud< CloudType > > & heatTransfer() const
Return reference to heat transfer model.
tmp< fvScalarMatrix > Sh(volScalarField &hs) const
Return sensible enthalpy source term [J/kg/m3/s].
autoPtr< HeatTransferModel< ThermoCloud< CloudType > > > heatTransferModel_
Heat transfer model.
parcelType::constantProperties constProps_
Thermo parcel constant properties.
autoPtr< volScalarField::Internal > radAreaPT4_
Radiation sum of parcel projected areas * temperature^4.
volScalarField::Internal & hsTrans()
Sensible enthalpy transfer [J/kg].
void transferToCarrier(const parcelType &p, const typename parcelType::trackingData &td)
Transfer the effect of parcel to the carrier phase.
const SLGThermo & thermo_
SLG thermodynamics package.
const volScalarField & T_
Temperature [K].
const volScalarField & p() const
Return const access to the carrier pressure field.
tmp< volScalarField > Ep() const
Return tmp equivalent particulate emission.
autoPtr< volScalarField::Internal > hsTrans_
Sensible enthalpy transfer [J/kg].
autoPtr< volScalarField::Internal > radAreaP_
Radiation sum of parcel projected areas.
tmp< volScalarField > ap() const
Return tmp equivalent particulate absorption.
Base for a set of schemes which integrate simple ODEs which arise from semi-implcit rate expressions.
const Time & time() const noexcept
Return time registry.
IOobject newIOobject(const word &name, IOobjectOption ioOpt) const
Create an IOobject at the current time instance (timeName) with the specified options.
Selector class for relaxation factors, solver type and solution.
Definition solution.H:95
A class for managing temporary objects.
Definition tmp.H:75
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
Definition tmp.H:215
volScalarField & p
const volScalarField & Cp
Definition EEqn.H:7
bool coupled
dynamicFvMesh & mesh
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition error.H:600
scalar epsilon
auto & name
wallPoints::trackData td(isBlockedFace, regionToBlockSize)
return returnReduce(nRefine-oldNRefine, sumOp< label >())
#define DebugInfo
Report an information message using Foam::Info.
const dimensionedScalar sigma
Stefan-Boltzmann constant: default SI units: [W/m2/K4].
Different types of constants.
Namespace of functions to calculate implicit derivatives returning a matrix.
zeroField SuSp(const Foam::zero, const GeometricField< Type, fvPatchField, volMesh > &)
A no-op source.
bool returnReduceOr(const bool value, const int communicator=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition hashSets.C:40
const dimensionSet dimless
Dimensionless.
const dimensionSet dimEnergy
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
dimensionedScalar pow3(const dimensionedScalar &ds)
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition Ostream.H:519
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition hashSets.C:26
errorManip< error > abort(error &err)
Definition errorManip.H:139
static constexpr const zero Zero
Global zero (0).
Definition zero.H:127
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
constexpr char nl
The newline '\n' character (0x0a).
Definition Ostream.H:50
labelList f(nPoints)