twoPhaseSolver.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::twoPhaseSolver
26 
27 Description
28  Solver module base-class for for 2 immiscible fluids, with optional
29  mesh motion and mesh topology changes including adaptive re-meshing.
30 
31  The momentum and other fluid properties are of the "mixture" and a single
32  momentum equation is solved.
33 
34  Either mixture or two-phase transport modelling may be selected. In the
35  mixture approach a single laminar, RAS or LES model is selected to model the
36  momentum stress. In the Euler-Euler two-phase approach separate laminar,
37  RAS or LES selected models are selected for each of the phases.
38 
39  Uses the flexible PIMPLE (PISO-SIMPLE) solution for time-resolved and
40  pseudo-transient and steady simulations.
41 
42  Optional fvModels and fvConstraints are provided to enhance the simulation
43  in many ways including adding various sources, Lagrangian
44  particles, surface film etc. and constraining or limiting the solution.
45 
46 SourceFiles
47  twoPhaseSolver.C
48 
49 See also
50  Foam::solvers::fluidSolver
51 
52 \*---------------------------------------------------------------------------*/
53 
54 #ifndef twoPhaseSolver_H
55 #define twoPhaseSolver_H
56 
57 #include "VoFSolver.H"
58 #include "twoPhaseVoFMixture.H"
59 
60 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
61 
62 namespace Foam
63 {
64 namespace solvers
65 {
66 
67 /*---------------------------------------------------------------------------*\
68  Class twoPhaseSolver Declaration
69 \*---------------------------------------------------------------------------*/
70 
71 class twoPhaseSolver
72 :
73  public VoFSolver
74 {
75 
76 protected:
77 
78  // Phase properties
79 
80  //- Reference to the twoPhaseVoFMixture
82 
83  //- Reference to the phase1-fraction
85 
86  //- Reference to the phase2-fraction
88 
89  //- Switch indicating if this is a restart
90  bool alphaRestart;
91 
92 
93  // Kinematic properties
94 
95  // Phase-1 volumetric flux
97 
98 
99  // Cached temporary fields
100 
101  //- MULES Correction
103 
104 
105 private:
106 
107  // Private Member Functions
108 
109  //- Solve for the phase-fractions
110  void alphaSolve(const dictionary& alphaControls);
111 
112 
113 protected:
114 
115  // Protected Member Functions
116 
118  (
119  const surfaceScalarField& phi,
120  const volScalarField& alpha,
122  );
123 
124  //- Solve for the phase-fractions
125  void alphaPredictor();
126 
127  //- Calculate the alpha equation sources
128  virtual void alphaSuSp
129  (
132  ) = 0;
133 
134  //- Correct the interface properties following mesh-change
135  // and phase-fraction update
136  virtual void correctInterface() = 0;
137 
138  //- Return the interface surface tension force for the momentum equation
139  virtual tmp<surfaceScalarField> surfaceTensionForce() const = 0;
140 
141  //- Construct and solve the incompressible pressure equation
142  // in the PISO loop
144 
145 
146 public:
147 
148  //- Runtime type information
149  TypeName("twoPhaseSolver");
150 
151 
152  // Constructors
153 
154  //- Construct from region mesh
156 
157  //- Disallow default bitwise copy construction
158  twoPhaseSolver(const twoPhaseSolver&) = delete;
159 
160 
161  //- Destructor
162  virtual ~twoPhaseSolver();
163 
164 
165  // Member Functions
166 
167  //- Called at the start of the time-step, before the PIMPLE loop
168  virtual void preSolve();
169 
170  //- Called at the start of the PIMPLE loop
171  virtual void prePredictor();
172 
173 
174  // Member Operators
175 
176  //- Disallow default bitwise assignment
177  void operator=(const twoPhaseSolver&) = delete;
178 };
179 
180 
181 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
182 
183 } // End namespace solvers
184 } // End namespace Foam
185 
186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
187 
188 #endif
189 
190 // ************************************************************************* //
const dictionary & alphaControls
Definition: alphaControls.H:1
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
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:101
const fvMesh & mesh
Region mesh.
Definition: solver.H:94
Base solver module base-class for the solution of immiscible fluids using a VOF (volume of fluid) pha...
Definition: VoFSolver.H:73
const surfaceScalarField & phi
Reference to the mass-flux field.
Definition: VoFSolver.H:212
Solver module base-class for for 2 immiscible fluids, with optional mesh motion and mesh topology cha...
virtual void prePredictor()
Called at the start of the PIMPLE loop.
twoPhaseSolver(fvMesh &mesh, autoPtr< twoPhaseVoFMixture >)
Construct from region mesh.
bool alphaRestart
Switch indicating if this is a restart.
virtual void alphaSuSp(tmp< volScalarField::Internal > &Su, tmp< volScalarField::Internal > &Sp)=0
Calculate the alpha equation sources.
surfaceScalarField alphaPhi1
void alphaPredictor()
Solve for the phase-fractions.
TypeName("twoPhaseSolver")
Runtime type information.
virtual tmp< surfaceScalarField > surfaceTensionForce() const =0
Return the interface surface tension force for the momentum equation.
volScalarField & alpha1
Reference to the phase1-fraction.
void operator=(const twoPhaseSolver &)=delete
Disallow default bitwise assignment.
virtual tmp< surfaceScalarField > alphaPhi(const surfaceScalarField &phi, const volScalarField &alpha, const dictionary &alphaControls)
virtual ~twoPhaseSolver()
Destructor.
tmp< surfaceScalarField > talphaPhi1Corr0
MULES Correction.
virtual void preSolve()
Called at the start of the time-step, before the PIMPLE loop.
volScalarField & alpha2
Reference to the phase2-fraction.
twoPhaseVoFMixture & mixture
Reference to the twoPhaseVoFMixture.
void incompressiblePressureCorrector(volScalarField &p)
Construct and solve the incompressible pressure equation.
virtual void correctInterface()=0
Correct the interface properties following mesh-change.
A class for managing temporary objects.
Definition: tmp.H:55
Class to represent a VoF mixture.
volScalarField alpha(IOobject("alpha", runTime.name(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
tmp< VolField< Type > > Su(const VolField< Type > &su, const VolField< Type > &vf)
Definition: fvcSup.C:44
tmp< VolField< Type > > Sp(const volScalarField &sp, const VolField< Type > &vf)
Definition: fvcSup.C:67
Namespace for OpenFOAM.
volScalarField & p