DAFoam
v3.0.6
Discrete Adjoint with OpenFOAM
dafoam
src
adjoint
DASolver
DAPimpleFoam
pEqnPimple.H
Go to the documentation of this file.
1
volScalarField
rAU
(1.0 /
UEqn
.A());
2
volVectorField
HbyA
(constrainHbyA(
rAU
*
UEqn
.H(),
U
,
p
));
3
surfaceScalarField
phiHbyA
(
4
"phiHbyA"
,
5
fvc::flux(
HbyA
)
6
+ fvc::interpolate(
rAU
) * fvc::ddtCorr(
U
,
phi
));
7
8
adjustPhi
(
phiHbyA
,
U
,
p
);
9
10
tmp<volScalarField>
rAtU
(
rAU
);
11
12
if
(
pimple
.consistent())
13
{
14
rAtU
= 1.0 / max(1.0 /
rAU
-
UEqn
.H1(), 0.1 /
rAU
);
15
phiHbyA
+=
16
fvc::interpolate(
rAtU
() -
rAU
) * fvc::snGrad(
p
) *
mesh
.magSf();
17
HbyA
-= (
rAU
-
rAtU
()) * fvc::grad(
p
);
18
}
19
20
if
(
pimple
.nCorrPISO() <= 1)
21
{
22
tUEqn
.clear();
23
}
24
25
// Non-orthogonal pressure corrector loop
26
while
(
pimple
.correctNonOrthogonal())
27
{
28
// Pressure corrector
29
fvScalarMatrix pEqn(
30
fvm::laplacian(
rAtU
(),
p
) == fvc::div(
phiHbyA
));
31
32
pEqn.setReference(
pRefCell
,
pRefValue
);
33
34
// get the solver performance info such as initial
35
// and final residuals
36
SolverPerformance<scalar> solverP = pEqn.solve(
mesh
.solver(
p
.select(
pimple
.finalInnerIter())));
37
38
this->
primalResidualControl<scalar>
(solverP, printToScreen, printInterval,
"p"
);
39
40
if
(
pimple
.finalNonOrthogonalIter())
41
{
42
phi
=
phiHbyA
- pEqn.flux();
43
}
44
}
45
46
if
(printToScreen)
47
{
48
#include "
continuityErrsPython.H
"
49
}
50
51
// Explicitly relax pressure for momentum corrector
52
p
.relax();
53
54
U
=
HbyA
-
rAtU
() * fvc::grad(
p
);
55
U
.correctBoundaryConditions();
rAtU
tmp< volScalarField > rAtU(rAU)
tUEqn
tmp< fvVectorMatrix > tUEqn(fvm::ddt(U)+fvm::div(phi, U)+MRF.DDt(U)+turbulence->divDevReff(U)==fvOptions(U))
adjustPhi
adjustPhi(phiHbyA, U, p)
pRefValue
scalar & pRefValue
Definition:
createRefsPimple.H:12
UEqn
fvVectorMatrix & UEqn
Definition:
UEqnPimpleDyM.H:13
pRefCell
label & pRefCell
Definition:
createRefsPimple.H:11
rAU
volScalarField rAU(1.0/UEqn.A())
phiHbyA
surfaceScalarField phiHbyA("phiHbyA", fvc::flux(HbyA)+fvc::interpolate(rAU) *fvc::ddtCorr(U, phi))
p
volScalarField & p
Definition:
createRefsPimple.H:6
continuityErrsPython.H
pimple
pimpleControlDF & pimple
Definition:
createRefsPimple.H:5
mesh
fvMesh & mesh
Definition:
createRefsHeatTransfer.H:4
primalResidualControl< scalar >
this primalResidualControl< scalar >(solverE, printToScreen, printInterval, "he")
phi
surfaceScalarField & phi
Definition:
createRefsPimple.H:8
U
U
Definition:
pEqnPimple.H:54
HbyA
volVectorField HbyA(constrainHbyA(rAU *UEqn.H(), U, p))
Generated by
1.8.17