DAFoam
v3.0.6
Discrete Adjoint with OpenFOAM
dafoam
src
adjoint
DASolver
DASimpleFoam
solvePseudoUEqn.H
Go to the documentation of this file.
1
// Overwrite the r.h.s.
2
pseudoUEqn
.source() = USource.primitiveField();
3
4
// Make sure that boundary contribution to source is zero,
5
// Alternatively, we can deduct source by boundary contribution, so that it would cancel out during solve.
6
forAll
(
pseudoU
.boundaryField(), patchI)
7
{
8
const
fvPatch& pp =
pseudoU
.boundaryField()[patchI].patch();
9
forAll
(pp, faceI)
10
{
11
label cellI = pp.faceCells()[faceI];
12
//myDiag[cellI] += TEqn.internalCoeffs()[patchI][faceI];
13
pseudoUEqn
.source()[cellI] -=
pseudoUEqn
.boundaryCoeffs()[patchI][faceI];
14
//pseudoUEqn.boundaryCoeffs()[patchI][faceI][0] = 0;
15
//pseudoUEqn.boundaryCoeffs()[patchI][faceI][1] = 0;
16
//pseudoUEqn.boundaryCoeffs()[patchI][faceI][2] = 0;
17
}
18
}
19
20
// Before solve, force xEqn.psi() to be solved into all zero
21
forAll
(
pseudoU
.primitiveFieldRef(), cellI)
22
{
23
pseudoU
.primitiveFieldRef()[cellI][0] = 0;
24
pseudoU
.primitiveFieldRef()[cellI][1] = 0;
25
pseudoU
.primitiveFieldRef()[cellI][2] = 0;
26
}
27
28
pseudoUEqn
.solve(solverDictU_);
pseudoU
volVectorField pseudoU("pseudoU", U)
forAll
forAll(pseudoU.boundaryField(), patchI)
Definition:
solvePseudoUEqn.H:6
pseudoUEqn
fvVectorMatrix pseudoUEqn(fvm::div(phi, pseudoU, divScheme) - fvm::laplacian(nuEff, pseudoU))
Generated by
1.8.17