multiphaseInterDyMFoam.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  multiphaseInterFoam
26 
27 Description
28  Solver for n incompressible fluids which captures the interfaces and
29  includes surface-tension and contact-angle effects for each phase.
30 
31  Turbulence modelling is generic, i.e. laminar, RAS or LES may be selected.
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #include "fvCFD.H"
36 #include "dynamicFvMesh.H"
37 #include "multiphaseMixture.H"
39 #include "pimpleControl.H"
40 #include "fvIOoptionList.H"
41 #include "CorrectPhi.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 int main(int argc, char *argv[])
47 {
48  #include "setRootCase.H"
49  #include "createTime.H"
50  #include "createDynamicFvMesh.H"
51  #include "initContinuityErrs.H"
52 
53  pimpleControl pimple(mesh);
54 
55  #include "createControls.H"
56  #include "createFields.H"
57  #include "createMRF.H"
58  #include "createFvOptions.H"
59 
61  (
62  IOobject
63  (
64  "rAU",
65  runTime.timeName(),
66  mesh,
67  IOobject::READ_IF_PRESENT,
68  IOobject::AUTO_WRITE
69  ),
70  mesh,
71  dimensionedScalar("rAUf", dimTime/rho.dimensions(), 1.0)
72  );
73 
74  #include "correctPhi.H"
75  #include "createUf.H"
76  #include "CourantNo.H"
77  #include "setInitialDeltaT.H"
78 
79  // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
80 
81  Info<< "\nStarting time loop\n" << endl;
82 
83  while (runTime.run())
84  {
85  #include "readControls.H"
86  #include "CourantNo.H"
87  #include "alphaCourantNo.H"
88 
89  #include "setDeltaT.H"
90 
91  runTime++;
92 
93  Info<< "Time = " << runTime.timeName() << nl << endl;
94 
95  // --- Pressure-velocity PIMPLE corrector loop
96  while (pimple.loop())
97  {
98  if (pimple.firstIter() || moveMeshOuterCorrectors)
99  {
100  scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime();
101 
102  mesh.update();
103 
104  if (mesh.changing())
105  {
106  Info<< "Execution time for mesh.update() = "
107  << runTime.elapsedCpuTime() - timeBeforeMeshUpdate
108  << " s" << endl;
109 
110  gh = (g & mesh.C()) - ghRef;
111  ghf = (g & mesh.Cf()) - ghRef;
112  }
113 
114  if (mesh.changing() && correctPhi)
115  {
116  // Calculate absolute flux from the mapped surface velocity
117  phi = mesh.Sf() & Uf;
118 
119  #include "correctPhi.H"
120 
121  // Make the flux relative to the mesh motion
123 
124  mixture.correct();
125  }
126 
127  if (mesh.changing() && checkMeshCourantNo)
128  {
129  #include "meshCourantNo.H"
130  }
131  }
132 
133  mixture.solve();
134  rho = mixture.rho();
135 
136  #include "UEqn.H"
137 
138  // --- Pressure corrector loop
139  while (pimple.correct())
140  {
141  #include "pEqn.H"
142  }
143 
144  if (pimple.turbCorr())
145  {
146  turbulence->correct();
147  }
148  }
149 
150  runTime.write();
151 
152  Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
153  << " ClockTime = " << runTime.elapsedClockTime() << " s"
154  << nl << endl;
155  }
156 
157  Info<< "End\n" << endl;
158 
159  return 0;
160 }
161 
162 
163 // ************************************************************************* //
Uf
Definition: pEqn.H:78
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:51
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
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.
U
Definition: pEqn.H:82
const surfaceScalarField & ghf
Creates and initialises the velocity velocity field Uf.
const volScalarField & gh