Commit 3e1ee52c authored by mattijs's avatar mattijs Committed by Andrew Heather
Browse files

ENH: overset: overlap communications

parent 7cc9961f
......@@ -211,6 +211,59 @@ void Foam::oversetFvPatchField<Type>::initEvaluate
}
template<class Type>
void Foam::oversetFvPatchField<Type>::initInterfaceMatrixUpdate
(
scalarField&,
const bool add,
const scalarField& psiInternal,
const scalarField&,
const direction,
const Pstream::commsTypes commsType
) const
{
// Add remote values
const oversetFvPatch& ovp = this->oversetPatch_;
if (ovp.master())
{
const fvMesh& mesh = this->patch().boundaryMesh().mesh();
// Try to find out if the solve routine comes from the mesh
// TBD. This should be cleaner.
if (&mesh.lduAddr() == &mesh.fvMesh::lduAddr())
{
return;
}
const mapDistribute& map = ovp.cellInterpolationMap();
// Transfer the current state (similar to processorFvPatchField). Note
// use of separate tag to avoid clashes with any outstanding processor
// exchanges
if (this->pBufs_.valid())
{
this->pBufs_().clear();
}
else
{
this->pBufs_.set
(
new PstreamBuffers
(
Pstream::commsTypes::nonBlocking,
UPstream::msgType()+1
)
);
}
// Start sending
map.mapDistributeBase::send(this->pBufs_(), psiInternal);
}
}
template<class Type>
void Foam::oversetFvPatchField<Type>::updateInterfaceMatrix
(
......@@ -251,11 +304,14 @@ void Foam::oversetFvPatchField<Type>::updateInterfaceMatrix
const scalarList& factor = ovp.cellInterpolationWeight();
const scalarField& normalisation = ovp.normalisation();
// Since we're inside initEvaluate/evaluate there might be processor
// comms underway. Change the tag we use.
scalarField work(psiInternal);
map.mapDistributeBase::distribute(work, UPstream::msgType()+1);
//scalarField work(psiInternal);
//map.mapDistributeBase::distribute(work, UPstream::msgType()+1);
// Receive the outstanding data
scalarField work;
map.receive(this->pBufs_(), work);
forAll(cellIDs, i)
{
......@@ -263,6 +319,7 @@ void Foam::oversetFvPatchField<Type>::updateInterfaceMatrix
const scalarList& w = wghts[celli];
const labelList& nbrs = stencil[celli];
scalar f = factor[celli];
const scalar norm = normalisation[celli];
......
......@@ -56,6 +56,14 @@ class oversetFvPatchField
:
public semiImplicitOversetFvPatchField<Type>
{
protected:
// Protected data
//- Send/receive buffer
mutable autoPtr<PstreamBuffers> pBufs_;
public:
//- Runtime type information
......@@ -127,6 +135,18 @@ public:
//- Initialise the evaluation of the patch field
virtual void initEvaluate(const Pstream::commsTypes commsType);
//- Initialise neighbour matrix update. Add
// or subtract coupled contributions to matrix
virtual void initInterfaceMatrixUpdate
(
scalarField&,
const bool add,
const scalarField&,
const scalarField&,
const direction,
const Pstream::commsTypes commsType
) const;
//- Update result field based on interface functionality
virtual void updateInterfaceMatrix
(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment