DAFoam
v3.0.6
Discrete Adjoint with OpenFOAM
dafoam
src
adjoint
DASolver
DASimpleFoam
pseudoEqns.H
Go to the documentation of this file.
1
word
divScheme
=
"div(phi,U)"
;
2
if
(daOptionPtr_->getSubDictOption<label>(
"adjEqnOption"
,
"fpPCUpwind"
))
3
{
4
divScheme
=
"div(pc)"
;
5
}
6
// Duplicate U as pseudoU
7
volVectorField
pseudoU
(
"pseudoU"
,
U
);
8
// Get the pseudoUEqn,
9
// the most important thing here is to make sure the l.h.s. matches that of UEqn.
10
fvVectorMatrix
pseudoUEqn
(
11
fvm::div(
phi
,
pseudoU
,
divScheme
)
12
- fvm::laplacian(nuEff,
pseudoU
));
13
pseudoUEqn
.relax(relaxUEqn_);
14
15
// Swap upper() and lower()
16
swap
(
pseudoUEqn
.upper(),
pseudoUEqn
.lower());
17
// Get UDiag as D
18
List<scalar>
UDiag
=
pseudoUEqn
.D();
19
// Get rAU
20
volScalarField
rAU
(1.0 /
pseudoUEqn
.A());
21
22
// *********************************** //
23
// Duplicate p as pseudoP
24
volScalarField
pseudoP
(
"pseudoP"
,
p
);
25
// Get the pseudoPEqn,
26
// the most important thing here is to make sure the l.h.s. matches that of pEqn.
27
fvScalarMatrix
pseudoPEqn
(
28
fvm::laplacian(
rAU
,
pseudoP
));
29
// Swap upper() and lower()
30
swap
(
pseudoPEqn
.upper(),
pseudoPEqn
.lower());
31
32
// *********************************** //
33
// Use lookupObject to access pseudoNuTilda
34
volScalarField&
pseudoNuTilda
=
const_cast<
volScalarField&
>
(db.lookupObject<volScalarField>(
"pseudoNuTilda"
));
35
// Construct pseudoNuTildaEqn
36
daTurbulenceModelPtr_->constructPseudoNuTildaEqn();
37
38
/*
39
// Get myChi and myFv1
40
volScalarField myChi("myChi", chi(pseudoNuTilda, nu));
41
volScalarField myFv1("myFv1", fv1(myChi, Cv1));
42
// Alternatively, we can do below
43
//volScalarField myChi = chi(nuTilda, nu);
44
//volScalarField myFv1 = fv1(myChi, Cv1);
45
46
// Get myStilda
47
volScalarField myStilda(
48
"myStilda",
49
fv3(myChi, myFv1, Cv2) * ::sqrt(2.0) * mag(skew(fvc::grad(U))) + fv2(myChi, myFv1, Cv2) * nuTilda / sqr(kappa * y));
50
// Alternatively, we can do below
51
//volScalarField myStilda = Stilda(myChi, myFv1, U, nuTilda, y, kappa, Cs);
52
53
// Get the pseudoNuTildaEqn,
54
// the most important thing here is to make sure the l.h.s. mathces that of nuTildaEqn.
55
// Some explicit terms that only contributes to the r.h.s. are diabled
56
fvScalarMatrix pseudoNuTildaEqn(
57
fvm::ddt(pseudoNuTilda)
58
+ fvm::div(phi, pseudoNuTilda)
59
- fvm::laplacian(DnuTildaEff(pseudoNuTilda, nu, sigmaNut), pseudoNuTilda)
60
//- Cb2 / sigmaNut * magSqr(fvc::grad(pseudoNuTilda))
61
==
62
//Cb1 * myStilda * pseudoNuTilda
63
-fvm::Sp(Cw1 * fw(myStilda, pseudoNuTilda, y, kappa, Cw2, Cw3) * pseudoNuTilda / sqr(y), pseudoNuTilda));
64
pseudoNuTildaEqn.relax();
65
66
// Swap upper() and lower()
67
swap(pseudoNuTildaEqn.upper(), pseudoNuTildaEqn.lower());
68
*/
U
U
Definition:
pEqnPimpleDyM.H:60
swap
swap(pseudoUEqn.upper(), pseudoUEqn.lower())
pseudoP
volScalarField pseudoP("pseudoP", p)
rAU
volScalarField rAU(1.0/pseudoUEqn.A())
pseudoU
volVectorField pseudoU("pseudoU", U)
pseudoNuTilda
volScalarField & pseudoNuTilda
Definition:
pseudoEqns.H:34
p
volScalarField & p
Definition:
createRefsPimple.H:6
phi
surfaceScalarField & phi
Definition:
createRefsPimple.H:8
divScheme
word divScheme
Definition:
pseudoEqns.H:1
UDiag
List< scalar > UDiag
Definition:
pseudoEqns.H:18
pseudoUEqn
fvVectorMatrix pseudoUEqn(fvm::div(phi, pseudoU, divScheme) - fvm::laplacian(nuEff, pseudoU))
pseudoPEqn
fvScalarMatrix pseudoPEqn(fvm::laplacian(rAU, pseudoP))
Generated by
1.8.17