DAFoam
v3.0.6
Discrete Adjoint with OpenFOAM
dafoam
src
adjoint
DASolver
DASimpleFoam
solvePseudoPEqn.H
Go to the documentation of this file.
1
// Overwrite the r.h.s.
2
pseudoPEqn
.source() = pSource.primitiveField();
3
4
// pEqn.setReference(pRefCell, pRefValue);
5
// Here, pRefCell is a label, and pRefValue is a scalar
6
pseudoPEqn
.setReference(0, 0.0);
7
8
// Make sure that boundary contribution to source is zero,
9
// Alternatively, we can deduct source by boundary contribution, so that it would cancel out during solve.
10
forAll
(
pseudoP
.boundaryField(), patchI)
11
{
12
const
fvPatch& pp =
pseudoP
.boundaryField()[patchI].patch();
13
forAll
(pp, faceI)
14
{
15
label cellI = pp.faceCells()[faceI];
16
pseudoPEqn
.source()[cellI] -=
pseudoPEqn
.boundaryCoeffs()[patchI][faceI];
17
//pseudoPEqn.boundaryCoeffs()[patchI][faceI] = 0;
18
}
19
}
20
21
// Before solve, force xEqn.psi() to be solved into all zero
22
forAll
(
pseudoP
.primitiveFieldRef(), cellI)
23
{
24
pseudoP
.primitiveFieldRef()[cellI] = 0;
25
}
26
27
pseudoPEqn
.solve(solverDictP_);
pseudoP
volScalarField pseudoP("pseudoP", p)
forAll
forAll(pseudoP.boundaryField(), patchI)
Definition:
solvePseudoPEqn.H:10
pseudoPEqn
fvScalarMatrix pseudoPEqn(fvm::laplacian(rAU, pseudoP))
Generated by
1.8.17