ENH: overset: clean-up interpolation triggering. See #1041.

This commit is contained in:
mattijs
2018-10-17 08:54:34 +01:00
parent 4cce1d74d2
commit 03b5870c07

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -113,60 +113,27 @@ void Foam::oversetFvPatchField<Type>::initEvaluate
<< fldName << endl; << fldName << endl;
} }
} }
else if else if (!fvSchemes.found("oversetInterpolation"))
(
!fvSchemes.found("oversetInterpolation")
|| (
fvSchemes.found("oversetInterpolationRequired")
== fvSchemes.found("oversetInterpolationSuppressed")
)
)
{ {
IOWarningInFunction(fvSchemes) IOWarningInFunction(fvSchemes)
<< "Missing required dictionary entries" << "Missing required dictionary entry"
<< " 'oversetInterpolation' and 'oversetInterpolationRequired'" << " 'oversetInterpolation'"
<< " or 'oversetInterpolationSuppressed'"
<< ". Skipping overset interpolation for field " << ". Skipping overset interpolation for field "
<< fldName << endl; << fldName << endl;
} }
else if (fvSchemes.found("oversetInterpolationSuppressed")) else if (fvSchemes.found("oversetInterpolationRequired"))
{ {
// Add the stencil suppression list // Backwards compatibility mode: only interpolate what is
wordHashSet suppressed(Stencil::New(mesh).nonInterpolatedFields()); // explicitly mentioned
const dictionary* dictPtr if (fvSchemes.found("oversetInterpolationSuppressed"))
(
fvSchemes.findDict("oversetInterpolationSuppressed")
);
if (dictPtr)
{ {
suppressed.insert(dictPtr->toc()); FatalIOErrorInFunction(fvSchemes)
<< "Cannot have both dictionary entry"
<< " 'oversetInterpolationSuppresed' and "
<< " 'oversetInterpolationRequired' for field "
<< fldName << exit(FatalIOError);
} }
if (!suppressed.found(fldName))
{
if (debug)
{
Info<< "Interpolating non-suppressed field " << fldName
<< endl;
}
mesh.interpolate
(
const_cast<Field<Type>&>
(
this->primitiveField()
)
);
}
else if (debug)
{
Info<< "Skipping suppressed overset interpolation for field "
<< fldName << endl;
}
}
else
{
const dictionary& intDict = fvSchemes.subDict const dictionary& intDict = fvSchemes.subDict
( (
"oversetInterpolationRequired" "oversetInterpolationRequired"
@ -197,6 +164,49 @@ void Foam::oversetFvPatchField<Type>::initEvaluate
<< fldName << endl; << fldName << endl;
} }
} }
else
{
const dictionary* dictPtr
(
fvSchemes.subDictPtr("oversetInterpolationSuppressed")
);
const wordHashSet& suppress =
Stencil::New(mesh).nonInterpolatedFields();
bool skipInterpolate = suppress.found(fldName);
if (dictPtr)
{
skipInterpolate =
skipInterpolate
|| dictPtr->found(fldName);
}
if (skipInterpolate)
{
if (debug)
{
Info<< "Skipping suppressed overset interpolation"
<< " for field " << fldName << endl;
}
}
else
{
if (debug)
{
Info<< "Interpolating non-suppressed field " << fldName
<< endl;
}
mesh.interpolate
(
const_cast<Field<Type>&>
(
this->primitiveField()
)
);
}
}
} }
} }