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-2015 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 "fvIOoptionList.H"
46 #include "CorrectPhi.H"
48 #include "localEulerDdtScheme.H"
49 #include "fvcSmooth.H"
50 
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 
53 int main(int argc, char *argv[])
54 {
55  #include "setRootCase.H"
56  #include "createTime.H"
57  #include "createDynamicFvMesh.H"
58  #include "initContinuityErrs.H"
59 
60  pimpleControl pimple(mesh);
61 
62  #include "createControls.H"
63  #include "createRDeltaT.H"
64  #include "createFields.H"
65  #include "createMRF.H"
66  #include "createFvOptions.H"
67 
69  (
70  IOobject
71  (
72  "rAU",
73  runTime.timeName(),
74  mesh,
75  IOobject::READ_IF_PRESENT,
76  IOobject::AUTO_WRITE
77  ),
78  mesh,
79  dimensionedScalar("rAUf", dimTime/rho.dimensions(), 1.0)
80  );
81 
82  #include "correctPhi.H"
83  #include "createUf.H"
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  gh = (g & mesh.C()) - ghRef;
129  ghf = (g & mesh.Cf()) - ghRef;
130  }
131 
132  if (mesh.changing() && correctPhi)
133  {
134  // Calculate absolute flux from the mapped surface velocity
135  phi = mesh.Sf() & Uf;
136 
137  #include "correctPhi.H"
138 
139  // Make the flux relative to the mesh motion
141 
142  mixture.correct();
143  }
144 
145  if (mesh.changing() && checkMeshCourantNo)
146  {
147  #include "meshCourantNo.H"
148  }
149  }
150 
151  #include "alphaControls.H"
152  #include "alphaEqnSubCycle.H"
153 
154  mixture.correct();
155 
156  #include "UEqn.H"
157 
158  // --- Pressure corrector loop
159  while (pimple.correct())
160  {
161  #include "pEqn.H"
162  }
163 
164  if (pimple.turbCorr())
165  {
166  turbulence->correct();
167  }
168  }
169 
170  runTime.write();
171 
172  Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
173  << " ClockTime = " << runTime.elapsedClockTime() << " s"
174  << nl << endl;
175  }
176 
177  Info<< "End\n" << endl;
178 
179  return 0;
180 }
181 
182 
183 // ************************************************************************* //
Uf
Definition: pEqn.H:78
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:51
bool LTS
Definition: createRDeltaT.H:1
Info<< "Reading field p_rgh\n"<< endl;volScalarField p_rgh(IOobject("p_rgh", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);Info<< "Reading field U\n"<< endl;volVectorField U(IOobject("U", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);Info<< "Creating phaseChangeTwoPhaseMixture\n"<< endl;autoPtr< phaseChangeTwoPhaseMixture > mixture
Definition: createFields.H:33
messageStream Info
autoPtr< compressible::turbulenceModel > turbulence
Definition: createFields.H:23
dynamicFvMesh & mesh
const dictionary & pimple
checkMeshCourantNo
Definition: readControls.H:5
static const char nl
Definition: Ostream.H:260
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:52
CMULES: Multidimensional universal limiter for explicit corrected implicit solution.
void makeRelative(surfaceScalarField &phi, const volVectorField &U)
Make the given flux relative.
Definition: fvcMeshPhi.C:74
surfaceScalarField & phi
volScalarField rAU(1.0/UEqn.A())
const dimensionedVector & g
correctPhi
Definition: readControls.H:3
moveMeshOuterCorrectors
Definition: readControls.H:8
Calculates and outputs the mean and maximum Courant Numbers.
int main(int argc, char *argv[])
Definition: postCalc.C:54
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Provides functions smooth spread and sweep which use the FaceCellWave algorithm to smooth and redistr...
U
Definition: pEqn.H:82
const surfaceScalarField & ghf
Creates and initialises the velocity velocity field Uf.
const volScalarField & gh