diff --git a/src/overset/oversetPolyPatch/oversetFvPatchField.C b/src/overset/oversetPolyPatch/oversetFvPatchField.C index b0698afc32ebfe70daac56b2496cc4ab6236bb8e..2a72d57e20f5376d74e66542c007e2f7abdde0f6 100644 --- a/src/overset/oversetPolyPatch/oversetFvPatchField.C +++ b/src/overset/oversetPolyPatch/oversetFvPatchField.C @@ -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]; diff --git a/src/overset/oversetPolyPatch/oversetFvPatchField.H b/src/overset/oversetPolyPatch/oversetFvPatchField.H index 9cae63dc43caff5a9882fcb9114da016b45dc458..9ed9aa99c073ac5b33b148c2223066b391feba32 100644 --- a/src/overset/oversetPolyPatch/oversetFvPatchField.H +++ b/src/overset/oversetPolyPatch/oversetFvPatchField.H @@ -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 (