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 | Copyright (C) 2011-2017 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  chtMultiRegionFoam
26 
27 Description
28  Transient solver for buoyant, turbulent fluid flow and solid heat
29  conduction with conjugate heat transfer between solid and fluid regions.
30 
31  It handles secondary fluid or solid circuits which can be coupled
32  thermally with the main fluid region. i.e radiators, etc.
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #include "fvCFD.H"
37 #include "rhoThermo.H"
40 #include "regionProperties.H"
41 #include "compressibleCourantNo.H"
42 #include "solidRegionDiffNo.H"
43 #include "solidThermo.H"
44 #include "radiationModel.H"
45 #include "fvOptions.H"
46 #include "coordinateSystem.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 int main(int argc, char *argv[])
51 {
52  #define NO_CONTROL
53  #define CREATE_MESH createMeshesPostProcess.H
54  #include "postProcess.H"
55 
56  #include "setRootCase.H"
57  #include "createTime.H"
58  #include "createMeshes.H"
59  #include "createFields.H"
60  #include "initContinuityErrs.H"
61  #include "createTimeControls.H"
62  #include "readSolidTimeControls.H"
63  #include "compressibleMultiRegionCourantNo.H"
64  #include "solidRegionDiffusionNo.H"
66 
67  while (runTime.run())
68  {
69  #include "readTimeControls.H"
70  #include "readSolidTimeControls.H"
71  #include "readPIMPLEControls.H"
72 
73  #include "compressibleMultiRegionCourantNo.H"
74  #include "solidRegionDiffusionNo.H"
75  #include "setMultiRegionDeltaT.H"
76 
77  runTime++;
78 
79  Info<< "Time = " << runTime.timeName() << nl << endl;
80 
81  if (nOuterCorr != 1)
82  {
84  {
85  #include "storeOldFluidFields.H"
86  }
87  }
88 
89  bool allRegionsConverged = false;
90  bool finalIter = false;
91 
92  // --- PIMPLE loop
93  for (int oCorr=0; oCorr<nOuterCorr; oCorr++)
94  {
95  Info<< "Pimple iteration " << oCorr << "\n";
96 
97  if (oCorr == nOuterCorr-1 || allRegionsConverged)
98  {
99  finalIter = true;
100  }
101 
102  forAll(fluidRegions, i)
103  {
104  Info<< "\nSolving for fluid region "
105  << fluidRegions[i].name() << endl;
106  #include "setRegionFluidFields.H"
108  #include "readFluidMultiRegionResidualControls.H"
109  #include "solveFluid.H"
110  #include "residualControlsFluid.H"
111  }
112 
113  forAll(solidRegions, i)
114  {
115  Info<< "\nSolving for solid region "
116  << solidRegions[i].name() << endl;
117  #include "setRegionSolidFields.H"
119  #include "readSolidMultiRegionResidualControls.H"
120  #include "solveSolid.H"
121  #include "residualControlsSolid.H"
122  }
123 
124  #include "checkResidualControls.H"
125  }
126 
127  runTime.write();
128 
129  Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
130  << " ClockTime = " << runTime.elapsedClockTime() << " s"
131  << nl << endl;
132  }
133 
134  Info<< "End\n" << endl;
135 
136  return 0;
137 }
138 
139 
140 // ************************************************************************* //
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:428
Set the initial timestep for the CHT MultiRegion solver.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:253
Read the control parameters used by setDeltaT.
Calculates and outputs the mean and maximum Diffusion Numbers for the solid regions.
const int nOuterCorr
static const char nl
Definition: Ostream.H:262
PtrList< fvMesh > solidRegions(solidsNames.size())
Read the control parameters used in the solid.
messageStream Info
PtrList< fvMesh > fluidRegions(fluidNames.size())
virtual Ostream & write(const token &)=0
Write next token to stream.
Execute application functionObjects to post-process existing results.
Read the control parameters used by setDeltaT.