interDyMFoam.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011-2017 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  interDyMFoam
26 
27 Description
28  Solver for 2 incompressible, 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 \*---------------------------------------------------------------------------*/
34 
35 #include "fvCFD.H"
36 #include "dynamicFvMesh.H"
37 #include "CMULES.H"
38 #include "EulerDdtScheme.H"
39 #include "localEulerDdtScheme.H"
40 #include "CrankNicolsonDdtScheme.H"
41 #include "subCycle.H"
44 #include "pimpleControl.H"
45 #include "fvOptions.H"
46 #include "CorrectPhi.H"
47 #include "fvcSmooth.H"
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 int main(int argc, char *argv[])
52 {
53  #include "postProcess.H"
54 
55  #include "setRootCase.H"
56  #include "createTime.H"
57  #include "createDynamicFvMesh.H"
58  #include "initContinuityErrs.H"
59  #include "createControl.H"
60  #include "createTimeControls.H"
61  #include "createDyMControls.H"
62  #include "createFields.H"
63  #include "createAlphaFluxes.H"
64  #include "createFvOptions.H"
65 
67  (
68  IOobject
69  (
70  "rAU",
71  runTime.timeName(),
72  mesh,
73  IOobject::READ_IF_PRESENT,
74  IOobject::AUTO_WRITE
75  ),
76  mesh,
77  dimensionedScalar("rAUf", dimTime/rho.dimensions(), 1.0)
78  );
79 
80  #include "correctPhi.H"
81  #include "createUf.H"
82 
83  turbulence->validate();
84 
85  if (!LTS)
86  {
87  #include "CourantNo.H"
88  #include "setInitialDeltaT.H"
89  }
90 
91  // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
92  Info<< "\nStarting time loop\n" << endl;
93 
94  while (runTime.run())
95  {
96  #include "readControls.H"
97 
98  if (LTS)
99  {
100  #include "setRDeltaT.H"
101  }
102  else
103  {
104  #include "CourantNo.H"
105  #include "alphaCourantNo.H"
106  #include "setDeltaT.H"
107  }
108 
109  runTime++;
110 
111  Info<< "Time = " << runTime.timeName() << nl << endl;
112 
113  // --- Pressure-velocity PIMPLE corrector loop
114  while (pimple.loop())
115  {
116  if (pimple.firstIter() || moveMeshOuterCorrectors)
117  {
118  scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime();
119 
120  mesh.update();
121 
122  if (mesh.changing())
123  {
124  Info<< "Execution time for mesh.update() = "
125  << runTime.elapsedCpuTime() - timeBeforeMeshUpdate
126  << " s" << endl;
127 
128  // Do not apply previous time-step mesh compression flux
129  // if the mesh topology changed
130  if (mesh.topoChanging())
131  {
132  talphaPhi1Corr0.clear();
133  }
134 
135  gh = (g & mesh.C()) - ghRef;
136  ghf = (g & mesh.Cf()) - ghRef;
137  }
138 
139  if (mesh.changing() && correctPhi)
140  {
141  // Calculate absolute flux from the mapped surface velocity
142  phi = mesh.Sf() & Uf;
143 
144  #include "correctPhi.H"
145 
146  // Make the flux relative to the mesh motion
148 
149  mixture.correct();
150  }
151 
152  if (mesh.changing() && checkMeshCourantNo)
153  {
154  #include "meshCourantNo.H"
155  }
156  }
157 
158  #include "alphaControls.H"
159  #include "alphaEqnSubCycle.H"
160 
161  mixture.correct();
162 
163  #include "UEqn.H"
164 
165  // --- Pressure corrector loop
166  while (pimple.correct())
167  {
168  #include "pEqn.H"
169  }
170 
171  if (pimple.turbCorr())
172  {
173  turbulence->correct();
174  }
175  }
176 
177  runTime.write();
178 
179  Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
180  << " ClockTime = " << runTime.elapsedClockTime() << " s"
181  << nl << endl;
182  }
183 
184  Info<< "End\n" << endl;
185 
186  return 0;
187 }
188 
189 
190 // ************************************************************************* //
surfaceScalarField & phi
moveMeshOuterCorrectors
Definition: readControls.H:8
U
Definition: pEqn.H:83
const dictionary & pimple
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:253
Uf
Definition: pEqn.H:67
const surfaceScalarField & ghf
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:52
dynamicFvMesh & mesh
Creates and initialises the velocity velocity field Uf.
static const char nl
Definition: Ostream.H:262
const dimensionedVector & g
bool LTS
Definition: createRDeltaT.H:1
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("pos", dimless, 1.0));surfaceScalarField neg(IOobject("neg", runTime.timeName(), mesh), mesh, dimensionedScalar("neg", dimless, -1.0));surfaceScalarField phi("phi", fvc::flux(rhoU));Info<< "Creating turbulence model\"<< endl;autoPtr< compressible::turbulenceModel > turbulence(compressible::turbulenceModel::New(rho, U, phi, thermo))
Definition: createFields.H:94
Info<< "Reading field p_rgh\"<< endl;volScalarField p_rgh(IOobject("p_rgh", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);Info<< "Reading field U\"<< endl;volVectorField U(IOobject("U", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);Info<< "Creating phaseChangeTwoPhaseMixture\"<< endl;autoPtr< phaseChangeTwoPhaseMixture > mixture
Definition: createFields.H:33
Calculates and outputs the mean and maximum Courant Numbers.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
const volScalarField & gh
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:51
messageStream Info
checkMeshCourantNo
Definition: readControls.H:5
correctPhi
Definition: readControls.H:3
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...
Read the control parameters used by setDeltaT.
CMULES: Multidimensional universal limiter for explicit corrected implicit solution.
volScalarField rAU(1.0/UEqn.A())
tmp< surfaceScalarField > talphaPhi1Corr0