isothermalFilm.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) 2023 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::solvers::isothermalFilm
26 
27 Description
28  Solver module for flow of compressible isothermal liquid films
29 
30  Uses the flexible PIMPLE (PISO-SIMPLE) solution for time-resolved and
31  pseudo-transient and steady simulations.
32 
33  Optional fvModels and fvConstraints are provided to enhance the simulation
34  in many ways including adding various sources, Lagrangian
35  particles, surface film etc. and constraining or limiting the solution.
36 
37 SourceFiles
38  isothermalFilm.C
39 
40 See also
41  Foam::solver
42 
43 \*---------------------------------------------------------------------------*/
44 
45 #ifndef isothermalFilm_H
46 #define isothermalFilm_H
47 
48 #include "solver.H"
49 #include "rhoThermo.H"
52 
53 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 
55 namespace Foam
56 {
57 
58 // Forward declaration of classes
59 class surfaceTensionModel;
60 class mappedPatchBase;
61 
62 namespace solvers
63 {
64 
65 /*---------------------------------------------------------------------------*\
66  Class isothermalFilm Declaration
67 \*---------------------------------------------------------------------------*/
68 
69 class isothermalFilm
70 :
71  public solver
72 {
73  // Control parameters
74 
75  //- Maximum allowed Courant number
76  scalar maxCo;
77 
78  //- Maximum time-step
79  scalar maxDeltaT_;
80 
81 
82  // Continuity properties
83 
84  //- Current maximum Courant number for time-step control
85  scalar CoNum;
86 
87  //- Current cumulative continuity error
88  scalar cumulativeContErr;
89 
90 
91 protected:
92 
93  // Thermophysical properties
94 
95  //- Pointer to the fluid thermophysical properties
97 
98  //- Reference to the fluid thermophysical properties
100 
101  //- The thermodynamic pressure field
102  volScalarField& p;
103 
104 
105  // Film
106 
107  //- List of film wall patch IDs
109 
110  //- Film surface patch ID
111  // Set to -1 if the surface patch is empty or not coupled
113 
114  //- Film wall normal
116 
117  //- Film cell cross-sectional area magnitude
119 
120  //- Film cell volume/wall face area
122 
123  //- Bool returned by initFilmMesh()
124  bool initialised_;
125 
126  //- Film thickness
128 
129  //- Film volume fraction in the cell layer
131 
132  //- Film thickness below which the surface is considered dry
134 
135 
136  // Kinematic properties
137 
138  //- Film velocity field
140 
141  //- Film mass-flux field
143 
144  //- Film volumetric-flux field
146 
147 
148  // Interface properties
149 
150  //- Pointer to the surface tension coefficient model
152 
153  //- Set true if the surface tension coefficient is non-uniform
154  // to include the thermocapillary force
155  bool thermocapillary;
156 
157 
158  // Cached temporary fields
159 
160  //- Cached momentum matrix
161  // shared between the momentum predictor and pressure corrector
163 
164  //- Continuity error
166 
167 
168 private:
169 
170  // Private Member Functions
171 
172  //- Initialise film specific mesh topology and geometry
173  bool initFilmMesh();
174 
175  //- Helper function to map the delta BC types
176  // to the corresponding alpha BC types
177  wordList alphaTypes() const;
178 
179  //- Constrain the given field such that the flow
180  // is in the plane of the film.
181  // This involves setting the flux on the top and bottom patches to 0
182  template<class FieldType>
183  void constrainField(FieldType& field) const;
184 
185  //- Constrain a field such that the flow
186  // is in the plane of the film.
187  // This involves setting the flux on the top and bottom patches to 0
188  template<class FieldType>
189  tmp<FieldType> constrainedField(const FieldType& field) const;
190 
191  //- Constrain a field such that the flow
192  // is in the plane of the film.
193  // This involves setting the flux on the top and bottom patches to 0
194  template<class FieldType>
195  tmp<FieldType> constrainedField(const tmp<FieldType>& tfield) const;
196 
197  //- Correct the cached Courant number
198  void correctCoNum();
199 
200  // Solve the explicit continuity equation for the film volume-fraction
201  // to predict the film thickness
202  void continuityPredictor();
203 
204  // Calculate the continuity error caused by limiting alpha
205  void correctContinuityError();
206 
207  //- Print the continuity errors
208  void continuityErrors();
209 
210  //- Update film thickness delta from the film volume-fraction
211  void correctDelta();
212 
213  //- Construct the film volume-fraction elliptic equation
214  // and correct the film thickness
215  void correctAlpha();
216 
217  //- Buoyant pressure divided by alpha*density
218  tmp<surfaceScalarField> pbByAlphaRhof() const;
219 
220  //- Buoyant pressure divided by alpha
221  tmp<surfaceScalarField> pbByAlphaf() const;
222 
223  //- Buoyant pressure divided by alpha*grad(rho)
224  tmp<surfaceScalarField> pbByAlphaGradRhof() const;
225 
226  //- Capillary pressure
227  tmp<volScalarField> pc(const volScalarField& sigma) const;
228 
229  //- External pressure
230  // Adjacent region fluid pressure
231  // Accumulated Lagrangian particle impingement pressure
232  tmp<volScalarField> pe() const;
233 
234  //- Contact force obtained from the given surface tension coefficient
235  // and the contact angle distribution from the wall delta patch field
236  tmp<volVectorField::Internal> contactForce
237  (
238  const volScalarField& sigma
239  ) const;
240 
241 
242 protected:
243 
244  // Protected Member Functions
245 
246  //- Read controls
247  void readControls();
248 
249 
250 public:
251 
252  // Public Data
253 
254  //- Acceleration due to gravity
256 
257  //- Film wall normal
258  const volVectorField& nHat;
259 
260  //- Film cell cross-sectional area magnitude
262 
263  //- Film cell volume/wall face area
264  const volScalarField& VbyA;
265 
266  //- Film thickness
267  const volScalarField& delta;
268 
269  //- Film volume fraction in the cell layer
270  const volScalarField& alpha;
271 
272  //- Reference to the fluid thermophysical properties
273  const rhoThermo& thermo;
274 
275  //- Reference to the thermodynamic density field
276  const volScalarField& rho;
277 
278  //- Reference to the film velocity field
279  const volVectorField& U;
280 
281  //- Reference to the film mass-flux field
283 
284  //- Reference to the film volumetric-flux field
285  const surfaceScalarField& phi;
286 
287 
288 protected:
289 
290  // Momentum transport
291 
292  //- Pointer to the momentum transport model
294 
295 
296 public:
297 
298  //- Runtime type information
299  TypeName("isothermalFilm");
300 
301 
302  // Constructors
303 
304  //- Construct from region mesh and thermophysical properties
306 
307  //- Construct from region mesh
309 
310  //- Disallow default bitwise copy construction
311  isothermalFilm(const isothermalFilm&) = delete;
312 
313 
314  //- Destructor
315  virtual ~isothermalFilm();
316 
317 
318  // Member Functions
319 
320  //- Return the film surface patch
321  const fvPatch& surfacePatch() const;
322 
323  //- Return the film surface patch region-region map
324  const mappedPatchBase& surfacePatchMap() const;
325 
326  //- Return the film surface tension coefficient field
327  tmp<volScalarField> sigma() const;
328 
329  //- Return the current maximum time-step for stable solution
330  virtual scalar maxDeltaT() const;
331 
332  //- Called at the start of the time-step, before the PIMPLE loop
333  virtual void preSolve();
334 
335  //- Called at the start of the PIMPLE loop to move the mesh
336  virtual void moveMesh();
337 
338  //- Called at the start of the PIMPLE loop
339  virtual void prePredictor();
340 
341  //- Construct and optionally solve the momentum equation
342  virtual void momentumPredictor();
343 
344  //- Construct and solve the energy equation,
345  // convert to temperature
346  // and update thermophysical and transport properties
347  virtual void thermophysicalPredictor();
348 
349  //- Construct and solve the pressure equation in the PISO loop
350  virtual void pressureCorrector();
351 
352  //- Correct the momentum and thermophysical transport modelling
353  virtual void postCorrector();
354 
355  //- Called after the PIMPLE loop at the end of the time-step
356  virtual void postSolve();
357 
358 
359  // Member Operators
360 
361  //- Disallow default bitwise assignment
362  void operator=(const isothermalFilm&) = delete;
363 };
364 
365 
366 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
367 
368 } // End namespace solvers
369 } // End namespace Foam
370 
371 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
372 
373 #ifdef NoRepository
374  #include "isothermalFilmTemplates.C"
375 #endif
376 
377 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
378 
379 #endif
380 
381 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Generic GeometricField class.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:101
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
Engine which provides mapping between two patches.
Base-class for fluid thermodynamic properties based on density.
Definition: rhoThermo.H:55
Abstract base class for run-time selectable region solvers.
Definition: solver.H:55
const fvMesh & mesh
Region mesh.
Definition: solver.H:94
Solver module for flow of compressible isothermal liquid films.
virtual void thermophysicalPredictor()
Construct and solve the energy equation,.
isothermalFilm(fvMesh &mesh, autoPtr< rhoThermo >)
Construct from region mesh and thermophysical properties.
TypeName("isothermalFilm")
Runtime type information.
rhoThermo & thermo_
Reference to the fluid thermophysical properties.
const surfaceScalarField & phi
Reference to the film volumetric-flux field.
volVectorField U_
Film velocity field.
virtual void prePredictor()
Called at the start of the PIMPLE loop.
Definition: prePredictor.C:30
const rhoThermo & thermo
Reference to the fluid thermophysical properties.
tmp< fvVectorMatrix > tUEqn
Cached momentum matrix.
virtual void postSolve()
Called after the PIMPLE loop at the end of the time-step.
volScalarField & p
The thermodynamic pressure field.
autoPtr< filmCompressible::momentumTransportModel > momentumTransport
Pointer to the momentum transport model.
bool initialised_
Bool returned by initFilmMesh()
const volScalarField & alpha
Film volume fraction in the cell layer.
const mappedPatchBase & surfacePatchMap() const
Return the film surface patch region-region map.
virtual void moveMesh()
Called at the start of the PIMPLE loop to move the mesh.
virtual scalar maxDeltaT() const
Return the current maximum time-step for stable solution.
const volVectorField & U
Reference to the film velocity field.
tmp< volScalarField::Internal > contErr
Continuity error.
autoPtr< surfaceTensionModel > surfaceTension
Pointer to the surface tension coefficient model.
const surfaceScalarField & alphaRhoPhi
Reference to the film mass-flux field.
void operator=(const isothermalFilm &)=delete
Disallow default bitwise assignment.
virtual void pressureCorrector()
Construct and solve the pressure equation in the PISO loop.
virtual void postCorrector()
Correct the momentum and thermophysical transport modelling.
const uniformDimensionedVectorField g
Acceleration due to gravity.
surfaceScalarField alphaRhoPhi_
Film mass-flux field.
volScalarField delta_
Film thickness.
virtual void momentumPredictor()
Construct and optionally solve the momentum equation.
const volScalarField & VbyA
Film cell volume/wall face area.
bool thermocapillary
Set true if the surface tension coefficient is non-uniform.
volScalarField VbyA_
Film cell volume/wall face area.
const fvPatch & surfacePatch() const
Return the film surface patch.
surfaceScalarField phi_
Film volumetric-flux field.
void readControls()
Read controls.
tmp< volScalarField > sigma() const
Return the film surface tension coefficient field.
const volScalarField & delta
Film thickness.
const volScalarField & rho
Reference to the thermodynamic density field.
const volVectorField & nHat
Film wall normal.
volScalarField::Internal magSf_
Film cell cross-sectional area magnitude.
volVectorField nHat_
Film wall normal.
virtual void preSolve()
Called at the start of the time-step, before the PIMPLE loop.
label surfacePatchID
Film surface patch ID.
autoPtr< rhoThermo > thermoPtr_
Pointer to the fluid thermophysical properties.
const volScalarField::Internal & magSf
Film cell cross-sectional area magnitude.
virtual ~isothermalFilm()
Destructor.
dimensionedScalar deltaWet
Film thickness below which the surface is considered dry.
labelList wallPatchIDs
List of film wall patch IDs.
volScalarField alpha_
Film volume fraction in the cell layer.
A class for managing temporary objects.
Definition: tmp.H:55
Namespace for OpenFOAM.
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