decomposePar, reconstructPar: Catch decomposition of overridden cyclics

Patch fields on cyclic patches which have overridden the cyclic
constraint using a "patchType cyclic;" setting cannot be decomposed.
OpenFOAM does not have processor variants of jumpCyclic,
porousBafflePressure, etc... Using these conditions in a decomposed case
requires the cyclic to be constrained to a single processor.

This change catches this problem in decomposePar and reconstructPar and
raises a fatal error, rather than continuing and silently converting
these overridden boundary conditions to a standard processorCyclic patch
field.

Resolves bug report https://bugs.openfoam.org/view.php?id=3916
This commit is contained in:
Will Bainbridge
2022-10-21 09:17:14 +01:00
parent b1de509a77
commit a7155a7e0a
4 changed files with 40 additions and 21 deletions

View File

@ -149,8 +149,7 @@ public:
tmp<GeometricField<Type, fvPatchField, volMesh>>
decomposeField
(
const GeometricField<Type, fvPatchField, volMesh>& field,
const bool allowUnknownPatchFields = false
const GeometricField<Type, fvPatchField, volMesh>& field
) const;
//- Decompose surface field

View File

@ -29,6 +29,7 @@ License
#include "processorCyclicFvPatchField.H"
#include "processorCyclicFvsPatchField.H"
#include "emptyFvPatchFields.H"
#include "stringOps.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
@ -85,8 +86,7 @@ template<class Type>
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>>
Foam::fvFieldDecomposer::decomposeField
(
const GeometricField<Type, fvPatchField, volMesh>& field,
const bool allowUnknownPatchFields
const GeometricField<Type, fvPatchField, volMesh>& field
) const
{
// Create dummy patch fields
@ -153,6 +153,23 @@ Foam::fvFieldDecomposer::decomposeField
}
else if (isA<processorCyclicFvPatch>(procPatch))
{
if (field.boundaryField()[completePatchi].overridesConstraint())
{
OStringStream str;
str << "\nThe field \"" << field.name()
<< "\" on cyclic patch \""
<< field.boundaryField()[completePatchi].patch().name()
<< "\" cannot be decomposed as it is not a cyclic "
<< "patch field. A \"patchType cyclic;\" setting has "
<< "been used to override the cyclic patch type.\n\n"
<< "Cyclic patches like this with non-cyclic boundary "
<< "conditions should be confined to a single "
<< "processor using decomposition constraints.";
FatalErrorInFunction
<< stringOps::breakIntoIndentedLines(str.str()).c_str()
<< exit(FatalError);
}
const label nbrCompletePatchi =
refCast<const processorCyclicFvPatch>(procPatch)
.referPatch().nbrPatchID();
@ -193,18 +210,6 @@ Foam::fvFieldDecomposer::decomposeField
)
);
}
else if (allowUnknownPatchFields)
{
bf.set
(
procPatchi,
new emptyFvPatchField<Type>
(
procPatch,
resF()
)
);
}
else
{
FatalErrorInFunction

View File

@ -31,6 +31,7 @@ License
#include "emptyFvPatchField.H"
#include "emptyFvsPatchField.H"
#include "processorCyclicFvPatch.H"
#include "stringOps.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
@ -212,6 +213,23 @@ Foam::fvFieldReconstructor::reconstructFvVolumeField
);
}
if (patchFields[completePatchi].overridesConstraint())
{
OStringStream str;
str << "\nThe field \"" << procFields[0].name()
<< "\" on cyclic patch \""
<< patchFields[completePatchi].patch().name()
<< "\" cannot be reconstructed as it is not a cyclic "
<< "patch field. A \"patchType cyclic;\" setting has "
<< "been used to override the cyclic patch type.\n\n"
<< "Cyclic patches like this with non-cyclic boundary "
<< "conditions should be confined to a single "
<< "processor using decomposition constraints.";
FatalErrorInFunction
<< stringOps::breakIntoIndentedLines(str.str()).c_str()
<< exit(FatalError);
}
patchFields[completePatchi].rmap
(
procField.boundaryField()[procPatchi],