coupledFvPatches: Prevent crashes when operating on processor cases

This commit is contained in:
Will Bainbridge
2019-05-10 12:00:54 +01:00
parent 4163d53eec
commit e4d89daf5d
7 changed files with 46 additions and 24 deletions

View File

@ -63,9 +63,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

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -114,21 +114,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;
}
else
{
return false;
}
return cyclicAMIPatch_.coupled();
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -26,6 +26,7 @@ License
#include "cyclicAMIFvPatch.H"
#include "addToRunTimeSelectionTable.H"
#include "fvMesh.H"
#include "Time.H"
#include "transform.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -103,7 +104,9 @@ void Foam::cyclicAMIFvPatch::makeWeights(scalarField& w) const
bool Foam::cyclicAMIFvPatch::coupled() const
{
return Pstream::parRun() || (this->size() && neighbFvPatch().size());
return
Pstream::parRun()
|| !this->boundaryMesh().mesh().time().processorCase();
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -25,6 +25,8 @@ License
#include "cyclicAMIPointPatch.H"
#include "pointBoundaryMesh.H"
#include "pointMesh.H"
#include "Time.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -96,4 +98,14 @@ Foam::cyclicAMIPointPatch::~cyclicAMIPointPatch()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::cyclicAMIPointPatch::coupled() const
{
return
Pstream::parRun()
|| !this->boundaryMesh().mesh().mesh().time().processorCase();
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -112,6 +112,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

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -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

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -208,6 +208,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
(