thermoSingleLayer.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 Class
25  Foam::regionModels::surfaceFilmModels::thermoSingleLayer
26 
27 Description
28  Thermodynamic form of single-cell layer surface film model
29 
30  Note: defining enthalpy as Cp(T - Tstd) - when using liquids from the
31  thermophysical library, their enthalpies are calculated similarly, where
32  Tstd = 298.15K. This is clearly non-conservative unless the heat-capacity
33  is constant and should be rewritten to use the standard thermodynamics
34  packages.
35 
36 SourceFiles
37  thermoSingleLayer.C
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef thermoSingleLayer_H
42 #define thermoSingleLayer_H
43 
44 #include "kinematicSingleLayer.H"
45 #include "SLGThermo.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 namespace regionModels
52 {
53 namespace surfaceFilmModels
54 {
55 
56 // Forward declaration of classes
57 class filmViscosityModel;
58 class heatTransferModel;
59 class phaseChangeModel;
60 class filmRadiationModel;
61 
62 /*---------------------------------------------------------------------------*\
63  Class thermoSingleLayer Declaration
64 \*---------------------------------------------------------------------------*/
65 
67 :
69 {
70  // Private member functions
71 
72  //- Disallow default bitwise copy construct
74 
75  //- Disallow default bitwise assignment
76  void operator=(const thermoSingleLayer&);
77 
78  //- Return boundary types for sensible enthalpy field
79  wordList hsBoundaryTypes();
80 
81 
82 protected:
83 
84  // Protected data
85 
86  // Thermo properties
87 
88  //- Reference to the SLGThermo
89  const SLGThermo& thermo_;
90 
91 
92  // Fields
93 
94  //- Specific heat capacity [J/kg/K]
96 
97  //- Thermal conductivity [W/m/K]
99 
100  //- Temperature - mean [K]
102 
103  //- Temperature - surface [K]
105 
106  //- Temperature - wall [K]
108 
109  //- Sensible enthalpy [J/kg]
111 
112 
113  // Transfer fields - to the primary region
114 
115  //- Film energy transfer
117 
118 
119  //- Threshold film thickness beyond which the film is considered 'wet'
120  scalar deltaWet_;
121 
122 
123  // Hyprophilic/phobic properties
124 
125  //- Activation flag
126  bool hydrophilic_;
127 
128  //- Length scale applied to deltaWet_ to determine when a wet
129  // surface becomes dry, typically 0.5
130  scalar hydrophilicDryScale_;
131 
132  //- Length scale applied to deltaWet_ to determine when a dry
133  // surface becomes wet, typically 0.001
134  scalar hydrophilicWetScale_;
135 
136 
137  // Source term fields
138 
139  // Film region - registered to the film region mesh
140  // Note: need boundary value mapped from primary region, and then
141  // pushed into the patch internal field
142 
143  //- Energy [J/m2/s]
145 
146 
147  // Primary region - registered to the primary region mesh
148  // Internal use only - not read-in
149 
150  //- Energy [J/m2/s]
152 
153 
154  // Fields mapped from primary region - registered to the film region
155  // Note: need both boundary AND patch internal fields to be mapped
156 
157  //- Temperature [K]
159 
160  //- List of specie mass fractions [0-1]
162 
163 
164  // Sub-models
165 
166  //- Viscosity model
168 
169  //- Heat transfer coefficient between film surface and primary
170  // region [W/m2/K]
172 
173  //- Heat transfer coefficient between wall and film [W/m2/K]
175 
176  //- Phase change
178 
179  //- Radiation
181 
182 
183  // Limits
184 
185  //- Minimum temperature limit (optional)
186  scalar Tmin_;
187 
188  //- Maximum temperature limit (optional)
189  scalar Tmax_;
190 
191 
192  // Protected member functions
193 
194  //- Read control parameters from dictionary
195  virtual bool read();
196 
197  //- Correct the thermo fields
198  virtual void correctThermoFields();
199 
200  //- Correct sensible enthalpy for mapped temperature fields
201  virtual void correctHsForMappedT();
202 
203  //- Correct the film surface and wall temperatures
204  virtual void updateSurfaceTemperatures();
205 
206  //- Reset source term fields
207  virtual void resetPrimaryRegionSourceTerms();
208 
209  //- Transfer thermo fields from the primary region to the film region
210  virtual void transferPrimaryRegionThermoFields();
211 
212  //- Transfer source fields from the primary region to the film region
213  virtual void transferPrimaryRegionSourceFields();
214 
215  //- Correct film coverage field
216  virtual void correctAlpha();
217 
218  //- Update the film sub-models
219  virtual void updateSubmodels();
220 
221  //- Return the wall/surface heat transfer term for the enthalpy equation
222  virtual tmp<fvScalarMatrix> q(volScalarField& hs) const;
223 
224 
225  // Equations
226 
227  //- Solve energy equation
228  virtual void solveEnergy();
229 
230 
231 public:
232 
233  //- Runtime type information
234  TypeName("thermoSingleLayer");
235 
236 
237  // Constructors
238 
239  //- Construct from components
241  (
242  const word& modelType,
243  const fvMesh& mesh,
244  const dimensionedVector& g,
245  const word& regionType,
246  const bool readFields = true
247  );
248 
249 
250  //- Destructor
251  virtual ~thermoSingleLayer();
252 
253 
254  // Member Functions
255 
256  // Thermo properties
257 
258  //- Return const reference to the SLGThermo object
259  inline const SLGThermo& thermo() const;
260 
261 
262  // Fields
263 
264  //- Return the film specific heat capacity [J/kg/K]
265  virtual const volScalarField& Cp() const;
266 
267  //- Return the film thermal conductivity [W/m/K]
268  virtual const volScalarField& kappa() const;
269 
270  //- Return the film mean temperature [K]
271  virtual const volScalarField& T() const;
272 
273  //- Return the film surface temperature [K]
274  virtual const volScalarField& Ts() const;
275 
276  //- Return the film wall temperature [K]
277  virtual const volScalarField& Tw() const;
278 
279  //- Return the film sensible enthalpy [J/kg]
280  virtual const volScalarField& hs() const;
281 
282 
283  // Helper functions
284 
285  //- Return sensible enthalpy as a function of temperature
286  // for a patch
287  inline tmp<scalarField> hs
288  (
289  const scalarField& T,
290  const label patchi
291  ) const;
292 
293  //- Return sensible enthalpy as a function of temperature
294  inline tmp<volScalarField> hs
295  (
296  const volScalarField& T
297  ) const;
298 
299  //- Return temperature as a function of sensible enthalpy
300  inline tmp<volScalarField> T
301  (
302  const volScalarField& hs
303  ) const;
304 
305 
306  // Source fields (read/write access)
307 
308  //- External hook to add sources to the film
309  virtual void addSources
310  (
311  const label patchi, // patchi on primary region
312  const label facei, // facei of patchi
313  const scalar massSource, // [kg]
314  const vector& momentumSource, // [kg.m/s] (tangential momentum)
315  const scalar pressureSource, // [kg.m/s] (normal momentum)
316  const scalar energySource // [J]
317  );
318 
319 
320  // Source term fields
321 
322  // Film region
323 
324  //- Energy [J/m2/s]
325  inline const volScalarField& hsSp() const;
326 
327 
328  // Primary region
329 
330  //- Energy [J/m2/s]
331  inline const volScalarField& hsSpPrimary() const;
332 
333 
334  // Fields mapped from the primary region
335 
336  //- Temperature [K]
337  inline const volScalarField& TPrimary() const;
338 
339  //- Specie mass fractions [0-1]
340  inline const PtrList<volScalarField>& YPrimary() const;
341 
342 
343 
344  // Sub-models
345 
346  //- Return const access to the (surface) heat transfer model
347  inline const heatTransferModel& htcs() const;
348 
349  //- Return const access to the (wall) heat transfer model
350  inline const heatTransferModel& htcw() const;
351 
352  //- Return const access to the phase change model
353  inline const phaseChangeModel& phaseChange() const;
354 
355  //- Return const access to the radiation model
356  inline const filmRadiationModel& radiation() const;
357 
358 
359  // Derived fields (calculated on-the-fly)
360 
361  //- Return the convective heat energy from film to wall
362  inline tmp<scalarField> Qconvw(const label patchi) const;
363 
364  //- Return the convective heat energy from primary region to film
365  inline tmp<scalarField> Qconvp(const label patchi) const;
366 
367 
368  // Evolution
369 
370  //- Pre-evolve film hook
371  virtual void preEvolveRegion();
372 
373  //- Evolve the film equations
374  virtual void evolveRegion();
375 
376 
377  // Source fields
378 
379  // Mapped into primary region
380 
381  //- Return total mass source - Eulerian phase only
382  virtual tmp<volScalarField::Internal> Srho() const;
383 
384  //- Return mass source for specie i - Eulerian phase only
386  (
387  const label i
388  ) const;
389 
390  //- Return enthalpy source - Eulerian phase only
391  virtual tmp<volScalarField::Internal> Sh() const;
392 
393 
394  // I-O
395 
396  //- Provide some feedback
397  virtual void info();
398 };
399 
400 
401 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
402 
403 } // End namespace surfaceFilmModels
404 } // End namespace regionModels
405 } // End namespace Foam
406 
407 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
408 
409 #include "thermoSingleLayerI.H"
410 
411 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
412 
413 #endif
414 
415 // ************************************************************************* //
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].
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
virtual void resetPrimaryRegionSourceTerms()
Reset source term fields.
Kinematic form of single-cell layer surface film model.
scalar Tmax_
Maximum temperature limit (optional)
void readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const HashSet< word > &selectedFields, LIFOStack< regIOobject *> &storedObjects)
Read the selected GeometricFields of the specified type.
Definition: ReadFields.C:244
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.
tmp< scalarField > Qconvp(const label patchi) const
Return the convective heat energy from primary region to film.
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.
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.
scalar hydrophilicDryScale_
Length scale applied to deltaWet_ to determine when a wet.
A class for handling words, derived from string.
Definition: word.H:59
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:62
scalar hydrophilicWetScale_
Length scale applied to deltaWet_ to determine when a dry.
virtual const volScalarField & Ts() const
Return the film surface temperature [K].
scalar Tmin_
Minimum temperature limit (optional)
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 accleration 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.
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.
label patchi
scalar deltaWet_
Threshold film thickness beyond which the film is considered &#39;wet&#39;.
volScalarField Cp_
Specific heat capacity [J/kg/K].
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: List.H:63
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.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
A class for managing temporary objects.
Definition: PtrList.H:53
const filmRadiationModel & radiation() const
Return const access to the radiation model.
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.
tmp< scalarField > Qconvw(const label patchi) const
Return the convective heat energy from film to wall.
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].