DAFoam
v3.0.6
Discrete Adjoint with OpenFOAM
dafoam
src
adjoint
DASolver
DAPimpleDyMFoam
pEqnPimpleDyM.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
(
5
"phiHbyA"
,
6
fvc::flux(
HbyA
)
7
+
MRF
.zeroFilter(fvc::interpolate(
rAU
)*fvc::ddtCorr(
U
,
phi
, Uf))
8
);
9
10
MRF
.makeRelative(
phiHbyA
);
11
12
if
(
p
.needReference())
13
{
14
fvc::makeRelative
(
phiHbyA
,
U
);
15
adjustPhi
(
phiHbyA
,
U
,
p
);
16
fvc::makeAbsolute(
phiHbyA
,
U
);
17
}
18
19
tmp<volScalarField>
rAtU
(
rAU
);
20
21
if
(
pimple
.consistent())
22
{
23
rAtU
= 1.0/max(1.0/
rAU
-
UEqn
.H1(), 0.1/
rAU
);
24
phiHbyA
+=
25
fvc::interpolate(
rAtU
() -
rAU
)*fvc::snGrad(
p
)*
mesh
.magSf();
26
HbyA
-= (
rAU
-
rAtU
())*fvc::grad(
p
);
27
}
28
29
if
(
pimple
.nCorrPISO() <= 1)
30
{
31
tUEqn
.clear();
32
}
33
34
// Update the pressure BCs to ensure flux consistency
35
constrainPressure
(
p
,
U
,
phiHbyA
,
rAtU
(),
MRF
);
36
37
// Non-orthogonal pressure corrector loop
38
while
(
pimple
.correctNonOrthogonal())
39
{
40
fvScalarMatrix pEqn
41
(
42
fvm::laplacian(
rAtU
(),
p
) == fvc::div(
phiHbyA
)
43
);
44
45
pEqn.setReference(
pRefCell
,
pRefValue
);
46
47
pEqn.solve(
mesh
.solver(
p
.select(
pimple
.finalInnerIter())));
48
49
if
(
pimple
.finalNonOrthogonalIter())
50
{
51
phi
=
phiHbyA
- pEqn.flux();
52
}
53
}
54
55
#include "continuityErrs.H"
56
57
// Explicitly relax pressure for momentum corrector
58
p
.relax();
59
60
U
=
HbyA
-
rAtU
*fvc::grad(
p
);
61
U
.correctBoundaryConditions();
62
fvOptions.correct(
U
);
63
64
// Correct Uf if the mesh is moving
65
fvc::correctUf(Uf,
U
,
phi
);
66
67
// Make the fluxes relative to the mesh motion
68
fvc::makeRelative
(
phi
,
U
);
tUEqn
tmp< fvVectorMatrix > tUEqn(fvm::ddt(U)+fvm::div(phi, U)+MRF.DDt(U)+turbulence->divDevReff(U)==fvOptions(U))
adjustPhi
adjustPhi(phiHbyA, U, p)
U
U
Definition:
pEqnPimpleDyM.H:60
pRefValue
scalar & pRefValue
Definition:
createRefsPimple.H:12
UEqn
fvVectorMatrix & UEqn
Definition:
UEqnPimpleDyM.H:13
constrainPressure
constrainPressure(p, U, phiHbyA, rAtU(), MRF)
pRefCell
label & pRefCell
Definition:
createRefsPimple.H:11
MRF
IOMRFZoneListDF & MRF
Definition:
createRefsRhoSimple.H:18
p
volScalarField & p
Definition:
createRefsPimple.H:6
makeRelative
MRF makeRelative(phiHbyA)
pimple
pimpleControlDF & pimple
Definition:
createRefsPimple.H:5
mesh
fvMesh & mesh
Definition:
createRefsHeatTransfer.H:4
phi
surfaceScalarField & phi
Definition:
createRefsPimple.H:8
phiHbyA
surfaceScalarField phiHbyA("phiHbyA", fvc::flux(HbyA)+MRF.zeroFilter(fvc::interpolate(rAU) *fvc::ddtCorr(U, phi, Uf)))
rAtU
tmp< volScalarField > rAtU(rAU)
rAU
volScalarField rAU(1.0/UEqn.A())
HbyA
volVectorField HbyA(constrainHbyA(rAU *UEqn.H(), U, p))
Generated by
1.8.17