Merge branch 'fix-adjointRotatingWall-sens' into 'master'

BUG: adjointRotatingWallVelocity causes sensitivities to crash. Fixes #3180

Closes #3180

See merge request Development/openfoam!690
This commit is contained in:
Andrew Heather
2024-06-11 10:39:58 +00:00

View File

@ -419,20 +419,22 @@ void Foam::incompressibleAdjointSolver::accumulateBCSensitivityIntegrand
{ {
fvPatchVectorField& Uab = UaBoundary[patchI]; fvPatchVectorField& Uab = UaBoundary[patchI];
if (isA<adjointVectorBoundaryCondition>(Uab)) if (isA<adjointVectorBoundaryCondition>(Uab))
{
tmp<tensorField> dxdbMult =
refCast<adjointVectorBoundaryCondition>(Uab).dxdbMult();
if (dxdbMult)
{ {
const fvPatch& patch = mesh_.boundary()[patchI]; const fvPatch& patch = mesh_.boundary()[patchI];
tmp<vectorField> tnf = patch.nf(); tmp<vectorField> tnf = patch.nf();
const scalarField& magSf = patch.magSf(); const scalarField& magSf = patch.magSf();
tmp<vectorField> DvDbMult = tmp<vectorField> DvDbMult =
nuEffBoundary[patchI]*(Uab.snGrad() + (gradUabf[patchI] & tnf)) nuEffBoundary[patchI]
*(Uab.snGrad() + (gradUabf[patchI] & tnf))
// - (nf*pa.boundaryField()[patchI]) // - (nf*pa.boundaryField()[patchI])
+ adjointTurbulence().adjointMomentumBCSource()[patchI]; + adjointTurbulence().adjointMomentumBCSource()[patchI];
bcDxDbMult()[patchI] += bcDxDbMult()[patchI] += (DvDbMult & dxdbMult())*magSf*dt;
( }
DvDbMult
& refCast<adjointVectorBoundaryCondition>(Uab).dxdbMult()
)*magSf*dt;
} }
} }
} }