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-2015 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 Group
28  grpHeatTransferSolvers
29 
30 Description
31  Combination of heatConductionFoam and buoyantFoam for conjugate heat
32  transfer between solid regions and fluid regions.
33 
34  Note:
35  - Both regions support the fvOptions framework.
36  - It handles secondary fluid or solid circuits which can be coupled
37  thermally with the main fluid region. i.e radiators, etc.
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #include "fvCFD.H"
42 #include "rhoThermo.H"
45 #include "regionProperties.H"
46 #include "compressibleCourantNo.H"
47 #include "solidRegionDiffNo.H"
48 #include "solidThermo.H"
49 #include "radiationModel.H"
50 #include "fvOptions.H"
51 #include "coordinateSystem.H"
53 
54 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
55 
56 int main(int argc, char *argv[])
57 {
58  #include "setRootCase.H"
59  #include "createTime.H"
60 
61  regionProperties rp(runTime);
62 
63  #include "createFluidMeshes.H"
64  #include "createSolidMeshes.H"
65 
66  #include "createFluidFields.H"
67  #include "createSolidFields.H"
68 
69  #include "initContinuityErrs.H"
70  #include "createTimeControls.H"
71  #include "readSolidTimeControls.H"
72 
73 
74  #include "compressibleMultiRegionCourantNo.H"
75  #include "solidRegionDiffusionNo.H"
76  #include "setInitialMultiRegionDeltaT.H"
77 
78  while (runTime.run())
79  {
80  #include "createTimeControls.H"
81  #include "readSolidTimeControls.H"
82  #include "readPIMPLEControls.H"
83 
84  #include "compressibleMultiRegionCourantNo.H"
85  #include "solidRegionDiffusionNo.H"
86  #include "setMultiRegionDeltaT.H"
87 
88  runTime++;
89 
90  Info<< "Time = " << runTime.timeName() << nl << endl;
91 
92  if (nOuterCorr != 1)
93  {
95  {
96  #include "storeOldFluidFields.H"
97  }
98  }
99 
100 
101  // --- PIMPLE loop
102  for (int oCorr=0; oCorr<nOuterCorr; oCorr++)
103  {
104  bool finalIter = oCorr == nOuterCorr-1;
105 
106  forAll(fluidRegions, i)
107  {
108  Info<< "\nSolving for fluid region "
109  << fluidRegions[i].name() << endl;
110  #include "setRegionFluidFields.H"
111  #include "readFluidMultiRegionPIMPLEControls.H"
112  #include "solveFluid.H"
113  }
114 
115  forAll(solidRegions, i)
116  {
117  Info<< "\nSolving for solid region "
118  << solidRegions[i].name() << endl;
119  #include "setRegionSolidFields.H"
120  #include "readSolidMultiRegionPIMPLEControls.H"
121  #include "solveSolid.H"
122  }
123 
124  }
125 
126  runTime.write();
127 
128  Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
129  << " ClockTime = " << runTime.elapsedClockTime() << " s"
130  << nl << endl;
131  }
132 
133  Info<< "End\n" << endl;
134 
135  return 0;
136 }
137 
138 
139 // ************************************************************************* //
fvOptions.H
regionProperties.H
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:406
solidRegions
PtrList< fvMesh > solidRegions(solidsNames.size())
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
coordinateSystem.H
solidThermo.H
fluidRegions
PtrList< fvMesh > fluidRegions(fluidNames.size())
rhoThermo.H
Foam::Ostream::write
virtual Ostream & write(const token &)=0
Write next token to stream.
Foam::nl
static const char nl
Definition: Ostream.H:260
Foam::Info
messageStream Info
main
int main(int argc, char *argv[])
Definition: chtMultiRegionFoam.C:53
Foam::regionProperties
Simple class to hold region information for coupled region simulations.
Definition: regionProperties.H:53
fixedGradientFvPatchFields.H
setRootCase.H
readPIMPLEControls.H
createTimeControls.H
Read the control parameters used by setDeltaT.
nOuterCorr
const int nOuterCorr
Definition: readPIMPLEControls.H:7
createTime.H
fvCFD.H
fixedFluxPressureFvPatchScalarField.H
radiationModel.H
turbulentFluidThermoModel.H