kinematicSingleLayer.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-2021 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::kinematicSingleLayer
26 
27 Description
28  Kinematic form of single-cell layer surface film model
29 
30 SourceFiles
31  kinematicSingleLayer.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef kinematicSingleLayer_H
36 #define kinematicSingleLayer_H
37 
38 #include "surfaceFilmRegionModel.H"
39 #include "fvMesh.H"
40 #include "volFields.H"
41 #include "surfaceFields.H"
42 #include "fvMatrices.H"
43 #include "pimpleControl.H"
44 #include "rhoThermo.H"
45 #include "Function1.H"
46 
47 #include "ejectionModelList.H"
48 #include "transferModelList.H"
49 #include "forceList.H"
51 
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 
54 namespace Foam
55 {
56 namespace regionModels
57 {
58 namespace surfaceFilmModels
59 {
60 
61 // Forward class declarations
62 class viscosityModel;
63 
64 /*---------------------------------------------------------------------------*\
65  Class kinematicSingleLayer Declaration
66 \*---------------------------------------------------------------------------*/
67 
69 :
71 {
72 
73 protected:
74 
75  // Protected data
76 
77  // Solution parameters
78 
80 
81  //- Cumulative continuity error
82  scalar cumulativeContErr_;
83 
84  //- Small delta
86 
87  //- Film thickness above which Courant number calculation in valid
88  scalar deltaCoLimit_;
89 
90 
91  // Thermo properties
92 
93  //- Pressure [Pa]
95 
97 
98 
99  // Fields
100 
101  //- Dynamic viscosity [Pa.s]
103 
104  //- Film thickness [m]
106 
107  //- Film volume fraction in the cell layer []
109 
110  //- Velocity - mean [m/s]
112 
113  //- Velocity - wall [m/s]
115 
116  //- Mass flux [kg m/s]
118 
119  //- Film velocity flux [m^3/s]
121 
122  //- Current continuity error caused by delta_ bounding
124 
125  //- Film coverage indicator, 1 = covered, 0 = uncovered []
127 
128 
129  // Transfer fields
130 
131  //- Film mass available for transfer to the primary region
133 
134  //- Film mass available for transfer to cloud
136 
137  //- Parcel diameters originating from film to cloud
139 
140  //- Film momentum transfer
142 
143 
144  // Source term fields
145 
146  // Film region - registered to the film region mesh
147  // Note: need boundary value mapped from primary region, and then
148  // pushed into the patch internal field
149 
150  //- Mass [kg/m^2/s]
152 
153  //- Momentum [kg/m/s^2]
155 
156  //- Pressure [Pa]
158 
159 
160  // Primary region - registered to the primary region mesh
161  // Internal use only - not read-in
162 
163  //- Primary region mass source [kg]
165 
166  //- Primary region tangential momentum source [kg m/s]
168 
169  //- Primary region normal momentum source (pressure) [kg m/s]
171 
172 
173  // Fields mapped from primary region - registered to the film region
174  // Note: need both boundary AND patch internal fields to be mapped
175 
176  //- Velocity [m/s]
178 
179  //- Density [kg/m^3]
181 
182  //- Viscosity [Pa.s]
184 
185 
186  // Sub-models
187 
188  //- Viscosity model
190 
191  //- Surface tension function
193 
194  //- Available mass for transfer via sub-models
196 
197  //- Cloud ejection
199 
200  //- Transfer with the continuous phase
202 
203  //- Momentum transport model
205 
206  //- List of film forces
208 
209 
210  // Checks
211 
212  //- Cumulative mass added via sources [kg]
213  scalar addedMassTotal_;
214 
215 
216  // Protected member functions
217 
218  //- Read control parameters from dictionary
219  virtual bool read();
220 
221  //- Reset source term fields
222  virtual void resetPrimaryRegionSourceTerms();
223 
224  //- Transfer thermo fields from the primary region to the film region
225  virtual void transferPrimaryRegionThermoFields();
226 
227  //- Transfer source fields from the primary region to the film region
228  virtual void transferPrimaryRegionSourceFields();
229 
230  //- Hydrostatic pressure coefficient
232 
233  //- Hydrostatic pressure coefficient gradient
235 
236  //- Capillary pressure
238 
239  //- Explicit pressure
241 
242  //- Correct film coverage field
243  virtual void correctCoverage();
244 
245  //- Update the film sub-models
246  virtual void updateSubmodels();
247 
248  // Update continuity error
249  virtual void updateContinuityErr();
250 
251  //- Continuity check
252  virtual void continuityCheck();
253 
254  //- Constrain a film region master/slave boundaries of a field to a
255  // given value
256  template<class Type>
258  (
259  const tmp<Type>& field,
260  const typename Type::cmptType& value
261  );
262 
263 
264  // Equations
265 
266  //- Predict delta_ from the continuity equation
267  virtual void predictDelta();
268 
269  //- Solve for film velocity
271  (
272  const volScalarField& pc,
273  const volScalarField& pe
274  );
275 
276  //- Solve for film volume fraction and thickness
277  virtual void solveAlpha
278  (
279  const fvVectorMatrix& UEqn,
280  const volScalarField& pc,
281  const volScalarField& pe
282  );
283 
284 
285 public:
286 
287  //- Runtime type information
288  TypeName("kinematicSingleLayer");
289 
290 
291  // Constructors
292 
293  //- Construct from components
295  (
296  const word& modelType,
297  const fvMesh& mesh,
298  const dimensionedVector& g,
299  const word& regionType,
300  const bool readFields = true
301  );
302 
303  //- Disallow default bitwise copy construction
305 
306 
307  //- Destructor
308  virtual ~kinematicSingleLayer();
309 
310 
311  // Member Functions
312 
313  // Solution parameters
314 
315  //- Courant number evaluation
316  virtual scalar CourantNumber() const;
317 
318  //- Return small delta
319  inline const dimensionedScalar& deltaSmall() const;
320 
321 
322  // Thermo properties
323 
324  //- Return the film density [kg/m^3]
325  inline const volScalarField& rho() const;
326 
327  //- Return const access to the dynamic viscosity [Pa.s]
328  inline const volScalarField& mu() const;
329 
330  //- Return the surface tension coefficient [kg/s^2]
331  tmp<volScalarField> sigma() const;
332 
333 
334  // Fields
335 
336  //- Return const access to the film thickness [m]
337  inline const volScalarField& delta() const;
338 
339  //- Return const access to the film volume fraction []
340  inline const volScalarField& alpha() const;
341 
342  //- Return the film velocity [m/s]
343  inline const volVectorField& U() const;
344 
345  //- Return the film flux [kg m/s]
346  inline const surfaceScalarField& phi() const;
347 
348  //- Return the film velocity flux [m^3/s]
349  inline const surfaceScalarField& phiU() const;
350 
351  //- Return the current continuity error
352  inline const volScalarField::Internal& continuityErr() const;
353 
354  //- Return the film coverage, 1 = covered, 0 = uncovered []
355  inline const volScalarField& coverage() const;
356 
357 
358  // Derived Fields
359 
360  //- Return the film surface velocity [m/s]
361  inline tmp<volVectorField::Internal> Us() const;
362 
363  //- Return the film wall velocity [m/s]
365 
366 
367  // Transfer fields - to the primary region
368 
369  //- Return mass transfer source - Eulerian phase only
370  virtual tmp<volScalarField> primaryMassTrans() const;
371 
372  //- Return the film mass available for transfer to cloud
373  virtual const volScalarField& cloudMassTrans() const;
374 
375  //- Return the parcel diameters originating from film to cloud
376  virtual const volScalarField& cloudDiameterTrans() const;
377 
378  //- Return momentum transfer source - Eulerian phase only
380 
381 
382  // External helper functions
383 
384  //- External hook to add sources to the film
385  virtual void addSources
386  (
387  const label patchi, // patchi on primary region
388  const label facei, // facei of patchi
389  const scalar massSource, // [kg]
390  const vector& momentumSource, // [kg m/s] (tang'l momentum)
391  const scalar pressureSource, // [kg m/s] (normal momentum)
392  const scalar energySource = 0 // [J]
393  );
394 
395 
396  // Source fields (read/write access)
397 
398  // Primary region
399 
400  //- Momentum [kg/m/s^2]
401  inline volVectorField& USpPrimary();
402 
403  //- Pressure [Pa]
404  inline volScalarField& pSpPrimary();
405 
406  //- Mass [kg/m^2/s]
407  inline volScalarField& rhoSpPrimary();
408 
409 
410  // Film region
411 
412  //- Momentum [kg/m/s^2]
413  inline volVectorField::Internal& USp();
414 
415  //- Pressure [Pa]
416  inline volScalarField::Internal& pSp();
417 
418  //- Mass [kg/m^2/s]
420 
421  //- Momentum [kg/m/s^2]
422  inline const volVectorField::Internal& USp() const;
423 
424  //- Pressure [Pa]
425  inline const volScalarField::Internal& pSp() const;
426 
427  //- Mass [kg/m^2/s]
428  inline const volScalarField::Internal& rhoSp() const;
429 
430 
431  // Fields mapped from primary region
432 
433  //- Velocity [m/s]
434  inline const volVectorField& UPrimary() const;
435 
436  //- Pressure [Pa]
437  inline const volScalarField& pPrimary() const;
438 
439  //- Density [kg/m^3]
440  inline const volScalarField& rhoPrimary() const;
441 
442  //- Viscosity [Pa.s]
443  inline const volScalarField& muPrimary() const;
444 
445 
446  // Sub-models
447 
448  //- Film thermo
449  inline const rhoThermo& thermo() const;
450 
451  //- Ejection
452  inline ejectionModelList& ejection();
453 
454  //- Transfer
455  inline transferModelList& transfer();
456 
457  //- Momentum transport
458  inline const momentumTransportModel& momentumTransport() const;
459 
460 
461  // Helper functions
462 
463  //- Return the current film mass
464  inline tmp<volScalarField::Internal> mass() const;
465 
466  //- Return the change in film mass due to sources/sinks
468 
469 
470  // Evolution
471 
472  //- Pre-evolve film hook
473  virtual void preEvolveRegion();
474 
475  //- Evolve the film equations
476  virtual void evolveRegion();
477 
478 
479  // Primary region source fields
480 
481  //- Return total mass source - Eulerian phase only
482  virtual tmp<volScalarField::Internal> Srho() const;
483 
484  //- Return mass source for specie i - Eulerian phase only
486  (
487  const label i
488  ) const;
489 
490  //- Return momentum source - Eulerian phase only
491  virtual tmp<volVectorField::Internal> SU() const;
492 
493  //- Return enthalpy source - Eulerian phase only
494  virtual tmp<volScalarField::Internal> Sh() const;
495 
496 
497  // I-O
498 
499  //- Provide some feedback
500  virtual void info();
501 
502 
503  // Member Operators
504 
505  //- Disallow default bitwise assignment
506  void operator=(const kinematicSingleLayer&) = delete;
507 };
508 
509 
510 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
511 
512 } // End namespace surfaceFilmModels
513 } // End namespace regionModels
514 } // End namespace Foam
515 
516 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
517 
518 #ifdef NoRepository
520 #endif
521 
522 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
523 
524 #include "kinematicSingleLayerI.H"
525 
526 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
527 
528 #endif
529 
530 // ************************************************************************* //
virtual bool read()
Read control parameters from dictionary.
Foam::surfaceFields.
const momentumTransportModel & momentumTransport() const
Momentum transport.
tmp< volScalarField::Internal > mass() const
Return the current film mass.
List container for film ejection models.
const volVectorField & U() const
Return the film velocity [m/s].
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
volScalarField primaryMassTrans_
Film mass available for transfer to the primary region.
volVectorField primaryMomentumTrans_
Film momentum transfer.
autoPtr< Function1< scalar > > sigma_
Surface tension function.
Kinematic form of single-cell layer surface film model.
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
volScalarField::Internal continuityErr_
Current continuity error caused by delta_ bounding.
void operator=(const kinematicSingleLayer &)=delete
Disallow default bitwise assignment.
virtual void transferPrimaryRegionThermoFields()
Transfer thermo fields from the primary region to the film region.
List container for film sources.
Definition: forceList.H:53
virtual void correctCoverage()
Correct film coverage field.
volVectorField::Internal USp_
Momentum [kg/m/s^2].
virtual tmp< volScalarField::Internal > Srho() const
Return total mass source - Eulerian phase only.
scalarField availableMass_
Available mass for transfer via sub-models.
volScalarField cloudDiameterTrans_
Parcel diameters originating from film to cloud.
volScalarField coverage_
Film coverage indicator, 1 = covered, 0 = uncovered [].
scalar addedMassTotal_
Cumulative mass added via sources [kg].
volVectorField USpPrimary_
Primary region tangential momentum source [kg m/s].
const volScalarField & rhoPrimary() const
Density [kg/m^3].
tmp< volVectorField::Internal > Us() const
Return the film surface velocity [m/s].
volScalarField::Internal & rhoSp()
Mass [kg/m^2/s].
virtual tmp< volScalarField > primaryMassTrans() const
Return mass transfer source - Eulerian phase only.
virtual tmp< volScalarField::Internal > SYi(const label i) const
Return mass source for specie i - Eulerian phase only.
tmp< surfaceScalarField > rhog() const
Hydrostatic pressure coefficient.
virtual void evolveRegion()
Evolve the film equations.
virtual tmp< fvVectorMatrix > solveMomentum(const volScalarField &pc, const volScalarField &pe)
Solve for film velocity.
const volScalarField & muPrimary() const
Viscosity [Pa.s].
virtual void transferPrimaryRegionSourceFields()
Transfer source fields from the primary region to the film region.
tmp< volVectorField::Internal > Uw() const
Return the film wall velocity [m/s].
const volVectorField & UPrimary() const
Velocity [m/s].
dynamicFvMesh & mesh
const volScalarField & mu() const
Return const access to the dynamic viscosity [Pa.s].
virtual tmp< volVectorField > primaryMomentumTrans() const
Return momentum transfer source - Eulerian phase only.
virtual const volScalarField & cloudMassTrans() const
Return the film mass available for transfer to cloud.
const surfaceScalarField & phiU() const
Return the film velocity flux [m^3/s].
A class for handling words, derived from string.
Definition: word.H:59
virtual const volScalarField & cloudDiameterTrans() const
Return the parcel diameters originating from film to cloud.
const dimensionedScalar & deltaSmall() const
Return small delta.
const volScalarField & coverage() const
Return the film coverage, 1 = covered, 0 = uncovered [].
const surfaceScalarField & phi() const
Return the film flux [kg m/s].
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
virtual void solveAlpha(const fvVectorMatrix &UEqn, const volScalarField &pc, const volScalarField &pe)
Solve for film volume fraction and thickness.
const volScalarField::Internal & continuityErr() const
Return the current continuity error.
volScalarField pSpPrimary_
Primary region normal momentum source (pressure) [kg m/s].
volVectorField::Internal & USp()
Momentum [kg/m/s^2].
autoPtr< momentumTransportModel > momentumTransport_
Momentum transport model.
const volScalarField & pPrimary() const
Pressure [Pa].
List container for film transfer models.
const dimensionedVector & g() const
Return the acceleration due to gravity.
virtual void resetPrimaryRegionSourceTerms()
Reset source term fields.
const volScalarField & delta() const
Return const access to the film thickness [m].
tmp< volScalarField > sigma() const
Return the surface tension coefficient [kg/s^2].
transferModelList transfer_
Transfer with the continuous phase.
kinematicSingleLayer(const word &modelType, const fvMesh &mesh, const dimensionedVector &g, const word &regionType, const bool readFields=true)
Construct from components.
virtual void updateSubmodels()
Update the film sub-models.
label patchi
virtual void predictDelta()
Predict delta_ from the continuity equation.
Pimple control class. Provides time-loop control methods which exit the simulation once convergence c...
Definition: pimpleControl.H:74
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
volScalarField alpha_
Film volume fraction in the cell layer [].
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
A special matrix type and solver, designed for finite volume solutions of scalar equations.
Base-class for fluid thermodynamic properties based on density.
Definition: rhoThermo.H:52
TypeName("kinematicSingleLayer")
Runtime type information.
tmp< surfaceScalarField > gGradRho() const
Hydrostatic pressure coefficient gradient.
volScalarField rhoSpPrimary_
Primary region mass source [kg].
surfaceScalarField phiU_
Film velocity flux [m^3/s].
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
virtual void addSources(const label patchi, const label facei, const scalar massSource, const vector &momentumSource, const scalar pressureSource, const scalar energySource=0)
External hook to add sources to the film.
const volScalarField & rho() const
Return the film density [kg/m^3].
volVectorField::Internal Uw_
Velocity - wall [m/s].
volScalarField cloudMassTrans_
Film mass available for transfer to cloud.
rDeltaTY field()
A class for managing temporary objects.
Definition: PtrList.H:53
tmp< Type > constrainFilmField(const tmp< Type > &field, const typename Type::cmptType &value)
Constrain a film region master/slave boundaries of a field to a.
virtual tmp< volScalarField::Internal > Sh() const
Return enthalpy source - Eulerian phase only.
virtual scalar CourantNumber() const
Courant number evaluation.
autoPtr< viscosityModel > viscosity_
Viscosity model.
virtual tmp< volVectorField::Internal > SU() const
Return momentum source - Eulerian phase only.
scalar deltaCoLimit_
Film thickness above which Courant number calculation in valid.
const volScalarField & alpha() const
Return const access to the film volume fraction [].
Namespace for OpenFOAM.
fvVectorMatrix & UEqn
Definition: UEqn.H:13
tmp< volScalarField::Internal > deltaMass() const
Return the change in film mass due to sources/sinks.