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-2020 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 "pimpleControl.H"
52 #include "fvOptions.H"
53 #include "CorrectPhi.H"
54 #include "fvcSmooth.H"
55 
56 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
57 
58 int main(int argc, char *argv[])
59 {
60  #include "postProcess.H"
61 
62  #include "setRootCaseLists.H"
63  #include "createTime.H"
64  #include "createDynamicFvMesh.H"
65  #include "initContinuityErrs.H"
66  #include "createDyMControls.H"
67  #include "createFields.H"
68  #include "CourantNo.H"
69  #include "setInitialDeltaT.H"
70  #include "createUfIfPresent.H"
71 
72  volScalarField& p = mixture.p();
73  volScalarField& T = mixture.T();
74  const volScalarField& psi1 = mixture.thermo1().psi();
75  const volScalarField& psi2 = mixture.thermo2().psi();
76 
77  // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
78  Info<< "\nStarting time loop\n" << endl;
79 
80  while (pimple.run(runTime))
81  {
82  #include "readDyMControls.H"
83 
84  // Store divU from the previous mesh so that it can be mapped
85  // and used in correctPhi to ensure the corrected phi has the
86  // same divergence
88 
89  if (LTS)
90  {
91  #include "setRDeltaT.H"
92  }
93  else
94  {
95  #include "CourantNo.H"
96  #include "alphaCourantNo.H"
97  #include "setDeltaT.H"
98  }
99 
100  runTime++;
101 
102  Info<< "Time = " << runTime.timeName() << nl << endl;
103 
104  // --- Pressure-velocity PIMPLE corrector loop
105  while (pimple.loop())
106  {
107  if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
108  {
109  mesh.update();
110 
111  if (mesh.changing())
112  {
113  gh = (g & mesh.C()) - ghRef;
114  ghf = (g & mesh.Cf()) - ghRef;
115 
116  MRF.update();
117 
118  if (correctPhi)
119  {
120  // Calculate absolute flux
121  // from the mapped surface velocity
122  phi = mesh.Sf() & Uf();
123 
124  #include "correctPhi.H"
125 
126  // Make the fluxes relative to the mesh motion
128  }
129 
130  mixture.correct();
131 
132  if (checkMeshCourantNo)
133  {
134  #include "meshCourantNo.H"
135  }
136  }
137  }
138 
140 
141  #include "alphaControls.H"
143 
144  turbulence.correctPhasePhi();
145 
146  #include "UEqn.H"
147  #include "TEqn.H"
148 
149  // --- Pressure corrector loop
150  while (pimple.correct())
151  {
152  #include "pEqn.H"
153  }
154 
155  if (pimple.turbCorr())
156  {
157  turbulence.correct();
158  }
159  }
160 
161  runTime.write();
162 
163  Info<< "ExecutionTime = "
164  << runTime.elapsedCpuTime()
165  << " s\n\n" << endl;
166  }
167 
168  Info<< "End\n" << endl;
169 
170  return 0;
171 }
172 
173 
174 // ************************************************************************* //
pimpleNoLoopControl & pimple
IOMRFZoneList & MRF
tmp< GeometricField< Type, fvPatchField, volMesh > > div(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition: fvcDiv.C:47
engineTime & runTime
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
correctPhi
checkMeshCourantNo
phi
Definition: pEqn.H:104
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:57
dynamicFvMesh & mesh
autoPtr< surfaceVectorField > Uf
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
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
zeroField divU
Definition: alphaSuSp.H:3
phaseChangeTwoPhaseMixture & mixture
Definition: createFields.H:38
const dimensionedVector & g
Execute application functionObjects to post-process existing results.
void makeRelative(surfaceScalarField &phi, const volVectorField &U)
Make the given flux relative.
Definition: fvcMeshPhi.C:75
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.