incompressibleVoF.C
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) 2022-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 \*---------------------------------------------------------------------------*/
25 
26 #include "incompressibleVoF.H"
27 #include "localEulerDdtScheme.H"
28 #include "fvCorrectPhi.H"
29 #include "geometricZeroField.H"
31 
32 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
36 namespace solvers
37 {
40 }
41 }
42 
43 
44 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
45 
47 :
49  (
50  mesh,
52  ),
53 
54  mixture
55  (
57  ),
58 
59  p
60  (
61  IOobject
62  (
63  "p",
64  runTime.name(),
65  mesh,
66  IOobject::NO_READ,
67  IOobject::AUTO_WRITE
68  ),
69  p_rgh + rho*buoyancy.gh
70  ),
71 
72  pressureReference_
73  (
74  p,
75  p_rgh,
76  pimple.dict()
77  ),
78 
79  momentumTransport
80  (
81  U,
82  phi,
83  alphaPhi1,
84  mixture
85  )
86 {
87  // Read the controls
88  readControls();
89 
90  if (correctPhi || mesh.topoChanging())
91  {
92  rAU = new volScalarField
93  (
94  IOobject
95  (
96  "rAU",
97  runTime.name(),
98  mesh,
101  ),
102  mesh,
104  );
105  }
106 
107  if (!runTime.restart() || !divergent())
108  {
109  correctUphiBCs(U_, phi_, true);
110 
112  (
113  phi_,
114  U,
115  p_rgh,
116  rAU,
119  pimple
120  );
121  }
122 }
123 
124 
125 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
126 
128 {}
129 
130 
131 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
132 
134 {
136 
137  const dimensionedScalar& rho1 = mixture.rho1();
138  const dimensionedScalar& rho2 = mixture.rho2();
139 
140  // Calculate the mass-flux from the accumulated alphaPhi1
141  rhoPhi = (alphaPhi1*(rho1 - rho2) + phi*rho2);
142 
143  if (pimple.predictTransport())
144  {
145  momentumTransport.predict();
146  }
147 }
148 
149 
151 {
152  incompressiblePressureCorrector(p);
153 }
154 
155 
157 {}
158 
159 
161 {
162  if (pimple.correctTransport())
163  {
164  momentumTransport.correct();
165  }
166 }
167 
168 
169 // ************************************************************************* //
Macros for easy insertion into run-time selection tables.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:99
bool restart() const
Return true if the run is a restart, i.e. startTime != beginTime.
Definition: Time.H:428
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
const word & name() const
Return const reference to name.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:101
bool topoChanging() const
Does the mesh topology change?
Definition: fvMesh.C:635
Class to represent a mixture of two constant density phases.
Abstract base class for run-time selectable region solvers.
Definition: solver.H:55
pimpleNoLoopControl pimple
PIMPLE inner-loop controls.
Definition: solver.H:100
const Time & runTime
Time.
Definition: solver.H:97
const fvMesh & mesh
Region mesh.
Definition: solver.H:94
volScalarField & p_rgh
Reference to the buoyant pressure for buoyant cases.
Definition: VoFSolver.H:107
volVectorField U_
Velocity field.
Definition: VoFSolver.H:94
autoPtr< volScalarField > rAU
Inverse momentum equation diagonal.
Definition: VoFSolver.H:129
const volVectorField & U
Reference to the velocity field.
Definition: VoFSolver.H:209
surfaceScalarField phi_
Volumetric flux field.
Definition: VoFSolver.H:97
Buoyancy related data for the Foam::solvers::isothermalFluid solver module when solving buoyant cases...
Definition: buoyancy.H:70
bool correctPhi
Switch to correct the flux after mesh change.
Definition: fluidSolver.H:95
void readControls()
Read controls.
Definition: fluidSolver.C:45
Solver module for for 2 incompressible, isothermal immiscible fluids using a VOF (volume of fluid) ph...
virtual void thermophysicalPredictor()
Construct and solve the energy equation,.
virtual const Foam::pressureReference & pressureReference() const
Return the pressure reference.
virtual void prePredictor()
Called at the start of the PIMPLE loop.
virtual bool divergent() const
Is the flow divergent?
virtual ~incompressibleVoF()
Destructor.
virtual void pressureCorrector()
Construct and solve the pressure equation in the PISO loop.
virtual void postCorrector()
Correct the momentum and thermophysical transport modelling.
incompressibleVoF(fvMesh &mesh)
Construct from region mesh.
virtual void prePredictor()
Called at the start of the PIMPLE loop.
Solver module base-class for for 2 immiscible fluids using a VOF (volume of fluid) phase-fraction bas...
Class to represent a VoF mixture.
pimpleControl pimple(mesh)
Flux correction functions to ensure continuity.
U
Definition: pEqn.H:72
void correctPhi(surfaceScalarField &phi, const volVectorField &U, const volScalarField &p, const autoPtr< volScalarField > &rAU, const autoPtr< volScalarField > &divU, const pressureReference &pressureReference, nonOrthogonalSolutionControl &pcorrControl)
Definition: fvCorrectPhi.C:32
addToRunTimeSelectionTable(solver, compressibleMultiphaseVoF, fvMesh)
defineTypeNameAndDebug(compressibleMultiphaseVoF, 0)
Namespace for OpenFOAM.
To & refCast(From &r)
Reference type cast template function.
Definition: typeInfo.H:111
const dimensionSet dimTime
const dimensionSet dimDensity
VolField< scalar > volScalarField
Definition: volFieldsFwd.H:61
void correctUphiBCs(volVectorField &U, surfaceScalarField &phi, const bool evaluateUBCs)
If the mesh is moving correct the velocity BCs on the moving walls to.
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
dictionary dict
volScalarField & p