OpenFOAM: API Guide
v2112
The open source CFD toolbox
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
-------------------------------------------------------------------------------
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
chtMultiRegionSimpleFoam
29
30
Group
31
grpHeatTransferSolvers
32
33
Description
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
"
41
#include "
turbulentFluidThermoModel.H
"
42
#include "
fixedGradientFvPatchFields.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
52
int
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
77
forAll
(
fluidRegions
, i)
78
{
79
Info
<<
"\nSolving for fluid region "
80
<<
fluidRegions
[i].name() <<
endl
;
81
#include "setRegionFluidFields.H"
82
#include "
readFluidMultiRegionSIMPLEControls.H
"
83
#include "solveFluid.H"
84
}
85
86
forAll
(
solidRegions
, i)
87
{
88
#include "
setRegionSolidFields.H
"
89
#include "
readSolidMultiRegionSIMPLEControls.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
100
forAll
(
fluidRegions
, i)
101
{
102
#include "setRegionFluidFields.H"
103
#include "
readSolidMultiRegionSIMPLEControls.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
122
forAll
(
fluidRegions
, i)
123
{
124
Info
<<
"\nSolving for fluid region "
125
<<
fluidRegions
[i].name() <<
endl
;
126
#include "setRegionFluidFields.H"
127
#include "
readFluidMultiRegionSIMPLEControls.H
"
128
frozenFlow
=
true
;
129
#include "solveFluid.H"
130
}
131
132
forAll
(
solidRegions
, i)
133
{
134
Info
<<
"\nSolving for solid region "
135
<<
solidRegions
[i].name() <<
endl
;
136
#include "
setRegionSolidFields.H
"
137
#include "
readSolidMultiRegionSIMPLEControls.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
// ************************************************************************* //
addCheckCaseOptions.H
Required Classes.
fluidRegions
PtrList< fvMesh > fluidRegions(fluidNames.size())
frozenFlow
bool frozenFlow
Definition:
setRegionFluidFields.H:34
turb
compressible::turbulenceModel & turb
Definition:
setRegionFluidFields.H:10
coordinateSystem.H
correctThermos.H
createCoupledRegions.H
fvMatrixAssemblyPtr
autoPtr< fvMatrix< scalar > > fvMatrixAssemblyPtr
Definition:
createCoupledRegions.H:5
coupled
bool coupled(solutionDict.getOrDefault("coupledEnergyField", false))
runTime
engineTime & runTime
Definition:
createEngineTime.H:13
createMeshes.H
solidRegions
PtrList< fvMesh > solidRegions(solidNames.size())
createTime.H
fixedGradientFvPatchFields.H
fvCFD.H
fvOptions.H
loopControl.H
Foam::Info
messageStream Info
Information stream (stdout output on master, null elsewhere)
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition:
Ostream.H:372
Foam::nl
constexpr char nl
The newline '\n' character (0x0a)
Definition:
Ostream.H:53
postProcess.H
Execute application functionObjects to post-process existing results.
radiationModel.H
readFluidMultiRegionSIMPLEControls.H
readSolidMultiRegionSIMPLEControls.H
regionProperties.H
rhoThermo.H
setRegionSolidFields.H
setRootCaseLists.H
solidThermo.H
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition:
stdFoam.H:333
turbulentFluidThermoModel.H
applications
solvers
heatTransfer
chtMultiRegionFoam
chtMultiRegionSimpleFoam
chtMultiRegionSimpleFoam.C
Generated by
1.9.5
OPENFOAM® is a registered
trademark
of OpenCFD Ltd.