FreeFOAM The Cross-Platform CFD Toolkit
compressibleInterDyMFoam.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) 1991-2010 OpenCFD Ltd.
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  compressibleInterDyMFoam
26 
27 Description
28  Solver for 2 compressible, 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  Turbulence modelling is generic, i.e. laminar, RAS or LES may be selected.
37 
38 Usage
39  - compressibleInterDyMFoam [OPTION]
40 
41  @param -case <dir> \n
42  Specify the case directory
43 
44  @param -parallel \n
45  Run the case in parallel
46 
47  @param -help \n
48  Display short usage message
49 
50  @param -doc \n
51  Display Doxygen documentation page
52 
53  @param -srcDoc \n
54  Display source code
55 
56 \*---------------------------------------------------------------------------*/
57 
58 #include <finiteVolume/fvCFD.H>
60 #include <finiteVolume/MULES.H>
61 #include <OpenFOAM/subCycle.H>
65 
66 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
67 
68 int main(int argc, char *argv[])
69 {
70  #include <OpenFOAM/setRootCase.H>
71  #include <OpenFOAM/createTime.H>
74  #include "readControls.H"
76  #include "../createFields.H"
77  #include "createPcorrTypes.H"
78  #include <finiteVolume/CourantNo.H>
80 
81  // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
82  Info<< "\nStarting time loop\n" << endl;
83 
84  while (runTime.run())
85  {
86  #include "readControls.H"
87  #include <finiteVolume/CourantNo.H>
88 
89  // Make the fluxes absolute
91 
92  #include <finiteVolume/setDeltaT.H>
93 
94  runTime++;
95 
96  Info<< "Time = " << runTime.timeName() << nl << endl;
97 
98  {
99  // Store divU from the previous mesh for the correctPhi
100  volScalarField divU = fvc::div(phi);
101 
102  scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime();
103 
104  // Do any mesh changes
105  mesh.update();
106 
107  if (mesh.changing())
108  {
109  Info<< "Execution time for mesh.update() = "
110  << runTime.elapsedCpuTime() - timeBeforeMeshUpdate
111  << " s" << endl;
112 
113  gh = g & mesh.C();
114  ghf = g & mesh.Cf();
115  }
116 
117  if (mesh.changing() && correctPhi)
118  {
119  #include "correctPhi.H"
120  }
121  }
122 
123  // Make the fluxes relative to the mesh motion
125 
127  {
129  }
130 
131  turbulence->correct();
132 
133  // --- Outer-corrector loop
134  for (int oCorr=0; oCorr<nOuterCorr; oCorr++)
135  {
136  #include "alphaEqnsSubCycle.H"
137 
139 
140  #include "../UEqn.H"
141 
142  // --- PISO loop
143  for (int corr=0; corr<nCorr; corr++)
144  {
145  #include "pEqn.H"
146  }
147  }
148 
149  rho = alpha1*rho1 + alpha2*rho2;
150 
151  runTime.write();
152 
153  Info<< "ExecutionTime = "
154  << runTime.elapsedCpuTime()
155  << " s\n\n" << endl;
156  }
157 
158  Info<< "End\n" << endl;
159 
160  return 0;
161 }
162 
163 
164 // ************************ vim: set sw=4 sts=4 et: ************************ //