chtMultiRegionSimpleFoam.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-2019,2022 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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
27Application
28 chtMultiRegionSimpleFoam
29
30Group
31 grpHeatTransferSolvers
32
33Description
34 Steady-state solver for buoyant, turbulent fluid flow and solid heat
35 conduction with conjugate heat transfer between solid and fluid regions.
36
37\*---------------------------------------------------------------------------*/
38
39#include "fvCFD.H"
40#include "rhoThermo.H"
43#include "regionProperties.H"
44#include "solidThermo.H"
45#include "radiationModel.H"
46#include "fvOptions.H"
47#include "coordinateSystem.H"
48#include "loopControl.H"
49
50// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51
52int main(int argc, char *argv[])
53{
54 argList::addNote
55 (
56 "Steady-state solver for buoyant, turbulent fluid flow and solid heat"
57 " conduction with conjugate heat transfer"
58 " between solid and fluid regions."
59 );
60
61 #define NO_CONTROL
62 #define CREATE_MESH createMeshesPostProcess.H
63 #include "postProcess.H"
64
65 #include "addCheckCaseOptions.H"
66 #include "setRootCaseLists.H"
67 #include "createTime.H"
68 #include "createMeshes.H"
69 #include "createFields.H"
70 #include "createCoupledRegions.H"
71 #include "initContinuityErrs.H"
72
73 while (runTime.loop())
74 {
75 Info<< "Time = " << runTime.timeName() << nl << endl;
76
78 {
79 Info<< "\nSolving for fluid region "
80 << fluidRegions[i].name() << endl;
81 #include "setRegionFluidFields.H"
83 #include "solveFluid.H"
84 }
85
87 {
88 #include "setRegionSolidFields.H"
90 #include "solveSolid.H"
91 }
92
93
94 if (coupled)
95 {
96 Info<< "\nSolving energy coupled regions" << endl;
97 fvMatrixAssemblyPtr->solve();
98 #include "correctThermos.H"
99
101 {
102 #include "setRegionFluidFields.H"
104 if (!frozenFlow)
105 {
106 #include "pEqn.H"
107 turb.correct();
108 }
109 }
110
111 fvMatrixAssemblyPtr->clear();
112 }
113
114 // Additional loops for energy solution only
115 {
116 loopControl looping(runTime, "SIMPLE", "energyCoupling");
117
118 while (looping.loop())
119 {
120 Info<< nl << looping << nl;
121
123 {
124 Info<< "\nSolving for fluid region "
125 << fluidRegions[i].name() << endl;
126 #include "setRegionFluidFields.H"
128 frozenFlow = true;
129 #include "solveFluid.H"
130 }
131
133 {
134 Info<< "\nSolving for solid region "
135 << solidRegions[i].name() << endl;
136 #include "setRegionSolidFields.H"
138 #include "solveSolid.H"
139 }
140
141 if (coupled)
142 {
143 Info<< "\nSolving energy coupled regions.. " << endl;
144 fvMatrixAssemblyPtr->solve();
145 #include "correctThermos.H"
146
147 fvMatrixAssemblyPtr->clear();
148 }
149 }
150 }
151
152 runTime.write();
153
154 runTime.printExecutionTime(Info);
155 }
156
157 Info<< "End\n" << endl;
158
159 return 0;
160}
161
162
163// ************************************************************************* //
Required Classes.
PtrList< fvMesh > fluidRegions(fluidNames.size())
bool frozenFlow
compressible::turbulenceModel & turb
autoPtr< fvMatrix< scalar > > fvMatrixAssemblyPtr
bool coupled(solutionDict.getOrDefault("coupledEnergyField", false))
engineTime & runTime
PtrList< fvMesh > solidRegions(solidNames.size())
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
constexpr char nl
The newline '\n' character (0x0a)
Definition: Ostream.H:53
Execute application functionObjects to post-process existing results.
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:333