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

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