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 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  // Phase-2 volumetric flux
100 
101 
102  // Cached temporary fields
103 
104  //- MULES Correction
106 
107 
108 private:
109 
110  // Private Member Functions
111 
112  //- Solve for the phase-fractions
113  void alphaSolve(const dictionary& alphaControls);
114 
115 
116 protected:
117 
118  // Protected Member Functions
119 
121  (
122  const surfaceScalarField& phi,
123  const volScalarField& alpha,
125  );
126 
127  //- Solve for the phase-fractions
128  void alphaPredictor();
129 
130  //- Calculate the alpha equation sources
131  virtual void alphaSuSp
132  (
136  ) = 0;
137 
138  //- Correct the interface properties following mesh-change
139  // and phase-fraction update
140  virtual void correctInterface() = 0;
141 
142  //- Return the interface surface tension force for the momentum equation
143  virtual tmp<surfaceScalarField> surfaceTensionForce() const = 0;
144 
145  //- Construct and solve the incompressible pressure equation
146  // in the PISO loop
148 
149 
150 public:
151 
152  //- Runtime type information
153  TypeName("twoPhaseSolver");
154 
155 
156  // Constructors
157 
158  //- Construct from region mesh
160 
161  //- Disallow default bitwise copy construction
162  twoPhaseSolver(const twoPhaseSolver&) = delete;
163 
164 
165  //- Destructor
166  virtual ~twoPhaseSolver();
167 
168 
169  // Member Functions
170 
171  //- Called at the start of the time-step, before the PIMPLE loop
172  virtual void preSolve();
173 
174  //- Called at the start of the PIMPLE loop
175  virtual void prePredictor();
176 
177 
178  // Member Operators
179 
180  //- Disallow default bitwise assignment
181  void operator=(const twoPhaseSolver&) = delete;
182 };
183 
184 
185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186 
187 } // End namespace solvers
188 } // End namespace Foam
189 
190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
191 
192 #endif
193 
194 // ************************************************************************* //
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:162
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:99
const fvMesh & mesh
Region mesh.
Definition: solver.H:101
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 2 immiscible fluids, with optional mesh motion and mesh topology changes...
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.
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 void alphaSuSp(tmp< volScalarField::Internal > &Su, tmp< volScalarField::Internal > &Sp, const dictionary &alphaControls)=0
Calculate the alpha equation sources.
virtual ~twoPhaseSolver()
Destructor.
surfaceScalarField alphaPhi2
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