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-2026 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  //- Constrain buoyancy and surface tension fluxes
198  // for fixed flux boundary conditions
199  void constrainFixedFlux
200  (
201  surfaceScalarField& pbByAlphaf,
202  surfaceScalarField& pbByAlphaGradRhof,
203  surfaceScalarField& phip
204  );
205 
206  //- Correct the cached Courant number
207  void correctCoNum();
208 
209  // Solve the explicit continuity equation for the film volume-fraction
210  // to predict the film thickness
211  void continuityPredictor();
212 
213  // Calculate the continuity error caused by limiting alpha
214  void correctContinuityError();
215 
216  //- Print the continuity errors
217  void continuityErrors();
218 
219  //- Update film thickness delta from the film volume-fraction
220  void correctDelta();
221 
222  //- Construct the film volume-fraction elliptic equation
223  // and correct the film thickness
224  void correctAlpha();
225 
226  //- Buoyant pressure divided by alpha*density
227  tmp<surfaceScalarField> pbByAlphaRhof() const;
228 
229  //- Buoyant pressure divided by alpha
230  tmp<surfaceScalarField> pbByAlphaf() const;
231 
232  //- Buoyant pressure divided by alpha*grad(rho)
233  tmp<surfaceScalarField> pbByAlphaGradRhof() const;
234 
235  //- Capillary pressure
236  tmp<volScalarField> pc(const volScalarField& sigma) const;
237 
238  //- External pressure
239  // Adjacent region fluid pressure
240  // Accumulated Lagrangian particle impingement pressure
241  tmp<volScalarField> pe() const;
242 
243  //- Contact force obtained from the given surface tension coefficient
244  // and the contact angle distribution from the wall delta patch field
245  tmp<volVectorField::Internal> contactForce
246  (
247  const volScalarField& sigma
248  ) const;
249 
250 
251 protected:
252 
253  // Protected Member Functions
254 
255  //- Return true if the solver's dependencies have been modified
256  virtual bool dependenciesModified() const;
257 
258  //- Read controls
259  virtual bool read();
260 
261 
262 public:
263 
264  // Public Data
265 
266  //- Acceleration due to gravity
267  const uniformDimensionedVectorField g;
268 
269  //- Film wall normal
270  const volVectorField& nHat;
271 
272  //- Film cell cross-sectional area magnitude
274 
275  //- Film cell volume/wall face area
276  const volScalarField& VbyA;
277 
278  //- Film thickness
279  const volScalarField& delta;
280 
281  //- Film volume fraction in the cell layer
282  const volScalarField& alpha;
283 
284  //- Reference to the fluid thermophysical properties
285  const rhoFluidThermo& thermo;
286 
287  //- Reference to the thermodynamic density field
288  const volScalarField& rho;
289 
290  //- Reference to the film velocity field
291  const volVectorField& U;
292 
293  //- Reference to the film mass-flux field
295 
296  //- Reference to the film volumetric-flux field
297  const surfaceScalarField& phi;
298 
299 
300 protected:
301 
302  // Momentum transport
303 
304  //- Pointer to the momentum transport model
306 
307 
308 public:
309 
310  //- Runtime type information
311  TypeName("isothermalFilm");
312 
313 
314  // Constructors
315 
316  //- Construct from region mesh and thermophysical properties
318 
319  //- Construct from region mesh
321 
322  //- Disallow default bitwise copy construction
323  isothermalFilm(const isothermalFilm&) = delete;
324 
325 
326  //- Destructor
327  virtual ~isothermalFilm();
328 
329 
330  // Member Functions
331 
332  //- Return the film surface patch
333  const fvPatch& surfacePatch() const;
334 
335  //- Return the film surface patch region-region map
336  const mappedFvPatchBaseBase& surfacePatchMap() const;
337 
338  //- Return the film surface tension coefficient field
339  tmp<volScalarField> sigma() const;
340 
341  //- Return the current maximum time-step for stable solution
342  virtual scalar maxDeltaT() const;
343 
344  //- Called at the start of the time-step, before the PIMPLE loop
345  virtual void preSolve();
346 
347  //- Called at the start of the PIMPLE loop to move the mesh
348  virtual void moveMesh();
349 
350  //- Corrections that follow mesh motion
351  virtual void motionCorrector();
352 
353  //- Called at the start of the PIMPLE loop
354  virtual void prePredictor();
355 
356  //- Predict the momentum transport
357  virtual void momentumTransportPredictor();
358 
359  //- Predict thermophysical transport
360  virtual void thermophysicalTransportPredictor();
361 
362  //- Construct and optionally solve the momentum equation
363  virtual void momentumPredictor();
364 
365  //- Construct and solve the energy equation,
366  // convert to temperature
367  // and update thermophysical and transport properties
368  virtual void thermophysicalPredictor();
369 
370  //- Construct and solve the pressure equation in the PISO loop
371  virtual void pressureCorrector();
372 
373  //- Correct the momentum transport
374  virtual void momentumTransportCorrector();
375 
376  //- Correct the thermophysical transport
377  virtual void thermophysicalTransportCorrector();
378 
379  //- Called after the PIMPLE loop at the end of the time-step
380  virtual void postSolve();
381 
382 
383  // Member Operators
384 
385  //- Disallow default bitwise assignment
386  void operator=(const isothermalFilm&) = delete;
387 };
388 
389 
390 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
391 
392 } // End namespace solvers
393 } // End namespace Foam
394 
395 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
396 
397 #ifdef NoRepository
398  #include "isothermalFilmTemplates.C"
399 #endif
400 
401 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
402 
403 #endif
404 
405 // ************************************************************************* //
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:98
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:58
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 momentumTransportCorrector()
Correct the momentum transport.
virtual void prePredictor()
Called at the start of the PIMPLE loop.
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.
virtual void momentumTransportPredictor()
Predict the momentum transport.
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.
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.
virtual void thermophysicalTransportCorrector()
Correct the thermophysical transport.
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 void thermophysicalTransportPredictor()
Predict thermophysical transport.
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
Typedefs for UniformDimensionedField.