chtMultiRegionTwoPhaseEulerFoam.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) 2018 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Application
27  chtMultiRegionTwoPhaseEulerFoam
28 
29 Group
30  grpHeatTransferSolvers
31 
32 Description
33  Transient solver for buoyant, turbulent fluid flow and solid heat
34  conduction with conjugate heat transfer between solid and fluid regions.
35 
36  It solves a two-phase Euler approach on the fluid region.
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #include "fvCFD.H"
42 
43 #include "twoPhaseSystem.H"
44 #include "phaseCompressibleTurbulenceModel.H"
45 #include "pimpleControl.H"
47 #include "regionProperties.H"
48 #include "solidRegionDiffNo.H"
49 #include "solidThermo.H"
50 #include "radiationModel.H"
51 #include "fvOptions.H"
52 #include "coordinateSystem.H"
53 #include "loopControl.H"
54 
55 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56 
57 int main(int argc, char *argv[])
58 {
59  argList::addNote
60  (
61  "Transient solver for buoyant, turbulent two phase fluid flow and"
62  "solid heat conduction with conjugate heat transfer "
63  "between solid and fluid regions."
64  );
65 
66  #define NO_CONTROL
67  #define CREATE_MESH createMeshesPostProcess.H
68  #include "postProcess.H"
69 
70  #include "setRootCase.H"
71  #include "createTime.H"
72  #include "createMeshes.H"
73  #include "createFields.H"
74  #include "initContinuityErrs.H"
75  #include "createTimeControls.H"
76  #include "readSolidTimeControls.H"
77  #include "compressibleMultiRegionCourantNo.H"
78  #include "solidRegionDiffusionNo.H"
80 
81  while (runTime.run())
82  {
83  #include "readTimeControls.H"
84  #include "readSolidTimeControls.H"
85  #include "readPIMPLEControls.H"
86 
87  #include "compressibleMultiRegionCourantNo.H"
88  #include "solidRegionDiffusionNo.H"
89  #include "setMultiRegionDeltaT.H"
90 
91  ++runTime;
92 
93  Info<< "Time = " << runTime.timeName() << nl << endl;
94 
95  if (nOuterCorr != 1)
96  {
98  {
99  #include "storeOldFluidFields.H"
100  }
101  }
102 
103  // --- PIMPLE loop
104  for (int oCorr=0; oCorr<nOuterCorr; ++oCorr)
105  {
106  const bool finalIter = (oCorr == nOuterCorr-1);
107 
108  forAll(fluidRegions, i)
109  {
110  Info<< "\nSolving for fluid region "
111  << fluidRegions[i].name() << endl;
112  #include "setRegionFluidFields.H"
113  #include "readFluidMultiRegionPIMPLEControls.H"
114  #include "solveFluid.H"
115  }
116 
117  forAll(solidRegions, i)
118  {
119  Info<< "\nSolving for solid region "
120  << solidRegions[i].name() << endl;
121  #include "setRegionSolidFields.H"
123  #include "solveSolid.H"
124  }
125 
126  // Additional loops for energy solution only
127  if (!oCorr && nOuterCorr > 1)
128  {
129  loopControl looping(runTime, pimple, "energyCoupling");
130 
131  while (looping.loop())
132  {
133  Info<< nl << looping << nl;
134 
135  forAll(fluidRegions, i)
136  {
137  Info<< "\nSolving for fluid region "
138  << fluidRegions[i].name() << endl;
139  #include "setRegionFluidFields.H"
140  #include "readFluidMultiRegionPIMPLEControls.H"
141  frozenFlow = true;
142  #include "solveFluid.H"
143  }
144 
145  forAll(solidRegions, i)
146  {
147  Info<< "\nSolving for solid region "
148  << solidRegions[i].name() << endl;
149  #include "setRegionSolidFields.H"
151  #include "solveSolid.H"
152  }
153  }
154  }
155  }
156 
157  runTime.write();
158 
159  runTime.printExecutionTime(Info);
160  }
161 
162  Info<< "End\n" << endl;
163 
164  return 0;
165 }
166 
167 
168 // ************************************************************************* //
readSolidMultiRegionPIMPLEControls.H
runTime
engineTime & runTime
Definition: createEngineTime.H:13
setInitialMultiRegionDeltaT.H
Set the initial timestep for the CHT MultiRegion solver.
fvOptions.H
regionProperties.H
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:369
setRegionSolidFields.H
coordinateSystem.H
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
pimpleControl.H
solidThermo.H
pimple
pimpleControl & pimple
Definition: setRegionFluidFields.H:56
Foam::Info
messageStream Info
Information stream (stdout output on master, null elsewhere)
solidRegionDiffNo.H
Calculates and outputs the mean and maximum Diffusion Numbers for the solid regions.
readSolidTimeControls.H
Read the control parameters used in the solid.
postProcess.H
Execute application functionObjects to post-process existing results.
nOuterCorr
const int nOuterCorr
Definition: readPIMPLEControls.H:7
fixedGradientFvPatchFields.H
setRootCase.H
Foam::nl
constexpr char nl
Definition: Ostream.H:404
loopControl.H
fluidRegions
PtrList< fvMesh > fluidRegions(fluidNames.size())
createTimeControls.H
Read the control parameters used by setDeltaT.
solidRegions
PtrList< fvMesh > solidRegions(solidNames.size())
readTimeControls.H
Read the control parameters used by setDeltaT.
createTime.H
createMeshes.H
fvCFD.H
readPIMPLEControls.H
frozenFlow
bool frozenFlow
Definition: setRegionFluidFields.H:34
radiationModel.H
turbulentFluidThermoModel.H