Skip to content
Permalink
Browse files

coupledFvPatches: Prevent crashes when operating on processor cases

  • Loading branch information...
Will Bainbridge
Will Bainbridge committed May 10, 2019
1 parent 4163d53 commit e4d89daf5de85f31c98012102c7dea2e29351ff2
@@ -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());
}
}
}

@@ -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();
}


@@ -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();
}


@@ -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();
}


// ************************************************************************* //
@@ -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
{
@@ -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
(
@@ -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
(

0 comments on commit e4d89da

Please sign in to comment.
You can’t perform that action at this time.