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:
@ -149,8 +149,7 @@ public:
|
|||||||
tmp<GeometricField<Type, fvPatchField, volMesh>>
|
tmp<GeometricField<Type, fvPatchField, volMesh>>
|
||||||
decomposeField
|
decomposeField
|
||||||
(
|
(
|
||||||
const GeometricField<Type, fvPatchField, volMesh>& field,
|
const GeometricField<Type, fvPatchField, volMesh>& field
|
||||||
const bool allowUnknownPatchFields = false
|
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Decompose surface field
|
//- Decompose surface field
|
||||||
|
|||||||
@ -29,6 +29,7 @@ License
|
|||||||
#include "processorCyclicFvPatchField.H"
|
#include "processorCyclicFvPatchField.H"
|
||||||
#include "processorCyclicFvsPatchField.H"
|
#include "processorCyclicFvsPatchField.H"
|
||||||
#include "emptyFvPatchFields.H"
|
#include "emptyFvPatchFields.H"
|
||||||
|
#include "stringOps.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -85,8 +86,7 @@ template<class Type>
|
|||||||
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>>
|
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>>
|
||||||
Foam::fvFieldDecomposer::decomposeField
|
Foam::fvFieldDecomposer::decomposeField
|
||||||
(
|
(
|
||||||
const GeometricField<Type, fvPatchField, volMesh>& field,
|
const GeometricField<Type, fvPatchField, volMesh>& field
|
||||||
const bool allowUnknownPatchFields
|
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
// Create dummy patch fields
|
// Create dummy patch fields
|
||||||
@ -153,6 +153,23 @@ Foam::fvFieldDecomposer::decomposeField
|
|||||||
}
|
}
|
||||||
else if (isA<processorCyclicFvPatch>(procPatch))
|
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 =
|
const label nbrCompletePatchi =
|
||||||
refCast<const processorCyclicFvPatch>(procPatch)
|
refCast<const processorCyclicFvPatch>(procPatch)
|
||||||
.referPatch().nbrPatchID();
|
.referPatch().nbrPatchID();
|
||||||
@ -193,18 +210,6 @@ Foam::fvFieldDecomposer::decomposeField
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if (allowUnknownPatchFields)
|
|
||||||
{
|
|
||||||
bf.set
|
|
||||||
(
|
|
||||||
procPatchi,
|
|
||||||
new emptyFvPatchField<Type>
|
|
||||||
(
|
|
||||||
procPatch,
|
|
||||||
resF()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
|
|||||||
@ -31,6 +31,7 @@ License
|
|||||||
#include "emptyFvPatchField.H"
|
#include "emptyFvPatchField.H"
|
||||||
#include "emptyFvsPatchField.H"
|
#include "emptyFvsPatchField.H"
|
||||||
#include "processorCyclicFvPatch.H"
|
#include "processorCyclicFvPatch.H"
|
||||||
|
#include "stringOps.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * 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
|
patchFields[completePatchi].rmap
|
||||||
(
|
(
|
||||||
procField.boundaryField()[procPatchi],
|
procField.boundaryField()[procPatchi],
|
||||||
|
|||||||
@ -514,9 +514,7 @@ Foam::cyclicTransform::cyclicTransform
|
|||||||
if (ctrNbrCtrTDistance > lengthScale*matchTolerance)
|
if (ctrNbrCtrTDistance > lengthScale*matchTolerance)
|
||||||
{
|
{
|
||||||
OStringStream str;
|
OStringStream str;
|
||||||
|
str << "Patches " << name << " and " << nbrName << " are potentially "
|
||||||
str << nl
|
|
||||||
<< "Patches " << name << " and " << nbrName << " are potentially "
|
|
||||||
<< "not geometrically similar enough to be coupled." << nl << nl
|
<< "not geometrically similar enough to be coupled." << nl << nl
|
||||||
<< "The distance between the transformed centres of these patches "
|
<< "The distance between the transformed centres of these patches "
|
||||||
<< "is " << ctrNbrCtrTDistance << ", which is greater than the "
|
<< "is " << ctrNbrCtrTDistance << ", which is greater than the "
|
||||||
@ -529,9 +527,8 @@ Foam::cyclicTransform::cyclicTransform
|
|||||||
<< "is failing, then it might be appropriate to relax the failure "
|
<< "is failing, then it might be appropriate to relax the failure "
|
||||||
<< "criteria by increasing the \"matchTolerance\" setting for "
|
<< "criteria by increasing the \"matchTolerance\" setting for "
|
||||||
<< "these patches in the \"polyMesh/boundary\" file.";
|
<< "these patches in the \"polyMesh/boundary\" file.";
|
||||||
|
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< stringOps::breakIntoIndentedLines(str.str(), 80, 4).c_str()
|
<< nl << stringOps::breakIntoIndentedLines(str.str()).c_str()
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user