kinematicSingleLayer.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 | Copyright (C) 2011-2014 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::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 "surfaceFilmModel.H"
39 #include "fvMesh.H"
40 #include "volFields.H"
41 #include "surfaceFields.H"
42 #include "fvMatrices.H"
43 
44 #include "injectionModelList.H"
45 #include "forceList.H"
46 #include "filmTurbulenceModel.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 namespace regionModels
53 {
54 namespace surfaceFilmModels
55 {
56 
57 // Forward class declarations
58 class filmThermoModel;
59 
60 /*---------------------------------------------------------------------------*\
61  Class kinematicSingleLayer Declaration
62 \*---------------------------------------------------------------------------*/
63 
65 :
66  public surfaceFilmModel
67 {
68 private:
69 
70  // Private member functions
71 
72  //- Disallow default bitwise copy construct
74 
75  //- Disallow default bitwise assignment
76  void operator=(const kinematicSingleLayer&);
77 
78 
79 protected:
80 
81  // Protected data
82 
83  // Solution parameters
84 
85  //- Momentum predictor
87 
88  //- Number of outer correctors
90 
91  //- Number of PISO-like correctors
92  label nCorr_;
93 
94  //- Number of non-orthogonal correctors
96 
97  //- Cumulative continuity error
98  scalar cumulativeContErr_;
99 
100  //- Small delta
102 
103  //- Film thickness above which Courant number calculation in valid
104  scalar deltaCoLimit_;
105 
106 
107  // Thermo properties
108 
109  // Fields
110 
111  //- Density / [kg/m3]
113 
114  //- Dynamic viscosity / [Pa.s]
116 
117  //- Surface tension / [m/s2]
119 
120 
121  // Fields
122 
123  //- Film thickness / [m]
125 
126  //- Film coverage indicator, 1 = covered, 0 = uncovered / []
128 
129  //- Velocity - mean / [m/s]
131 
132  //- Velocity - surface / [m/s]
134 
135  //- Velocity - wall / [m/s]
137 
138  //- Film thickness*density (helper field) / [kg/m2]
140 
141  //- Mass flux (includes film thickness) / [kg.m/s]
143 
144 
145  // Transfer fields
146 
147  //- Film mass available for transfer to the primary region
149 
150  //- Film mass available for transfer to cloud
152 
153  //- Parcel diameters originating from film to cloud
155 
156 
157  // Source term fields
158 
159  // Film region - registered to the film region mesh
160  // Note: need boundary value mapped from primary region, and then
161  // pushed into the patch internal field
162 
163  //- Momementum / [kg/m/s2]
165 
166  //- Pressure / [Pa]
168 
169  //- Mass / [kg/m2/s]
171 
172 
173  // Primary region - registered to the primary region mesh
174  // Internal use only - not read-in
175 
176  //- Momementum / [kg/m/s2]
178 
179  //- Pressure / [Pa]
181 
182  //- Mass / [kg/m2/s]
184 
185 
186  // Fields mapped from primary region - registered to the film region
187  // Note: need both boundary AND patch internal fields to be mapped
188 
189  //- Velocity / [m/s]
191 
192  //- Pressure / [Pa]
194 
195  //- Density / [kg/m3]
197 
198  //- Viscosity / [Pa.s]
200 
201 
202  // Sub-models
203 
204  //- Film thermo model
206 
207  //- Available mass for transfer via sub-models
209 
210  //- Cloud injection
212 
213  //- Turbulence model
215 
216  //- List of film forces
218 
219 
220  // Checks
221 
222  //- Cumulative mass added via sources [kg]
223  scalar addedMassTotal_;
224 
225 
226  // Protected member functions
227 
228  //- Read control parameters from dictionary
229  virtual bool read();
230 
231  //- Correct the thermo fields
232  virtual void correctThermoFields();
233 
234  //- Reset source term fields
235  virtual void resetPrimaryRegionSourceTerms();
236 
237  //- Transfer thermo fields from the primary region to the film region
238  virtual void transferPrimaryRegionThermoFields();
239 
240  //- Transfer source fields from the primary region to the film region
241  virtual void transferPrimaryRegionSourceFields();
242 
243  //- Explicit pressure source contribution
244  virtual tmp<volScalarField> pu();
245 
246  //- Implicit pressure source coefficient
247  virtual tmp<volScalarField> pp();
248 
249  //- Correct film coverage field
250  virtual void correctAlpha();
251 
252  //- Update the film sub-models
253  virtual void updateSubmodels();
254 
255  //- Continuity check
256  virtual void continuityCheck();
257 
258  //- Update film surface velocities
259  virtual void updateSurfaceVelocities();
260 
261  //- Constrain a film region master/slave boundaries of a field to a
262  // given value
263  template<class Type>
264  void constrainFilmField
265  (
266  Type& field,
267  const typename Type::cmptType& value
268  );
269 
270 
271  // Equations
272 
273  //- Solve continuity equation
274  virtual void solveContinuity();
275 
276  //- Solve for film velocity
278  (
279  const volScalarField& pu,
280  const volScalarField& pp
281  );
282 
283  //- Solve coupled velocity-thickness equations
284  virtual void solveThickness
285  (
286  const volScalarField& pu,
287  const volScalarField& pp,
288  const fvVectorMatrix& UEqn
289  );
290 
291 
292 public:
293 
294  //- Runtime type information
295  TypeName("kinematicSingleLayer");
296 
297 
298  // Constructors
299 
300  //- Construct from components
302  (
303  const word& modelType,
304  const fvMesh& mesh,
305  const dimensionedVector& g,
306  const word& regionType,
307  const bool readFields = true
308  );
309 
310 
311  //- Destructor
312  virtual ~kinematicSingleLayer();
313 
314 
315  // Member Functions
316 
317  // Solution parameters
318 
319  //- Courant number evaluation
320  virtual scalar CourantNumber() const;
321 
322  //- Return the momentum predictor
323  inline const Switch& momentumPredictor() const;
324 
325  //- Return the number of outer correctors
326  inline label nOuterCorr() const;
327 
328  //- Return the number of PISO correctors
329  inline label nCorr() const;
330 
331  //- Return the number of non-orthogonal correctors
332  inline label nNonOrthCorr() const;
333 
334  //- Return small delta
335  inline const dimensionedScalar& deltaSmall() const;
336 
337 
338  // Thermo properties
339 
340  //- Return const access to the dynamic viscosity / [Pa.s]
341  inline const volScalarField& mu() const;
342 
343  //- Return const access to the surface tension / [m/s2]
344  inline const volScalarField& sigma() const;
345 
346 
347  // Fields
348 
349  //- Return const access to the film thickness / [m]
350  inline const volScalarField& delta() const;
351 
352  //- Return the film coverage, 1 = covered, 0 = uncovered / []
353  inline const volScalarField& alpha() const;
354 
355  //- Return the film velocity [m/s]
356  virtual const volVectorField& U() const;
357 
358  //- Return the film surface velocity [m/s]
359  virtual const volVectorField& Us() const;
360 
361  //- Return the film wall velocity [m/s]
362  virtual const volVectorField& Uw() const;
363 
364  //- Return the film thickness*density (helper field) [kg/m3]
365  virtual const volScalarField& deltaRho() const;
366 
367  //- Return the film flux [kg.m/s]
368  virtual const surfaceScalarField& phi() const;
369 
370  //- Return the film density [kg/m3]
371  virtual const volScalarField& rho() const;
372 
373  //- Return the film mean temperature [K]
374  virtual const volScalarField& T() const;
375 
376  //- Return the film surface temperature [K]
377  virtual const volScalarField& Ts() const;
378 
379  //- Return the film wall temperature [K]
380  virtual const volScalarField& Tw() const;
381 
382  //- Return the film specific heat capacity [J/kg/K]
383  virtual const volScalarField& Cp() const;
384 
385  //- Return the film thermal conductivity [W/m/K]
386  virtual const volScalarField& kappa() const;
387 
388 
389  // Transfer fields - to the primary region
390 
391  //- Return mass transfer source - Eulerian phase only
392  virtual tmp<volScalarField> primaryMassTrans() const;
393 
394  //- Return the film mass available for transfer to cloud
395  virtual const volScalarField& cloudMassTrans() const;
396 
397  //- Return the parcel diameters originating from film to cloud
398  virtual const volScalarField& cloudDiameterTrans() const;
399 
400 
401  // External helper functions
402 
403  //- External hook to add sources to the film
404  virtual void addSources
405  (
406  const label patchI, // patchI on primary region
407  const label faceI, // faceI of patchI
408  const scalar massSource, // [kg]
409  const vector& momentumSource, // [kg.m/s] (tang'l momentum)
410  const scalar pressureSource, // [kg.m/s] (normal momentum)
411  const scalar energySource = 0 // [J]
412  );
413 
414 
415  // Source fields (read/write access)
416 
417  // Primary region
418 
419  //- Momementum / [kg/m/s2]
420  inline volVectorField& USpPrimary();
421 
422  //- Pressure / [Pa]
423  inline volScalarField& pSpPrimary();
424 
425  //- Mass / [kg/m2/s]
426  inline volScalarField& rhoSpPrimary();
427 
428 
429  // Film region
430 
431  //- Momentum / [kg/m/s2]
432  inline volVectorField& USp();
433 
434  //- Pressure / [Pa]
435  inline volScalarField& pSp();
436 
437  //- Mass / [kg/m2/s]
438  inline volScalarField& rhoSp();
439 
440  //- Momentum / [kg/m/s2]
441  inline const volVectorField& USp() const;
442 
443  //- Pressure / [Pa]
444  inline const volScalarField& pSp() const;
445 
446  //- Mass / [kg/m2/s]
447  inline const volScalarField& rhoSp() const;
448 
449 
450  // Fields mapped from primary region
451 
452  //- Velocity / [m/s]
453  inline const volVectorField& UPrimary() const;
454 
455  //- Pressure / [Pa]
456  inline const volScalarField& pPrimary() const;
457 
458  //- Density / [kg/m3]
459  inline const volScalarField& rhoPrimary() const;
460 
461  //- Viscosity / [Pa.s]
462  inline const volScalarField& muPrimary() const;
463 
464 
465  // Sub-models
466 
467  //- Film thermo
468  inline const filmThermoModel& filmThermo() const;
469 
470  //- Injection
471  inline injectionModelList& injection();
472 
473  //- Turbulence
474  inline const filmTurbulenceModel& turbulence() const;
475 
476 
477  // Helper functions
478 
479  //- Return the current film mass
480  inline tmp<volScalarField> mass() const;
481 
482  //- Return the net film mass available over the next integration
483  inline tmp<volScalarField> netMass() const;
484 
485  //- Return the change in film mass due to sources/sinks
486  inline tmp<volScalarField> deltaMass() const;
487 
488  //- Return the gravity normal-to-patch component contribution
489  inline tmp<volScalarField> gNorm() const;
490 
491  //- Return the gravity normal-to-patch component contribution
492  // Clipped so that only non-zero if g & nHat_ < 0
493  inline tmp<volScalarField> gNormClipped() const;
494 
495  //- Return the gravity tangential component contributions
496  inline tmp<volVectorField> gTan() const;
497 
498 
499  // Evolution
500 
501  //- Pre-evolve film hook
502  virtual void preEvolveRegion();
503 
504  //- Evolve the film equations
505  virtual void evolveRegion();
506 
507 
508  // Source fields
509 
510  // Mapped into primary region
511 
512  //- Return total mass source - Eulerian phase only
514 
515  //- Return mass source for specie i - Eulerian phase only
517  (
518  const label i
519  ) const;
520 
521  //- Return enthalpy source - Eulerian phase only
522  virtual tmp<DimensionedField<scalar, volMesh> > Sh() const;
523 
524 
525  // I-O
526 
527  //- Provide some feedback
528  virtual void info();
529 };
530 
531 
532 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
533 
534 } // End namespace surfaceFilmModels
535 } // End namespace regionModels
536 } // End namespace Foam
537 
538 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
539 
540 #ifdef NoRepository
542 #endif
543 
544 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
545 
546 #include "kinematicSingleLayerI.H"
547 
548 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
549 
550 #endif
551 
552 // ************************************************************************* //
const volScalarField & alpha() const
Return the film coverage, 1 = covered, 0 = uncovered / [].
scalar addedMassTotal_
Cumulative mass added via sources [kg].
virtual const volScalarField & deltaRho() const
Return the film thickness*density (helper field) [kg/m3].
virtual tmp< volScalarField > primaryMassTrans() const
Return mass transfer source - Eulerian phase only.
virtual scalar CourantNumber() const
Courant number evaluation.
label nCorr() const
Return the number of PISO correctors.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Foam::surfaceFields.
volScalarField alpha_
Film coverage indicator, 1 = covered, 0 = uncovered / [].
const filmTurbulenceModel & turbulence() const
Turbulence.
const volScalarField & rhoPrimary() const
Density / [kg/m3].
virtual const volScalarField & rho() const
Return the film density [kg/m3].
autoPtr< filmThermoModel > filmThermo_
Film thermo model.
virtual void evolveRegion()
Evolve the film equations.
const dimensionedVector & g() const
Return the accleration due to gravity.
virtual const volScalarField & kappa() const
Return the film thermal conductivity [W/m/K].
const volScalarField & delta() const
Return const access to the film thickness / [m].
volScalarField cloudMassTrans_
Film mass available for transfer to cloud.
virtual tmp< volScalarField > pu()
Explicit pressure source contribution.
tmp< volScalarField > mass() const
Return the current film mass.
virtual const volScalarField & Tw() const
Return the film wall temperature [K].
const volScalarField & mu() const
Return const access to the dynamic viscosity / [Pa.s].
A class for handling words, derived from string.
Definition: word.H:59
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 const volVectorField & Uw() const
Return the film wall velocity [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:68
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, y/n, t/f, or none.
Definition: Switch.H:60
dynamicFvMesh & mesh
virtual void transferPrimaryRegionThermoFields()
Transfer thermo fields from the primary region to the film region.
virtual tmp< DimensionedField< scalar, volMesh > > Sh() const
Return enthalpy source - Eulerian phase only.
TypeName("kinematicSingleLayer")
Runtime type information.
const volVectorField & UPrimary() const
Velocity / [m/s].
void constrainFilmField(Type &field, const typename Type::cmptType &value)
Constrain a film region master/slave boundaries of a field to a.
Namespace for OpenFOAM.
virtual const volScalarField & cloudMassTrans() const
Return the film mass available for transfer to cloud.
virtual const volScalarField & Cp() const
Return the film specific heat capacity [J/kg/K].
tmp< volScalarField > deltaMass() const
Return the change in film mass due to sources/sinks.
virtual void updateSubmodels()
Update the film sub-models.
label nNonOrthCorr_
Number of non-orthogonal correctors.
tmp< volScalarField > gNormClipped() const
Return the gravity normal-to-patch component contribution.
volScalarField cloudDiameterTrans_
Parcel diameters originating from film to cloud.
const volScalarField & muPrimary() const
Viscosity / [Pa.s].
virtual void resetPrimaryRegionSourceTerms()
Reset source term fields.
virtual void correctThermoFields()
Correct the thermo fields.
virtual const volVectorField & U() const
Return the film velocity [m/s].
virtual tmp< fvVectorMatrix > solveMomentum(const volScalarField &pu, const volScalarField &pp)
Solve for film velocity.
fvVectorMatrix UEqn(fvm::ddt(rho, U)+fvm::div(phi, U)+turbulence->divDevRhoReff(U)==fvOptions(rho, U))
tmp< volVectorField > gTan() const
Return the gravity tangential component contributions.
const filmThermoModel & filmThermo() const
Film thermo.
virtual tmp< DimensionedField< scalar, volMesh > > Srho() const
Return total mass source - Eulerian phase only.
const volScalarField & sigma() const
Return const access to the surface tension / [m/s2].
const dimensionedScalar & deltaSmall() const
Return small delta.
virtual const volScalarField & T() const
Return the film mean temperature [K].
surfaceScalarField phi_
Mass flux (includes film thickness) / [kg.m/s].
tmp< volScalarField > netMass() const
Return the net film mass available over the next integration.
virtual const volScalarField & Ts() const
Return the film surface temperature [K].
virtual tmp< volScalarField > pp()
Implicit pressure source coefficient.
volVectorField & USpPrimary()
Momementum / [kg/m/s2].
volScalarField primaryMassTrans_
Film mass available for transfer to the primary region.
label nOuterCorr() const
Return the number of outer correctors.
tmp< volScalarField > gNorm() const
Return the gravity normal-to-patch component contribution.
virtual const surfaceScalarField & phi() const
Return the film flux [kg.m/s].
scalar deltaCoLimit_
Film thickness above which Courant number calculation in valid.
autoPtr< filmTurbulenceModel > turbulence_
Turbulence model.
virtual void solveThickness(const volScalarField &pu, const volScalarField &pp, const fvVectorMatrix &UEqn)
Solve coupled velocity-thickness equations.
label nNonOrthCorr() const
Return the number of non-orthogonal correctors.
virtual void transferPrimaryRegionSourceFields()
Transfer source fields from the primary region to the film region.
virtual bool read()
Read control parameters from dictionary.
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.
virtual void updateSurfaceVelocities()
Update film surface velocities.
const volScalarField & pPrimary() const
Pressure / [Pa].
This function object reads fields from the time directories and adds them to the mesh database for fu...
Definition: readFields.H:102
virtual void solveContinuity()
Solve continuity equation.
virtual const volVectorField & Us() const
Return the film surface velocity [m/s].
scalarField availableMass_
Available mass for transfer via sub-models.
const Switch & momentumPredictor() const
Return the momentum predictor.
virtual const volScalarField & cloudDiameterTrans() const
Return the parcel diameters originating from film to cloud.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
A class for managing temporary objects.
Definition: PtrList.H:118
virtual void correctAlpha()
Correct film coverage field.
A special matrix type and solver, designed for finite volume solutions of scalar equations.
volScalarField deltaRho_
Film thickness*density (helper field) / [kg/m2].