Skip to content
Snippets Groups Projects
Commit 803caa40 authored by Vaggelis Papoutsis's avatar Vaggelis Papoutsis Committed by Andrew Heather
Browse files

ENH: when using (E)SI sensitivities and a symmetry(Plane) is included

in the sensitivity patches, symmetry::evaluate() needs access to the
internalField which does exist, leading to wrong memory access.

Fixed by specifying a calculated type fvPatchField for all patches when
creating a boundaryField<Type>

Using a symmetry(Plane) as a sensitivity patch is quite rare and
borderline wrong, but this provides a fix nonetheless.
parent 36ca1171
Branches
Tags
1 merge request!518ENH: adjoint code review
......@@ -88,13 +88,30 @@ createZeroBoundaryPtr
typedef typename GeometricField<Type, fvPatchField, volMesh>::Boundary
Boundary;
// Make sure that the patchFields to be generated will be of type
// calculated, even if they are of constraint type
// Necessary to avoid unexpected behaviour when computing sensitivities
// on symmetry patches (not a good practice either way)
const fvBoundaryMesh& bm = mesh.boundary();
wordList actualPatchTypes(bm.size(), word::null);
forAll(actualPatchTypes, pI)
{
auto patchTypeCstrIter =
fvPatchField<Type>::patchConstructorTablePtr_->cfind(bm[pI].type());
if (patchTypeCstrIter.found())
{
actualPatchTypes[pI] = bm[pI].type();
}
}
autoPtr<Boundary> bPtr
(
new Boundary
(
mesh.boundary(),
mesh.V()*pTraits<Type>::zero, // Dummy internal field,
calculatedFvPatchField<Type>::typeName
wordList(bm.size(), calculatedFvPatchField<Type>::typeName),
actualPatchTypes
)
);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment