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
buoyantSimpleFoam
pEqn.H
Go to the documentation of this file.
1
{
2
rho
=
thermo
.rho();
3
rho
.relax();
4
5
volScalarField
rUA
= 1.0/
UEqn
().A();
6
surfaceScalarField
rhorUAf
(
"(rho*(1|A(U)))"
,
fvc::interpolate
(
rho
*rUA));
7
8
U
= rUA*
UEqn
().H();
9
UEqn
.clear();
10
11
phi
=
fvc::interpolate
(
rho
)*(
fvc::interpolate
(
U
) &
mesh
.Sf());
12
bool
closedVolume
=
adjustPhi
(
phi
,
U
,
p_rgh
);
13
14
surfaceScalarField
buoyancyPhi =
rhorUAf
*
ghf
*
fvc::snGrad
(
rho
)*
mesh
.magSf();
15
phi
-= buoyancyPhi;
16
17
for
(
int
nonOrth=0; nonOrth<=
nNonOrthCorr
; nonOrth++)
18
{
19
fvScalarMatrix
p_rghEqn
20
(
21
fvm::laplacian
(
rhorUAf
,
p_rgh
) ==
fvc::div
(
phi
)
22
);
23
24
p_rghEqn.setReference
25
(
26
pRefCell
,
getRefCellValue
(
p_rgh
,
pRefCell
)
27
);
28
29
eqnResidual
= p_rghEqn.solve().initialResidual();
30
31
// Retain the residual from the first iteration
32
if
(nonOrth == 0)
33
{
34
maxResidual
=
max
(
eqnResidual
,
maxResidual
);
35
}
36
37
if
(nonOrth ==
nNonOrthCorr
)
38
{
39
// Calculate the conservative fluxes
40
phi
-= p_rghEqn.flux();
41
42
// Explicitly relax pressure for momentum corrector
43
p_rgh
.relax();
44
45
// Correct the momentum source with the pressure gradient flux
46
// calculated from the relaxed pressure
47
U
-= rUA*
fvc::reconstruct
((buoyancyPhi + p_rghEqn.flux())/
rhorUAf
);
48
U
.correctBoundaryConditions();
49
}
50
}
51
52
#include <
finiteVolume/continuityErrs.H
>
53
54
p
=
p_rgh
+
rho
*
gh
;
55
56
// For closed-volume cases adjust the pressure level
57
// to obey overall mass continuity
58
if
(closedVolume)
59
{
60
p
+= (
initialMass
-
fvc::domainIntegrate
(
psi
*
p
))
61
/
fvc::domainIntegrate
(
psi
);
62
p_rgh
=
p
-
rho
*
gh
;
63
}
64
65
rho
=
thermo
.rho();
66
rho
.relax();
67
Info
<<
"rho max/min : "
<<
max
(
rho
).value() <<
" "
<<
min
(
rho
).value()
68
<<
endl
;
69
}