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-2022 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  const word phaseName_;
78 
79  // Solution parameters
80 
82 
83  //- Cumulative continuity error
84  scalar cumulativeContErr_;
85 
86  //- Small delta
88 
89  //- Optional maximum Courant number for stable film solution
90  scalar maxCo_;
91 
92 
93  // Thermo properties
94 
95  //- Pressure [Pa]
97 
98  //- Thermo package
100 
101 
102  // Fields
103 
104  //- Dynamic viscosity [Pa.s]
106 
107  //- Film thickness [m]
109 
110  //- Film volume fraction in the cell layer []
112 
113  //- Velocity - mean [m/s]
115 
116  //- Velocity - wall [m/s]
118 
119  //- Mass flux [kg m/s]
121 
122  //- Film velocity flux [m^3/s]
124 
125  //- Current continuity error caused by delta_ bounding
127 
128  //- Film coverage indicator, 1 = covered, 0 = uncovered []
130 
131 
132  // Transfer fields
133 
134  //- Film mass available for transfer to the primary region
136 
137  //- Film mass available for transfer to cloud
139 
140  //- Parcel diameters originating from film to cloud
142 
143  //- Film momentum transfer
145 
146 
147  // Source term fields
148 
149  // Film region - registered to the film region mesh
150  // Note: need boundary value mapped from primary region, and then
151  // pushed into the patch internal field
152 
153  //- Mass [kg/m^2/s]
155 
156  //- Momentum [kg/m/s^2]
158 
159  //- Pressure [Pa]
161 
162 
163  // Primary region - registered to the primary region mesh
164  // Internal use only - not read-in
165 
166  //- Primary region mass source [kg]
168 
169  //- Primary region tangential momentum source [kg m/s]
171 
172  //- Primary region normal momentum source (pressure) [kg m/s]
174 
175 
176  // Fields mapped from primary region - registered to the film region
177  // Note: need both boundary AND patch internal fields to be mapped
178 
179  //- Velocity [m/s]
181 
182  //- Density [kg/m^3]
184 
185  //- Viscosity [Pa.s]
187 
188 
189  // Sub-models
190 
191  //- Viscosity model
193 
194  //- Surface tension function
196 
197  //- Available mass for transfer via sub-models
199 
200  //- Cloud ejection
202 
203  //- Transfer with the continuous phase
205 
206  //- Momentum transport model
208 
209  //- List of film forces
211 
212 
213  // Checks
214 
215  //- Cumulative mass added via sources [kg]
216  scalar addedMassTotal_;
217 
218 
219  // Protected member functions
220 
221  //- Read control parameters from dictionary
222  virtual bool read();
223 
224  //- Reset source term fields
225  virtual void resetPrimaryRegionSourceTerms();
226 
227  //- Transfer thermo fields from the primary region to the film region
228  virtual void transferPrimaryRegionThermoFields();
229 
230  //- Transfer source fields from the primary region to the film region
231  virtual void transferPrimaryRegionSourceFields();
232 
233  //- Hydrostatic pressure coefficient
235 
236  //- Hydrostatic pressure coefficient gradient
238 
239  //- Capillary pressure
241 
242  //- Explicit pressure
244 
245  //- Correct film coverage field
246  virtual void correctCoverage();
247 
248  //- Update the film sub-models
249  virtual void updateSubmodels();
250 
251  // Update continuity error
252  virtual void updateContinuityErr();
253 
254  //- Continuity check
255  virtual void continuityCheck();
256 
257  //- Constrain a film region master/slave boundaries of a field to a
258  // given value
259  template<class Type>
261  (
262  const tmp<Type>& field,
263  const typename Type::cmptType& value
264  );
265 
266 
267  // Equations
268 
269  //- Predict delta_ from the continuity equation
270  virtual void predictDelta();
271 
272  //- Solve for film velocity
274  (
275  const volScalarField& pc,
276  const volScalarField& pe
277  );
278 
279  //- Solve for film volume fraction and thickness
280  virtual void solveAlpha
281  (
282  const fvVectorMatrix& UEqn,
283  const volScalarField& pc,
284  const volScalarField& pe
285  );
286 
287 
288 public:
289 
290  //- Runtime type information
291  TypeName("kinematicSingleLayer");
292 
293 
294  // Constructors
295 
296  //- Construct from components
298  (
299  const word& modelType,
300  const fvMesh& mesh,
301  const dimensionedVector& g,
302  const word& regionType,
303  const bool readFields = true
304  );
305 
306  //- Disallow default bitwise copy construction
308 
309 
310  //- Destructor
311  virtual ~kinematicSingleLayer();
312 
313 
314  // Member Functions
315 
316  // Solution parameters
317 
318  //- Courant number
319  virtual scalar CourantNumber() const;
320 
321  //- Return the maximum time-step for stable operation
322  // based on the Courant number
323  virtual scalar maxDeltaT() const;
324 
325  //- Return small delta
326  inline const dimensionedScalar& deltaSmall() const;
327 
328 
329  // Thermo properties
330 
331  //- Return the name of the phase deposited to form the film
332  inline const word& phaseName() const;
333 
334  //- Return the film density [kg/m^3]
335  inline const volScalarField& rho() const;
336 
337  //- Return const access to the dynamic viscosity [Pa.s]
338  inline const volScalarField& mu() const;
339 
340  //- Return the surface tension coefficient [kg/s^2]
341  tmp<volScalarField> sigma() const;
342 
343 
344  // Fields
345 
346  //- Return const access to the film thickness [m]
347  inline const volScalarField& delta() const;
348 
349  //- Return const access to the film volume fraction []
350  inline const volScalarField& alpha() const;
351 
352  //- Return the film velocity [m/s]
353  inline const volVectorField& U() const;
354 
355  //- Return the film flux [kg m/s]
356  inline const surfaceScalarField& phi() const;
357 
358  //- Return the film velocity flux [m^3/s]
359  inline const surfaceScalarField& phiU() const;
360 
361  //- Return the current continuity error
362  inline const volScalarField::Internal& continuityErr() const;
363 
364  //- Return the film coverage, 1 = covered, 0 = uncovered []
365  inline const volScalarField& coverage() const;
366 
367 
368  // Derived Fields
369 
370  //- Return the film surface velocity [m/s]
371  inline tmp<volVectorField::Internal> Us() const;
372 
373  //- Return the film wall velocity [m/s]
375 
376 
377  // Transfer fields - to the primary region
378 
379  //- Return mass transfer source - Eulerian phase only
380  virtual tmp<volScalarField> primaryMassTrans() const;
381 
382  //- Return the film mass available for transfer to cloud
383  virtual const volScalarField& cloudMassTrans() const;
384 
385  //- Return the parcel diameters originating from film to cloud
386  virtual const volScalarField& cloudDiameterTrans() const;
387 
388  //- Return momentum transfer source - Eulerian phase only
390 
391 
392  // External helper functions
393 
394  //- External hook to add sources to the film
395  virtual void addSources
396  (
397  const label patchi, // patchi on primary region
398  const label facei, // facei of patchi
399  const scalar massSource, // [kg]
400  const vector& momentumSource, // [kg m/s] (tang'l momentum)
401  const scalar pressureSource, // [kg m/s] (normal momentum)
402  const scalar energySource = 0 // [J]
403  );
404 
405 
406  // Source fields (read/write access)
407 
408  // Primary region
409 
410  //- Momentum [kg/m/s^2]
411  inline volVectorField& USpPrimary();
412 
413  //- Pressure [Pa]
414  inline volScalarField& pSpPrimary();
415 
416  //- Mass [kg/m^2/s]
417  inline volScalarField& rhoSpPrimary();
418 
419 
420  // Film region
421 
422  //- Momentum [kg/m/s^2]
423  inline volVectorField::Internal& USp();
424 
425  //- Pressure [Pa]
426  inline volScalarField::Internal& pSp();
427 
428  //- Mass [kg/m^2/s]
430 
431  //- Momentum [kg/m/s^2]
432  inline const volVectorField::Internal& USp() const;
433 
434  //- Pressure [Pa]
435  inline const volScalarField::Internal& pSp() const;
436 
437  //- Mass [kg/m^2/s]
438  inline const volScalarField::Internal& rhoSp() const;
439 
440 
441  // Fields mapped from primary region
442 
443  //- Velocity [m/s]
444  inline const volVectorField& UPrimary() const;
445 
446  //- Pressure [Pa]
447  inline const volScalarField& pPrimary() const;
448 
449  //- Density [kg/m^3]
450  inline const volScalarField& rhoPrimary() const;
451 
452  //- Viscosity [Pa.s]
453  inline const volScalarField& muPrimary() const;
454 
455 
456  // Sub-models
457 
458  //- Film thermo
459  inline const rhoThermo& thermo() const;
460 
461  //- Ejection
462  inline ejectionModelList& ejection();
463 
464  //- Transfer
465  inline transferModelList& transfer();
466 
467  //- Momentum transport
468  inline const momentumTransportModel& momentumTransport() const;
469 
470 
471  // Helper functions
472 
473  //- Return the current film mass
474  inline tmp<volScalarField::Internal> mass() const;
475 
476  //- Return the change in film mass due to sources/sinks
478 
479 
480  // Evolution
481 
482  //- Pre-evolve film hook
483  virtual void preEvolveRegion();
484 
485  //- Evolve the film equations
486  virtual void evolveRegion();
487 
488 
489  // Primary region source fields
490 
491  //- Return total mass source - Eulerian phase only
492  virtual tmp<volScalarField::Internal> Srho() const;
493 
494  //- Return mass source for specie i - Eulerian phase only
496  (
497  const label i
498  ) const;
499 
500  //- Return momentum source - Eulerian phase only
501  virtual tmp<volVectorField::Internal> SU() const;
502 
503  //- Return enthalpy source - Eulerian phase only
504  virtual tmp<volScalarField::Internal> Sh() const;
505 
506 
507  // I-O
508 
509  //- Provide some feedback
510  virtual void info();
511 
512 
513  // Member Operators
514 
515  //- Disallow default bitwise assignment
516  void operator=(const kinematicSingleLayer&) = delete;
517 };
518 
519 
520 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
521 
522 } // End namespace surfaceFilmModels
523 } // End namespace regionModels
524 } // End namespace Foam
525 
526 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
527 
528 #ifdef NoRepository
530 #endif
531 
532 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
533 
534 #include "kinematicSingleLayerI.H"
535 
536 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
537 
538 #endif
539 
540 // ************************************************************************* //
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].
virtual scalar maxDeltaT() const
Return the maximum time-step for stable operation.
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].
fvMesh & mesh
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 word & phaseName() const
Return the name of the phase deposited to form the film.
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].
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.
scalar maxCo_
Optional maximum Courant number for stable film solution.
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:95
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.
autoPtr< viscosityModel > viscosity_
Viscosity model.
virtual tmp< volVectorField::Internal > SU() const
Return momentum source - Eulerian phase only.
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.