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 "rhoFluidThermo.H"
52 
53 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 
55 namespace Foam
56 {
57 
58 // Forward declaration of classes
59 class surfaceTensionModel;
60 class mappedFvPatchBaseBase;
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  //- Return true if the solver's dependencies have been modified
247  virtual bool dependenciesModified() const;
248 
249  //- Read controls
250  virtual bool read();
251 
252 
253 public:
254 
255  // Public Data
256 
257  //- Acceleration due to gravity
259 
260  //- Film wall normal
261  const volVectorField& nHat;
262 
263  //- Film cell cross-sectional area magnitude
265 
266  //- Film cell volume/wall face area
267  const volScalarField& VbyA;
268 
269  //- Film thickness
270  const volScalarField& delta;
271 
272  //- Film volume fraction in the cell layer
273  const volScalarField& alpha;
274 
275  //- Reference to the fluid thermophysical properties
276  const rhoFluidThermo& thermo;
277 
278  //- Reference to the thermodynamic density field
279  const volScalarField& rho;
280 
281  //- Reference to the film velocity field
282  const volVectorField& U;
283 
284  //- Reference to the film mass-flux field
286 
287  //- Reference to the film volumetric-flux field
288  const surfaceScalarField& phi;
289 
290 
291 protected:
292 
293  // Momentum transport
294 
295  //- Pointer to the momentum transport model
297 
298 
299 public:
300 
301  //- Runtime type information
302  TypeName("isothermalFilm");
303 
304 
305  // Constructors
306 
307  //- Construct from region mesh and thermophysical properties
309 
310  //- Construct from region mesh
312 
313  //- Disallow default bitwise copy construction
314  isothermalFilm(const isothermalFilm&) = delete;
315 
316 
317  //- Destructor
318  virtual ~isothermalFilm();
319 
320 
321  // Member Functions
322 
323  //- Return the film surface patch
324  const fvPatch& surfacePatch() const;
325 
326  //- Return the film surface patch region-region map
327  const mappedFvPatchBaseBase& surfacePatchMap() const;
328 
329  //- Return the film surface tension coefficient field
330  tmp<volScalarField> sigma() const;
331 
332  //- Return the current maximum time-step for stable solution
333  virtual scalar maxDeltaT() const;
334 
335  //- Called at the start of the time-step, before the PIMPLE loop
336  virtual void preSolve();
337 
338  //- Called at the start of the PIMPLE loop to move the mesh
339  virtual void moveMesh();
340 
341  //- Corrections that follow mesh motion
342  virtual void motionCorrector();
343 
344  //- Called at the start of the PIMPLE loop
345  virtual void prePredictor();
346 
347  //- Construct and optionally solve the momentum equation
348  virtual void momentumPredictor();
349 
350  //- Construct and solve the energy equation,
351  // convert to temperature
352  // and update thermophysical and transport properties
353  virtual void thermophysicalPredictor();
354 
355  //- Construct and solve the pressure equation in the PISO loop
356  virtual void pressureCorrector();
357 
358  //- Correct the momentum and thermophysical transport modelling
359  virtual void postCorrector();
360 
361  //- Called after the PIMPLE loop at the end of the time-step
362  virtual void postSolve();
363 
364 
365  // Member Operators
366 
367  //- Disallow default bitwise assignment
368  void operator=(const isothermalFilm&) = delete;
369 };
370 
371 
372 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
373 
374 } // End namespace solvers
375 } // End namespace Foam
376 
377 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
378 
379 #ifdef NoRepository
380  #include "isothermalFilmTemplates.C"
381 #endif
382 
383 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
384 
385 #endif
386 
387 // ************************************************************************* //
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:99
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
Base class for fv patches that provide mapping between two fv patches.
Base-class for fluid thermodynamic properties based on density.
Abstract base class for run-time selectable region solvers.
Definition: solver.H:56
const fvMesh & mesh
Region mesh.
Definition: solver.H:101
Solver module for flow of compressible isothermal liquid films.
virtual void thermophysicalPredictor()
Construct and solve the energy equation,.
TypeName("isothermalFilm")
Runtime type information.
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
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.
rhoFluidThermo & thermo_
Reference to the fluid thermophysical properties.
bool initialised_
Bool returned by initFilmMesh()
virtual bool dependenciesModified() const
Return true if the solver's dependencies have been modified.
const volScalarField & alpha
Film volume fraction in the cell layer.
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 rhoFluidThermo & thermo
Reference to the fluid thermophysical properties.
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.
virtual void motionCorrector()
Corrections that follow mesh motion.
autoPtr< rhoFluidThermo > thermoPtr_
Pointer to the fluid thermophysical properties.
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.
isothermalFilm(fvMesh &mesh, autoPtr< rhoFluidThermo >)
Construct from region mesh and thermophysical properties.
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 mappedFvPatchBaseBase & surfacePatchMap() const
Return the film surface patch region-region map.
const fvPatch & surfacePatch() const
Return the film surface patch.
surfaceScalarField phi_
Film volumetric-flux field.
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.
const volScalarField::Internal & magSf
Film cell cross-sectional area magnitude.
virtual ~isothermalFilm()
Destructor.
dimensionedScalar deltaWet
Film thickness below which the surface is considered dry.
virtual bool read()
Read controls.
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