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-2022 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 "addCheckCaseOptions.H"
71  #include "setRootCase.H"
72  #include "createTime.H"
73  #include "createMeshes.H"
74  #include "createFields.H"
75  #include "initContinuityErrs.H"
76  #include "createTimeControls.H"
77  #include "readSolidTimeControls.H"
78  #include "compressibleMultiRegionCourantNo.H"
79  #include "solidRegionDiffusionNo.H"
81 
82  while (runTime.run())
83  {
84  #include "readTimeControls.H"
85  #include "readSolidTimeControls.H"
86  #include "readPIMPLEControls.H"
87 
88  #include "compressibleMultiRegionCourantNo.H"
89  #include "solidRegionDiffusionNo.H"
90  #include "setMultiRegionDeltaT.H"
91 
92  ++runTime;
93 
94  Info<< "Time = " << runTime.timeName() << nl << endl;
95 
96  if (nOuterCorr != 1)
97  {
99  {
100  #include "storeOldFluidFields.H"
101  }
102  }
103 
104  // --- PIMPLE loop
105  for (int oCorr=0; oCorr<nOuterCorr; ++oCorr)
106  {
107  const bool finalIter = (oCorr == nOuterCorr-1);
108 
109  forAll(fluidRegions, i)
110  {
111  fvMesh& mesh = fluidRegions[i];
112 
113  Info<< "\nSolving for fluid region "
114  << fluidRegions[i].name() << endl;
115  #include "readFluidMultiRegionPIMPLEControls.H"
116  #include "setRegionFluidFields.H"
117  #include "solveFluid.H"
118  }
119 
120  forAll(solidRegions, i)
121  {
122  fvMesh& mesh = solidRegions[i];
123 
124  Info<< "\nSolving for solid region "
125  << solidRegions[i].name() << endl;
127  #include "setRegionSolidFields.H"
128  #include "solveSolid.H"
129  }
130 
131  // Additional loops for energy solution only
132  if (!oCorr && nOuterCorr > 1)
133  {
134  loopControl looping(runTime, pimple, "energyCoupling");
135 
136  while (looping.loop())
137  {
138  Info<< nl << looping << nl;
139 
140  forAll(fluidRegions, i)
141  {
142  fvMesh& mesh = fluidRegions[i];
143 
144  Info<< "\nSolving for fluid region "
145  << fluidRegions[i].name() << endl;
146  #include "readFluidMultiRegionPIMPLEControls.H"
147  #include "setRegionFluidFields.H"
148  frozenFlow = true;
149  #include "solveFluid.H"
150  }
151 
152  forAll(solidRegions, i)
153  {
154  fvMesh& mesh = solidRegions[i];
155 
156  Info<< "\nSolving for solid region "
157  << solidRegions[i].name() << endl;
159  #include "setRegionSolidFields.H"
160  #include "solveSolid.H"
161  }
162  }
163  }
164  }
165 
166  runTime.write();
167 
168  runTime.printExecutionTime(Info);
169  }
170 
171  Info<< "End\n" << endl;
172 
173  return 0;
174 }
175 
176 
177 // ************************************************************************* //
bool frozenFlow
Set the initial timestep for the CHT MultiRegion solver.
constexpr char nl
The newline &#39;\n&#39; character (0x0a)
Definition: Ostream.H:49
engineTime & runTime
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:487
PtrList< fvMesh > solidRegions(solidNames.size())
Read the control parameters used by setDeltaT.
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:413
dynamicFvMesh & mesh
const int nOuterCorr
pimpleControl & pimple
Read the control parameters used in the solid.
messageStream Info
Information stream (stdout output on master, null elsewhere)
PtrList< fvMesh > fluidRegions(fluidNames.size())
Execute application functionObjects to post-process existing results.
Required Classes.
Read the control parameters used by setDeltaT.