Home
Downloads
Documentation
Installation
User Guide
man-pages
API Documentation
README
Release Notes
Changes
License
Support
SourceForge Project
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
applications
solvers
heatTransfer
chtMultiRegionSimpleFoam
fluid
pEqn.H
Go to the documentation of this file.
1
{
2
rho
=
thermo
.rho();
3
rho
=
max
(
rho
,
rhoMin
[i]);
4
rho
=
min
(
rho
,
rhoMax
[i]);
5
rho
.relax();
6
7
volScalarField
rUA
= 1.0/
UEqn
().A();
8
surfaceScalarField
rhorUAf
(
"(rho*(1|A(U)))"
,
fvc::interpolate
(
rho
*rUA));
9
10
U
= rUA*
UEqn
().H();
11
UEqn
.clear();
12
13
phi
=
fvc::interpolate
(
rho
)*(
fvc::interpolate
(
U
) &
mesh
.Sf());
14
bool
closedVolume
=
adjustPhi
(
phi
,
U
,
p_rgh
);
15
dimensionedScalar
compressibility =
fvc::domainIntegrate
(
psi
);
16
bool
compressible = (compressibility.value() > SMALL);
17
18
surfaceScalarField
buoyancyPhi =
rhorUAf
*
ghf
*
fvc::snGrad
(
rho
)*
mesh
.magSf();
19
phi
-= buoyancyPhi;
20
21
// Solve pressure
22
for
(
int
nonOrth=0; nonOrth<=
nNonOrthCorr
; nonOrth++)
23
{
24
fvScalarMatrix
p_rghEqn
25
(
26
fvm::laplacian
(
rhorUAf
,
p_rgh
) ==
fvc::div
(
phi
)
27
);
28
29
p_rghEqn.setReference
30
(
31
pRefCell
,
32
compressible ?
getRefCellValue
(
p_rgh
,
pRefCell
) :
pRefValue
33
);
34
35
eqnResidual
= p_rghEqn.solve().initialResidual();
36
37
// Retain the residual from the first iteration
38
if
(nonOrth == 0)
39
{
40
maxResidual
=
max
(
eqnResidual
,
maxResidual
);
41
}
42
43
if
(nonOrth ==
nNonOrthCorr
)
44
{
45
// Calculate the conservative fluxes
46
phi
-= p_rghEqn.flux();
47
48
// Explicitly relax pressure for momentum corrector
49
p_rgh
.relax();
50
51
// Correct the momentum source with the pressure gradient flux
52
// calculated from the relaxed pressure
53
U
-= rUA*
fvc::reconstruct
((buoyancyPhi + p_rghEqn.flux())/
rhorUAf
);
54
U
.correctBoundaryConditions();
55
}
56
}
57
58
p
=
p_rgh
+
rho
*
gh
;
59
60
#include <
finiteVolume/continuityErrs.H
>
61
62
// For closed-volume cases adjust the pressure level
63
// to obey overall mass continuity
64
if
(closedVolume && compressible)
65
{
66
p
+= (
initialMass
-
fvc::domainIntegrate
(
thermo
.rho()))
67
/compressibility;
68
p_rgh
=
p
-
rho
*
gh
;
69
}
70
71
rho
=
thermo
.rho();
72
rho
=
max
(
rho
,
rhoMin
[i]);
73
rho
=
min
(
rho
,
rhoMax
[i]);
74
rho
.relax();
75
76
Info
<<
"Min/max rho:"
<<
min
(
rho
).value() <<
' '
77
<<
max
(
rho
).value() <<
endl
;
78
79
// Update thermal conductivity
80
K
=
thermo
.Cp()*
turb
.alphaEff();
81
}