chtMultiRegionFoam.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-2016 OpenFOAM Foundation
9  Copyright (C) 2017 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  chtMultiRegionFoam
29 
30 Group
31  grpHeatTransferSolvers
32 
33 Description
34  Transient solver for buoyant, turbulent fluid flow and solid heat
35  conduction with conjugate heat transfer between solid and fluid regions.
36 
37  It handles secondary fluid or solid circuits which can be coupled
38  thermally with the main fluid region. i.e radiators, etc.
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #include "fvCFD.H"
44 #include "rhoReactionThermo.H"
45 #include "CombustionModel.H"
47 #include "regionProperties.H"
48 #include "compressibleCourantNo.H"
49 #include "solidRegionDiffNo.H"
50 #include "solidThermo.H"
51 #include "radiationModel.H"
52 #include "fvOptions.H"
53 #include "coordinateSystem.H"
54 #include "loopControl.H"
55 #include "pressureControl.H"
56 
57 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
58 
59 int main(int argc, char *argv[])
60 {
61  argList::addNote
62  (
63  "Transient solver for buoyant, turbulent fluid flow and solid heat"
64  " conduction with conjugate heat transfer"
65  " between solid and fluid regions."
66  );
67 
68  #define NO_CONTROL
69  #define CREATE_MESH createMeshesPostProcess.H
70  #include "postProcess.H"
71 
72  #include "setRootCaseLists.H"
73  #include "createTime.H"
74  #include "createMeshes.H"
75  #include "createFields.H"
76  #include "initContinuityErrs.H"
77  #include "createTimeControls.H"
78  #include "readSolidTimeControls.H"
79  #include "compressibleMultiRegionCourantNo.H"
80  #include "solidRegionDiffusionNo.H"
82 
83  while (runTime.run())
84  {
85  #include "readTimeControls.H"
86  #include "readSolidTimeControls.H"
87  #include "readPIMPLEControls.H"
88 
89  #include "compressibleMultiRegionCourantNo.H"
90  #include "solidRegionDiffusionNo.H"
91  #include "setMultiRegionDeltaT.H"
92 
93  ++runTime;
94 
95  Info<< "Time = " << runTime.timeName() << nl << endl;
96 
97  if (nOuterCorr != 1)
98  {
100  {
101  #include "storeOldFluidFields.H"
102  }
103  }
104 
105  // --- PIMPLE loop
106  for (int oCorr=0; oCorr<nOuterCorr; ++oCorr)
107  {
108  const bool finalIter = (oCorr == nOuterCorr-1);
109 
110  forAll(fluidRegions, i)
111  {
112  Info<< "\nSolving for fluid region "
113  << fluidRegions[i].name() << endl;
114  #include "setRegionFluidFields.H"
115  #include "readFluidMultiRegionPIMPLEControls.H"
116  #include "solveFluid.H"
117  }
118 
119  forAll(solidRegions, i)
120  {
121  Info<< "\nSolving for solid region "
122  << solidRegions[i].name() << endl;
123  #include "setRegionSolidFields.H"
125  #include "solveSolid.H"
126  }
127 
128  // Additional loops for energy solution only
129  if (!oCorr && nOuterCorr > 1)
130  {
131  loopControl looping(runTime, pimple, "energyCoupling");
132 
133  while (looping.loop())
134  {
135  Info<< nl << looping << nl;
136 
137  forAll(fluidRegions, i)
138  {
139  Info<< "\nSolving for fluid region "
140  << fluidRegions[i].name() << endl;
141  #include "setRegionFluidFields.H"
142  #include "readFluidMultiRegionPIMPLEControls.H"
143  frozenFlow = true;
144  #include "solveFluid.H"
145  }
146 
147  forAll(solidRegions, i)
148  {
149  Info<< "\nSolving for solid region "
150  << solidRegions[i].name() << endl;
151  #include "setRegionSolidFields.H"
153  #include "solveSolid.H"
154  }
155  }
156  }
157  }
158 
159  runTime.write();
160 
161  runTime.printExecutionTime(Info);
162  }
163 
164  Info<< "End\n" << endl;
165 
166  return 0;
167 }
168 
169 
170 // ************************************************************************* //
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:350
setRegionSolidFields.H
coordinateSystem.H
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
solidThermo.H
rhoReactionThermo.H
pimple
pimpleControl & pimple
Definition: setRegionFluidFields.H:56
setRootCaseLists.H
Foam::Info
messageStream Info
Information stream (uses stdout - output is on the master only)
CombustionModel.H
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
pressureControl.H
Foam::nl
constexpr char nl
Definition: Ostream.H:385
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
fvCFD.H
readPIMPLEControls.H
frozenFlow
bool frozenFlow
Definition: setRegionFluidFields.H:32
radiationModel.H
turbulentFluidThermoModel.H