sonicDyMFoam.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  sonicDyMFoam
26 
27 Group
28  grpCompressibleSolvers grpMovingMeshSolvers
29 
30 Description
31  Transient solver for trans-sonic/supersonic, laminar or turbulent flow
32  of a compressible gas with mesh motion..
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #include "fvCFD.H"
37 #include "dynamicFvMesh.H"
38 #include "psiThermo.H"
40 #include "pimpleControl.H"
41 #include "CorrectPhi.H"
42 #include "fvIOoptionList.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  #include "createRhoUf.H"
60  #include "compressibleCourantNo.H"
61  #include "setInitialDeltaT.H"
62 
63  // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
64 
65  Info<< "\nStarting time loop\n" << endl;
66 
67  while (runTime.run())
68  {
69  #include "readControls.H"
70 
71  {
72  // Store divrhoU from the previous mesh so that it can be mapped
73  // and used in correctPhi to ensure the corrected phi has the
74  // same divergence
75  volScalarField divrhoU
76  (
77  "divrhoU",
79  );
80 
81  #include "compressibleCourantNo.H"
82  #include "setDeltaT.H"
83 
84  runTime++;
85 
86  Info<< "Time = " << runTime.timeName() << nl << endl;
87 
88  // Store momentum to set rhoUf for introduced faces.
89  volVectorField rhoU("rhoU", rho*U);
90 
91  // Do any mesh changes
92  mesh.update();
93 
94  if (mesh.changing() && correctPhi)
95  {
96  // Calculate absolute flux from the mapped surface velocity
97  phi = mesh.Sf() & rhoUf;
98 
99  #include "correctPhi.H"
100 
101  // Make the fluxes relative to the mesh-motion
103  }
104  }
105 
106  if (mesh.changing() && checkMeshCourantNo)
107  {
108  #include "meshCourantNo.H"
109  }
110 
111  #include "rhoEqn.H"
112  Info<< "rhoEqn max/min : " << max(rho).value()
113  << " " << min(rho).value() << endl;
114 
115  // --- Pressure-velocity PIMPLE corrector loop
116  while (pimple.loop())
117  {
118  #include "UEqn.H"
119  #include "EEqn.H"
120 
121  // --- Pressure corrector loop
122  while (pimple.correct())
123  {
124  #include "pEqn.H"
125  }
126 
127  if (pimple.turbCorr())
128  {
129  turbulence->correct();
130  }
131  }
132 
133  runTime.write();
134 
135  Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
136  << " ClockTime = " << runTime.elapsedClockTime() << " s"
137  << nl << endl;
138  }
139 
140  Info<< "End\n" << endl;
141 
142  return 0;
143 }
144 
145 
146 // ************************************************************************* //
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
rhoUf
Definition: pEqn.H:90
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
tmp< surfaceScalarField > absolute(const tmp< surfaceScalarField > &tphi, const volVectorField &U)
Return the given relative flux in absolute form.
Definition: fvcMeshPhi.C:187
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:52
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
void makeRelative(surfaceScalarField &phi, const volVectorField &U)
Make the given flux relative.
Definition: fvcMeshPhi.C:74
surfaceScalarField & phi
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:55
correctPhi
Definition: readControls.H:3
tmp< GeometricField< Type, fvPatchField, volMesh > > div(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition: fvcDiv.C:47
Calculates and outputs the mean and maximum Courant Numbers.
int main(int argc, char *argv[])
Definition: postCalc.C:54
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
U
Definition: pEqn.H:82
Creates and initialises the velocity velocity field rhoUf.