ThermoCloud.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 | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011-2017 OpenFOAM Foundation
9 Copyright (C) 2020 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
29#include "ThermoCloud.H"
30#include "ThermoParcel.H"
31
32#include "HeatTransferModel.H"
33
34// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
35
36template<class CloudType>
38{
39 heatTransferModel_.reset
40 (
42 (
43 this->subModelProperties(),
44 *this
45 ).ptr()
46 );
47
48 TIntegrator_.reset
49 (
50 integrationScheme::New
51 (
52 "T",
53 this->solution().integrationSchemes()
54 ).ptr()
55 );
56
57 this->subModelProperties().readEntry("radiation", radiation_);
58
59 if (radiation_)
60 {
61 radAreaP_.reset
62 (
64 (
66 (
67 this->name() + ":radAreaP",
68 this->db().time().timeName(),
69 this->db(),
70 IOobject::READ_IF_PRESENT,
71 IOobject::AUTO_WRITE
72 ),
73 this->mesh(),
75 )
76 );
77
78 radT4_.reset
79 (
81 (
83 (
84 this->name() + ":radT4",
85 this->db().time().timeName(),
86 this->db(),
87 IOobject::READ_IF_PRESENT,
88 IOobject::AUTO_WRITE
89 ),
90 this->mesh(),
92 )
93 );
94
95 radAreaPT4_.reset
96 (
98 (
100 (
101 this->name() + ":radAreaPT4",
102 this->db().time().timeName(),
103 this->db(),
104 IOobject::READ_IF_PRESENT,
105 IOobject::AUTO_WRITE
106 ),
107 this->mesh(),
109 )
110 );
111 }
112}
113
114
115template<class CloudType>
117{
118 CloudType::cloudReset(c);
119
120 heatTransferModel_.reset(c.heatTransferModel_.ptr());
121 TIntegrator_.reset(c.TIntegrator_.ptr());
122
123 radiation_ = c.radiation_;
124}
125
126
127// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
128
129template<class CloudType>
131(
132 const word& cloudName,
133 const volScalarField& rho,
134 const volVectorField& U,
135 const dimensionedVector& g,
136 const SLGThermo& thermo,
137 bool readFields
138)
139:
141 (
142 cloudName,
143 rho,
144 U,
145 thermo.thermo().mu(),
146 g,
147 false
148 ),
149 thermoCloud(),
150 cloudCopyPtr_(nullptr),
151 constProps_(this->particleProperties()),
152 thermo_(thermo),
153 T_(thermo.thermo().T()),
154 p_(thermo.thermo().p()),
155 heatTransferModel_(nullptr),
156 TIntegrator_(nullptr),
157 radiation_(false),
158 radAreaP_(nullptr),
159 radT4_(nullptr),
160 radAreaPT4_(nullptr),
161 hsTrans_
162 (
163 new volScalarField::Internal
166 (
167 this->name() + ":hsTrans",
168 this->db().time().timeName(),
169 this->db(),
170 IOobject::READ_IF_PRESENT,
171 IOobject::AUTO_WRITE
172 ),
173 this->mesh(),
175 )
176 ),
177 hsCoeff_
179 new volScalarField::Internal
180 (
182 (
183 this->name() + ":hsCoeff",
184 this->db().time().timeName(),
185 this->db(),
186 IOobject::READ_IF_PRESENT,
187 IOobject::AUTO_WRITE
188 ),
189 this->mesh(),
191 )
193{
194 if (this->solution().active())
195 {
196 setModels();
197
198 if (readFields)
199 {
201 this->deleteLostParticles();
202 }
203 }
204
205 if (this->solution().resetSourcesOnStartup())
206 {
207 resetSourceTerms();
208 }
209}
210
211
212template<class CloudType>
214(
216 const word& name
217)
218:
219 CloudType(c, name),
220 thermoCloud(),
221 cloudCopyPtr_(nullptr),
222 constProps_(c.constProps_),
223 thermo_(c.thermo_),
224 T_(c.T()),
225 p_(c.p()),
226 heatTransferModel_(c.heatTransferModel_->clone()),
227 TIntegrator_(c.TIntegrator_->clone()),
228 radiation_(c.radiation_),
229 radAreaP_(nullptr),
230 radT4_(nullptr),
231 radAreaPT4_(nullptr),
232 hsTrans_
233 (
234 new volScalarField::Internal
235 (
237 (
238 this->name() + ":hsTrans",
239 this->db().time().timeName(),
240 this->db(),
241 IOobject::NO_READ,
242 IOobject::NO_WRITE,
243 false
244 ),
245 c.hsTrans()
246 )
247 ),
248 hsCoeff_
249 (
250 new volScalarField::Internal
251 (
253 (
254 this->name() + ":hsCoeff",
255 this->db().time().timeName(),
256 this->db(),
257 IOobject::NO_READ,
258 IOobject::NO_WRITE,
259 false
260 ),
261 c.hsCoeff()
262 )
263 )
264{
265 if (radiation_)
266 {
267 radAreaP_.reset
268 (
270 (
272 (
273 this->name() + ":radAreaP",
274 this->db().time().timeName(),
275 this->db(),
278 false
279 ),
280 c.radAreaP()
281 )
282 );
283
284 radT4_.reset
285 (
287 (
289 (
290 this->name() + ":radT4",
291 this->db().time().timeName(),
292 this->db(),
295 false
296 ),
297 c.radT4()
298 )
299 );
300
301 radAreaPT4_.reset
302 (
304 (
306 (
307 this->name() + ":radAreaPT4",
308 this->db().time().timeName(),
309 this->db(),
312 false
313 ),
314 c.radAreaPT4()
315 )
316 );
317 }
318}
319
320
321template<class CloudType>
323(
324 const fvMesh& mesh,
325 const word& name,
327)
328:
329 CloudType(mesh, name, c),
330 thermoCloud(),
331 cloudCopyPtr_(nullptr),
332 constProps_(),
333 thermo_(c.thermo()),
334 T_(c.T()),
335 p_(c.p()),
336 heatTransferModel_(nullptr),
337 TIntegrator_(nullptr),
338 radiation_(false),
339 radAreaP_(nullptr),
340 radT4_(nullptr),
341 radAreaPT4_(nullptr),
342 hsTrans_(nullptr),
343 hsCoeff_(nullptr)
344{}
345
347// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
348
349template<class CloudType>
351(
352 parcelType& parcel,
353 const scalar lagrangianDt
354)
356 CloudType::setParcelThermoProperties(parcel, lagrangianDt);
357
358 parcel.T() = constProps_.T0();
359 parcel.Cp() = constProps_.Cp0();
360}
362
363template<class CloudType>
365(
366 parcelType& parcel,
367 const scalar lagrangianDt,
368 const bool fullyDescribed
369)
370{
371 CloudType::checkParcelProperties(parcel, lagrangianDt, fullyDescribed);
372}
373
374
375template<class CloudType>
378 cloudCopyPtr_.reset
379 (
380 static_cast<ThermoCloud<CloudType>*>
381 (
382 clone(this->name() + "Copy").ptr()
383 )
384 );
385}
386
387
388template<class CloudType>
390{
391 cloudReset(cloudCopyPtr_());
392 cloudCopyPtr_.clear();
393}
394
395
396template<class CloudType>
398{
400 hsTrans_->field() = 0.0;
401 hsCoeff_->field() = 0.0;
402
403 if (radiation_)
404 {
405 radAreaP_->field() = 0.0;
406 radT4_->field() = 0.0;
407 radAreaPT4_->field() = 0.0;
408 }
409}
410
411
412template<class CloudType>
414(
415 const ThermoCloud<CloudType>& cloudOldTime
416)
417{
418 CloudType::relaxSources(cloudOldTime);
419
420 this->relax(hsTrans_(), cloudOldTime.hsTrans(), "h");
421 this->relax(hsCoeff_(), cloudOldTime.hsCoeff(), "h");
422
423 if (radiation_)
424 {
425 this->relax(radAreaP_(), cloudOldTime.radAreaP(), "radiation");
426 this->relax(radT4_(), cloudOldTime.radT4(), "radiation");
427 this->relax(radAreaPT4_(), cloudOldTime.radAreaPT4(), "radiation");
428 }
429}
430
431
432template<class CloudType>
434{
436
437 this->scale(hsTrans_(), "h");
438 this->scale(hsCoeff_(), "h");
439
440 if (radiation_)
441 {
442 this->scale(radAreaP_(), "radiation");
443 this->scale(radT4_(), "radiation");
444 this->scale(radAreaPT4_(), "radiation");
445 }
446}
447
448
449template<class CloudType>
451(
452 const typename parcelType::trackingData& td
453)
454{
456
457 this->pAmbient() = thermo_.thermo().p().average().value();
458}
459
460
461template<class CloudType>
463{
464 if (this->solution().canEvolve())
465 {
466 typename parcelType::trackingData td(*this);
467
468 this->solve(*this, td);
469 }
470}
471
472
473template<class CloudType>
475{
477
478 this->updateMesh();
479}
480
481
482template<class CloudType>
484{
486
487 Info<< " Temperature min/max = " << Tmin() << ", " << Tmax()
488 << endl;
489}
490
491
492// ************************************************************************* //
const uniformDimensionedVectorField & g
void autoMap(const mapPolyMesh &)
Remap the cells of particles corresponding to the.
Definition: Cloud.C:308
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:75
void info() const
Print cloud information.
Definition: DSMCCloud.C:940
Templated class to calculate the fluid-particle heat transfer coefficients based on a specified Nusse...
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:170
const word & name() const noexcept
Return the object name.
Definition: IOobjectI.H:65
const objectRegistry & db() const noexcept
Return the local objectRegistry.
Definition: IOobject.C:500
void relaxSources(const KinematicCloud< CloudType > &cloudOldTime)
Apply relaxation to (steady state) cloud sources.
void setParcelThermoProperties(parcelType &parcel, const scalar lagrangianDt)
Set parcel thermo properties.
void checkParcelProperties(parcelType &parcel, const scalar lagrangianDt, const bool fullyDescribed)
Check parcel properties.
void scaleSources()
Apply scaling to (transient) cloud sources.
void preEvolve(const typename parcelType::trackingData &td)
Pre-evolve.
void resetSourceTerms()
Reset the cloud source terms.
Thermo package for (S)olids (L)iquids and (G)ases Takes reference to thermo package,...
Definition: SLGThermo.H:67
Templated base class for thermodynamic cloud.
Definition: ThermoCloud.H:70
volScalarField::Internal & radAreaP()
Radiation sum of parcel projected areas [m2].
Definition: ThermoCloudI.H:105
void setModels()
Set cloud sub-models.
Definition: ThermoCloud.C:37
volScalarField::Internal & hsCoeff()
Return coefficient for carrier phase hs equation.
Definition: ThermoCloudI.H:211
volScalarField::Internal & radAreaPT4()
Radiation sum of parcel projected area*temperature^4 [m2K4].
Definition: ThermoCloudI.H:165
void storeState()
Store the current cloud state.
Definition: ThermoCloud.C:376
void setParcelThermoProperties(parcelType &parcel, const scalar lagrangianDt)
Set parcel thermo properties.
Definition: ThermoCloud.C:351
void checkParcelProperties(parcelType &parcel, const scalar lagrangianDt, const bool fullyDescribed)
Check parcel properties.
Definition: ThermoCloud.C:365
volScalarField::Internal & radT4()
Radiation sum of parcel temperature^4 [K4].
Definition: ThermoCloudI.H:135
void relaxSources(const ThermoCloud< CloudType > &cloudOldTime)
Apply relaxation to (steady state) cloud sources.
Definition: ThermoCloud.C:414
autoPtr< volScalarField::Internal > radT4_
Radiation sum of parcel temperature^4.
Definition: ThermoCloud.H:144
void scaleSources()
Apply scaling to (transient) cloud sources.
Definition: ThermoCloud.C:433
CloudType::particleType parcelType
Type of parcel the cloud was instantiated for.
Definition: ThermoCloud.H:79
Switch radiation_
Include radiation.
Definition: ThermoCloud.H:138
virtual void autoMap(const mapPolyMesh &)
Remap the cells of particles corresponding to the.
Definition: ThermoCloud.C:474
void cloudReset(ThermoCloud< CloudType > &c)
Reset state of cloud.
Definition: ThermoCloud.C:116
void evolve()
Evolve the cloud.
Definition: ThermoCloud.C:462
autoPtr< volScalarField::Internal > radAreaPT4_
Radiation sum of parcel projected areas * temperature^4.
Definition: ThermoCloud.H:147
volScalarField::Internal & hsTrans()
Sensible enthalpy transfer [J/kg].
Definition: ThermoCloudI.H:195
void preEvolve(const typename parcelType::trackingData &td)
Pre-evolve.
Definition: ThermoCloud.C:451
void info()
Print cloud information.
Definition: ThermoCloud.C:483
void restoreState()
Reset the current cloud to the previously stored state.
Definition: ThermoCloud.C:389
void resetSourceTerms()
Reset the cloud source terms.
Definition: ThermoCloud.C:397
autoPtr< volScalarField::Internal > radAreaP_
Radiation sum of parcel projected areas.
Definition: ThermoCloud.H:141
Class used to pass data into container.
Reads fields from the time directories and adds them to the mesh database for further post-processing...
Definition: readFields.H:158
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:162
const Time & time() const noexcept
Return time registry.
Selector class for relaxation factors, solver type and solution.
Definition: solution.H:66
Virtual abstract base class for templated ThermoCloud.
Definition: thermoCloud.H:51
Basic thermodynamics type based on the use of fitting functions for cp, h, s obtained from the templa...
A class for handling words, derived from Foam::string.
Definition: word.H:68
U
Definition: pEqn.H:72
volScalarField & p
const volScalarField & T
UEqn relax()
const volScalarField & mu
dynamicFvMesh & mesh
word timeName
Definition: getTimeIndex.H:3
dimensionedSymmTensor sqr(const dimensionedVector &dv)
const dimensionSet dimEnergy
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:52
const dimensionSet dimArea(sqr(dimLength))
Definition: dimensionSets.H:59
messageStream Info
Information stream (stdout output on master, null elsewhere)
void readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const wordHashSet &selectedFields, LIFOStack< regIOobject * > &storedObjects)
Read the selected GeometricFields of the templated type.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
const dimensionSet dimTemperature(0, 0, 0, 1, 0, 0, 0)
Definition: dimensionSets.H:54
dimensionedScalar pow4(const dimensionedScalar &ds)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
CEqn solve()
const word cloudName(propsDict.get< word >("cloud"))