compressibleInterFoam.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) 2011-2021 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 Application
25  compressibleInterFoam
26 
27 Description
28  Solver for 2 compressible, non-isothermal immiscible fluids using a VOF
29  (volume of fluid) phase-fraction based interface capturing approach,
30  with optional mesh motion and mesh topology changes including adaptive
31  re-meshing.
32 
33  The momentum and other fluid properties are of the "mixture" and a single
34  momentum equation is solved.
35 
36  Either mixture or two-phase transport modelling may be selected. In the
37  mixture approach a single laminar, RAS or LES model is selected to model the
38  momentum stress. In the Euler-Euler two-phase approach separate laminar,
39  RAS or LES selected models are selected for each of the phases.
40 
41 \*---------------------------------------------------------------------------*/
42 
43 #include "fvCFD.H"
44 #include "dynamicFvMesh.H"
45 #include "CMULES.H"
46 #include "EulerDdtScheme.H"
47 #include "localEulerDdtScheme.H"
48 #include "CrankNicolsonDdtScheme.H"
49 #include "subCycle.H"
51 #include "noPhaseChange.H"
52 #include "pimpleControl.H"
53 #include "pressureReference.H"
54 #include "fvModels.H"
55 #include "fvConstraints.H"
56 #include "CorrectPhi.H"
57 #include "fvcSmooth.H"
58 
59 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
60 
61 int main(int argc, char *argv[])
62 {
63  #include "postProcess.H"
64 
65  #include "setRootCaseLists.H"
66  #include "createTime.H"
67  #include "createDynamicFvMesh.H"
68  #include "initContinuityErrs.H"
69  #include "createDyMControls.H"
70  #include "createFields.H"
71  #include "createFieldRefs.H"
72  #include "CourantNo.H"
73  #include "setInitialDeltaT.H"
74  #include "createUfIfPresent.H"
75 
76  // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
77  Info<< "\nStarting time loop\n" << endl;
78 
79  while (pimple.run(runTime))
80  {
81  #include "readDyMControls.H"
82 
83  if (LTS)
84  {
85  #include "setRDeltaT.H"
86  }
87  else
88  {
89  #include "CourantNo.H"
90  #include "alphaCourantNo.H"
91  #include "setDeltaT.H"
92  }
93 
94  runTime++;
95 
96  Info<< "Time = " << runTime.timeName() << nl << endl;
97 
98  // --- Pressure-velocity PIMPLE corrector loop
99  while (pimple.loop())
100  {
101  if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
102  {
103  // Store divU from the previous mesh so that it can be mapped
104  // and used in correctPhi to ensure the corrected phi has the
105  // same divergence
106  tmp<volScalarField> divU;
107 
108  if (correctPhi)
109  {
110  // Construct and register divU for mapping
111  divU = new volScalarField
112  (
113  "divU0",
115  );
116  }
117 
119 
120  mesh.update();
121 
122  if (mesh.changing())
123  {
124  gh = (g & mesh.C()) - ghRef;
125  ghf = (g & mesh.Cf()) - ghRef;
126 
127  MRF.update();
128 
129  if (correctPhi)
130  {
131  #include "correctPhi.H"
132  }
133 
134  mixture.correct();
135 
136  if (checkMeshCourantNo)
137  {
138  #include "meshCourantNo.H"
139  }
140  }
141 
142  divU.clear();
143  }
144 
145  fvModels.correct();
146 
147  #include "alphaControls.H"
149 
150  turbulence.correctPhasePhi();
151 
152  #include "UEqn.H"
153  #include "TEqn.H"
154 
155  // --- Pressure corrector loop
156  while (pimple.correct())
157  {
158  #include "pEqn.H"
159  }
160 
161  if (pimple.turbCorr())
162  {
163  turbulence.correct();
164  }
165  }
166 
167  runTime.write();
168 
169  Info<< "ExecutionTime = "
170  << runTime.elapsedCpuTime()
171  << " s\n\n" << endl;
172  }
173 
174  Info<< "End\n" << endl;
175 
176  return 0;
177 }
178 
179 
180 // ************************************************************************* //
pimpleNoLoopControl & pimple
IOMRFZoneList & MRF
tmp< GeometricField< Type, fvPatchField, volMesh > > div(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition: fvcDiv.C:47
virtual void correct()
Correct the fvModels.
Definition: fvModels.C:316
engineTime & runTime
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
virtual void preUpdateMesh()
Prepare for mesh update.
Definition: fvModels.C:240
correctPhi
checkMeshCourantNo
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:57
dynamicFvMesh & mesh
phi
Definition: correctPhi.H:3
Info<< "Reading field U\"<< endl;volVectorField U(IOobject("U", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);volScalarField rho(IOobject("rho", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE), thermo.rho());volVectorField rhoU(IOobject("rhoU", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE), rho *U);volScalarField rhoE(IOobject("rhoE", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE), rho *(e+0.5 *magSqr(U)));surfaceScalarField pos(IOobject("pos", runTime.timeName(), mesh), mesh, dimensionedScalar(dimless, 1.0));surfaceScalarField neg(IOobject("neg", runTime.timeName(), mesh), mesh, dimensionedScalar(dimless, -1.0));surfaceScalarField phi("phi", fvc::flux(rhoU));Info<< "Creating turbulence model\"<< endl;autoPtr< compressible::momentumTransportModel > turbulence(compressible::momentumTransportModel::New(rho, U, phi, thermo))
Definition: createFields.H:94
const surfaceScalarField & ghf
static const char nl
Definition: Ostream.H:260
bool LTS
Definition: createRDeltaT.H:1
moveMeshOuterCorrectors
tmp< volScalarField > divU
Definition: alphaSuSp.H:9
Foam::fvModels & fvModels
Calculates and outputs the mean and maximum Courant Numbers.
tmp< surfaceScalarField > absolute(const tmp< surfaceScalarField > &tphi, const volVectorField &U)
Return the given relative flux in absolute form.
Definition: fvcMeshPhi.C:188
U
Definition: pEqn.H:72
const volScalarField & gh
messageStream Info
const dimensionedVector & g
Execute application functionObjects to post-process existing results.
Provides functions smooth spread and sweep which use the FaceCellWave algorithm to smooth and redistr...
CMULES: Multidimensional universal limiter for explicit corrected implicit solution.
Creates and initialises the velocity field Uf if required.