BUG: reconstructPar: prevent crashes when operating on processor cases (#1143)

From OpenFOAM Foundation e4d89daf5d

The main issue here was that reconstructPar is serial but coupled() in
cyclicAMIFvPatch.C could return true if both sides of the patch was present
(this->size() && neighbFvPatch().size()). However, this would result in an
evaluate call in cyclicAMIFvPatchField. This would only work if both sides
were completely contained on the same processor. The change in logic prevents
coupled() from returning true when called in serial for a decomposed case.

Signed-off-by: Kutalmis Bercin <kutalmis.bercin@esi-group.com>
This commit is contained in:
Darrin Stephens
2020-08-29 21:24:51 +10:00
committed by Kutalmis Bercin
parent d392bf9841
commit b42db6cee5
7 changed files with 40 additions and 16 deletions

View File

@ -64,9 +64,16 @@ Foam::cyclicAMIFvPatchField<Type>::cyclicAMIFvPatchField
<< exit(FatalIOError);
}
if (!dict.found("value") && this->coupled())
if (!dict.found("value"))
{
this->evaluate(Pstream::commsTypes::blocking);
if (this->coupled())
{
this->evaluate(Pstream::commsTypes::blocking);
}
else
{
fvPatchField<Type>::operator=(this->patchInternalField());
}
}
}

View File

@ -115,19 +115,7 @@ Foam::cyclicAMIFvsPatchField<Type>::cyclicAMIFvsPatchField
template<class Type>
bool Foam::cyclicAMIFvsPatchField<Type>::coupled() const
{
if
(
Pstream::parRun()
|| (
this->cyclicAMIPatch_.size()
&& this->cyclicAMIPatch_.cyclicAMIPatch().neighbPatch().size()
)
)
{
return true;
}
return false;
return cyclicAMIPatch_.coupled();
}

View File

@ -29,6 +29,7 @@ License
#include "cyclicAMIFvPatch.H"
#include "addToRunTimeSelectionTable.H"
#include "fvMesh.H"
#include "Time.H"
#include "transform.H"
#include "surfaceFields.H"
@ -52,7 +53,9 @@ namespace Foam
bool Foam::cyclicAMIFvPatch::coupled() const
{
return Pstream::parRun() || (this->size() && neighbFvPatch().size());
return
Pstream::parRun()
|| !this->boundaryMesh().mesh().time().processorCase();
}

View File

@ -27,6 +27,8 @@ License
#include "cyclicAMIPointPatch.H"
#include "pointBoundaryMesh.H"
#include "pointMesh.H"
#include "Time.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -105,4 +107,14 @@ Foam::cyclicAMIPointPatch::~cyclicAMIPointPatch()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::cyclicAMIPointPatch::coupled() const
{
return
Pstream::parRun()
|| !this->boundaryMesh().mesh().mesh().time().processorCase();
}
// ************************************************************************* //

View File

@ -114,6 +114,9 @@ public:
// Member Functions
//- Return true if this patch field is coupled
virtual bool coupled() const;
//- Return the constraint type this pointPatch implements.
virtual const word& constraintType() const
{

View File

@ -111,6 +111,13 @@ Foam::cyclicAMIPointPatchField<Type>::cyclicAMIPointPatchField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
bool Foam::cyclicAMIPointPatchField<Type>::coupled() const
{
return cyclicAMIPatch_.coupled();
}
template<class Type>
void Foam::cyclicAMIPointPatchField<Type>::swapAddSeparated
(

View File

@ -211,6 +211,10 @@ public:
// Evaluation functions
//- Return true if coupled. Note that the underlying patch
//- is not coupled() - the points don't align.
virtual bool coupled() const;
//- Evaluate the patch field
virtual void evaluate
(