thermoSingleLayer.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) 2023 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
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 Class
28  Foam::regionModels::surfaceFilmModels::thermoSingleLayer
29 
30 Description
31  Thermodynamic form of single-cell layer surface film model
32 
33  Note: defining enthalpy as Cp(T - Tstd) - when using liquids from the
34  thermophysical library, their enthalpies are calculated similarly, where
35  Tstd = 298.15K. This is clearly non-conservative unless the heat-capacity
36  is constant and should be rewritten to use the standard thermodynamics
37  packages.
38 
39 SourceFiles
40  thermoSingleLayer.C
41 
42 \*---------------------------------------------------------------------------*/
43 
44 #ifndef Foam_thermoSingleLayer_H
45 #define Foam_thermoSingleLayer_H
46 
47 #include "kinematicSingleLayer.H"
48 #include "SLGThermo.H"
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 namespace Foam
53 {
54 namespace regionModels
55 {
56 namespace surfaceFilmModels
57 {
58 
59 // Forward declaration of classes
60 class filmViscosityModel;
61 class heatTransferModel;
62 class phaseChangeModel;
63 class filmRadiationModel;
64 
65 /*---------------------------------------------------------------------------*\
66  Class thermoSingleLayer Declaration
67 \*---------------------------------------------------------------------------*/
68 
70 :
72 {
73  // Private Member Functions
74 
75  //- No copy construct
76  thermoSingleLayer(const thermoSingleLayer&) = delete;
77 
78  //- No copy assignment
79  void operator=(const thermoSingleLayer&) = delete;
80 
81  //- Return boundary types for sensible enthalpy field
82  wordList hsBoundaryTypes();
83 
84 
85 protected:
86 
87  // Protected Data
88 
89  //- Enumerated limiter type
90  enum limitType : unsigned
91  {
92  CLAMP_NONE = 0,
93  CLAMP_MIN = 0x1,
94  CLAMP_MAX = 0x2,
96  };
97 
98 
99  // Thermo properties
100 
101  //- Reference to the SLGThermo
102  const SLGThermo& thermo_;
103 
104 
105  // Fields
106 
107  //- Specific heat capacity [J/kg/K]
109 
110  //- Thermal conductivity [W/m/K]
112 
113  //- Temperature - mean [K]
116  //- Temperature - surface [K]
118 
119  //- Temperature - wall [K]
121 
122  //- Sensible enthalpy [J/kg]
124 
126  // Transfer fields - to the primary region
127 
128  //- Film energy transfer
131 
132  //- Threshold film thickness beyond which the film is considered 'wet'
133  scalar deltaWet_;
134 
136  // Hydrophilic/phobic properties
137 
138  //- Activation flag
139  bool hydrophilic_;
141  //- Length scale applied to deltaWet_ to determine when a wet
142  // surface becomes dry, typically 0.5
143  scalar hydrophilicDryScale_;
144 
145  //- Length scale applied to deltaWet_ to determine when a dry
146  // surface becomes wet, typically 0.001
147  scalar hydrophilicWetScale_;
149 
150  // Source term fields
151 
152  // Film region - registered to the film region mesh
153  // Note: need boundary value mapped from primary region, and then
154  // pushed into the patch internal field
155 
156  //- Energy [J/m2/s]
158 
159 
160  // Primary region - registered to the primary region mesh
161  // Internal use only - not read-in
163  //- Energy [J/m2/s]
165 
166 
167  // Fields mapped from primary region - registered to the film region
168  // Note: need both boundary AND patch internal fields to be mapped
170  //- Temperature [K]
172 
173  //- List of specie mass fractions [0-1]
175 
177  // Sub-models
178 
179  //- Viscosity model
181 
182  //- Heat transfer coefficient between film surface and primary
183  // region [W/m2/K]
185 
186  //- Heat transfer coefficient between wall and film [W/m2/K]
189  //- Phase change
191 
192  //- Radiation
194 
195 
196  // Limits
198  //- Limiting type
200 
201  //- Temperature limits (optional)
203 
204 
205  // Protected Member Functions
207  //- Read control parameters from dictionary
208  virtual bool read();
209 
210  //- Correct the thermo fields
211  virtual void correctThermoFields();
212 
213  //- Correct sensible enthalpy for mapped temperature fields
214  virtual void correctHsForMappedT();
215 
216  //- Correct the film surface and wall temperatures
217  virtual void updateSurfaceTemperatures();
218 
219  //- Reset source term fields
220  virtual void resetPrimaryRegionSourceTerms();
221 
222  //- Transfer thermo fields from the primary region to the film region
223  virtual void transferPrimaryRegionThermoFields();
224 
225  //- Transfer source fields from the primary region to the film region
227 
228  //- Correct film coverage field
229  virtual void correctAlpha();
230 
231  //- Update the film sub-models
232  virtual void updateSubmodels();
233 
234  //- Return the wall/surface heat transfer term for the enthalpy equation
235  virtual tmp<fvScalarMatrix> q(volScalarField& hs) const;
237 
238  // Equations
239 
240  //- Solve energy equation
241  virtual void solveEnergy();
242 
243 
244 public:
245 
246  //- Runtime type information
247  TypeName("thermoSingleLayer");
248 
250  // Constructors
251 
252  //- Construct from components
254  (
255  const word& modelType,
256  const fvMesh& mesh,
257  const dimensionedVector& g,
258  const word& regionType,
259  const bool readFields = true
260  );
261 
262 
263  //- Destructor
264  virtual ~thermoSingleLayer();
265 
266 
267  // Member Functions
268 
269  // Thermo properties
270 
271  //- Return const reference to the SLGThermo object
272  inline const SLGThermo& thermo() const;
273 
274 
275  // Fields
276 
277  //- Return the film specific heat capacity [J/kg/K]
278  virtual const volScalarField& Cp() const;
279 
280  //- Return the film thermal conductivity [W/m/K]
281  virtual const volScalarField& kappa() const;
282 
283  //- Return the film mean temperature [K]
284  virtual const volScalarField& T() const;
285 
286  //- Return the film surface temperature [K]
287  virtual const volScalarField& Ts() const;
288 
289  //- Return the film wall temperature [K]
290  virtual const volScalarField& Tw() const;
291 
292  //- Return the film sensible enthalpy [J/kg]
293  virtual const volScalarField& hs() const;
294 
295 
296  // Helper functions
297 
298  //- Return sensible enthalpy as a function of temperature
299  // for a patch
300  inline tmp<scalarField> hs
301  (
302  const scalarField& T,
303  const label patchi
304  ) const;
305 
306  //- Return sensible enthalpy as a function of temperature
307  inline tmp<volScalarField> hs
308  (
309  const volScalarField& T
310  ) const;
311 
312  //- Return temperature as a function of sensible enthalpy
313  inline tmp<volScalarField> T
314  (
315  const volScalarField& hs
316  ) const;
317 
318 
319  // Source fields (read/write access)
320 
321  //- External hook to add sources to the film
322  virtual void addSources
323  (
324  const label patchi, // patchi on primary region
325  const label facei, // facei of patchi
326  const scalar massSource, // [kg]
327  const vector& momentumSource, // [kg.m/s] (tangential momentum)
328  const scalar pressureSource, // [kg.m/s] (normal momentum)
329  const scalar energySource // [J]
330  );
331 
332 
333  // Source term fields
334 
335  // Film region
336 
337  //- Energy [J/m2/s]
338  inline const volScalarField& hsSp() const;
339 
340 
341  // Primary region
342 
343  //- Energy [J/m2/s]
344  inline const volScalarField& hsSpPrimary() const;
345 
346 
347  // Fields mapped from the primary region
348 
349  //- Temperature [K]
350  inline const volScalarField& TPrimary() const;
351 
352  //- Specie mass fractions [0-1]
353  inline const PtrList<volScalarField>& YPrimary() const;
354 
355 
356 
357  // Sub-models
358 
359  //- Return const access to the (surface) heat transfer model
360  inline const heatTransferModel& htcs() const;
361 
362  //- Return const access to the (wall) heat transfer model
363  inline const heatTransferModel& htcw() const;
364 
365  //- Return const access to the phase change model
366  inline const phaseChangeModel& phaseChange() const;
367 
368  //- Return const access to the radiation model
369  inline const filmRadiationModel& radiation() const;
370 
371 
372  // Derived fields (calculated on-the-fly)
373 
374  //- Return the convective heat energy from film to wall
375  inline tmp<scalarField> qconvw(const label patchi) const;
376 
377  //- Return the convective heat energy from primary region to film
378  inline tmp<scalarField> qconvp(const label patchi) const;
379 
380 
381  // Evolution
382 
383  //- Pre-evolve film hook
384  virtual void preEvolveRegion();
385 
386  //- Evolve the film equations
387  virtual void evolveRegion();
388 
389 
390  // Source fields
391 
392  // Mapped into primary region
393 
394  //- Return total mass source - Eulerian phase only
395  virtual tmp<volScalarField::Internal> Srho() const;
396 
397  //- Return mass source for specie i - Eulerian phase only
399  (
400  const label i
401  ) const;
402 
403  //- Return enthalpy source - Eulerian phase only
404  virtual tmp<volScalarField::Internal> Sh() const;
405 
406 
407  // I-O
408 
409  //- Provide some feedback
410  virtual void info();
411 };
412 
413 
414 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
415 
416 } // End namespace surfaceFilmModels
417 } // End namespace regionModels
418 } // End namespace Foam
419 
420 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
421 
422 #include "thermoSingleLayerI.H"
423 
424 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
425 
426 #endif
427 
428 // ************************************************************************* //
volScalarField Ts_
Temperature - surface [K].
autoPtr< heatTransferModel > htcw_
Heat transfer coefficient between wall and film [W/m2/K].
virtual void correctAlpha()
Correct film coverage field.
const heatTransferModel & htcs() const
Return const access to the (surface) heat transfer model.
const volScalarField & hsSpPrimary() const
Energy [J/m2/s].
autoPtr< phaseChangeModel > phaseChange_
Phase change.
const volScalarField & hsSp() const
Energy [J/m2/s].
virtual const volScalarField & Cp() const
Return the film specific heat capacity [J/kg/K].
virtual void resetPrimaryRegionSourceTerms()
Reset source term fields.
Kinematic form of single-cell layer surface film model.
virtual void transferPrimaryRegionSourceFields()
Transfer source fields from the primary region to the film region.
virtual const volScalarField & kappa() const
Return the film thermal conductivity [W/m/K].
virtual void transferPrimaryRegionThermoFields()
Transfer thermo fields from the primary region to the film region.
autoPtr< heatTransferModel > htcs_
Heat transfer coefficient between film surface and primary.
virtual void updateSurfaceTemperatures()
Correct the film surface and wall temperatures.
virtual tmp< volScalarField::Internal > Srho() const
Return total mass source - Eulerian phase only.
tmp< scalarField > qconvp(const label patchi) const
Return the convective heat energy from primary region to film.
Base class for surface film phase change models.
const volScalarField & TPrimary() const
Temperature [K].
virtual tmp< fvScalarMatrix > q(volScalarField &hs) const
Return the wall/surface heat transfer term for the enthalpy equation.
virtual void updateSubmodels()
Update the film sub-models.
dynamicFvMesh & mesh
TypeName("thermoSingleLayer")
Runtime type information.
void readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const NameMatchPredicate &selectedFields, DynamicList< regIOobject *> &storedObjects)
Read the selected GeometricFields of the templated type and store on the objectRegistry.
scalar hydrophilicDryScale_
Length scale applied to deltaWet_ to determine when a wet.
A class for handling words, derived from Foam::string.
Definition: word.H:63
tmp< scalarField > qconvw(const label patchi) const
Return the convective heat energy from film to wall.
volScalarField kappa_
Thermal conductivity [W/m/K].
const PtrList< volScalarField > & YPrimary() const
Specie mass fractions [0-1].
Thermo package for (S)olids (L)iquids and (G)ases Takes reference to thermo package, and provides:
Definition: SLGThermo.H:60
scalar hydrophilicWetScale_
Length scale applied to deltaWet_ to determine when a dry.
virtual const volScalarField & Ts() const
Return the film surface temperature [K].
const phaseChangeModel & phaseChange() const
Return const access to the phase change model.
const SLGThermo & thermo_
Reference to the SLGThermo.
const dimensionedVector & g() const
Return the acceleration due to gravity.
virtual void evolveRegion()
Evolve the film equations.
virtual void addSources(const label patchi, const label facei, const scalar massSource, const vector &momentumSource, const scalar pressureSource, const scalar energySource)
External hook to add sources to the film.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
volScalarField primaryEnergyTrans_
Film energy transfer.
virtual void correctThermoFields()
Correct the thermo fields.
autoPtr< filmRadiationModel > radiation_
Radiation.
virtual bool read()
Read control parameters from dictionary.
const heatTransferModel & htcw() const
Return const access to the (wall) heat transfer model.
scalar deltaWet_
Threshold film thickness beyond which the film is considered &#39;wet&#39;.
volScalarField Cp_
Specific heat capacity [J/kg/K].
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
Definition: List.H:55
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
virtual void preEvolveRegion()
Pre-evolve film hook.
PtrList< volScalarField > YPrimary_
List of specie mass fractions [0-1].
virtual const volScalarField & hs() const
Return the film sensible enthalpy [J/kg].
autoPtr< filmViscosityModel > viscosity_
Viscosity model.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
A class for managing temporary objects.
Definition: HashPtrTable.H:50
const filmRadiationModel & radiation() const
Return const access to the radiation model.
scalarMinMax Tbounds_
Temperature limits (optional)
const SLGThermo & thermo() const
Return const reference to the SLGThermo object.
virtual void correctHsForMappedT()
Correct sensible enthalpy for mapped temperature fields.
volScalarField hs_
Sensible enthalpy [J/kg].
virtual tmp< volScalarField::Internal > Sh() const
Return enthalpy source - Eulerian phase only.
Thermodynamic form of single-cell layer surface film model.
Namespace for OpenFOAM.
Base class for film heat transfer models.
virtual const volScalarField & T() const
Return the film mean temperature [K].
virtual const volScalarField & Tw() const
Return the film wall temperature [K].