buoyantBoussinesqPimpleFoam.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2017 OpenFOAM Foundation
9  Copyright (C) 2021 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Application
28  buoyantBoussinesqPimpleFoam
29 
30 Group
31  grpHeatTransferSolvers
32 
33 Description
34  Transient solver for buoyant, turbulent flow of incompressible fluids,
35  with optional mesh motion and mesh topology changes.
36 
37  Uses the Boussinesq approximation:
38  \f[
39  rho_{k} = 1 - beta(T - T_{ref})
40  \f]
41 
42  where:
43  \f$ rho_{k} \f$ = the effective (driving) kinematic density
44  beta = thermal expansion coefficient [1/K]
45  T = temperature [K]
46  \f$ T_{ref} \f$ = reference temperature [K]
47 
48  Valid when:
49  \f[
50  \frac{beta(T - T_{ref})}{rho_{ref}} << 1
51  \f]
52 
53 \*---------------------------------------------------------------------------*/
54 
55 #include "fvCFD.H"
56 #include "dynamicFvMesh.H"
59 #include "radiationModel.H"
60 #include "CorrectPhi.H"
61 #include "fvOptions.H"
62 #include "pimpleControl.H"
63 
64 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
65 
66 int main(int argc, char *argv[])
67 {
68  argList::addNote
69  (
70  "Transient solver for buoyant, turbulent flow"
71  " of incompressible fluids, with optional mesh"
72  " motion and mesh topology changes.\n"
73  "Uses the Boussinesq approximation."
74  );
75 
76  #include "postProcess.H"
77 
78  #include "addCheckCaseOptions.H"
79  #include "setRootCaseLists.H"
80  #include "createTime.H"
81  #include "createDynamicFvMesh.H"
82  #include "createDyMControls.H"
83  #include "createFields.H"
84  #include "createUfIfPresent.H"
85  #include "CourantNo.H"
86  #include "setInitialDeltaT.H"
87  #include "initContinuityErrs.H"
88 
89  turbulence->validate();
90 
91  // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
92 
93  Info<< "\nStarting time loop\n" << endl;
94 
95  while (runTime.run())
96  {
97  #include "readDyMControls.H"
98  #include "CourantNo.H"
99  #include "setDeltaT.H"
100 
101  ++runTime;
102 
103  Info<< "Time = " << runTime.timeName() << nl << endl;
104 
105  // --- Pressure-velocity PIMPLE corrector loop
106  while (pimple.loop())
107  {
108  if (pimple.firstIter() || moveMeshOuterCorrectors)
109  {
110  // Do any mesh changes
111  mesh.controlledUpdate();
112 
113  if (mesh.changing())
114  {
115  MRF.update();
116 
117  if (correctPhi)
118  {
119  // Calculate absolute flux
120  // from the mapped surface velocity
121  phi = mesh.Sf() & Uf();
122 
123  #include "correctPhi.H"
124 
125  // Make the flux relative to the mesh motion
127  }
128 
129  if (checkMeshCourantNo)
130  {
131  #include "meshCourantNo.H"
132  }
133  }
134  }
135 
136  #include "UEqn.H"
137  #include "TEqn.H"
138 
139  // --- Pressure corrector loop
140  while (pimple.correct())
141  {
142  #include "pEqn.H"
143  }
144 
145  if (pimple.turbCorr())
146  {
147  laminarTransport.correct();
148  turbulence->correct();
149  }
150  }
151 
152  runTime.write();
153 
154  runTime.printExecutionTime(Info);
155  }
156 
157  Info<< "End\n" << endl;
158 
159  return 0;
160 }
161 
162 
163 // ************************************************************************* //
runTime
engineTime & runTime
Definition: createEngineTime.H:13
fvOptions.H
turbulence
Info<< "Reading field U\n"<< 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\n"<< endl;autoPtr< compressible::turbulenceModel > turbulence(compressible::turbulenceModel::New(rho, U, phi, thermo))
Definition: createFields.H:94
singlePhaseTransportModel.H
turbulentTransportModel.H
Uf
autoPtr< surfaceVectorField > Uf
Definition: createUfIfPresent.H:33
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:369
correctPhi
correctPhi
Definition: readDyMControls.H:3
pimpleControl.H
Foam::fvc::makeRelative
void makeRelative(surfaceScalarField &phi, const volVectorField &U)
Make the given flux relative.
Definition: fvcMeshPhi.C:77
MRF
IOMRFZoneList & MRF
Definition: setRegionFluidFields.H:22
pimple
pimpleControl & pimple
Definition: setRegionFluidFields.H:56
setRootCaseLists.H
addCheckCaseOptions.H
Required Classes.
Foam::Info
messageStream Info
Information stream (stdout output on master, null elsewhere)
phi
surfaceScalarField & phi
Definition: setRegionFluidFields.H:8
readDyMControls.H
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
postProcess.H
Execute application functionObjects to post-process existing results.
U
U
Definition: pEqn.H:72
Foam::nl
constexpr char nl
Definition: Ostream.H:404
meshCourantNo.H
Calculates and outputs the mean and maximum Courant Numbers.
CorrectPhi.H
createTime.H
createUfIfPresent.H
Creates and initialises the velocity field Uf if required.
dynamicFvMesh.H
fvCFD.H
checkMeshCourantNo
checkMeshCourantNo
Definition: readDyMControls.H:9
moveMeshOuterCorrectors
moveMeshOuterCorrectors
Definition: readDyMControls.H:15
laminarTransport
singlePhaseTransportModel laminarTransport(U, phi)
radiationModel.H
createDynamicFvMesh.H