diff --git a/dumux/decoupled/common/fv/fvpressure.hh b/dumux/decoupled/common/fv/fvpressure.hh index 1b05b20502a46a5be125cc1dd42c1da1fa4e62b5..49674e43dcf8624c1df05eeaf2095e2a443a50f5 100644 --- a/dumux/decoupled/common/fv/fvpressure.hh +++ b/dumux/decoupled/common/fv/fvpressure.hh @@ -393,11 +393,15 @@ void FVPressure<TypeTag>::assemble(bool first) int globalIdxJ = problem_.variables().index(*elementNeighbor); - //check for hanging nodes - //take a hanging node never from the element with smaller level! + // check for hanging nodes + // take a hanging node never from the element with smaller level! bool haveSameLevel = (eIt->level() == elementNeighbor->level()); - //calculate only from one side, but add matrix entries for both sides - if (GET_PROP_VALUE(TypeTag, VisitFacesOnlyOnce) && (globalIdxI > globalIdxJ) && haveSameLevel) + // calculate only from one side, but add matrix entries for both sides + // the last condition is needed to properly assemble in the presence + // of ghost elements + if (GET_PROP_VALUE(TypeTag, VisitFacesOnlyOnce) + && (globalIdxI > globalIdxJ) && haveSameLevel + && elementNeighbor->partitionType() == Dune::InteriorEntity) continue; //check for hanging nodes @@ -410,10 +414,12 @@ void FVPressure<TypeTag>::assemble(bool first) // set diagonal entry A_[globalIdxI][globalIdxI] += entries[matrix]; - // set off-diagonal entry + // set off-diagonal entry A_[globalIdxI][globalIdxJ] -= entries[matrix]; - if (GET_PROP_VALUE(TypeTag, VisitFacesOnlyOnce)) + // The second condition is needed to not spoil the ghost element entries + if (GET_PROP_VALUE(TypeTag, VisitFacesOnlyOnce) + && elementNeighbor->partitionType() == Dune::InteriorEntity) { f_[globalIdxJ] += entries[rhs]; A_[globalIdxJ][globalIdxJ] += entries[matrix]; diff --git a/dumux/decoupled/common/fv/fvtransport.hh b/dumux/decoupled/common/fv/fvtransport.hh index 5a260d61fb31859769a42658faf5c65f9f951754..8123012022f9609d07d1b700545076ec9d4f1114 100644 --- a/dumux/decoupled/common/fv/fvtransport.hh +++ b/dumux/decoupled/common/fv/fvtransport.hh @@ -22,6 +22,7 @@ #include <dune/grid/common/gridenums.hh> #include <dumux/decoupled/common/transportproperties.hh> #include <dumux/decoupled/common/decoupledproperties.hh> +#include <dumux/linear/vectorexchange.hh> /** * @file @@ -279,6 +280,18 @@ void FVTransport<TypeTag>::update(const Scalar t, Scalar& dt, TransportSolutionT //store update cellDataI.setUpdate(updateVec[globalIdxI]); } // end grid traversal + +#if HAVE_MPI + // communicate updated values + typedef typename GET_PROP(TypeTag, SolutionTypes) SolutionTypes; + typedef typename SolutionTypes::ElementMapper ElementMapper; + typedef VectorExchange<ElementMapper, Dune::BlockVector<Dune::FieldVector<Scalar, 1> > > DataHandle; + DataHandle dataHandle(problem_.variables().elementMapper(), updateVec); + problem_.gridView().template communicate<DataHandle>(dataHandle, + Dune::InteriorBorder_All_Interface, + Dune::ForwardCommunication); + dt = problem_.gridView().comm().min(dt); +#endif } }