diff --git a/dumux/common/intersectionmapper.hh b/dumux/common/intersectionmapper.hh index cd54a0623825365831d0d65f2f3dac3c13297c2d..77a3f9afdbb06e5ed85a91cc5632702f91194dab 100644 --- a/dumux/common/intersectionmapper.hh +++ b/dumux/common/intersectionmapper.hh @@ -36,7 +36,6 @@ class IntersectionMapper typedef typename GridView::Grid Grid; enum {dim=Grid::dimension}; typedef typename Grid::template Codim<0>::Entity Element; - typedef typename Grid::template Codim<0>::EntityPointer ElementPointer; typedef typename GridView::template Codim<0>::Iterator ElementIterator; typedef typename GridView::IntersectionIterator IntersectionIterator; typedef typename GridView::Intersection Intersection; @@ -167,10 +166,10 @@ public: { if (isIt->neighbor()) { - ElementPointer neighbor = isIt->outside(); - int globalIdxNeighbor = map(*neighbor); + auto neighbor = isIt->outside(); + int globalIdxNeighbor = map(neighbor); - if (eIt->level() > neighbor->level() || (eIt->level() == neighbor->level() && eIdxGlobal < globalIdxNeighbor)) + if (eIt->level() > neighbor.level() || (eIt->level() == neighbor.level() && eIdxGlobal < globalIdxNeighbor)) { int faceIdxNeighbor = 0; @@ -180,12 +179,12 @@ public: } else { - IntersectionIterator isItNEnd = gridView_.iend(*neighbor); - for (IntersectionIterator isItN = gridView_.ibegin(*neighbor); isItN != isItNEnd; ++isItN) + IntersectionIterator isItNEnd = gridView_.iend(neighbor); + for (IntersectionIterator isItN = gridView_.ibegin(neighbor); isItN != isItNEnd; ++isItN) { if (isItN->neighbor()) { - if (isItN->outside() == eIt) + if (isItN->outside() == *eIt) { break; } diff --git a/dumux/decoupled/1p/diffusion/fv/fvpressure1p.hh b/dumux/decoupled/1p/diffusion/fv/fvpressure1p.hh index c48e1372d846504a209fcc9edfef81ff855c191e..b181a5808cb8af2d3966319f776a9a1eaa4bfd10 100644 --- a/dumux/decoupled/1p/diffusion/fv/fvpressure1p.hh +++ b/dumux/decoupled/1p/diffusion/fv/fvpressure1p.hh @@ -86,7 +86,6 @@ template<class TypeTag> class FVPressure1P: public FVPressure<TypeTag> typedef typename GridView::Traits::template Codim<0>::Entity Element; typedef typename GridView::template Codim<0>::Iterator ElementIterator; - typedef typename GridView::template Codim<0>::EntityPointer ElementPointer; typedef typename GridView::Intersection Intersection; typedef Dune::FieldVector<Scalar, dimWorld> GlobalPosition; @@ -244,12 +243,12 @@ template<class TypeTag> void FVPressure1P<TypeTag>::getFlux(Dune::FieldVector<Scalar, 2>& entry, const Intersection& intersection , const CellData& cellData, const bool first) { - ElementPointer elementI = intersection.inside(); - ElementPointer elementJ = intersection.outside(); + auto elementI = intersection.inside(); + auto elementJ = intersection.outside(); // get global coordinates of cell centers - const GlobalPosition& globalPosI = elementI->geometry().center(); - const GlobalPosition& globalPosJ = elementJ->geometry().center(); + const GlobalPosition& globalPosI = elementI.geometry().center(); + const GlobalPosition& globalPosJ = elementJ.geometry().center(); //get face normal const Dune::FieldVector<Scalar, dim>& unitOuterNormal = intersection.centerUnitOuterNormal(); @@ -266,8 +265,8 @@ void FVPressure1P<TypeTag>::getFlux(Dune::FieldVector<Scalar, 2>& entry, const I // compute vectorized permeabilities DimMatrix meanPermeability(0); - problem_.spatialParams().meanK(meanPermeability, problem_.spatialParams().intrinsicPermeability(*elementI), - problem_.spatialParams().intrinsicPermeability(*elementJ)); + problem_.spatialParams().meanK(meanPermeability, problem_.spatialParams().intrinsicPermeability(elementI), + problem_.spatialParams().intrinsicPermeability(elementJ)); Dune::FieldVector<Scalar, dim> permeability(0); meanPermeability.mv(unitOuterNormal, permeability); @@ -294,10 +293,10 @@ template<class TypeTag> void FVPressure1P<TypeTag>::getFluxOnBoundary(Dune::FieldVector<Scalar, 2>& entry, const Intersection& intersection, const CellData& cellData, const bool first) { - ElementPointer element = intersection.inside(); + auto element = intersection.inside(); // get global coordinates of cell centers - const GlobalPosition& globalPosI = element->geometry().center(); + const GlobalPosition& globalPosI = element.geometry().center(); // center of face in global coordinates const GlobalPosition& globalPosJ = intersection.geometry().center(); @@ -327,7 +326,7 @@ const Intersection& intersection, const CellData& cellData, const bool first) DimMatrix meanPermeability(0); problem_.spatialParams().meanK(meanPermeability, - problem_.spatialParams().intrinsicPermeability(*element)); + problem_.spatialParams().intrinsicPermeability(element)); Dune::FieldVector<Scalar, dim> permeability(0); meanPermeability.mv(unitOuterNormal, permeability); diff --git a/dumux/decoupled/1p/diffusion/fv/fvvelocity1p.hh b/dumux/decoupled/1p/diffusion/fv/fvvelocity1p.hh index 53c7640f4f02e6a452832a543775870ca6b48c98..375372ffaeca50b13e27783c6d8824a9363ebe61 100644 --- a/dumux/decoupled/1p/diffusion/fv/fvvelocity1p.hh +++ b/dumux/decoupled/1p/diffusion/fv/fvvelocity1p.hh @@ -63,7 +63,6 @@ class FVVelocity1P typedef typename GridView::Traits::template Codim<0>::Entity Element; typedef typename GridView::IntersectionIterator IntersectionIterator; typedef typename GridView::Intersection Intersection; - typedef typename GridView::template Codim<0>::EntityPointer ElementPointer; enum { @@ -205,16 +204,16 @@ private: template<class TypeTag> void FVVelocity1P<TypeTag>::calculateVelocity(const Intersection& intersection, CellData& cellData) { - ElementPointer elementI = intersection.inside(); - ElementPointer elementJ = intersection.outside(); + auto elementI = intersection.inside(); + auto elementJ = intersection.outside(); - int eIdxGlobalJ = problem_.variables().index(*elementJ); + int eIdxGlobalJ = problem_.variables().index(elementJ); CellData& cellDataJ = problem_.variables().cellData(eIdxGlobalJ); // get global coordinates of cell centers - const GlobalPosition& globalPosI = elementI->geometry().center(); - const GlobalPosition& globalPosJ = elementJ->geometry().center(); + const GlobalPosition& globalPosI = elementI.geometry().center(); + const GlobalPosition& globalPosJ = elementJ.geometry().center(); //get face index int isIndexI = intersection.indexInInside(); @@ -232,8 +231,8 @@ void FVVelocity1P<TypeTag>::calculateVelocity(const Intersection& intersection, // compute vectorized permeabilities DimMatrix meanPermeability(0); - problem_.spatialParams().meanK(meanPermeability, problem_.spatialParams().intrinsicPermeability(*elementI), - problem_.spatialParams().intrinsicPermeability(*elementJ)); + problem_.spatialParams().meanK(meanPermeability, problem_.spatialParams().intrinsicPermeability(elementI), + problem_.spatialParams().intrinsicPermeability(elementJ)); Dune::FieldVector < Scalar, dim > permeability(0); meanPermeability.mv(unitOuterNormal, permeability); @@ -277,7 +276,7 @@ void FVVelocity1P<TypeTag>::calculateVelocity(const Intersection& intersection, template<class TypeTag> void FVVelocity1P<TypeTag>::calculateVelocityOnBoundary(const Intersection& intersection, CellData& cellData) { - ElementPointer element = intersection.inside(); + auto element = intersection.inside(); //get face index int isIndex = intersection.indexInInside(); @@ -295,7 +294,7 @@ void FVVelocity1P<TypeTag>::calculateVelocityOnBoundary(const Intersection& inte problem_.dirichlet(boundValues, intersection); // get global coordinates of cell centers - const GlobalPosition& globalPosI = element->geometry().center(); + const GlobalPosition& globalPosI = element.geometry().center(); // center of face in global coordinates const GlobalPosition& globalPosJ = intersection.geometry().center(); @@ -310,7 +309,7 @@ void FVVelocity1P<TypeTag>::calculateVelocityOnBoundary(const Intersection& inte // compute vectorized permeabilities DimMatrix meanPermeability(0); - problem_.spatialParams().meanK(meanPermeability, problem_.spatialParams().intrinsicPermeability(*element)); + problem_.spatialParams().meanK(meanPermeability, problem_.spatialParams().intrinsicPermeability(element)); //multiply with normal vector at the boundary Dune::FieldVector < Scalar, dim > permeability(0); diff --git a/dumux/decoupled/2p/diffusion/fv/fvpressure2p.hh b/dumux/decoupled/2p/diffusion/fv/fvpressure2p.hh index 4a69c039d64b6a91544eba54efba598954aa5397..37e5c46fe576abaae34679e9906015e09693c33f 100644 --- a/dumux/decoupled/2p/diffusion/fv/fvpressure2p.hh +++ b/dumux/decoupled/2p/diffusion/fv/fvpressure2p.hh @@ -143,7 +143,6 @@ template<class TypeTag> class FVPressure2P: public FVPressure<TypeTag> typedef typename GridView::template Codim<0>::Iterator ElementIterator; typedef typename GridView::Traits::template Codim<0>::Entity Element; - typedef typename GridView::template Codim<0>::EntityPointer ElementPointer; typedef typename GridView::Intersection Intersection; typedef Dune::FieldVector<Scalar, dimWorld> GlobalPosition; @@ -684,14 +683,14 @@ template<class TypeTag> void FVPressure2P<TypeTag>::getFlux(EntryType& entry, const Intersection& intersection , const CellData& cellData, const bool first) { - ElementPointer elementI = intersection.inside(); - ElementPointer elementJ = intersection.outside(); + auto elementI = intersection.inside(); + auto elementJ = intersection.outside(); - const CellData& cellDataJ = problem_.variables().cellData(problem_.variables().index(*elementJ)); + const CellData& cellDataJ = problem_.variables().cellData(problem_.variables().index(elementJ)); // get global coordinates of cell centers - const GlobalPosition& globalPosI = elementI->geometry().center(); - const GlobalPosition& globalPosJ = elementJ->geometry().center(); + const GlobalPosition& globalPosI = elementI.geometry().center(); + const GlobalPosition& globalPosJ = elementJ.geometry().center(); // get mobilities and fractional flow factors Scalar lambdaWI = cellData.mobility(wPhaseIdx); @@ -718,8 +717,8 @@ void FVPressure2P<TypeTag>::getFlux(EntryType& entry, const Intersection& inters // compute vectorized permeabilities DimMatrix meanPermeability(0); - problem_.spatialParams().meanK(meanPermeability, problem_.spatialParams().intrinsicPermeability(*elementI), - problem_.spatialParams().intrinsicPermeability(*elementJ)); + problem_.spatialParams().meanK(meanPermeability, problem_.spatialParams().intrinsicPermeability(elementI), + problem_.spatialParams().intrinsicPermeability(elementJ)); Dune::FieldVector<Scalar, dim> permeability(0); meanPermeability.mv(unitOuterNormal, permeability); @@ -809,10 +808,10 @@ template<class TypeTag> void FVPressure2P<TypeTag>::getFluxOnBoundary(EntryType& entry, const Intersection& intersection, const CellData& cellData, const bool first) { - ElementPointer element = intersection.inside(); + auto element = intersection.inside(); // get global coordinates of cell centers - const GlobalPosition& globalPosI = element->geometry().center(); + const GlobalPosition& globalPosI = element.geometry().center(); // center of face in global coordinates const GlobalPosition& globalPosJ = intersection.geometry().center(); @@ -854,7 +853,7 @@ const Intersection& intersection, const CellData& cellData, const bool first) DimMatrix meanPermeability(0); problem_.spatialParams().meanK(meanPermeability, - problem_.spatialParams().intrinsicPermeability(*element)); + problem_.spatialParams().intrinsicPermeability(element)); Dune::FieldVector<Scalar, dim> permeability(0); meanPermeability.mv(unitOuterNormal, permeability); @@ -885,13 +884,13 @@ const Intersection& intersection, const CellData& cellData, const bool first) satW = cellData.saturation(wPhaseIdx); satNw = cellData.saturation(nPhaseIdx); } - Scalar temperature = problem_.temperature(*element); + Scalar temperature = problem_.temperature(element); //get dirichlet pressure boundary condition Scalar pressBound = boundValues[pressureIdx]; //calculate consitutive relations depending on the kind of saturation used - Scalar pcBound = MaterialLaw::pc(problem_.spatialParams().materialLawParams(*element), satW); + Scalar pcBound = MaterialLaw::pc(problem_.spatialParams().materialLawParams(element), satW); //determine phase pressures from primary pressure variable Scalar pressW = 0; @@ -932,9 +931,9 @@ const Intersection& intersection, const CellData& cellData, const bool first) rhoMeanNw = 0.5 * (cellData.density(nPhaseIdx) + densityNwBound); } - Scalar lambdaWBound = MaterialLaw::krw(problem_.spatialParams().materialLawParams(*element), satW) + Scalar lambdaWBound = MaterialLaw::krw(problem_.spatialParams().materialLawParams(element), satW) / viscosityWBound; - Scalar lambdaNwBound = MaterialLaw::krn(problem_.spatialParams().materialLawParams(*element), satW) + Scalar lambdaNwBound = MaterialLaw::krn(problem_.spatialParams().materialLawParams(element), satW) / viscosityNwBound; Scalar fractionalWBound = lambdaWBound / (lambdaWBound + lambdaNwBound); diff --git a/dumux/decoupled/2p/diffusion/fv/fvpressure2padaptive.hh b/dumux/decoupled/2p/diffusion/fv/fvpressure2padaptive.hh index d411b77519886aa448e0e6eaf2bc1e77757c63ec..615efc2c074831a50e376fd9501f7fc2c7470668 100644 --- a/dumux/decoupled/2p/diffusion/fv/fvpressure2padaptive.hh +++ b/dumux/decoupled/2p/diffusion/fv/fvpressure2padaptive.hh @@ -80,7 +80,6 @@ template<class TypeTag> class FVPressure2PAdaptive: public FVPressure2P<TypeTag> rhs = ParentType::rhs, matrix = ParentType::matrix }; - typedef typename GridView::template Codim<0>::EntityPointer ElementPointer; typedef typename GridView::template Codim<0>::Iterator ElementIterator; typedef typename GridView::Intersection Intersection; typedef typename GridView::IntersectionIterator IntersectionIterator; @@ -251,30 +250,30 @@ template<class TypeTag> void FVPressure2PAdaptive<TypeTag>::getFlux(EntryType& entry, const Intersection& intersection , const CellData& cellData, const bool first) { - ElementPointer elementI = intersection.inside(); - ElementPointer elementJ = intersection.outside(); + auto elementI = intersection.inside(); + auto elementJ = intersection.outside(); - if (elementI->level() == elementJ->level() || dim == 3) + if (elementI.level() == elementJ.level() || dim == 3) { ParentType::getFlux(entry, intersection, cellData, first); //add the entry only once in case the VisitFacesOnlyOnce option is enabled!!! - if (GET_PROP_VALUE(TypeTag, VisitFacesOnlyOnce) && elementI->level() < elementJ->level()) + if (GET_PROP_VALUE(TypeTag, VisitFacesOnlyOnce) && elementI.level() < elementJ.level()) { entry = 0.; } } // hanging node situation: neighbor has higher level - else if (elementJ->level() == elementI->level() + 1) + else if (elementJ.level() == elementI.level() + 1) { - const CellData& cellDataJ = problem_.variables().cellData(problem_.variables().index(*elementJ)); + const CellData& cellDataJ = problem_.variables().cellData(problem_.variables().index(elementJ)); // get global coordinates of cell centers - const GlobalPosition& globalPosI = elementI->geometry().center(); - const GlobalPosition& globalPosJ = elementJ->geometry().center(); + const GlobalPosition& globalPosI = elementI.geometry().center(); + const GlobalPosition& globalPosJ = elementJ.geometry().center(); - int globalIdxI = problem_.variables().index(*elementI); - int globalIdxJ = problem_.variables().index(*elementJ); + int globalIdxI = problem_.variables().index(elementI); + int globalIdxJ = problem_.variables().index(elementJ); // get mobilities and fractional flow factors Scalar lambdaWI = cellData.mobility(wPhaseIdx); @@ -302,24 +301,24 @@ void FVPressure2PAdaptive<TypeTag>::getFlux(EntryType& entry, const Intersection // Count number of hanging nodes // not really necessary int globalIdxK = 0; - ElementPointer elementK = intersection.outside(); + auto elementK = intersection.outside(); // We are looking for two things: // IsIndexJ, the index of the interface from the neighbor-cell point of view // GlobalIdxK, the index of the third cell // Intersectioniterator around cell I - IntersectionIterator isItEndI = problem_.gridView().iend(*elementI); - for (IntersectionIterator isItI = problem_.gridView().ibegin(*elementI); isItI != isItEndI; ++isItI) + IntersectionIterator isItEndI = problem_.gridView().iend(elementI); + for (IntersectionIterator isItI = problem_.gridView().ibegin(elementI); isItI != isItEndI; ++isItI) { if (isItI->neighbor()) { - ElementPointer neighborPointer2 = isItI->outside(); + auto neighbor2 = isItI->outside(); // make sure we do not choose elemntI as third element // -> faces with hanging node have more than one intersection but only one face index! - if (neighborPointer2 != elementJ && isItI->indexInInside() == isIndexI) + if (neighbor2 != elementJ && isItI->indexInInside() == isIndexI) { - globalIdxK = problem_.variables().index(*neighborPointer2); - elementK = neighborPointer2; + globalIdxK = problem_.variables().index(neighbor2); + elementK = neighbor2; break; } } @@ -341,11 +340,11 @@ void FVPressure2PAdaptive<TypeTag>::getFlux(EntryType& entry, const Intersection FieldMatrix permeabilityK(0); problem_.spatialParams().meanK(permeabilityI, - problem_.spatialParams().intrinsicPermeability(*elementI)); + problem_.spatialParams().intrinsicPermeability(elementI)); problem_.spatialParams().meanK(permeabilityJ, - problem_.spatialParams().intrinsicPermeability(*elementJ)); + problem_.spatialParams().intrinsicPermeability(elementJ)); problem_.spatialParams().meanK(permeabilityK, - problem_.spatialParams().intrinsicPermeability(*elementK)); + problem_.spatialParams().intrinsicPermeability(elementK)); // Calculate permeablity component normal to interface Scalar kI, kJ, kK, kMean, ng; diff --git a/dumux/decoupled/2p/diffusion/fv/fvvelocity2p.hh b/dumux/decoupled/2p/diffusion/fv/fvvelocity2p.hh index 1bd508bd859b22c713ee915456d21d9fc86bfaa8..80e462444bd62327f97b920d0ea63abde2f675e3 100644 --- a/dumux/decoupled/2p/diffusion/fv/fvvelocity2p.hh +++ b/dumux/decoupled/2p/diffusion/fv/fvvelocity2p.hh @@ -76,7 +76,6 @@ class FVVelocity2P typedef typename GridView::template Codim<0>::Iterator ElementIterator; typedef typename GridView::Traits::template Codim<0>::Entity Element; - typedef typename GridView::template Codim<0>::EntityPointer ElementPointer; typedef typename GridView::Intersection Intersection; typedef typename GridView::IntersectionIterator IntersectionIterator; @@ -332,16 +331,16 @@ private: template<class TypeTag> void FVVelocity2P<TypeTag>::calculateVelocity(const Intersection& intersection, CellData& cellData) { - ElementPointer elementI = intersection.inside(); - ElementPointer elementJ = intersection.outside(); + auto elementI = intersection.inside(); + auto elementJ = intersection.outside(); - int eIdxGlobalJ = problem_.variables().index(*elementJ); + int eIdxGlobalJ = problem_.variables().index(elementJ); CellData& cellDataJ = problem_.variables().cellData(eIdxGlobalJ); // get global coordinates of cell centers - const GlobalPosition& globalPosI = (*elementI).geometry().center(); - const GlobalPosition& globalPosJ = (*elementJ).geometry().center(); + const GlobalPosition& globalPosI = (elementI).geometry().center(); + const GlobalPosition& globalPosJ = (elementJ).geometry().center(); // get mobilities and fractional flow factors Scalar lambdaWI = cellData.mobility(wPhaseIdx); @@ -369,8 +368,8 @@ void FVVelocity2P<TypeTag>::calculateVelocity(const Intersection& intersection, // compute vectorized permeabilities DimMatrix meanPermeability(0); - problem_.spatialParams().meanK(meanPermeability, problem_.spatialParams().intrinsicPermeability(*elementI), - problem_.spatialParams().intrinsicPermeability(*elementJ)); + problem_.spatialParams().meanK(meanPermeability, problem_.spatialParams().intrinsicPermeability(elementI), + problem_.spatialParams().intrinsicPermeability(elementJ)); Dune::FieldVector<Scalar, dim> permeability(0); meanPermeability.mv(unitOuterNormal, permeability); @@ -491,7 +490,7 @@ void FVVelocity2P<TypeTag>::calculateVelocity(const Intersection& intersection, template<class TypeTag> void FVVelocity2P<TypeTag>::calculateVelocityOnBoundary(const Intersection& intersection, CellData& cellData) { - ElementPointer element = intersection.inside(); + auto element = intersection.inside(); //get face index int isIndex = intersection.indexInInside(); @@ -509,7 +508,7 @@ void FVVelocity2P<TypeTag>::calculateVelocityOnBoundary(const Intersection& inte problem_.dirichlet(boundValues, intersection); // get global coordinates of cell centers - const GlobalPosition& globalPosI = (*element).geometry().center(); + const GlobalPosition& globalPosI = element.geometry().center(); // center of face in global coordinates const GlobalPosition& globalPosJ = intersection.geometry().center(); @@ -533,7 +532,7 @@ void FVVelocity2P<TypeTag>::calculateVelocityOnBoundary(const Intersection& inte // compute vectorized permeabilities DimMatrix meanPermeability(0); - problem_.spatialParams().meanK(meanPermeability, problem_.spatialParams().intrinsicPermeability(*element)); + problem_.spatialParams().meanK(meanPermeability, problem_.spatialParams().intrinsicPermeability(element)); Dune::FieldVector<Scalar, dim> permeability(0); meanPermeability.mv(unitOuterNormal, permeability); @@ -566,7 +565,7 @@ void FVVelocity2P<TypeTag>::calculateVelocityOnBoundary(const Intersection& inte } Scalar pressBound = boundValues[pressureIdx]; - Scalar pcBound = MaterialLaw::pc(problem_.spatialParams().materialLawParams(*element), satW); + Scalar pcBound = MaterialLaw::pc(problem_.spatialParams().materialLawParams(element), satW); //determine phase pressures from primary pressure variable Scalar pressWBound = 0; @@ -583,7 +582,7 @@ void FVVelocity2P<TypeTag>::calculateVelocityOnBoundary(const Intersection& inte } //get temperature at current position - Scalar temperature = problem_.temperature(*element); + Scalar temperature = problem_.temperature(element); Scalar densityWBound = density_[wPhaseIdx]; Scalar densityNwBound = density_[nPhaseIdx]; @@ -605,9 +604,9 @@ void FVVelocity2P<TypeTag>::calculateVelocityOnBoundary(const Intersection& inte viscosityNwBound = FluidSystem::viscosity(fluidState, nPhaseIdx) / densityNwBound; } - Scalar lambdaWBound = MaterialLaw::krw(problem_.spatialParams().materialLawParams(*element), satW) + Scalar lambdaWBound = MaterialLaw::krw(problem_.spatialParams().materialLawParams(element), satW) / viscosityWBound; - Scalar lambdaNwBound = MaterialLaw::krn(problem_.spatialParams().materialLawParams(*element), satW) + Scalar lambdaNwBound = MaterialLaw::krn(problem_.spatialParams().materialLawParams(element), satW) / viscosityNwBound; Scalar potentialDiffW = cellData.fluxData().upwindPotential(wPhaseIdx, isIndex); diff --git a/dumux/decoupled/2p/diffusion/fv/fvvelocity2padaptive.hh b/dumux/decoupled/2p/diffusion/fv/fvvelocity2padaptive.hh index 594c1af8585ccccdb0c8d67141ea3e4ddfbe9f11..ffa247de51d0069ca034c895fe14ec933ce4118d 100644 --- a/dumux/decoupled/2p/diffusion/fv/fvvelocity2padaptive.hh +++ b/dumux/decoupled/2p/diffusion/fv/fvvelocity2padaptive.hh @@ -54,7 +54,6 @@ class FVVelocity2PAdaptive: public FVVelocity2P<TypeTag> typedef typename GridView::template Codim<0>::Iterator ElementIterator; typedef typename GridView::IntersectionIterator IntersectionIterator; typedef typename GridView::Intersection Intersection; - typedef typename GridView::template Codim<0>::EntityPointer ElementPointer; enum { @@ -160,20 +159,20 @@ private: template<class TypeTag> void FVVelocity2PAdaptive<TypeTag>::calculateVelocity(const Intersection& intersection, CellData& cellData) { - ElementPointer elementI = intersection.inside(); - ElementPointer elementJ = intersection.outside(); + auto elementI = intersection.inside(); + auto elementJ = intersection.outside(); - if (elementI->level() == elementJ->level()) + if (elementI.level() == elementJ.level()) { ParentType::calculateVelocity(intersection, cellData); } - else if (elementJ->level() == elementI->level() + 1 && dim == 2) + else if (elementJ.level() == elementI.level() + 1 && dim == 2) { - CellData& cellDataJ = problem_.variables().cellData(problem_.variables().index(*elementJ)); + CellData& cellDataJ = problem_.variables().cellData(problem_.variables().index(elementJ)); // get global coordinates of cell centers - const GlobalPosition& globalPosI = elementI->geometry().center(); - const GlobalPosition& globalPosJ = elementJ->geometry().center(); + const GlobalPosition& globalPosI = elementI.geometry().center(); + const GlobalPosition& globalPosJ = elementJ.geometry().center(); // get mobilities and fractional flow factors Scalar lambdaWI = cellData.mobility(wPhaseIdx); @@ -203,26 +202,26 @@ void FVVelocity2PAdaptive<TypeTag>::calculateVelocity(const Intersection& inters int isIndexJ = intersection.indexInOutside(); int globalIdxK = 0; - ElementPointer elementK = intersection.outside(); + auto elementK = intersection.outside(); // We are looking for two things: // IsIndexJ, the index of the interface from the neighbor-cell point of view // GlobalIdxK, the index of the third cell // for efficienty this is done in one IntersectionIterator-Loop // Intersectioniterator around cell I - IntersectionIterator isItEndI = problem_.gridView().iend(*elementI); - for (IntersectionIterator isItI = problem_.gridView().ibegin(*elementI); isItI != isItEndI; ++isItI) + IntersectionIterator isItEndI = problem_.gridView().iend(elementI); + for (IntersectionIterator isItI = problem_.gridView().ibegin(elementI); isItI != isItEndI; ++isItI) { if (isItI->neighbor()) { - ElementPointer neighborPointer2 = isItI->outside(); + auto neighbor2 = isItI->outside(); // make sure we do not choose elemntI as third element // -> faces with hanging node have more than one intersection but only one face index! - if (neighborPointer2 != elementJ && isItI->indexInInside() == isIndexI) + if (neighbor2 != elementJ && isItI->indexInInside() == isIndexI) { - globalIdxK = problem_.variables().index(*neighborPointer2); - elementK = neighborPointer2; + globalIdxK = problem_.variables().index(neighbor2); + elementK = neighbor2; faceAreaSum += isItI->geometry().volume(); break; @@ -246,11 +245,11 @@ void FVVelocity2PAdaptive<TypeTag>::calculateVelocity(const Intersection& inters DimMatrix permeabilityK(0); problem_.spatialParams().meanK(permeabilityI, - problem_.spatialParams().intrinsicPermeability(*elementI)); + problem_.spatialParams().intrinsicPermeability(elementI)); problem_.spatialParams().meanK(permeabilityJ, - problem_.spatialParams().intrinsicPermeability(*elementJ)); + problem_.spatialParams().intrinsicPermeability(elementJ)); problem_.spatialParams().meanK(permeabilityK, - problem_.spatialParams().intrinsicPermeability(*elementK)); + problem_.spatialParams().intrinsicPermeability(elementK)); // Calculate permeablity component normal to interface Scalar kI, kJ, kK, ng, kMean; //, gI, gJ, gK; @@ -449,18 +448,18 @@ void FVVelocity2PAdaptive<TypeTag>::calculateVelocity(const Intersection& inters cellData.fluxData().addVelocity(wPhaseIdx, isIndexI, velocityW); cellData.fluxData().addVelocity(nPhaseIdx, isIndexI, velocityNw); } - else if (elementI->level() > elementJ->level() && dim == 3) + else if (elementI.level() > elementJ.level() && dim == 3) { - ElementPointer elementI = intersection.inside(); - ElementPointer elementJ = intersection.outside(); + auto elementI = intersection.inside(); + auto elementJ = intersection.outside(); - int globalIdxJ = problem_.variables().index(*elementJ); + int globalIdxJ = problem_.variables().index(elementJ); CellData& cellDataJ = problem_.variables().cellData(globalIdxJ); // get global coordinates of cell centers - const GlobalPosition& globalPosI = elementI->geometry().center(); - const GlobalPosition& globalPosJ = elementJ->geometry().center(); + const GlobalPosition& globalPosI = elementI.geometry().center(); + const GlobalPosition& globalPosJ = elementJ.geometry().center(); // get mobilities and fractional flow factors Scalar lambdaWI = cellData.mobility(wPhaseIdx); @@ -488,8 +487,8 @@ void FVVelocity2PAdaptive<TypeTag>::calculateVelocity(const Intersection& inters // compute vectorized permeabilities DimMatrix meanPermeability(0); - problem_.spatialParams().meanK(meanPermeability, problem_.spatialParams().intrinsicPermeability(*elementI), - problem_.spatialParams().intrinsicPermeability(*elementJ)); + problem_.spatialParams().meanK(meanPermeability, problem_.spatialParams().intrinsicPermeability(elementI), + problem_.spatialParams().intrinsicPermeability(elementJ)); Dune::FieldVector<Scalar, dim> permeability(0); meanPermeability.mv(unitOuterNormal, permeability); @@ -593,7 +592,7 @@ void FVVelocity2PAdaptive<TypeTag>::calculateVelocity(const Intersection& inters cellData.fluxData().setVelocity(nPhaseIdx, isIndexI, velocityNw); cellData.fluxData().setVelocityMarker(isIndexI); - Scalar weightingFactor = std::pow(0.5, (dim - 1)*(elementI->level() - elementJ->level())); + Scalar weightingFactor = std::pow(0.5, (dim - 1)*(elementI.level() - elementJ.level())); velocityW *= weightingFactor; velocityNw *= weightingFactor; diff --git a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2dpressure2p.hh b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2dpressure2p.hh index 2e846f5a9fa632d7d5ac267c92141d0751ff97f2..f8a7ac6c9f3dd81d3a1d04876951ffa701709c64 100644 --- a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2dpressure2p.hh +++ b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2dpressure2p.hh @@ -132,7 +132,6 @@ class FvMpfaL2dPressure2p: public FVPressure<TypeTag> typedef typename GridView::Traits::template Codim<0>::Entity Element; typedef typename GridView::template Codim<0>::Iterator ElementIterator; typedef typename GridView::template Codim<dim>::Iterator VertexIterator; - typedef typename GridView::template Codim<0>::EntityPointer ElementPointer; typedef typename GridView::IntersectionIterator IntersectionIterator; typedef Dune::FieldVector<Scalar, dim> LocalPosition; @@ -591,23 +590,20 @@ void FvMpfaL2dPressure2p<TypeTag>::initializeMatrix() if (isIt->neighbor() && nextIsIt->neighbor()) { // access the common neighbor of isIt's and nextIsIt's outside - ElementPointer outside = isIt->outside(); - ElementPointer nextisItoutside = nextIsIt->outside(); + auto outside = isIt->outside(); + auto nextisItoutside = nextIsIt->outside(); - IntersectionIterator innerisItEnd = problem_.gridView().iend(*outside); - IntersectionIterator innernextisItEnd = problem_.gridView().iend(*nextisItoutside); + IntersectionIterator innerisItEnd = problem_.gridView().iend(outside); + IntersectionIterator innernextisItEnd = problem_.gridView().iend(nextisItoutside); - for (IntersectionIterator innerisIt = problem_.gridView().ibegin(*outside); innerisIt != innerisItEnd; + for (IntersectionIterator innerisIt = problem_.gridView().ibegin(outside); innerisIt != innerisItEnd; ++innerisIt) - for (IntersectionIterator innernextisIt = problem_.gridView().ibegin(*nextisItoutside); + for (IntersectionIterator innernextisIt = problem_.gridView().ibegin(nextisItoutside); innernextisIt != innernextisItEnd; ++innernextisIt) { if (innerisIt->neighbor() && innernextisIt->neighbor()) { - ElementPointer innerisItoutside = innerisIt->outside(); - ElementPointer innernextisItoutside = innernextisIt->outside(); - - if (innerisItoutside == innernextisItoutside && innerisItoutside != isIt->inside()) + if (innerisIt->outside() == innernextisIt->outside() && innerisIt->outside() != isIt->inside()) { rowSize++; } @@ -686,8 +682,7 @@ void FvMpfaL2dPressure2p<TypeTag>::initializeMatrix() if (isIt->neighbor()) { // access neighbor - ElementPointer outside = isIt->outside(); - int eIdxGlobalJ = problem_.variables().index(*outside); + int eIdxGlobalJ = problem_.variables().index(isIt->outside()); // add off diagonal index // add index (row,col) to the matrix @@ -697,25 +692,25 @@ void FvMpfaL2dPressure2p<TypeTag>::initializeMatrix() if (isIt->neighbor() && nextIsIt->neighbor()) { // access the common neighbor of isIt's and nextIsIt's outside - ElementPointer outside = isIt->outside(); - ElementPointer nextisItoutside = nextIsIt->outside(); + auto outside = isIt->outside(); + auto nextisItoutside = nextIsIt->outside(); - IntersectionIterator innerisItEnd = problem_.gridView().iend(*outside); - IntersectionIterator innernextisItEnd = problem_.gridView().iend(*nextisItoutside); + IntersectionIterator innerisItEnd = problem_.gridView().iend(outside); + IntersectionIterator innernextisItEnd = problem_.gridView().iend(nextisItoutside); - for (IntersectionIterator innerisIt = problem_.gridView().ibegin(*outside); innerisIt != innerisItEnd; + for (IntersectionIterator innerisIt = problem_.gridView().ibegin(outside); innerisIt != innerisItEnd; ++innerisIt) - for (IntersectionIterator innernextisIt = problem_.gridView().ibegin(*nextisItoutside); + for (IntersectionIterator innernextisIt = problem_.gridView().ibegin(nextisItoutside); innernextisIt != innernextisItEnd; ++innernextisIt) { if (innerisIt->neighbor() && innernextisIt->neighbor()) { - ElementPointer innerisItoutside = innerisIt->outside(); - ElementPointer innernextisItoutside = innernextisIt->outside(); + auto innerisItoutside = innerisIt->outside(); + auto innernextisItoutside = innernextisIt->outside(); if (innerisItoutside == innernextisItoutside && innerisItoutside != isIt->inside()) { - int eIdxGlobalJ = problem_.variables().index(*innerisItoutside); + int eIdxGlobalJ = problem_.variables().index(innerisItoutside); this->A_.addindex(eIdxGlobalI, eIdxGlobalJ); } @@ -928,12 +923,12 @@ void FvMpfaL2dPressure2p<TypeTag>::storeInteractionVolumeInfo() if (isIt12->neighbor()) { // access neighbor cell 2 of 'isIt12' - ElementPointer elementPointer2 = isIt12->outside(); + auto element2 = isIt12->outside(); - int eIdxGlobal2 = problem_.variables().index(*elementPointer2); + int eIdxGlobal2 = problem_.variables().index(element2); //store pointer 2 - interactionVolumes_[globalVertIdx1234].setSubVolumeElement(elementPointer2, 1); + interactionVolumes_[globalVertIdx1234].setSubVolumeElement(element2, 1); interactionVolumes_[globalVertIdx1234].setIndexOnElement(isIt12->indexInOutside(), 1, 1); interactionVolumes_[globalVertIdx1234].setNormal(unitOuterNormal12, 1, 1); interactionVolumes_[globalVertIdx1234].setFaceArea(faceVol12, 1, 1); @@ -944,10 +939,10 @@ void FvMpfaL2dPressure2p<TypeTag>::storeInteractionVolumeInfo() { // neighbor cell 3 // access neighbor cell 3 - ElementPointer elementPointer4 = isIt14->outside(); + auto element4 = isIt14->outside(); //store pointer 4 - interactionVolumes_[globalVertIdx1234].setSubVolumeElement(elementPointer4, 3); + interactionVolumes_[globalVertIdx1234].setSubVolumeElement(element4, 3); interactionVolumes_[globalVertIdx1234].setIndexOnElement(isIt14->indexInOutside(), 3, 0); interactionVolumes_[globalVertIdx1234].setNormal(unitOuterNormal14, 3, 0); @@ -960,26 +955,26 @@ void FvMpfaL2dPressure2p<TypeTag>::storeInteractionVolumeInfo() GlobalPosition globalPosFace23(0); GlobalPosition globalPosFace34(0); - IntersectionIterator isIt2End = problem_.gridView().iend(*elementPointer2); - IntersectionIterator isIt4End = problem_.gridView().iend(*elementPointer4); - for (IntersectionIterator isIt23 = problem_.gridView().ibegin(*elementPointer2); isIt23 != isIt2End; + IntersectionIterator isIt2End = problem_.gridView().iend(element2); + IntersectionIterator isIt4End = problem_.gridView().iend(element4); + for (IntersectionIterator isIt23 = problem_.gridView().ibegin(element2); isIt23 != isIt2End; ++isIt23) { bool finished = false; - for (IntersectionIterator isIt43 = problem_.gridView().ibegin(*elementPointer4); + for (IntersectionIterator isIt43 = problem_.gridView().ibegin(element4); isIt43 != isIt4End; ++isIt43) { if (isIt23->neighbor() && isIt43->neighbor()) { - ElementPointer elementPointer32 = isIt23->outside(); - ElementPointer elementPointer34 = isIt43->outside(); + auto element32 = isIt23->outside(); + auto element34 = isIt43->outside(); // find the common neighbor cell between cell 2 and cell 3, except cell 1 - if (elementPointer32 == elementPointer34 && elementPointer32 != eIt) + if (element32 == element34 && element32 != eIt) { //store pointer 3 - interactionVolumes_[globalVertIdx1234].setSubVolumeElement(elementPointer32, 2); + interactionVolumes_[globalVertIdx1234].setSubVolumeElement(element32, 2); interactionVolumes_[globalVertIdx1234].setIndexOnElement(isIt23->indexInInside(), 1, 0); @@ -991,7 +986,7 @@ void FvMpfaL2dPressure2p<TypeTag>::storeInteractionVolumeInfo() 0); // get global coordinate of neighbor cell 4 center - globalPos3 = elementPointer32->geometry().center(); + globalPos3 = element32.geometry().center(); globalPosFace23 = isIt23->geometry().center(); globalPosFace34 = isIt43->geometry().center(); @@ -1065,8 +1060,8 @@ void FvMpfaL2dPressure2p<TypeTag>::storeInteractionVolumeInfo() bool finished = false; - IntersectionIterator isIt2End = problem_.gridView().iend(*elementPointer2); - for (IntersectionIterator isIt2 = problem_.gridView().ibegin(*elementPointer2); isIt2 != isIt2End; + IntersectionIterator isIt2End = problem_.gridView().iend(element2); + for (IntersectionIterator isIt2 = problem_.gridView().ibegin(element2); isIt2 != isIt2End; ++isIt2) { if (isIt2->boundary()) @@ -1077,7 +1072,7 @@ void FvMpfaL2dPressure2p<TypeTag>::storeInteractionVolumeInfo() dim); int globalVertIdx2corner = problem_.variables().index( - *((*elementPointer2).template subEntity < dim > (localVertIdx2corner))); + *((element2).template subEntity < dim > (localVertIdx2corner))); if (globalVertIdx2corner == globalVertIdx1234) { @@ -1182,23 +1177,23 @@ void FvMpfaL2dPressure2p<TypeTag>::storeInteractionVolumeInfo() { // neighbor cell 3 // access neighbor cell 3 - ElementPointer elementPointer4 = isIt14->outside(); + auto element4 = isIt14->outside(); interactionVolumes_[globalVertIdx1234].setIndexOnElement(isIt14->indexInOutside(), 3, 0); //store pointer 4 - interactionVolumes_[globalVertIdx1234].setSubVolumeElement(elementPointer4, 3); + interactionVolumes_[globalVertIdx1234].setSubVolumeElement(element4, 3); interactionVolumes_[globalVertIdx1234].setNormal(unitOuterNormal14, 3, 0); interactionVolumes_[globalVertIdx1234].setFaceArea(faceVol41, 3, 0); interactionVolumes_[globalVertIdx1234].setFacePosition(globalPosFace41, 3, 0); - int eIdxGlobal4 = problem_.variables().index(*elementPointer4); + int eIdxGlobal4 = problem_.variables().index(element4); bool finished = false; // get the information of the face 'isIt34' between cell3 and cell4 (locally numbered) - IntersectionIterator isIt4End = problem_.gridView().iend(*elementPointer4); - for (IntersectionIterator isIt4 = problem_.gridView().ibegin(*elementPointer4); isIt4 != isIt4End; + IntersectionIterator isIt4End = problem_.gridView().iend(element4); + for (IntersectionIterator isIt4 = problem_.gridView().ibegin(element4); isIt4 != isIt4End; ++isIt4) { if (isIt4->boundary()) @@ -1209,7 +1204,7 @@ void FvMpfaL2dPressure2p<TypeTag>::storeInteractionVolumeInfo() dim); int globalVertIdx4corner = problem_.variables().index( - *((*elementPointer4).template subEntity < dim > (localVertIdx4corner))); + *((element4).template subEntity < dim > (localVertIdx4corner))); if (globalVertIdx4corner == globalVertIdx1234) { @@ -1249,7 +1244,7 @@ void FvMpfaL2dPressure2p<TypeTag>::storeInteractionVolumeInfo() // get absolute permeability of neighbor cell 2 DimMatrix K4( - problem_.spatialParams().intrinsicPermeability(*elementPointer4)); + problem_.spatialParams().intrinsicPermeability(element4)); finished = true; @@ -1296,28 +1291,28 @@ void FvMpfaL2dPressure2p<TypeTag>::assemble() if (interactionVolume.isInnerVolume()) { - ElementPointer& elementPointer1 = interactionVolume.getSubVolumeElement(0); - ElementPointer& elementPointer2 = interactionVolume.getSubVolumeElement(1); - ElementPointer& elementPointer3 = interactionVolume.getSubVolumeElement(2); - ElementPointer& elementPointer4 = interactionVolume.getSubVolumeElement(3); + auto element1 = interactionVolume.getSubVolumeElement(0); + auto element2 = interactionVolume.getSubVolumeElement(1); + auto element3 = interactionVolume.getSubVolumeElement(2); + auto element4 = interactionVolume.getSubVolumeElement(3); // get global coordinate of cell centers - const GlobalPosition& globalPos1 = elementPointer1->geometry().center(); - const GlobalPosition& globalPos2 = elementPointer2->geometry().center(); - const GlobalPosition& globalPos3 = elementPointer3->geometry().center(); - const GlobalPosition& globalPos4 = elementPointer4->geometry().center(); + const GlobalPosition& globalPos1 = element1.geometry().center(); + const GlobalPosition& globalPos2 = element2.geometry().center(); + const GlobalPosition& globalPos3 = element3.geometry().center(); + const GlobalPosition& globalPos4 = element4.geometry().center(); // cell volumes - Scalar volume1 = elementPointer1->geometry().volume(); - Scalar volume2 = elementPointer2->geometry().volume(); - Scalar volume3 = elementPointer3->geometry().volume(); - Scalar volume4 = elementPointer4->geometry().volume(); + Scalar volume1 = element1.geometry().volume(); + Scalar volume2 = element2.geometry().volume(); + Scalar volume3 = element3.geometry().volume(); + Scalar volume4 = element4.geometry().volume(); // cell index - int eIdxGlobal1 = problem_.variables().index(*elementPointer1); - int eIdxGlobal2 = problem_.variables().index(*elementPointer2); - int eIdxGlobal3 = problem_.variables().index(*elementPointer3); - int eIdxGlobal4 = problem_.variables().index(*elementPointer4); + int eIdxGlobal1 = problem_.variables().index(element1); + int eIdxGlobal2 = problem_.variables().index(element2); + int eIdxGlobal3 = problem_.variables().index(element3); + int eIdxGlobal4 = problem_.variables().index(element4); //get the cell Data CellData& cellData1 = problem_.variables().cellData(eIdxGlobal1); @@ -1327,13 +1322,13 @@ void FvMpfaL2dPressure2p<TypeTag>::assemble() // evaluate right hand side PrimaryVariables source(0.0); - problem_.source(source, *elementPointer1); + problem_.source(source, element1); this->f_[eIdxGlobal1] += volume1 / (4.0) * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]); - problem_.source(source, *elementPointer2); + problem_.source(source, element2); this->f_[eIdxGlobal2] += volume2 / (4.0) * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]); - problem_.source(source, *elementPointer3); + problem_.source(source, element3); this->f_[eIdxGlobal3] += volume3 / (4.0) * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]); - problem_.source(source, *elementPointer4); + problem_.source(source, element4); this->f_[eIdxGlobal4] += volume4 / (4.0) * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]); this->f_[eIdxGlobal1] += evaluateErrorTerm_(cellData1) * volume1 / (4.0); @@ -1703,26 +1698,26 @@ void FvMpfaL2dPressure2p<TypeTag>::assemble() continue; } - ElementPointer& elementPointer = interactionVolume.getSubVolumeElement(elemIdx); + auto element = interactionVolume.getSubVolumeElement(elemIdx); // get global coordinate of cell centers - const GlobalPosition& globalPos = elementPointer->geometry().center(); + const GlobalPosition& globalPos = element.geometry().center(); // cell volumes - Scalar volume = elementPointer->geometry().volume(); + Scalar volume = element.geometry().volume(); // cell index - int eIdxGlobal = problem_.variables().index(*elementPointer); + int eIdxGlobal = problem_.variables().index(element); //get the cell Data CellData& cellData = problem_.variables().cellData(eIdxGlobal); //permeability vector at boundary - DimMatrix permeability(problem_.spatialParams().intrinsicPermeability(*elementPointer)); + DimMatrix permeability(problem_.spatialParams().intrinsicPermeability(element)); // evaluate right hand side PrimaryVariables source(0); - problem_.source(source, *elementPointer); + problem_.source(source, element); this->f_[eIdxGlobal] += volume / (4.0) * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]); this->f_[eIdxGlobal] += evaluateErrorTerm_(cellData) * volume / (4.0); @@ -1749,11 +1744,11 @@ void FvMpfaL2dPressure2p<TypeTag>::assemble() int boundaryFaceIdx = interactionVolume.getIndexOnElement(elemIdx, fIdx); const ReferenceElement& referenceElement = ReferenceElements::general( - elementPointer->geometry().type()); + element.geometry().type()); const LocalPosition& localPos = referenceElement.position(boundaryFaceIdx, 1); - const GlobalPosition& globalPosFace = elementPointer->geometry().global(localPos); + const GlobalPosition& globalPosFace = element.geometry().global(localPos); DimVector distVec(globalPosFace - globalPos); Scalar dist = distVec.two_norm(); @@ -1785,7 +1780,7 @@ void FvMpfaL2dPressure2p<TypeTag>::assemble() } Scalar pcBound = MaterialLaw::pc( - problem_.spatialParams().materialLawParams(*elementPointer), satWBound); + problem_.spatialParams().materialLawParams(element), satWBound); Scalar gravityDiffBound = (problem_.bBoxMax() - globalPosFace) * gravity_ * (density_[nPhaseIdx] - density_[wPhaseIdx]); @@ -1793,10 +1788,10 @@ void FvMpfaL2dPressure2p<TypeTag>::assemble() pcBound += gravityDiffBound; Dune::FieldVector<Scalar, numPhases> lambdaBound( - MaterialLaw::krw(problem_.spatialParams().materialLawParams(*elementPointer), + MaterialLaw::krw(problem_.spatialParams().materialLawParams(element), satWBound)); lambdaBound[nPhaseIdx] = MaterialLaw::krn( - problem_.spatialParams().materialLawParams(*elementPointer), satWBound); + problem_.spatialParams().materialLawParams(element), satWBound); lambdaBound[wPhaseIdx] /= viscosity_[wPhaseIdx]; lambdaBound[nPhaseIdx] /= viscosity_[nPhaseIdx]; diff --git a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2dpressure2padaptive.hh b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2dpressure2padaptive.hh index 418c35d95b3bc1f4961f33e9c9256a17e98c9a2b..577e5f9ac39965a6339c2cb13c82774412a7a6af 100644 --- a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2dpressure2padaptive.hh +++ b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2dpressure2padaptive.hh @@ -135,7 +135,6 @@ class FvMpfaL2dPressure2pAdaptive: public FVPressure<TypeTag> typedef typename GridView::template Codim<0>::Iterator ElementIterator; typedef typename GridView::template Codim<dim>::Iterator VertexIterator; typedef typename GridView::Grid Grid; - typedef typename GridView::template Codim<0>::EntityPointer ElementPointer; typedef typename GridView::IntersectionIterator IntersectionIterator; typedef Dune::FieldVector<Scalar, dim> LocalPosition; @@ -601,24 +600,24 @@ void FvMpfaL2dPressure2pAdaptive<TypeTag>::initializeMatrix() if (nextIsIt->neighbor()) { // access the common neighbor of isIt's and nextIsIt's outside - ElementPointer outside = isIt->outside(); - ElementPointer nextisItoutside = nextIsIt->outside(); + auto outside = isIt->outside(); + auto nextisItoutside = nextIsIt->outside(); bool isCorner = true; - IntersectionIterator innerisItEnd = problem_.gridView().iend(*outside); - IntersectionIterator innernextisItEnd = problem_.gridView().iend(*nextisItoutside); + IntersectionIterator innerisItEnd = problem_.gridView().iend(outside); + IntersectionIterator innernextisItEnd = problem_.gridView().iend(nextisItoutside); - for (IntersectionIterator innerisIt = problem_.gridView().ibegin(*outside); + for (IntersectionIterator innerisIt = problem_.gridView().ibegin(outside); innerisIt != innerisItEnd; ++innerisIt) { - for (IntersectionIterator innernextisIt = problem_.gridView().ibegin(*nextisItoutside); + for (IntersectionIterator innernextisIt = problem_.gridView().ibegin(nextisItoutside); innernextisIt != innernextisItEnd; ++innernextisIt) { if (innerisIt->neighbor() && innernextisIt->neighbor()) { - ElementPointer innerisItoutside = innerisIt->outside(); - ElementPointer innernextisItoutside = innernextisIt->outside(); + auto innerisItoutside = innerisIt->outside(); + auto innernextisItoutside = innernextisIt->outside(); if (innerisItoutside == nextisItoutside || innernextisItoutside == outside) // if (innerisItoutside == innernextisItoutside && innerisItoutside != eIt) @@ -670,14 +669,14 @@ void FvMpfaL2dPressure2pAdaptive<TypeTag>::initializeMatrix() if (isIt->neighbor()) { // access neighbor - ElementPointer outside = isIt->outside(); - int eIdxGlobalJ = problem_.variables().index(*outside); + auto outside = isIt->outside(); + int eIdxGlobalJ = problem_.variables().index(outside); // add off diagonal index // add index (row,col) to the matrix this->A_.addindex(eIdxGlobalI, eIdxGlobalJ); - if (eIt->level() < outside->level()) + if (eIt->level() < outside.level()) { continue; } @@ -712,47 +711,47 @@ void FvMpfaL2dPressure2pAdaptive<TypeTag>::initializeMatrix() if (nextIsIt->neighbor()) { // access the common neighbor of isIt's and nextIsIt's outside - ElementPointer nextisItoutside = nextIsIt->outside(); + auto nextisItoutside = nextIsIt->outside(); - if (eIt->level() < nextisItoutside->level()) + if (eIt->level() < nextisItoutside.level()) { continue; } - IntersectionIterator innerisItEnd = problem_.gridView().iend(*outside); - IntersectionIterator innernextisItEnd = problem_.gridView().iend(*nextisItoutside); + IntersectionIterator innerisItEnd = problem_.gridView().iend(outside); + IntersectionIterator innernextisItEnd = problem_.gridView().iend(nextisItoutside); for (IntersectionIterator innerisIt = problem_.gridView().ibegin(*outside); innerisIt != innerisItEnd; ++innerisIt) { - for (IntersectionIterator innernextisIt = problem_.gridView().ibegin(*nextisItoutside); + for (IntersectionIterator innernextisIt = problem_.gridView().ibegin(nextisItoutside); innernextisIt != innernextisItEnd; ++innernextisIt) { if (innerisIt->neighbor() && innernextisIt->neighbor()) { - ElementPointer innerisItoutside = innerisIt->outside(); - ElementPointer innernextisItoutside = innernextisIt->outside(); + auto innerisItoutside = innerisIt->outside(); + auto innernextisItoutside = innernextisIt->outside(); if (innerisItoutside == innernextisItoutside && innerisItoutside != eIt && innerisItoutside != nextisItoutside) { - int eIdxGlobalCorner = problem_.variables().index(*innerisItoutside); + int eIdxGlobalCorner = problem_.variables().index(innerisItoutside); this->A_.addindex(eIdxGlobalI, eIdxGlobalCorner); if (eIt->level() > outside->level()) { - int eIdxGlobalJCorner = problem_.variables().index(*nextisItoutside); + int eIdxGlobalJCorner = problem_.variables().index(nextisItoutside); this->A_.addindex(eIdxGlobalJ, eIdxGlobalJCorner); } - if (eIt->level() > nextisItoutside->level()) + if (eIt->level() > nextisItoutside.level()) { - int eIdxGlobalJCorner = problem_.variables().index(*nextisItoutside); + int eIdxGlobalJCorner = problem_.variables().index(nextisItoutside); this->A_.addindex(eIdxGlobalJCorner, eIdxGlobalJ); } - if (eIt->level() > innerisItoutside->level()) + if (eIt->level() > innerisItoutside.level()) { this->A_.addindex(eIdxGlobalCorner, eIdxGlobalI); } @@ -815,10 +814,10 @@ void FvMpfaL2dPressure2pAdaptive<TypeTag>::storeInteractionVolumeInfo() if (isIt12->neighbor()) { // access neighbor cell 2 of 'isIt12' - ElementPointer elementPointer2 = isIt12->outside(); - int eIdxGlobal2 = problem_.variables().index(*elementPointer2); + auto element2 = isIt12->outside(); + int eIdxGlobal2 = problem_.variables().index(element2); - if (eIt->level() < elementPointer2->level()) + if (eIt->level() < element2.level()) { continue; } @@ -859,15 +858,13 @@ void FvMpfaL2dPressure2pAdaptive<TypeTag>::storeInteractionVolumeInfo() { int localVertIdx12corner = referenceElement.subEntity(indexInInside12, dim - 1, i, dim); - int globalVertIdx12corner = problem_.variables().index( - *((*eIt).template subEntity < dim > (localVertIdx12corner))); + int globalVertIdx12corner = problem_.variables().index(eIt->template subEntity<dim>(localVertIdx12corner)); for (int j = 0; j < isIt14->geometry().corners(); ++j) { int localVertIdx14corner = referenceElement.subEntity(indexInInside14, dim - 1, j, dim); - int globalVertIdx14corner = problem_.variables().index( - *((*eIt).template subEntity < dim > (localVertIdx14corner))); + int globalVertIdx14corner = problem_.variables().index(eIt->template subEntity<dim>(localVertIdx14corner)); if (globalVertIdx12corner == globalVertIdx14corner) { @@ -931,7 +928,7 @@ void FvMpfaL2dPressure2pAdaptive<TypeTag>::storeInteractionVolumeInfo() interactionVolumes_[globalVertIdx1234].setFacePosition(globalPosFace41, 0, 1); //store pointer 2 - interactionVolumes_[globalVertIdx1234].setSubVolumeElement(elementPointer2, 1); + interactionVolumes_[globalVertIdx1234].setSubVolumeElement(element2, 1); interactionVolumes_[globalVertIdx1234].setIndexOnElement(isIt12->indexInOutside(), 1, 1); interactionVolumes_[globalVertIdx1234].setNormal(unitOuterNormal12, 1, 1); interactionVolumes_[globalVertIdx1234].setFaceArea(faceVol12, 1, 1); @@ -942,10 +939,10 @@ void FvMpfaL2dPressure2pAdaptive<TypeTag>::storeInteractionVolumeInfo() { // neighbor cell 3 // access neighbor cell 3 - ElementPointer elementPointer4 = isIt14->outside(); + auto element4 = isIt14->outside(); //store pointer 4 - interactionVolumes_[globalVertIdx1234].setSubVolumeElement(elementPointer4, 3); + interactionVolumes_[globalVertIdx1234].setSubVolumeElement(element4, 3); interactionVolumes_[globalVertIdx1234].setIndexOnElement(isIt14->indexInOutside(), 3, 0); interactionVolumes_[globalVertIdx1234].setNormal(unitOuterNormal14, 3, 0); @@ -956,28 +953,28 @@ void FvMpfaL2dPressure2pAdaptive<TypeTag>::storeInteractionVolumeInfo() GlobalPosition globalPosFace23(0); GlobalPosition globalPosFace34(0); - if (elementPointer4->level() < eIt->level()) + if (element4.level() < eIt->level()) { bool isHangingNode = false; - IntersectionIterator isIt2End = problem_.gridView().iend(*elementPointer2); - IntersectionIterator isIt4End = problem_.gridView().iend(*elementPointer4); - for (IntersectionIterator isIt2 = problem_.gridView().ibegin(*elementPointer2); + IntersectionIterator isIt2End = problem_.gridView().iend(element2); + IntersectionIterator isIt4End = problem_.gridView().iend(element4); + for (IntersectionIterator isIt2 = problem_.gridView().ibegin(element2); isIt2 != isIt2End; ++isIt2) { bool breakLoop = false; - for (IntersectionIterator isIt4 = problem_.gridView().ibegin(*elementPointer4); + for (IntersectionIterator isIt4 = problem_.gridView().ibegin(element4); isIt4 != isIt4End; ++isIt4) { if (isIt2->neighbor() && isIt4->neighbor()) { - ElementPointer elementPointer32 = isIt2->outside(); - ElementPointer elementPointer34 = isIt4->outside(); + auto element32 = isIt2->outside(); + auto element34 = isIt4->outside(); //hanging node! - if (elementPointer32 == elementPointer4) + if (element32 == element4) { - if (eIt->level() != elementPointer2->level()) + if (eIt->level() != element2.level()) { breakLoop = true; isHangingNode = false; @@ -1006,9 +1003,9 @@ void FvMpfaL2dPressure2pAdaptive<TypeTag>::storeInteractionVolumeInfo() unitOuterNormal23 *= -1; interactionVolumes_[globalVertIdx1234].setNormal(unitOuterNormal23, 3, 1); } - else if (elementPointer34 == elementPointer2) + else if (element34 == element2) { - if (eIt->level() != elementPointer2->level()) + if (eIt->level() != element2.level()) { breakLoop = true; isHangingNode = false; @@ -1037,17 +1034,17 @@ void FvMpfaL2dPressure2pAdaptive<TypeTag>::storeInteractionVolumeInfo() { bool regularNode = false; - for (IntersectionIterator isIt2 = problem_.gridView().ibegin(*elementPointer2); + for (IntersectionIterator isIt2 = problem_.gridView().ibegin(element2); isIt2 != isIt2End; ++isIt2) { - for (IntersectionIterator isIt4 = problem_.gridView().ibegin(*elementPointer4); + for (IntersectionIterator isIt4 = problem_.gridView().ibegin(element4); isIt4 != isIt4End; ++isIt4) { if (isIt4->neighbor()) { - ElementPointer elementPointer41 = isIt4->outside(); + auto element41 = isIt4->outside(); - if (elementPointer41 == eIt && elementPointer41->level() > eIt->level()) + if (element41 == eIt && element41.level() > eIt->level()) { //adjust values of isIt12 in case of hanging nodes globalPosFace41 = isIt4->geometry().center(); @@ -1064,14 +1061,14 @@ void FvMpfaL2dPressure2pAdaptive<TypeTag>::storeInteractionVolumeInfo() if (isIt2->neighbor() && isIt4->neighbor()) { - ElementPointer elementPointer32 = isIt2->outside(); - ElementPointer elementPointer34 = isIt4->outside(); + auto element32 = isIt2->outside(); + auto element34 = isIt4->outside(); //hanging node! - if (elementPointer32 == elementPointer34 && elementPointer32 != eIt) + if (element32 == element34 && element32 != eIt) { //store pointer 3 - interactionVolumes_[globalVertIdx1234].setSubVolumeElement(elementPointer32, + interactionVolumes_[globalVertIdx1234].setSubVolumeElement(element32, 2); interactionVolumes_[globalVertIdx1234].setIndexOnElement( @@ -1100,18 +1097,18 @@ void FvMpfaL2dPressure2pAdaptive<TypeTag>::storeInteractionVolumeInfo() unitOuterNormal43 *= -1; interactionVolumes_[globalVertIdx1234].setNormal(unitOuterNormal43, 2, 0); - if (elementPointer32->level() > elementPointer2->level()) + if (element32.level() > element2.level()) { IntersectionIterator isIt3End = problem_.gridView().iend( - *elementPointer32); + element32); for (IntersectionIterator isIt3 = problem_.gridView().ibegin( - *elementPointer32); isIt3 != isIt3End; ++isIt3) + element32); isIt3 != isIt3End; ++isIt3) { if (isIt3->neighbor()) { - ElementPointer elementPointer23 = isIt3->outside(); + auto element23 = isIt3->outside(); - if (elementPointer23 == elementPointer2) + if (element23 == element2) { globalPosFace23 = isIt3->geometry().center(); faceVol23 = isIt3->geometry().volume() / 2.0; @@ -1127,18 +1124,18 @@ void FvMpfaL2dPressure2pAdaptive<TypeTag>::storeInteractionVolumeInfo() interactionVolumes_[globalVertIdx1234].setFacePosition(globalPosFace23, 2, 1); - if (elementPointer34->level() > elementPointer4->level()) + if (element34.level() > element4.level()) { IntersectionIterator isIt3End = problem_.gridView().iend( - *elementPointer34); + element34); for (IntersectionIterator isIt3 = problem_.gridView().ibegin( - *elementPointer34); isIt3 != isIt3End; ++isIt3) + element34); isIt3 != isIt3End; ++isIt3) { if (isIt3->neighbor()) { - ElementPointer elementPointer43 = isIt3->outside(); + auto element43 = isIt3->outside(); - if (elementPointer43 == elementPointer4) + if (element43 == element4) { globalPosFace34 = isIt3->geometry().center(); faceVol34 = isIt3->geometry().volume() / 2.0; @@ -1175,19 +1172,19 @@ void FvMpfaL2dPressure2pAdaptive<TypeTag>::storeInteractionVolumeInfo() else { bool regularNode = false; - IntersectionIterator isIt2End = problem_.gridView().iend(*elementPointer2); - IntersectionIterator isIt4End = problem_.gridView().iend(*elementPointer4); - for (IntersectionIterator isIt2 = problem_.gridView().ibegin(*elementPointer2); + IntersectionIterator isIt2End = problem_.gridView().iend(element2); + IntersectionIterator isIt4End = problem_.gridView().iend(element4); + for (IntersectionIterator isIt2 = problem_.gridView().ibegin(element2); isIt2 != isIt2End; ++isIt2) { - for (IntersectionIterator isIt4 = problem_.gridView().ibegin(*elementPointer4); + for (IntersectionIterator isIt4 = problem_.gridView().ibegin(element4); isIt4 != isIt4End; ++isIt4) { if (isIt4->neighbor()) { - ElementPointer elementPointer41 = isIt4->outside(); + auto element41 = isIt4->outside(); - if (elementPointer41 == eIt && elementPointer41->level() > eIt->level()) + if (element41 == eIt && element41.level() > eIt->level()) { //adjust values of isIt12 in case of hanging nodes globalPosFace41 = isIt4->geometry().center(); @@ -1202,14 +1199,14 @@ void FvMpfaL2dPressure2pAdaptive<TypeTag>::storeInteractionVolumeInfo() if (isIt2->neighbor() && isIt4->neighbor()) { - ElementPointer elementPointer32 = isIt2->outside(); - ElementPointer elementPointer34 = isIt4->outside(); + auto element32 = isIt2->outside(); + auto element34 = isIt4->outside(); // find the common neighbor cell between cell 2 and cell 3, except cell 1 - if (elementPointer32 == elementPointer34 && elementPointer32 != eIt) + if (element32 == element34 && element32 != eIt) { //store pointer 3 - interactionVolumes_[globalVertIdx1234].setSubVolumeElement(elementPointer32, 2); + interactionVolumes_[globalVertIdx1234].setSubVolumeElement(element32, 2); interactionVolumes_[globalVertIdx1234].setIndexOnElement(isIt2->indexInInside(), 1, 0); @@ -1298,8 +1295,8 @@ void FvMpfaL2dPressure2pAdaptive<TypeTag>::storeInteractionVolumeInfo() bool finished = false; - IntersectionIterator isIt2End = problem_.gridView().iend(*elementPointer2); - for (IntersectionIterator isIt2 = problem_.gridView().ibegin(*elementPointer2); isIt2 != isIt2End; + IntersectionIterator isIt2End = problem_.gridView().iend(element2); + for (IntersectionIterator isIt2 = problem_.gridView().ibegin(element2); isIt2 != isIt2End; ++isIt2) { if (isIt2->boundary()) @@ -1309,8 +1306,7 @@ void FvMpfaL2dPressure2pAdaptive<TypeTag>::storeInteractionVolumeInfo() int localVertIdx2corner = referenceElement.subEntity(isIt2->indexInInside(), dim - 1, i, dim); - int globalVertIdx2corner = problem_.variables().index( - *((*elementPointer2).template subEntity < dim > (localVertIdx2corner))); + int globalVertIdx2corner = problem_.variables().index(element2.template subEntity<dim>(localVertIdx2corner)); if (globalVertIdx2corner == globalVertIdx1234) { @@ -1346,16 +1342,16 @@ void FvMpfaL2dPressure2pAdaptive<TypeTag>::storeInteractionVolumeInfo() interactionVolumes_[globalVertIdx1234].setOutsideFace(2); - if (eIt->level() == elementPointer2->level()) + if (eIt->level() == element2.level()) { innerBoundaryVolumeFaces_[eIdxGlobal1][isIt12->indexInInside()] = true; innerBoundaryVolumeFaces_[eIdxGlobal2][isIt12->indexInOutside()] = true; } - else if (eIt->level() < elementPointer2->level()) + else if (eIt->level() < element2.level()) { innerBoundaryVolumeFaces_[eIdxGlobal2][isIt12->indexInOutside()] = true; } - else if (eIt->level() > elementPointer2->level()) + else if (eIt->level() > element2.level()) { innerBoundaryVolumeFaces_[eIdxGlobal1][isIt12->indexInInside()] = true; } @@ -1421,15 +1417,13 @@ void FvMpfaL2dPressure2pAdaptive<TypeTag>::storeInteractionVolumeInfo() int localVertIdx12corner = referenceElement.subEntity(indexInInside12, dim - 1, i, dim); - int globalVertIdx12corner = problem_.variables().index( - *((*eIt).template subEntity < dim > (localVertIdx12corner))); + int globalVertIdx12corner = problem_.variables().index(eIt->template subEntity<dim>(localVertIdx12corner)); for (int j = 0; j < isIt14->geometry().corners(); ++j) { int localVertIdx14corner = referenceElement.subEntity(indexInInside14, dim - 1, j, dim); - int globalVertIdx14corner = problem_.variables().index( - *((*eIt).template subEntity < dim > (localVertIdx14corner))); + int globalVertIdx14corner = problem_.variables().index(eIt->template subEntity<dim>(localVertIdx14corner)); if (globalVertIdx12corner == globalVertIdx14corner) { @@ -1536,11 +1530,11 @@ void FvMpfaL2dPressure2pAdaptive<TypeTag>::storeInteractionVolumeInfo() { // neighbor cell 3 // access neighbor cell 3 - ElementPointer elementPointer4 = isIt14->outside(); - int eIdxGlobal4 = problem_.variables().index(*elementPointer4); + auto element4 = isIt14->outside(); + int eIdxGlobal4 = problem_.variables().index(element4); - if ((eIt->level() == elementPointer4->level() && eIdxGlobal1 > eIdxGlobal4) - || eIt->level() < elementPointer4->level()) + if ((eIt->level() == element4.level() && eIdxGlobal1 > eIdxGlobal4) + || eIt->level() < element4.level()) { interactionVolumes_[globalVertIdx1234].reset(); continue; @@ -1549,7 +1543,7 @@ void FvMpfaL2dPressure2pAdaptive<TypeTag>::storeInteractionVolumeInfo() interactionVolumes_[globalVertIdx1234].setIndexOnElement(isIt14->indexInOutside(), 3, 0); //store pointer 4 - interactionVolumes_[globalVertIdx1234].setSubVolumeElement(elementPointer4, 3); + interactionVolumes_[globalVertIdx1234].setSubVolumeElement(element4, 3); interactionVolumes_[globalVertIdx1234].setNormal(unitOuterNormal14, 3, 0); interactionVolumes_[globalVertIdx1234].setFaceArea(faceVol41, 3, 0); @@ -1558,8 +1552,8 @@ void FvMpfaL2dPressure2pAdaptive<TypeTag>::storeInteractionVolumeInfo() bool finished = false; // get the information of the face 'isIt34' between cell3 and cell4 (locally numbered) - IntersectionIterator isIt4End = problem_.gridView().iend(*elementPointer4); - for (IntersectionIterator isIt4 = problem_.gridView().ibegin(*elementPointer4); isIt4 != isIt4End; + IntersectionIterator isIt4End = problem_.gridView().iend(element4); + for (IntersectionIterator isIt4 = problem_.gridView().ibegin(element4); isIt4 != isIt4End; ++isIt4) { if (isIt4->boundary()) @@ -1569,8 +1563,7 @@ void FvMpfaL2dPressure2pAdaptive<TypeTag>::storeInteractionVolumeInfo() int localVertIdx4corner = referenceElement.subEntity(isIt4->indexInInside(), dim - 1, i, dim); - int globalVertIdx4corner = problem_.variables().index( - *((*elementPointer4).template subEntity < dim > (localVertIdx4corner))); + int globalVertIdx4corner = problem_.variables().index(element4.template subEntity<dim>(localVertIdx4corner)); if (globalVertIdx4corner == globalVertIdx1234) { @@ -1604,16 +1597,16 @@ void FvMpfaL2dPressure2pAdaptive<TypeTag>::storeInteractionVolumeInfo() interactionVolumes_[globalVertIdx1234].setOutsideFace(1); - if (eIt->level() == elementPointer4->level()) + if (eIt->level() == element4.level()) { innerBoundaryVolumeFaces_[eIdxGlobal1][isIt14->indexInInside()] = true; innerBoundaryVolumeFaces_[eIdxGlobal4][isIt14->indexInOutside()] = true; } - if (eIt->level() < elementPointer4->level()) + if (eIt->level() < element4.level()) { innerBoundaryVolumeFaces_[eIdxGlobal4][isIt14->indexInOutside()] = true; } - if (eIt->level() > elementPointer4->level()) + if (eIt->level() > element4.level()) { innerBoundaryVolumeFaces_[eIdxGlobal1][isIt14->indexInInside()] = true; } @@ -1665,13 +1658,13 @@ void FvMpfaL2dPressure2pAdaptive<TypeTag>::printInteractionVolumes() std::cout << "global vertex index: " << vIdxGlobal << "\n"; if (interactionVolume.getElementNumber() == 3) { - ElementPointer& elementPointer1 = interactionVolume.getSubVolumeElement(0); - ElementPointer& elementPointer2 = interactionVolume.getSubVolumeElement(1); - ElementPointer& elementPointer4 = interactionVolume.getSubVolumeElement(3); + auto element1 = interactionVolume.getSubVolumeElement(0); + auto element2 = interactionVolume.getSubVolumeElement(1); + auto element4 = interactionVolume.getSubVolumeElement(3); - int eIdxGlobal1 = problem_.variables().index(*elementPointer1); - int eIdxGlobal2 = problem_.variables().index(*elementPointer2); - int eIdxGlobal4 = problem_.variables().index(*elementPointer4); + int eIdxGlobal1 = problem_.variables().index(element1); + int eIdxGlobal2 = problem_.variables().index(element2); + int eIdxGlobal4 = problem_.variables().index(element4); std::cout << "global element index 1: " << eIdxGlobal1 << "\n"; std::cout << "global element index 2: " << eIdxGlobal2 << "\n"; @@ -1679,15 +1672,15 @@ void FvMpfaL2dPressure2pAdaptive<TypeTag>::printInteractionVolumes() } if (interactionVolume.getElementNumber() == 4) { - ElementPointer& elementPointer1 = interactionVolume.getSubVolumeElement(0); - ElementPointer& elementPointer2 = interactionVolume.getSubVolumeElement(1); - ElementPointer& elementPointer3 = interactionVolume.getSubVolumeElement(2); - ElementPointer& elementPointer4 = interactionVolume.getSubVolumeElement(3); + auto element1 = interactionVolume.getSubVolumeElement(0); + auto element2 = interactionVolume.getSubVolumeElement(1); + auto element3 = interactionVolume.getSubVolumeElement(2); + auto element4 = interactionVolume.getSubVolumeElement(3); - int eIdxGlobal1 = problem_.variables().index(*elementPointer1); - int eIdxGlobal2 = problem_.variables().index(*elementPointer2); - int eIdxGlobal3 = problem_.variables().index(*elementPointer3); - int eIdxGlobal4 = problem_.variables().index(*elementPointer4); + int eIdxGlobal1 = problem_.variables().index(element1); + int eIdxGlobal2 = problem_.variables().index(element2); + int eIdxGlobal3 = problem_.variables().index(element3); + int eIdxGlobal4 = problem_.variables().index(element4); std::cout << "global element index 1: " << eIdxGlobal1 << "\n"; std::cout << "global element index 2: " << eIdxGlobal2 << "\n"; @@ -1718,28 +1711,28 @@ void FvMpfaL2dPressure2pAdaptive<TypeTag>::assemble() { if (interactionVolume.getElementNumber() == 4) { - ElementPointer& elementPointer1 = interactionVolume.getSubVolumeElement(0); - ElementPointer& elementPointer2 = interactionVolume.getSubVolumeElement(1); - ElementPointer& elementPointer3 = interactionVolume.getSubVolumeElement(2); - ElementPointer& elementPointer4 = interactionVolume.getSubVolumeElement(3); + auto element1 = interactionVolume.getSubVolumeElement(0); + auto element2 = interactionVolume.getSubVolumeElement(1); + auto element3 = interactionVolume.getSubVolumeElement(2); + auto element4 = interactionVolume.getSubVolumeElement(3); // get global coordinate of cell centers - const GlobalPosition& globalPos1 = elementPointer1->geometry().center(); - const GlobalPosition& globalPos2 = elementPointer2->geometry().center(); - const GlobalPosition& globalPos3 = elementPointer3->geometry().center(); - const GlobalPosition& globalPos4 = elementPointer4->geometry().center(); + const GlobalPosition& globalPos1 = element1.geometry().center(); + const GlobalPosition& globalPos2 = element2.geometry().center(); + const GlobalPosition& globalPos3 = element3.geometry().center(); + const GlobalPosition& globalPos4 = element4.geometry().center(); // cell volumes - Scalar volume1 = elementPointer1->geometry().volume(); - Scalar volume2 = elementPointer2->geometry().volume(); - Scalar volume3 = elementPointer3->geometry().volume(); - Scalar volume4 = elementPointer4->geometry().volume(); + Scalar volume1 = element1.geometry().volume(); + Scalar volume2 = element2.geometry().volume(); + Scalar volume3 = element3.geometry().volume(); + Scalar volume4 = element4.geometry().volume(); // cell index - int eIdxGlobal1 = problem_.variables().index(*elementPointer1); - int eIdxGlobal2 = problem_.variables().index(*elementPointer2); - int eIdxGlobal3 = problem_.variables().index(*elementPointer3); - int eIdxGlobal4 = problem_.variables().index(*elementPointer4); + int eIdxGlobal1 = problem_.variables().index(element1); + int eIdxGlobal2 = problem_.variables().index(element2); + int eIdxGlobal3 = problem_.variables().index(element3); + int eIdxGlobal4 = problem_.variables().index(element4); //get the cell Data CellData& cellData1 = problem_.variables().cellData(eIdxGlobal1); @@ -1749,13 +1742,13 @@ void FvMpfaL2dPressure2pAdaptive<TypeTag>::assemble() // evaluate right hand side PrimaryVariables source(0.0); - problem_.source(source, *elementPointer1); + problem_.source(source, element1); this->f_[eIdxGlobal1] += volume1 / (4.0) * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]); - problem_.source(source, *elementPointer2); + problem_.source(source, element2); this->f_[eIdxGlobal2] += volume2 / (4.0) * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]); - problem_.source(source, *elementPointer3); + problem_.source(source, element3); this->f_[eIdxGlobal3] += volume3 / (4.0) * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]); - problem_.source(source, *elementPointer4); + problem_.source(source, element4); this->f_[eIdxGlobal4] += volume4 / (4.0) * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]); this->f_[eIdxGlobal1] += evaluateErrorTerm_(cellData1) * volume1 / (4.0); @@ -2101,23 +2094,23 @@ void FvMpfaL2dPressure2pAdaptive<TypeTag>::assemble() } else if (interactionVolume.getElementNumber() == 3) { - ElementPointer& elementPointer1 = interactionVolume.getSubVolumeElement(0); - ElementPointer& elementPointer2 = interactionVolume.getSubVolumeElement(1); - ElementPointer& elementPointer4 = interactionVolume.getSubVolumeElement(3); + auto element1 = interactionVolume.getSubVolumeElement(0); + auto element2 = interactionVolume.getSubVolumeElement(1); + auto element4 = interactionVolume.getSubVolumeElement(3); // get global coordinate of cell centers - const GlobalPosition& globalPos1 = elementPointer1->geometry().center(); - const GlobalPosition& globalPos2 = elementPointer2->geometry().center(); - const GlobalPosition& globalPos4 = elementPointer4->geometry().center(); + const GlobalPosition& globalPos1 = element1.geometry().center(); + const GlobalPosition& globalPos2 = element2.geometry().center(); + const GlobalPosition& globalPos4 = element4.geometry().center(); // cell volumes - Scalar volume1 = elementPointer1->geometry().volume(); - Scalar volume2 = elementPointer2->geometry().volume(); + Scalar volume1 = element1.geometry().volume(); + Scalar volume2 = element2.geometry().volume(); // cell index - int eIdxGlobal1 = problem_.variables().index(*elementPointer1); - int eIdxGlobal2 = problem_.variables().index(*elementPointer2); - int eIdxGlobal4 = problem_.variables().index(*elementPointer4); + int eIdxGlobal1 = problem_.variables().index(element1); + int eIdxGlobal2 = problem_.variables().index(element2); + int eIdxGlobal4 = problem_.variables().index(element4); //get the cell Data CellData& cellData1 = problem_.variables().cellData(eIdxGlobal1); @@ -2127,9 +2120,9 @@ void FvMpfaL2dPressure2pAdaptive<TypeTag>::assemble() // evaluate right hand side -> only add source for the cells without hanging node! // In doing so every cell gets the source from 4 vertices and the division by 4 is correct! PrimaryVariables source(0.0); - problem_.source(source, *elementPointer1); + problem_.source(source, element1); this->f_[eIdxGlobal1] += volume1 / (4.0) * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]); - problem_.source(source, *elementPointer2); + problem_.source(source, element2); this->f_[eIdxGlobal2] += volume2 / (4.0) * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]); this->f_[eIdxGlobal1] += evaluateErrorTerm_(cellData1) * volume1 / (4.0); @@ -2393,26 +2386,26 @@ void FvMpfaL2dPressure2pAdaptive<TypeTag>::assemble() continue; } - ElementPointer& elementPointer = interactionVolume.getSubVolumeElement(elemIdx); + auto element = interactionVolume.getSubVolumeElement(elemIdx); // get global coordinate of cell centers - const GlobalPosition& globalPos = elementPointer->geometry().center(); + const GlobalPosition& globalPos = element.geometry().center(); // cell volumes - Scalar volume = elementPointer->geometry().volume(); + Scalar volume = element.geometry().volume(); // cell index - int eIdxGlobal = problem_.variables().index(*elementPointer); + int eIdxGlobal = problem_.variables().index(element); //get the cell Data CellData& cellData = problem_.variables().cellData(eIdxGlobal); //permeability vector at boundary - DimMatrix permeability(problem_.spatialParams().intrinsicPermeability(*elementPointer)); + DimMatrix permeability(problem_.spatialParams().intrinsicPermeability(element)); // evaluate right hand side PrimaryVariables source(0); - problem_.source(source, *elementPointer); + problem_.source(source, element); this->f_[eIdxGlobal] += volume / (4.0) * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]); this->f_[eIdxGlobal] += evaluateErrorTerm_(cellData) * volume / (4.0); @@ -2439,11 +2432,11 @@ void FvMpfaL2dPressure2pAdaptive<TypeTag>::assemble() int boundaryFaceIdx = interactionVolume.getIndexOnElement(elemIdx, fIdx); const ReferenceElement& referenceElement = ReferenceElements::general( - elementPointer->geometry().type()); + element.geometry().type()); const LocalPosition& localPos = referenceElement.position(boundaryFaceIdx, 1); - const GlobalPosition& globalPosFace = elementPointer->geometry().global(localPos); + const GlobalPosition& globalPosFace = element.geometry().global(localPos); DimVector distVec(globalPosFace - globalPos); Scalar dist = distVec.two_norm(); @@ -2475,7 +2468,7 @@ void FvMpfaL2dPressure2pAdaptive<TypeTag>::assemble() } Scalar pcBound = MaterialLaw::pc( - problem_.spatialParams().materialLawParams(*elementPointer), satWBound); + problem_.spatialParams().materialLawParams(element), satWBound); Scalar gravityDiffBound = (problem_.bBoxMax() - globalPosFace) * gravity_ * (density_[nPhaseIdx] - density_[wPhaseIdx]); @@ -2483,10 +2476,10 @@ void FvMpfaL2dPressure2pAdaptive<TypeTag>::assemble() pcBound += gravityDiffBound; Dune::FieldVector<Scalar, numPhases> lambdaBound( - MaterialLaw::krw(problem_.spatialParams().materialLawParams(*elementPointer), + MaterialLaw::krw(problem_.spatialParams().materialLawParams(element), satWBound)); lambdaBound[nPhaseIdx] = MaterialLaw::krn( - problem_.spatialParams().materialLawParams(*elementPointer), satWBound); + problem_.spatialParams().materialLawParams(element), satWBound); lambdaBound[wPhaseIdx] /= viscosity_[wPhaseIdx]; lambdaBound[nPhaseIdx] /= viscosity_[nPhaseIdx]; diff --git a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2dpressurevelocity2p.hh b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2dpressurevelocity2p.hh index 92aa2d0266d75e97f98107e438b91e8ea0d1a3e5..ff146a67932477045200e0d4c463686f2e21f294 100644 --- a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2dpressurevelocity2p.hh +++ b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2dpressurevelocity2p.hh @@ -76,7 +76,6 @@ template<class TypeTag> class FvMpfaL2dPressureVelocity2p: public FvMpfaL2dPress typedef typename GridView::template Codim<0>::Iterator ElementIterator; typedef typename GridView::template Codim<dim>::Iterator VertexIterator; typedef typename GridView::IntersectionIterator IntersectionIterator; - typedef typename GridView::template Codim<0>::EntityPointer ElementPointer; typedef typename GridView::Intersection Intersection; typedef typename ParentType::InteractionVolume InteractionVolume; @@ -231,16 +230,16 @@ void FvMpfaL2dPressureVelocity2p<TypeTag>::calculateVelocity() if (interactionVolume.isInnerVolume()) { - ElementPointer & elementPointer1 = interactionVolume.getSubVolumeElement(0); - ElementPointer & elementPointer2 = interactionVolume.getSubVolumeElement(1); - ElementPointer & elementPointer3 = interactionVolume.getSubVolumeElement(2); - ElementPointer & elementPointer4 = interactionVolume.getSubVolumeElement(3); + auto element1 = interactionVolume.getSubVolumeElement(0); + auto element2 = interactionVolume.getSubVolumeElement(1); + auto element3 = interactionVolume.getSubVolumeElement(2); + auto element4 = interactionVolume.getSubVolumeElement(3); // cell index - int eIdxGlobal1 = problem_.variables().index(*elementPointer1); - int eIdxGlobal2 = problem_.variables().index(*elementPointer2); - int eIdxGlobal3 = problem_.variables().index(*elementPointer3); - int eIdxGlobal4 = problem_.variables().index(*elementPointer4); + int eIdxGlobal1 = problem_.variables().index(element1); + int eIdxGlobal2 = problem_.variables().index(element2); + int eIdxGlobal3 = problem_.variables().index(element3); + int eIdxGlobal4 = problem_.variables().index(element4); //get the cell Data CellData& cellData1 = problem_.variables().cellData(eIdxGlobal1); @@ -271,10 +270,8 @@ void FvMpfaL2dPressureVelocity2p<TypeTag>::calculateVelocity() { continue; } - ElementPointer & elementPointer = interactionVolume.getSubVolumeElement(elemIdx); - // cell index - int eIdxGlobal = problem_.variables().index(*elementPointer); + int eIdxGlobal = problem_.variables().index(interactionVolume.getSubVolumeElement(elemIdx)); //get the cell Data CellData& cellData = problem_.variables().cellData(eIdxGlobal); @@ -301,15 +298,15 @@ void FvMpfaL2dPressureVelocity2p<TypeTag>::calculateVelocity(const Intersection& { int numVertices = intersection.geometry().corners(); - ElementPointer elementPtrI = intersection.inside(); - ElementPointer elementPtrJ = intersection.outside(); + auto elementI = intersection.inside(); + auto elementJ = intersection.outside(); - int eIdxGlobalI = problem_.variables().index(*elementPtrI); - int eIdxGlobalJ = problem_.variables().index(*elementPtrJ); + int eIdxGlobalI = problem_.variables().index(elementI); + int eIdxGlobalJ = problem_.variables().index(elementJ); CellData& cellDataJ = problem_.variables().cellData(eIdxGlobalJ); - const ReferenceElement& referenceElement = ReferenceElements::general(elementPtrI->geometry().type()); + const ReferenceElement& referenceElement = ReferenceElements::general(elementI.geometry().type()); int indexInInside = intersection.indexInInside(); int indexInOutside = intersection.indexInOutside(); @@ -320,25 +317,24 @@ void FvMpfaL2dPressureVelocity2p<TypeTag>::calculateVelocity(const Intersection& { int localVertIdx = referenceElement.subEntity(indexInInside, dim - 1, vIdx, dim); - int vIdxGlobal = problem_.variables().index( - *((*elementPtrI).template subEntity < dim > (localVertIdx))); + int vIdxGlobal = problem_.variables().index(elementI.template subEntity<dim>(localVertIdx)); InteractionVolume& interactionVolume = this->interactionVolumes_[vIdxGlobal]; if (interactionVolume.isInnerVolume()) { - ElementPointer & elementPointer1 = interactionVolume.getSubVolumeElement(0); - ElementPointer & elementPointer2 = interactionVolume.getSubVolumeElement(1); - ElementPointer & elementPointer3 = interactionVolume.getSubVolumeElement(2); - ElementPointer & elementPointer4 = interactionVolume.getSubVolumeElement(3); + auto element1 = interactionVolume.getSubVolumeElement(0); + auto element2 = interactionVolume.getSubVolumeElement(1); + auto element3 = interactionVolume.getSubVolumeElement(2); + auto element4 = interactionVolume.getSubVolumeElement(3); // cell index int eIdxGlobal[4]; - eIdxGlobal[0] = problem_.variables().index(*elementPointer1); - eIdxGlobal[1] = problem_.variables().index(*elementPointer2); - eIdxGlobal[2] = problem_.variables().index(*elementPointer3); - eIdxGlobal[3] = problem_.variables().index(*elementPointer4); + eIdxGlobal[0] = problem_.variables().index(element1); + eIdxGlobal[1] = problem_.variables().index(element2); + eIdxGlobal[2] = problem_.variables().index(element3); + eIdxGlobal[3] = problem_.variables().index(element4); //get the cell Data cellDataTemp[0] = problem_.variables().cellData(eIdxGlobal[0]); @@ -390,7 +386,7 @@ void FvMpfaL2dPressureVelocity2p<TypeTag>::calculateVelocity(const Intersection& template<class TypeTag> void FvMpfaL2dPressureVelocity2p<TypeTag>::calculateVelocityOnBoundary(const Intersection& intersection, CellData& cellData) { - ElementPointer element = intersection.inside(); + auto element = intersection.inside(); //get face index int isIndex = intersection.indexInInside(); @@ -408,7 +404,7 @@ void FvMpfaL2dPressureVelocity2p<TypeTag>::calculateVelocityOnBoundary(const Int problem_.dirichlet(boundValues, intersection); // get global coordinates of cell centers - const GlobalPosition& globalPosI = element->geometry().center(); + const GlobalPosition& globalPosI = element.geometry().center(); // center of face in global coordinates const GlobalPosition& globalPosJ = intersection.geometry().center(); @@ -430,7 +426,7 @@ void FvMpfaL2dPressureVelocity2p<TypeTag>::calculateVelocityOnBoundary(const Int // compute vectorized permeabilities DimMatrix meanPermeability(0); - problem_.spatialParams().meanK(meanPermeability, problem_.spatialParams().intrinsicPermeability(*element)); + problem_.spatialParams().meanK(meanPermeability, problem_.spatialParams().intrinsicPermeability(element)); Dune::FieldVector<Scalar, dim> permeability(0); meanPermeability.mv(unitOuterNormal, permeability); @@ -459,7 +455,7 @@ void FvMpfaL2dPressureVelocity2p<TypeTag>::calculateVelocityOnBoundary(const Int } Scalar pressBound = boundValues[pressureIdx]; - Scalar pcBound = MaterialLaw::pc(problem_.spatialParams().materialLawParams(*element), satW); + Scalar pcBound = MaterialLaw::pc(problem_.spatialParams().materialLawParams(element), satW); //determine phase pressures from primary pressure variable Scalar pressWBound = 0; @@ -475,9 +471,9 @@ void FvMpfaL2dPressureVelocity2p<TypeTag>::calculateVelocityOnBoundary(const Int pressNwBound = pressBound; } - Scalar lambdaWBound = MaterialLaw::krw(problem_.spatialParams().materialLawParams(*element), satW) + Scalar lambdaWBound = MaterialLaw::krw(problem_.spatialParams().materialLawParams(element), satW) / viscosity_[wPhaseIdx]; - Scalar lambdaNwBound = MaterialLaw::krn(problem_.spatialParams().materialLawParams(*element), satW) + Scalar lambdaNwBound = MaterialLaw::krn(problem_.spatialParams().materialLawParams(element), satW) / viscosity_[nPhaseIdx]; Scalar potentialDiffW = cellData.fluxData().upwindPotential(wPhaseIdx, isIndex); diff --git a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2dpressurevelocity2padaptive.hh b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2dpressurevelocity2padaptive.hh index 017947077c96065c8921cb2cc8000dde6a2ef469..d47f7876a1ec999eb2e4799447e2b13a8bcc28f1 100644 --- a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2dpressurevelocity2padaptive.hh +++ b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2dpressurevelocity2padaptive.hh @@ -79,7 +79,6 @@ template<class TypeTag> class FvMpfaL2dPressureVelocity2pAdaptive: public FvMpfa typedef typename GridView::template Codim<0>::Iterator ElementIterator; typedef typename GridView::template Codim<dim>::Iterator VertexIterator; typedef typename GridView::IntersectionIterator IntersectionIterator; - typedef typename Grid::template Codim<0>::EntityPointer ElementPointer; typedef typename GridView::Intersection Intersection; typedef typename Grid::template Codim<0>::Entity::Geometry Geometry; @@ -242,16 +241,16 @@ void FvMpfaL2dPressureVelocity2pAdaptive<TypeTag>::calculateVelocity() { if (interactionVolume.getElementNumber() == 4) { - ElementPointer & elementPointer1 = interactionVolume.getSubVolumeElement(0); - ElementPointer & elementPointer2 = interactionVolume.getSubVolumeElement(1); - ElementPointer & elementPointer3 = interactionVolume.getSubVolumeElement(2); - ElementPointer & elementPointer4 = interactionVolume.getSubVolumeElement(3); + auto element1 = interactionVolume.getSubVolumeElement(0); + auto element2 = interactionVolume.getSubVolumeElement(1); + auto element3 = interactionVolume.getSubVolumeElement(2); + auto element4 = interactionVolume.getSubVolumeElement(3); // cell index - int eIdxGlobal1 = problem_.variables().index(*elementPointer1); - int eIdxGlobal2 = problem_.variables().index(*elementPointer2); - int eIdxGlobal3 = problem_.variables().index(*elementPointer3); - int eIdxGlobal4 = problem_.variables().index(*elementPointer4); + int eIdxGlobal1 = problem_.variables().index(element1); + int eIdxGlobal2 = problem_.variables().index(element2); + int eIdxGlobal3 = problem_.variables().index(element3); + int eIdxGlobal4 = problem_.variables().index(element4); //get the cell Data CellData& cellData1 = problem_.variables().cellData(eIdxGlobal1); @@ -265,14 +264,14 @@ void FvMpfaL2dPressureVelocity2pAdaptive<TypeTag>::calculateVelocity() } else if (interactionVolume.getElementNumber() == 3) { - ElementPointer & elementPointer1 = interactionVolume.getSubVolumeElement(0); - ElementPointer & elementPointer2 = interactionVolume.getSubVolumeElement(1); - ElementPointer & elementPointer4 = interactionVolume.getSubVolumeElement(3); + auto element1 = interactionVolume.getSubVolumeElement(0); + auto element2 = interactionVolume.getSubVolumeElement(1); + auto element4 = interactionVolume.getSubVolumeElement(3); // cell index - int eIdxGlobal1 = problem_.variables().index(*elementPointer1); - int eIdxGlobal2 = problem_.variables().index(*elementPointer2); - int eIdxGlobal4 = problem_.variables().index(*elementPointer4); + int eIdxGlobal1 = problem_.variables().index(element1); + int eIdxGlobal2 = problem_.variables().index(element2); + int eIdxGlobal4 = problem_.variables().index(element4); //get the cell Data CellData& cellData1 = problem_.variables().cellData(eIdxGlobal1); @@ -308,10 +307,8 @@ void FvMpfaL2dPressureVelocity2pAdaptive<TypeTag>::calculateVelocity() { continue; } - ElementPointer & elementPointer = interactionVolume.getSubVolumeElement(elemIdx); - // cell index - int eIdxGlobal = problem_.variables().index(*elementPointer); + int eIdxGlobal = problem_.variables().index(interactionVolume.getSubVolumeElement(elemIdx)); //get the cell Data CellData& cellData = problem_.variables().cellData(eIdxGlobal); @@ -336,18 +333,18 @@ void FvMpfaL2dPressureVelocity2pAdaptive<TypeTag>::calculateVelocity(const Inter { int numVertices = intersection.geometry().corners(); - ElementPointer elementPtrI = intersection.inside(); - ElementPointer elementPtrJ = intersection.outside(); + auto elementI = intersection.inside(); + auto elementJ = intersection.outside(); - int levelI = elementPtrI->level(); - int levelJ = elementPtrJ->level(); + int levelI = elementI.level(); + int levelJ = elementJ.level(); - int eIdxGlobalI = problem_.variables().index(*elementPtrI); - int eIdxGlobalJ = problem_.variables().index(*elementPtrJ); + int eIdxGlobalI = problem_.variables().index(elementI); + int eIdxGlobalJ = problem_.variables().index(elementJ); CellData& cellDataJ = problem_.variables().cellData(eIdxGlobalJ); - const ReferenceElement& referenceElement = ReferenceElements::general(elementPtrI->geometry().type()); + const ReferenceElement& referenceElement = ReferenceElements::general(elementI.geometry().type()); int indexInInside = intersection.indexInInside(); int indexInOutside = intersection.indexInOutside(); @@ -380,13 +377,11 @@ void FvMpfaL2dPressureVelocity2pAdaptive<TypeTag>::calculateVelocity(const Inter int vIdxGlobal = 0; if (levelI >= levelJ) { - vIdxGlobal = problem_.variables().index( - *((*elementPtrI).template subEntity < dim > (localVertIdx))); + vIdxGlobal = problem_.variables().index(elementI.template subEntity<dim>(localVertIdx)); } else { - vIdxGlobal = problem_.variables().index( - *((*elementPtrJ).template subEntity < dim > (localVertIdx))); + vIdxGlobal = problem_.variables().index(elementJ.template subEntity<dim>(localVertIdx)); } InteractionVolume& interactionVolume = this->interactionVolumes_[vIdxGlobal]; @@ -398,17 +393,17 @@ void FvMpfaL2dPressureVelocity2pAdaptive<TypeTag>::calculateVelocity(const Inter if (interactionVolume.getElementNumber() == 4) { - ElementPointer & elementPointer1 = interactionVolume.getSubVolumeElement(0); - ElementPointer & elementPointer2 = interactionVolume.getSubVolumeElement(1); - ElementPointer & elementPointer3 = interactionVolume.getSubVolumeElement(2); - ElementPointer & elementPointer4 = interactionVolume.getSubVolumeElement(3); + auto element1 = interactionVolume.getSubVolumeElement(0); + auto element2 = interactionVolume.getSubVolumeElement(1); + auto element3 = interactionVolume.getSubVolumeElement(2); + auto element4 = interactionVolume.getSubVolumeElement(3); eIdxGlobal.resize(4); - eIdxGlobal[0] = problem_.variables().index(*elementPointer1); - eIdxGlobal[1] = problem_.variables().index(*elementPointer2); - eIdxGlobal[2] = problem_.variables().index(*elementPointer3); - eIdxGlobal[3] = problem_.variables().index(*elementPointer4); + eIdxGlobal[0] = problem_.variables().index(element1); + eIdxGlobal[1] = problem_.variables().index(element2); + eIdxGlobal[2] = problem_.variables().index(element3); + eIdxGlobal[3] = problem_.variables().index(element4); //cell Data vector cellDataTemp.resize(4); @@ -423,15 +418,15 @@ void FvMpfaL2dPressureVelocity2pAdaptive<TypeTag>::calculateVelocity(const Inter } else if (interactionVolume.getElementNumber() == 3) { - ElementPointer & elementPointer1 = interactionVolume.getSubVolumeElement(0); - ElementPointer & elementPointer2 = interactionVolume.getSubVolumeElement(1); - ElementPointer & elementPointer4 = interactionVolume.getSubVolumeElement(3); + auto element1 = interactionVolume.getSubVolumeElement(0); + auto element2 = interactionVolume.getSubVolumeElement(1); + auto element4 = interactionVolume.getSubVolumeElement(3); eIdxGlobal.resize(3); - eIdxGlobal[0] = problem_.variables().index(*elementPointer1); - eIdxGlobal[1] = problem_.variables().index(*elementPointer2); - eIdxGlobal[2] = problem_.variables().index(*elementPointer4); + eIdxGlobal[0] = problem_.variables().index(element1); + eIdxGlobal[1] = problem_.variables().index(element2); + eIdxGlobal[2] = problem_.variables().index(element4); //cell Data vector cellDataTemp.resize(3); @@ -527,7 +522,7 @@ void FvMpfaL2dPressureVelocity2pAdaptive<TypeTag>::calculateVelocity(const Inter template<class TypeTag> void FvMpfaL2dPressureVelocity2pAdaptive<TypeTag>::calculateVelocityOnBoundary(const Intersection& intersection, CellData& cellData) { - ElementPointer element = intersection.inside(); + auto element = intersection.inside(); //get face index int isIndex = intersection.indexInInside(); @@ -545,7 +540,7 @@ void FvMpfaL2dPressureVelocity2pAdaptive<TypeTag>::calculateVelocityOnBoundary(c problem_.dirichlet(boundValues, intersection); // get global coordinates of cell centers - const GlobalPosition& globalPosI = element->geometry().center(); + const GlobalPosition& globalPosI = element.geometry().center(); // center of face in global coordinates const GlobalPosition& globalPosJ = intersection.geometry().center(); @@ -567,7 +562,7 @@ void FvMpfaL2dPressureVelocity2pAdaptive<TypeTag>::calculateVelocityOnBoundary(c // compute vectorized permeabilities DimMatrix meanPermeability(0); - problem_.spatialParams().meanK(meanPermeability, problem_.spatialParams().intrinsicPermeability(*element)); + problem_.spatialParams().meanK(meanPermeability, problem_.spatialParams().intrinsicPermeability(element)); Dune::FieldVector<Scalar, dim> permeability(0); meanPermeability.mv(unitOuterNormal, permeability); @@ -596,7 +591,7 @@ void FvMpfaL2dPressureVelocity2pAdaptive<TypeTag>::calculateVelocityOnBoundary(c } Scalar pressBound = boundValues[pressureIdx]; - Scalar pcBound = MaterialLaw::pc(problem_.spatialParams().materialLawParams(*element), satW); + Scalar pcBound = MaterialLaw::pc(problem_.spatialParams().materialLawParams(element), satW); //determine phase pressures from primary pressure variable Scalar pressWBound = 0; @@ -612,9 +607,9 @@ void FvMpfaL2dPressureVelocity2pAdaptive<TypeTag>::calculateVelocityOnBoundary(c pressNwBound = pressBound; } - Scalar lambdaWBound = MaterialLaw::krw(problem_.spatialParams().materialLawParams(*element), satW) + Scalar lambdaWBound = MaterialLaw::krw(problem_.spatialParams().materialLawParams(element), satW) / viscosity_[wPhaseIdx]; - Scalar lambdaNwBound = MaterialLaw::krn(problem_.spatialParams().materialLawParams(*element), satW) + Scalar lambdaNwBound = MaterialLaw::krn(problem_.spatialParams().materialLawParams(element), satW) / viscosity_[nPhaseIdx]; Scalar potentialDiffW = cellData.fluxData().upwindPotential(wPhaseIdx, isIndex); diff --git a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2dtransmissibilitycalculator.hh b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2dtransmissibilitycalculator.hh index 57b94095c3a058e5245ae2f231254f5495d61808..69ed845ff7b9c58022dbbf7a6a2aebbe2c38fe6a 100644 --- a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2dtransmissibilitycalculator.hh +++ b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2dtransmissibilitycalculator.hh @@ -52,8 +52,6 @@ class FvMpfaL2dTransmissibilityCalculator typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef typename GET_PROP_TYPE(TypeTag, Problem) Problem; - typedef typename GridView::template Codim<0>::EntityPointer ElementPointer; - typedef Dune::FieldVector<Scalar, dimWorld> GlobalPosition; typedef Dune::FieldMatrix<Scalar, dim, dim> DimMatrix; @@ -136,28 +134,28 @@ int FvMpfaL2dTransmissibilityCalculator<TypeTag>::calculateTransmissibility( std::vector<DimVector >& lambda, int idx1, int idx2, int idx3, int idx4) { - ElementPointer& elementPointer1 = interactionVolume.getSubVolumeElement(idx1); - ElementPointer& elementPointer2 = interactionVolume.getSubVolumeElement(idx2); - ElementPointer& elementPointer3 = interactionVolume.getSubVolumeElement(idx3); - ElementPointer& elementPointer4 = interactionVolume.getSubVolumeElement(idx4); + auto element1 = interactionVolume.getSubVolumeElement(idx1); + auto element2 = interactionVolume.getSubVolumeElement(idx2); + auto element3 = interactionVolume.getSubVolumeElement(idx3); + auto element4 = interactionVolume.getSubVolumeElement(idx4); - if (elementPointer3 == elementPointer4 && elementPointer1->level() != elementPointer2->level()) + if (element3 == element4 && element1.level() != element2.level()) { return noTransmissibility; } // get global coordinate of cell centers - const GlobalPosition& globalPos1 = elementPointer1->geometry().center(); - const GlobalPosition& globalPos2 = elementPointer2->geometry().center(); - const GlobalPosition& globalPos3 = elementPointer3->geometry().center(); - const GlobalPosition& globalPos4 = elementPointer4->geometry().center(); + const GlobalPosition& globalPos1 = element1.geometry().center(); + const GlobalPosition& globalPos2 = element2.geometry().center(); + const GlobalPosition& globalPos3 = element3.geometry().center(); + const GlobalPosition& globalPos4 = element4.geometry().center(); const GlobalPosition& globalPosCenter = interactionVolume.getCenterPosition(); - const DimMatrix& K1 = problem_.spatialParams().intrinsicPermeability(*elementPointer1); - const DimMatrix& K2 = problem_.spatialParams().intrinsicPermeability(*elementPointer2); - const DimMatrix& K3 = problem_.spatialParams().intrinsicPermeability(*elementPointer3); - const DimMatrix& K4 = problem_.spatialParams().intrinsicPermeability(*elementPointer4); + const DimMatrix& K1 = problem_.spatialParams().intrinsicPermeability(element1); + const DimMatrix& K2 = problem_.spatialParams().intrinsicPermeability(element2); + const DimMatrix& K3 = problem_.spatialParams().intrinsicPermeability(element3); + const DimMatrix& K4 = problem_.spatialParams().intrinsicPermeability(element4); const GlobalPosition& globalPosFace12 = interactionVolume.getFacePosition(idx1, 0); const GlobalPosition& globalPosFace23 = interactionVolume.getFacePosition(idx2, 0); @@ -390,25 +388,25 @@ int FvMpfaL2dTransmissibilityCalculator<TypeTag>::calculateLeftHNTransmissibilit std::vector<DimVector >& lambda, int idx1, int idx2, int idx3) { - ElementPointer& elementPointer1 = interactionVolume.getSubVolumeElement(idx1); - ElementPointer& elementPointer2 = interactionVolume.getSubVolumeElement(idx2); - ElementPointer& elementPointer3 = interactionVolume.getSubVolumeElement(idx3); + auto element1 = interactionVolume.getSubVolumeElement(idx1); + auto element2 = interactionVolume.getSubVolumeElement(idx2); + auto element3 = interactionVolume.getSubVolumeElement(idx3); - if (elementPointer1->level() != elementPointer3->level()) + if (element1.level() != element3.level()) { return noTransmissibility; } // get global coordinate of cell centers - const GlobalPosition& globalPos1 = elementPointer1->geometry().center(); - const GlobalPosition& globalPos2 = elementPointer2->geometry().center(); - const GlobalPosition& globalPos3 = elementPointer3->geometry().center(); + const GlobalPosition& globalPos1 = element1.geometry().center(); + const GlobalPosition& globalPos2 = element2.geometry().center(); + const GlobalPosition& globalPos3 = element3.geometry().center(); const GlobalPosition& globalPosCenter = interactionVolume.getCenterPosition(); - const DimMatrix& K1 = problem_.spatialParams().intrinsicPermeability(*elementPointer1); - const DimMatrix& K2 = problem_.spatialParams().intrinsicPermeability(*elementPointer2); - const DimMatrix& K3 = problem_.spatialParams().intrinsicPermeability(*elementPointer3); + const DimMatrix& K1 = problem_.spatialParams().intrinsicPermeability(element1); + const DimMatrix& K2 = problem_.spatialParams().intrinsicPermeability(element2); + const DimMatrix& K3 = problem_.spatialParams().intrinsicPermeability(element3); const GlobalPosition& globalPosFace12 = interactionVolume.getFacePosition(idx1, 0); DimVector &outerNormaln2 = interactionVolume.getNormal(idx1, 0); @@ -533,25 +531,25 @@ int FvMpfaL2dTransmissibilityCalculator<TypeTag>::calculateRightHNTransmissibili std::vector<DimVector >& lambda, int idx1, int idx2, int idx3) { - ElementPointer& elementPointer1 = interactionVolume.getSubVolumeElement(idx1); - ElementPointer& elementPointer2 = interactionVolume.getSubVolumeElement(idx2); - ElementPointer& elementPointer3 = interactionVolume.getSubVolumeElement(idx3); + auto element1 = interactionVolume.getSubVolumeElement(idx1); + auto element2 = interactionVolume.getSubVolumeElement(idx2); + auto element3 = interactionVolume.getSubVolumeElement(idx3); - if (elementPointer2->level() != elementPointer3->level()) + if (element2.level() != element3.level()) { return noTransmissibility; } // get global coordinate of cell centers - const GlobalPosition& globalPos1 = elementPointer1->geometry().center(); - const GlobalPosition& globalPos2 = elementPointer2->geometry().center(); - const GlobalPosition& globalPos3 = elementPointer3->geometry().center(); + const GlobalPosition& globalPos1 = element1.geometry().center(); + const GlobalPosition& globalPos2 = element2.geometry().center(); + const GlobalPosition& globalPos3 = element3.geometry().center(); const GlobalPosition& globalPosCenter = interactionVolume.getCenterPosition(); - const DimMatrix& K1 = problem_.spatialParams().intrinsicPermeability(*elementPointer1); - const DimMatrix& K2 = problem_.spatialParams().intrinsicPermeability(*elementPointer2); - const DimMatrix& K3 = problem_.spatialParams().intrinsicPermeability(*elementPointer3); + const DimMatrix& K1 = problem_.spatialParams().intrinsicPermeability(element1); + const DimMatrix& K2 = problem_.spatialParams().intrinsicPermeability(element2); + const DimMatrix& K3 = problem_.spatialParams().intrinsicPermeability(element3); const GlobalPosition& globalPosFace12 = interactionVolume.getFacePosition(idx1, 0); const GlobalPosition& globalPosFace23 = interactionVolume.getFacePosition(idx2, 0); diff --git a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2dvelocity2p.hh b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2dvelocity2p.hh index 348ea5a2fcc656a6d5876f7dd5bafdd177944287..70c0ee9e75154ec42330ba3298a0315e30928a26 100644 --- a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2dvelocity2p.hh +++ b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2dvelocity2p.hh @@ -86,7 +86,6 @@ template<class TypeTag> class FvMpfaL2dVelocity2p typedef typename GridView::template Codim<0>::Iterator ElementIterator; typedef typename GridView::template Codim<dim>::Iterator VertexIterator; typedef typename GridView::IntersectionIterator IntersectionIterator; - typedef typename Grid::template Codim<0>::EntityPointer ElementPointer; typedef typename Element::Geometry Geometry; typedef typename Geometry::JacobianTransposed JacobianTransposed; @@ -284,21 +283,21 @@ void FvMpfaL2dVelocity2p<TypeTag>::calculateInnerInteractionVolumeVelocity(Inter CellData& cellData3, CellData& cellData4, InnerBoundaryVolumeFaces& innerBoundaryVolumeFaces) { - ElementPointer & elementPointer1 = interactionVolume.getSubVolumeElement(0); - ElementPointer & elementPointer2 = interactionVolume.getSubVolumeElement(1); - ElementPointer & elementPointer3 = interactionVolume.getSubVolumeElement(2); - ElementPointer & elementPointer4 = interactionVolume.getSubVolumeElement(3); + auto element1 = interactionVolume.getSubVolumeElement(0); + auto element2 = interactionVolume.getSubVolumeElement(1); + auto element3 = interactionVolume.getSubVolumeElement(2); + auto element4 = interactionVolume.getSubVolumeElement(3); - int level1 = elementPointer1->level(); - int level2 = elementPointer2->level(); - int level3 = elementPointer3->level(); - int level4 = elementPointer4->level(); + int level1 = element1.level(); + int level2 = element2.level(); + int level3 = element3.level(); + int level4 = element4.level(); // cell index - int eIdxGlobal1 = problem_.variables().index(*elementPointer1); - int eIdxGlobal2 = problem_.variables().index(*elementPointer2); - int eIdxGlobal3 = problem_.variables().index(*elementPointer3); - int eIdxGlobal4 = problem_.variables().index(*elementPointer4); + int eIdxGlobal1 = problem_.variables().index(element1); + int eIdxGlobal2 = problem_.variables().index(element2); + int eIdxGlobal3 = problem_.variables().index(element3); + int eIdxGlobal4 = problem_.variables().index(element4); // get pressure values Dune::FieldVector < Scalar, 2 * dim > potW(0); @@ -735,13 +734,13 @@ template<class TypeTag> void FvMpfaL2dVelocity2p<TypeTag>::calculateBoundaryInteractionVolumeVelocity(InteractionVolume& interactionVolume, CellData& cellData, int elemIdx) { - ElementPointer & elementPointer = interactionVolume.getSubVolumeElement(elemIdx); + auto element = interactionVolume.getSubVolumeElement(elemIdx); // get global coordinate of cell centers - const GlobalPosition& globalPos = elementPointer->geometry().center(); + const GlobalPosition& globalPos = element.geometry().center(); //permeability vector at boundary - DimMatrix permeability(problem_.spatialParams().intrinsicPermeability(*elementPointer)); + DimMatrix permeability(problem_.spatialParams().intrinsicPermeability(element)); //get mobilities of the phases Dune::FieldVector < Scalar, numPhases > lambda(cellData.mobility(wPhaseIdx)); @@ -758,11 +757,11 @@ void FvMpfaL2dVelocity2p<TypeTag>::calculateBoundaryInteractionVolumeVelocity(In int boundaryFaceIdx = interactionVolume.getIndexOnElement(elemIdx, fIdx); const ReferenceElement& referenceElement = ReferenceElements::general( - elementPointer->geometry().type()); + element.geometry().type()); const LocalPosition& localPos = referenceElement.position(boundaryFaceIdx, 1); - const GlobalPosition& globalPosFace = elementPointer->geometry().global(localPos); + const GlobalPosition& globalPosFace = element.geometry().global(localPos); DimVector distVec(globalPosFace - globalPos); Scalar dist = distVec.two_norm(); @@ -792,7 +791,7 @@ void FvMpfaL2dVelocity2p<TypeTag>::calculateBoundaryInteractionVolumeVelocity(In } Scalar pcBound = MaterialLaw::pc( - problem_.spatialParams().materialLawParams(*elementPointer), satWBound); + problem_.spatialParams().materialLawParams(element), satWBound); Scalar gravityDiffBound = (problem_.bBoxMax() - globalPosFace) * gravity_ * (density_[nPhaseIdx] - density_[wPhaseIdx]); @@ -802,10 +801,10 @@ void FvMpfaL2dVelocity2p<TypeTag>::calculateBoundaryInteractionVolumeVelocity(In Dune::FieldVector < Scalar, numPhases > lambdaBound( MaterialLaw::krw( - problem_.spatialParams().materialLawParams(*elementPointer), + problem_.spatialParams().materialLawParams(element), satWBound)); lambdaBound[nPhaseIdx] = MaterialLaw::krn( - problem_.spatialParams().materialLawParams(*elementPointer), satWBound); + problem_.spatialParams().materialLawParams(element), satWBound); lambdaBound[wPhaseIdx] /= viscosity_[wPhaseIdx]; lambdaBound[nPhaseIdx] /= viscosity_[nPhaseIdx]; @@ -868,11 +867,11 @@ void FvMpfaL2dVelocity2p<TypeTag>::calculateBoundaryInteractionVolumeVelocity(In int boundaryFaceIdx = interactionVolume.getIndexOnElement(elemIdx, fIdx); const ReferenceElement& referenceElement = ReferenceElements::general( - elementPointer->geometry().type()); + element.geometry().type()); const LocalPosition& localPos = referenceElement.position(boundaryFaceIdx, 1); - const GlobalPosition& globalPosFace = elementPointer->geometry().global(localPos); + const GlobalPosition& globalPosFace = element.geometry().global(localPos); DimVector distVec(globalPosFace - globalPos); Scalar dist = distVec.two_norm(); diff --git a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2dvelocity2padaptive.hh b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2dvelocity2padaptive.hh index ee0f4b9b064e101f84d942b4a2b6d5b1d7dd4fa0..b01058d4501a1ceb5f6755319df6b4c0b792601c 100644 --- a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2dvelocity2padaptive.hh +++ b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2dvelocity2padaptive.hh @@ -83,7 +83,6 @@ template<class TypeTag> class FvMpfaL2dVelocity2pAdaptive : public FvMpfaL2dVelo typedef typename GridView::template Codim<0>::Iterator ElementIterator; typedef typename GridView::template Codim<dim>::Iterator VertexIterator; typedef typename GridView::IntersectionIterator IntersectionIterator; - typedef typename Grid::template Codim<0>::EntityPointer ElementPointer; typedef typename Element::Geometry Geometry; typedef typename Geometry::JacobianTransposed JacobianTransposed; @@ -157,12 +156,9 @@ void FvMpfaL2dVelocity2pAdaptive<TypeTag>::calculateHangingNodeInteractionVolume CellData& cellData4, InnerBoundaryVolumeFaces& innerBoundaryVolumeFaces) { - ElementPointer & elementPointer1 = interactionVolume.getSubVolumeElement(0); - ElementPointer & elementPointer2 = interactionVolume.getSubVolumeElement(1); - // cell index - int globalIdx1 = problem_.variables().index(*elementPointer1); - int globalIdx2 = problem_.variables().index(*elementPointer2); + int globalIdx1 = problem_.variables().index(interactionVolume.getSubVolumeElement(0)); + int globalIdx2 = problem_.variables().index(interactionVolume.getSubVolumeElement(1)); // get pressure values Dune::FieldVector < Scalar, 2 * dim > potW(0); diff --git a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dinteractionvolumecontainer.hh b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dinteractionvolumecontainer.hh index 2ae6eb6297d01d175b15a3d1c130527fb59dd88c..3437ed1aefe82c2eab1962f9016d3e5ef7f7f1c5 100644 --- a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dinteractionvolumecontainer.hh +++ b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dinteractionvolumecontainer.hh @@ -77,7 +77,6 @@ class FvMpfaL3dInteractionVolumeContainer typedef typename GridView::template Codim<0>::Iterator ElementIterator; typedef typename GridView::template Codim<dim>::Iterator VertexIterator; - typedef typename GridView::template Codim<0>::EntityPointer ElementPointer; typedef typename GridView::IntersectionIterator IntersectionIterator; typedef typename GridView::Intersection Intersection; typedef typename Intersection::Geometry IntersectionGeometry; @@ -431,12 +430,12 @@ void FvMpfaL3dInteractionVolumeContainer<TypeTag>::storeIntersectionInfo(const E bool takeIntersection = true; if (isIt->neighbor()) { - ElementPointer outside = isIt->outside(); - int eIdxGlobalJ = problem_.variables().index(*outside); + auto outside = isIt->outside(); + int eIdxGlobalJ = problem_.variables().index(outside); - if (levelI == outside->level() && eIdxGlobal > eIdxGlobalJ) + if (levelI == outside.level() && eIdxGlobal > eIdxGlobalJ) takeIntersection = false; - if (levelI < outside->level()) + if (levelI < outside.level()) takeIntersection = false; } @@ -445,7 +444,7 @@ void FvMpfaL3dInteractionVolumeContainer<TypeTag>::storeIntersectionInfo(const E addRealFaceArea_(faceVol, eIdxGlobal, indexInInside); if (isIt->neighbor()) { - int eIdxGlobalJ = problem_.variables().index(*(isIt->outside())); + int eIdxGlobalJ = problem_.variables().index(isIt->outside()); addRealFaceArea_(faceVol, eIdxGlobalJ, isIt->indexInOutside()); } @@ -1384,11 +1383,11 @@ void FvMpfaL3dInteractionVolumeContainer<TypeTag>::storeInnerInteractionVolume(I if (sameLevel) { - ElementPointer& elementPointer1 = interactionVolume.getSubVolumeElement(0); - ElementPointer& elementPointer8 = interactionVolume.getSubVolumeElement(7); + auto element1 = interactionVolume.getSubVolumeElement(0); + auto element8 = interactionVolume.getSubVolumeElement(7); - const ElementGeometry& geometry1 = elementPointer1->geometry(); - const ElementGeometry& geometry8 = elementPointer8->geometry(); + const ElementGeometry& geometry1 = element1.geometry(); + const ElementGeometry& geometry8 = element8.geometry(); const ReferenceElement& referenceElement = ReferenceElements::general(geometry1.type()); @@ -1535,8 +1534,7 @@ void FvMpfaL3dInteractionVolumeContainer<TypeTag>::storeBoundaryInteractionVolum interactionVolume.setOutsideFace(10); interactionVolume.setOutsideFace(11); - ElementPointer& element = interactionVolume.getSubVolumeElement(0); - int eIdxGlobal = problem_.variables().index(*element); + int eIdxGlobal = problem_.variables().index(interactionVolume.getSubVolumeElement(0)); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal, 0, 0)/4.0,0); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal, 0, 1)/4.0,3); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal, 0, 2)/4.0,8); @@ -1553,8 +1551,7 @@ void FvMpfaL3dInteractionVolumeContainer<TypeTag>::storeBoundaryInteractionVolum interactionVolume.setOutsideFace(10); interactionVolume.setOutsideFace(11); - ElementPointer& element = interactionVolume.getSubVolumeElement(1); - int eIdxGlobal = problem_.variables().index(*element); + int eIdxGlobal = problem_.variables().index(interactionVolume.getSubVolumeElement(1)); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal, 1, 0)/4.0,1); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal, 1, 1)/4.0,0); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal, 1, 2)/4.0,9); @@ -1571,8 +1568,7 @@ void FvMpfaL3dInteractionVolumeContainer<TypeTag>::storeBoundaryInteractionVolum interactionVolume.setOutsideFace(9); interactionVolume.setOutsideFace(10); - ElementPointer& element = interactionVolume.getSubVolumeElement(2); - int eIdxGlobal = problem_.variables().index(*element); + int eIdxGlobal = problem_.variables().index(interactionVolume.getSubVolumeElement(2)); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal, 2, 0)/4.0,3); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal, 2, 1)/4.0,2); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal, 2, 2)/4.0,11); @@ -1589,8 +1585,7 @@ void FvMpfaL3dInteractionVolumeContainer<TypeTag>::storeBoundaryInteractionVolum interactionVolume.setOutsideFace(9); interactionVolume.setOutsideFace(11); - ElementPointer& element = interactionVolume.getSubVolumeElement(3); - int eIdxGlobal = problem_.variables().index(*element); + int eIdxGlobal = problem_.variables().index(interactionVolume.getSubVolumeElement(3)); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal, 3, 0)/4.0,2); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal, 3, 1)/4.0,1); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal, 3, 2)/4.0,10); @@ -1607,8 +1602,7 @@ void FvMpfaL3dInteractionVolumeContainer<TypeTag>::storeBoundaryInteractionVolum interactionVolume.setOutsideFace(10); interactionVolume.setOutsideFace(11); - ElementPointer& element = interactionVolume.getSubVolumeElement(4); - int eIdxGlobal = problem_.variables().index(*element); + int eIdxGlobal = problem_.variables().index(interactionVolume.getSubVolumeElement(4)); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal, 4, 0)/4.0,8); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal, 4, 1)/4.0,4); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal, 4, 2)/4.0,7); @@ -1625,8 +1619,7 @@ void FvMpfaL3dInteractionVolumeContainer<TypeTag>::storeBoundaryInteractionVolum interactionVolume.setOutsideFace(10); interactionVolume.setOutsideFace(11); - ElementPointer& element = interactionVolume.getSubVolumeElement(5); - int eIdxGlobal = problem_.variables().index(*element); + int eIdxGlobal = problem_.variables().index(interactionVolume.getSubVolumeElement(5)); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal, 5, 0)/4.0,9); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal, 5, 1)/4.0,5); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal, 5, 2)/4.0,4); @@ -1643,8 +1636,7 @@ void FvMpfaL3dInteractionVolumeContainer<TypeTag>::storeBoundaryInteractionVolum interactionVolume.setOutsideFace(9); interactionVolume.setOutsideFace(10); - ElementPointer& element = interactionVolume.getSubVolumeElement(6); - int eIdxGlobal = problem_.variables().index(*element); + int eIdxGlobal = problem_.variables().index(interactionVolume.getSubVolumeElement(6)); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal, 6, 0)/4.0,11); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal, 6, 1)/4.0,7); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal, 6, 2)/4.0,6); @@ -1661,8 +1653,7 @@ void FvMpfaL3dInteractionVolumeContainer<TypeTag>::storeBoundaryInteractionVolum interactionVolume.setOutsideFace(9); interactionVolume.setOutsideFace(11); - ElementPointer& element = interactionVolume.getSubVolumeElement(7); - int eIdxGlobal = problem_.variables().index(*element); + int eIdxGlobal = problem_.variables().index(interactionVolume.getSubVolumeElement(7)); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal, 7, 0)/4.0,10); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal, 7, 1)/4.0,6); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal, 7, 2)/4.0,5); @@ -1674,8 +1665,7 @@ void FvMpfaL3dInteractionVolumeContainer<TypeTag>::storeBoundaryInteractionVolum // edge if (interactionVolume.hasSubVolumeElement(0)) { - ElementPointer& element1 = interactionVolume.getSubVolumeElement(0); - int eIdxGlobal1 = problem_.variables().index(*element1); + int eIdxGlobal1 = problem_.variables().index(interactionVolume.getSubVolumeElement(0)); if (interactionVolume.hasSubVolumeElement(1)) { interactionVolume.setOutsideFace(4); @@ -1686,8 +1676,7 @@ void FvMpfaL3dInteractionVolumeContainer<TypeTag>::storeBoundaryInteractionVolum interactionVolume.setOutsideFace(10); interactionVolume.setOutsideFace(11); - ElementPointer& element2 = interactionVolume.getSubVolumeElement(1); - int eIdxGlobal2 = problem_.variables().index(*element2); + int eIdxGlobal2 = problem_.variables().index(interactionVolume.getSubVolumeElement(1)); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal1, 0, 1)/4.0,3); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal1, 0, 2)/4.0,8); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal2, 1, 0)/4.0,1); @@ -1705,8 +1694,7 @@ void FvMpfaL3dInteractionVolumeContainer<TypeTag>::storeBoundaryInteractionVolum interactionVolume.setOutsideFace(9); interactionVolume.setOutsideFace(10); - ElementPointer& element2 = interactionVolume.getSubVolumeElement(2); - int eIdxGlobal2 = problem_.variables().index(*element2); + int eIdxGlobal2 = problem_.variables().index(interactionVolume.getSubVolumeElement(2)); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal1, 0, 0)/4.0,0); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal1, 0, 2)/4.0,8); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal2, 2, 1)/4.0,2); @@ -1724,8 +1712,7 @@ void FvMpfaL3dInteractionVolumeContainer<TypeTag>::storeBoundaryInteractionVolum interactionVolume.setOutsideFace(6); interactionVolume.setOutsideFace(11); - ElementPointer& element2 = interactionVolume.getSubVolumeElement(4); - int eIdxGlobal2 = problem_.variables().index(*element2); + int eIdxGlobal2 = problem_.variables().index(interactionVolume.getSubVolumeElement(4)); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal1, 0, 0)/4.0,0); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal1, 0, 1)/4.0,3); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal2, 4, 1)/4.0,4); @@ -1736,8 +1723,7 @@ void FvMpfaL3dInteractionVolumeContainer<TypeTag>::storeBoundaryInteractionVolum } if (interactionVolume.hasSubVolumeElement(7)) { - ElementPointer& element1 = interactionVolume.getSubVolumeElement(7); - int eIdxGlobal1 = problem_.variables().index(*element1); + int eIdxGlobal1 = problem_.variables().index(interactionVolume.getSubVolumeElement(7)); if (interactionVolume.hasSubVolumeElement(5)) { interactionVolume.setOutsideFace(0); @@ -1748,8 +1734,7 @@ void FvMpfaL3dInteractionVolumeContainer<TypeTag>::storeBoundaryInteractionVolum interactionVolume.setOutsideFace(8); interactionVolume.setOutsideFace(11); - ElementPointer& element2 = interactionVolume.getSubVolumeElement(5); - int eIdxGlobal2 = problem_.variables().index(*element2); + int eIdxGlobal2 = problem_.variables().index(interactionVolume.getSubVolumeElement(5)); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal1, 7, 0)/4.0,10); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal1, 7, 1)/4.0,6); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal2, 5, 0)/4.0,9); @@ -1767,8 +1752,7 @@ void FvMpfaL3dInteractionVolumeContainer<TypeTag>::storeBoundaryInteractionVolum interactionVolume.setOutsideFace(8); interactionVolume.setOutsideFace(9); - ElementPointer& element2 = interactionVolume.getSubVolumeElement(6); - int eIdxGlobal2 = problem_.variables().index(*element2); + int eIdxGlobal2 = problem_.variables().index(interactionVolume.getSubVolumeElement(6)); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal1, 7, 0)/4.0,10); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal1, 7, 2)/4.0,5); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal2, 6, 0)/4.0,11); @@ -1786,8 +1770,7 @@ void FvMpfaL3dInteractionVolumeContainer<TypeTag>::storeBoundaryInteractionVolum interactionVolume.setOutsideFace(7); interactionVolume.setOutsideFace(11); - ElementPointer& element2 = interactionVolume.getSubVolumeElement(3); - int eIdxGlobal2 = problem_.variables().index(*element2); + int eIdxGlobal2 = problem_.variables().index(interactionVolume.getSubVolumeElement(3)); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal1, 7, 1)/4.0,6); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal1, 7, 2)/4.0,5); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal2, 3, 0)/4.0,2); @@ -1798,8 +1781,7 @@ void FvMpfaL3dInteractionVolumeContainer<TypeTag>::storeBoundaryInteractionVolum } if (interactionVolume.hasSubVolumeElement(5)) { - ElementPointer& element1 = interactionVolume.getSubVolumeElement(5); - int eIdxGlobal1 = problem_.variables().index(*element1); + int eIdxGlobal1 = problem_.variables().index(interactionVolume.getSubVolumeElement(5)); if (interactionVolume.hasSubVolumeElement(1)) { interactionVolume.setOutsideFace(3); @@ -1810,8 +1792,7 @@ void FvMpfaL3dInteractionVolumeContainer<TypeTag>::storeBoundaryInteractionVolum interactionVolume.setOutsideFace(6); interactionVolume.setOutsideFace(10); - ElementPointer& element2 = interactionVolume.getSubVolumeElement(1); - int eIdxGlobal2 = problem_.variables().index(*element2); + int eIdxGlobal2 = problem_.variables().index(interactionVolume.getSubVolumeElement(1)); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal1, 5, 1)/4.0,5); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal1, 5, 2)/4.0,4); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal2, 1, 0)/4.0,1); @@ -1829,8 +1810,7 @@ void FvMpfaL3dInteractionVolumeContainer<TypeTag>::storeBoundaryInteractionVolum interactionVolume.setOutsideFace(10); interactionVolume.setOutsideFace(11); - ElementPointer& element2 = interactionVolume.getSubVolumeElement(4); - int eIdxGlobal2 = problem_.variables().index(*element2); + int eIdxGlobal2 = problem_.variables().index(interactionVolume.getSubVolumeElement(4)); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal1, 5, 0)/4.0,9); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal1, 5, 1)/4.0,5); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal2, 4, 0)/4.0,8); @@ -1841,8 +1821,7 @@ void FvMpfaL3dInteractionVolumeContainer<TypeTag>::storeBoundaryInteractionVolum } if (interactionVolume.hasSubVolumeElement(6)) { - ElementPointer& element1 = interactionVolume.getSubVolumeElement(6); - int eIdxGlobal1 = problem_.variables().index(*element1); + int eIdxGlobal1 = problem_.variables().index(interactionVolume.getSubVolumeElement(6)); if (interactionVolume.hasSubVolumeElement(4)) { interactionVolume.setOutsideFace(1); @@ -1853,8 +1832,7 @@ void FvMpfaL3dInteractionVolumeContainer<TypeTag>::storeBoundaryInteractionVolum interactionVolume.setOutsideFace(2); interactionVolume.setOutsideFace(3); - ElementPointer& element2 = interactionVolume.getSubVolumeElement(4); - int eIdxGlobal2 = problem_.variables().index(*element2); + int eIdxGlobal2 = problem_.variables().index(interactionVolume.getSubVolumeElement(4)); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal1, 6, 0)/4.0,11); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal1, 6, 2)/4.0,6); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal2, 4, 0)/4.0,8); @@ -1872,8 +1850,7 @@ void FvMpfaL3dInteractionVolumeContainer<TypeTag>::storeBoundaryInteractionVolum interactionVolume.setOutsideFace(4); interactionVolume.setOutsideFace(8); - ElementPointer& element2 = interactionVolume.getSubVolumeElement(2); - int eIdxGlobal2 = problem_.variables().index(*element2); + int eIdxGlobal2 = problem_.variables().index(interactionVolume.getSubVolumeElement(2)); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal1, 6, 1)/4.0,7); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal1, 6, 2)/4.0,6); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal2, 2, 0)/4.0,3); @@ -1884,8 +1861,7 @@ void FvMpfaL3dInteractionVolumeContainer<TypeTag>::storeBoundaryInteractionVolum } if (interactionVolume.hasSubVolumeElement(3)) { - ElementPointer& element1 = interactionVolume.getSubVolumeElement(3); - int eIdxGlobal1 = problem_.variables().index(*element1); + int eIdxGlobal1 = problem_.variables().index(interactionVolume.getSubVolumeElement(3)); if (interactionVolume.hasSubVolumeElement(1)) { interactionVolume.setOutsideFace(4); @@ -1896,8 +1872,7 @@ void FvMpfaL3dInteractionVolumeContainer<TypeTag>::storeBoundaryInteractionVolum interactionVolume.setOutsideFace(8); interactionVolume.setOutsideFace(11); - ElementPointer& element2 = interactionVolume.getSubVolumeElement(1); - int eIdxGlobal2 = problem_.variables().index(*element2); + int eIdxGlobal2 = problem_.variables().index(interactionVolume.getSubVolumeElement(1)); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal1, 3, 0)/4.0,2); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal1, 3, 2)/4.0,10); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal2, 1, 1)/4.0,0); @@ -1915,8 +1890,7 @@ void FvMpfaL3dInteractionVolumeContainer<TypeTag>::storeBoundaryInteractionVolum interactionVolume.setOutsideFace(8); interactionVolume.setOutsideFace(9); - ElementPointer& element2 = interactionVolume.getSubVolumeElement(2); - int eIdxGlobal2 = problem_.variables().index(*element2); + int eIdxGlobal2 = problem_.variables().index(interactionVolume.getSubVolumeElement(2)); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal1, 3, 1)/4.0,1); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal1, 3, 2)/4.0,10); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal2, 2, 0)/4.0,3); @@ -1932,12 +1906,10 @@ void FvMpfaL3dInteractionVolumeContainer<TypeTag>::storeBoundaryInteractionVolum //side if (interactionVolume.hasSubVolumeElement(0)) { - ElementPointer& element1 = interactionVolume.getSubVolumeElement(0); - int eIdxGlobal1 = problem_.variables().index(*element1); + int eIdxGlobal1 = problem_.variables().index(interactionVolume.getSubVolumeElement(0)); if (interactionVolume.hasSubVolumeElement(1)) { - ElementPointer& element2 = interactionVolume.getSubVolumeElement(1); - int eIdxGlobal2 = problem_.variables().index(*element2); + int eIdxGlobal2 = problem_.variables().index(interactionVolume.getSubVolumeElement(1)); if (interactionVolume.hasSubVolumeElement(2) && interactionVolume.hasSubVolumeElement(3)) { interactionVolume.setOutsideFace(4); @@ -1945,10 +1917,8 @@ void FvMpfaL3dInteractionVolumeContainer<TypeTag>::storeBoundaryInteractionVolum interactionVolume.setOutsideFace(6); interactionVolume.setOutsideFace(7); - ElementPointer& element3 = interactionVolume.getSubVolumeElement(2); - int eIdxGlobal3 = problem_.variables().index(*element3); - ElementPointer& element4 = interactionVolume.getSubVolumeElement(3); - int eIdxGlobal4 = problem_.variables().index(*element4); + int eIdxGlobal3 = problem_.variables().index(interactionVolume.getSubVolumeElement(2)); + int eIdxGlobal4 = problem_.variables().index(interactionVolume.getSubVolumeElement(3)); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal1, 0, 2)/4.0, 8); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal2, 1, 2)/4.0, 9); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal3, 2, 2)/4.0, 10); @@ -1963,10 +1933,8 @@ void FvMpfaL3dInteractionVolumeContainer<TypeTag>::storeBoundaryInteractionVolum interactionVolume.setOutsideFace(10); interactionVolume.setOutsideFace(11); - ElementPointer& element3 = interactionVolume.getSubVolumeElement(4); - int eIdxGlobal3 = problem_.variables().index(*element3); - ElementPointer& element4 = interactionVolume.getSubVolumeElement(5); - int eIdxGlobal4 = problem_.variables().index(*element4); + int eIdxGlobal3 = problem_.variables().index(interactionVolume.getSubVolumeElement(4)); + int eIdxGlobal4 = problem_.variables().index(interactionVolume.getSubVolumeElement(5)); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal1, 0, 1)/4.0, 3); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal2, 1, 0)/4.0, 1); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal3, 4, 2)/4.0, 7); @@ -1983,12 +1951,9 @@ void FvMpfaL3dInteractionVolumeContainer<TypeTag>::storeBoundaryInteractionVolum interactionVolume.setOutsideFace(9); interactionVolume.setOutsideFace(10); - ElementPointer& element2 = interactionVolume.getSubVolumeElement(2); - int eIdxGlobal2 = problem_.variables().index(*element2); - ElementPointer& element3 = interactionVolume.getSubVolumeElement(4); - int eIdxGlobal3 = problem_.variables().index(*element3); - ElementPointer& element4 = interactionVolume.getSubVolumeElement(6); - int eIdxGlobal4 = problem_.variables().index(*element4); + int eIdxGlobal2 = problem_.variables().index(interactionVolume.getSubVolumeElement(2)); + int eIdxGlobal3 = problem_.variables().index(interactionVolume.getSubVolumeElement(4)); + int eIdxGlobal4 = problem_.variables().index(interactionVolume.getSubVolumeElement(6)); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal1, 0, 0)/4.0, 0); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal2, 2, 1)/4.0, 2); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal3, 4, 1)/4.0, 4); @@ -1999,12 +1964,10 @@ void FvMpfaL3dInteractionVolumeContainer<TypeTag>::storeBoundaryInteractionVolum } if (interactionVolume.hasSubVolumeElement(7)) { - ElementPointer& element1 = interactionVolume.getSubVolumeElement(7); - int eIdxGlobal1 = problem_.variables().index(*element1); + int eIdxGlobal1 = problem_.variables().index(interactionVolume.getSubVolumeElement(7)); if (interactionVolume.hasSubVolumeElement(5)) { - ElementPointer& element2 = interactionVolume.getSubVolumeElement(5); - int eIdxGlobal2 = problem_.variables().index(*element2); + int eIdxGlobal2 = problem_.variables().index(interactionVolume.getSubVolumeElement(5)); if (interactionVolume.hasSubVolumeElement(1) && interactionVolume.hasSubVolumeElement(3)) { interactionVolume.setOutsideFace(3); @@ -2012,10 +1975,8 @@ void FvMpfaL3dInteractionVolumeContainer<TypeTag>::storeBoundaryInteractionVolum interactionVolume.setOutsideFace(8); interactionVolume.setOutsideFace(11); - ElementPointer& element3 = interactionVolume.getSubVolumeElement(1); - int eIdxGlobal3 = problem_.variables().index(*element3); - ElementPointer& element4 = interactionVolume.getSubVolumeElement(3); - int eIdxGlobal4 = problem_.variables().index(*element4); + int eIdxGlobal3 = problem_.variables().index(interactionVolume.getSubVolumeElement(1)); + int eIdxGlobal4 = problem_.variables().index(interactionVolume.getSubVolumeElement(3)); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal1, 7, 1)/4.0, 6); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal2, 5, 2)/4.0, 4); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal3, 1, 1)/4.0, 0); @@ -2030,10 +1991,8 @@ void FvMpfaL3dInteractionVolumeContainer<TypeTag>::storeBoundaryInteractionVolum interactionVolume.setOutsideFace(2); interactionVolume.setOutsideFace(3); - ElementPointer& element3 = interactionVolume.getSubVolumeElement(4); - int eIdxGlobal3 = problem_.variables().index(*element3); - ElementPointer& element4 = interactionVolume.getSubVolumeElement(6); - int eIdxGlobal4 = problem_.variables().index(*element4); + int eIdxGlobal3 = problem_.variables().index(interactionVolume.getSubVolumeElement(4)); + int eIdxGlobal4 = problem_.variables().index(interactionVolume.getSubVolumeElement(6)); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal1, 7, 0)/4.0, 10); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal2, 5, 0)/4.0, 9); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal3, 4, 0)/4.0, 8); @@ -2050,12 +2009,9 @@ void FvMpfaL3dInteractionVolumeContainer<TypeTag>::storeBoundaryInteractionVolum interactionVolume.setOutsideFace(8); interactionVolume.setOutsideFace(9); - ElementPointer& element2 = interactionVolume.getSubVolumeElement(6); - int eIdxGlobal2 = problem_.variables().index(*element2); - ElementPointer& element3 = interactionVolume.getSubVolumeElement(2); - int eIdxGlobal3 = problem_.variables().index(*element3); - ElementPointer& element4 = interactionVolume.getSubVolumeElement(3); - int eIdxGlobal4 = problem_.variables().index(*element4); + int eIdxGlobal2 = problem_.variables().index(interactionVolume.getSubVolumeElement(6)); + int eIdxGlobal3 = problem_.variables().index(interactionVolume.getSubVolumeElement(2)); + int eIdxGlobal4 = problem_.variables().index(interactionVolume.getSubVolumeElement(3)); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal1, 7, 2)/4.0, 5); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal2, 6, 1)/4.0, 7); interactionVolume.setFaceArea(getRealFaceArea(interactionVolume, eIdxGlobal3, 2, 0)/4.0, 3); @@ -2082,10 +2038,7 @@ void FvMpfaL3dInteractionVolumeContainer<TypeTag>::storeInteractionVolumeInfo() //Add elements to the interaction volumes and store element-vertex map ElementIterator eEndIt = problem_.gridView().template end<0>(); for (ElementIterator eIt = problem_.gridView().template begin<0>(); eIt != eEndIt; ++eIt) - { - ElementPointer ePtr = *eIt; - storeSubVolumeElements(*ePtr, elemVertMap); - } + storeSubVolumeElements(*eIt, elemVertMap); for (unsigned int i = 0; i < interactionVolumes_.size(); i++) if (interactionVolumes_[i].getElementNumber() == 0) @@ -2093,10 +2046,7 @@ void FvMpfaL3dInteractionVolumeContainer<TypeTag>::storeInteractionVolumeInfo() // Store information related to DUNE intersections for all interaction volumes for (ElementIterator eIt = problem_.gridView().template begin<0>(); eIt != eEndIt; ++eIt) - { - ElementPointer ePtr = *eIt; - storeIntersectionInfo(*ePtr, elemVertMap); - } + storeIntersectionInfo(*eIt, elemVertMap); // Complete storage of the interaction volumes using the previously stored information // about the orientation and relationship of the DUNE elements in the interaction volumes (see doc/docextra/3dmpfa) @@ -2128,23 +2078,23 @@ void FvMpfaL3dInteractionVolumeContainer<TypeTag>::storeInteractionVolumeInfo() // editors, Simulation of Flow in Porous Media - Applications in Energy and Environment. De Gruyter.) if (!interactionVolume.isBoundaryInteractionVolume()) { - ElementPointer& elementPointer1 = interactionVolume.getSubVolumeElement(0); - ElementPointer& elementPointer2 = interactionVolume.getSubVolumeElement(1); - ElementPointer& elementPointer3 = interactionVolume.getSubVolumeElement(2); - ElementPointer& elementPointer4 = interactionVolume.getSubVolumeElement(3); - ElementPointer& elementPointer5 = interactionVolume.getSubVolumeElement(4); - ElementPointer& elementPointer6 = interactionVolume.getSubVolumeElement(5); - ElementPointer& elementPointer7 = interactionVolume.getSubVolumeElement(6); - ElementPointer& elementPointer8 = interactionVolume.getSubVolumeElement(7); - - int eIdxGlobal1 = problem_.variables().index(*elementPointer1); - int eIdxGlobal2 = problem_.variables().index(*elementPointer2); - int eIdxGlobal3 = problem_.variables().index(*elementPointer3); - int eIdxGlobal4 = problem_.variables().index(*elementPointer4); - int eIdxGlobal5 = problem_.variables().index(*elementPointer5); - int eIdxGlobal6 = problem_.variables().index(*elementPointer6); - int eIdxGlobal7 = problem_.variables().index(*elementPointer7); - int eIdxGlobal8 = problem_.variables().index(*elementPointer8); + auto element1 = interactionVolume.getSubVolumeElement(0); + auto element2 = interactionVolume.getSubVolumeElement(1); + auto element3 = interactionVolume.getSubVolumeElement(2); + auto element4 = interactionVolume.getSubVolumeElement(3); + auto element5 = interactionVolume.getSubVolumeElement(4); + auto element6 = interactionVolume.getSubVolumeElement(5); + auto element7 = interactionVolume.getSubVolumeElement(6); + auto element8 = interactionVolume.getSubVolumeElement(7); + + int eIdxGlobal1 = problem_.variables().index(element1); + int eIdxGlobal2 = problem_.variables().index(element2); + int eIdxGlobal3 = problem_.variables().index(element3); + int eIdxGlobal4 = problem_.variables().index(element4); + int eIdxGlobal5 = problem_.variables().index(element5); + int eIdxGlobal6 = problem_.variables().index(element6); + int eIdxGlobal7 = problem_.variables().index(element7); + int eIdxGlobal8 = problem_.variables().index(element8); addRealFluxFaceArea_(interactionVolume.getFaceArea(0, 0), eIdxGlobal1, interactionVolume.getIndexOnElement(0, 0)); addRealFluxFaceArea_(interactionVolume.getFaceArea(0, 1), eIdxGlobal1, interactionVolume.getIndexOnElement(0, 1)); diff --git a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dinteractionvolumecontaineradaptive.hh b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dinteractionvolumecontaineradaptive.hh index 323b7b95248a6cb9b3b55e462ed24796550e1e41..dfbf16211dac576ee889baa43f4cca127a0ca464 100644 --- a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dinteractionvolumecontaineradaptive.hh +++ b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dinteractionvolumecontaineradaptive.hh @@ -69,7 +69,6 @@ class FvMpfaL3dInteractionVolumeContainerAdaptive: public FvMpfaL3dInteractionVo typedef typename GridView::template Codim<0>::Iterator ElementIterator; typedef typename GridView::template Codim<dim>::Iterator VertexIterator; - typedef typename GridView::template Codim<0>::EntityPointer ElementPointer; typedef typename GridView::IntersectionIterator IntersectionIterator; typedef Dune::FieldVector<Scalar, dimWorld> GlobalPosition; @@ -176,7 +175,7 @@ void FvMpfaL3dInteractionVolumeContainerAdaptive<TypeTag>::storeInnerInteraction for (int i = 0; i < 8; i++) { levelIdx[i][0] = i; - levelIdx[i][1] = interactionVolume.getSubVolumeElement(i)->level(); + levelIdx[i][1] = interactionVolume.getSubVolumeElement(i).level(); } std::sort(levelIdx.begin(), levelIdx.end(), sort_compare); @@ -189,9 +188,9 @@ void FvMpfaL3dInteractionVolumeContainerAdaptive<TypeTag>::storeInnerInteraction for (int i = 0; i < 8; i++) { int idx = levelIdx[i][0]; - ElementPointer& elementPointer = interactionVolume.getSubVolumeElement(idx); + auto element = interactionVolume.getSubVolumeElement(idx); - const ElementGeometry& geometry = elementPointer->geometry(); + const ElementGeometry& geometry = element.geometry(); const ReferenceElement& referenceElement = ReferenceElements::general(geometry.type()); @@ -330,7 +329,7 @@ void FvMpfaL3dInteractionVolumeContainerAdaptive<TypeTag>::storeHangingNodeInter { levelIdx[i][0] = i; if (interactionVolume.hasSubVolumeElement(i)) - levelIdx[i][1] = interactionVolume.getSubVolumeElement(i)->level(); + levelIdx[i][1] = interactionVolume.getSubVolumeElement(i).level(); else levelIdx[i][1] = -1; } @@ -349,9 +348,9 @@ void FvMpfaL3dInteractionVolumeContainerAdaptive<TypeTag>::storeHangingNodeInter int idx = levelIdx[i][0]; - ElementPointer& elementPointer = interactionVolume.getSubVolumeElement(idx); + auto element = interactionVolume.getSubVolumeElement(idx); - const ElementGeometry& geometry = elementPointer->geometry(); + const ElementGeometry& geometry = element.geometry(); const ReferenceElement& referenceElement = ReferenceElements::general(geometry.type()); @@ -518,10 +517,10 @@ void FvMpfaL3dInteractionVolumeContainerAdaptive<TypeTag>::storeHangingNodeInter interactionVolume.setCenterPosition(centerPos); - ElementPointer& element1 = interactionVolume.getSubVolumeElement(0); + auto element1 = interactionVolume.getSubVolumeElement(0); - IntersectionIterator isIt = problem_.gridView().ibegin(*element1); - IntersectionIterator isEndIt = problem_.gridView().iend(*element1); + IntersectionIterator isIt = problem_.gridView().ibegin(element1); + IntersectionIterator isEndIt = problem_.gridView().iend(element1); for (; isIt != isEndIt; ++isIt) { int idxInInside = isIt->indexInInside(); @@ -530,8 +529,8 @@ void FvMpfaL3dInteractionVolumeContainerAdaptive<TypeTag>::storeHangingNodeInter { if (isIt->neighbor()) { - ElementPointer outside = isIt->outside(); - if (element1->level() > outside->level()) + auto outside = isIt->outside(); + if (element1.level() > outside.level()) { interactionVolume.setSubVolumeElement(outside, 4); interactionVolume.setSubVolumeElement(outside, 5); @@ -542,8 +541,8 @@ void FvMpfaL3dInteractionVolumeContainerAdaptive<TypeTag>::storeHangingNodeInter { if (isIt->neighbor()) { - ElementPointer outside = isIt->outside(); - if (element1->level() > outside->level()) + auto outside = isIt->outside(); + if (element1.level() > outside.level()) { interactionVolume.setSubVolumeElement(outside, 2); interactionVolume.setSubVolumeElement(outside, 3); @@ -551,25 +550,25 @@ void FvMpfaL3dInteractionVolumeContainerAdaptive<TypeTag>::storeHangingNodeInter } } } - ElementPointer& element2 = interactionVolume.getSubVolumeElement(1); - ElementPointer& element45 = interactionVolume.getSubVolumeElement(4); - ElementPointer& element23 = interactionVolume.getSubVolumeElement(2); + auto element2 = interactionVolume.getSubVolumeElement(1); + auto element45 = interactionVolume.getSubVolumeElement(4); + auto element23 = interactionVolume.getSubVolumeElement(2); - IntersectionIterator isIt1 = problem_.gridView().ibegin(*element45); - IntersectionIterator isIt1End = problem_.gridView().iend(*element45); + IntersectionIterator isIt1 = problem_.gridView().ibegin(element45); + IntersectionIterator isIt1End = problem_.gridView().iend(element45); for (; isIt1 != isIt1End; ++isIt1) { if (isIt1->neighbor()) { - ElementPointer element45Outside = isIt1->outside(); + auto element45Outside = isIt1->outside(); - IntersectionIterator isIt2 = problem_.gridView().ibegin(*element23); - IntersectionIterator isIt2End = problem_.gridView().iend(*element23); + IntersectionIterator isIt2 = problem_.gridView().ibegin(element23); + IntersectionIterator isIt2End = problem_.gridView().iend(element23); for (; isIt2 != isIt2End; ++isIt2) { if (isIt2->neighbor()) { - ElementPointer element23Outside = isIt2->outside(); + auto element23Outside = isIt2->outside(); if (element45Outside == element23Outside && element45Outside != element1 && element45Outside != element2) @@ -777,14 +776,14 @@ void FvMpfaL3dInteractionVolumeContainerAdaptive<TypeTag>::storeHangingNodeInter if (zeroFaceIdxVec.size() == 4) { - ElementPointer& element1 = interactionVolume.getSubVolumeElement(0); - ElementPointer& element4 = interactionVolume.getSubVolumeElement(3); + auto element1 = interactionVolume.getSubVolumeElement(0); + auto element4 = interactionVolume.getSubVolumeElement(3); - ElementPointer outside1 = element1; - ElementPointer outside4 = element4; + auto outside1 = element1; + auto outside4 = element4; - IntersectionIterator isIt1 = problem_.gridView().ibegin(*element1); - IntersectionIterator isItEnd1 = problem_.gridView().iend(*element1); + IntersectionIterator isIt1 = problem_.gridView().ibegin(element1); + IntersectionIterator isItEnd1 = problem_.gridView().iend(element1); for (; isIt1 != isItEnd1; ++isIt1) { if (isIt1->neighbor()) @@ -796,8 +795,8 @@ void FvMpfaL3dInteractionVolumeContainerAdaptive<TypeTag>::storeHangingNodeInter } } } - IntersectionIterator isIt4 = problem_.gridView().ibegin(*element4); - IntersectionIterator isItEnd4 = problem_.gridView().iend(*element4); + IntersectionIterator isIt4 = problem_.gridView().ibegin(element4); + IntersectionIterator isItEnd4 = problem_.gridView().iend(element4); for (; isIt4 != isItEnd4; ++isIt4) { if (isIt4->neighbor()) @@ -821,7 +820,7 @@ void FvMpfaL3dInteractionVolumeContainerAdaptive<TypeTag>::storeHangingNodeInter if (interactionVolume.getHangingNodeType() == InteractionVolume::fourSmallCellsFace) { - ElementPointer& element = interactionVolume.getSubVolumeElement(0); + auto element = interactionVolume.getSubVolumeElement(0); DimVector edgeCoord1(interactionVolume.getEdgePosition(0)); DimVector edgeCoord2(interactionVolume.getEdgePosition(1)); @@ -881,16 +880,16 @@ void FvMpfaL3dInteractionVolumeContainerAdaptive<TypeTag>::storeHangingNodeInter faceArea = crossProduct(crossProductVector1, crossProductVector2).two_norm()/2.0; interactionVolume.setFaceArea(faceArea, 11); - IntersectionIterator isIt = problem_.gridView().ibegin(*element); - IntersectionIterator isEndIt = problem_.gridView().iend(*element); + IntersectionIterator isIt = problem_.gridView().ibegin(element); + IntersectionIterator isEndIt = problem_.gridView().iend(element); for (; isIt != isEndIt; ++isIt) { if (isIt->indexInInside() == interactionVolume.getIndexOnElement(0, 2)) { if (isIt->neighbor()) { - ElementPointer outside = isIt->outside(); - if (element->level() > outside->level()) + auto outside = isIt->outside(); + if (element.level() > outside.level()) { interactionVolume.setSubVolumeElement(outside, 4); interactionVolume.setSubVolumeElement(outside, 5); @@ -906,37 +905,37 @@ void FvMpfaL3dInteractionVolumeContainerAdaptive<TypeTag>::storeHangingNodeInter } else if (interactionVolume.getHangingNodeType() == InteractionVolume::fourSmallCellsEdge) { - ElementPointer& element1 = interactionVolume.getSubVolumeElement(0); - ElementPointer& element2 = interactionVolume.getSubVolumeElement(1); - ElementPointer& element3 = interactionVolume.getSubVolumeElement(2); - ElementPointer& element4 = interactionVolume.getSubVolumeElement(3); + auto element1 = interactionVolume.getSubVolumeElement(0); + auto element2 = interactionVolume.getSubVolumeElement(1); + auto element3 = interactionVolume.getSubVolumeElement(2); + auto element4 = interactionVolume.getSubVolumeElement(3); - IntersectionIterator isIt1 = problem_.gridView().ibegin(*element1); - IntersectionIterator isItEnd1 = problem_.gridView().iend(*element1); + IntersectionIterator isIt1 = problem_.gridView().ibegin(element1); + IntersectionIterator isItEnd1 = problem_.gridView().iend(element1); for (; isIt1 != isItEnd1; ++isIt1) { if (isIt1->neighbor()) { if (isIt1->indexInInside() == interactionVolume.getIndexOnElement(0, 2)) { - ElementPointer outside = isIt1->outside(); - if (element1->level() > outside->level()) + auto outside = isIt1->outside(); + if (element1.level() > outside.level()) { interactionVolume.setSubVolumeElement(outside, 4); } } } } - IntersectionIterator isIt2 = problem_.gridView().ibegin(*element2); - IntersectionIterator isItEnd2 = problem_.gridView().iend(*element2); + IntersectionIterator isIt2 = problem_.gridView().ibegin(element2); + IntersectionIterator isItEnd2 = problem_.gridView().iend(element2); for (; isIt2 != isItEnd2; ++isIt2) { if (isIt2->neighbor()) { if (isIt2->indexInInside() == interactionVolume.getIndexOnElement(1, 2)) { - ElementPointer outside = isIt2->outside(); - if (element2->level() > outside->level()) + auto outside = isIt2->outside(); + if (element2.level() > outside.level()) { interactionVolume.setSubVolumeElement(outside, 5); @@ -945,16 +944,16 @@ void FvMpfaL3dInteractionVolumeContainerAdaptive<TypeTag>::storeHangingNodeInter } } } - IntersectionIterator isIt3 = problem_.gridView().ibegin(*element3); - IntersectionIterator isItEnd3 = problem_.gridView().iend(*element3); + IntersectionIterator isIt3 = problem_.gridView().ibegin(element3); + IntersectionIterator isItEnd3 = problem_.gridView().iend(element3); for (; isIt3 != isItEnd3; ++isIt3) { if (isIt3->neighbor()) { if (isIt3->indexInInside() == interactionVolume.getIndexOnElement(2, 2)) { - ElementPointer outside = isIt3->outside(); - if (element3->level() > outside->level()) + auto outside = isIt3->outside(); + if (element3.level() > outside.level()) { interactionVolume.setSubVolumeElement(outside, 6); break; @@ -962,16 +961,16 @@ void FvMpfaL3dInteractionVolumeContainerAdaptive<TypeTag>::storeHangingNodeInter } } } - IntersectionIterator isIt4 = problem_.gridView().ibegin(*element4); - IntersectionIterator isItEnd4 = problem_.gridView().iend(*element4); + IntersectionIterator isIt4 = problem_.gridView().ibegin(element4); + IntersectionIterator isItEnd4 = problem_.gridView().iend(element4); for (; isIt4 != isItEnd4; ++isIt4) { if (isIt4->neighbor()) { if (isIt4->indexInInside() == interactionVolume.getIndexOnElement(3, 2)) { - ElementPointer outside = isIt4->outside(); - if (element4->level() > outside->level()) + auto outside = isIt4->outside(); + if (element4.level() > outside.level()) { interactionVolume.setSubVolumeElement(outside, 7); @@ -1038,23 +1037,23 @@ void FvMpfaL3dInteractionVolumeContainerAdaptive<TypeTag>::storeHangingNodeInter faceArea = crossProduct(crossProductVector1, crossProductVector2).two_norm()/2.0; interactionVolume.setFaceArea(faceArea, 11); - ElementPointer& element5 = interactionVolume.getSubVolumeElement(4); - ElementPointer& element6 = interactionVolume.getSubVolumeElement(5); - ElementPointer& element7 = interactionVolume.getSubVolumeElement(6); - ElementPointer& element8 = interactionVolume.getSubVolumeElement(7); + auto element5 = interactionVolume.getSubVolumeElement(4); + auto element6 = interactionVolume.getSubVolumeElement(5); + auto element7 = interactionVolume.getSubVolumeElement(6); + auto element8 = interactionVolume.getSubVolumeElement(7); if (element5 == element6) { - interactionVolume.setFacePosition(element5->geometry().center(), 4); - interactionVolume.setFacePosition(element7->geometry().center(), 6); + interactionVolume.setFacePosition(element5.geometry().center(), 4); + interactionVolume.setFacePosition(element7.geometry().center(), 6); - IntersectionIterator isIt = problem_.gridView().ibegin(*element5); - IntersectionIterator isEndIt = problem_.gridView().iend(*element5); + IntersectionIterator isIt = problem_.gridView().ibegin(element5); + IntersectionIterator isEndIt = problem_.gridView().iend(element5); for (; isIt != isEndIt; ++isIt) { if (isIt->neighbor()) { - ElementPointer outside = isIt->outside(); + auto outside = isIt->outside(); if (outside == element7 || outside == element8) { @@ -1096,17 +1095,17 @@ void FvMpfaL3dInteractionVolumeContainerAdaptive<TypeTag>::storeHangingNodeInter } else if (element5 == element7) { - interactionVolume.setFacePosition(element6->geometry().center(), 5); - interactionVolume.setFacePosition(element5->geometry().center(), 7); + interactionVolume.setFacePosition(element6.geometry().center(), 5); + interactionVolume.setFacePosition(element5.geometry().center(), 7); interactionVolume.setFacePosition(globalPosFace, 6); - IntersectionIterator isIt = problem_.gridView().ibegin(*element5); - IntersectionIterator isEndIt = problem_.gridView().iend(*element5); + IntersectionIterator isIt = problem_.gridView().ibegin(element5); + IntersectionIterator isEndIt = problem_.gridView().iend(element5); for (; isIt != isEndIt; ++isIt) { if (isIt->neighbor()) { - ElementPointer outside = isIt->outside(); + auto outside = isIt->outside(); if (outside == element6 || outside == element8) { @@ -1147,7 +1146,7 @@ void FvMpfaL3dInteractionVolumeContainerAdaptive<TypeTag>::storeHangingNodeInter // interactionVolume.setFaceArea(0.0, 6); } - const ElementGeometry& geometry = element5->geometry(); + const ElementGeometry& geometry = element5.geometry(); const ReferenceElement& referenceElement = ReferenceElements::general(geometry.type()); @@ -1369,20 +1368,20 @@ void FvMpfaL3dInteractionVolumeContainerAdaptive<TypeTag>::storeHangingNodeInter faceArea = crossProduct(crossProductVector1, crossProductVector2).two_norm()/2.0; interactionVolume.setFaceArea(faceArea, 11); - ElementPointer& element1 = interactionVolume.getSubVolumeElement(0); + auto element1 = interactionVolume.getSubVolumeElement(0); bool hasFaceOne = false; bool hasFaceTwo = false; - IntersectionIterator isIt = problem_.gridView().ibegin(*element1); - IntersectionIterator isEndIt = problem_.gridView().iend(*element1); + IntersectionIterator isIt = problem_.gridView().ibegin(element1); + IntersectionIterator isEndIt = problem_.gridView().iend(element1); for (; isIt != isEndIt; ++isIt) { if (isIt->indexInInside() == interactionVolume.getIndexOnElement(0, 1)) { if (isIt->neighbor()) { - ElementPointer outside = isIt->outside(); - if (element1->level() > outside->level()) + auto outside = isIt->outside(); + if (element1.level() > outside.level()) { interactionVolume.setSubVolumeElement(outside, 2); interactionVolume.setSubVolumeElement(outside, 3); @@ -1397,8 +1396,8 @@ void FvMpfaL3dInteractionVolumeContainerAdaptive<TypeTag>::storeHangingNodeInter { if (isIt->neighbor()) { - ElementPointer outside = isIt->outside(); - if (element1->level() > outside->level()) + auto outside = isIt->outside(); + if (element1.level() > outside.level()) { interactionVolume.setSubVolumeElement(outside, 4); interactionVolume.setSubVolumeElement(outside, 5); @@ -1510,18 +1509,18 @@ void FvMpfaL3dInteractionVolumeContainerAdaptive<TypeTag>::storeHangingNodeInter interactionVolume.setHangingNodeType(InteractionVolume::sixSmallCells); - ElementPointer& element3 = interactionVolume.getSubVolumeElement(2); + auto element3 = interactionVolume.getSubVolumeElement(2); - IntersectionIterator isIt = problem_.gridView().ibegin(*element3); - IntersectionIterator isEndIt = problem_.gridView().iend(*element3); + IntersectionIterator isIt = problem_.gridView().ibegin(element3); + IntersectionIterator isEndIt = problem_.gridView().iend(element3); for (; isIt != isEndIt; ++isIt) { if (isIt->indexInInside() == interactionVolume.getIndexOnElement(2, 2)) { if (isIt->neighbor()) { - ElementPointer outside = isIt->outside(); - if (element3->level() > outside->level()) + auto outside = isIt->outside(); + if (element3.level() > outside.level()) { interactionVolume.setSubVolumeElement(outside, 6); interactionVolume.setSubVolumeElement(outside, 7); @@ -1627,10 +1626,7 @@ void FvMpfaL3dInteractionVolumeContainerAdaptive<TypeTag>::storeInteractionVolum //Add elements to the interaction volumes and store element-vertex map ElementIterator eEndIt = problem_.gridView().template end<0>(); for (ElementIterator eIt = problem_.gridView().template begin<0>(); eIt != eEndIt; ++eIt) - { - ElementPointer ePtr = *eIt; - asImp_().storeSubVolumeElements(*ePtr, elemVertMap); - } + asImp_().storeSubVolumeElements(*eIt, elemVertMap); for (unsigned int i = 0; i < asImp_().interactionVolumes_.size(); i++) if (asImp_().interactionVolumes_[i].getElementNumber() == 0) @@ -1638,10 +1634,7 @@ void FvMpfaL3dInteractionVolumeContainerAdaptive<TypeTag>::storeInteractionVolum // Store information related to DUNE intersections for all interaction volumes for (ElementIterator eIt = problem_.gridView().template begin<0>(); eIt != eEndIt; ++eIt) - { - ElementPointer ePtr = *eIt; - asImp_().storeIntersectionInfo(*ePtr, elemVertMap); - } + asImp_().storeIntersectionInfo(*eIt, elemVertMap); faceVertices_.clear(); faceVertices_.resize(problem_.gridView().size(0)); @@ -1671,23 +1664,23 @@ void FvMpfaL3dInteractionVolumeContainerAdaptive<TypeTag>::storeInteractionVolum if (!interactionVolume.isBoundaryInteractionVolume()) { - ElementPointer& elementPointer1 = interactionVolume.getSubVolumeElement(0); - ElementPointer& elementPointer2 = interactionVolume.getSubVolumeElement(1); - ElementPointer& elementPointer3 = interactionVolume.getSubVolumeElement(2); - ElementPointer& elementPointer4 = interactionVolume.getSubVolumeElement(3); - ElementPointer& elementPointer5 = interactionVolume.getSubVolumeElement(4); - ElementPointer& elementPointer6 = interactionVolume.getSubVolumeElement(5); - ElementPointer& elementPointer7 = interactionVolume.getSubVolumeElement(6); - ElementPointer& elementPointer8 = interactionVolume.getSubVolumeElement(7); - - int globalIdx1 = problem_.variables().index(*elementPointer1); - int globalIdx2 = problem_.variables().index(*elementPointer2); - int globalIdx3 = problem_.variables().index(*elementPointer3); - int globalIdx4 = problem_.variables().index(*elementPointer4); - int globalIdx5 = problem_.variables().index(*elementPointer5); - int globalIdx6 = problem_.variables().index(*elementPointer6); - int globalIdx7 = problem_.variables().index(*elementPointer7); - int globalIdx8 = problem_.variables().index(*elementPointer8); + auto element1 = interactionVolume.getSubVolumeElement(0); + auto element2 = interactionVolume.getSubVolumeElement(1); + auto element3 = interactionVolume.getSubVolumeElement(2); + auto element4 = interactionVolume.getSubVolumeElement(3); + auto element5 = interactionVolume.getSubVolumeElement(4); + auto element6 = interactionVolume.getSubVolumeElement(5); + auto element7 = interactionVolume.getSubVolumeElement(6); + auto element8 = interactionVolume.getSubVolumeElement(7); + + int globalIdx1 = problem_.variables().index(element1); + int globalIdx2 = problem_.variables().index(element2); + int globalIdx3 = problem_.variables().index(element3); + int globalIdx4 = problem_.variables().index(element4); + int globalIdx5 = problem_.variables().index(element5); + int globalIdx6 = problem_.variables().index(element6); + int globalIdx7 = problem_.variables().index(element7); + int globalIdx8 = problem_.variables().index(element8); asImp_().addRealFluxFaceArea_(interactionVolume.getFaceArea(0, 0), globalIdx1, interactionVolume.getIndexOnElement(0, 0)); asImp_().addRealFluxFaceArea_(interactionVolume.getFaceArea(0, 1), globalIdx1, interactionVolume.getIndexOnElement(0, 1)); diff --git a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dpressure2p.hh b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dpressure2p.hh index 27d751ecbc0f444a39824272602d06d717206eb2..203e5b23a3b32708332053482da460fc2ff24599 100644 --- a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dpressure2p.hh +++ b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dpressure2p.hh @@ -142,7 +142,6 @@ class FvMpfaL3dPressure2p: public FVPressure<TypeTag> typedef typename GridView::template Codim<dim>::Iterator VertexIterator; typedef typename GridView::Grid Grid; typedef typename Element::Geometry Geometry; - typedef typename GridView::template Codim<0>::EntityPointer ElementPointer; typedef typename GridView::IntersectionIterator IntersectionIterator; typedef Dune::FieldVector<Scalar, dim> LocalPosition; @@ -581,8 +580,7 @@ void FvMpfaL3dPressure2p<TypeTag>::initializeMatrixRowSize() { if (interactionVolume.hasSubVolumeElement(subVolumeIdx)) { - const ElementPointer& neighbor = interactionVolume.getSubVolumeElement(subVolumeIdx); - int eIdxGlobalJ = problem_.variables().index(*neighbor); + int eIdxGlobalJ = problem_.variables().index(interactionVolume.getSubVolumeElement(subVolumeIdx)); neighborIndices.insert(eIdxGlobalJ); } @@ -625,8 +623,7 @@ void FvMpfaL3dPressure2p<TypeTag>::initializeMatrixIndices() { if (interactionVolume.hasSubVolumeElement(subVolumeIdx)) { - ElementPointer neighbor = interactionVolume.getSubVolumeElement(subVolumeIdx); - int eIdxGlobalJ = problem_.variables().index(*neighbor); + int eIdxGlobalJ = problem_.variables().index(interactionVolume.getSubVolumeElement(subVolumeIdx)); this->A_.addindex(eIdxGlobalI, eIdxGlobalJ); } @@ -673,44 +670,44 @@ void FvMpfaL3dPressure2p<TypeTag>::assemble() template<class TypeTag> void FvMpfaL3dPressure2p<TypeTag>::assembleInnerInteractionVolume(InteractionVolume& interactionVolume) { - ElementPointer& elementPointer1 = interactionVolume.getSubVolumeElement(0); - ElementPointer& elementPointer2 = interactionVolume.getSubVolumeElement(1); - ElementPointer& elementPointer3 = interactionVolume.getSubVolumeElement(2); - ElementPointer& elementPointer4 = interactionVolume.getSubVolumeElement(3); - ElementPointer& elementPointer5 = interactionVolume.getSubVolumeElement(4); - ElementPointer& elementPointer6 = interactionVolume.getSubVolumeElement(5); - ElementPointer& elementPointer7 = interactionVolume.getSubVolumeElement(6); - ElementPointer& elementPointer8 = interactionVolume.getSubVolumeElement(7); + auto element1 = interactionVolume.getSubVolumeElement(0); + auto element2 = interactionVolume.getSubVolumeElement(1); + auto element3 = interactionVolume.getSubVolumeElement(2); + auto element4 = interactionVolume.getSubVolumeElement(3); + auto element5 = interactionVolume.getSubVolumeElement(4); + auto element6 = interactionVolume.getSubVolumeElement(5); + auto element7 = interactionVolume.getSubVolumeElement(6); + auto element8 = interactionVolume.getSubVolumeElement(7); // get global coordinate of cell centers - const GlobalPosition& globalPos1 = elementPointer1->geometry().center(); - const GlobalPosition& globalPos2 = elementPointer2->geometry().center(); - const GlobalPosition& globalPos3 = elementPointer3->geometry().center(); - const GlobalPosition& globalPos4 = elementPointer4->geometry().center(); - const GlobalPosition& globalPos5 = elementPointer5->geometry().center(); - const GlobalPosition& globalPos6 = elementPointer6->geometry().center(); - const GlobalPosition& globalPos7 = elementPointer7->geometry().center(); - const GlobalPosition& globalPos8 = elementPointer8->geometry().center(); + const GlobalPosition& globalPos1 = element1.geometry().center(); + const GlobalPosition& globalPos2 = element2.geometry().center(); + const GlobalPosition& globalPos3 = element3.geometry().center(); + const GlobalPosition& globalPos4 = element4.geometry().center(); + const GlobalPosition& globalPos5 = element5.geometry().center(); + const GlobalPosition& globalPos6 = element6.geometry().center(); + const GlobalPosition& globalPos7 = element7.geometry().center(); + const GlobalPosition& globalPos8 = element8.geometry().center(); // cell volumes - Scalar volume1 = elementPointer1->geometry().volume(); - Scalar volume2 = elementPointer2->geometry().volume(); - Scalar volume3 = elementPointer3->geometry().volume(); - Scalar volume4 = elementPointer4->geometry().volume(); - Scalar volume5 = elementPointer5->geometry().volume(); - Scalar volume6 = elementPointer6->geometry().volume(); - Scalar volume7 = elementPointer7->geometry().volume(); - Scalar volume8 = elementPointer8->geometry().volume(); + Scalar volume1 = element1.geometry().volume(); + Scalar volume2 = element2.geometry().volume(); + Scalar volume3 = element3.geometry().volume(); + Scalar volume4 = element4.geometry().volume(); + Scalar volume5 = element5.geometry().volume(); + Scalar volume6 = element6.geometry().volume(); + Scalar volume7 = element7.geometry().volume(); + Scalar volume8 = element8.geometry().volume(); // cell index - int eIdxGlobal1 = problem_.variables().index(*elementPointer1); - int eIdxGlobal2 = problem_.variables().index(*elementPointer2); - int eIdxGlobal3 = problem_.variables().index(*elementPointer3); - int eIdxGlobal4 = problem_.variables().index(*elementPointer4); - int eIdxGlobal5 = problem_.variables().index(*elementPointer5); - int eIdxGlobal6 = problem_.variables().index(*elementPointer6); - int eIdxGlobal7 = problem_.variables().index(*elementPointer7); - int eIdxGlobal8 = problem_.variables().index(*elementPointer8); + int eIdxGlobal1 = problem_.variables().index(element1); + int eIdxGlobal2 = problem_.variables().index(element2); + int eIdxGlobal3 = problem_.variables().index(element3); + int eIdxGlobal4 = problem_.variables().index(element4); + int eIdxGlobal5 = problem_.variables().index(element5); + int eIdxGlobal6 = problem_.variables().index(element6); + int eIdxGlobal7 = problem_.variables().index(element7); + int eIdxGlobal8 = problem_.variables().index(element8); //get the cell Data CellData& cellData1 = problem_.variables().cellData(eIdxGlobal1); @@ -847,28 +844,28 @@ void FvMpfaL3dPressure2p<TypeTag>::assembleInnerInteractionVolume(InteractionVol // interactionVolume.printInteractionVolumeInfo(); // evaluate right hand side PrimaryVariables source(0.0); - problem_.source(source, *elementPointer1); + problem_.source(source, element1); this->f_[eIdxGlobal1] += volume1 / (8.0) * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]); - problem_.source(source, *elementPointer2); + problem_.source(source, element2); this->f_[eIdxGlobal2] += volume2 / (8.0) * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]); - problem_.source(source, *elementPointer3); + problem_.source(source, element3); this->f_[eIdxGlobal3] += volume3 / (8.0) * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]); - problem_.source(source, *elementPointer4); + problem_.source(source, element4); this->f_[eIdxGlobal4] += volume4 / (8.0) * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]); - problem_.source(source, *elementPointer5); + problem_.source(source, element5); this->f_[eIdxGlobal5] += volume5 / (8.0) * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]); - problem_.source(source, *elementPointer6); + problem_.source(source, element6); this->f_[eIdxGlobal6] += volume6 / (8.0) * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]); - problem_.source(source, *elementPointer7); + problem_.source(source, element7); this->f_[eIdxGlobal7] += volume7 / (8.0) * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]); - problem_.source(source, *elementPointer8); + problem_.source(source, element8); this->f_[eIdxGlobal8] += volume8 / (8.0) * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]); @@ -2292,26 +2289,26 @@ void FvMpfaL3dPressure2p<TypeTag>::assembleBoundaryInteractionVolume(Interaction continue; } - ElementPointer& elementPointer = interactionVolume.getSubVolumeElement(elemIdx); + auto element = interactionVolume.getSubVolumeElement(elemIdx); // get global coordinate of cell centers - const GlobalPosition& globalPos = elementPointer->geometry().center(); + const GlobalPosition& globalPos = element.geometry().center(); // cell volumes - Scalar volume = elementPointer->geometry().volume(); + Scalar volume = element.geometry().volume(); // cell index - int eIdxGlobal = problem_.variables().index(*elementPointer); + int eIdxGlobal = problem_.variables().index(element); //get the cell Data CellData& cellData = problem_.variables().cellData(eIdxGlobal); // permeability vector at boundary - DimMatrix permeability(problem_.spatialParams().intrinsicPermeability(*elementPointer)); + DimMatrix permeability(problem_.spatialParams().intrinsicPermeability(element)); // evaluate right hand side PrimaryVariables source(0); - problem_.source(source, *elementPointer); + problem_.source(source, element); this->f_[eIdxGlobal] += volume / (8.0) * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]); @@ -2367,7 +2364,7 @@ void FvMpfaL3dPressure2p<TypeTag>::assembleBoundaryInteractionVolume(Interaction } Scalar pcBound = MaterialLaw::pc( - problem_.spatialParams().materialLawParams(*elementPointer), satWBound); + problem_.spatialParams().materialLawParams(element), satWBound); Scalar gravityDiffBound = (problem_.bBoxMax() - globalPosFace) * gravity_ * (density_[nPhaseIdx] - density_[wPhaseIdx]); @@ -2375,9 +2372,9 @@ void FvMpfaL3dPressure2p<TypeTag>::assembleBoundaryInteractionVolume(Interaction pcBound += gravityDiffBound; Dune::FieldVector<Scalar, numPhases> - lambdaBound(MaterialLaw::krw(problem_.spatialParams().materialLawParams(*elementPointer),satWBound)); + lambdaBound(MaterialLaw::krw(problem_.spatialParams().materialLawParams(element),satWBound)); lambdaBound[nPhaseIdx] = MaterialLaw::krn( - problem_.spatialParams().materialLawParams(*elementPointer), satWBound); + problem_.spatialParams().materialLawParams(element), satWBound); lambdaBound[wPhaseIdx] /= viscosity_[wPhaseIdx]; lambdaBound[nPhaseIdx] /= viscosity_[nPhaseIdx]; diff --git a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dpressure2padaptive.hh b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dpressure2padaptive.hh index 640073acacf62f06109954301f8c553f656080be..d47164462da943d22b8c5a9a413145ae79326b0a 100644 --- a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dpressure2padaptive.hh +++ b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dpressure2padaptive.hh @@ -145,7 +145,6 @@ class FvMpfaL3dPressure2pAdaptive: public FvMpfaL3dPressure2p<TypeTag> typedef typename GridView::template Codim<dim>::Iterator VertexIterator; typedef typename GridView::Grid Grid; typedef typename Element::Geometry Geometry; - typedef typename GridView::template Codim<0>::EntityPointer ElementPointer; typedef Dune::FieldVector<Scalar, dim> LocalPosition; typedef Dune::FieldVector<Scalar, dimWorld> GlobalPosition; @@ -308,18 +307,18 @@ void FvMpfaL3dPressure2pAdaptive<TypeTag>::initializeMatrixRowSize() { if (interactionVolume.hasSubVolumeElement(subVolumeIdx)) { - const ElementPointer& neighbor = interactionVolume.getSubVolumeElement(subVolumeIdx); - int globalIdxJ = problem_.variables().index(*neighbor); + auto neighbor = interactionVolume.getSubVolumeElement(subVolumeIdx); + int globalIdxJ = problem_.variables().index(neighbor); neighborIndices.insert(globalIdxJ); if (!interactionVolume.sameLevel()) { - if (neighbor->level() == levelI + 2) + if (neighbor.level() == levelI + 2) { for (int vIdx = 0; vIdx < numVertices; vIdx++) { - int globalVertIdxJ = problem_.variables().vertexMapper().map(*neighbor, vIdx, dim); + int globalVertIdxJ = problem_.variables().vertexMapper().map(neighbor, vIdx, dim); if (globalVertIdxJ != vIdxGlobal) { @@ -336,9 +335,7 @@ void FvMpfaL3dPressure2pAdaptive<TypeTag>::initializeMatrixRowSize() { if (interactionVolumeJ.hasSubVolumeElement(subVolumeIdxJ)) { - const ElementPointer& neighborJ = - interactionVolumeJ.getSubVolumeElement(subVolumeIdxJ); - int globalIdxJJ = problem_.variables().index(*neighborJ); + int globalIdxJJ = problem_.variables().index(interactionVolumeJ.getSubVolumeElement(subVolumeIdxJ)); neighborIndicesJ.insert(globalIdxJJ); @@ -396,15 +393,15 @@ void FvMpfaL3dPressure2pAdaptive<TypeTag>::initializeMatrixIndices() { if (interactionVolume.hasSubVolumeElement(subVolumeIdx)) { - ElementPointer neighbor = interactionVolume.getSubVolumeElement(subVolumeIdx); - int globalIdxJ = problem_.variables().index(*neighbor); + auto neighbor = interactionVolume.getSubVolumeElement(subVolumeIdx); + int globalIdxJ = problem_.variables().index(neighbor); this->A_.addindex(globalIdxI, globalIdxJ); if (interactionVolume.isHangingNodeVolume() && interactionVolume.getHangingNodeType() == InteractionVolume::sixSmallCells && !interactionVolume.sameLevel()) { - if (neighbor->level() == levelI-2) + if (neighbor.level() == levelI-2) { this->A_.addindex(globalIdxJ, globalIdxI); } @@ -466,44 +463,44 @@ void FvMpfaL3dPressure2pAdaptive<TypeTag>::assemble() template<class TypeTag> void FvMpfaL3dPressure2pAdaptive<TypeTag>::assembleHangingNodeInteractionVolume(InteractionVolume& interactionVolume) { - ElementPointer& elementPointer1 = interactionVolume.getSubVolumeElement(0); - ElementPointer& elementPointer2 = interactionVolume.getSubVolumeElement(1); - ElementPointer& elementPointer3 = interactionVolume.getSubVolumeElement(2); - ElementPointer& elementPointer4 = interactionVolume.getSubVolumeElement(3); - ElementPointer& elementPointer5 = interactionVolume.getSubVolumeElement(4); - ElementPointer& elementPointer6 = interactionVolume.getSubVolumeElement(5); - ElementPointer& elementPointer7 = interactionVolume.getSubVolumeElement(6); - ElementPointer& elementPointer8 = interactionVolume.getSubVolumeElement(7); + auto element1 = interactionVolume.getSubVolumeElement(0); + auto element2 = interactionVolume.getSubVolumeElement(1); + auto element3 = interactionVolume.getSubVolumeElement(2); + auto element4 = interactionVolume.getSubVolumeElement(3); + auto element5 = interactionVolume.getSubVolumeElement(4); + auto element6 = interactionVolume.getSubVolumeElement(5); + auto element7 = interactionVolume.getSubVolumeElement(6); + auto element8 = interactionVolume.getSubVolumeElement(7); // get global coordinate of cell centers - const GlobalPosition& globalPos1 = elementPointer1->geometry().center(); - const GlobalPosition& globalPos2 = elementPointer2->geometry().center(); - const GlobalPosition& globalPos3 = elementPointer3->geometry().center(); - const GlobalPosition& globalPos4 = elementPointer4->geometry().center(); - const GlobalPosition& globalPos5 = elementPointer5->geometry().center(); - const GlobalPosition& globalPos6 = elementPointer6->geometry().center(); - const GlobalPosition& globalPos7 = elementPointer7->geometry().center(); - const GlobalPosition& globalPos8 = elementPointer8->geometry().center(); + const GlobalPosition& globalPos1 = element1.geometry().center(); + const GlobalPosition& globalPos2 = element2.geometry().center(); + const GlobalPosition& globalPos3 = element3.geometry().center(); + const GlobalPosition& globalPos4 = element4.geometry().center(); + const GlobalPosition& globalPos5 = element5.geometry().center(); + const GlobalPosition& globalPos6 = element6.geometry().center(); + const GlobalPosition& globalPos7 = element7.geometry().center(); + const GlobalPosition& globalPos8 = element8.geometry().center(); // cell volumes - Scalar volume1 = elementPointer1->geometry().volume(); - Scalar volume2 = elementPointer2->geometry().volume(); - Scalar volume3 = elementPointer3->geometry().volume(); - Scalar volume4 = elementPointer4->geometry().volume(); - Scalar volume5 = elementPointer5->geometry().volume(); - Scalar volume6 = elementPointer6->geometry().volume(); - Scalar volume7 DUNE_UNUSED = elementPointer7->geometry().volume(); - Scalar volume8 DUNE_UNUSED = elementPointer8->geometry().volume(); + Scalar volume1 = element1.geometry().volume(); + Scalar volume2 = element2.geometry().volume(); + Scalar volume3 = element3.geometry().volume(); + Scalar volume4 = element4.geometry().volume(); + Scalar volume5 = element5.geometry().volume(); + Scalar volume6 = element6.geometry().volume(); + Scalar volume7 DUNE_UNUSED = element7.geometry().volume(); + Scalar volume8 DUNE_UNUSED = element8.geometry().volume(); // cell index - int globalIdx1 = problem_.variables().index(*elementPointer1); - int globalIdx2 = problem_.variables().index(*elementPointer2); - int globalIdx3 = problem_.variables().index(*elementPointer3); - int globalIdx4 = problem_.variables().index(*elementPointer4); - int globalIdx5 = problem_.variables().index(*elementPointer5); - int globalIdx6 = problem_.variables().index(*elementPointer6); - int globalIdx7 = problem_.variables().index(*elementPointer7); - int globalIdx8 = problem_.variables().index(*elementPointer8); + int globalIdx1 = problem_.variables().index(element1); + int globalIdx2 = problem_.variables().index(element2); + int globalIdx3 = problem_.variables().index(element3); + int globalIdx4 = problem_.variables().index(element4); + int globalIdx5 = problem_.variables().index(element5); + int globalIdx6 = problem_.variables().index(element6); + int globalIdx7 = problem_.variables().index(element7); + int globalIdx8 = problem_.variables().index(element8); //get the cell Data CellData& cellData1 = problem_.variables().cellData(globalIdx1); @@ -645,10 +642,10 @@ void FvMpfaL3dPressure2pAdaptive<TypeTag>::assembleHangingNodeInteractionVolume( { // evaluate right hand side PrimaryVariables source(0.0); - problem_.source(source, *elementPointer1); + problem_.source(source, element1); this->f_[globalIdx1] += volume1 / (8.0) * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]); - problem_.source(source, *elementPointer2); + problem_.source(source, element2); this->f_[globalIdx2] += volume2 / (8.0) * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]); @@ -660,16 +657,16 @@ void FvMpfaL3dPressure2pAdaptive<TypeTag>::assembleHangingNodeInteractionVolume( { // evaluate right hand side PrimaryVariables source(0.0); - problem_.source(source, *elementPointer1); + problem_.source(source, element1); this->f_[globalIdx1] += volume1 / (8.0) * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]); - problem_.source(source, *elementPointer2); + problem_.source(source, element2); this->f_[globalIdx2] += volume2 / (8.0) * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]); - problem_.source(source, *elementPointer3); + problem_.source(source, element3); this->f_[globalIdx3] += volume3 / (8.0) * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]); - problem_.source(source, *elementPointer4); + problem_.source(source, element4); this->f_[globalIdx4] += volume4 / (8.0) * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]); @@ -682,22 +679,22 @@ void FvMpfaL3dPressure2pAdaptive<TypeTag>::assembleHangingNodeInteractionVolume( { // evaluate right hand side PrimaryVariables source(0.0); - problem_.source(source, *elementPointer1); + problem_.source(source, element1); this->f_[globalIdx1] += volume1 / (8.0) * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]); - problem_.source(source, *elementPointer2); + problem_.source(source, element2); this->f_[globalIdx2] += volume2 / (8.0) * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]); - problem_.source(source, *elementPointer3); + problem_.source(source, element3); this->f_[globalIdx3] += volume3 / (8.0) * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]); - problem_.source(source, *elementPointer4); + problem_.source(source, element4); this->f_[globalIdx4] += volume4 / (8.0) * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]); - problem_.source(source, *elementPointer4); + problem_.source(source, element4); this->f_[globalIdx5] += volume5 / (8.0) * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]); - problem_.source(source, *elementPointer6); + problem_.source(source, element6); this->f_[globalIdx6] += volume6 / (8.0) * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]); diff --git a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dpressurevelocity2p.hh b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dpressurevelocity2p.hh index e5d455a620850b84a8ed80d72e6d3a5cdf5d730b..810b80df76011694f1c95360194cba407b7a5a75 100644 --- a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dpressurevelocity2p.hh +++ b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dpressurevelocity2p.hh @@ -86,7 +86,6 @@ template<class TypeTag> class FvMpfaL3dPressureVelocity2p: public FvMpfaL3dPress typedef typename GridView::template Codim<dim>::Iterator VertexIterator; typedef typename GET_PROP_TYPE(TypeTag, MPFAInteractionVolume) InteractionVolume; typedef typename GridView::IntersectionIterator IntersectionIterator; - typedef typename GridView::template Codim<0>::EntityPointer ElementPointer; typedef typename GridView::Intersection Intersection; typedef Dune::FieldVector<Scalar, dimWorld> GlobalPosition; @@ -230,7 +229,7 @@ void FvMpfaL3dPressureVelocity2p<TypeTag>::calculateVelocity() int eIdxGlobal[8]; for (int i = 0; i < 8; i++) { - eIdxGlobal[i] = problem_.variables().index(*(interactionVolume.getSubVolumeElement(i))); + eIdxGlobal[i] = problem_.variables().index(interactionVolume.getSubVolumeElement(i)); } //get the cell Data @@ -271,11 +270,8 @@ void FvMpfaL3dPressureVelocity2p<TypeTag>::calculateVelocity() { continue; } - - ElementPointer & elementPointer = interactionVolume.getSubVolumeElement(elemIdx); - // cell index - int eIdxGlobal = problem_.variables().index(*elementPointer); + int eIdxGlobal = problem_.variables().index(interactionVolume.getSubVolumeElement(elemIdx)); //get the cell Data CellData& cellData = problem_.variables().cellData(eIdxGlobal); @@ -300,15 +296,15 @@ void FvMpfaL3dPressureVelocity2p<TypeTag>::calculateVelocity(const Intersection& { int numVertices = intersection.geometry().corners(); - ElementPointer elementPtrI = intersection.inside(); - ElementPointer elementPtrJ = intersection.outside(); + auto elementI = intersection.inside(); + auto elementJ = intersection.outside(); - int eIdxGlobalI DUNE_UNUSED = problem_.variables().index(*elementPtrI); - int eIdxGlobalJ = problem_.variables().index(*elementPtrJ); + int eIdxGlobalI DUNE_UNUSED = problem_.variables().index(elementI); + int eIdxGlobalJ = problem_.variables().index(elementJ); CellData& cellDataJ = problem_.variables().cellData(eIdxGlobalJ); - const ReferenceElement& referenceElement = ReferenceElements::general(elementPtrI->geometry().type()); + const ReferenceElement& referenceElement = ReferenceElements::general(elementI.geometry().type()); int indexInInside = intersection.indexInInside(); int indexInOutside = intersection.indexInOutside(); @@ -319,8 +315,7 @@ void FvMpfaL3dPressureVelocity2p<TypeTag>::calculateVelocity(const Intersection& { int localVertIdx = referenceElement.subEntity(indexInInside, 1, vIdx, dim); - int vIdxGlobal = problem_.variables().index( - *((*elementPtrI).template subEntity < dim > (localVertIdx))); + int vIdxGlobal = problem_.variables().index(elementI.template subEntity<dim>(localVertIdx)); InteractionVolume& interactionVolume = this->interactionVolumes_.interactionVolume(vIdxGlobal); @@ -333,14 +328,14 @@ void FvMpfaL3dPressureVelocity2p<TypeTag>::calculateVelocity(const Intersection& int eIdxGlobal[8]; for (int i = 0; i < 8; i++) { - ElementPointer elem = *(interactionVolume.getSubVolumeElement(i)); + auto elem = interactionVolume.getSubVolumeElement(i); - if (elem == elementPtrI) + if (elem == elementI) localMpfaElemIdxI = i; - else if (elem == elementPtrJ) + else if (elem == elementJ) localMpfaElemIdxJ = i; - eIdxGlobal[i] = problem_.variables().index(*elem); + eIdxGlobal[i] = problem_.variables().index(elem); cellDataTemp[i] = problem_.variables().cellData(eIdxGlobal[i]); } @@ -387,7 +382,7 @@ void FvMpfaL3dPressureVelocity2p<TypeTag>::calculateVelocity(const Intersection& template<class TypeTag> void FvMpfaL3dPressureVelocity2p<TypeTag>::calculateVelocityOnBoundary(const Intersection& intersection, CellData& cellData) { - ElementPointer element = intersection.inside(); + auto element = intersection.inside(); //get face index int isIndex = intersection.indexInInside(); @@ -405,7 +400,7 @@ void FvMpfaL3dPressureVelocity2p<TypeTag>::calculateVelocityOnBoundary(const Int problem_.dirichlet(boundValues, intersection); // get global coordinates of cell centers - const GlobalPosition& globalPosI = element->geometry().center(); + const GlobalPosition& globalPosI = element.geometry().center(); // center of face in global coordinates const GlobalPosition& globalPosJ = intersection.geometry().center(); @@ -427,7 +422,7 @@ void FvMpfaL3dPressureVelocity2p<TypeTag>::calculateVelocityOnBoundary(const Int // compute vectorized permeabilities DimMatrix meanPermeability(0); - problem_.spatialParams().meanK(meanPermeability, problem_.spatialParams().intrinsicPermeability(*element)); + problem_.spatialParams().meanK(meanPermeability, problem_.spatialParams().intrinsicPermeability(element)); Dune::FieldVector<Scalar, dim> permeability(0); meanPermeability.mv(unitOuterNormal, permeability); @@ -460,7 +455,7 @@ void FvMpfaL3dPressureVelocity2p<TypeTag>::calculateVelocityOnBoundary(const Int } Scalar pressBound = boundValues[pressureIdx]; - Scalar pcBound = MaterialLaw::pc(problem_.spatialParams().materialLawParams(*element), satW); + Scalar pcBound = MaterialLaw::pc(problem_.spatialParams().materialLawParams(element), satW); //determine phase pressures from primary pressure variable Scalar pressWBound = 0; @@ -476,9 +471,9 @@ void FvMpfaL3dPressureVelocity2p<TypeTag>::calculateVelocityOnBoundary(const Int pressNwBound = pressBound; } - Scalar lambdaWBound = MaterialLaw::krw(problem_.spatialParams().materialLawParams(*element), satW) + Scalar lambdaWBound = MaterialLaw::krw(problem_.spatialParams().materialLawParams(element), satW) / viscosity_[wPhaseIdx]; - Scalar lambdaNwBound = MaterialLaw::krn(problem_.spatialParams().materialLawParams(*element), satW) + Scalar lambdaNwBound = MaterialLaw::krn(problem_.spatialParams().materialLawParams(element), satW) / viscosity_[nPhaseIdx]; Scalar potentialDiffW = cellData.fluxData().upwindPotential(wPhaseIdx, isIndex); diff --git a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dpressurevelocity2padaptive.hh b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dpressurevelocity2padaptive.hh index d51618404ffe96e9fc8066cac6aebf5e6266a3f2..9a93f1444260548fb9639eb518a9ca32990291fb 100644 --- a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dpressurevelocity2padaptive.hh +++ b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dpressurevelocity2padaptive.hh @@ -87,7 +87,6 @@ template<class TypeTag> class FvMpfaL3dPressureVelocity2pAdaptive: public FvMpfa typedef typename GridView::template Codim<dim>::Iterator VertexIterator; typedef typename GET_PROP_TYPE(TypeTag, MPFAInteractionVolume) InteractionVolume; typedef typename GridView::IntersectionIterator IntersectionIterator; - typedef typename GridView::template Codim<0>::EntityPointer ElementPointer; typedef typename GridView::Intersection Intersection; typedef Dune::FieldVector<Scalar, dimWorld> GlobalPosition; @@ -231,7 +230,7 @@ void FvMpfaL3dPressureVelocity2pAdaptive<TypeTag>::calculateVelocity() int eIdxGlobal[8]; for (int i = 0; i < 8; i++) { - eIdxGlobal[i] = problem_.variables().index(*(interactionVolume.getSubVolumeElement(i))); + eIdxGlobal[i] = problem_.variables().index(interactionVolume.getSubVolumeElement(i)); } //get the cell Data @@ -282,10 +281,8 @@ void FvMpfaL3dPressureVelocity2pAdaptive<TypeTag>::calculateVelocity() continue; } - ElementPointer & elementPointer = interactionVolume.getSubVolumeElement(elemIdx); - // cell index - int eIdxGlobal = problem_.variables().index(*elementPointer); + int eIdxGlobal = problem_.variables().index(interactionVolume.getSubVolumeElement(elemIdx)); //get the cell Data CellData& cellData = problem_.variables().cellData(eIdxGlobal); @@ -308,14 +305,14 @@ void FvMpfaL3dPressureVelocity2pAdaptive<TypeTag>::calculateVelocity() template<class TypeTag> void FvMpfaL3dPressureVelocity2pAdaptive<TypeTag>::calculateVelocity(const Intersection& intersection, CellData& cellData) { - ElementPointer elementPtrI = intersection.inside(); - ElementPointer elementPtrJ = intersection.outside(); + auto elementI = intersection.inside(); + auto elementJ = intersection.outside(); - int levelI = elementPtrI->level(); - int levelJ = elementPtrJ->level(); + int levelI = elementI.level(); + int levelJ = elementJ.level(); - int eIdxGlobalI = problem_.variables().index(*elementPtrI); - int eIdxGlobalJ = problem_.variables().index(*elementPtrJ); + int eIdxGlobalI = problem_.variables().index(elementI); + int eIdxGlobalJ = problem_.variables().index(elementJ); CellData& cellDataJ = problem_.variables().cellData(eIdxGlobalJ); @@ -363,19 +360,17 @@ void FvMpfaL3dPressureVelocity2pAdaptive<TypeTag>::calculateVelocity(const Inter int eIdxGlobal[8]; for (int i = 0; i < 8; i++) { - ElementPointer elem = *(interactionVolume.getSubVolumeElement(i)); + auto elem = interactionVolume.getSubVolumeElement(i); if (interactionVolume.isHangingNodeVolume()) { - if (elem == elementPtrI) + if (elem == elementI) { for (int j = 0; j < 3; j++) { for (int k = 0; k < 8; k++) { - ElementPointer elemJ = *(interactionVolume.getSubVolumeElement(k)); - - if (elemJ == elementPtrJ && + if (interactionVolume.getSubVolumeElement(k) == elementJ && IndexTranslator::getFaceIndexFromSubVolume(i,j) == IndexTranslator::getFaceIndexFromElements(i,k)) { @@ -391,13 +386,13 @@ void FvMpfaL3dPressureVelocity2pAdaptive<TypeTag>::calculateVelocity(const Inter if (localMpfaElemIdx.size() != 1) localMpfaElemIdx.resize(1); - if (elem == elementPtrI) + if (elem == elementI) localMpfaElemIdx[0].first = i; - else if (elem == elementPtrJ) + else if (elem == elementJ) localMpfaElemIdx[0].second = i; } - eIdxGlobal[i] = problem_.variables().index(*elem); + eIdxGlobal[i] = problem_.variables().index(elem); cellDataTemp[i] = problem_.variables().cellData(eIdxGlobal[i]); } @@ -489,7 +484,7 @@ void FvMpfaL3dPressureVelocity2pAdaptive<TypeTag>::calculateVelocity(const Inter template<class TypeTag> void FvMpfaL3dPressureVelocity2pAdaptive<TypeTag>::calculateVelocityOnBoundary(const Intersection& intersection, CellData& cellData) { - ElementPointer element = intersection.inside(); + auto element = intersection.inside(); //get face index int isIndex = intersection.indexInInside(); @@ -507,7 +502,7 @@ void FvMpfaL3dPressureVelocity2pAdaptive<TypeTag>::calculateVelocityOnBoundary(c problem_.dirichlet(boundValues, intersection); // get global coordinates of cell centers - const GlobalPosition& globalPosI = element->geometry().center(); + const GlobalPosition& globalPosI = element.geometry().center(); // center of face in global coordinates const GlobalPosition& globalPosJ = intersection.geometry().center(); @@ -529,7 +524,7 @@ void FvMpfaL3dPressureVelocity2pAdaptive<TypeTag>::calculateVelocityOnBoundary(c // compute vectorized permeabilities DimMatrix meanPermeability(0); - problem_.spatialParams().meanK(meanPermeability, problem_.spatialParams().intrinsicPermeability(*element)); + problem_.spatialParams().meanK(meanPermeability, problem_.spatialParams().intrinsicPermeability(element)); Dune::FieldVector<Scalar, dim> permeability(0); meanPermeability.mv(unitOuterNormal, permeability); @@ -562,7 +557,7 @@ void FvMpfaL3dPressureVelocity2pAdaptive<TypeTag>::calculateVelocityOnBoundary(c } Scalar pressBound = boundValues[pressureIdx]; - Scalar pcBound = MaterialLaw::pc(problem_.spatialParams().materialLawParams(*element), satW); + Scalar pcBound = MaterialLaw::pc(problem_.spatialParams().materialLawParams(element), satW); //determine phase pressures from primary pressure variable Scalar pressWBound = 0; @@ -578,9 +573,9 @@ void FvMpfaL3dPressureVelocity2pAdaptive<TypeTag>::calculateVelocityOnBoundary(c pressNwBound = pressBound; } - Scalar lambdaWBound = MaterialLaw::krw(problem_.spatialParams().materialLawParams(*element), satW) + Scalar lambdaWBound = MaterialLaw::krw(problem_.spatialParams().materialLawParams(element), satW) / viscosity_[wPhaseIdx]; - Scalar lambdaNwBound = MaterialLaw::krn(problem_.spatialParams().materialLawParams(*element), satW) + Scalar lambdaNwBound = MaterialLaw::krn(problem_.spatialParams().materialLawParams(element), satW) / viscosity_[nPhaseIdx]; Scalar potentialDiffW = cellData.fluxData().upwindPotential(wPhaseIdx, isIndex); diff --git a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dtransmissibilitycalculator.hh b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dtransmissibilitycalculator.hh index bb8e0ad8fc12572f69e1cc1b1f646d78b1efce0c..24e4be28aa78af32da1c36ae9f37dca3aaa88ce7 100644 --- a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dtransmissibilitycalculator.hh +++ b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dtransmissibilitycalculator.hh @@ -67,8 +67,6 @@ class FvMpfaL3dTransmissibilityCalculator typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef typename GET_PROP_TYPE(TypeTag, Problem) Problem; - typedef typename GridView::template Codim<0>::EntityPointer ElementPointer; - typedef Dune::FieldVector<Scalar, dimWorld> GlobalPosition; typedef Dune::FieldMatrix<Scalar, dim, dim> DimMatrix; @@ -271,8 +269,8 @@ int FvMpfaL3dTransmissibilityCalculator<TypeTag>::transmissibility(Transmissibil int idx1, int idx2, int idx3, int idx4, int idx5, int idx6) { - int level1 = interactionVolume.getSubVolumeElement(idx1)->level(); - int level2 = interactionVolume.getSubVolumeElement(idx2)->level(); + int level1 = interactionVolume.getSubVolumeElement(idx1).level(); + int level2 = interactionVolume.getSubVolumeElement(idx2).level(); if (enableTPFA_ && level1 == level2) { @@ -372,8 +370,8 @@ int FvMpfaL3dTransmissibilityCalculator<TypeTag>::transmissibility(Transmissibil int idx2, int idx3, int idx4, int idx5, int idx6, Dune::FieldVector<bool, 4> &useCases) { - int level1 = interactionVolume.getSubVolumeElement(idx1)->level(); - int level2 = interactionVolume.getSubVolumeElement(idx2)->level(); + int level1 = interactionVolume.getSubVolumeElement(idx1).level(); + int level2 = interactionVolume.getSubVolumeElement(idx2).level(); if (enableTPFA_ && level1 == level2) { @@ -540,12 +538,12 @@ int FvMpfaL3dTransmissibilityCalculator<TypeTag>::transmissibilityTPFA( InteractionVolume& interactionVolume, std::vector<DimVector >& lambda, int idx1, int idx2) { - ElementPointer& elementPointer1 = interactionVolume.getSubVolumeElement(idx1); - ElementPointer& elementPointer2 = interactionVolume.getSubVolumeElement(idx2); + auto element1 = interactionVolume.getSubVolumeElement(idx1); + auto element2 = interactionVolume.getSubVolumeElement(idx2); // get global coordinate of cell centers - const GlobalPosition& globalPos1 = elementPointer1->geometry().center(); - const GlobalPosition& globalPos2 = elementPointer2->geometry().center(); + const GlobalPosition& globalPos1 = element1.geometry().center(); + const GlobalPosition& globalPos2 = element2.geometry().center(); GlobalPosition distVec = globalPos1 - globalPos2; @@ -594,8 +592,8 @@ int FvMpfaL3dTransmissibilityCalculator<TypeTag>::transmissibilityTPFA( faceArea = interactionVolume.getFaceArea(idx1,2); } - const DimMatrix& K1 = problem_.spatialParams().intrinsicPermeability(*elementPointer1); - const DimMatrix& K2 = problem_.spatialParams().intrinsicPermeability(*elementPointer2); + const DimMatrix& K1 = problem_.spatialParams().intrinsicPermeability(element1); + const DimMatrix& K2 = problem_.spatialParams().intrinsicPermeability(element2); // compute vectorized permeabilities DimVector permeability(0); @@ -648,23 +646,23 @@ int FvMpfaL3dTransmissibilityCalculator<TypeTag>::transmissibilityCaseOne( InteractionVolume& interactionVolume, std::vector<DimVector >& lambda, int idx1, int idx2, int idx3, int idx5) { - ElementPointer& elementPointer1 = interactionVolume.getSubVolumeElement(idx1); - ElementPointer& elementPointer2 = interactionVolume.getSubVolumeElement(idx2); - ElementPointer& elementPointer3 = interactionVolume.getSubVolumeElement(idx3); - ElementPointer& elementPointer5 = interactionVolume.getSubVolumeElement(idx5); + auto element1 = interactionVolume.getSubVolumeElement(idx1); + auto element2 = interactionVolume.getSubVolumeElement(idx2); + auto element3 = interactionVolume.getSubVolumeElement(idx3); + auto element5 = interactionVolume.getSubVolumeElement(idx5); // get global coordinate of cell centers - const GlobalPosition& globalPos1 = elementPointer1->geometry().center(); - const GlobalPosition& globalPos2 = elementPointer2->geometry().center(); - const GlobalPosition& globalPos3 = elementPointer3->geometry().center(); - const GlobalPosition& globalPos5 = elementPointer5->geometry().center(); + const GlobalPosition& globalPos1 = element1.geometry().center(); + const GlobalPosition& globalPos2 = element2.geometry().center(); + const GlobalPosition& globalPos3 = element3.geometry().center(); + const GlobalPosition& globalPos5 = element5.geometry().center(); const GlobalPosition& globalPosCenter = interactionVolume.getCenterPosition(); - const DimMatrix& K1 = problem_.spatialParams().intrinsicPermeability(*elementPointer1); - const DimMatrix& K2 = problem_.spatialParams().intrinsicPermeability(*elementPointer2); - const DimMatrix& K3 = problem_.spatialParams().intrinsicPermeability(*elementPointer3); - const DimMatrix& K5 = problem_.spatialParams().intrinsicPermeability(*elementPointer5); + const DimMatrix& K1 = problem_.spatialParams().intrinsicPermeability(element1); + const DimMatrix& K2 = problem_.spatialParams().intrinsicPermeability(element2); + const DimMatrix& K3 = problem_.spatialParams().intrinsicPermeability(element3); + const DimMatrix& K5 = problem_.spatialParams().intrinsicPermeability(element5); // 1.use centered L-stencil 1 to compute the transmissibility of 1/4 face GlobalPosition edgeCoord1213(0); @@ -1032,23 +1030,23 @@ int FvMpfaL3dTransmissibilityCalculator<TypeTag>::transmissibilityCaseTwo( InteractionVolume& interactionVolume, std::vector<DimVector >& lambda, int idx1, int idx2, int idx4, int idx6) { - ElementPointer& elementPointer1 = interactionVolume.getSubVolumeElement(idx1); - ElementPointer& elementPointer2 = interactionVolume.getSubVolumeElement(idx2); - ElementPointer& elementPointer4 = interactionVolume.getSubVolumeElement(idx4); - ElementPointer& elementPointer6 = interactionVolume.getSubVolumeElement(idx6); + auto element1 = interactionVolume.getSubVolumeElement(idx1); + auto element2 = interactionVolume.getSubVolumeElement(idx2); + auto element4 = interactionVolume.getSubVolumeElement(idx4); + auto element6 = interactionVolume.getSubVolumeElement(idx6); // get global coordinate of cell centers - const GlobalPosition& globalPos1 = elementPointer1->geometry().center(); - const GlobalPosition& globalPos2 = elementPointer2->geometry().center(); - const GlobalPosition& globalPos4 = elementPointer4->geometry().center(); - const GlobalPosition& globalPos6 = elementPointer6->geometry().center(); + const GlobalPosition& globalPos1 = element1.geometry().center(); + const GlobalPosition& globalPos2 = element2.geometry().center(); + const GlobalPosition& globalPos4 = element4.geometry().center(); + const GlobalPosition& globalPos6 = element6.geometry().center(); const GlobalPosition& globalPosCenter = interactionVolume.getCenterPosition(); - const DimMatrix& K1 = problem_.spatialParams().intrinsicPermeability(*elementPointer1); - const DimMatrix& K2 = problem_.spatialParams().intrinsicPermeability(*elementPointer2); - const DimMatrix& K4 = problem_.spatialParams().intrinsicPermeability(*elementPointer4); - const DimMatrix& K6 = problem_.spatialParams().intrinsicPermeability(*elementPointer6); + const DimMatrix& K1 = problem_.spatialParams().intrinsicPermeability(element1); + const DimMatrix& K2 = problem_.spatialParams().intrinsicPermeability(element2); + const DimMatrix& K4 = problem_.spatialParams().intrinsicPermeability(element4); + const DimMatrix& K6 = problem_.spatialParams().intrinsicPermeability(element6); // 1.use centered L-stencil 1 to compute the transmissibility of 1/4 face GlobalPosition globalPosFace12(0); @@ -1429,23 +1427,23 @@ int FvMpfaL3dTransmissibilityCalculator<TypeTag>::transmissibilityCaseThree( InteractionVolume& interactionVolume, std::vector<DimVector >& lambda,int idx1, int idx2, int idx4, int idx5) { - ElementPointer& elementPointer1 = interactionVolume.getSubVolumeElement(idx1); - ElementPointer& elementPointer2 = interactionVolume.getSubVolumeElement(idx2); - ElementPointer& elementPointer4 = interactionVolume.getSubVolumeElement(idx4); - ElementPointer& elementPointer5 = interactionVolume.getSubVolumeElement(idx5); + auto element1 = interactionVolume.getSubVolumeElement(idx1); + auto element2 = interactionVolume.getSubVolumeElement(idx2); + auto element4 = interactionVolume.getSubVolumeElement(idx4); + auto element5 = interactionVolume.getSubVolumeElement(idx5); // get global coordinate of cell centers - const GlobalPosition& globalPos1 = elementPointer1->geometry().center(); - const GlobalPosition& globalPos2 = elementPointer2->geometry().center(); - const GlobalPosition& globalPos4 = elementPointer4->geometry().center(); - const GlobalPosition& globalPos5 = elementPointer5->geometry().center(); + const GlobalPosition& globalPos1 = element1.geometry().center(); + const GlobalPosition& globalPos2 = element2.geometry().center(); + const GlobalPosition& globalPos4 = element4.geometry().center(); + const GlobalPosition& globalPos5 = element5.geometry().center(); const GlobalPosition& globalPosCenter = interactionVolume.getCenterPosition(); - const DimMatrix& K1 = problem_.spatialParams().intrinsicPermeability(*elementPointer1); - const DimMatrix& K2 = problem_.spatialParams().intrinsicPermeability(*elementPointer2); - const DimMatrix& K4 = problem_.spatialParams().intrinsicPermeability(*elementPointer4); - const DimMatrix& K5 = problem_.spatialParams().intrinsicPermeability(*elementPointer5); + const DimMatrix& K1 = problem_.spatialParams().intrinsicPermeability(element1); + const DimMatrix& K2 = problem_.spatialParams().intrinsicPermeability(element2); + const DimMatrix& K4 = problem_.spatialParams().intrinsicPermeability(element4); + const DimMatrix& K5 = problem_.spatialParams().intrinsicPermeability(element5); // 1.use centered L-stencil 1 to compute the transmissibility of 1/4 face GlobalPosition globalPosFace12(0); @@ -1827,23 +1825,23 @@ int FvMpfaL3dTransmissibilityCalculator<TypeTag>::transmissibilityCaseFour( InteractionVolume& interactionVolume, std::vector<DimVector >& lambda,int idx1, int idx2, int idx3, int idx6) { - ElementPointer& elementPointer1 = interactionVolume.getSubVolumeElement(idx1); - ElementPointer& elementPointer2 = interactionVolume.getSubVolumeElement(idx2); - ElementPointer& elementPointer3 = interactionVolume.getSubVolumeElement(idx3); - ElementPointer& elementPointer6 = interactionVolume.getSubVolumeElement(idx6); + auto element1 = interactionVolume.getSubVolumeElement(idx1); + auto element2 = interactionVolume.getSubVolumeElement(idx2); + auto element3 = interactionVolume.getSubVolumeElement(idx3); + auto element6 = interactionVolume.getSubVolumeElement(idx6); // get global coordinate of cell centers - const GlobalPosition& globalPos1 = elementPointer1->geometry().center(); - const GlobalPosition& globalPos2 = elementPointer2->geometry().center(); - const GlobalPosition& globalPos3 = elementPointer3->geometry().center(); - const GlobalPosition& globalPos6 = elementPointer6->geometry().center(); + const GlobalPosition& globalPos1 = element1.geometry().center(); + const GlobalPosition& globalPos2 = element2.geometry().center(); + const GlobalPosition& globalPos3 = element3.geometry().center(); + const GlobalPosition& globalPos6 = element6.geometry().center(); const GlobalPosition& globalPosCenter = interactionVolume.getCenterPosition(); - const DimMatrix& K1 = problem_.spatialParams().intrinsicPermeability(*elementPointer1); - const DimMatrix& K2 = problem_.spatialParams().intrinsicPermeability(*elementPointer2); - const DimMatrix& K3 = problem_.spatialParams().intrinsicPermeability(*elementPointer3); - const DimMatrix& K6 = problem_.spatialParams().intrinsicPermeability(*elementPointer6); + const DimMatrix& K1 = problem_.spatialParams().intrinsicPermeability(element1); + const DimMatrix& K2 = problem_.spatialParams().intrinsicPermeability(element2); + const DimMatrix& K3 = problem_.spatialParams().intrinsicPermeability(element3); + const DimMatrix& K6 = problem_.spatialParams().intrinsicPermeability(element6); // 1.use centered L-stencil 1 to compute the transmissibility of 1/4 face GlobalPosition globalPosFace12(0); diff --git a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dvelocity2p.hh b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dvelocity2p.hh index 521e74943b09f2624206b9df7dacde4aa84ff8e0..7e4cf50fd94514773c1d316817c3af7647a21418 100644 --- a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dvelocity2p.hh +++ b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dvelocity2p.hh @@ -85,7 +85,6 @@ template<class TypeTag> class FvMpfaL3dVelocity2p typedef typename GridView::template Codim<0>::Iterator ElementIterator; typedef typename GridView::template Codim<dim>::Iterator VertexIterator; typedef typename GridView::IntersectionIterator IntersectionIterator; - typedef typename Grid::template Codim<0>::EntityPointer ElementPointer; typedef typename Element::Geometry Geometry; typedef typename Geometry::JacobianTransposed JacobianTransposed; @@ -305,24 +304,24 @@ void FvMpfaL3dVelocity2p<TypeTag>::calculateInnerInteractionVolumeVelocity(Inter CellData & cellData5, CellData & cellData6, CellData & cellData7, CellData & cellData8, InteractionVolumeContainer& interactionVolumes, TransmissibilityCalculator& transmissibilityCalculator, int fIdx) { - ElementPointer& elementPointer1 = interactionVolume.getSubVolumeElement(0); - ElementPointer& elementPointer2 = interactionVolume.getSubVolumeElement(1); - ElementPointer& elementPointer3 = interactionVolume.getSubVolumeElement(2); - ElementPointer& elementPointer4 = interactionVolume.getSubVolumeElement(3); - ElementPointer& elementPointer5 = interactionVolume.getSubVolumeElement(4); - ElementPointer& elementPointer6 = interactionVolume.getSubVolumeElement(5); - ElementPointer& elementPointer7 = interactionVolume.getSubVolumeElement(6); - ElementPointer& elementPointer8 = interactionVolume.getSubVolumeElement(7); + auto element1 = interactionVolume.getSubVolumeElement(0); + auto element2 = interactionVolume.getSubVolumeElement(1); + auto element3 = interactionVolume.getSubVolumeElement(2); + auto element4 = interactionVolume.getSubVolumeElement(3); + auto element5 = interactionVolume.getSubVolumeElement(4); + auto element6 = interactionVolume.getSubVolumeElement(5); + auto element7 = interactionVolume.getSubVolumeElement(6); + auto element8 = interactionVolume.getSubVolumeElement(7); // cell index - int eIdxGlobal1 = problem_.variables().index(*elementPointer1); - int eIdxGlobal2 = problem_.variables().index(*elementPointer2); - int eIdxGlobal3 = problem_.variables().index(*elementPointer3); - int eIdxGlobal4 = problem_.variables().index(*elementPointer4); - int eIdxGlobal5 = problem_.variables().index(*elementPointer5); - int eIdxGlobal6 = problem_.variables().index(*elementPointer6); - int eIdxGlobal7 = problem_.variables().index(*elementPointer7); - int eIdxGlobal8 = problem_.variables().index(*elementPointer8); + int eIdxGlobal1 = problem_.variables().index(element1); + int eIdxGlobal2 = problem_.variables().index(element2); + int eIdxGlobal3 = problem_.variables().index(element3); + int eIdxGlobal4 = problem_.variables().index(element4); + int eIdxGlobal5 = problem_.variables().index(element5); + int eIdxGlobal6 = problem_.variables().index(element6); + int eIdxGlobal7 = problem_.variables().index(element7); + int eIdxGlobal8 = problem_.variables().index(element8); // pressures flux calculation Dune::FieldVector<Scalar, 8> potW(0); @@ -1926,13 +1925,13 @@ void FvMpfaL3dVelocity2p<TypeTag>::calculateInnerInteractionVolumeVelocity(Inter template<class TypeTag> void FvMpfaL3dVelocity2p<TypeTag>::calculateBoundaryInteractionVolumeVelocity(InteractionVolume& interactionVolume, CellData& cellData, int elemIdx) { - ElementPointer& elementPointer = interactionVolume.getSubVolumeElement(elemIdx); + auto element = interactionVolume.getSubVolumeElement(elemIdx); // get global coordinate of cell centers - const GlobalPosition& globalPos = elementPointer->geometry().center(); + const GlobalPosition& globalPos = element.geometry().center(); // permeability vector at boundary - DimMatrix permeability(problem_.spatialParams().intrinsicPermeability(*elementPointer)); + DimMatrix permeability(problem_.spatialParams().intrinsicPermeability(element)); //get mobilities of the phases Dune::FieldVector<Scalar, numPhases> lambda(cellData.mobility(wPhaseIdx)); @@ -1980,7 +1979,7 @@ void FvMpfaL3dVelocity2p<TypeTag>::calculateBoundaryInteractionVolumeVelocity(In } Scalar pcBound = MaterialLaw::pc( - problem_.spatialParams().materialLawParams(*elementPointer), satWBound); + problem_.spatialParams().materialLawParams(element), satWBound); Scalar gravityDiffBound = (problem_.bBoxMax() - globalPosFace) * gravity_ * (density_[nPhaseIdx] - density_[wPhaseIdx]); @@ -1988,10 +1987,10 @@ void FvMpfaL3dVelocity2p<TypeTag>::calculateBoundaryInteractionVolumeVelocity(In pcBound += gravityDiffBound; Dune::FieldVector<Scalar, numPhases> lambdaBound( - MaterialLaw::krw(problem_.spatialParams().materialLawParams(*elementPointer), + MaterialLaw::krw(problem_.spatialParams().materialLawParams(element), satWBound)); lambdaBound[nPhaseIdx] = MaterialLaw::krn( - problem_.spatialParams().materialLawParams(*elementPointer), satWBound); + problem_.spatialParams().materialLawParams(element), satWBound); lambdaBound[wPhaseIdx] /= viscosity_[wPhaseIdx]; lambdaBound[nPhaseIdx] /= viscosity_[nPhaseIdx]; diff --git a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dvelocity2padaptive.hh b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dvelocity2padaptive.hh index c9567ae482f9a9ca921f28afbe209a6dd4bac0e8..248eb7fe10c93920b513758970874a4a1a592b38 100644 --- a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dvelocity2padaptive.hh +++ b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dvelocity2padaptive.hh @@ -87,7 +87,6 @@ template<class TypeTag> class FvMpfaL3dVelocity2pAdaptive: public FvMpfaL3dVeloc typedef typename GridView::template Codim<0>::Iterator ElementIterator; typedef typename GridView::template Codim<dim>::Iterator VertexIterator; typedef typename GridView::IntersectionIterator IntersectionIterator; - typedef typename Grid::template Codim<0>::EntityPointer ElementPointer; typedef typename GET_PROP_TYPE(TypeTag, GridTypeIndices) GridTypeIndices; @@ -225,24 +224,24 @@ void FvMpfaL3dVelocity2pAdaptive<TypeTag>::calculateHangingNodeInteractionVolume CellData & cellData1, CellData & cellData2, CellData & cellData3, CellData & cellData4, CellData & cellData5, CellData & cellData6, CellData & cellData7, CellData & cellData8, int fIdx) { - ElementPointer& elementPointer1 = interactionVolume.getSubVolumeElement(0); - ElementPointer& elementPointer2 = interactionVolume.getSubVolumeElement(1); - ElementPointer& elementPointer3 = interactionVolume.getSubVolumeElement(2); - ElementPointer& elementPointer4 = interactionVolume.getSubVolumeElement(3); - ElementPointer& elementPointer5 = interactionVolume.getSubVolumeElement(4); - ElementPointer& elementPointer6 = interactionVolume.getSubVolumeElement(5); - ElementPointer& elementPointer7 = interactionVolume.getSubVolumeElement(6); - ElementPointer& elementPointer8 = interactionVolume.getSubVolumeElement(7); + auto element1 = interactionVolume.getSubVolumeElement(0); + auto element2 = interactionVolume.getSubVolumeElement(1); + auto element3 = interactionVolume.getSubVolumeElement(2); + auto element4 = interactionVolume.getSubVolumeElement(3); + auto element5 = interactionVolume.getSubVolumeElement(4); + auto element6 = interactionVolume.getSubVolumeElement(5); + auto element7 = interactionVolume.getSubVolumeElement(6); + auto element8 = interactionVolume.getSubVolumeElement(7); // cell index - int globalIdx1 = problem_.variables().index(*elementPointer1); - int globalIdx2 = problem_.variables().index(*elementPointer2); - int globalIdx3 = problem_.variables().index(*elementPointer3); - int globalIdx4 = problem_.variables().index(*elementPointer4); - int globalIdx5 = problem_.variables().index(*elementPointer5); - int globalIdx6 = problem_.variables().index(*elementPointer6); - int globalIdx7 = problem_.variables().index(*elementPointer7); - int globalIdx8 = problem_.variables().index(*elementPointer8); + int globalIdx1 = problem_.variables().index(element1); + int globalIdx2 = problem_.variables().index(element2); + int globalIdx3 = problem_.variables().index(element3); + int globalIdx4 = problem_.variables().index(element4); + int globalIdx5 = problem_.variables().index(element5); + int globalIdx6 = problem_.variables().index(element6); + int globalIdx7 = problem_.variables().index(element7); + int globalIdx8 = problem_.variables().index(element8); // pressures flux calculation Dune::FieldVector<Scalar, 8> potW(0); diff --git a/dumux/decoupled/2p/diffusion/fvmpfa/omethod/fvmpfao2dpressure2p.hh b/dumux/decoupled/2p/diffusion/fvmpfa/omethod/fvmpfao2dpressure2p.hh index 52e2169f95f0eefe615b130122a340f5e6ab0faf..60257c9356ca273868f951c786b0b884c048a928 100644 --- a/dumux/decoupled/2p/diffusion/fvmpfa/omethod/fvmpfao2dpressure2p.hh +++ b/dumux/decoupled/2p/diffusion/fvmpfa/omethod/fvmpfao2dpressure2p.hh @@ -125,7 +125,6 @@ class FvMpfaO2dPressure2p: public FVPressure<TypeTag> typedef typename GridView::Traits::template Codim<0>::Entity Element; typedef typename GridView::template Codim<0>::Iterator ElementIterator; typedef typename GridView::template Codim<dim>::Iterator VertexIterator; - typedef typename GridView::template Codim<0>::EntityPointer ElementPointer; typedef typename GridView::IntersectionIterator IntersectionIterator; typedef Dune::FieldVector<Scalar, dim> LocalPosition; @@ -176,11 +175,11 @@ public: { ParentType::initialize(); - ElementIterator element = problem_.gridView().template begin<0>(); + ElementIterator eIt = problem_.gridView().template begin<0>(); FluidState fluidState; - fluidState.setPressure(wPhaseIdx, problem_.referencePressure(*element)); - fluidState.setPressure(nPhaseIdx, problem_.referencePressure(*element)); - fluidState.setTemperature(problem_.temperature(*element)); + fluidState.setPressure(wPhaseIdx, problem_.referencePressure(*eIt)); + fluidState.setPressure(nPhaseIdx, problem_.referencePressure(*eIt)); + fluidState.setTemperature(problem_.temperature(*eIt)); fluidState.setSaturation(wPhaseIdx, 1.); fluidState.setSaturation(nPhaseIdx, 0.); density_[wPhaseIdx] = FluidSystem::density(fluidState, wPhaseIdx); @@ -569,23 +568,20 @@ void FvMpfaO2dPressure2p<TypeTag>::initializeMatrix() if (isIt->neighbor() && nextIsIt->neighbor()) { // access the common neighbor of isIt's and nextIsIt's outside - ElementPointer outside = isIt->outside(); - ElementPointer nextisItoutside = nextIsIt->outside(); + auto outside = isIt->outside(); + auto nextisItoutside = nextIsIt->outside(); - IntersectionIterator innerisItEnd = problem_.gridView().iend(*outside); - IntersectionIterator innernextisItEnd = problem_.gridView().iend(*nextisItoutside); + IntersectionIterator innerisItEnd = problem_.gridView().iend(outside); + IntersectionIterator innernextisItEnd = problem_.gridView().iend(nextisItoutside); - for (IntersectionIterator innerisIt = problem_.gridView().ibegin(*outside); innerisIt != innerisItEnd; + for (IntersectionIterator innerisIt = problem_.gridView().ibegin(outside); innerisIt != innerisItEnd; ++innerisIt) - for (IntersectionIterator innernextisIt = problem_.gridView().ibegin(*nextisItoutside); + for (IntersectionIterator innernextisIt = problem_.gridView().ibegin(nextisItoutside); innernextisIt != innernextisItEnd; ++innernextisIt) { if (innerisIt->neighbor() && innernextisIt->neighbor()) { - ElementPointer innerisItoutside = innerisIt->outside(); - ElementPointer innernextisItoutside = innernextisIt->outside(); - - if (innerisItoutside == innernextisItoutside && innerisItoutside != isIt->inside()) + if (innerisIt->outside() == innernextisIt->outside() && innerisIt->outside() != isIt->inside()) { rowSize++; } @@ -665,8 +661,7 @@ void FvMpfaO2dPressure2p<TypeTag>::initializeMatrix() if (isIt->neighbor()) { // access neighbor - ElementPointer outside = isIt->outside(); - int eIdxGlobalJ = problem_.variables().index(*outside); + int eIdxGlobalJ = problem_.variables().index(isIt->outside()); // add off diagonal index // add index (row,col) to the matrix @@ -676,25 +671,25 @@ void FvMpfaO2dPressure2p<TypeTag>::initializeMatrix() if (isIt->neighbor() && nextIsIt->neighbor()) { // access the common neighbor of isIt's and nextIsIt's outside - ElementPointer outside = isIt->outside(); - ElementPointer nextisItoutside = nextIsIt->outside(); + auto outside = isIt->outside(); + auto nextisItoutside = nextIsIt->outside(); - IntersectionIterator innerisItEnd = problem_.gridView().iend(*outside); - IntersectionIterator innernextisItEnd = problem_.gridView().iend(*nextisItoutside); + IntersectionIterator innerisItEnd = problem_.gridView().iend(outside); + IntersectionIterator innernextisItEnd = problem_.gridView().iend(nextisItoutside); - for (IntersectionIterator innerisIt = problem_.gridView().ibegin(*outside); innerisIt != innerisItEnd; + for (IntersectionIterator innerisIt = problem_.gridView().ibegin(outside); innerisIt != innerisItEnd; ++innerisIt) - for (IntersectionIterator innernextisIt = problem_.gridView().ibegin(*nextisItoutside); + for (IntersectionIterator innernextisIt = problem_.gridView().ibegin(nextisItoutside); innernextisIt != innernextisItEnd; ++innernextisIt) { if (innerisIt->neighbor() && innernextisIt->neighbor()) { - ElementPointer innerisItoutside = innerisIt->outside(); - ElementPointer innernextisItoutside = innernextisIt->outside(); + auto innerisItoutside = innerisIt->outside(); + auto innernextisItoutside = innernextisIt->outside(); if (innerisItoutside == innernextisItoutside && innerisItoutside != isIt->inside()) { - int eIdxGlobalJ = problem_.variables().index(*innerisItoutside); + int eIdxGlobalJ = problem_.variables().index(innerisItoutside); this->A_.addindex(eIdxGlobalI, eIdxGlobalJ); } @@ -828,15 +823,13 @@ void FvMpfaO2dPressure2p<TypeTag>::storeInteractionVolumeInfo() int localVertIdx12corner = referenceElement.subEntity(indexInInside12, dim - 1, i, dim); - int globalVertIdx12corner = problem_.variables().index( - *((*eIt).template subEntity < dim > (localVertIdx12corner))); + int globalVertIdx12corner = problem_.variables().index(eIt->template subEntity<dim>(localVertIdx12corner)); for (int j = 0; j < isIt14->geometry().corners(); ++j) { int localVertIdx14corner = referenceElement.subEntity(indexInInside14, dim - 1, j, dim); - int globalVertIdx14corner = problem_.variables().index( - *((*eIt).template subEntity < dim > (localVertIdx14corner))); + int globalVertIdx14corner = problem_.variables().index(eIt->template subEntity<dim>(localVertIdx14corner)); if (globalVertIdx12corner == globalVertIdx14corner) { @@ -911,32 +904,32 @@ void FvMpfaO2dPressure2p<TypeTag>::storeInteractionVolumeInfo() if (isIt12->neighbor()) { // access neighbor cell 2 of 'isIt12' - ElementPointer elementPointer2 = isIt12->outside(); + auto element2 = isIt12->outside(); - int eIdxGlobal2 = problem_.variables().index(*elementPointer2); + int eIdxGlobal2 = problem_.variables().index(element2); //store pointer 2 - interactionVolumes_[globalVertIdx1234].setSubVolumeElement(elementPointer2, 1); + interactionVolumes_[globalVertIdx1234].setSubVolumeElement(element2, 1); interactionVolumes_[globalVertIdx1234].setIndexOnElement(isIt12->indexInOutside(), 1, 1); interactionVolumes_[globalVertIdx1234].setNormal(unitOuterNormal12, 1, 1); interactionVolumes_[globalVertIdx1234].setFaceArea(faceVol12, 1, 1); // get global coordinate of neighbor cell 2 center - const GlobalPosition& globalPos2 = elementPointer2->geometry().center(); + const GlobalPosition& globalPos2 = element2.geometry().center(); // get absolute permeability of neighbor cell 2 - DimMatrix K2(problem_.spatialParams().intrinsicPermeability(*elementPointer2)); + DimMatrix K2(problem_.spatialParams().intrinsicPermeability(element2)); // 'isIt14' is an interior face if (isIt14->neighbor()) { // neighbor cell 3 // access neighbor cell 3 - ElementPointer elementPointer4 = isIt14->outside(); + auto element4 = isIt14->outside(); //store pointer 4 - interactionVolumes_[globalVertIdx1234].setSubVolumeElement(elementPointer4, 3); + interactionVolumes_[globalVertIdx1234].setSubVolumeElement(element4, 3); interactionVolumes_[globalVertIdx1234].setIndexOnElement(isIt14->indexInOutside(), 3, 0); interactionVolumes_[globalVertIdx1234].setNormal(unitOuterNormal14, 3, 0); @@ -945,10 +938,10 @@ void FvMpfaO2dPressure2p<TypeTag>::storeInteractionVolumeInfo() // get basic information of cell 1,2's neighbor cell 3,4 // get global coordinate of neighbor cell 4 center - const GlobalPosition& globalPos4 = elementPointer4->geometry().center(); + const GlobalPosition& globalPos4 = element4.geometry().center(); // get absolute permeability of neighbor cell 2 - DimMatrix K4(problem_.spatialParams().intrinsicPermeability(*elementPointer4)); + DimMatrix K4(problem_.spatialParams().intrinsicPermeability(element4)); // cell 3 GlobalPosition globalPos3(0); @@ -956,26 +949,26 @@ void FvMpfaO2dPressure2p<TypeTag>::storeInteractionVolumeInfo() GlobalPosition globalPosFace23(0); GlobalPosition globalPosFace34(0); - IntersectionIterator isIt2End = problem_.gridView().iend(*elementPointer2); - IntersectionIterator isIt4End = problem_.gridView().iend(*elementPointer4); - for (IntersectionIterator isIt2 = problem_.gridView().ibegin(*elementPointer2); isIt2 != isIt2End; + IntersectionIterator isIt2End = problem_.gridView().iend(element2); + IntersectionIterator isIt4End = problem_.gridView().iend(element4); + for (IntersectionIterator isIt2 = problem_.gridView().ibegin(element2); isIt2 != isIt2End; ++isIt2) { bool finished = false; - for (IntersectionIterator isIt4 = problem_.gridView().ibegin(*elementPointer4); + for (IntersectionIterator isIt4 = problem_.gridView().ibegin(element4); isIt4 != isIt4End; ++isIt4) { if (isIt2->neighbor() && isIt4->neighbor()) { - ElementPointer elementPointer32 = isIt2->outside(); - ElementPointer elementPointer34 = isIt4->outside(); + auto element32 = isIt2->outside(); + auto element34 = isIt4->outside(); // find the common neighbor cell between cell 2 and cell 3, except cell 1 - if (elementPointer32 == elementPointer34 && elementPointer32 != eIt) + if (element32 == element34 && element32 != *eIt) { //store pointer 3 - interactionVolumes_[globalVertIdx1234].setSubVolumeElement(elementPointer32, 2); + interactionVolumes_[globalVertIdx1234].setSubVolumeElement(element32, 2); interactionVolumes_[globalVertIdx1234].setIndexOnElement(isIt2->indexInInside(), 1, 0); @@ -987,7 +980,7 @@ void FvMpfaO2dPressure2p<TypeTag>::storeInteractionVolumeInfo() 0); // get global coordinate of neighbor cell 4 center - globalPos3 = elementPointer32->geometry().center(); + globalPos3 = element32.geometry().center(); globalPosFace23 = isIt2->geometry().center(); globalPosFace34 = isIt4->geometry().center(); @@ -1011,7 +1004,7 @@ void FvMpfaO2dPressure2p<TypeTag>::storeInteractionVolumeInfo() // get absolute permeability of neighbor cell 2 DimMatrix K3( - problem_.spatialParams().intrinsicPermeability(*elementPointer32)); + problem_.spatialParams().intrinsicPermeability(element32)); // compute normal vectors nu23, nu21; nu32, nu34; nu41, nu43; DimVector nu23(0); @@ -1098,8 +1091,8 @@ void FvMpfaO2dPressure2p<TypeTag>::storeInteractionVolumeInfo() bool finished = false; - IntersectionIterator isIt2End = problem_.gridView().iend(*elementPointer2); - for (IntersectionIterator isIt2 = problem_.gridView().ibegin(*elementPointer2); isIt2 != isIt2End; + IntersectionIterator isIt2End = problem_.gridView().iend(element2); + for (IntersectionIterator isIt2 = problem_.gridView().ibegin(element2); isIt2 != isIt2End; ++isIt2) { if (isIt2->boundary()) @@ -1109,8 +1102,7 @@ void FvMpfaO2dPressure2p<TypeTag>::storeInteractionVolumeInfo() int localVertIdx2corner = referenceElement.subEntity(isIt2->indexInInside(), dim - 1, i, dim); - int globalVertIdx2corner = problem_.variables().index( - *((*elementPointer2).template subEntity < dim > (localVertIdx2corner))); + int globalVertIdx2corner = problem_.variables().index(element2.template subEntity<dim>(localVertIdx2corner)); if (globalVertIdx2corner == globalVertIdx1234) { @@ -1229,25 +1221,25 @@ void FvMpfaO2dPressure2p<TypeTag>::storeInteractionVolumeInfo() { // neighbor cell 3 // access neighbor cell 3 - ElementPointer elementPointer4 = isIt14->outside(); + auto element4 = isIt14->outside(); interactionVolumes_[globalVertIdx1234].setIndexOnElement(isIt14->indexInOutside(), 3, 0); //store pointer 4 - interactionVolumes_[globalVertIdx1234].setSubVolumeElement(elementPointer4, 3); + interactionVolumes_[globalVertIdx1234].setSubVolumeElement(element4, 3); interactionVolumes_[globalVertIdx1234].setNormal(unitOuterNormal14, 3, 0); interactionVolumes_[globalVertIdx1234].setFaceArea(faceVol41, 3, 0); // get global coordinate of neighbor cell 3 center - const GlobalPosition& globalPos4 = elementPointer4->geometry().center(); + const GlobalPosition& globalPos4 = element4.geometry().center(); - int eIdxGlobal4 = problem_.variables().index(*elementPointer4); + int eIdxGlobal4 = problem_.variables().index(element4); bool finished = false; // get the information of the face 'isIt34' between cell3 and cell4 (locally numbered) - IntersectionIterator isIt4End = problem_.gridView().iend(*elementPointer4); - for (IntersectionIterator isIt4 = problem_.gridView().ibegin(*elementPointer4); isIt4 != isIt4End; + IntersectionIterator isIt4End = problem_.gridView().iend(element4); + for (IntersectionIterator isIt4 = problem_.gridView().ibegin(element4); isIt4 != isIt4End; ++isIt4) { if (isIt4->boundary()) @@ -1257,8 +1249,7 @@ void FvMpfaO2dPressure2p<TypeTag>::storeInteractionVolumeInfo() int localVertIdx4corner = referenceElement.subEntity(isIt4->indexInInside(), dim - 1, i, dim); - int globalVertIdx4corner = problem_.variables().index( - *((*elementPointer4).template subEntity < dim > (localVertIdx4corner))); + int globalVertIdx4corner = problem_.variables().index(element4.template subEntity<dim>(localVertIdx4corner)); if (globalVertIdx4corner == globalVertIdx1234) { @@ -1297,7 +1288,7 @@ void FvMpfaO2dPressure2p<TypeTag>::storeInteractionVolumeInfo() // get absolute permeability of neighbor cell 2 DimMatrix K4( - problem_.spatialParams().intrinsicPermeability(*elementPointer4)); + problem_.spatialParams().intrinsicPermeability(element4)); // compute normal vectors nu41, nu43; DimVector nu41(0); @@ -1359,28 +1350,28 @@ void FvMpfaO2dPressure2p<TypeTag>::assemble() if (interactionVolume.isInnerVolume()) { - ElementPointer& elementPointer1 = interactionVolume.getSubVolumeElement(0); - ElementPointer& elementPointer2 = interactionVolume.getSubVolumeElement(1); - ElementPointer& elementPointer3 = interactionVolume.getSubVolumeElement(2); - ElementPointer& elementPointer4 = interactionVolume.getSubVolumeElement(3); + auto element1 = interactionVolume.getSubVolumeElement(0); + auto element2 = interactionVolume.getSubVolumeElement(1); + auto element3 = interactionVolume.getSubVolumeElement(2); + auto element4 = interactionVolume.getSubVolumeElement(3); // get global coordinate of cell centers - const GlobalPosition& globalPos1 = elementPointer1->geometry().center(); - const GlobalPosition& globalPos2 = elementPointer2->geometry().center(); - const GlobalPosition& globalPos3 = elementPointer3->geometry().center(); - const GlobalPosition& globalPos4 = elementPointer4->geometry().center(); + const GlobalPosition& globalPos1 = element1.geometry().center(); + const GlobalPosition& globalPos2 = element2.geometry().center(); + const GlobalPosition& globalPos3 = element3.geometry().center(); + const GlobalPosition& globalPos4 = element4.geometry().center(); // cell volumes - Scalar volume1 = elementPointer1->geometry().volume(); - Scalar volume2 = elementPointer2->geometry().volume(); - Scalar volume3 = elementPointer3->geometry().volume(); - Scalar volume4 = elementPointer4->geometry().volume(); + Scalar volume1 = element1.geometry().volume(); + Scalar volume2 = element2.geometry().volume(); + Scalar volume3 = element3.geometry().volume(); + Scalar volume4 = element4.geometry().volume(); // cell index - int eIdxGlobal1 = problem_.variables().index(*elementPointer1); - int eIdxGlobal2 = problem_.variables().index(*elementPointer2); - int eIdxGlobal3 = problem_.variables().index(*elementPointer3); - int eIdxGlobal4 = problem_.variables().index(*elementPointer4); + int eIdxGlobal1 = problem_.variables().index(element1); + int eIdxGlobal2 = problem_.variables().index(element2); + int eIdxGlobal3 = problem_.variables().index(element3); + int eIdxGlobal4 = problem_.variables().index(element4); //get the cell Data CellData& cellData1 = problem_.variables().cellData(eIdxGlobal1); @@ -1390,16 +1381,16 @@ void FvMpfaO2dPressure2p<TypeTag>::assemble() // evaluate right hand side PrimaryVariables source(0.0); - problem_.source(source, *elementPointer1); + problem_.source(source, element1); this->f_[eIdxGlobal1] += volume1 / (4.0) * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]); - problem_.source(source, *elementPointer2); + problem_.source(source, element2); this->f_[eIdxGlobal2] += volume2 / (4.0) * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]); - problem_.source(source, *elementPointer3); + problem_.source(source, element3); this->f_[eIdxGlobal3] += volume3 / (4.0) * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]); - problem_.source(source, *elementPointer4); + problem_.source(source, element4); this->f_[eIdxGlobal4] += volume4 / (4.0) * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]); @@ -1773,26 +1764,26 @@ void FvMpfaO2dPressure2p<TypeTag>::assemble() continue; } - ElementPointer& elementPointer = interactionVolume.getSubVolumeElement(elemIdx); + auto element = interactionVolume.getSubVolumeElement(elemIdx); // get global coordinate of cell centers - const GlobalPosition& globalPos = elementPointer->geometry().center(); + const GlobalPosition& globalPos = element.geometry().center(); // cell volumes - Scalar volume = elementPointer->geometry().volume(); + Scalar volume = element.geometry().volume(); // cell index - int eIdxGlobal = problem_.variables().index(*elementPointer); + int eIdxGlobal = problem_.variables().index(element); //get the cell Data CellData& cellData = problem_.variables().cellData(eIdxGlobal); //permeability vector at boundary - DimMatrix permeability(problem_.spatialParams().intrinsicPermeability(*elementPointer)); + DimMatrix permeability(problem_.spatialParams().intrinsicPermeability(element)); // evaluate right hand side PrimaryVariables source(0); - problem_.source(source, *elementPointer); + problem_.source(source, element); this->f_[eIdxGlobal] += volume / (4.0) * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]); @@ -1821,11 +1812,11 @@ void FvMpfaO2dPressure2p<TypeTag>::assemble() int boundaryFaceIdx = interactionVolume.getIndexOnElement(elemIdx, fIdx); const ReferenceElement& referenceElement = ReferenceElements::general( - elementPointer->geometry().type()); + element.geometry().type()); const LocalPosition& localPos = referenceElement.position(boundaryFaceIdx, 1); - const GlobalPosition& globalPosFace = elementPointer->geometry().global(localPos); + const GlobalPosition& globalPosFace = element.geometry().global(localPos); DimVector distVec(globalPosFace - globalPos); Scalar dist = distVec.two_norm(); @@ -1857,7 +1848,7 @@ void FvMpfaO2dPressure2p<TypeTag>::assemble() } Scalar pcBound = MaterialLaw::pc( - problem_.spatialParams().materialLawParams(*elementPointer), satWBound); + problem_.spatialParams().materialLawParams(element), satWBound); Scalar gravityDiffBound = (problem_.bBoxMax() - globalPosFace) * gravity_ * (density_[nPhaseIdx] - density_[wPhaseIdx]); @@ -1865,10 +1856,10 @@ void FvMpfaO2dPressure2p<TypeTag>::assemble() pcBound += gravityDiffBound; Dune::FieldVector<Scalar, numPhases> lambdaBound( - MaterialLaw::krw(problem_.spatialParams().materialLawParams(*elementPointer), + MaterialLaw::krw(problem_.spatialParams().materialLawParams(element), satWBound)); lambdaBound[nPhaseIdx] = MaterialLaw::krn( - problem_.spatialParams().materialLawParams(*elementPointer), satWBound); + problem_.spatialParams().materialLawParams(element), satWBound); lambdaBound[wPhaseIdx] /= viscosity_[wPhaseIdx]; lambdaBound[nPhaseIdx] /= viscosity_[nPhaseIdx]; diff --git a/dumux/decoupled/2p/diffusion/fvmpfa/omethod/fvmpfao2dpressurevelocity2p.hh b/dumux/decoupled/2p/diffusion/fvmpfa/omethod/fvmpfao2dpressurevelocity2p.hh index 212741b305dd757bfe1e980e7699ea96bcb9e1e8..169f36706a6d739b6676e6605c71681f8e35695c 100644 --- a/dumux/decoupled/2p/diffusion/fvmpfa/omethod/fvmpfao2dpressurevelocity2p.hh +++ b/dumux/decoupled/2p/diffusion/fvmpfa/omethod/fvmpfao2dpressurevelocity2p.hh @@ -69,8 +69,6 @@ template<class TypeTag> class FvMpfaO2dPressureVelocity2p: public FvMpfaO2dPress typedef typename GridView::template Codim<0>::Iterator ElementIterator; typedef typename GridView::template Codim<dim>::Iterator VertexIterator; typedef typename GridView::Traits::template Codim<dim>::Entity Vertex; - typedef typename GridView::Traits::template Codim<0>::EntityPointer ElementPointer; - typedef typename GridView::Traits::template Codim<dim>::EntityPointer VertexPointer; typedef typename GridView::Intersection Intersection; typedef typename Dune::ReferenceElements<Scalar, dim> ReferenceElements; @@ -232,16 +230,16 @@ void FvMpfaO2dPressureVelocity2p<TypeTag>::calculateVelocity() if (interactionVolume.isInnerVolume()) { - ElementPointer & elementPointer1 = interactionVolume.getSubVolumeElement(0); - ElementPointer & elementPointer2 = interactionVolume.getSubVolumeElement(1); - ElementPointer & elementPointer3 = interactionVolume.getSubVolumeElement(2); - ElementPointer & elementPointer4 = interactionVolume.getSubVolumeElement(3); + auto element1 = interactionVolume.getSubVolumeElement(0); + auto element2 = interactionVolume.getSubVolumeElement(1); + auto element3 = interactionVolume.getSubVolumeElement(2); + auto element4 = interactionVolume.getSubVolumeElement(3); // cell index - int eIdxGlobal1 = problem_.variables().index(*elementPointer1); - int eIdxGlobal2 = problem_.variables().index(*elementPointer2); - int eIdxGlobal3 = problem_.variables().index(*elementPointer3); - int eIdxGlobal4 = problem_.variables().index(*elementPointer4); + int eIdxGlobal1 = problem_.variables().index(element1); + int eIdxGlobal2 = problem_.variables().index(element2); + int eIdxGlobal3 = problem_.variables().index(element3); + int eIdxGlobal4 = problem_.variables().index(element4); //get the cell Data CellData& cellData1 = problem_.variables().cellData(eIdxGlobal1); @@ -271,10 +269,8 @@ void FvMpfaO2dPressureVelocity2p<TypeTag>::calculateVelocity() { continue; } - ElementPointer & elementPointer = interactionVolume.getSubVolumeElement(elemIdx); - // cell index - int eIdxGlobal = problem_.variables().index(*elementPointer); + int eIdxGlobal = problem_.variables().index(interactionVolume.getSubVolumeElement(elemIdx)); //get the cell Data CellData& cellData = problem_.variables().cellData(eIdxGlobal); @@ -299,15 +295,15 @@ void FvMpfaO2dPressureVelocity2p<TypeTag>::calculateVelocity(const Intersection& { int numVertices = intersection.geometry().corners(); - ElementPointer elementPtrI = intersection.inside(); - ElementPointer elementPtrJ = intersection.outside(); + auto elementI = intersection.inside(); + auto elementJ = intersection.outside(); - int eIdxGlobalI = problem_.variables().index(*elementPtrI); - int eIdxGlobalJ = problem_.variables().index(*elementPtrJ); + int eIdxGlobalI = problem_.variables().index(elementI); + int eIdxGlobalJ = problem_.variables().index(elementJ); CellData& cellDataJ = problem_.variables().cellData(eIdxGlobalJ); - const ReferenceElement& referenceElement = ReferenceElements::general(elementPtrI->geometry().type()); + const ReferenceElement& referenceElement = ReferenceElements::general(elementI.geometry().type()); int indexInInside = intersection.indexInInside(); int indexInOutside = intersection.indexInOutside(); @@ -318,25 +314,24 @@ void FvMpfaO2dPressureVelocity2p<TypeTag>::calculateVelocity(const Intersection& { int localVertIdx = referenceElement.subEntity(indexInInside, dim - 1, vIdx, dim); - int vIdxGlobal = problem_.variables().index( - *((*elementPtrI).template subEntity < dim > (localVertIdx))); + int vIdxGlobal = problem_.variables().index(elementI.template subEntity<dim>(localVertIdx)); InteractionVolume& interactionVolume = this->interactionVolumes_[vIdxGlobal]; if (interactionVolume.isInnerVolume()) { - ElementPointer & elementPointer1 = interactionVolume.getSubVolumeElement(0); - ElementPointer & elementPointer2 = interactionVolume.getSubVolumeElement(1); - ElementPointer & elementPointer3 = interactionVolume.getSubVolumeElement(2); - ElementPointer & elementPointer4 = interactionVolume.getSubVolumeElement(3); + auto element1 = interactionVolume.getSubVolumeElement(0); + auto element2 = interactionVolume.getSubVolumeElement(1); + auto element3 = interactionVolume.getSubVolumeElement(2); + auto element4 = interactionVolume.getSubVolumeElement(3); // cell index int eIdxGlobal[4]; - eIdxGlobal[0] = problem_.variables().index(*elementPointer1); - eIdxGlobal[1] = problem_.variables().index(*elementPointer2); - eIdxGlobal[2] = problem_.variables().index(*elementPointer3); - eIdxGlobal[3] = problem_.variables().index(*elementPointer4); + eIdxGlobal[0] = problem_.variables().index(element1); + eIdxGlobal[1] = problem_.variables().index(element2); + eIdxGlobal[2] = problem_.variables().index(element3); + eIdxGlobal[3] = problem_.variables().index(element4); //get the cell Data cellDataTemp[0] = problem_.variables().cellData(eIdxGlobal[0]); @@ -390,7 +385,7 @@ void FvMpfaO2dPressureVelocity2p<TypeTag>::calculateVelocity(const Intersection& template<class TypeTag> void FvMpfaO2dPressureVelocity2p<TypeTag>::calculateVelocityOnBoundary(const Intersection& intersection, CellData& cellData) { - ElementPointer element = intersection.inside(); + auto element = intersection.inside(); //get face index int isIndex = intersection.indexInInside(); @@ -408,7 +403,7 @@ void FvMpfaO2dPressureVelocity2p<TypeTag>::calculateVelocityOnBoundary(const Int problem_.dirichlet(boundValues, intersection); // get global coordinates of cell centers - const GlobalPosition& globalPosI = element->geometry().center(); + const GlobalPosition& globalPosI = element.geometry().center(); // center of face in global coordinates const GlobalPosition& globalPosJ = intersection.geometry().center(); @@ -430,7 +425,7 @@ void FvMpfaO2dPressureVelocity2p<TypeTag>::calculateVelocityOnBoundary(const Int // compute vectorized permeabilities DimMatrix meanPermeability(0); - problem_.spatialParams().meanK(meanPermeability, problem_.spatialParams().intrinsicPermeability(*element)); + problem_.spatialParams().meanK(meanPermeability, problem_.spatialParams().intrinsicPermeability(element)); Dune::FieldVector<Scalar, dim> permeability(0); meanPermeability.mv(unitOuterNormal, permeability); @@ -459,7 +454,7 @@ void FvMpfaO2dPressureVelocity2p<TypeTag>::calculateVelocityOnBoundary(const Int } Scalar pressBound = boundValues[pressureIdx]; - Scalar pcBound = MaterialLaw::pc(problem_.spatialParams().materialLawParams(*element), satW); + Scalar pcBound = MaterialLaw::pc(problem_.spatialParams().materialLawParams(element), satW); //determine phase pressures from primary pressure variable Scalar pressWBound = 0; @@ -475,9 +470,9 @@ void FvMpfaO2dPressureVelocity2p<TypeTag>::calculateVelocityOnBoundary(const Int pressNwBound = pressBound; } - Scalar lambdaWBound = MaterialLaw::krw(problem_.spatialParams().materialLawParams(*element), satW) + Scalar lambdaWBound = MaterialLaw::krw(problem_.spatialParams().materialLawParams(element), satW) / viscosity_[wPhaseIdx]; - Scalar lambdaNwBound = MaterialLaw::krn(problem_.spatialParams().materialLawParams(*element), satW) + Scalar lambdaNwBound = MaterialLaw::krn(problem_.spatialParams().materialLawParams(element), satW) / viscosity_[nPhaseIdx]; Scalar potentialDiffW = cellData.fluxData().upwindPotential(wPhaseIdx, isIndex); diff --git a/dumux/decoupled/2p/diffusion/fvmpfa/omethod/fvmpfao2dvelocity2p.hh b/dumux/decoupled/2p/diffusion/fvmpfa/omethod/fvmpfao2dvelocity2p.hh index bd4305f22ee107a843c4ecae011bb24611c91c06..88b8b71a4d6f025de1226a711349ecdcee3b7481 100644 --- a/dumux/decoupled/2p/diffusion/fvmpfa/omethod/fvmpfao2dvelocity2p.hh +++ b/dumux/decoupled/2p/diffusion/fvmpfa/omethod/fvmpfao2dvelocity2p.hh @@ -85,7 +85,6 @@ template<class TypeTag> class FvMpfaO2dVelocity2P typedef typename GridView::template Codim<0>::Iterator ElementIterator; typedef typename GridView::template Codim<dim>::Iterator VertexIterator; typedef typename GridView::IntersectionIterator IntersectionIterator; - typedef typename Grid::template Codim<0>::EntityPointer ElementPointer; typedef typename Element::Geometry Geometry; typedef typename Geometry::JacobianTransposed JacobianTransposed; @@ -281,16 +280,11 @@ void FvMpfaO2dVelocity2P<TypeTag>::calculateInnerInteractionVolumeVelocity(Inter CellData& cellData3, CellData& cellData4, InnerBoundaryVolumeFaces& innerBoundaryVolumeFaces) { - ElementPointer & elementPointer1 = interactionVolume.getSubVolumeElement(0); - ElementPointer & elementPointer2 = interactionVolume.getSubVolumeElement(1); - ElementPointer & elementPointer3 = interactionVolume.getSubVolumeElement(2); - ElementPointer & elementPointer4 = interactionVolume.getSubVolumeElement(3); - // cell index - int eIdxGlobal1 = problem_.variables().index(*elementPointer1); - int eIdxGlobal2 = problem_.variables().index(*elementPointer2); - int eIdxGlobal3 = problem_.variables().index(*elementPointer3); - int eIdxGlobal4 = problem_.variables().index(*elementPointer4); + int eIdxGlobal1 = problem_.variables().index(interactionVolume.getSubVolumeElement(0)); + int eIdxGlobal2 = problem_.variables().index(interactionVolume.getSubVolumeElement(1)); + int eIdxGlobal3 = problem_.variables().index(interactionVolume.getSubVolumeElement(2)); + int eIdxGlobal4 = problem_.variables().index(interactionVolume.getSubVolumeElement(3)); // get pressure values Dune::FieldVector < Scalar, 2 * dim > potW(0); @@ -573,13 +567,13 @@ template<class TypeTag> void FvMpfaO2dVelocity2P<TypeTag>::calculateBoundaryInteractionVolumeVelocity(InteractionVolume& interactionVolume, CellData& cellData, int elemIdx) { - ElementPointer & elementPointer = interactionVolume.getSubVolumeElement(elemIdx); + auto element = interactionVolume.getSubVolumeElement(elemIdx); // get global coordinate of cell centers - const GlobalPosition& globalPos = elementPointer->geometry().center(); + const GlobalPosition& globalPos = element.geometry().center(); //permeability vector at boundary - DimMatrix permeability(problem_.spatialParams().intrinsicPermeability(*elementPointer)); + DimMatrix permeability(problem_.spatialParams().intrinsicPermeability(element)); //get mobilities of the phases Dune::FieldVector < Scalar, numPhases > lambda(cellData.mobility(wPhaseIdx)); @@ -596,11 +590,11 @@ void FvMpfaO2dVelocity2P<TypeTag>::calculateBoundaryInteractionVolumeVelocity(In int boundaryFaceIdx = interactionVolume.getIndexOnElement(elemIdx, fIdx); const ReferenceElement& referenceElement = ReferenceElements::general( - elementPointer->geometry().type()); + element.geometry().type()); const LocalPosition& localPos = referenceElement.position(boundaryFaceIdx, 1); - const GlobalPosition& globalPosFace = elementPointer->geometry().global(localPos); + const GlobalPosition& globalPosFace = element.geometry().global(localPos); DimVector distVec(globalPosFace - globalPos); Scalar dist = distVec.two_norm(); @@ -630,7 +624,7 @@ void FvMpfaO2dVelocity2P<TypeTag>::calculateBoundaryInteractionVolumeVelocity(In } Scalar pcBound = MaterialLaw::pc( - problem_.spatialParams().materialLawParams(*elementPointer), satWBound); + problem_.spatialParams().materialLawParams(element), satWBound); Scalar gravityDiffBound = (problem_.bBoxMax() - globalPosFace) * gravity_ * (density_[nPhaseIdx] - density_[wPhaseIdx]); @@ -640,10 +634,10 @@ void FvMpfaO2dVelocity2P<TypeTag>::calculateBoundaryInteractionVolumeVelocity(In Dune::FieldVector < Scalar, numPhases > lambdaBound( MaterialLaw::krw( - problem_.spatialParams().materialLawParams(*elementPointer), + problem_.spatialParams().materialLawParams(element), satWBound)); lambdaBound[nPhaseIdx] = MaterialLaw::krn( - problem_.spatialParams().materialLawParams(*elementPointer), satWBound); + problem_.spatialParams().materialLawParams(element), satWBound); lambdaBound[wPhaseIdx] /= viscosity_[wPhaseIdx]; lambdaBound[nPhaseIdx] /= viscosity_[nPhaseIdx]; @@ -706,11 +700,11 @@ void FvMpfaO2dVelocity2P<TypeTag>::calculateBoundaryInteractionVolumeVelocity(In int boundaryFaceIdx = interactionVolume.getIndexOnElement(elemIdx, fIdx); const ReferenceElement& referenceElement = ReferenceElements::general( - elementPointer->geometry().type()); + element.geometry().type()); const LocalPosition& localPos = referenceElement.position(boundaryFaceIdx, 1); - const GlobalPosition& globalPosFace = elementPointer->geometry().global(localPos); + const GlobalPosition& globalPosFace = element.geometry().global(localPos); DimVector distVec(globalPosFace - globalPos); Scalar dist = distVec.two_norm(); diff --git a/dumux/decoupled/2p/diffusion/mimetic/croperator2padaptive.hh b/dumux/decoupled/2p/diffusion/mimetic/croperator2padaptive.hh index 0d87d35f524782c4fd3f0d5e7e770b272588bca8..45fea9d6fdae31f39228aeaf734b819865cc8f21 100644 --- a/dumux/decoupled/2p/diffusion/mimetic/croperator2padaptive.hh +++ b/dumux/decoupled/2p/diffusion/mimetic/croperator2padaptive.hh @@ -86,7 +86,6 @@ class CROperatorAssemblerTwoPAdaptive typedef typename GridView::template Codim<0>::Iterator ElementIterator; typedef typename GridView::IntersectionIterator IntersectionIterator; typedef typename GridView::IndexSet IS; - typedef typename GridView::template Codim<0>::EntityPointer ElementPointer; typedef Dune::FieldMatrix<Scalar,1,1> BlockType; typedef Dune::BCRSMatrix<BlockType> MatrixType; typedef typename MatrixType::block_type MBlockType; diff --git a/dumux/decoupled/2p/diffusion/mimetic/mimetic2p.hh b/dumux/decoupled/2p/diffusion/mimetic/mimetic2p.hh index 80cffd39855432dd78c299be4359b90e92d76834..4fc8b7277d6fa5c12a22c786689841d09e4ffce7 100644 --- a/dumux/decoupled/2p/diffusion/mimetic/mimetic2p.hh +++ b/dumux/decoupled/2p/diffusion/mimetic/mimetic2p.hh @@ -99,7 +99,6 @@ class MimeticTwoPLocalStiffness: public LocalStiffness<TypeTag, 1> typedef typename GridView::Grid Grid; typedef typename GridView::Traits::template Codim<0>::Entity Element; - typedef typename GridView::Traits::template Codim<0>::EntityPointer ElementPointer; typedef typename GridView::template Codim<0>::Iterator ElementIterator; typedef typename GridView::IntersectionIterator IntersectionIterator; @@ -647,8 +646,7 @@ void MimeticTwoPLocalStiffness<TypeTag>::assembleElementMatrices(const Element& //it is enough to evaluate the capillary/gravity flux for neighbors -> not needed anyway at the boundaries! if (isIt->neighbor()) { - ElementPointer neighbor = isIt->outside(); - int eIdxGlobalNeighbor = problem_.variables().index(*neighbor); + int eIdxGlobalNeighbor = problem_.variables().index(isIt->outside()); if (flux >= 0.) { switch (pressureType) diff --git a/dumux/decoupled/2p/diffusion/mimetic/mimetic2padaptive.hh b/dumux/decoupled/2p/diffusion/mimetic/mimetic2padaptive.hh index d5e348f382e2e6fb3ed09769a93963667bc0a2c2..23a36f1f214d0fdb730adcc4f874234a7adf472e 100644 --- a/dumux/decoupled/2p/diffusion/mimetic/mimetic2padaptive.hh +++ b/dumux/decoupled/2p/diffusion/mimetic/mimetic2padaptive.hh @@ -100,7 +100,6 @@ class MimeticTwoPLocalStiffnessAdaptive: public LocalStiffness<TypeTag, 1> typedef typename GridView::Grid Grid; typedef typename GridView::Traits::template Codim<0>::Entity Element; - typedef typename GridView::Traits::template Codim<0>::EntityPointer ElementPointer; typedef typename GridView::IntersectionIterator IntersectionIterator; typedef typename GridView::template Codim<0>::Iterator ElementIterator; @@ -652,8 +651,7 @@ void MimeticTwoPLocalStiffnessAdaptive<TypeTag>::assembleElementMatrices(const E if (isIt->neighbor()) { - ElementPointer neighbor = isIt->outside(); - int eIdxGlobalNeighbor = problem_.variables().index(*neighbor); + int eIdxGlobalNeighbor = problem_.variables().index(isIt->outside()); if (flux > 0.) { switch (pressureType) diff --git a/dumux/decoupled/2p/diffusion/mimetic/mimeticoperator2p.hh b/dumux/decoupled/2p/diffusion/mimetic/mimeticoperator2p.hh index 75f394eeedb26a9e98f962ba5261582b2f20e0b8..46be400de078789acba6c93f24e86871f23ef213 100644 --- a/dumux/decoupled/2p/diffusion/mimetic/mimeticoperator2p.hh +++ b/dumux/decoupled/2p/diffusion/mimetic/mimeticoperator2p.hh @@ -61,7 +61,6 @@ class MimeticOperatorAssemblerTwoP: public CROperatorAssemblerTwoP<TypeTag> typedef typename GridView::template Codim<0>::Iterator ElementIterator; typedef typename GridView::template Codim<0>::Entity Element; - typedef typename GridView::template Codim<0>::EntityPointer ElementPointer; typedef typename GridView::IntersectionIterator IntersectionIterator; typedef typename GET_PROP_TYPE(TypeTag, CellData) CellData; @@ -226,7 +225,7 @@ public: if (isIt->neighbor()) { - int neighborIdx = problem.variables().index(*(isIt->outside())); + int neighborIdx = problem.variables().index(isIt->outside()); CellData& cellDataNeighbor = problem.variables().cellData(neighborIdx); diff --git a/dumux/decoupled/2p/diffusion/mimetic/mimeticoperator2padaptive.hh b/dumux/decoupled/2p/diffusion/mimetic/mimeticoperator2padaptive.hh index 23e419b93898072822999e91d83052d4bb171416..29293f8706e50fe277417a097aa11cd20b276c1c 100644 --- a/dumux/decoupled/2p/diffusion/mimetic/mimeticoperator2padaptive.hh +++ b/dumux/decoupled/2p/diffusion/mimetic/mimeticoperator2padaptive.hh @@ -62,7 +62,6 @@ class MimeticOperatorAssemblerTwoPAdaptive : public CROperatorAssemblerTwoPAdapt typedef typename GridView::template Codim<0>::Iterator ElementIterator; typedef typename GridView::template Codim<0>::Entity Element; - typedef typename GridView::template Codim<0>::EntityPointer ElementPointer; typedef typename GridView::IntersectionIterator IntersectionIterator; typedef typename GET_PROP_TYPE(TypeTag, CellData) CellData; @@ -229,7 +228,7 @@ public: if (isIt->neighbor()) { - int neighborIdx = problem.variables().index(*(isIt->outside())); + int neighborIdx = problem.variables().index(isIt->outside()); CellData& cellDataNeighbor = problem.variables().cellData(neighborIdx); diff --git a/dumux/decoupled/2p/diffusion/mimetic/mimeticpressure2p.hh b/dumux/decoupled/2p/diffusion/mimetic/mimeticpressure2p.hh index 9125bed270ce64b8857ca60408009ddab8275c8a..b5840221439478e7d3a4def40b5fef3d4fed6604 100644 --- a/dumux/decoupled/2p/diffusion/mimetic/mimeticpressure2p.hh +++ b/dumux/decoupled/2p/diffusion/mimetic/mimeticpressure2p.hh @@ -103,7 +103,6 @@ template<class TypeTag> class MimeticPressure2P typedef typename GridView::Traits::template Codim<0>::Entity Element; typedef typename GridView::template Codim<0>::Iterator ElementIterator; typedef typename GridView::Grid Grid; - typedef typename GridView::template Codim<0>::EntityPointer ElementPointer; typedef typename GridView::IntersectionIterator IntersectionIterator; typedef typename Element::Geometry Geometry; diff --git a/dumux/decoupled/2p/diffusion/mimetic/mimeticpressure2padaptive.hh b/dumux/decoupled/2p/diffusion/mimetic/mimeticpressure2padaptive.hh index c0154152d9fea39e6a66fa6f502644f4e081f930..dd93fb0f0ea9e9b06e392057df43f494ac08f456 100644 --- a/dumux/decoupled/2p/diffusion/mimetic/mimeticpressure2padaptive.hh +++ b/dumux/decoupled/2p/diffusion/mimetic/mimeticpressure2padaptive.hh @@ -103,7 +103,6 @@ template<class TypeTag> class MimeticPressure2PAdaptive typedef typename GridView::Traits::template Codim<0>::Entity Element; typedef typename GridView::template Codim<0>::Iterator ElementIterator; typedef typename GridView::Grid Grid; - typedef typename GridView::template Codim<0>::EntityPointer ElementPointer; typedef typename GridView::IntersectionIterator IntersectionIterator; typedef typename Element::Geometry Geometry; diff --git a/dumux/decoupled/2p/impes/gridadaptionindicator2p.hh b/dumux/decoupled/2p/impes/gridadaptionindicator2p.hh index c6065a179471ef79f5d116d12301d0dc013e7e79..5aef330f70ef30139ea97b943e365c22730b1a5e 100644 --- a/dumux/decoupled/2p/impes/gridadaptionindicator2p.hh +++ b/dumux/decoupled/2p/impes/gridadaptionindicator2p.hh @@ -45,7 +45,6 @@ private: typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef typename GridView::IntersectionIterator IntersectionIterator; typedef typename GridView::Traits::template Codim<0>::Entity Element; - typedef typename GridView::Traits::template Codim<0>::EntityPointer ElementPointer; typedef typename GridView::template Codim<0>::Iterator ElementIterator; typedef typename GET_PROP(TypeTag, SolutionTypes) SolutionTypes; @@ -115,11 +114,11 @@ public: if (intersection.neighbor()) { // Access neighbor - ElementPointer outside = intersection.outside(); - int globalIdxJ = problem_.variables().index(*outside); + auto outside = intersection.outside(); + int globalIdxJ = problem_.variables().index(outside); // Visit intersection only once - if (eIt->level() > outside->level() || (eIt->level() == outside->level() && globalIdxI < globalIdxJ)) + if (eIt->level() > outside.level() || (eIt->level() == outside.level() && globalIdxI < globalIdxJ)) { Scalar satJ = 0.; switch (saturationType_) diff --git a/dumux/decoupled/2p/impes/gridadaptionindicator2plocal.hh b/dumux/decoupled/2p/impes/gridadaptionindicator2plocal.hh index f20d5ed4534810d3b44a0994a3f51c36e1684c9a..e3a1c2235bed57dbf92190f98bbc48498339f11c 100644 --- a/dumux/decoupled/2p/impes/gridadaptionindicator2plocal.hh +++ b/dumux/decoupled/2p/impes/gridadaptionindicator2plocal.hh @@ -43,7 +43,6 @@ private: typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef typename GridView::IntersectionIterator IntersectionIterator; typedef typename GridView::Traits::template Codim<0>::Entity Element; - typedef typename GridView::Traits::template Codim<0>::EntityPointer ElementPointer; typedef typename GridView::template Codim<0>::Iterator ElementIterator; typedef typename GET_PROP(TypeTag, SolutionTypes) SolutionTypes; @@ -179,12 +178,12 @@ public: else { // get element pointer from neighbor - ElementPointer outside = intersection.outside(); - int globalIdxJ = problem_.variables().index(*outside); + auto outside = intersection.outside(); + int globalIdxJ = problem_.variables().index(outside); // treat each intersection only from one side - if (eIt->level() > outside->level() - || (eIt->level() == outside->level() && globalIdxI < globalIdxJ)) + if (eIt->level() > outside.level() + || (eIt->level() == outside.level() && globalIdxI < globalIdxJ)) { Scalar satJ = 0.; switch (saturationType_) diff --git a/dumux/decoupled/2p/impes/gridadaptionindicator2plocalflux.hh b/dumux/decoupled/2p/impes/gridadaptionindicator2plocalflux.hh index eba02a19472457bdde59bbd13db70bb19ab0a792..727b516e1ddfd4a8035ac11b187be58193d16c6b 100644 --- a/dumux/decoupled/2p/impes/gridadaptionindicator2plocalflux.hh +++ b/dumux/decoupled/2p/impes/gridadaptionindicator2plocalflux.hh @@ -65,7 +65,6 @@ private: typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef typename GridView::IntersectionIterator IntersectionIterator; typedef typename GridView::Traits::template Codim<0>::Entity Element; - typedef typename GridView::Traits::template Codim<0>::EntityPointer ElementPointer; typedef typename GridView::template Codim<0>::Iterator ElementIterator; typedef typename GET_PROP_TYPE(TypeTag, Grid) Grid; @@ -231,7 +230,7 @@ public: if (isIt->neighbor()) { - const CellData& cellDataJ = problem_.variables().cellData(problem_.variables().index(*(isIt->outside()))); + const CellData& cellDataJ = problem_.variables().cellData(problem_.variables().index(isIt->outside())); if (!checkPhysicalRange_(cellDataJ)) { indicatorVector_[globalIdxI] = refineBound_ + 1.0; @@ -310,9 +309,8 @@ public: { if (useSatInd_ || usePercentileSat_) { - // Greife auf Nachbarn zu - ElementPointer outside = intersection.outside(); - int globalIdxJ = problem_.variables().index(*outside); + // get neighbors + int globalIdxJ = problem_.variables().index(intersection.outside()); Scalar satJ = 0.; switch (saturationType_) diff --git a/dumux/decoupled/2p/transport/fv/capillarydiffusion.hh b/dumux/decoupled/2p/transport/fv/capillarydiffusion.hh index d96e761ae2a4e8ae67673ecc97b88c6c87299035..1822e5637ad8919165e4b29c31c95310761e4237 100644 --- a/dumux/decoupled/2p/transport/fv/capillarydiffusion.hh +++ b/dumux/decoupled/2p/transport/fv/capillarydiffusion.hh @@ -73,7 +73,6 @@ private: pressEqIdx = Indices::pressureEqIdx }; - typedef typename GridView::template Codim<0>::EntityPointer ElementPointer; typedef typename GridView::Intersection Intersection; typedef Dune::FieldVector<Scalar, dim> DimVector; typedef Dune::FieldVector<Scalar, dimWorld> GlobalPosition; @@ -92,18 +91,18 @@ public: void getFlux (DimVector& flux, const Intersection& intersection, Scalar satI, Scalar satJ, const DimVector& pcGradient) const { - ElementPointer element = intersection.inside(); + auto element = intersection.inside(); // get global coordinate of cell center - const GlobalPosition& globalPos = element->geometry().center(); + const GlobalPosition& globalPos = element.geometry().center(); - int globalIdxI = problem_.variables().index(*element); + int globalIdxI = problem_.variables().index(element); CellData& CellDataI = problem_.variables().cellData(globalIdxI); // get geometry type of face //Dune::GeometryType faceGT = isIt->geometryInInside().type(); - Scalar temperature = problem_.temperature(*element); - Scalar referencePressure = problem_.referencePressure(*element); + Scalar temperature = problem_.temperature(element); + Scalar referencePressure = problem_.referencePressure(element); //get lambda_bar = lambda_n*f_w Scalar mobBar = 0; @@ -121,9 +120,9 @@ public: fluidState.setPressure(wPhaseIdx, referencePressure); fluidState.setPressure(nPhaseIdx, referencePressure); fluidState.setTemperature(temperature); - mobilityWI = MaterialLaw::krw(problem_.spatialParams().materialLawParams(*element), satI); + mobilityWI = MaterialLaw::krw(problem_.spatialParams().materialLawParams(element), satI); mobilityWI /= FluidSystem::viscosity(fluidState, wPhaseIdx); - mobilityNwI = MaterialLaw::krn(problem_.spatialParams().materialLawParams(*element), satI); + mobilityNwI = MaterialLaw::krn(problem_.spatialParams().materialLawParams(element), satI); mobilityNwI /= FluidSystem::viscosity(fluidState, nPhaseIdx); } @@ -132,13 +131,13 @@ public: if (intersection.neighbor()) { // access neighbor - ElementPointer neighborPointer = intersection.outside(); + auto neighbor = intersection.outside(); - int globalIdxJ = problem_.variables().index(*neighborPointer); + int globalIdxJ = problem_.variables().index(neighbor); CellData& cellDataJ = problem_.variables().cellData(globalIdxJ); // neighbor cell center in global coordinates - const GlobalPosition& globalPosNeighbor = neighborPointer->geometry().center(); + const GlobalPosition& globalPosNeighbor = neighbor.geometry().center(); // distance vector between barycenters DimVector distVec = globalPosNeighbor - globalPos; @@ -151,8 +150,8 @@ public: // get permeability problem_.spatialParams().meanK(meanPermeability, - problem_.spatialParams().intrinsicPermeability(*element), - problem_.spatialParams().intrinsicPermeability(*neighborPointer)); + problem_.spatialParams().intrinsicPermeability(element), + problem_.spatialParams().intrinsicPermeability(neighbor)); Scalar mobilityWJ = 0; @@ -170,9 +169,9 @@ public: fluidState.setPressure(nPhaseIdx, referencePressure); fluidState.setTemperature(temperature); - mobilityWJ = MaterialLaw::krw(problem_.spatialParams().materialLawParams(*neighborPointer), satJ); + mobilityWJ = MaterialLaw::krw(problem_.spatialParams().materialLawParams(neighbor), satJ); mobilityWJ /= FluidSystem::viscosity(fluidState, wPhaseIdx); - mobilityNwJ = MaterialLaw::krn(problem_.spatialParams().materialLawParams(*neighborPointer), satJ); + mobilityNwJ = MaterialLaw::krn(problem_.spatialParams().materialLawParams(neighbor), satJ); mobilityNwJ /= FluidSystem::viscosity(fluidState, nPhaseIdx); } Scalar mobilityWMean = 0.5*(mobilityWI + mobilityWJ); @@ -195,7 +194,7 @@ public: } // get permeability problem_.spatialParams().meanK(meanPermeability, - problem_.spatialParams().intrinsicPermeability(*element)); + problem_.spatialParams().intrinsicPermeability(element)); Scalar mobilityWJ = 0; Scalar mobilityNwJ = 0; @@ -205,9 +204,9 @@ public: fluidState.setPressure(wPhaseIdx, referencePressure); fluidState.setPressure(nPhaseIdx, referencePressure); fluidState.setTemperature(temperature); - mobilityWJ = MaterialLaw::krw(problem_.spatialParams().materialLawParams(*element), satJ); + mobilityWJ = MaterialLaw::krw(problem_.spatialParams().materialLawParams(element), satJ); mobilityWJ /= FluidSystem::viscosity(fluidState, wPhaseIdx); - mobilityNwJ = MaterialLaw::krn(problem_.spatialParams().materialLawParams(*element), satJ); + mobilityNwJ = MaterialLaw::krn(problem_.spatialParams().materialLawParams(element), satJ); mobilityNwJ /= FluidSystem::viscosity(fluidState, nPhaseIdx); Scalar mobWMean = 0.5 * (mobilityWI + mobilityWJ); diff --git a/dumux/decoupled/2p/transport/fv/evalcflfluxcoats.hh b/dumux/decoupled/2p/transport/fv/evalcflfluxcoats.hh index 5aa2f5213ef5d4dc125621a9b3222004eded45ff..0d2b0f54443539a1fd54851199617384654ca7ad 100644 --- a/dumux/decoupled/2p/transport/fv/evalcflfluxcoats.hh +++ b/dumux/decoupled/2p/transport/fv/evalcflfluxcoats.hh @@ -77,7 +77,6 @@ private: }; typedef typename GridView::Traits::template Codim<0>::Entity Element; - typedef typename GridView::template Codim<0>::EntityPointer ElementPointer; typedef typename GridView::template Codim<0>::Iterator ElementIterator; typedef typename GridView::Intersection Intersection; @@ -321,13 +320,13 @@ void EvalCflFluxCoats<TypeTag>::addCoatsFlux(Scalar& lambdaW, Scalar& lambdaNw, if (lambdaT <= threshold_) return; - ElementPointer element = intersection.inside(); + auto element = intersection.inside(); //coordinates of cell center - const GlobalPosition& globalPos = element->geometry().center(); + const GlobalPosition& globalPos = element.geometry().center(); // cell index - int globalIdxI = problem_.variables().index(*element); + int globalIdxI = problem_.variables().index(element); CellData& cellDataI = problem_.variables().cellData(globalIdxI); @@ -345,15 +344,15 @@ void EvalCflFluxCoats<TypeTag>::addCoatsFlux(Scalar& lambdaW, Scalar& lambdaNw, Scalar lambdaWI = cellDataI.mobility(wPhaseIdx); Scalar lambdaNwI = cellDataI.mobility(nPhaseIdx); - Scalar dpc_dsI = MaterialLaw::dpc_dsw(problem_.spatialParams().materialLawParams(*element), satI); + Scalar dpc_dsI = MaterialLaw::dpc_dsw(problem_.spatialParams().materialLawParams(element), satI); const GlobalPosition& unitOuterNormal = intersection.centerUnitOuterNormal(); if (intersection.neighbor()) { - ElementPointer neighbor = intersection.outside(); + auto neighbor = intersection.outside(); - int globalIdxJ = problem_.variables().index(*neighbor); + int globalIdxJ = problem_.variables().index(neighbor); CellData& cellDataJ = problem_.variables().cellData(globalIdxJ); @@ -365,7 +364,7 @@ void EvalCflFluxCoats<TypeTag>::addCoatsFlux(Scalar& lambdaW, Scalar& lambdaNw, return; } - if (element->level() != neighbor->level()) + if (element.level() != neighbor.level()) { rejectForTimeStepping_ = true; cflFluxFunctionCoatsIn_ = 0; @@ -373,7 +372,7 @@ void EvalCflFluxCoats<TypeTag>::addCoatsFlux(Scalar& lambdaW, Scalar& lambdaNw, return; } - bool takeNeighbor = (element->level() < neighbor->level()); + bool takeNeighbor = (element.level() < neighbor.level()); //get phase potentials bool upwindWI = (takeNeighbor) ? !cellDataJ.fluxData().isUpwindCell(wPhaseIdx, intersection.indexInOutside()) : @@ -382,7 +381,7 @@ void EvalCflFluxCoats<TypeTag>::addCoatsFlux(Scalar& lambdaW, Scalar& lambdaNw, (takeNeighbor) ? !cellDataJ.fluxData().isUpwindCell(nPhaseIdx, intersection.indexInOutside()) : cellDataI.fluxData().isUpwindCell(nPhaseIdx, indexInInside); - const GlobalPosition& globalPosNeighbor = neighbor->geometry().center(); + const GlobalPosition& globalPosNeighbor = neighbor.geometry().center(); // distance vector between barycenters GlobalPosition distVec = globalPosNeighbor - globalPos; @@ -394,18 +393,18 @@ void EvalCflFluxCoats<TypeTag>::addCoatsFlux(Scalar& lambdaW, Scalar& lambdaNw, Scalar lambdaWJ = cellDataI.mobility(wPhaseIdx); Scalar lambdaNwJ = cellDataI.mobility(nPhaseIdx); - Scalar dpc_dsJ = MaterialLaw::dpc_dsw(problem_.spatialParams().materialLawParams(*neighbor), satJ); + Scalar dpc_dsJ = MaterialLaw::dpc_dsw(problem_.spatialParams().materialLawParams(neighbor), satJ); // compute vectorized permeabilities DimVector permeability(0); DimMatrix perm(0); - problem_.spatialParams().meanK(perm, problem_.spatialParams().intrinsicPermeability(*element)); + problem_.spatialParams().meanK(perm, problem_.spatialParams().intrinsicPermeability(element)); perm.mv(unitOuterNormal, permeability); Scalar perm1 = permeability * unitOuterNormal; permeability = 0; - problem_.spatialParams().meanK(perm, problem_.spatialParams().intrinsicPermeability(*neighbor)); + problem_.spatialParams().meanK(perm, problem_.spatialParams().intrinsicPermeability(neighbor)); perm.mv(unitOuterNormal, permeability); Scalar perm2 = permeability * unitOuterNormal; @@ -434,8 +433,8 @@ void EvalCflFluxCoats<TypeTag>::addCoatsFlux(Scalar& lambdaW, Scalar& lambdaNw, ds += epsDerivative_; } - Scalar dLambdaWDs = MaterialLaw::krw(problem_.spatialParams().materialLawParams(*neighbor), std::abs(satPlus)) / viscosityW; - dLambdaWDs -= MaterialLaw::krw(problem_.spatialParams().materialLawParams(*neighbor), std::abs(satMinus)) / viscosityW; + Scalar dLambdaWDs = MaterialLaw::krw(problem_.spatialParams().materialLawParams(neighbor), std::abs(satPlus)) / viscosityW; + dLambdaWDs -= MaterialLaw::krw(problem_.spatialParams().materialLawParams(neighbor), std::abs(satMinus)) / viscosityW; dLambdaWDs /= (ds); if (upwindNwI) @@ -457,8 +456,8 @@ void EvalCflFluxCoats<TypeTag>::addCoatsFlux(Scalar& lambdaW, Scalar& lambdaNw, ds += epsDerivative_; } - Scalar dLambdaNwDs = MaterialLaw::krn(problem_.spatialParams().materialLawParams(*neighbor), satPlus) / viscosityNw; - dLambdaNwDs -= MaterialLaw::krn(problem_.spatialParams().materialLawParams(*neighbor), satMinus) / viscosityNw; + Scalar dLambdaNwDs = MaterialLaw::krn(problem_.spatialParams().materialLawParams(neighbor), satPlus) / viscosityNw; + dLambdaNwDs -= MaterialLaw::krn(problem_.spatialParams().materialLawParams(neighbor), satMinus) / viscosityNw; dLambdaNwDs /= (ds); Scalar lambdaWCap = 0.5 * (lambdaWI + lambdaWJ); @@ -501,7 +500,7 @@ void EvalCflFluxCoats<TypeTag>::addCoatsFlux(Scalar& lambdaW, Scalar& lambdaNw, Dune::FieldVector<Scalar, dim> permeability(0); DimMatrix perm(0); - problem_.spatialParams().meanK(perm, problem_.spatialParams().intrinsicPermeability(*element)); + problem_.spatialParams().meanK(perm, problem_.spatialParams().intrinsicPermeability(element)); perm.mv(unitOuterNormal, permeability); Scalar faceArea = intersection.geometry().volume(); @@ -545,13 +544,13 @@ void EvalCflFluxCoats<TypeTag>::addCoatsFlux(Scalar& lambdaW, Scalar& lambdaNw, case pw: { potWBound = bcValues[eqIdxPress] + density_[wPhaseIdx] * gdeltaZ; - potNwBound = bcValues[eqIdxPress] + MaterialLaw::pc(problem_.spatialParams().materialLawParams(*element), satWBound) + potNwBound = bcValues[eqIdxPress] + MaterialLaw::pc(problem_.spatialParams().materialLawParams(element), satWBound) + density_[nPhaseIdx] * gdeltaZ; break; } case pn: { - potWBound = bcValues[eqIdxPress] - MaterialLaw::pc(problem_.spatialParams().materialLawParams(*element),satWBound) + potWBound = bcValues[eqIdxPress] - MaterialLaw::pc(problem_.spatialParams().materialLawParams(element),satWBound) + density_[wPhaseIdx] * gdeltaZ; potNwBound = bcValues[eqIdxPress] + density_[nPhaseIdx] * gdeltaZ; break; @@ -588,12 +587,12 @@ void EvalCflFluxCoats<TypeTag>::addCoatsFlux(Scalar& lambdaW, Scalar& lambdaNw, if (hasPotWBound && !hasPotNwBound) { - potNwBound = potWBound + MaterialLaw::pc(problem_.spatialParams().materialLawParams(*element),satWBound) + potNwBound = potWBound + MaterialLaw::pc(problem_.spatialParams().materialLawParams(element),satWBound) + (density_[nPhaseIdx] - density_[wPhaseIdx]) * gdeltaZ; } else if (!hasPotWBound && hasPotNwBound) { - potWBound = potNwBound - MaterialLaw::pc(problem_.spatialParams().materialLawParams(*element),satWBound) + potWBound = potNwBound - MaterialLaw::pc(problem_.spatialParams().materialLawParams(element),satWBound) + (density_[nPhaseIdx] - density_[wPhaseIdx]) * gdeltaZ; } } @@ -635,13 +634,13 @@ void EvalCflFluxCoats<TypeTag>::addCoatsFlux(Scalar& lambdaW, Scalar& lambdaNw, return; } - Scalar dpc_dsBound = MaterialLaw::dpc_dsw(problem_.spatialParams().materialLawParams(*element), satWBound); + Scalar dpc_dsBound = MaterialLaw::dpc_dsw(problem_.spatialParams().materialLawParams(element), satWBound); Scalar lambdaWBound = 0; Scalar lambdaNwBound = 0; - Scalar temperature = problem_.temperature(*element); - Scalar referencePressure = problem_.referencePressure(*element); + Scalar temperature = problem_.temperature(element); + Scalar referencePressure = problem_.referencePressure(element); FluidState fluidState; fluidState.setPressure(wPhaseIdx, referencePressure); fluidState.setPressure(nPhaseIdx, referencePressure); @@ -650,8 +649,8 @@ void EvalCflFluxCoats<TypeTag>::addCoatsFlux(Scalar& lambdaW, Scalar& lambdaNw, Scalar viscosityWBound = FluidSystem::viscosity(fluidState, wPhaseIdx); Scalar viscosityNwBound = FluidSystem::viscosity(fluidState, nPhaseIdx); - lambdaWBound = MaterialLaw::krw(problem_.spatialParams().materialLawParams(*element), satWBound) / viscosityWBound; - lambdaNwBound = MaterialLaw::krn(problem_.spatialParams().materialLawParams(*element), satWBound) / viscosityNwBound; + lambdaWBound = MaterialLaw::krw(problem_.spatialParams().materialLawParams(element), satWBound) / viscosityWBound; + lambdaNwBound = MaterialLaw::krn(problem_.spatialParams().materialLawParams(element), satWBound) / viscosityNwBound; Scalar satUpw = 0; if (cellDataI.fluxData().isUpwindCell(wPhaseIdx, indexInInside)) @@ -673,8 +672,8 @@ void EvalCflFluxCoats<TypeTag>::addCoatsFlux(Scalar& lambdaW, Scalar& lambdaNw, ds += epsDerivative_; } - Scalar dLambdaWDs = MaterialLaw::krw(problem_.spatialParams().materialLawParams(*element), satPlus) / viscosityW; - dLambdaWDs -= MaterialLaw::krw(problem_.spatialParams().materialLawParams(*element), satMinus) / viscosityW; + Scalar dLambdaWDs = MaterialLaw::krw(problem_.spatialParams().materialLawParams(element), satPlus) / viscosityW; + dLambdaWDs -= MaterialLaw::krw(problem_.spatialParams().materialLawParams(element), satMinus) / viscosityW; dLambdaWDs /= (ds); if (cellDataI.fluxData().isUpwindCell(nPhaseIdx, indexInInside)) @@ -696,8 +695,8 @@ void EvalCflFluxCoats<TypeTag>::addCoatsFlux(Scalar& lambdaW, Scalar& lambdaNw, ds += epsDerivative_; } - Scalar dLambdaNwDs = MaterialLaw::krn(problem_.spatialParams().materialLawParams(*element), satPlus) / viscosityNw; - dLambdaNwDs -= MaterialLaw::krn(problem_.spatialParams().materialLawParams(*element), satMinus) / viscosityNw; + Scalar dLambdaNwDs = MaterialLaw::krn(problem_.spatialParams().materialLawParams(element), satPlus) / viscosityNw; + dLambdaNwDs -= MaterialLaw::krn(problem_.spatialParams().materialLawParams(element), satMinus) / viscosityNw; dLambdaNwDs /= (ds); Scalar lambdaWCap = 0.5 * (lambdaWI + lambdaWBound); diff --git a/dumux/decoupled/2p/transport/fv/fvsaturation2p.hh b/dumux/decoupled/2p/transport/fv/fvsaturation2p.hh index b8ad02192f3406090b15f0de3a1c7bd7298f6eba..3d5fdae09bd6940aca17d211ecb94e00e727951d 100644 --- a/dumux/decoupled/2p/transport/fv/fvsaturation2p.hh +++ b/dumux/decoupled/2p/transport/fv/fvsaturation2p.hh @@ -128,7 +128,6 @@ class FVSaturation2P: public FVTransport<TypeTag> typedef typename GridView::Traits::template Codim<0>::Entity Element; typedef typename GridView::template Codim<0>::Iterator ElementIterator; - typedef typename GridView::template Codim<0>::EntityPointer ElementPointer; typedef typename GridView::Intersection Intersection; typedef Dune::FieldVector<Scalar, dimWorld> GlobalPosition; @@ -532,18 +531,18 @@ private: template<class TypeTag> void FVSaturation2P<TypeTag>::getFlux(Scalar& update, const Intersection& intersection, CellData& cellDataI) { - ElementPointer elementI = intersection.inside(); - ElementPointer elementJ = intersection.outside(); + auto elementI = intersection.inside(); + auto elementJ = intersection.outside(); - const CellData& cellDataJ = problem_.variables().cellData(problem_.variables().index(*elementJ)); + const CellData& cellDataJ = problem_.variables().cellData(problem_.variables().index(elementJ)); // get global coordinates of cell centers - const GlobalPosition& globalPosI = elementI->geometry().center(); - const GlobalPosition& globalPosJ = elementJ->geometry().center(); + const GlobalPosition& globalPosI = elementI.geometry().center(); + const GlobalPosition& globalPosJ = elementJ.geometry().center(); // cell volume, assume linear map here - Scalar volume = elementI->geometry().volume(); - Scalar porosity = std::max(problem_.spatialParams().porosity(*elementI), porosityThreshold_); + Scalar volume = elementI.geometry().volume(); + Scalar porosity = std::max(problem_.spatialParams().porosity(elementI), porosityThreshold_); if (compressibility_) { @@ -573,7 +572,7 @@ void FVSaturation2P<TypeTag>::getFlux(Scalar& update, const Intersection& inters // compute distance between cell centers Scalar dist = distVec.two_norm(); - bool takeNeighbor = (elementI->level() < elementJ->level()); + bool takeNeighbor = (elementI.level() < elementJ.level()); //get phase potentials bool upwindWI = (takeNeighbor) ? !cellDataJ.fluxData().isUpwindCell(wPhaseIdx, intersection.indexInOutside()) : @@ -723,17 +722,17 @@ void FVSaturation2P<TypeTag>::getFlux(Scalar& update, const Intersection& inters template<class TypeTag> void FVSaturation2P<TypeTag>::getFluxOnBoundary(Scalar& update, const Intersection& intersection, CellData& cellDataI) { - ElementPointer elementI = intersection.inside(); + auto elementI = intersection.inside(); // get global coordinates of cell centers - const GlobalPosition& globalPosI = elementI->geometry().center(); + const GlobalPosition& globalPosI = elementI.geometry().center(); // center of face in global coordinates const GlobalPosition& globalPosJ = intersection.geometry().center(); // cell volume, assume linear map here - Scalar volume = elementI->geometry().volume(); - Scalar porosity = std::max(problem_.spatialParams().porosity(*elementI), porosityThreshold_); + Scalar volume = elementI.geometry().volume(); + Scalar porosity = std::max(problem_.spatialParams().porosity(elementI), porosityThreshold_); if (compressibility_) { @@ -792,7 +791,7 @@ void FVSaturation2P<TypeTag>::getFluxOnBoundary(Scalar& update, const Intersecti } } - Scalar pcBound = MaterialLaw::pc(problem_.spatialParams().materialLawParams(*elementI), satWBound); + Scalar pcBound = MaterialLaw::pc(problem_.spatialParams().materialLawParams(elementI), satWBound); Scalar lambdaW = 0; Scalar lambdaNw = 0; @@ -810,12 +809,12 @@ void FVSaturation2P<TypeTag>::getFluxOnBoundary(Scalar& update, const Intersecti { if (compressibility_) { - lambdaW = MaterialLaw::krw(problem_.spatialParams().materialLawParams(*elementI), satWBound) + lambdaW = MaterialLaw::krw(problem_.spatialParams().materialLawParams(elementI), satWBound) / FluidSystem::viscosity(cellDataI.fluidState(), wPhaseIdx); } else { - lambdaW = MaterialLaw::krw(problem_.spatialParams().materialLawParams(*elementI), satWBound) + lambdaW = MaterialLaw::krw(problem_.spatialParams().materialLawParams(elementI), satWBound) / viscosity_[wPhaseIdx]; } } @@ -832,12 +831,12 @@ void FVSaturation2P<TypeTag>::getFluxOnBoundary(Scalar& update, const Intersecti { if (compressibility_) { - lambdaNw = MaterialLaw::krn(problem_.spatialParams().materialLawParams(*elementI), satWBound) + lambdaNw = MaterialLaw::krn(problem_.spatialParams().materialLawParams(elementI), satWBound) / FluidSystem::viscosity(cellDataI.fluidState(), nPhaseIdx); } else { - lambdaNw = MaterialLaw::krn(problem_.spatialParams().materialLawParams(*elementI), satWBound) + lambdaNw = MaterialLaw::krn(problem_.spatialParams().materialLawParams(elementI), satWBound) / viscosity_[nPhaseIdx]; } } diff --git a/dumux/decoupled/2p/transport/fv/gravitypart.hh b/dumux/decoupled/2p/transport/fv/gravitypart.hh index f4a26cad4d867323b376708af0406491cab94407..3cfaf2c6057dc6dbca36addd20d2973b1dc32e24 100644 --- a/dumux/decoupled/2p/transport/fv/gravitypart.hh +++ b/dumux/decoupled/2p/transport/fv/gravitypart.hh @@ -70,7 +70,6 @@ private: wPhaseIdx = Indices::wPhaseIdx, nPhaseIdx = Indices::nPhaseIdx, numPhases = GET_PROP_VALUE(TypeTag, NumPhases) }; - typedef typename GridView::template Codim<0>::EntityPointer ElementPointer; typedef typename GridView::template Codim<0>::Iterator ElementIterator; typedef typename GridView::Intersection Intersection; typedef Dune::FieldVector<Scalar, dim> DimVector; @@ -88,9 +87,9 @@ public: */ void getFlux(DimVector& flux, const Intersection& intersection, const Scalar satI, const Scalar satJ) const { - ElementPointer element = intersection.inside(); + auto element = intersection.inside(); - int globalIdxI = problem_.variables().index(*element); + int globalIdxI = problem_.variables().index(element); CellData& cellDataI = problem_.variables().cellData(globalIdxI); int indexInInside = intersection.indexInInside(); @@ -108,9 +107,9 @@ public: } else { - lambdaWI = MaterialLaw::krw(problem_.spatialParams().materialLawParams(*element), satI); + lambdaWI = MaterialLaw::krw(problem_.spatialParams().materialLawParams(element), satI); lambdaWI /= viscosity_[wPhaseIdx]; - lambdaNwI = MaterialLaw::krn(problem_.spatialParams().materialLawParams(*element), satI); + lambdaNwI = MaterialLaw::krn(problem_.spatialParams().materialLawParams(element), satI); lambdaNwI /= viscosity_[nPhaseIdx]; } @@ -125,17 +124,17 @@ public: if (intersection.neighbor()) { // access neighbor - ElementPointer neighborPointer = intersection.outside(); + auto neighbor = intersection.outside(); - int globalIdxJ = problem_.variables().index(*neighborPointer); + int globalIdxJ = problem_.variables().index(neighbor); CellData& cellDataJ = problem_.variables().cellData(globalIdxJ); - distVec = neighborPointer->geometry().center() - element->geometry().center(); + distVec = neighbor.geometry().center() - element.geometry().center(); // get permeability problem_.spatialParams().meanK(meanPermeability, - problem_.spatialParams().intrinsicPermeability(*element), - problem_.spatialParams().intrinsicPermeability(*neighborPointer)); + problem_.spatialParams().intrinsicPermeability(element), + problem_.spatialParams().intrinsicPermeability(neighbor)); //get lambda_bar = lambda_n*f_w if (preComput_) @@ -145,9 +144,9 @@ public: } else { - lambdaWJ = MaterialLaw::krw(problem_.spatialParams().materialLawParams(*neighborPointer), satJ); + lambdaWJ = MaterialLaw::krw(problem_.spatialParams().materialLawParams(neighbor), satJ); lambdaWJ /= viscosity_[wPhaseIdx]; - lambdaNwJ = MaterialLaw::krn(problem_.spatialParams().materialLawParams(*neighborPointer), satJ); + lambdaNwJ = MaterialLaw::krn(problem_.spatialParams().materialLawParams(neighbor), satJ); lambdaNwJ /= viscosity_[nPhaseIdx]; } @@ -160,14 +159,14 @@ public: { // get permeability problem_.spatialParams().meanK(meanPermeability, - problem_.spatialParams().intrinsicPermeability(*element)); + problem_.spatialParams().intrinsicPermeability(element)); - distVec = intersection.geometry().center() - element->geometry().center(); + distVec = intersection.geometry().center() - element.geometry().center(); //calculate lambda_n*f_w at the boundary - lambdaWJ = MaterialLaw::krw(problem_.spatialParams().materialLawParams(*element), satJ); + lambdaWJ = MaterialLaw::krw(problem_.spatialParams().materialLawParams(element), satJ); lambdaWJ /= viscosity_[wPhaseIdx]; - lambdaNwJ = MaterialLaw::krn(problem_.spatialParams().materialLawParams(*element), satJ); + lambdaNwJ = MaterialLaw::krn(problem_.spatialParams().materialLawParams(element), satJ); lambdaNwJ /= viscosity_[nPhaseIdx]; //If potential is zero always take value from the boundary! diff --git a/dumux/decoupled/2p2c/fv2dpressure2p2cadaptive.hh b/dumux/decoupled/2p2c/fv2dpressure2p2cadaptive.hh index f4c1e33fad5d31d4c94b9837129ff78a2699f905..e2afd49747f6f9d47298aa385ca234ae62a89f48 100644 --- a/dumux/decoupled/2p2c/fv2dpressure2p2cadaptive.hh +++ b/dumux/decoupled/2p2c/fv2dpressure2p2cadaptive.hh @@ -106,7 +106,6 @@ template<class TypeTag> class FV2dPressure2P2CAdaptive // typedefs to abbreviate several dune classes... typedef typename GridView::template Codim<0>::Iterator ElementIterator; - typedef typename GridView::template Codim<0>::EntityPointer ElementPointer; typedef typename GridView::Intersection Intersection; typedef typename GridView::IntersectionIterator IntersectionIterator; @@ -257,7 +256,7 @@ void FV2dPressure2P2CAdaptive<TypeTag>::initializeMatrix() rowSize++; // if mpfa is used, more entries might be needed if both halfedges are regarded - if (enableMPFA && (enableSecondHalfEdge && isIt->outside()->level() != eIt->level())) + if (enableMPFA && (enableSecondHalfEdge && isIt->outside().level() != eIt->level())) { GlobalPosition globalPos3(0.); int globalIdx3=-1; @@ -284,13 +283,13 @@ void FV2dPressure2P2CAdaptive<TypeTag>::initializeMatrix() } //also check if additional cell was already used for another interaction triangle for (unsigned int i = 0; i < foundAdditionals.size(); i++) - if(foundAdditionals[i] == problem().variables().index(*additionalIsIt->outside())) + if(foundAdditionals[i] == problem().variables().index(additionalIsIt->outside())) increaseRowSize = false; if (increaseRowSize) { rowSize++; - foundAdditionals.push_back(problem().variables().index(*additionalIsIt->outside())); + foundAdditionals.push_back(problem().variables().index(additionalIsIt->outside())); } } } @@ -317,14 +316,13 @@ void FV2dPressure2P2CAdaptive<TypeTag>::initializeMatrix() if (isIt->neighbor()) { // access neighbor - ElementPointer outside = isIt->outside(); - int globalIdxJ = problem().variables().index(*outside); + int globalIdxJ = problem().variables().index(isIt->outside()); // add off diagonal index this->A_.addindex(globalIdxI, globalIdxJ); // if mpfa is used, more entries might be needed if both halfedges are regarded - if (enableMPFA && (enableSecondHalfEdge && isIt->outside()->level() != eIt->level())) + if (enableMPFA && (enableSecondHalfEdge && isIt->outside().level() != eIt->level())) { GlobalPosition globalPos3(0.); int globalIdx3=-1; @@ -339,7 +337,7 @@ void FV2dPressure2P2CAdaptive<TypeTag>::initializeMatrix() globalPos3, globalIdx3 ); // add off diagonal index if 2 half-edges regarded if(halfedgesStored == 2) - this->A_.addindex(globalIdxI, problem().variables().index(*additionalIsIt->outside())); + this->A_.addindex(globalIdxI, problem().variables().index(additionalIsIt->outside())); } } } @@ -397,19 +395,19 @@ void FV2dPressure2P2CAdaptive<TypeTag>::assemble(bool first) /************* handle interior face *****************/ if (isIt->neighbor()) { - ElementPointer elementNeighbor = isIt->outside(); + auto elementNeighbor = isIt->outside(); - int globalIdxJ = problem().variables().index(*elementNeighbor); + int globalIdxJ = problem().variables().index(elementNeighbor); //check for hanging nodes //take a hanging node never from the element with smaller level! - bool haveSameLevel = (eIt->level() == elementNeighbor->level()); + bool haveSameLevel = (eIt->level() == elementNeighbor.level()); // 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) + && elementNeighbor.partitionType() == Dune::InteriorEntity) continue; entries = 0; @@ -433,7 +431,7 @@ void FV2dPressure2P2CAdaptive<TypeTag>::assemble(bool first) // The second condition is needed to not spoil the ghost element entries if (GET_PROP_VALUE(TypeTag, VisitFacesOnlyOnce) - && elementNeighbor->partitionType() == Dune::InteriorEntity) + && elementNeighbor.partitionType() == Dune::InteriorEntity) { this->f_[globalIdxJ] += entries[rhs]; this->A_[globalIdxJ][globalIdxJ] += entries[matrix]; @@ -504,28 +502,28 @@ void FV2dPressure2P2CAdaptive<TypeTag>::getMpfaFlux(const IntersectionIterator& const CellData& cellDataI) { // acess Cell I - ElementPointer elementPointerI = intersectionIterator->inside(); - int globalIdxI = problem().variables().index(*elementPointerI); + auto elementI = intersectionIterator->inside(); + int globalIdxI = problem().variables().index(elementI); // get global coordinate of cell center - const GlobalPosition& globalPos = elementPointerI->geometry().center(); + const GlobalPosition& globalPos = elementI.geometry().center(); // cell volume & perimeter, assume linear map here - Scalar volume = elementPointerI->geometry().volume(); + Scalar volume = elementI.geometry().volume(); Scalar perimeter = cellDataI.perimeter(); const GlobalPosition& gravity_ = problem().gravity(); // get absolute permeability - DimMatrix permeabilityI(problem().spatialParams().intrinsicPermeability(*elementPointerI)); + DimMatrix permeabilityI(problem().spatialParams().intrinsicPermeability(elementI)); // access neighbor - ElementPointer neighborPointer = intersectionIterator->outside(); - int globalIdxJ = problem().variables().index(*neighborPointer); + auto neighbor = intersectionIterator->outside(); + int globalIdxJ = problem().variables().index(neighbor); CellData& cellDataJ = problem().variables().cellData(globalIdxJ); // gemotry info of neighbor - const GlobalPosition& globalPosNeighbor = neighborPointer->geometry().center(); + const GlobalPosition& globalPosNeighbor = neighbor.geometry().center(); // distance vector between barycenters GlobalPosition distVec = globalPosNeighbor - globalPos; @@ -537,7 +535,7 @@ void FV2dPressure2P2CAdaptive<TypeTag>::getMpfaFlux(const IntersectionIterator& unitDistVec /= dist; DimMatrix permeabilityJ - = problem().spatialParams().intrinsicPermeability(*neighborPointer); + = problem().spatialParams().intrinsicPermeability(neighbor); // compute vectorized permeabilities DimMatrix meanPermeability(0); @@ -556,7 +554,7 @@ void FV2dPressure2P2CAdaptive<TypeTag>::getMpfaFlux(const IntersectionIterator& // determine volume derivatives in neighbor if (!cellDataJ.hasVolumeDerivatives()) - this->volumeDerivatives(globalPosNeighbor, *neighborPointer); + this->volumeDerivatives(globalPosNeighbor, neighbor); Scalar dv_dC1 = (cellDataJ.dv(wPhaseIdx) + cellDataI.dv(wPhaseIdx)) / 2; // dV/dm1= dv/dC^1 @@ -616,17 +614,17 @@ void FV2dPressure2P2CAdaptive<TypeTag>::getMpfaFlux(const IntersectionIterator& // regard second half edge, if there is one if(halfedgesStored == 2) { - int AdditionalIdx = problem().variables().index(*(additionalIsIt->outside())); + int AdditionalIdx = problem().variables().index(additionalIsIt->outside()); CellData& cellDataAdditional = problem().variables().cellData(AdditionalIdx); potentialW += (cellDataI.pressure(wPhaseIdx)-temp1*densityW) * additionalT[2] + (cellDataJ.pressure(wPhaseIdx)-temp2*densityW) * additionalT[0] + (cellDataAdditional.pressure(wPhaseIdx) - -(additionalIsIt->outside()->geometry().center()*gravity_) + -(additionalIsIt->outside().geometry().center()*gravity_) *densityW) * additionalT[1]; potentialNW += (cellDataI.pressure(nPhaseIdx)-temp1*densityNW) * additionalT[2] + (cellDataJ.pressure(nPhaseIdx)-temp2*densityNW) * additionalT[0] + (cellDataAdditional.pressure(nPhaseIdx) - -(additionalIsIt->outside()->geometry().center()*gravity_) + -(additionalIsIt->outside().geometry().center()*gravity_) *densityNW) * additionalT[1]; } @@ -720,7 +718,7 @@ void FV2dPressure2P2CAdaptive<TypeTag>::getMpfaFlux(const IntersectionIterator& // include second half-edge if(halfedgesStored == 2) { - int AdditionalIdx = problem().variables().index(*(additionalIsIt->outside())); + int AdditionalIdx = problem().variables().index(additionalIsIt->outside()); CellData& cellDataAdditional = problem().variables().cellData(AdditionalIdx); /* extend T with other matrix entries and assemble to A_ */ @@ -731,7 +729,7 @@ void FV2dPressure2P2CAdaptive<TypeTag>::getMpfaFlux(const IntersectionIterator& // add gravity to RHS vector this->f_[globalIdxI] += (densityW * lambdaW * dV_w + densityNW * lambdaN * dV_n) * temp2 * additionalT[0]; this->f_[globalIdxI] += (densityW * lambdaW * dV_w + densityNW * lambdaN * dV_n) - * (additionalIsIt->outside()->geometry().center()*gravity_) * additionalT[1]; + * (additionalIsIt->outside().geometry().center()*gravity_) * additionalT[1]; this->f_[globalIdxI] += (densityW * lambdaW * dV_w + densityNW * lambdaN * dV_n) * temp1 * additionalT[2]; if(enableVolumeIntegral) // switch off volume integral for mpfa case @@ -744,7 +742,7 @@ void FV2dPressure2P2CAdaptive<TypeTag>::getMpfaFlux(const IntersectionIterator& // add gravity to RHS vector this->f_[globalIdxI] -= weightingFactor * (densityW * lambdaW * gV_w + densityNW * lambdaN * gV_n) * temp2 * additionalT[0]; this->f_[globalIdxI] -= weightingFactor * (densityW * lambdaW * gV_w + densityNW * lambdaN * gV_n) - * (additionalIsIt->outside()->geometry().center()*gravity_) * additionalT[1]; + * (additionalIsIt->outside().geometry().center()*gravity_) * additionalT[1]; this->f_[globalIdxI] -= weightingFactor * (densityW * lambdaW * gV_w + densityNW * lambdaN * gV_n) * temp1 * additionalT[2]; } @@ -806,13 +804,12 @@ int FV2dPressure2P2CAdaptive<TypeTag>::computeTransmissibilities(const Intersect int& globalIdx3) { // get geometry information of cellI = cell1, cellJ = cell2 - ElementPointer eIt = isIt->inside(); - ElementPointer neighborPointer = isIt->outside(); - GlobalPosition globalPos1 = eIt->geometry().center(); - GlobalPosition globalPos2 = neighborPointer->geometry().center(); - DimMatrix K1(problem().spatialParams().intrinsicPermeability(*eIt)); - DimMatrix K2(problem().spatialParams().intrinsicPermeability(*neighborPointer)); -// int debugIdx = problem().variables().index(*isIt->outside()); + auto element = isIt->inside(); + auto neighbor = isIt->outside(); + GlobalPosition globalPos1 = element.geometry().center(); + GlobalPosition globalPos2 = neighbor.geometry().center(); + DimMatrix K1(problem().spatialParams().intrinsicPermeability(element)); + DimMatrix K2(problem().spatialParams().intrinsicPermeability(neighbor)); /** 1) get geometrical information of interaction triangle */ // geometry and Data of face IJ in nomenclature of mpfa @@ -824,25 +821,20 @@ int FV2dPressure2P2CAdaptive<TypeTag>::computeTransmissibilities(const Intersect // nextIs points to next intersection IntersectionIterator nextIs = isIt; ++nextIs; - if (nextIs== problem().gridView().template iend(*eIt)) - nextIs = problem().gridView().template ibegin(*eIt); + if (nextIs== problem().gridView().template iend(element)) + nextIs = problem().gridView().template ibegin(element); // get last intersection : --intersection does not exist // paceingIt loops one IS bevore prevIs - IntersectionIterator prevIs = problem().gridView().template ibegin(*eIt); + IntersectionIterator prevIs = problem().gridView().template ibegin(element); IntersectionIterator paceingIt = prevIs; - for (++paceingIt; paceingIt != problem().gridView().template iend(*eIt); ++paceingIt) + for (++paceingIt; paceingIt != problem().gridView().template iend(element); ++paceingIt) { -// if((paceingIt->neighbor())) -// debugIdx = problem().variables().index(*paceingIt->outside()); -// if((prevIs->neighbor())) -// debugIdx = problem().variables().index(*prevIs->outside()); - if (!paceingIt->neighbor()) // continue if no neighbor found ++prevIs; // we investigate next paceingIt -> prevIs is also increased else if (paceingIt->outside() == isIt->outside()) // we already found prevIs break; - else if (paceingIt == problem().gridView().template iend(*eIt)) + else if (paceingIt == problem().gridView().template iend(element)) prevIs = paceingIt; // this could only happen if isIt is begin, so prevIs has to be last. else ++prevIs; // we investigate next paceingIt -> prevIs is also increased @@ -856,11 +848,9 @@ int FV2dPressure2P2CAdaptive<TypeTag>::computeTransmissibilities(const Intersect IntersectionIterator face23 = isIt; // as long as face23=isIt, it is still not found! // store other intersection for the other interaction region for the other half-edge - IntersectionIterator isIt23End = problem().gridView().iend(*neighborPointer); - for (IntersectionIterator isIt23 = problem().gridView().ibegin(*neighborPointer); isIt23 != isIt23End; ++isIt23) + IntersectionIterator isIt23End = problem().gridView().iend(neighbor); + for (IntersectionIterator isIt23 = problem().gridView().ibegin(neighbor); isIt23 != isIt23End; ++isIt23) { -// if((isIt23->neighbor())) -// debugIdx = problem().variables().index(*isIt23->outside()); // stop search if found if( (face13->outside() != isIt->outside())) break; @@ -872,9 +862,6 @@ int FV2dPressure2P2CAdaptive<TypeTag>::computeTransmissibilities(const Intersect // investigate if prevIs points to cell 3 if (prevIs->neighbor()) { -// if((prevIs->neighbor())) -// debugIdx = problem().variables().index(*prevIs->outside()); - if (prevIs->outside() == isIt23->outside()) { face23 = isIt23; @@ -885,9 +872,6 @@ int FV2dPressure2P2CAdaptive<TypeTag>::computeTransmissibilities(const Intersect // investigate if nextIs points to cell 3 if (nextIs->neighbor()) { -// if((nextIs->neighbor())) -// debugIdx = problem().variables().index(*nextIs->outside()); - if (nextIs->outside() == isIt23->outside()) { face23 = isIt23; @@ -900,8 +884,8 @@ int FV2dPressure2P2CAdaptive<TypeTag>::computeTransmissibilities(const Intersect Dune::dgrave << "is 13 not found!!!" << std::endl; // get information of cell3 - globalPos3 = face13->outside()->geometry().center(); - globalIdx3 = problem().variables().index(*(face13->outside())); + globalPos3 = face13->outside().geometry().center(); + globalIdx3 = problem().variables().index(face13->outside()); // get absolute permeability of neighbor cell 3 DimMatrix K3(problem().spatialParams().intrinsicPermeability(*(face13->outside()))); @@ -1046,15 +1030,15 @@ int FV2dPressure2P2CAdaptive<TypeTag>::computeTransmissibilities(const Intersect IntersectionIterator tempIntersection = face13; bool corner1245found = false; // ensure iterator increases over local end - if (tempIntersection== problem().gridView().template iend(*eIt)) - tempIntersection = problem().gridView().template ibegin(*eIt); + if (tempIntersection== problem().gridView().template iend(element)) + tempIntersection = problem().gridView().template ibegin(element); while (!corner1245found) { ++tempIntersection; // ensure iterator increases over local end - if (tempIntersection== problem().gridView().template iend(*eIt)) - tempIntersection = problem().gridView().template ibegin(*eIt); + if (tempIntersection== problem().gridView().template iend(element)) + tempIntersection = problem().gridView().template ibegin(element); // enshure we do not arrive at isIt if (tempIntersection == isIt) continue; @@ -1227,10 +1211,10 @@ int FV2dPressure2P2CAdaptive<TypeTag>::transmissibilityAdapter_(const Intersecti interactionVolume.setFacePosition(globalPosFace41, 0, 1); // access neighbor cell 2 of 'isIt12' - ElementPointer elementPointer2 = isIt->inside(); + auto element2 = isIt->inside(); //**************** store pointer 2 - interactionVolume.setSubVolumeElement(elementPointer2, 1); + interactionVolume.setSubVolumeElement(element2, 1); // interactionVolume.setIndexOnElement(isIt->indexInInside(), 1, 1); interactionVolume.setNormal(unitOuterNormal12, 1, 1); interactionVolume.setFaceArea(faceVol12, 1, 1); @@ -1238,10 +1222,10 @@ int FV2dPressure2P2CAdaptive<TypeTag>::transmissibilityAdapter_(const Intersecti //**************** data for cell 4 - ElementPointer elementPointer4 = isIt14->outside(); + auto element4 = isIt14->outside(); //store pointer 4 - interactionVolume.setSubVolumeElement(elementPointer4, 3); + interactionVolume.setSubVolumeElement(element4, 3); // interactionVolume.setIndexOnElement(globalIdx4, 3, 0); interactionVolume.setNormal(unitOuterNormal14, 3, 0); @@ -1249,9 +1233,9 @@ int FV2dPressure2P2CAdaptive<TypeTag>::transmissibilityAdapter_(const Intersecti interactionVolume.setFacePosition(globalPosFace41, 3, 0); //**************** data for cell 3 - ElementPointer elementPointer3 = isIt23->outside(); + auto element3 = isIt23->outside(); //store pointer 3 - interactionVolume.setSubVolumeElement(elementPointer3, 2); + interactionVolume.setSubVolumeElement(element3, 2); GlobalPosition globalPosFace23 = isIt23->geometry().center(); Scalar faceVol23 = isIt23->geometry().volume() / 2.0; @@ -1269,11 +1253,6 @@ int FV2dPressure2P2CAdaptive<TypeTag>::transmissibilityAdapter_(const Intersecti interactionVolume.setFacePosition(globalPosFace23, 1, 0); interactionVolume.setFacePosition(globalPosFace23, 2, 1); -// int globalIdx1 = problem().variables().index(*isIt->outside()); -// int globalIdx2 = problem().variables().index(*elementPointer2); -// int globalIdx3 = problem().variables().index(*elementPointer3); -// int globalIdx4 = problem().variables().index(*isIt14->outside()); - Dune::FieldVector<Scalar, dim> unity(1.); std::vector<Dune::FieldVector<Scalar, dim> > lambda(4, unity); diff --git a/dumux/decoupled/2p2c/fv2dtransport2p2cadaptive.hh b/dumux/decoupled/2p2c/fv2dtransport2p2cadaptive.hh index 1247f407b944f70805f3c486282c6b8f8b17874a..e524358db1e9638b742536f788ff7dc11ac74abf 100644 --- a/dumux/decoupled/2p2c/fv2dtransport2p2cadaptive.hh +++ b/dumux/decoupled/2p2c/fv2dtransport2p2cadaptive.hh @@ -83,7 +83,6 @@ class FV2dTransport2P2CAdaptive : public FVTransport2P2C<TypeTag> }; typedef typename GridView::template Codim<0>::Iterator ElementIterator; - typedef typename GridView::template Codim<0>::EntityPointer ElementPointer; typedef typename GridView::IntersectionIterator IntersectionIterator; typedef Dune::FieldVector<Scalar, dimWorld> GlobalPosition; @@ -227,7 +226,7 @@ void FV2dTransport2P2CAdaptive<TypeTag>::update(const Scalar t, Scalar& dt, Tran // handle interior face if (isIt->neighbor()) { - if (enableMPFA && (isIt->outside()->level() != eIt->level())) + if (enableMPFA && (isIt->outside().level() != eIt->level())) getMpfaFlux(entries, timestepFlux, isIt, cellDataI); else this->getFlux(entries, timestepFlux, *isIt, cellDataI); @@ -351,26 +350,26 @@ void FV2dTransport2P2CAdaptive<TypeTag>::getMpfaFlux(Dune::FieldVector<Scalar, 2 fluxEntries = 0.; timestepFlux = 0.; // cell information - ElementPointer elementI= intersectionIterator->inside(); - int globalIdxI = problem().variables().index(*elementI); + auto elementI = intersectionIterator->inside(); + int globalIdxI = problem().variables().index(elementI); // get position - const GlobalPosition globalPos = elementI->geometry().center(); + const GlobalPosition globalPos = elementI.geometry().center(); const GlobalPosition& gravity_ = problem().gravity(); // cell volume, assume linear map here - Scalar volume = elementI->geometry().volume(); + Scalar volume = elementI.geometry().volume(); // get values of cell I Scalar pressI = problem().pressureModel().pressure(globalIdxI); Scalar pcI = cellDataI.capillaryPressure(); - DimMatrix K_I(problem().spatialParams().intrinsicPermeability(*elementI)); + DimMatrix K_I(problem().spatialParams().intrinsicPermeability(elementI)); PhaseVector SmobI(0.); SmobI[wPhaseIdx] = std::max((cellDataI.saturation(wPhaseIdx) - - problem().spatialParams().materialLawParams(*elementI).swr()) + - problem().spatialParams().materialLawParams(elementI).swr()) , 1e-2); SmobI[nPhaseIdx] = std::max((cellDataI.saturation(nPhaseIdx) - - problem().spatialParams().materialLawParams(*elementI).snr()) + - problem().spatialParams().materialLawParams(elementI).snr()) , 1e-2); Scalar densityWI (0.), densityNWI(0.); @@ -380,12 +379,12 @@ void FV2dTransport2P2CAdaptive<TypeTag>::getMpfaFlux(Dune::FieldVector<Scalar, 2 PhaseVector potential(0.); // access neighbor - ElementPointer neighborPointer = intersectionIterator->outside(); - int globalIdxJ = problem().variables().index(*neighborPointer); + auto neighbor = intersectionIterator->outside(); + int globalIdxJ = problem().variables().index(neighbor); CellData& cellDataJ = problem().variables().cellData(globalIdxJ); // neighbor cell center in global coordinates - const GlobalPosition& globalPosNeighbor = neighborPointer->geometry().center(); + const GlobalPosition& globalPosNeighbor = neighbor.geometry().center(); // distance vector between barycenters GlobalPosition distVec = globalPosNeighbor - globalPos; @@ -440,18 +439,18 @@ void FV2dTransport2P2CAdaptive<TypeTag>::getMpfaFlux(Dune::FieldVector<Scalar, 2 // second half edge, if there is one if(halfedgesStored == 2) { - int AdditionalIdx = problem().variables().index(*(additionalIsIt->outside())); + int AdditionalIdx = problem().variables().index(additionalIsIt->outside()); CellData& cellDataAdditional = problem().variables().cellData(AdditionalIdx); potential[wPhaseIdx] += (pressI-temp1*densityW_mean) * additionalT[2] +(pressJ-temp2*densityW_mean) * additionalT[0] +(problem().pressureModel().pressure(AdditionalIdx) - -(additionalIsIt->outside()->geometry().center()*gravity_*densityW_mean) + -(additionalIsIt->outside().geometry().center()*gravity_*densityW_mean) ) * additionalT[1]; potential[nPhaseIdx] += (pressI+pcI-temp1*densityNW_mean) * additionalT[2] +(pressJ+pcJ-temp2*densityNW_mean) * additionalT[0] +(problem().pressureModel().pressure(AdditionalIdx) + cellDataAdditional.capillaryPressure() - -(additionalIsIt->outside()->geometry().center()*gravity_*densityNW_mean) + -(additionalIsIt->outside().geometry().center()*gravity_*densityNW_mean) ) * additionalT[1]; } } @@ -466,19 +465,19 @@ void FV2dTransport2P2CAdaptive<TypeTag>::getMpfaFlux(Dune::FieldVector<Scalar, 2 // second half edge, if there is one if(halfedgesStored == 2) { - int AdditionalIdx = problem().variables().index(*(additionalIsIt->outside())); + int AdditionalIdx = problem().variables().index(additionalIsIt->outside()); CellData& cellDataAdditional = problem().variables().cellData(AdditionalIdx); potential[wPhaseIdx] += (pressI-pcI-temp1*densityW_mean) * additionalT[2] +(pressJ-pcJ-temp2*densityW_mean) * additionalT[0] +(problem().pressureModel().pressure(AdditionalIdx) - cellDataAdditional.capillaryPressure() - -(additionalIsIt->outside()->geometry().center()*gravity_*densityW_mean) + -(additionalIsIt->outside().geometry().center()*gravity_*densityW_mean) ) * additionalT[1]; potential[nPhaseIdx] += (pressI-temp1*densityNW_mean) * additionalT[2] +(pressJ-temp2*densityNW_mean) * additionalT[0] +(problem().pressureModel().pressure(AdditionalIdx) - -(additionalIsIt->outside()->geometry().center()*gravity_*densityNW_mean)) + -(additionalIsIt->outside().geometry().center()*gravity_*densityNW_mean)) * additionalT[1]; } } @@ -500,19 +499,19 @@ void FV2dTransport2P2CAdaptive<TypeTag>::getMpfaFlux(Dune::FieldVector<Scalar, 2 if(potential[phaseIdx] > 0.) { lambda[phaseIdx] = cellDataI.mobility(phaseIdx); - if(elementI->level()>neighborPointer->level()) + if(elementI.level()>neighbor.level()) cellDataI.setUpwindCell(intersectionIterator->indexInInside(), contiEqIdx, true); } else if(potential[phaseIdx] < 0.) { lambda[phaseIdx] = cellDataJ.mobility(phaseIdx); - if(elementI->level()>neighborPointer->level()) + if(elementI.level()>neighbor.level()) cellDataI.setUpwindCell(intersectionIterator->indexInInside(), contiEqIdx, false); } else { doUpwinding[phaseIdx] = false; - if(elementI->level()>neighborPointer->level()) + if(elementI.level()>neighbor.level()) cellDataI.setUpwindCell(intersectionIterator->indexInInside(), contiEqIdx, false); else cellDataJ.setUpwindCell(intersectionIterator->indexInOutside(), contiEqIdx, false); @@ -522,7 +521,7 @@ void FV2dTransport2P2CAdaptive<TypeTag>::getMpfaFlux(Dune::FieldVector<Scalar, 2 { bool cellIwasUpwindCell; //get the information from smaller (higher level) cell, as its IS is unique - if(elementI->level()>neighborPointer->level()) + if(elementI.level()>neighbor.level()) cellIwasUpwindCell = cellDataI.isUpwindCell(intersectionIterator->indexInInside(), contiEqIdx); else // reverse neighbors information gathered cellIwasUpwindCell = !cellDataJ.isUpwindCell(intersectionIterator->indexInOutside(), contiEqIdx); diff --git a/dumux/decoupled/2p2c/fv3dpressure2p2cadaptive.hh b/dumux/decoupled/2p2c/fv3dpressure2p2cadaptive.hh index 93d19eaa67637514d3e2a994046a25c7d5978f5a..ce9f0b1cd2c417a7dc9c44e7e84cfdbc58cbb8d4 100644 --- a/dumux/decoupled/2p2c/fv3dpressure2p2cadaptive.hh +++ b/dumux/decoupled/2p2c/fv3dpressure2p2cadaptive.hh @@ -123,14 +123,13 @@ template<class TypeTag> class FV3dPressure2P2CAdaptive }; // typedefs to abbreviate several dune classes... + typedef typename GridView::Traits::template Codim<dim>::Entity Vertex; typedef typename GridView::Traits::template Codim<0>::Entity Element; typedef Dune::ReferenceElements<Scalar, dim> ReferenceElementContainer; typedef Dune::ReferenceElement<Scalar, dim> ReferenceElement; typedef typename GridView::template Codim<0>::Iterator ElementIterator; typedef typename GridView::Grid Grid; - typedef typename GridView::template Codim<0>::EntityPointer ElementPointer; - typedef typename GridView::template Codim<dim>::EntityPointer VertexPointer; typedef typename GridView::Intersection Intersection; typedef typename GridView::IntersectionIterator IntersectionIterator; @@ -271,31 +270,31 @@ private: const Implementation &asImp_() const { return *static_cast<const Implementation *>(this);} - int searchCommonVertex_(const Intersection& is, VertexPointer& vertexPointer) + int searchCommonVertex_(const Intersection& is, Vertex& vertex) { /******* get corner of interest ************/ // search through corners of large cell with isIt int localIdxLarge = 0; #if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4) - for(localIdxLarge = 0; localIdxLarge < is.inside()->subEntities(dim); ++localIdxLarge) + for(localIdxLarge = 0; localIdxLarge < is.inside().subEntities(dim); ++localIdxLarge) #else - for(localIdxLarge = 0; localIdxLarge<is.inside()->template count<dim>(); ++localIdxLarge) + for(localIdxLarge = 0; localIdxLarge<is.inside().template count<dim>(); ++localIdxLarge) #endif { - const VertexPointer vPtrLarge = is.inside()->template subEntity<dim>(localIdxLarge); + auto vLarge = is.inside().template subEntity<dim>(localIdxLarge); // search through corners of small cell with isIt #if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4) - for(int verticeSmall = 0; verticeSmall<is.outside()->subEntities(dim); ++verticeSmall) + for(int verticeSmall = 0; verticeSmall<is.outside().subEntities(dim); ++verticeSmall) #else - for(int verticeSmall = 0; verticeSmall<is.outside()->template count<dim>(); ++verticeSmall) + for(int verticeSmall = 0; verticeSmall<is.outside().template count<dim>(); ++verticeSmall) #endif { - const VertexPointer vPtrSmall = is.outside()->template subEntity<dim>(verticeSmall); + auto vSmall = is.outside().template subEntity<dim>(verticeSmall); - if(problem().variables().index(*vPtrSmall) == problem().variables().index(*vPtrLarge) ) + if(problem().variables().index(vSmall) == problem().variables().index(vLarge) ) { - vertexPointer = vPtrSmall; + vertex = vSmall; return localIdxLarge; } } @@ -308,8 +307,8 @@ protected: InteractionVolume& interactionVolume, const int& subVolumeFaceIdx, bool properFluxDirection, - ElementPointer& additional2, - ElementPointer& additional3, + Element& additional2, + Element& additional3, TransmissivityMatrix& additionalT); std::map<int, std::vector<int> > irregularCellMap_; //!< Container to store all cell's Indice with a hanging node @@ -373,14 +372,14 @@ void FV3dPressure2P2CAdaptive<TypeTag>::initializeMatrixRowSize() rowSize++; // special treatment for hanging nodes in the mpfa case - if (enableMPFA && (eIt->level() < isIt->outside()->level())) + if (enableMPFA && (eIt->level() < isIt->outside().level())) { // each cell might have 4 hanging nodes with 4 irregular neighbors each // get global ID of Interface from larger cell int intersectionID = problem().grid().localIdSet().subId(*eIt, isIt->indexInInside(), 1); //index outside - int eIdxGlobalJ = problem().variables().index(*isIt->outside()); + int eIdxGlobalJ = problem().variables().index(isIt->outside()); // add Entry of current neighbor cell to the IS seen from large cell irregularCellMap_[intersectionID].push_back(eIdxGlobalJ); @@ -413,15 +412,15 @@ void FV3dPressure2P2CAdaptive<TypeTag>::initializeMatrixRowSize() if (isIt->neighbor()) { //index outside - int eIdxGlobalJ = problem().variables().index(*isIt->outside()); + int eIdxGlobalJ = problem().variables().index(isIt->outside()); // if mpfa is used, more entries might be needed if all interactionRegions are regarded - if (isIt->outside()->level() > eIt->level()) //look from larger cell + if (isIt->outside().level() > eIt->level()) //look from larger cell { - VertexPointer outerCornerPtr(isIt->inside()->template subEntity<dim>(0)); //initialize with rubbish + auto outerCorner = isIt->inside().template subEntity<dim>(0); //initialize with rubbish // prepare additional pointer to cells - ElementPointer additional2(isIt->inside()); //initialize with something wrong! - ElementPointer additional3(isIt->inside()); + auto additional2 = isIt->inside(); //initialize with something wrong! + auto additional3 = isIt->inside(); // Prepare MPFA /** get geometric Info, transmissibility matrix */ @@ -461,9 +460,9 @@ void FV3dPressure2P2CAdaptive<TypeTag>::initializeMatrixRowSize() { if (isItcheck->neighbor()) { - if(additionalIdx2==problem().variables().index(*isItcheck->outside())) + if(additionalIdx2==problem().variables().index(isItcheck->outside())) additional2isNeighbor = true; - if(additionalIdx3 == problem().variables().index(*isItcheck->outside())) + if(additionalIdx3 == problem().variables().index(isItcheck->outside())) additional3isNeighbor = true; } @@ -521,9 +520,9 @@ void FV3dPressure2P2CAdaptive<TypeTag>::initializeMatrixRowSize() { if (isItcheck->neighbor()) { - if(additionalIdx2 == problem().variables().index(*isItcheck->outside())) + if(additionalIdx2 == problem().variables().index(isItcheck->outside())) additional2isNeighbor = true; - if(additionalIdx3 == problem().variables().index(*isItcheck->outside())) + if(additionalIdx3 == problem().variables().index(isItcheck->outside())) additional3isNeighbor = true; } } @@ -604,14 +603,13 @@ void FV3dPressure2P2CAdaptive<TypeTag>::initializeMatrixIndices() if (isIt->neighbor()) { // access neighbor - ElementPointer outside = isIt->outside(); - int eIdxGlobalJ = problem().variables().index(*outside); + int eIdxGlobalJ = problem().variables().index(isIt->outside()); // add off diagonal index this->A_.addindex(eIdxGlobalI, eIdxGlobalJ); // special treatment for hanging nodes in the mpfa case - if (enableMPFA && (eIt->level() < isIt->outside()->level())) + if (enableMPFA && (eIt->level() < isIt->outside().level())) { // prepare stuff to enter transmissibility calculation GlobalPosition globalPos3(0.); @@ -695,17 +693,17 @@ void FV3dPressure2P2CAdaptive<TypeTag>::assemble(bool first) if (isIt->neighbor()) { - ElementPointer elementNeighbor = isIt->outside(); - int eIdxGlobalJ = problem().variables().index(*elementNeighbor); + auto neighbor = isIt->outside(); + int eIdxGlobalJ = problem().variables().index(neighbor); //check for hanging nodes //take a hanging node never from the element with smaller level! - bool haveSameLevel = (eIt->level() == elementNeighbor->level()); + bool haveSameLevel = (eIt->level() == neighbor.level()); // 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) && (eIdxGlobalI > eIdxGlobalJ) && haveSameLevel - && elementNeighbor->partitionType() == Dune::InteriorEntity) + && neighbor.partitionType() == Dune::InteriorEntity) continue; entries = 0; @@ -739,7 +737,7 @@ void FV3dPressure2P2CAdaptive<TypeTag>::assemble(bool first) // The second condition is needed to not spoil the ghost element entries if (GET_PROP_VALUE(TypeTag, VisitFacesOnlyOnce) - && elementNeighbor->partitionType() == Dune::InteriorEntity) + && neighbor.partitionType() == Dune::InteriorEntity) { this->f_[eIdxGlobalJ] += entries[rhs]; this->A_[eIdxGlobalJ][eIdxGlobalJ] += entries[matrix]; @@ -810,26 +808,26 @@ void FV3dPressure2P2CAdaptive<TypeTag>::getMpfaFlux(const IntersectionIterator& const CellData& cellDataI) { // acess Cell I - ElementPointer elementPointerI = isIt->inside(); - int eIdxGlobalI = problem().variables().index(*elementPointerI); + auto elementI = isIt->inside(); + int eIdxGlobalI = problem().variables().index(elementI); // get global coordinate of cell center - const GlobalPosition& globalPos = elementPointerI->geometry().center(); + const GlobalPosition& globalPos = elementI.geometry().center(); // cell volume & perimeter, assume linear map here - Scalar volume = elementPointerI->geometry().volume(); + Scalar volume = elementI.geometry().volume(); Scalar perimeter = cellDataI.perimeter(); // get absolute permeability - DimMatrix permeabilityI(problem().spatialParams().intrinsicPermeability(*elementPointerI)); + DimMatrix permeabilityI(problem().spatialParams().intrinsicPermeability(elementI)); // access neighbor - ElementPointer neighborPointer = isIt->outside(); - int eIdxGlobalJ = problem().variables().index(*neighborPointer); + auto neighbor = isIt->outside(); + int eIdxGlobalJ = problem().variables().index(neighbor); CellData& cellDataJ = problem().variables().cellData(eIdxGlobalJ); // gemotry info of neighbor - const GlobalPosition& globalPosNeighbor = neighborPointer->geometry().center(); + const GlobalPosition& globalPosNeighbor = neighbor.geometry().center(); // distance vector between barycenters GlobalPosition distVec = globalPosNeighbor - globalPos; @@ -841,7 +839,7 @@ void FV3dPressure2P2CAdaptive<TypeTag>::getMpfaFlux(const IntersectionIterator& unitDistVec /= dist; DimMatrix permeabilityJ - = problem().spatialParams().intrinsicPermeability(*neighborPointer); + = problem().spatialParams().intrinsicPermeability(neighbor); // compute vectorized permeabilities DimMatrix meanPermeability(0); @@ -860,7 +858,7 @@ void FV3dPressure2P2CAdaptive<TypeTag>::getMpfaFlux(const IntersectionIterator& // determine volume derivatives in neighbor if (!cellDataJ.hasVolumeDerivatives()) - asImp_().volumeDerivatives(globalPosNeighbor, *neighborPointer); + asImp_().volumeDerivatives(globalPosNeighbor, neighbor); ComponentVector dv_dC(0.), graddv_dC(0.); for (int compIdx = 0; compIdx < NumComponents; ++compIdx) @@ -1143,19 +1141,19 @@ void FV3dPressure2P2CAdaptive<TypeTag>::get1pMpfaFlux(const IntersectionIterator const CellData& cellDataI) { // acess Cell I - ElementPointer elementPointerI = isIt->inside(); - int eIdxGlobalI = problem().variables().index(*elementPointerI); + auto elementI = isIt->inside(); + int eIdxGlobalI = problem().variables().index(elementI); // get global coordinate of cell center - const GlobalPosition& globalPos = elementPointerI->geometry().center(); + const GlobalPosition& globalPos = elementI.geometry().center(); // access neighbor - ElementPointer neighborPointer = isIt->outside(); - int eIdxGlobalJ = problem().variables().index(*neighborPointer); + auto neighbor = isIt->outside(); + int eIdxGlobalJ = problem().variables().index(neighbor); CellData& cellDataJ = problem().variables().cellData(eIdxGlobalJ); // gemotry info of neighbor - const GlobalPosition& globalPosNeighbor = neighborPointer->geometry().center(); + const GlobalPosition& globalPosNeighbor = neighbor.geometry().center(); // due to "safety cell" around subdomain, both cells I and J // have single-phase conditions, although one is in 2p domain. @@ -1351,19 +1349,17 @@ int FV3dPressure2P2CAdaptive<TypeTag>::computeTransmissibilities(const Intersect int& eIdxGlobal6) { // get geometry information of cellI = cell1, cellJ = cell2 - ElementPointer eIt = isIt->inside(); -// int eIdxGlobalI = problem().variables().index(*eIt); - ElementPointer neighborPointer = isIt->outside(); - GlobalPosition globalPos1 = eIt->geometry().center(); - GlobalPosition globalPos2 = neighborPointer->geometry().center(); - DimMatrix K1(problem().spatialParams().intrinsicPermeability(*eIt)); - DimMatrix K2(problem().spatialParams().intrinsicPermeability(*neighborPointer)); -// int eIdxGlobalJ = problem().variables().index(*isIt->outside()); + auto element = isIt->inside(); + auto neighbor = isIt->outside(); + GlobalPosition globalPos1 = element.geometry().center(); + GlobalPosition globalPos2 = neighbor.geometry().center(); + DimMatrix K1(problem().spatialParams().intrinsicPermeability(element)); + DimMatrix K2(problem().spatialParams().intrinsicPermeability(neighbor)); // determine ID of intersection seen from larger cell int intersectionID = 0; - if(isIt->inside()->level() < isIt->outside()->level()) - intersectionID = problem().grid().localIdSet().subId(*eIt, + if(isIt->inside().level() < isIt->outside().level()) + intersectionID = problem().grid().localIdSet().subId(element, isIt->indexInInside(), 1); else DUNE_THROW(Dune::NotImplemented, " ABORT, transmiss calculated from wrong side!!"); @@ -1379,14 +1375,14 @@ int FV3dPressure2P2CAdaptive<TypeTag>::computeTransmissibilities(const Intersect IntersectionIterator face24=isIt; // as long as face24 = isIt, it is still not found! IntersectionIterator face26=isIt; // as long as face26 = isIt, it is still not found! - IntersectionIterator nextIsEnd = problem().gridView().iend(*neighborPointer); - for (IntersectionIterator isIt2 = problem().gridView().ibegin(*neighborPointer); isIt2 != nextIsEnd; ++isIt2) + IntersectionIterator nextIsEnd = problem().gridView().iend(neighbor); + for (IntersectionIterator isIt2 = problem().gridView().ibegin(neighbor); isIt2 != nextIsEnd; ++isIt2) { // continue if no neighbor or arrived at intersection - if(!(isIt2->neighbor()) or isIt2->outside() == eIt) + if(!(isIt2->neighbor()) || isIt2->outside() == element) continue; - int currentNeighbor = problem().variables().index(*isIt2->outside()); + int currentNeighbor = problem().variables().index(isIt2->outside()); // have we found face24? if (find(localIrregularCells.begin(), localIrregularCells.end(), @@ -1412,15 +1408,15 @@ int FV3dPressure2P2CAdaptive<TypeTag>::computeTransmissibilities(const Intersect } // get information of cell4 - globalPos4 = face24->outside()->geometry().center(); - eIdxGlobal4 = problem().variables().index(*(face24->outside())); + globalPos4 = face24->outside().geometry().center(); + eIdxGlobal4 = problem().variables().index(face24->outside()); GlobalPosition outerNormaln24 = face24->centerUnitOuterNormal(); // get absolute permeability of neighbor cell 3 DimMatrix K4(problem().spatialParams().intrinsicPermeability(*(face24->outside()))); // get information of cell6 - globalPos6 = face26->outside()->geometry().center(); - eIdxGlobal6 = problem().variables().index(*(face26->outside())); + globalPos6 = face26->outside().geometry().center(); + eIdxGlobal6 = problem().variables().index(face26->outside()); GlobalPosition outerNormaln26 = face26->centerUnitOuterNormal(); // get absolute permeability of neighbor cell 3 DimMatrix K6(problem().spatialParams().intrinsicPermeability(*(face26->outside()))); @@ -1430,7 +1426,7 @@ int FV3dPressure2P2CAdaptive<TypeTag>::computeTransmissibilities(const Intersect int localFace24 = face24->indexInInside(); int localFace26 = face26->indexInInside(); - const ReferenceElement& referenceElement = ReferenceElementContainer::general(neighborPointer->geometry().type()); + const ReferenceElement& referenceElement = ReferenceElementContainer::general(neighbor.geometry().type()); //find 'x'5 = edgeCoord1226 int edge1226; // search through edges of face 12 @@ -1451,7 +1447,7 @@ int FV3dPressure2P2CAdaptive<TypeTag>::computeTransmissibilities(const Intersect } } GlobalPosition edgeCoord1226 = // 'x'5 - neighborPointer->geometry().global(referenceElement.position(edge1226, dim-1)); + neighbor.geometry().global(referenceElement.position(edge1226, dim-1)); //find 'x'4 = edgeCoord1224 int edge1224; @@ -1472,7 +1468,7 @@ int FV3dPressure2P2CAdaptive<TypeTag>::computeTransmissibilities(const Intersect } } GlobalPosition edgeCoord1224 = // 'x'4 - neighborPointer->geometry().global(referenceElement.position(edge1224, dim-1)); + neighbor.geometry().global(referenceElement.position(edge1224, dim-1)); //find 'x'6 = edgeCoord2426 int edge2426; @@ -1493,7 +1489,7 @@ int FV3dPressure2P2CAdaptive<TypeTag>::computeTransmissibilities(const Intersect } } GlobalPosition edgeCoord2426 = // 'x'6 - neighborPointer->geometry().global(referenceElement.position(edge2426, dim-1)); + neighbor.geometry().global(referenceElement.position(edge2426, dim-1)); /** 2) Calculate omega, chi for matrices **/ // center of face in global coordinates, i.e., the midpoint of face 'isIt24' @@ -1666,25 +1662,25 @@ int FV3dPressure2P2CAdaptive<TypeTag>::computeTransmissibilities(const Intersect //initialize additional transmissitivity matrix TransmissivityMatrix additionalT(0.); - VertexPointer outerCornerPtr(isIt->inside()->template subEntity<dim>(0)); //initialize with rubbish + auto outerCorner = isIt->inside().template subEntity<dim>(0); //initialize with rubbish // prepare additonal pointer to cells - ElementPointer additional2(isIt->inside()); //initialize with something wrong! - ElementPointer additional3(isIt->inside()); + auto additional2 = isIt->inside(); //initialize with something wrong! + auto additional3 = isIt->inside(); int caseL = -2; /**** 2nd interaction region: get corner of interest ************/ // search through corners of large cell with isIt - int localIdxLarge = searchCommonVertex_(*isIt, outerCornerPtr); + int localIdxLarge = searchCommonVertex_(*isIt, outerCorner); //in the parallel case, skip all border entities #if HAVE_MPI if (problem().gridView().comm().size() > 1) - if(outerCornerPtr->partitionType() != Dune::InteriorEntity) + if(outerCorner.partitionType() != Dune::InteriorEntity) caseL = -1; // abort this specific interaction volume #endif // get Interaction Volume object - int vIdxGlobal = problem().variables().index(*outerCornerPtr); + int vIdxGlobal = problem().variables().index(outerCorner); InteractionVolume& interactionVolume = interactionVolumesContainer_->interactionVolume(vIdxGlobal); @@ -1715,8 +1711,8 @@ int FV3dPressure2P2CAdaptive<TypeTag>::computeTransmissibilities(const Intersect if(caseL != -1) //check if we regard 2 interaction regions { problem().variables().storeMpfaData3D(*isIt, additionalT, - additional2->geometry().center(), problem().variables().index(*additional2), - additional3->geometry().center(), problem().variables().index(*additional3), + additional2.geometry().center(), problem().variables().index(additional2), + additional3.geometry().center(), problem().variables().index(additional3), 1); // offset for second interaction region countInteractionRegions++; } @@ -1727,17 +1723,17 @@ int FV3dPressure2P2CAdaptive<TypeTag>::computeTransmissibilities(const Intersect // loop through remaining 2 points std::vector<int> diagonal; #if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4) - for(int verticeSmall = 0; verticeSmall < isIt->outside()->subEntities(dim); ++verticeSmall) + for(int verticeSmall = 0; verticeSmall < isIt->outside().subEntities(dim); ++verticeSmall) #else - for(int verticeSmall = 0; verticeSmall<isIt->outside()->template count<dim>(); ++verticeSmall) + for(int verticeSmall = 0; verticeSmall<isIt->outside().template count<dim>(); ++verticeSmall) #endif { - const VertexPointer vPtrSmall = isIt->outside()->template subEntity<dim>(verticeSmall); + auto vSmall = isIt->outside().template subEntity<dim>(verticeSmall); //in the parallel case, skip all border entities #if HAVE_MPI if (problem().gridView().comm().size() > 1) - if(vPtrSmall->partitionType() != Dune::InteriorEntity) + if(vSmall.partitionType() != Dune::InteriorEntity) continue; #endif @@ -1751,10 +1747,10 @@ int FV3dPressure2P2CAdaptive<TypeTag>::computeTransmissibilities(const Intersect GlobalPosition vertexOnInterface = isIt->geometryInOutside().corner(indexOnFace); - if(vPtrSmall != outerCornerPtr + if(vSmall != outerCorner && ((vertexOnInterface - vertexOnElement).two_norm()<1e-5)) { - int vIdxGlobal = problem().variables().index(*vPtrSmall); + int vIdxGlobal = problem().variables().index(vSmall); // acess interactionVolume InteractionVolume& interactionVolume = interactionVolumesContainer_->interactionVolume(vIdxGlobal); @@ -1767,7 +1763,7 @@ int FV3dPressure2P2CAdaptive<TypeTag>::computeTransmissibilities(const Intersect if(hangingNodeType != InteractionVolume::fourSmallCellsFace) { - diagonal.push_back(problem().variables().index(*vPtrSmall)); + diagonal.push_back(problem().variables().index(vSmall)); // a) take interaction volume and determine fIdx if(hangingNodeType == InteractionVolume::noHangingNode) { @@ -1791,8 +1787,8 @@ int FV3dPressure2P2CAdaptive<TypeTag>::computeTransmissibilities(const Intersect if(caseL != -1) //check if we regard this interaction region { problem().variables().storeMpfaData3D(*isIt, additionalT, - additional2->geometry().center(), problem().variables().index(*additional2), - additional3->geometry().center(), problem().variables().index(*additional3), + additional2.geometry().center(), problem().variables().index(additional2), + additional3.geometry().center(), problem().variables().index(additional3), countInteractionRegions); // offset for this interaction region countInteractionRegions++; } @@ -1830,8 +1826,8 @@ int FV3dPressure2P2CAdaptive<TypeTag>::computeTransmissibilities(const Intersect * \param subVolumeFaceIdx The local index of the intersection of interest in the interaction volume * \param properFluxDirection True if the intersection normal coincides * with the local indexing in the interaction volume -* \param[out] additional2 Pointer to the 3rd cell's element in the interaction volume -* \param[out] additional3 Pointer to the 4th cell's element in the interaction volume +* \param[out] additional2 The 3rd cell's element in the interaction volume +* \param[out] additional3 The 4th cell's element in the interaction volume * \param[out] additionalT Transmissitivity matrix calculated */ template<class TypeTag> @@ -1839,8 +1835,8 @@ int FV3dPressure2P2CAdaptive<TypeTag>::transmissibilityAdapter_(const Intersecti InteractionVolume& interactionVolume, const int& subVolumeFaceIdx, bool properFluxDirection, - ElementPointer& additional2, - ElementPointer& additional3, + Element& additional2, + Element& additional3, TransmissivityMatrix& additionalT) { // abort if we are on boundary @@ -2024,8 +2020,8 @@ int FV3dPressure2P2CAdaptive<TypeTag>::transmissibilityAdapter_(const Intersecti case 4:{ if (hangingNodeType == InteractionVolume::fourSmallCellsEdge) // should never happen, cause TPFA should be applied { - assert(problem().variables().index(*(interactionVolume.getSubVolumeElement(4))) - != problem().variables().index(*(interactionVolume.getSubVolumeElement(5)))); // else there would not be a subVolFaceIdx 4 + assert(problem().variables().index(interactionVolume.getSubVolumeElement(4)) + != problem().variables().index(interactionVolume.getSubVolumeElement(5))); // else there would not be a subVolFaceIdx 4 Dune::dgrave << " SubVolumeFace4 in hanging node type 3 should be modelled by" << " Tpfa!!" <<std::endl; // TODO: or use 1,5,3,4 and case 4 return -1; @@ -2062,8 +2058,8 @@ int FV3dPressure2P2CAdaptive<TypeTag>::transmissibilityAdapter_(const Intersecti case 5:{ if (hangingNodeType == InteractionVolume::fourSmallCellsEdge) { - assert (problem().variables().index(*(interactionVolume.getSubVolumeElement(4))) - != problem().variables().index(*(interactionVolume.getSubVolumeElement(6)))); // else there would not be a subVolFaceIdx 5 + assert (problem().variables().index(interactionVolume.getSubVolumeElement(4)) + != problem().variables().index(interactionVolume.getSubVolumeElement(6))); // else there would not be a subVolFaceIdx 5 Dune::dgrave << " SubVolumeFace5 in hanging node type 3 should be modelled by" << " Tpfa!!" <<std::endl; // TODO: or use 1,5,7,0 and case 3 return -1; @@ -2123,8 +2119,8 @@ int FV3dPressure2P2CAdaptive<TypeTag>::transmissibilityAdapter_(const Intersecti case 6:{ if (hangingNodeType == InteractionVolume::fourSmallCellsEdge) { - assert (problem().variables().index(*(interactionVolume.getSubVolumeElement(4))) - != problem().variables().index(*(interactionVolume.getSubVolumeElement(5)))); // else there would not be a subVolFaceIdx 4 + assert (problem().variables().index(interactionVolume.getSubVolumeElement(4)) + != problem().variables().index(interactionVolume.getSubVolumeElement(5))); // else there would not be a subVolFaceIdx 4 Dune::dgrave << " SubVolumeFace6 in hanging node type 3 should be modelled by" << " Tpfa!!" <<std::endl; // TODO: or use 2,6,0,7 and case 4 return -1; @@ -2166,8 +2162,8 @@ int FV3dPressure2P2CAdaptive<TypeTag>::transmissibilityAdapter_(const Intersecti { if (hangingNodeType == InteractionVolume::fourSmallCellsEdge) { - assert (problem().variables().index(*(interactionVolume.getSubVolumeElement(4))) - != problem().variables().index(*(interactionVolume.getSubVolumeElement(6)))); // else there would not be a subVolFaceIdx 5 + assert (problem().variables().index(interactionVolume.getSubVolumeElement(4)) + != problem().variables().index(interactionVolume.getSubVolumeElement(6))); // else there would not be a subVolFaceIdx 5 Dune::dgrave << " SubVolumeFace5 in hanging node type 3 should be modelled by" << " Tpfa!!" <<std::endl; // TODO: or use 4,0,6,1 and case 4 return -1; @@ -2238,8 +2234,8 @@ int FV3dPressure2P2CAdaptive<TypeTag>::transmissibilityAdapter_(const Intersecti } else if (hangingNodeType == InteractionVolume::fourSmallCellsDiag || (hangingNodeType == InteractionVolume::fourSmallCellsEdge - && (problem().variables().index(*(interactionVolume.getSubVolumeElement(4))) - != problem().variables().index(*(interactionVolume.getSubVolumeElement(6))))) ) + && (problem().variables().index(interactionVolume.getSubVolumeElement(4)) + != problem().variables().index(interactionVolume.getSubVolumeElement(6)))) ) { useCases[0] = false; useCases[1] = true; @@ -2302,8 +2298,8 @@ int FV3dPressure2P2CAdaptive<TypeTag>::transmissibilityAdapter_(const Intersecti } else if (hangingNodeType == InteractionVolume::fourSmallCellsDiag || (hangingNodeType == InteractionVolume::fourSmallCellsEdge - &&(problem().variables().index(*(interactionVolume.getSubVolumeElement(4))) - != problem().variables().index(*(interactionVolume.getSubVolumeElement(6)))) )) + &&(problem().variables().index(interactionVolume.getSubVolumeElement(4)) + != problem().variables().index(interactionVolume.getSubVolumeElement(6))) )) { useCases[0] = true; useCases[1] = false; @@ -2314,8 +2310,8 @@ int FV3dPressure2P2CAdaptive<TypeTag>::transmissibilityAdapter_(const Intersecti lambda, 1, 5, 3, 7, 0, 4, useCases); } else if (hangingNodeType == InteractionVolume::fourSmallCellsEdge - &&(problem().variables().index(*(interactionVolume.getSubVolumeElement(4))) - != problem().variables().index(*(interactionVolume.getSubVolumeElement(5)))) ) + &&(problem().variables().index(interactionVolume.getSubVolumeElement(4)) + != problem().variables().index(interactionVolume.getSubVolumeElement(5))) ) { useCases[0] = true; useCases[1] = false; @@ -2363,8 +2359,8 @@ int FV3dPressure2P2CAdaptive<TypeTag>::transmissibilityAdapter_(const Intersecti caseL = mpfal3DTransmissibilityCalculator_.transmissibilityCaseTwo(T, interactionVolume, lambda, 7, 3, 1, 2); else if ((hangingNodeType == InteractionVolume::fourSmallCellsEdge - &&(problem().variables().index(*(interactionVolume.getSubVolumeElement(4))) - != problem().variables().index(*(interactionVolume.getSubVolumeElement(6)))) ) + &&(problem().variables().index(interactionVolume.getSubVolumeElement(4)) + != problem().variables().index(interactionVolume.getSubVolumeElement(6))) ) || hangingNodeType == InteractionVolume::sixSmallCells) { useCases[0] = false; @@ -2437,8 +2433,8 @@ int FV3dPressure2P2CAdaptive<TypeTag>::transmissibilityAdapter_(const Intersecti caseL = mpfal3DTransmissibilityCalculator_.transmissibilityCaseOne(T, interactionVolume, lambda, 2, 6, 0, 3); else if ((hangingNodeType == InteractionVolume::fourSmallCellsEdge - && (problem().variables().index(*(interactionVolume.getSubVolumeElement(4))) - != problem().variables().index(*(interactionVolume.getSubVolumeElement(6))))) + && (problem().variables().index(interactionVolume.getSubVolumeElement(4)) + != problem().variables().index(interactionVolume.getSubVolumeElement(6)))) || hangingNodeType == InteractionVolume::sixSmallCells) { useCases[0] = true; @@ -2450,8 +2446,8 @@ int FV3dPressure2P2CAdaptive<TypeTag>::transmissibilityAdapter_(const Intersecti lambda, 2, 6, 0, 4, 3, 7, useCases); } else if (hangingNodeType == InteractionVolume::fourSmallCellsEdge - && (problem().variables().index(*(interactionVolume.getSubVolumeElement(4))) - != problem().variables().index(*(interactionVolume.getSubVolumeElement(5)))) ) + && (problem().variables().index(interactionVolume.getSubVolumeElement(4)) + != problem().variables().index(interactionVolume.getSubVolumeElement(5))) ) { useCases[0] = true; useCases[1] = false; diff --git a/dumux/decoupled/2p2c/fv3dtransport2p2cadaptive.hh b/dumux/decoupled/2p2c/fv3dtransport2p2cadaptive.hh index 4e0f2d828eaff6cba9869f5d21e09f3669d1ea90..74991ba209ed759983f2e55e43dbe47449271448 100644 --- a/dumux/decoupled/2p2c/fv3dtransport2p2cadaptive.hh +++ b/dumux/decoupled/2p2c/fv3dtransport2p2cadaptive.hh @@ -91,7 +91,6 @@ class FV3dTransport2P2CAdaptive : public FVTransport2P2C<TypeTag> typedef typename GridView::Traits::template Codim<0>::Entity Element; typedef typename GridView::Grid Grid; typedef typename GridView::template Codim<0>::Iterator ElementIterator; - typedef typename GridView::template Codim<0>::EntityPointer ElementPointer; typedef typename GridView::IntersectionIterator IntersectionIterator; typedef typename GridView::Intersection Intersection; @@ -224,7 +223,7 @@ void FV3dTransport2P2CAdaptive<TypeTag>::update(const Scalar t, Scalar& dt, // handle interior face if (isIt->neighbor()) { - if (enableMPFA && isIt->outside()->level() != eIt->level()) + if (enableMPFA && isIt->outside().level() != eIt->level()) getMpfaFlux(entries, timestepFlux, isIt, cellDataI); else this->getFlux(entries, timestepFlux, *isIt, cellDataI); @@ -345,26 +344,26 @@ void FV3dTransport2P2CAdaptive<TypeTag>::getMpfaFlux(Dune::FieldVector<Scalar, 2 fluxEntries = 0.; timestepFlux = 0.; // cell information - ElementPointer elementI= isIt->inside(); - int globalIdxI = problem().variables().index(*elementI); + auto elementI = isIt->inside(); + int globalIdxI = problem().variables().index(elementI); // get position - const GlobalPosition globalPos = elementI->geometry().center(); + const GlobalPosition globalPos = elementI.geometry().center(); const GlobalPosition& gravity_ = problem().gravity(); // cell volume, assume linear map here - Scalar volume = elementI->geometry().volume(); + Scalar volume = elementI.geometry().volume(); // get values of cell I Scalar pressI = problem().pressureModel().pressure(globalIdxI); Scalar pcI = cellDataI.capillaryPressure(); - DimMatrix K_I(problem().spatialParams().intrinsicPermeability(*elementI)); + DimMatrix K_I(problem().spatialParams().intrinsicPermeability(elementI)); PhaseVector SmobI(0.); SmobI[wPhaseIdx] = std::max((cellDataI.saturation(wPhaseIdx) - - problem().spatialParams().materialLawParams(*elementI).swr()) + - problem().spatialParams().materialLawParams(elementI).swr()) , 1e-2); SmobI[nPhaseIdx] = std::max((cellDataI.saturation(nPhaseIdx) - - problem().spatialParams().materialLawParams(*elementI).snr()) + - problem().spatialParams().materialLawParams(elementI).snr()) , 1e-2); Scalar densityWI (0.), densityNWI(0.); @@ -374,12 +373,12 @@ void FV3dTransport2P2CAdaptive<TypeTag>::getMpfaFlux(Dune::FieldVector<Scalar, 2 PhaseVector potential(0.); // access neighbor - ElementPointer neighborPointer = isIt->outside(); - int globalIdxJ = problem().variables().index(*neighborPointer); + auto neighbor = isIt->outside(); + int globalIdxJ = problem().variables().index(neighbor); CellData& cellDataJ = problem().variables().cellData(globalIdxJ); // neighbor cell center in global coordinates - const GlobalPosition& globalPosNeighbor = neighborPointer->geometry().center(); + const GlobalPosition& globalPosNeighbor = neighbor.geometry().center(); // distance vector between barycenters GlobalPosition distVec = globalPosNeighbor - globalPos; @@ -529,7 +528,7 @@ void FV3dTransport2P2CAdaptive<TypeTag>::getMpfaFlux(Dune::FieldVector<Scalar, 2 { bool cellIwasUpwindCell; //get the information from smaller (higher level) cell, as its IS is unique - if(elementI->level()>neighborPointer->level()) + if(elementI.level()>neighbor.level()) cellIwasUpwindCell = cellDataI.isUpwindCell(isIt->indexInInside(), contiEqIdx); else // reverse neighbors information gathered cellIwasUpwindCell = !cellDataJ.isUpwindCell(isIt->indexInOutside(), contiEqIdx); diff --git a/dumux/decoupled/2p2c/fvmpfal3d2p2cinteractionvolumecontaineradaptive.hh b/dumux/decoupled/2p2c/fvmpfal3d2p2cinteractionvolumecontaineradaptive.hh index 26e6678a4aff7125b127ae035da10ff775dabcd7..45ad926ab9f8034756ad33a2cba966bbb436a8db 100644 --- a/dumux/decoupled/2p2c/fvmpfal3d2p2cinteractionvolumecontaineradaptive.hh +++ b/dumux/decoupled/2p2c/fvmpfal3d2p2cinteractionvolumecontaineradaptive.hh @@ -72,7 +72,6 @@ class FvMpfaL3d2P2CInteractionVolumeContainerAdaptive : public FvMpfaL3dInteract typedef typename GridView::Traits::template Codim<dim>::Entity Vertex; typedef typename GridView::template Codim<dim>::Iterator VertexIterator; - typedef typename GridView::template Codim<0>::EntityPointer ElementPointer; typedef typename GridView::IntersectionIterator IntersectionIterator; typedef typename GridView::Intersection Intersection; typedef typename Intersection::Geometry IntersectionGeometry; @@ -408,8 +407,8 @@ inline int FvMpfaL3d2P2CInteractionVolumeContainerAdaptive<TypeTag>::getMpfaCase } Dune::dgrave << " Could not find "<< interactionVolume.getHangingNodeType() <<" case configuration for I = " - << problem_.variables().index(*isIt->inside()) << " localIdx " << mapI << " , " - << problem_.variables().index(*isIt->outside()) << " localIdx " << mapJ << std::endl; + << problem_.variables().index(isIt->inside()) << " localIdx " << mapI << " , " + << problem_.variables().index(isIt->outside()) << " localIdx " << mapJ << std::endl; return -1; } @@ -555,8 +554,8 @@ inline int FvMpfaL3d2P2CInteractionVolumeContainerAdaptive<TypeTag>::getMpfaCase } Dune::dgrave << " Could not find "<< interactionVolume.getHangingNodeType() <<" case configuration for I = " - << problem_.variables().index(*isIt->inside()) << " localIdx " << mapI << " and " - << problem_.variables().index(*isIt->outside()) << " localIdx " << mapJ << std::endl; + << problem_.variables().index(isIt->inside()) << " localIdx " << mapI << " and " + << problem_.variables().index(isIt->outside()) << " localIdx " << mapJ << std::endl; return -1; } diff --git a/dumux/decoupled/2p2c/fvpressure2p2c.hh b/dumux/decoupled/2p2c/fvpressure2p2c.hh index 4b9610372e13755b2ee215bce36fb9a9a835fab1..0ba98e9fb8309ab6da7db0580b1e0d3be4d607c4 100644 --- a/dumux/decoupled/2p2c/fvpressure2p2c.hh +++ b/dumux/decoupled/2p2c/fvpressure2p2c.hh @@ -117,7 +117,6 @@ template<class TypeTag> class FVPressure2P2C // typedefs to abbreviate several dune classes... typedef typename GridView::Traits::template Codim<0>::Entity Element; - typedef typename GridView::template Codim<0>::EntityPointer ElementPtr; typedef typename GridView::Intersection Intersection; // convenience shortcuts for Vectors/Matrices @@ -348,14 +347,14 @@ void FVPressure2P2C<TypeTag>::getFlux(Dune::FieldVector<Scalar, 2>& entries, const Intersection& intersection, const CellData& cellDataI, const bool first) { entries = 0.; - ElementPtr elementPtrI = intersection.inside(); - int eIdxGlobalI = problem().variables().index(*elementPtrI); + auto elementI = intersection.inside(); + int eIdxGlobalI = problem().variables().index(elementI); // get global coordinate of cell center - const GlobalPosition& globalPos = elementPtrI->geometry().center(); + const GlobalPosition& globalPos = elementI.geometry().center(); // cell volume & perimeter, assume linear map here - Scalar volume = elementPtrI->geometry().volume(); + Scalar volume = elementI.geometry().volume(); Scalar perimeter = cellDataI.perimeter(); //#warning perimeter hack 2D! // perimeter = intersection.geometry().volume()*2; @@ -363,7 +362,7 @@ void FVPressure2P2C<TypeTag>::getFlux(Dune::FieldVector<Scalar, 2>& entries, const GlobalPosition& gravity_ = problem().gravity(); // get absolute permeability - DimMatrix permeabilityI(problem().spatialParams().intrinsicPermeability(*elementPtrI)); + DimMatrix permeabilityI(problem().spatialParams().intrinsicPermeability(elementI)); // get mobilities and fractional flow factors Scalar fractionalWI=0, fractionalNWI=0; @@ -382,12 +381,12 @@ void FVPressure2P2C<TypeTag>::getFlux(Dune::FieldVector<Scalar, 2>& entries, Scalar faceArea = intersection.geometry().volume(); // access neighbor - ElementPtr neighborPtr = intersection.outside(); - int eIdxGlobalJ = problem().variables().index(*neighborPtr); + auto neighbor = intersection.outside(); + int eIdxGlobalJ = problem().variables().index(neighbor); CellData& cellDataJ = problem().variables().cellData(eIdxGlobalJ); // gemotry info of neighbor - const GlobalPosition& globalPosNeighbor = neighborPtr->geometry().center(); + const GlobalPosition& globalPosNeighbor = neighbor.geometry().center(); // distance vector between barycenters GlobalPosition distVec = globalPosNeighbor - globalPos; @@ -399,7 +398,7 @@ void FVPressure2P2C<TypeTag>::getFlux(Dune::FieldVector<Scalar, 2>& entries, unitDistVec /= dist; DimMatrix permeabilityJ - = problem().spatialParams().intrinsicPermeability(*neighborPtr); + = problem().spatialParams().intrinsicPermeability(neighbor); // compute vectorized permeabilities DimMatrix meanPermeability(0); @@ -439,7 +438,7 @@ void FVPressure2P2C<TypeTag>::getFlux(Dune::FieldVector<Scalar, 2>& entries, { // determine volume derivatives if (!cellDataJ.hasVolumeDerivatives()) - asImp_().volumeDerivatives(globalPosNeighbor, *neighborPtr); + asImp_().volumeDerivatives(globalPosNeighbor, neighbor); Scalar dv_dC1 = (cellDataJ.dv(wPhaseIdx) + cellDataI.dv(wPhaseIdx)) / 2; // dV/dm1= dv/dC^1 @@ -507,7 +506,7 @@ void FVPressure2P2C<TypeTag>::getFlux(Dune::FieldVector<Scalar, 2>& entries, } //perform upwinding if desired - if(!upwindWCellData or (cellDataI.wasRefined() && cellDataJ.wasRefined() && elementPtrI->father() == neighborPtr->father())) + if(!upwindWCellData or (cellDataI.wasRefined() && cellDataJ.wasRefined() && elementI.father() == neighbor.father())) { if (cellDataI.wasRefined() && cellDataJ.wasRefined()) { @@ -636,8 +635,8 @@ void FVPressure2P2C<TypeTag>::getFluxOnBoundary(Dune::FieldVector<Scalar, 2>& en { entries = 0.; // get global coordinate of cell center - ElementPtr elementPtrI = intersection.inside(); - const GlobalPosition& globalPos = elementPtrI->geometry().center(); + auto elementI = intersection.inside(); + const GlobalPosition& globalPos = elementI.geometry().center(); // get normal vector const GlobalPosition& unitOuterNormal = intersection.centerUnitOuterNormal(); @@ -669,7 +668,7 @@ void FVPressure2P2C<TypeTag>::getFluxOnBoundary(Dune::FieldVector<Scalar, 2>& en if (bcType.isDirichlet(Indices::pressureEqIdx)) { // get absolute permeability - DimMatrix permeabilityI(problem().spatialParams().intrinsicPermeability(*elementPtrI)); + DimMatrix permeabilityI(problem().spatialParams().intrinsicPermeability(elementI)); if(regulateBoundaryPermeability) { @@ -742,10 +741,10 @@ void FVPressure2P2C<TypeTag>::getFluxOnBoundary(Dune::FieldVector<Scalar, 2>& en else if(GET_PROP_VALUE(TypeTag, BoundaryMobility) == Indices::permDependent) { lambdaWBound - = MaterialLaw::krw(problem().spatialParams().materialLawParams(*elementPtrI), + = MaterialLaw::krw(problem().spatialParams().materialLawParams(elementI), BCfluidState.saturation(wPhaseIdx)) / viscosityWBound; lambdaNWBound - = MaterialLaw::krn(problem().spatialParams().materialLawParams(*elementPtrI), + = MaterialLaw::krn(problem().spatialParams().materialLawParams(elementI), BCfluidState.saturation(wPhaseIdx)) / viscosityNWBound; } // get average density diff --git a/dumux/decoupled/2p2c/fvpressure2p2cmultiphysics.hh b/dumux/decoupled/2p2c/fvpressure2p2cmultiphysics.hh index c2a95ec80c73e645dca481928cdc0d93b7500cd0..11d1c7fe93717e19f83ecf184220e24dc3979729 100644 --- a/dumux/decoupled/2p2c/fvpressure2p2cmultiphysics.hh +++ b/dumux/decoupled/2p2c/fvpressure2p2cmultiphysics.hh @@ -102,7 +102,6 @@ class FVPressure2P2CMultiPhysics : public FVPressure2P2C<TypeTag> typedef typename GridView::Traits::template Codim<0>::Entity Element; typedef typename GridView::template Codim<0>::Iterator ElementIterator; typedef typename GridView::Grid Grid; - typedef typename GridView::template Codim<0>::EntityPointer ElementPointer; typedef typename GridView::Intersection Intersection; typedef typename GridView::IntersectionIterator IntersectionIterator; @@ -295,7 +294,7 @@ void FVPressure2P2CMultiPhysics<TypeTag>::assemble(bool first) /************* handle interior face *****************/ if (isIt->neighbor()) { - int eIdxGlobalJ = problem().variables().index(*(isIt->outside())); + int eIdxGlobalJ = problem().variables().index(isIt->outside()); if (cellDataI.subdomain() != 2 or problem().variables().cellData(eIdxGlobalJ).subdomain() != 2) // cell in the 1p domain @@ -516,16 +515,13 @@ void FVPressure2P2CMultiPhysics<TypeTag>::get1pFlux(Dune::FieldVector<Scalar, 2> const Intersection& intersection, const CellData& cellDataI) { entries = 0.; - ElementPointer elementPointerI = intersection.inside(); + auto elementI = intersection.inside(); // get global coordinate of cell center - const GlobalPosition& globalPos = elementPointerI->geometry().center(); - - // cell index -// int eIdxGlobalI = problem().variables().index(*elementPointerI); + const GlobalPosition& globalPos = elementI.geometry().center(); // get absolute permeability - DimMatrix permeabilityI(problem().spatialParams().intrinsicPermeability(*elementPointerI)); + DimMatrix permeabilityI(problem().spatialParams().intrinsicPermeability(elementI)); // get normal vector const GlobalPosition& unitOuterNormal = intersection.centerUnitOuterNormal(); @@ -534,12 +530,12 @@ void FVPressure2P2CMultiPhysics<TypeTag>::get1pFlux(Dune::FieldVector<Scalar, 2> Scalar faceArea = intersection.geometry().volume(); // access neighbor - ElementPointer neighborPointer = intersection.outside(); - int eIdxGlobalJ = problem().variables().index(*neighborPointer); + auto neighbor = intersection.outside(); + int eIdxGlobalJ = problem().variables().index(neighbor); CellData& cellDataJ = problem().variables().cellData(eIdxGlobalJ); // gemotry info of neighbor - const GlobalPosition& globalPosNeighbor = neighborPointer->geometry().center(); + const GlobalPosition& globalPosNeighbor = neighbor.geometry().center(); // distance vector between barycenters GlobalPosition distVec = globalPosNeighbor - globalPos; @@ -551,7 +547,7 @@ void FVPressure2P2CMultiPhysics<TypeTag>::get1pFlux(Dune::FieldVector<Scalar, 2> unitDistVec /= dist; DimMatrix permeabilityJ - = problem().spatialParams().intrinsicPermeability(*neighborPointer); + = problem().spatialParams().intrinsicPermeability(neighbor); // compute vectorized permeabilities DimMatrix meanPermeability(0); @@ -621,9 +617,9 @@ void FVPressure2P2CMultiPhysics<TypeTag>::get1pFluxOnBoundary(Dune::FieldVector< { entries = 0.; // get global coordinate of cell center - ElementPointer elementPointerI = intersection.inside(); - const GlobalPosition& globalPos = elementPointerI->geometry().center(); -// int eIdxGlobalI = problem().variables().index(*elementPointerI); + auto elementI = intersection.inside(); + const GlobalPosition& globalPos = elementI.geometry().center(); +// int eIdxGlobalI = problem().variables().index(elementI); int phaseIdx = cellDataI.subdomain(); // get normal vector @@ -651,7 +647,7 @@ void FVPressure2P2CMultiPhysics<TypeTag>::get1pFluxOnBoundary(Dune::FieldVector< if (bcType.isDirichlet(Indices::pressureEqIdx)) { // get absolute permeability - DimMatrix permeabilityI(problem().spatialParams().intrinsicPermeability(*elementPointerI)); + DimMatrix permeabilityI(problem().spatialParams().intrinsicPermeability(elementI)); if(this->regulateBoundaryPermeability) { int axis = intersection.indexInInside() / 2; @@ -699,11 +695,11 @@ void FVPressure2P2CMultiPhysics<TypeTag>::get1pFluxOnBoundary(Dune::FieldVector< { if (phaseIdx == wPhaseIdx) lambdaBound = MaterialLaw::krw( - problem().spatialParams().materialLawParams(*elementPointerI), BCfluidState.saturation(wPhaseIdx)) + problem().spatialParams().materialLawParams(elementI), BCfluidState.saturation(wPhaseIdx)) / viscosityBound; else lambdaBound = MaterialLaw::krn( - problem().spatialParams().materialLawParams(*elementPointerI), BCfluidState.saturation(wPhaseIdx)) + problem().spatialParams().materialLawParams(elementI), BCfluidState.saturation(wPhaseIdx)) / viscosityBound; break; } @@ -819,7 +815,7 @@ void FVPressure2P2CMultiPhysics<TypeTag>::updateMaterialLaws(bool postTimeStep) { if (isIt->neighbor()) { - int eIdxGlobalJ = problem().variables().index(*(isIt->outside())); + int eIdxGlobalJ = problem().variables().index(isIt->outside()); // mark neighbor Element nextSubdomain[eIdxGlobalJ] = 2; } diff --git a/dumux/decoupled/2p2c/fvtransport2p2c.hh b/dumux/decoupled/2p2c/fvtransport2p2c.hh index dc1e8fc74a879e2cd9bc1b5279b38c9ae723e5a2..1fb1f85270161d8c6e94445d02bba428c52dfb48 100644 --- a/dumux/decoupled/2p2c/fvtransport2p2c.hh +++ b/dumux/decoupled/2p2c/fvtransport2p2c.hh @@ -103,7 +103,6 @@ class FVTransport2P2C typedef typename GridView::Traits::template Codim<0>::Entity Element; typedef typename GridView::template Codim<0>::Iterator ElementIterator; - typedef typename GridView::template Codim<0>::EntityPointer ElementPointer; typedef typename GridView::IntersectionIterator IntersectionIterator; typedef typename GridView::Intersection Intersection; @@ -578,26 +577,26 @@ void FVTransport2P2C<TypeTag>::getFlux(ComponentVector& fluxEntries, fluxEntries = 0.; timestepFlux = 0.; // cell information - ElementPointer elementPtrI= intersection.inside(); - int eIdxGlobalI = problem().variables().index(*elementPtrI); + auto elementI = intersection.inside(); + int eIdxGlobalI = problem().variables().index(elementI); // get position - const GlobalPosition globalPos = elementPtrI->geometry().center(); + const GlobalPosition globalPos = elementI.geometry().center(); const GlobalPosition& gravity_ = problem().gravity(); // cell volume, assume linear map here - Scalar volume = elementPtrI->geometry().volume(); + Scalar volume = elementI.geometry().volume(); // get values of cell I Scalar pressI = problem().pressureModel().pressure(eIdxGlobalI); Scalar pcI = cellDataI.capillaryPressure(); - DimMatrix K_I(problem().spatialParams().intrinsicPermeability(*elementPtrI)); + DimMatrix K_I(problem().spatialParams().intrinsicPermeability(elementI)); PhaseVector SmobI(0.); SmobI[wPhaseIdx] = std::max((cellDataI.saturation(wPhaseIdx) - - problem().spatialParams().materialLawParams(*elementPtrI).swr()) + - problem().spatialParams().materialLawParams(elementI).swr()) , 1e-2); SmobI[nPhaseIdx] = std::max((cellDataI.saturation(nPhaseIdx) - - problem().spatialParams().materialLawParams(*elementPtrI).snr()) + - problem().spatialParams().materialLawParams(elementI).snr()) , 1e-2); Scalar densityWI (0.), densityNWI(0.); @@ -621,12 +620,12 @@ void FVTransport2P2C<TypeTag>::getFlux(ComponentVector& fluxEntries, PhaseVector potential(0.); // access neighbor - ElementPointer neighborPtr = intersection.outside(); - int eIdxGlobalJ = problem().variables().index(*neighborPtr); + auto neighbor = intersection.outside(); + int eIdxGlobalJ = problem().variables().index(neighbor); CellData& cellDataJ = problem().variables().cellData(eIdxGlobalJ); // neighbor cell center in global coordinates - const GlobalPosition& globalPosNeighbor = neighborPtr->geometry().center(); + const GlobalPosition& globalPosNeighbor = neighbor.geometry().center(); // distance vector between barycenters GlobalPosition distVec = globalPosNeighbor - globalPos; @@ -652,7 +651,7 @@ void FVTransport2P2C<TypeTag>::getFlux(ComponentVector& fluxEntries, DimMatrix meanK_(0.); Dumux::harmonicMeanMatrix(meanK_, K_I, - problem().spatialParams().intrinsicPermeability(*neighborPtr)); + problem().spatialParams().intrinsicPermeability(neighbor)); Dune::FieldVector<Scalar,dim> K(0); meanK_.umv(unitDistVec,K); @@ -725,10 +724,10 @@ void FVTransport2P2C<TypeTag>::getFlux(ComponentVector& fluxEntries, { //check if harmonic weighting is necessary if (potential[phaseIdx] > 0. && (Dune::FloatCmp::ne<Scalar, Dune::FloatCmp::absolute>(cellDataJ.mobility(phaseIdx), 0.0, 1.0e-30) // check if outflow induce neglected (i.e. mob=0) phase flux - or (cellDataI.wasRefined() && cellDataJ.wasRefined() && elementPtrI->father() == neighborPtr->father()))) + or (cellDataI.wasRefined() && cellDataJ.wasRefined() && elementI.father() == neighbor.father()))) lambda[phaseIdx] = cellDataI.mobility(phaseIdx); else if (potential[phaseIdx] < 0. && (Dune::FloatCmp::ne<Scalar, Dune::FloatCmp::absolute>(cellDataI.mobility(phaseIdx), 0.0, 1.0e-30) // check if inflow induce neglected phase flux - or (cellDataI.wasRefined() && cellDataJ.wasRefined() && elementPtrI->father() == neighborPtr->father()))) + or (cellDataI.wasRefined() && cellDataJ.wasRefined() && elementI.father() == neighbor.father()))) lambda[phaseIdx] = cellDataJ.mobility(phaseIdx); else doUpwinding[phaseIdx] = false; @@ -764,7 +763,7 @@ void FVTransport2P2C<TypeTag>::getFlux(ComponentVector& fluxEntries, * harmonicMean(cellDataI.mobility(phaseIdx),cellDataJ.mobility(phaseIdx))/SmobI[phaseIdx]); //d) output - if(!(cellDataI.wasRefined() && cellDataJ.wasRefined() && elementPtrI->father() == neighborPtr->father()) + if(!(cellDataI.wasRefined() && cellDataJ.wasRefined() && elementI.father() == neighbor.father()) && eIdxGlobalI > eIdxGlobalJ) //(only for one side) { averagedFaces_++; @@ -823,8 +822,8 @@ void FVTransport2P2C<TypeTag>::getFlux(ComponentVector& fluxEntries, // // // calculate tortuosity at the nodes i and j needed // // for porous media diffusion coefficient -// Scalar poroI = problem().spatialParams().porosity(*elementPtrI); -// Scalar poroJ = problem().spatialParams().porosity(*neighborPtr); +// Scalar poroI = problem().spatialParams().porosity(elementI); +// Scalar poroJ = problem().spatialParams().porosity(neighbor); // Scalar tauI = // 1.0/(poroI * poroI) * // pow(poroI * cellDataI.saturation(phaseIdx), 7.0/3); @@ -873,19 +872,19 @@ void FVTransport2P2C<TypeTag>::getFluxOnBoundary(ComponentVector& fluxEntries, const CellData& cellDataI) { // cell information - ElementPointer elementPtrI= intersection.inside(); - int eIdxGlobalI = problem().variables().index(*elementPtrI); + auto elementI = intersection.inside(); + int eIdxGlobalI = problem().variables().index(elementI); // get position - const GlobalPosition globalPos = elementPtrI->geometry().center(); + const GlobalPosition globalPos = elementI.geometry().center(); // cell volume, assume linear map here - Scalar volume = elementPtrI->geometry().volume(); + Scalar volume = elementI.geometry().volume(); const GlobalPosition& gravity_ = problem().gravity(); // get values of cell I Scalar pressI = problem().pressureModel().pressure(eIdxGlobalI); Scalar pcI = cellDataI.capillaryPressure(); - DimMatrix K_I(problem().spatialParams().intrinsicPermeability(*elementPtrI)); + DimMatrix K_I(problem().spatialParams().intrinsicPermeability(elementI)); if(regulateBoundaryPermeability) { @@ -895,10 +894,10 @@ void FVTransport2P2C<TypeTag>::getFluxOnBoundary(ComponentVector& fluxEntries, } Scalar SwmobI = std::max((cellDataI.saturation(wPhaseIdx) - - problem().spatialParams().materialLawParams(*elementPtrI).swr()) + - problem().spatialParams().materialLawParams(elementI).swr()) , 1e-2); Scalar SnmobI = std::max((cellDataI.saturation(nPhaseIdx) - - problem().spatialParams().materialLawParams(*elementPtrI).snr()) + - problem().spatialParams().materialLawParams(elementI).snr()) , 1e-2); Scalar densityWI (0.), densityNWI(0.); @@ -996,7 +995,7 @@ void FVTransport2P2C<TypeTag>::getFluxOnBoundary(ComponentVector& fluxEntries, lambda[wPhaseIdx] = BCfluidState.saturation(wPhaseIdx) / viscosityWBound; else lambda[wPhaseIdx] = MaterialLaw::krw( - problem().spatialParams().materialLawParams(*elementPtrI), BCfluidState.saturation(wPhaseIdx)) + problem().spatialParams().materialLawParams(elementI), BCfluidState.saturation(wPhaseIdx)) / viscosityWBound; } if (potential[nPhaseIdx] >= 0.) @@ -1007,7 +1006,7 @@ void FVTransport2P2C<TypeTag>::getFluxOnBoundary(ComponentVector& fluxEntries, lambda[nPhaseIdx] = BCfluidState.saturation(nPhaseIdx) / viscosityNWBound; else lambda[nPhaseIdx] = MaterialLaw::krn( - problem().spatialParams().materialLawParams(*elementPtrI), BCfluidState.saturation(wPhaseIdx)) + problem().spatialParams().materialLawParams(elementI), BCfluidState.saturation(wPhaseIdx)) / viscosityNWBound; } // calculate and standardized velocity @@ -1092,7 +1091,7 @@ void FVTransport2P2C<TypeTag>::evalBoundary(GlobalPosition globalPosFace, // prepare a flash solver CompositionalFlash<TypeTag> flashSolver; - const ElementPointer eIt= intersection.inside(); + auto element = intersection.inside(); // read boundary values PrimaryVariables primaryVariablesOnBoundary(0.); problem().dirichlet(primaryVariablesOnBoundary, intersection); @@ -1105,7 +1104,7 @@ void FVTransport2P2C<TypeTag>::evalBoundary(GlobalPosition globalPosFace, Scalar satBound = primaryVariablesOnBoundary[contiWEqIdx]; if(GET_PROP_VALUE(TypeTag, EnableCapillarity)) { - Scalar pcBound = MaterialLaw::pc(problem().spatialParams().materialLawParams(*eIt), + Scalar pcBound = MaterialLaw::pc(problem().spatialParams().materialLawParams(element), satBound); switch (pressureType) { @@ -1127,7 +1126,7 @@ void FVTransport2P2C<TypeTag>::evalBoundary(GlobalPosition globalPosFace, pressBound[wPhaseIdx] = pressBound[nPhaseIdx] = primaryVariablesOnBoundary[Indices::pressureEqIdx]; flashSolver.saturationFlash2p2c(BCfluidState, satBound, pressBound, - problem().spatialParams().porosity(*eIt), problem().temperatureAtPos(globalPosFace)); + problem().spatialParams().porosity(element), problem().temperatureAtPos(globalPosFace)); } else if (bcType == Indices::concentration) { @@ -1135,11 +1134,11 @@ void FVTransport2P2C<TypeTag>::evalBoundary(GlobalPosition globalPosFace, pressBound[wPhaseIdx] = pressBound[nPhaseIdx] = primaryVariablesOnBoundary[Indices::pressureEqIdx]; Scalar Z1Bound = primaryVariablesOnBoundary[contiWEqIdx]; flashSolver.concentrationFlash2p2c(BCfluidState, Z1Bound, pressBound, - problem().spatialParams().porosity(*eIt), problem().temperatureAtPos(globalPosFace)); + problem().spatialParams().porosity(element), problem().temperatureAtPos(globalPosFace)); if(GET_PROP_VALUE(TypeTag, EnableCapillarity)) { - Scalar pcBound = MaterialLaw::pc(problem().spatialParams().materialLawParams(*eIt), + Scalar pcBound = MaterialLaw::pc(problem().spatialParams().materialLawParams(element), BCfluidState.saturation(wPhaseIdx)); int maxiter = 3; //start iteration loop @@ -1168,8 +1167,8 @@ void FVTransport2P2C<TypeTag>::evalBoundary(GlobalPosition globalPosFace, Scalar oldPc = pcBound; //update with better pressures flashSolver.concentrationFlash2p2c(BCfluidState, Z1Bound, pressBound, - problem().spatialParams().porosity(*eIt), problem().temperatureAtPos(globalPosFace)); - pcBound = MaterialLaw::pc(problem().spatialParams().materialLawParams(*eIt), + problem().spatialParams().porosity(element), problem().temperatureAtPos(globalPosFace)); + pcBound = MaterialLaw::pc(problem().spatialParams().materialLawParams(element), BCfluidState.saturation(wPhaseIdx)); // TODO: get right criterion, do output for evaluation //converge criterion @@ -1215,11 +1214,11 @@ void FVTransport2P2C<TypeTag>::updatedTargetDt_(Scalar &dt) if (isIt->neighbor()) { - ElementPointer neighbor = isIt->outside(); - int eIdxGlobalJ = problem_.variables().index(*neighbor); + auto neighbor = isIt->outside(); + int eIdxGlobalJ = problem_.variables().index(neighbor); int levelI = eIt->level(); - int levelJ = neighbor->level(); + int levelJ = neighbor.level(); if (eIdxGlobalI < eIdxGlobalJ && levelI <= levelJ) { @@ -1281,8 +1280,8 @@ void FVTransport2P2C<TypeTag>::updatedTargetDt_(Scalar &dt) it = faceDt.find(indexInInside); if (it != faceDt.end()) { - ElementPointer neighbor = isIt->outside(); - int eIdxGlobalJ = problem_.variables().index(*neighbor); + auto neighbor = isIt->outside(); + int eIdxGlobalJ = problem_.variables().index(neighbor); LocalTimesteppingData& localDataJ = timeStepData_[eIdxGlobalJ]; diff --git a/dumux/decoupled/2p2c/variableclass2p2cadaptive.hh b/dumux/decoupled/2p2c/variableclass2p2cadaptive.hh index 9f9224d01a4b686590596725c0c273ca6f114c5f..6e58c793d1d8cea873ea78ef90702cda09478b17 100644 --- a/dumux/decoupled/2p2c/variableclass2p2cadaptive.hh +++ b/dumux/decoupled/2p2c/variableclass2p2cadaptive.hh @@ -178,7 +178,7 @@ public: IdType intersectionID = grid_.localIdSet().subId( *irregularIs.inside(), irregularIs.indexInInside(), 1); // mapping is only unique from smaller cell (if *inside and not *outside) - if (irregularIs.inside()->level() < irregularIs.outside()->level()) + if (irregularIs.inside().level() < irregularIs.outside().level()) { // IS is regarded from larger cell: get the unique number as seen from smaller intersectionID = grid_.localIdSet().subId( @@ -220,16 +220,16 @@ public: const int& globalIdx3) { IdType intersectionID - = grid_.localIdSet().subId(*irregularIs.inside(), - irregularIs.indexInInside(), 1); + = grid_.localIdSet().subId(irregularIs.inside(), + irregularIs.indexInInside(), 1); // mapping is only unique from smaller cell (if *inside and not *outside) - if (irregularIs.inside()->level() < irregularIs.outside()->level()) + if (irregularIs.inside().level() < irregularIs.outside().level()) { // IS is regarded from larger cell: get the unique number as seen from smaller intersectionID - = grid_.localIdSet().subId(*irregularIs.outside(), - irregularIs.indexInOutside(), 1); + = grid_.localIdSet().subId(irregularIs.outside(), + irregularIs.indexInOutside(), 1); // store as if it was seen from smaller: change i & j irregularInterfaceMap_[intersectionID].T1_[first][2] = - T1[0]; @@ -282,16 +282,16 @@ public: const int offset = subFaceIdx * 2; IdType intersectionID - = grid_.localIdSet().subId(*irregularIs.inside(), - irregularIs.indexInInside(), 1); + = grid_.localIdSet().subId(irregularIs.inside(), + irregularIs.indexInInside(), 1); // mapping is only unique from smaller cell (if *inside and not *outside) - if (irregularIs.inside()->level() < irregularIs.outside()->level()) + if (irregularIs.inside().level() < irregularIs.outside().level()) { // IS is regarded from larger cell: get the unique ID as seen from smaller intersectionID - = grid_.localIdSet().subId(*irregularIs.outside(), - irregularIs.indexInOutside(), 1); + = grid_.localIdSet().subId(irregularIs.outside(), + irregularIs.indexInOutside(), 1); // store as if it was seen from smaller: change i & j irregularInterfaceMap_[intersectionID].T1_[subFaceIdx][0] = -T1[1]; @@ -331,16 +331,16 @@ public: Scalar weight, int subFaceIdx = -1) { IdType intersectionID - = grid_.localIdSet().subId(*irregularIs.inside(), - irregularIs.indexInInside(), 1); + = grid_.localIdSet().subId(irregularIs.inside(), + irregularIs.indexInInside(), 1); // mapping is only unique from smaller cell (if *inside and not *outside) - if (irregularIs.inside()->level() < irregularIs.outside()->level()) + if (irregularIs.inside().level() < irregularIs.outside().level()) { // IS is regarded from larger cell: get the unique ID as seen from smaller intersectionID - = grid_.localIdSet().subId(*irregularIs.outside(), - irregularIs.indexInOutside(), 1); + = grid_.localIdSet().subId(irregularIs.outside(), + irregularIs.indexInOutside(), 1); } // for subFaceIdx == -1, we weight all subfaces equally @@ -375,15 +375,15 @@ public: int& globalIdx3) { IdType intersectionID - = grid_.localIdSet().subId(*irregularIs.inside(), - irregularIs.indexInInside(), 1); + = grid_.localIdSet().subId(irregularIs.inside(), + irregularIs.indexInInside(), 1); // mapping is only unique from smaller cell (if *inside and not *outside) - if (irregularIs.inside()->level() < irregularIs.outside()->level()) + if (irregularIs.inside().level() < irregularIs.outside().level()) { // IS is regarded from larger cell: get the unique number as seen from smaller intersectionID - = grid_.localIdSet().subId(*irregularIs.outside(), - irregularIs.indexInOutside(), 1); + = grid_.localIdSet().subId(irregularIs.outside(), + irregularIs.indexInOutside(), 1); // check if T1ransmissibility matrix was stored for that IF if (irregularInterfaceMap_.find(intersectionID) == irregularInterfaceMap_.end()) @@ -404,8 +404,6 @@ public: T1_secondHalfEdge[0] = -irregularInterfaceMap_[intersectionID].T1_[second][2]; T1_secondHalfEdge[1] = -irregularInterfaceMap_[intersectionID].T1_[second][1]; T1_secondHalfEdge[2] = -irregularInterfaceMap_[intersectionID].T1_[second][0]; - // Dune::dinfo << "mpfa Info retrieved for isID " << intersectionID - // << "at coordinate " << irregularIs.geometry().center() << " from GlobalIdx " << this->index(*irregularIs.inside())<<std::endl; return 2; } return 1; @@ -424,9 +422,6 @@ public: { secondHalfEdgeIntersectionIt = irregularInterfaceMap_[intersectionID].getIntersection(); T1_secondHalfEdge = irregularInterfaceMap_[intersectionID].T1_[second]; - - // Dune::dinfo << "mpfa Info retrieved for isID " << intersectionID - // << "at coordinate " << irregularIs.geometry().center() << " from GlobalIdx " << this->index(*irregularIs.inside())<<std::endl; return 2; } return 1; @@ -461,15 +456,15 @@ public: const int offset = subFaceIdx * 2; IdType intersectionID - = grid_.localIdSet().subId(*irregularIs.inside(), - irregularIs.indexInInside(), 1); + = grid_.localIdSet().subId(irregularIs.inside(), + irregularIs.indexInInside(), 1); // mapping is only unique from smaller cell (if *inside and not *outside) - if (irregularIs.inside()->level() < irregularIs.outside()->level()) + if (irregularIs.inside().level() < irregularIs.outside().level()) { // IS is regarded from larger cell: get the unique number as seen from smaller intersectionID - = grid_.localIdSet().subId(*irregularIs.outside(), - irregularIs.indexInOutside(), 1); + = grid_.localIdSet().subId(irregularIs.outside(), + irregularIs.indexInOutside(), 1); // check if T1ransmissibility matrix was stored for that IF if (irregularInterfaceMap_.find(intersectionID) == irregularInterfaceMap_.end()) diff --git a/dumux/decoupled/common/fv/fvpressure.hh b/dumux/decoupled/common/fv/fvpressure.hh index bbb32ff64dc9a4c8ea77264e424e7ee861d6d6b5..5967cd7aedb783c919c887722fc2f5f45f4ed287 100644 --- a/dumux/decoupled/common/fv/fvpressure.hh +++ b/dumux/decoupled/common/fv/fvpressure.hh @@ -56,7 +56,6 @@ template<class TypeTag> class FVPressure // typedefs to abbreviate several dune classes... typedef typename GridView::Traits::template Codim<0>::Entity Element; typedef typename GridView::template Codim<0>::Iterator ElementIterator; - typedef typename GridView::template Codim<0>::EntityPointer ElementPointer; typedef typename GridView::IntersectionIterator IntersectionIterator; typedef typename GridView::Intersection Intersection; @@ -384,8 +383,7 @@ void FVPressure<TypeTag>::initializeMatrixIndices() if (isIt->neighbor()) { // access neighbor - ElementPointer outside = isIt->outside(); - int eIdxGlobalJ = problem_.variables().index(*outside); + int eIdxGlobalJ = problem_.variables().index(isIt->outside()); // add off diagonal index A_.addindex(eIdxGlobalI, eIdxGlobalJ); @@ -437,19 +435,19 @@ void FVPressure<TypeTag>::assemble(bool first) /************* handle interior face *****************/ if (isIt->neighbor()) { - ElementPointer elementNeighbor = isIt->outside(); + auto elementNeighbor = isIt->outside(); - int eIdxGlobalJ = problem_.variables().index(*elementNeighbor); + int eIdxGlobalJ = problem_.variables().index(elementNeighbor); // check for hanging nodes // take a hanging node never from the element with smaller level! - bool haveSameLevel = (eIt->level() == elementNeighbor->level()); + bool haveSameLevel = (eIt->level() == elementNeighbor.level()); // 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) && (eIdxGlobalI > eIdxGlobalJ) && haveSameLevel - && elementNeighbor->partitionType() == Dune::InteriorEntity) + && elementNeighbor.partitionType() == Dune::InteriorEntity) continue; //check for hanging nodes @@ -467,7 +465,7 @@ void FVPressure<TypeTag>::assemble(bool first) // The second condition is needed to not spoil the ghost element entries if (GET_PROP_VALUE(TypeTag, VisitFacesOnlyOnce) - && elementNeighbor->partitionType() == Dune::InteriorEntity) + && elementNeighbor.partitionType() == Dune::InteriorEntity) { f_[eIdxGlobalJ] += entries[rhs]; A_[eIdxGlobalJ][eIdxGlobalJ] += entries[matrix]; diff --git a/dumux/decoupled/common/fv/fvtransport.hh b/dumux/decoupled/common/fv/fvtransport.hh index 3084411894ad54dbceb91c2c487feda82afa7ece..4ba882cb35c53d27c297ff21603b1e5b71cc328a 100644 --- a/dumux/decoupled/common/fv/fvtransport.hh +++ b/dumux/decoupled/common/fv/fvtransport.hh @@ -75,7 +75,6 @@ class FVTransport typedef typename GridView::Traits::template Codim<0>::Entity Element; typedef typename GridView::template Codim<0>::Iterator ElementIterator; - typedef typename GridView::template Codim<0>::EntityPointer ElementPointer; typedef typename GridView::IntersectionIterator IntersectionIterator; typedef typename GridView::Intersection Intersection; @@ -478,11 +477,11 @@ void FVTransport<TypeTag>::updatedTargetDt_(Scalar &dt) if (isIt->neighbor()) { - ElementPointer neighbor = isIt->outside(); - int globalIdxJ = problem_.variables().index(*neighbor); + auto neighbor = isIt->outside(); + int globalIdxJ = problem_.variables().index(neighbor); int levelI = eIt->level(); - int levelJ = neighbor->level(); + int levelJ = neighbor.level(); if (globalIdxI < globalIdxJ && levelI <= levelJ) { @@ -544,8 +543,7 @@ void FVTransport<TypeTag>::updatedTargetDt_(Scalar &dt) it = faceDt.find(indexInInside); if (it != faceDt.end()) { - ElementPointer neighbor = isIt->outside(); - int globalIdxJ = problem_.variables().index(*neighbor); + int globalIdxJ = problem_.variables().index(isIt->outside()); LocalTimesteppingData& localDataJ = timeStepData_[globalIdxJ]; diff --git a/dumux/decoupled/common/fv/mpfa/mpfalinteractionvolume.hh b/dumux/decoupled/common/fv/mpfa/mpfalinteractionvolume.hh index 81065afadc24469d2dc226f215a1ffa7ff4a3f9b..4c95591d62e3ecba9ecbb8988f35ce051914a080 100644 --- a/dumux/decoupled/common/fv/mpfa/mpfalinteractionvolume.hh +++ b/dumux/decoupled/common/fv/mpfa/mpfalinteractionvolume.hh @@ -41,14 +41,17 @@ class FVMPFALInteractionVolume { private: typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; + typedef typename GET_PROP_TYPE(TypeTag, Grid) Grid; typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView; + typedef typename GET_PROP_TYPE(TypeTag, GridCreator) GridCreator; enum { dim = GridView::dimension }; - typedef typename GridView::template Codim<0>::EntityPointer ElementPointer; + typedef typename GridView::template Codim<0>::Entity Element; + typedef typename Grid::template Codim<0>::EntitySeed ElementSeed; typedef typename GET_PROP_TYPE(TypeTag, BoundaryTypes) BoundaryTypes; typedef typename GET_PROP(TypeTag, SolutionTypes) SolutionTypes; @@ -128,12 +131,12 @@ public: //! Store an element of the interaction volume /*! - * \param pointer The Dune::EntityPointer to the element + * \param element The element * \param subVolumeIdx The local element index in the interaction volume */ - void setSubVolumeElement(ElementPointer pointer, int subVolumeIdx) + void setSubVolumeElement(const Element& element, int subVolumeIdx) { - elements_[subVolumeIdx].push_back(pointer); + elements_[subVolumeIdx].push_back(element.seed()); elementNum_++; } @@ -273,11 +276,11 @@ public: /*! * \param subVolumeIdx The local element index in the interaction volume * - * \return Dune::EntityPointer to the interaction volume sub-element. + * \return The interaction volume sub-element. */ - ElementPointer& getSubVolumeElement(int subVolumeIdx) + Element getSubVolumeElement(int subVolumeIdx) { - return elements_[subVolumeIdx][0]; + return GridCreator::grid().entity(elements_[subVolumeIdx][0]); } //! Get boundary condtion types for a flux face @@ -416,7 +419,7 @@ private: std::vector<int> faceType_; Dune::FieldVector<IndexVector, 2*dim> indexOnElement_; Dune::FieldVector<IndexVector, 2*dim> faceIndexOnSubVolume_; - std::vector<std::vector<ElementPointer> > elements_; + std::vector<std::vector<ElementSeed> > elements_; BCVector neumannValues_; BCVector dirichletValues_; DimVector centerVertexPos_; diff --git a/dumux/decoupled/common/fv/mpfa/mpfalinteractionvolume3d.hh b/dumux/decoupled/common/fv/mpfa/mpfalinteractionvolume3d.hh index 84c346f192f02744c96c9f0f720591be29659ab0..fb16aed80147c7de047068c2af207678b65ac0d8 100644 --- a/dumux/decoupled/common/fv/mpfa/mpfalinteractionvolume3d.hh +++ b/dumux/decoupled/common/fv/mpfa/mpfalinteractionvolume3d.hh @@ -115,7 +115,9 @@ class FvMpfaL3dInteractionVolume { private: typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; + typedef typename GET_PROP_TYPE(TypeTag, Grid) Grid; typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView; + typedef typename GET_PROP_TYPE(TypeTag, GridCreator) GridCreator; typedef typename GET_PROP_TYPE(TypeTag, Problem) Problem; enum @@ -124,7 +126,8 @@ private: dimWorld = GridView::dimensionworld, }; - typedef typename GridView::template Codim<0>::EntityPointer ElementPointer; + typedef typename GridView::template Codim<0>::Entity Element; + typedef typename Grid::template Codim<0>::EntitySeed ElementSeed; typedef typename GET_PROP_TYPE(TypeTag, BoundaryTypes) BoundaryTypes; typedef typename GET_PROP(TypeTag, SolutionTypes) SolutionTypes; @@ -199,19 +202,19 @@ public: } //! Store a dune element as a sub volume element /*! - * \param pointer The Dune::EntityPointer to the element + * \param element The element * \param subVolumeIdx The local element index in the interaction volume */ - void setSubVolumeElement(ElementPointer pointer, int subVolumeIdx) + void setSubVolumeElement(const Element& element, int subVolumeIdx) { if (!hasSubVolumeElement(subVolumeIdx)) { - elements_[subVolumeIdx].push_back(pointer); + elements_[subVolumeIdx].push_back(element.seed()); elementNum_++; } else { - elements_[subVolumeIdx].insert(elements_[subVolumeIdx].begin(), pointer); + elements_[subVolumeIdx].insert(elements_[subVolumeIdx].begin(), element.seed()); } } @@ -372,12 +375,12 @@ public: /*! * \param subVolumeIdx The local element index in the interaction volume * - * \return Dune::EntityPointer to the interaction volume sub-element. + * \return The interaction volume sub-element. */ - ElementPointer& getSubVolumeElement(int subVolumeIdx) + Element getSubVolumeElement(int subVolumeIdx) { if (hasSubVolumeElement(subVolumeIdx)) - return elements_[subVolumeIdx][0]; + return GridCreator::grid().entity(elements_[subVolumeIdx][0]); else { std::cout<<"Problems when calling getSubVolumeElement("<<subVolumeIdx<<")\n"; @@ -578,9 +581,9 @@ public: if (elements_[i].size() > 0) { std::cout<<"element "<<i<<":\n"; - std::cout<<"element level: "<<elements_[i][0]->level()<<"\n"; - std::cout<<"element position: "<<elements_[i][0]->geometry().center()<<"\n"; - std::cout<<"element volume: "<<elements_[i][0]->geometry().volume()<<"\n"; + std::cout<<"element level: "<<GridCreator::grid().entity(elements_[i][0]).level()<<"\n"; + std::cout<<"element position: "<<GridCreator::grid().entity(elements_[i][0]).geometry().center()<<"\n"; + std::cout<<"element volume: "<<GridCreator::grid().entity(elements_[i][0]).geometry().volume()<<"\n"; std::cout<<"face indices on element: "<<indexOnElement_[i]<<"\n"; std::cout<<"face normals on element: "<<normal_[i]<<"\n"; std::cout<<"face areas on element: "; @@ -690,7 +693,7 @@ private: BCTypeVector boundaryTypes_; std::vector<int> faceType_; Dune::FieldVector<IndexVector, subVolumeTotalNum> indexOnElement_; - std::vector<std::vector<ElementPointer> > elements_; + std::vector<std::vector<ElementSeed> > elements_; BCVector neumannValues_; BCVector dirichletValues_; DimVector centerVertexPos_; diff --git a/dumux/decoupled/common/fv/mpfa/mpfalinteractionvolume3dadaptive.hh b/dumux/decoupled/common/fv/mpfa/mpfalinteractionvolume3dadaptive.hh index bafaadbcc6ebf9c4a0dbf441a0beb1d56082479a..41dca4a6783d2aab6c99add9149376e558aa1e9b 100644 --- a/dumux/decoupled/common/fv/mpfa/mpfalinteractionvolume3dadaptive.hh +++ b/dumux/decoupled/common/fv/mpfa/mpfalinteractionvolume3dadaptive.hh @@ -193,7 +193,9 @@ class FvMpfaL3dInteractionVolumeAdaptive:public FvMpfaL3dInteractionVolume<TypeT private: typedef FvMpfaL3dInteractionVolume<TypeTag> ParentType; typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; + typedef typename GET_PROP_TYPE(TypeTag, Grid) Grid; typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView; + typedef typename GET_PROP_TYPE(TypeTag, GridCreator) GridCreator; typedef typename GET_PROP_TYPE(TypeTag, Problem) Problem; enum @@ -202,7 +204,8 @@ private: dimWorld = GridView::dimensionworld, }; - typedef typename GridView::template Codim<0>::EntityPointer ElementPointer; + typedef typename GridView::template Codim<0>::Entity Element; + typedef typename Grid::template Codim<0>::EntitySeed ElementSeed; typedef typename GET_PROP_TYPE(TypeTag, BoundaryTypes) BoundaryTypes; typedef typename GET_PROP(TypeTag, SolutionTypes) SolutionTypes; @@ -261,10 +264,10 @@ public: } //!\copydoc FvMpfaL3dInteractionVolume::setSubVolumeElement() - void setSubVolumeElement(ElementPointer pointer, int subVolumeIdx) + void setSubVolumeElement(const Element& element, int subVolumeIdx) { - ParentType::setSubVolumeElement(pointer, subVolumeIdx); - existingLevel_.insert(pointer->level()); + ParentType::setSubVolumeElement(element, subVolumeIdx); + existingLevel_.insert(element.level()); } //! Store the type of hanging-node-interaction volume diff --git a/dumux/decoupled/common/fv/mpfa/mpfaointeractionvolume.hh b/dumux/decoupled/common/fv/mpfa/mpfaointeractionvolume.hh index 863e44181597a4a61eaa0b1696634b6ce66491d3..90f492ce00cd2bfc0c8dcd3dc2a61cec4c625d94 100644 --- a/dumux/decoupled/common/fv/mpfa/mpfaointeractionvolume.hh +++ b/dumux/decoupled/common/fv/mpfa/mpfaointeractionvolume.hh @@ -38,14 +38,17 @@ class FVMPFAOInteractionVolume { private: typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; + typedef typename GET_PROP_TYPE(TypeTag, Grid) Grid; typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView; + typedef typename GET_PROP_TYPE(TypeTag, GridCreator) GridCreator; enum { dim = GridView::dimension }; - typedef typename GridView::template Codim<0>::EntityPointer ElementPointer; + typedef typename GridView::template Codim<0>::Entity Element; + typedef typename Grid::template Codim<0>::EntitySeed ElementSeed; typedef typename GET_PROP_TYPE(TypeTag, BoundaryTypes) BoundaryTypes; typedef typename GET_PROP(TypeTag, SolutionTypes) SolutionTypes; @@ -99,12 +102,12 @@ public: //! Store an element of the interaction volume /*! - * \param pointer The Dune::EntityPointer to the element + * \param element The element * \param subVolumeIdx The local element index in the interaction volume */ - void setSubVolumeElement(ElementPointer pointer, int subVolumeIdx) + void setSubVolumeElement(const Element& element, int subVolumeIdx) { - elements_[subVolumeIdx].push_back(pointer); + elements_[subVolumeIdx].push_back(element.seed()); } //! Store the \f$ dF \f$ for the transmissiblity calculation @@ -248,11 +251,11 @@ public: /*! * \param subVolumeIdx The local element index in the interaction volume * - * \return Dune::EntityPointer to the interaction volume sub-element. + * \return The interaction volume sub-element. */ - ElementPointer& getSubVolumeElement(int subVolumeIdx) + Element getSubVolumeElement(int subVolumeIdx) { - return elements_[subVolumeIdx][0]; + return GridCreator::grid().entity(elements_[subVolumeIdx][0]); } //! Get boundary condtion types for a flux face @@ -446,7 +449,7 @@ private: std::vector<int> faceType_; Dune::FieldVector<IndexVector, 2*dim> indexOnElement_; Dune::FieldVector<IndexVector, 2*dim> faceIndexOnSubVolume_; - std::vector<std::vector<ElementPointer> > elements_; + std::vector<std::vector<ElementSeed> > elements_; BCVector neumannValues_; BCVector dirichletValues_; }; diff --git a/dumux/decoupled/common/gridadapt.hh b/dumux/decoupled/common/gridadapt.hh index d939006c2679c56f74720a55fec55c09ad9aaa61..2dd50a9eca0a2bcec2b427db71792ab3550e203b 100644 --- a/dumux/decoupled/common/gridadapt.hh +++ b/dumux/decoupled/common/gridadapt.hh @@ -52,7 +52,6 @@ class GridAdapt typedef typename LeafGridView::template Codim<0>::Iterator LeafIterator; typedef typename GridView::IntersectionIterator LeafIntersectionIterator; typedef typename Grid::template Codim<0>::Entity Element; - typedef typename Grid::template Codim<0>::EntityPointer ElementPointer; typedef typename GET_PROP_TYPE(TypeTag, CellData) CellData; typedef typename GET_PROP_TYPE(TypeTag, AdaptionIndicator) AdaptionIndicator; @@ -231,7 +230,7 @@ public: } if (indicator.coarsen(*eIt) && eIt->hasFather()) { - int idx = idSet.id(*(eIt->father())); + int idx = idSet.id(eIt->father()); typename CoarsenMarkerType::iterator it = coarsenMarker.find(idx); if (it != coarsenMarker.end()) { @@ -253,7 +252,7 @@ public: if (indicator.coarsen(*eIt) && eIt->level() > levelMin_) { - int idx = idSet.id(*(eIt->father())); + int idx = idSet.id(eIt->father()); typename CoarsenMarkerType::iterator it = coarsenMarker.find(idx); if (it != coarsenMarker.end()) { @@ -267,9 +266,9 @@ public: { if(is->neighbor()) { - ElementPointer outside = is->outside(); - if ((problem_.grid().getMark(*outside) > 0) - || outside->level() > eIt->level()) + auto outside = is->outside(); + if ((problem_.grid().getMark(outside) > 0) + || outside.level() > eIt->level()) { coarsenPossible = false; } @@ -368,20 +367,20 @@ private: if(!is->neighbor()) continue; - ElementPointer outside = is->outside(); + auto outside = is->outside(); // only mark non-ghost elements - if (outside->partitionType() == Dune::GhostEntity) + if (outside.partitionType() == Dune::GhostEntity) continue; - if ((outside->level() < levelMax_) - && (outside->level() < entity.level())) + if ((outside.level() < levelMax_) + && (outside.level() < entity.level())) { - problem_.grid().mark(1, *outside); + problem_.grid().mark(1, outside); ++marked_; if(level != levelMax_) - checkNeighborsRefine_(*outside, ++level); + checkNeighborsRefine_(outside, ++level); } } return true; @@ -422,11 +421,9 @@ private: if(!intersection.neighbor()) continue; - ElementPointer outside =intersection.outside(); - if (eIt.level()+maxLevelDelta<outside.level()) + if (eIt->level() + maxLevelDelta < intersection.outside().level()) { - ElementPointer entity =eIt; - problem_.grid().mark( 1, *entity ); + problem_.grid().mark( 1, *eIt ); done=false; } } diff --git a/dumux/decoupled/common/variableclassadaptive.hh b/dumux/decoupled/common/variableclassadaptive.hh index 8cc55d0612a0a0668258317bb1eb8f84090a8893..a5e03e124391405ff578c4a2a62dc8674ef88b19 100644 --- a/dumux/decoupled/common/variableclassadaptive.hh +++ b/dumux/decoupled/common/variableclassadaptive.hh @@ -55,7 +55,6 @@ private: typedef typename GridView::Grid Grid; typedef typename Grid::LevelGridView LevelGridView; typedef typename LevelGridView::template Codim<0>::Iterator LevelIterator; - typedef typename GridView::Traits::template Codim<0>::EntityPointer ElementPointer; typedef Dune::PersistentContainer<Grid, AdaptedValues> PersistentContainer; private: @@ -116,11 +115,10 @@ public: //Average in father if (eIt->level() > 0) { - ElementPointer epFather = eIt->father(); - AdaptedValues& adaptedValuesFather = adaptationMap_[*epFather]; + auto father = eIt->father(); + AdaptedValues& adaptedValuesFather = adaptationMap_[father]; adaptedValuesFather.count += 1; - CellData::storeAdaptionValues(adaptedValues, adaptedValuesFather, - *epFather); + CellData::storeAdaptionValues(adaptedValues, adaptedValuesFather, father); } } } @@ -171,11 +169,9 @@ public: // value is not in map, interpolate from father element if (eIt->level() > 0) { - ElementPointer epFather = eIt->father(); - - // create new entry: reconstruct from adaptationMap_[*father] to a new - // adaptationMap_[*son] - CellData::reconstructAdaptionValues(adaptationMap_, *epFather, *eIt, problem); + // create new entry: reconstruct from adaptationMap_[father] to a new + // adaptationMap_[son] + CellData::reconstructAdaptionValues(adaptationMap_, eIt->father(), *eIt, problem); // access new son AdaptedValues& adaptedValues = adaptationMap_[*eIt]; diff --git a/dumux/freeflow/zeroeq/zeroeqmodel.hh b/dumux/freeflow/zeroeq/zeroeqmodel.hh index 829c5059d26e0e73997abf431963a0e0ee91ab77..d062604cc974a46f60de9e73c2d56f42ea663055 100644 --- a/dumux/freeflow/zeroeq/zeroeqmodel.hh +++ b/dumux/freeflow/zeroeq/zeroeqmodel.hh @@ -160,15 +160,15 @@ public: ElementIterator eEndIt = this->gridView_().template end<0>(); for (; eIt != eEndIt; ++eIt) { - int idx = this->elementMapper().map(*eIt); + int idx = this->elementMapper().index(*eIt); rank[idx] = this->gridView_().comm().rank(); fvGeometry.update(this->gridView_(), *eIt); - int numLocalVerts = eIt->template count<dim>(); + int numLocalVerts = eIt->template subEntities(dim); for (int i = 0; i < numLocalVerts; ++i) { - int vIdxGlobal = this->vertexMapper().map(*eIt, i, dim); + int vIdxGlobal = this->vertexMapper().subIndex(*eIt, i, dim); volVars.update(sol[vIdxGlobal], this->problem_(), *eIt, @@ -242,7 +242,7 @@ public: numFluxVars += 1; } - int eIdxGlobal = this->elementMapper().map(*eIt); + int eIdxGlobal = this->elementMapper().index(*eIt); mut[eIdxGlobal] = sumDynamicEddyViscosity / numFluxVars; nut[eIdxGlobal] = sumKinematicEddyViscosity / numFluxVars; lmix[eIdxGlobal] = sumMixingLength / numFluxVars; diff --git a/dumux/freeflow/zeroeqnc/zeroeqncmodel.hh b/dumux/freeflow/zeroeqnc/zeroeqncmodel.hh index 0e700bde04e9f2eb2665c3bb550cc4fa727857d4..b5a1521978a0335d97ea2ccfadebeb7a396da7f4 100644 --- a/dumux/freeflow/zeroeqnc/zeroeqncmodel.hh +++ b/dumux/freeflow/zeroeqnc/zeroeqncmodel.hh @@ -168,16 +168,16 @@ public: ElementIterator eEndIt = this->gridView_().template end<0>(); for (; eIt != eEndIt; ++eIt) { - int idx = this->elementMapper().map(*eIt); + int idx = this->elementMapper().index(*eIt); rank[idx] = this->gridView_().comm().rank(); fvGeometry.update(this->gridView_(), *eIt); elemBcTypes.update(this->problem_(), *eIt, fvGeometry); - int numLocalVerts = eIt->template count<dim>(); + int numLocalVerts = eIt->template subEntities(dim); for (int i = 0; i < numLocalVerts; ++i) { - int vIdxGlobal = this->vertexMapper().map(*eIt, i, dim); + int vIdxGlobal = this->vertexMapper().subIndex(*eIt, i, dim); volVars.update(sol[vIdxGlobal], this->problem_(), *eIt, @@ -273,7 +273,7 @@ public: numFluxVars += 1; } - int eIdxGlobal = this->elementMapper().map(*eIt); + int eIdxGlobal = this->elementMapper().index(*eIt); mut[eIdxGlobal] = sumDynamicEddyViscosity / numFluxVars; nut[eIdxGlobal] = sumKinematicEddyViscosity / numFluxVars; lmix[eIdxGlobal] = sumMixingLength / numFluxVars; diff --git a/dumux/freeflow/zeroeqncni/zeroeqncnimodel.hh b/dumux/freeflow/zeroeqncni/zeroeqncnimodel.hh index e3d7eb110f2cceaa8bd20370387548b67f2adb2e..a56493e70de4332d9c7bb8c49d39a4d324e3dfbc 100644 --- a/dumux/freeflow/zeroeqncni/zeroeqncnimodel.hh +++ b/dumux/freeflow/zeroeqncni/zeroeqncnimodel.hh @@ -180,15 +180,15 @@ public: ElementIterator eEndIt = this->gridView_().template end<0>(); for (; eIt != eEndIt; ++eIt) { - int idx = this->elementMapper().map(*eIt); + int idx = this->elementMapper().index(*eIt); rank[idx] = this->gridView_().comm().rank(); fvGeometry.update(this->gridView_(), *eIt); - int numLocalVerts = eIt->template count<dim>(); + int numLocalVerts = eIt->template subEntities(dim); for (int i = 0; i < numLocalVerts; ++i) { - int vIdxGlobal = this->vertexMapper().map(*eIt, i, dim); + int vIdxGlobal = this->vertexMapper().subIndex(*eIt, i, dim); volVars.update(sol[vIdxGlobal], this->problem_(), *eIt, @@ -294,7 +294,7 @@ public: numFluxVars += 1; } - int eIdxGlobal = this->elementMapper().map(*eIt); + int eIdxGlobal = this->elementMapper().index(*eIt); mut[eIdxGlobal] = sumDynamicEddyViscosity / numFluxVars; nut[eIdxGlobal] = sumKinematicEddyViscosity / numFluxVars; lmix[eIdxGlobal] = sumMixingLength / numFluxVars; diff --git a/dumux/geomechanics/el1p2c/el1p2clocaljacobian.hh b/dumux/geomechanics/el1p2c/el1p2clocaljacobian.hh index f4f8aa70a0ae93224fd8fc0740c012f6582a7b26..b35002de24f683b70f37559971dd4453ddd0efbe 100644 --- a/dumux/geomechanics/el1p2c/el1p2clocaljacobian.hh +++ b/dumux/geomechanics/el1p2c/el1p2clocaljacobian.hh @@ -41,7 +41,6 @@ class ElOnePTwoCLocalJacobian : public ImplicitLocalJacobian<TypeTag> { private: typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView; - typedef typename GridView::Traits::template Codim<0>::EntityPointer ElementPointer; enum { dim = GridView::dimension, }; @@ -110,7 +109,7 @@ public: { int dofIdxGlobal; FVElementGeometry neighborFVGeom; - ElementPointer neighbor(this->element_()); + auto neighbor = this->element_(); if (isBox) { #if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4) @@ -123,11 +122,11 @@ public: else { neighbor = this->fvElemGeom_.neighbors[col]; - neighborFVGeom.updateInner(*neighbor); + neighborFVGeom.updateInner(neighbor); #if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4) - dofIdxGlobal = this->problemPtr_->elementMapper().index(*neighbor); + dofIdxGlobal = this->problemPtr_->elementMapper().index(neighbor); #else - dofIdxGlobal = this->problemPtr_->elementMapper().map(*neighbor); + dofIdxGlobal = this->problemPtr_->elementMapper().map(neighbor); #endif } @@ -163,7 +162,7 @@ public: else{ this->curVolVars_[col].update(priVars, this->problem_(), - *neighbor, + neighbor, neighborFVGeom, /*scvIdx=*/0, false); @@ -217,7 +216,7 @@ public: else{ this->curVolVars_[col].update(priVars, this->problem_(), - *neighbor, + neighbor, neighborFVGeom, /*scvIdx=*/0, false); diff --git a/dumux/implicit/1p2c/1p2cfluxvariables.hh b/dumux/implicit/1p2c/1p2cfluxvariables.hh index 4621eeeb4e089a4a650a8cd1b131fffbddc2db8d..641d9db8ff1cfe91b3cbaceaec84cf92f37563b0 100644 --- a/dumux/implicit/1p2c/1p2cfluxvariables.hh +++ b/dumux/implicit/1p2c/1p2cfluxvariables.hh @@ -367,11 +367,11 @@ protected: } else { - const Element& elementI = *fvGeometry_.neighbors[face().i]; + const Element& elementI = fvGeometry_.neighbors[face().i]; FVElementGeometry fvGeometryI; fvGeometryI.subContVol[0].global = elementI.geometry().center(); - const Element& elementJ = *fvGeometry_.neighbors[face().j]; + const Element& elementJ = fvGeometry_.neighbors[face().j]; FVElementGeometry fvGeometryJ; fvGeometryJ.subContVol[0].global = elementJ.geometry().center(); diff --git a/dumux/implicit/2p/2pgridadaptindicator.hh b/dumux/implicit/2p/2pgridadaptindicator.hh index ccccdeaf9c0511c6cba43c1d91b67aed9e067bc6..7b431c115b2d3c53ae45dc97010871818472d995 100644 --- a/dumux/implicit/2p/2pgridadaptindicator.hh +++ b/dumux/implicit/2p/2pgridadaptindicator.hh @@ -45,7 +45,6 @@ private: typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef typename GridView::IntersectionIterator IntersectionIterator; typedef typename GridView::Traits::template Codim<0>::Entity Element; - typedef typename GridView::Traits::template Codim<0>::EntityPointer ElementPointer; typedef typename GridView::template Codim<0>::Iterator ElementIterator; typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices; @@ -145,15 +144,15 @@ public: if (intersection.neighbor()) { // Access neighbor - ElementPointer outside = intersection.outside(); + auto outside = intersection.outside(); #if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4) - int globalIdxJ = problem_.elementMapper().index(*outside); + int globalIdxJ = problem_.elementMapper().index(outside); #else - int globalIdxJ = problem_.elementMapper().map(*outside); + int globalIdxJ = problem_.elementMapper().map(outside); #endif // Visit intersection only once - if (eIt->level() > outside->level() || (eIt->level() == outside->level() && globalIdxI < globalIdxJ)) + if (eIt->level() > outside.level() || (eIt->level() == outside.level() && globalIdxI < globalIdxJ)) { Scalar satJ = 0.0; @@ -162,7 +161,7 @@ public: else { const LocalFiniteElementCache feCache; - const auto geometryJ = outside->geometry(); + const auto geometryJ = outside.geometry(); Dune::GeometryType geomType = geometryJ.type(); GlobalPosition centerJ = geometryJ.local(geometryJ.center()); @@ -173,9 +172,9 @@ public: for (int i = 0; i < shapeVal.size(); ++i) { #if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4) - int dofIdxGlobal = problem_.model().dofMapper().subIndex(*outside, i, dofCodim); + int dofIdxGlobal = problem_.model().dofMapper().subIndex(outside, i, dofCodim); #else - int dofIdxGlobal = problem_.model().dofMapper().map(*outside, i, dofCodim); + int dofIdxGlobal = problem_.model().dofMapper().map(outside, i, dofCodim); #endif satJ += shapeVal[i]*problem_.model().curSol()[dofIdxGlobal][saturationIdx]; } diff --git a/dumux/implicit/2pminc/2pmincfluxvariables.hh b/dumux/implicit/2pminc/2pmincfluxvariables.hh index 59d0fd86b94a2f30c4fcb5cc3c6d3d0d168c5472..735f0e79ef65d6319eb41f10c396009d6a96de6b 100644 --- a/dumux/implicit/2pminc/2pmincfluxvariables.hh +++ b/dumux/implicit/2pminc/2pmincfluxvariables.hh @@ -251,11 +251,11 @@ protected: } else { - const Element& elementi = *fvGeometry_.neighbors[face().i]; + const Element& elementi = fvGeometry_.neighbors[face().i]; FVElementGeometry fvGeometryi; fvGeometryi.subContVol[0].global = elementi.geometry().center(); - const Element& elementj = *fvGeometry_.neighbors[face().j]; + const Element& elementj = fvGeometry_.neighbors[face().j]; FVElementGeometry fvGeometryj; fvGeometryj.subContVol[0].global = elementj.geometry().center(); diff --git a/dumux/implicit/2pminc/2pmincmodel.hh b/dumux/implicit/2pminc/2pmincmodel.hh index b40203ed5054d0e93d085251f40cac7e07af8312..d3111aef9c881dd952f93fb449fca9b59fc4b6ec 100644 --- a/dumux/implicit/2pminc/2pmincmodel.hh +++ b/dumux/implicit/2pminc/2pmincmodel.hh @@ -159,7 +159,7 @@ public: ElementIterator eEndIt = this->gridView_().template end<0>(); for (; eIt != eEndIt; ++eIt) { - int eIdx = this->elementMapper().map(*eIt); + int eIdx = this->elementMapper().index(*eIt); (*rank)[eIdx] = this->gridView_().comm().rank(); FVElementGeometry fvGeometry; @@ -173,7 +173,7 @@ public: for (int scvIdx = 0; scvIdx < fvGeometry.numScv; ++scvIdx) { - int globalIdx = this->dofMapper().map(*eIt, scvIdx, dofCodim); + int globalIdx = this->dofMapper().subIndex(*eIt, scvIdx, dofCodim); for (int nC=0; nC < numContinua; nC++) { (*pw[nC])[globalIdx] = elemVolVars[scvIdx].pressure(wPhaseIdx, nC); (*pn[nC])[globalIdx] = elemVolVars[scvIdx].pressure(nPhaseIdx, nC); diff --git a/dumux/implicit/2pncmin/2pncminmodel.hh b/dumux/implicit/2pncmin/2pncminmodel.hh index cc25e91744b997fcc6d0f8ee8a9af9afa57807b5..e89857f3a77d4ea030d509815709a9e7ddb07ff0 100644 --- a/dumux/implicit/2pncmin/2pncminmodel.hh +++ b/dumux/implicit/2pncmin/2pncminmodel.hh @@ -243,7 +243,7 @@ public: ElementIterator elemEndIt = this->gridView_().template end<0>(); for (; elemIt != elemEndIt; ++elemIt) { - int idx = this->problem_().elementMapper().map(*elemIt); + int idx = this->problem_().elementMapper().index(*elemIt); (*rank)[idx] = this->gridView_().comm().rank(); fvGeometry.update(this->gridView_(), *elemIt); @@ -259,7 +259,7 @@ public: #endif for (int i = 0; i < numVerts; ++i) { - int globalIdx = this->vertexMapper().map(*elemIt, i, dim); + int globalIdx = this->vertexMapper().subIndex(*elemIt, i, dim); volVars.update(sol[globalIdx], this->problem_(), *elemIt, @@ -394,7 +394,7 @@ public: fvGeometry.update(this->gridView_(), *it); for (int i = 0; i < fvGeometry.numScv; ++i) { - int globalIdx = this->vertexMapper().map(*it, i, dim); + int globalIdx = this->vertexMapper().subIndex(*it, i, dim); if (this->staticDat_[globalIdx].visited) continue; diff --git a/dumux/implicit/adaptive/adaptionhelper.hh b/dumux/implicit/adaptive/adaptionhelper.hh index 7bf86f562db18dabb4baffe902c7fb65053db1ba..ce029d655fccd0b9bef62c2528f214b045a90788 100644 --- a/dumux/implicit/adaptive/adaptionhelper.hh +++ b/dumux/implicit/adaptive/adaptionhelper.hh @@ -75,10 +75,8 @@ private: typedef typename Grid::LevelGridView LevelGridView; typedef typename LevelGridView::template Codim<dofCodim>::Iterator LevelIterator; typedef typename LevelGridView::template Codim<0>::Iterator ElementLevelIterator; - typedef typename GridView::Traits::template Codim<0>::EntityPointer ElementPointer; typedef typename GridView::Traits::template Codim<0>::Entity Element; typedef typename GridView::Traits::template Codim<dofCodim>::Entity DofEntity; - typedef typename GridView::Traits::template Codim<dofCodim>::EntityPointer DofPointer; typedef Dune::PersistentContainer<Grid, AdaptedValues> PersistentContainer; typedef Dune::FieldVector<Scalar, dimWorld> GlobalPosition; @@ -147,8 +145,7 @@ public: //Average in father if (eIt->level() > 0) { - ElementPointer epFather = eIt->father(); - AdaptedValues& adaptedValuesFather = adaptionMap_[*epFather]; + AdaptedValues& adaptedValuesFather = adaptionMap_[eIt->father()]; adaptedValuesFather.count += 1; storeAdaptionValues(adaptedValues, adaptedValuesFather); } @@ -223,9 +220,9 @@ public: for(unsigned int i = 0; i < numSubEntities; i++) { - DofPointer subEntity = eIt->template subEntity <dofCodim>(i); - AdaptedValues &adaptedValues = adaptionMap_[*subEntity]; - int newIdxI = this->dofIndex(problem, *subEntity); + auto subEntity = eIt->template subEntity <dofCodim>(i); + AdaptedValues &adaptedValues = adaptionMap_[subEntity]; + int newIdxI = this->dofIndex(problem, subEntity); setAdaptionValues(adaptedValues, problem.model().curSol()[newIdxI]); @@ -238,13 +235,13 @@ public: // value is not in map, interpolate from father element if (eIt->level() > 0 && eIt->hasFather()) { - ElementPointer epFather = eIt->father(); + auto epFather = eIt->father(); if(!isBox) { // create new entry: reconstruct from adaptionMap_[*father] to a new // adaptionMap_[*son] - reconstructAdaptionValues(adaptionMap_, *epFather, *eIt, problem); + reconstructAdaptionValues(adaptionMap_, epFather, *eIt, problem); // access new son AdaptedValues& adaptedValues = adaptionMap_[*eIt]; @@ -270,13 +267,13 @@ public: for(unsigned int i = 0; i < numSubEntities; i++) { - DofPointer subEntity = eIt->template subEntity <dofCodim>(i); - AdaptedValues &adaptedValues = adaptionMap_[*subEntity]; + auto subEntity = eIt->template subEntity <dofCodim>(i); + AdaptedValues &adaptedValues = adaptionMap_[subEntity]; if(adaptedValues.count == 0){ - LocalPosition dofCenterPos = geometryI.local(subEntity->geometry().center()); + LocalPosition dofCenterPos = geometryI.local(subEntity.geometry().center()); const LocalFiniteElementCache feCache; - Dune::GeometryType geomType = epFather->geometry().type(); + Dune::GeometryType geomType = epFather.geometry().type(); const LocalFiniteElement &localFiniteElement = feCache.get(geomType); std::vector<Dune::FieldVector<Scalar, 1> > shapeVal; @@ -284,8 +281,7 @@ public: PrimaryVariables u(0); for (int j = 0; j < shapeVal.size(); ++j) { - DofPointer subEntityFather = epFather->template subEntity <dofCodim>(j); - AdaptedValues & adaptedValuesFather = adaptionMap_[*subEntityFather]; + AdaptedValues & adaptedValuesFather = adaptionMap_[epFather.template subEntity <dofCodim>(j)]; u.axpy(shapeVal[j], adaptedValuesFather.u); } @@ -295,7 +291,7 @@ public: if (eIt->isLeaf()) { - int newIdxI = this->dofIndex(problem, *subEntity); + int newIdxI = this->dofIndex(problem, subEntity); setAdaptionValues(adaptedValues, problem.model().curSol()[newIdxI]); } diff --git a/dumux/implicit/adaptive/gridadapt.hh b/dumux/implicit/adaptive/gridadapt.hh index 209814dd61b0233cd1aaf7b81f3ab095b2a8474e..d3ab4040065daeb8d6622c9cd10a14461d66bb1f 100644 --- a/dumux/implicit/adaptive/gridadapt.hh +++ b/dumux/implicit/adaptive/gridadapt.hh @@ -61,7 +61,6 @@ class ImplicitGridAdapt typedef typename LeafGridView::template Codim<0>::Iterator LeafIterator; typedef typename GridView::IntersectionIterator LeafIntersectionIterator; typedef typename Grid::template Codim<0>::Entity Element; - typedef typename Grid::template Codim<0>::EntityPointer ElementPointer; typedef typename GET_PROP_TYPE(TypeTag, AdaptionIndicator) AdaptionIndicator; typedef typename GET_PROP_TYPE(TypeTag, AdaptionInitializationIndicator) AdaptionInitializationIndicator; @@ -352,20 +351,20 @@ private: if(!is->neighbor()) continue; - ElementPointer outside = is->outside(); + auto outside = is->outside(); // only mark non-ghost elements - if (outside->partitionType() == Dune::GhostEntity) + if (outside.partitionType() == Dune::GhostEntity) continue; - if ((outside->level() < levelMax_) - && (outside->level() < entity.level())) + if ((outside.level() < levelMax_) + && (outside.level() < entity.level())) { - problem_.grid().mark(1, *outside); + problem_.grid().mark(1, outside); ++marked_; if(level != levelMax_) - checkNeighborsRefine_(*outside, ++level); + checkNeighborsRefine_(outside, ++level); } } return true; @@ -406,11 +405,9 @@ private: if(!intersection.neighbor()) continue; - ElementPointer outside =intersection.outside(); - if (eIt.level()+maxLevelDelta<outside.level()) + if (eIt->level() + maxLevelDelta < intersection.outside().level()) { - ElementPointer entity =eIt; - problem_.grid().mark( 1, *entity ); + problem_.grid().mark(1, *eIt); done=false; } } diff --git a/dumux/implicit/adaptive/gridadaptinitializationindicator.hh b/dumux/implicit/adaptive/gridadaptinitializationindicator.hh index 7bc68f4f1a882ff20e35c7ba925d23000387f71c..237e82a9229ffc82ff178eca5d1d5d1969f6d698 100644 --- a/dumux/implicit/adaptive/gridadaptinitializationindicator.hh +++ b/dumux/implicit/adaptive/gridadaptinitializationindicator.hh @@ -68,7 +68,6 @@ private: typedef typename GridView::IntersectionIterator IntersectionIterator; typedef typename GridView::Traits::template Codim<0>::Entity Element; typedef typename GridView::Traits::template Codim<dim>::Entity Vertex; - typedef typename GridView::Traits::template Codim<dim>::EntityPointer VertexPointer; typedef typename GridView::Intersection Intersection; typedef typename GridView::template Codim<0>::Iterator ElementIterator; typedef typename GridView::Grid::ctype CoordScalar; @@ -139,8 +138,7 @@ private: { int scvIdx = refElement.subEntity(fIdx, 1, faceVertexIdx, dim); BoundaryTypes bcTypes = elemBcTypes[scvIdx]; - const VertexPointer v = element.template subEntity<dim>(scvIdx); - problemBoundaryTypes_(bcTypes, *v); + problemBoundaryTypes_(bcTypes, element.template subEntity<dim>(scvIdx)); int bfIdx = fvGeometry.boundaryFaceIndex(fIdx, faceVertexIdx); for (int i = 0; i < numEq; i++) { diff --git a/dumux/implicit/box/boxassembler.hh b/dumux/implicit/box/boxassembler.hh index dce8e72cb82e55a973c0a1425bb42b0e4507c986..114091a3e3aac8363ae9cbd6aa00c40378e909cb 100644 --- a/dumux/implicit/box/boxassembler.hh +++ b/dumux/implicit/box/boxassembler.hh @@ -47,7 +47,6 @@ class BoxAssembler : public ImplicitAssembler<TypeTag> typedef typename GridView::template Codim<0>::Entity Element; typedef typename GridView::template Codim<0>::Iterator ElementIterator; enum{ dim = GridView::dimension }; - typedef typename GridView::template Codim<dim>::EntityPointer VertexPointer; public: BoxAssembler(): ParentType() {} @@ -447,10 +446,10 @@ private: int numVerticesLocal = element.template count<dim>(); #endif for (int i=0; i < numVerticesLocal; ++i) { - const VertexPointer vp = element.template subEntity<dim>(i); + auto vertex = element.template subEntity<dim>(i); - if (vp->partitionType() == Dune::InteriorEntity || - vp->partitionType() == Dune::BorderEntity) + if (vertex.partitionType() == Dune::InteriorEntity || + vertex.partitionType() == Dune::BorderEntity) { // do not change the non-ghost vertices continue; @@ -458,9 +457,9 @@ private: // set main diagonal entries for the vertex #if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4) - int vIdx = this->vertexMapper_().index(*vp); + int vIdx = this->vertexMapper_().index(vertex); #else - int vIdx = this->vertexMapper_().map(*vp); + int vIdx = this->vertexMapper_().map(vertex); #endif typedef typename JacobianMatrix::block_type BlockType; BlockType &J = (*this->matrix_)[vIdx][vIdx]; diff --git a/dumux/implicit/box/boxelementboundarytypes.hh b/dumux/implicit/box/boxelementboundarytypes.hh index 2d5f4b49d2488a82860d55e5122eeccb077abdfe..2a1f91e3b61e9a64ccd16715c11164e970b2851b 100644 --- a/dumux/implicit/box/boxelementboundarytypes.hh +++ b/dumux/implicit/box/boxelementboundarytypes.hh @@ -49,7 +49,6 @@ class BoxElementBoundaryTypes : public std::vector<typename GET_PROP_TYPE(TypeTa enum { dim = GridView::dimension }; typedef typename GridView::template Codim<0>::Entity Element; - typedef typename GridView::template Codim<dim>::EntityPointer VertexPointer; public: /*! @@ -98,8 +97,7 @@ public: (*this)[i].reset(); if (problem.model().onBoundary(element, i)) { - const VertexPointer vptr = element.template subEntity<dim>(i); - problem.boundaryTypes((*this)[i], *vptr); + problem.boundaryTypes((*this)[i], element.template subEntity<dim>(i)); hasDirichlet_ = hasDirichlet_ || (*this)[i].hasDirichlet(); hasNeumann_ = hasNeumann_ || (*this)[i].hasNeumann(); diff --git a/dumux/implicit/box/boxfvelementgeometry.hh b/dumux/implicit/box/boxfvelementgeometry.hh index 5e724147f071dff9403c53b3a940dfd92c0cb67e..48bc73f3739ee2cd86126a0357d559c59d0d7246 100644 --- a/dumux/implicit/box/boxfvelementgeometry.hh +++ b/dumux/implicit/box/boxfvelementgeometry.hh @@ -392,7 +392,6 @@ class BoxFVElementGeometry typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef typename GridView::ctype CoordScalar; typedef typename GridView::Traits::template Codim<0>::Entity Element; - typedef typename GridView::Traits::template Codim<0>::EntityPointer ElementPointer; typedef typename Element::Geometry Geometry; typedef Dune::FieldVector<CoordScalar,dimWorld> GlobalPosition; typedef Dune::FieldVector<CoordScalar,dim> LocalPosition; @@ -652,7 +651,7 @@ public: int numScv; //!< number of subcontrol volumes int numScvf; //!< number of inner-domain subcontrolvolume faces int numNeighbors; //!< needed for compatibility with cc models - std::vector<ElementPointer> neighbors; //!< needed for compatibility with cc models + std::vector<Element> neighbors; //!< needed for compatibility with cc models const LocalFiniteElementCache feCache_; diff --git a/dumux/implicit/box/boxlocalresidual.hh b/dumux/implicit/box/boxlocalresidual.hh index 08989c6fe2f2f75a162d2d14d57c477a5b2f2fcd..8a838534a9a61bc44cb6beee6a3e8cfa4ae404ab 100644 --- a/dumux/implicit/box/boxlocalresidual.hh +++ b/dumux/implicit/box/boxlocalresidual.hh @@ -55,7 +55,6 @@ class BoxLocalResidual : public ImplicitLocalResidual<TypeTag> }; typedef typename GridView::template Codim<0>::Entity Element; - typedef typename GridView::template Codim<dim>::EntityPointer VertexPointer; typedef typename GridView::IntersectionIterator IntersectionIterator; typedef typename GridView::Grid::ctype CoordScalar; @@ -86,9 +85,8 @@ protected: if (bcTypes.hasDirichlet()) { // ask the problem for the dirichlet values - const VertexPointer vPtr = this->element_().template subEntity<dim>(scvIdx); Valgrind::SetUndefined(dirichletValues); - this->asImp_().problem_().dirichlet(dirichletValues, *vPtr); + this->asImp_().problem_().dirichlet(dirichletValues, this->element_().template subEntity<dim>(scvIdx)); // set the dirichlet conditions for (int eqIdx = 0; eqIdx < numEq; ++eqIdx) { diff --git a/dumux/implicit/cellcentered/ccassembler.hh b/dumux/implicit/cellcentered/ccassembler.hh index 41d3d5072b9ef01fb8533f4af9e22a732ae2ef26..9ef6dfbb85fb1ed812841822450699221fbfa2c3 100644 --- a/dumux/implicit/cellcentered/ccassembler.hh +++ b/dumux/implicit/cellcentered/ccassembler.hh @@ -120,7 +120,7 @@ private: if (isIt->neighbor()) { #if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4) - int neighborIdx = this->elementMapper_().index(*isIt->outside()); + int neighborIdx = this->elementMapper_().index(isIt->outside()); #else int neighborIdx = this->elementMapper_().map(*isIt->outside()); #endif @@ -173,7 +173,7 @@ private: if (isIt->neighbor()) { #if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4) - int globalJ = this->elementMapper_().index(*(isIt->outside())); + int globalJ = this->elementMapper_().index(isIt->outside()); #else int globalJ = this->elementMapper_().map(*(isIt->outside())); #endif @@ -248,7 +248,7 @@ private: if (isIt->neighbor()) { #if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4) - int globalJ = this->elementMapper_().index(*(isIt->outside())); + int globalJ = this->elementMapper_().index(isIt->outside()); #else int globalJ = this->elementMapper_().map(*(isIt->outside())); #endif diff --git a/dumux/implicit/cellcentered/ccelementvolumevariables.hh b/dumux/implicit/cellcentered/ccelementvolumevariables.hh index e55f359a4002546bfb94262d01f5b332c010ddc5..88c3e4d6f6897a2cf3dac66a801078d05bdf98cc 100644 --- a/dumux/implicit/cellcentered/ccelementvolumevariables.hh +++ b/dumux/implicit/cellcentered/ccelementvolumevariables.hh @@ -79,7 +79,7 @@ public: for (int i = 0; i < numNeighbors; i++) { - const Element& neighbor = *(fvGeometry.neighbors[i]); + const Element& neighbor = fvGeometry.neighbors[i]; #if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4) const PrimaryVariables &solI diff --git a/dumux/implicit/cellcentered/ccfvelementgeometry.hh b/dumux/implicit/cellcentered/ccfvelementgeometry.hh index cbf2f7e0007ac903ce0e85a6c52329d0cb26ac12..c29220012d4cc59d44e1b32b406b2bbeed1bcc7a 100644 --- a/dumux/implicit/cellcentered/ccfvelementgeometry.hh +++ b/dumux/implicit/cellcentered/ccfvelementgeometry.hh @@ -56,7 +56,6 @@ class CCFVElementGeometry typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef typename GridView::ctype CoordScalar; typedef typename GridView::Traits::template Codim<0>::Entity Element; - typedef typename GridView::Traits::template Codim<0>::EntityPointer ElementPointer; typedef typename Element::Geometry Geometry; typedef Dune::FieldVector<CoordScalar,dimWorld> GlobalPosition; typedef Dune::FieldVector<CoordScalar,dim> LocalPosition; @@ -96,7 +95,7 @@ public: int numScv; //!< number of subcontrol volumes int numScvf; //!< number of inner-domain subcontrolvolume faces int numNeighbors; //!< number of neighboring elements including the element itself - std::vector<ElementPointer> neighbors; //!< stores pointers for the neighboring elements + std::vector<Element> neighbors; //!< stores the neighboring elements void updateInner(const Element& element) { @@ -118,8 +117,7 @@ public: numNeighbors = 1; neighbors.clear(); neighbors.reserve(maxNE); - ElementPointer elementPointer(element); - neighbors.push_back(elementPointer); + neighbors.push_back(element); } void update(const GridView& gridView, const Element& element) @@ -140,8 +138,7 @@ public: if (isIt->neighbor()) { numNeighbors++; - ElementPointer elementPointer(isIt->outside()); - neighbors.push_back(elementPointer); + neighbors.push_back(isIt->outside()); int scvfIdx = numNeighbors - 2; SubControlVolumeFace& scvFace = subContVolFace[scvfIdx]; @@ -157,7 +154,7 @@ public: scvFace.area = volume; GlobalPosition distVec = elementGlobal - - neighbors[scvfIdx+1]->geometry().center(); + - neighbors[scvfIdx+1].geometry().center(); distVec /= distVec.two_norm2(); // gradients using a two-point flux approximation @@ -214,7 +211,6 @@ public: // treat elements on the boundary if (onBoundary) { - ElementPointer elementPointer(element); #if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4) for (int bfIdx = 0; bfIdx < element.subEntities(1); bfIdx++) #else @@ -224,7 +220,7 @@ public: SubControlVolumeFace& bFace = boundaryFace[bfIdx]; bFace.j = numNeighbors + bfIdx; bFace.fapIndices[1] = bFace.j; - neighbors.push_back(elementPointer); + neighbors.push_back(element); } } } diff --git a/dumux/implicit/common/implicitdarcyfluxvariables.hh b/dumux/implicit/common/implicitdarcyfluxvariables.hh index d9b38f64b1c934ba3131be5fbf280df2ee983e0d..fd80f14f30b605baf8a0d4260bd8c17766365c73 100644 --- a/dumux/implicit/common/implicitdarcyfluxvariables.hh +++ b/dumux/implicit/common/implicitdarcyfluxvariables.hh @@ -255,11 +255,11 @@ protected: } else { - const Element& elementI = *fvGeometry_.neighbors[face().i]; + const Element& elementI = fvGeometry_.neighbors[face().i]; FVElementGeometry fvGeometryI; fvGeometryI.subContVol[0].global = elementI.geometry().center(); - const Element& elementJ = *fvGeometry_.neighbors[face().j]; + const Element& elementJ = fvGeometry_.neighbors[face().j]; FVElementGeometry fvGeometryJ; fvGeometryJ.subContVol[0].global = elementJ.geometry().center(); diff --git a/dumux/implicit/common/implicitforchheimerfluxvariables.hh b/dumux/implicit/common/implicitforchheimerfluxvariables.hh index bcec756780fb350ef66ae09cf13b6a9db30dc66e..18e3bb9470b4c05119e2bdea8102efaf7976ca08 100644 --- a/dumux/implicit/common/implicitforchheimerfluxvariables.hh +++ b/dumux/implicit/common/implicitforchheimerfluxvariables.hh @@ -148,11 +148,11 @@ protected: } else { - const Element& elementI = *this->fvGeometry_.neighbors[this->face().i]; + const Element& elementI = this->fvGeometry_.neighbors[this->face().i]; FVElementGeometry fvGeometryI; fvGeometryI.subContVol[0].global = elementI.geometry().center(); - const Element& elementJ = *this->fvGeometry_.neighbors[this->face().j]; + const Element& elementJ = this->fvGeometry_.neighbors[this->face().j]; FVElementGeometry fvGeometryJ; fvGeometryJ.subContVol[0].global = elementJ.geometry().center(); diff --git a/dumux/implicit/common/implicitlocaljacobian.hh b/dumux/implicit/common/implicitlocaljacobian.hh index d874d5f0647f0fe72a6c013bd911f27ba9228b0b..5079c34b9d7a52061bd5d1e42ab2ad4e53f0b994 100644 --- a/dumux/implicit/common/implicitlocaljacobian.hh +++ b/dumux/implicit/common/implicitlocaljacobian.hh @@ -74,7 +74,6 @@ private: typedef typename GET_PROP_TYPE(TypeTag, Model) Model; typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView; typedef typename GridView::template Codim<0>::Entity Element; - typedef typename GridView::Traits::template Codim<0>::EntityPointer ElementPointer; typedef typename GET_PROP_TYPE(TypeTag, JacobianAssembler) JacobianAssembler; enum { @@ -408,7 +407,7 @@ protected: { int dofIdxGlobal; FVElementGeometry neighborFVGeom; - ElementPointer neighbor(element_()); + auto neighbor = element_(); if (isBox) { #if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4) @@ -420,11 +419,11 @@ protected: else { neighbor = fvElemGeom_.neighbors[col]; - neighborFVGeom.updateInner(*neighbor); + neighborFVGeom.updateInner(neighbor); #if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4) - dofIdxGlobal = problemPtr_->elementMapper().index(*neighbor); + dofIdxGlobal = problemPtr_->elementMapper().index(neighbor); #else - dofIdxGlobal = problemPtr_->elementMapper().map(*neighbor); + dofIdxGlobal = problemPtr_->elementMapper().map(neighbor); #endif } @@ -454,7 +453,7 @@ protected: else curVolVars_[col].update(priVars, problem_(), - *neighbor, + neighbor, neighborFVGeom, /*scvIdx=*/0, false); @@ -499,7 +498,7 @@ protected: else curVolVars_[col].update(priVars, problem_(), - *neighbor, + neighbor, neighborFVGeom, /*scvIdx=*/0, false); diff --git a/dumux/implicit/cornerpoint/cpdarcyfluxvariables.hh b/dumux/implicit/cornerpoint/cpdarcyfluxvariables.hh index d3061419c553f85c977a52fc588487c0a4e965a8..682ccef2a236e3e1846c9d779368bf9ace5e46b2 100644 --- a/dumux/implicit/cornerpoint/cpdarcyfluxvariables.hh +++ b/dumux/implicit/cornerpoint/cpdarcyfluxvariables.hh @@ -169,7 +169,7 @@ protected: // calculate the transmissibilities const SpatialParams &spatialParams = problem.spatialParams(); - const Element& elementI = *fvGeometry_.neighbors[face().i]; + const Element& elementI = fvGeometry_.neighbors[face().i]; FVElementGeometry fvGeometryI; fvGeometryI.subContVol[0].global = elementI.geometry().center(); auto ki = spatialParams.intrinsicPermeability(elementI, fvGeometryI, 0); @@ -183,7 +183,7 @@ protected: auto tij = ti; if (!onBoundary_) { - const Element& elementJ = *fvGeometry_.neighbors[face().j]; + const Element& elementJ = fvGeometry_.neighbors[face().j]; FVElementGeometry fvGeometryJ; fvGeometryJ.subContVol[0].global = elementJ.geometry().center(); auto kj = spatialParams.intrinsicPermeability(elementJ, fvGeometryJ, 0); @@ -230,7 +230,7 @@ protected: } else { - const Element& elementJ = *fvGeometry_.neighbors[face().j]; + const Element& elementJ = fvGeometry_.neighbors[face().j]; auto globalPosJ = elementJ.geometry().center(); potentialJ -= density*(problem.gravityAtPos(globalPosJ)*globalPosJ); } diff --git a/dumux/implicit/cornerpoint/cpelementvolumevariables.hh b/dumux/implicit/cornerpoint/cpelementvolumevariables.hh index 511f60aecdc1bb4443a1b6ed66c0828852a0ec57..9d4e3f834a91c08bbe84132be2ad87eda63fd33f 100644 --- a/dumux/implicit/cornerpoint/cpelementvolumevariables.hh +++ b/dumux/implicit/cornerpoint/cpelementvolumevariables.hh @@ -79,7 +79,7 @@ public: for (int i = 0; i < numNeighbors; i++) { - const Element& neighbor = *(fvGeometry.neighbors[i]); + const Element& neighbor = fvGeometry.neighbors[i]; #if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4) const PrimaryVariables &solI diff --git a/dumux/implicit/cornerpoint/cpfvelementgeometry.hh b/dumux/implicit/cornerpoint/cpfvelementgeometry.hh index 568c3fc6ba36c06ab2b70032b13b81d8e008dc25..1db5660cc5048291afd547ff4020fb2f348fd732 100644 --- a/dumux/implicit/cornerpoint/cpfvelementgeometry.hh +++ b/dumux/implicit/cornerpoint/cpfvelementgeometry.hh @@ -56,7 +56,6 @@ class CpFVElementGeometry typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef typename GridView::ctype CoordScalar; typedef typename GridView::Traits::template Codim<0>::Entity Element; - typedef typename GridView::Traits::template Codim<0>::EntityPointer ElementPointer; typedef typename Element::Geometry Geometry; typedef Dune::FieldVector<CoordScalar,dimWorld> GlobalPosition; typedef Dune::FieldVector<CoordScalar,dim> LocalPosition; @@ -96,7 +95,7 @@ public: int numScv; //!< number of subcontrol volumes int numScvf; //!< number of inner-domain subcontrolvolume faces int numNeighbors; //!< number of neighboring elements including the element itself - std::vector<ElementPointer> neighbors; //!< stores pointers for the neighboring elements + std::vector<Element> neighbors; //!< stores the neighboring elements void updateInner(const Element& element) { @@ -118,8 +117,7 @@ public: numNeighbors = 1; neighbors.clear(); neighbors.reserve(maxNE); - ElementPointer elementPointer(element); - neighbors.push_back(elementPointer); + neighbors.push_back(element); } void update(const GridView& gridView, const Element& element) @@ -140,8 +138,7 @@ public: if (isIt->neighbor()) { numNeighbors++; - ElementPointer elementPointer(isIt->outside()); - neighbors.push_back(elementPointer); + neighbors.push_back(isIt->outside()); int scvfIdx = numNeighbors - 2; SubControlVolumeFace& scvFace = subContVolFace[scvfIdx]; @@ -161,7 +158,7 @@ public: scvFace.area = volume; GlobalPosition distVec = elementGlobal - - neighbors[scvfIdx+1]->geometry().center(); + - neighbors[scvfIdx+1].geometry().center(); distVec /= distVec.two_norm2(); // gradients using a two-point flux approximation @@ -222,13 +219,12 @@ public: // treat elements on the boundary if (onBoundary) { - ElementPointer elementPointer(element); for (int bfIdx = 0; bfIdx < maxBF; bfIdx++) { SubControlVolumeFace& bFace = boundaryFace[bfIdx]; bFace.j = numNeighbors + bfIdx; bFace.fapIndices[1] = bFace.j; - neighbors.push_back(elementPointer); + neighbors.push_back(element); } } } diff --git a/dumux/implicit/mpnc/energy/mpncfluxvariablesenergy.hh b/dumux/implicit/mpnc/energy/mpncfluxvariablesenergy.hh index ffd89cbe25c92e306ff8e2aa2e10a3f951d8051f..75dfbc3c17a66929f4d78970cb5a3b70eab71ad0 100644 --- a/dumux/implicit/mpnc/energy/mpncfluxvariablesenergy.hh +++ b/dumux/implicit/mpnc/energy/mpncfluxvariablesenergy.hh @@ -206,7 +206,7 @@ protected: } else { - const Element & elementI = *fvGeometry.neighbors[i]; + const Element & elementI = fvGeometry.neighbors[i]; FVElementGeometry fvGeometryI; fvGeometryI.subContVol[0].global = elementI.geometry().center(); @@ -217,7 +217,7 @@ protected: problem.spatialParams().solidThermalConductivity(elementI, fvGeometryI, 0), problem.spatialParams().porosity(elementI, fvGeometryI, 0)); - const Element & elementJ = *fvGeometry.neighbors[j]; + const Element & elementJ = fvGeometry.neighbors[j]; FVElementGeometry fvGeometryJ; fvGeometryJ.subContVol[0].global = elementJ.geometry().center(); diff --git a/dumux/implicit/mpnc/energy/mpncfluxvariablesenergykinetic.hh b/dumux/implicit/mpnc/energy/mpncfluxvariablesenergykinetic.hh index 7e6b35db98efa3903fa22b55a1cef8222318eb34..7dc2e668ac606bc02fcf4d2d65cbc7cec8c6b7e2 100644 --- a/dumux/implicit/mpnc/energy/mpncfluxvariablesenergykinetic.hh +++ b/dumux/implicit/mpnc/energy/mpncfluxvariablesenergykinetic.hh @@ -260,7 +260,7 @@ protected: } else { - const Element & elementI = *fvGeometry.neighbors[i]; + const Element & elementI = fvGeometry.neighbors[i]; FVElementGeometry fvGeometryI; fvGeometryI.subContVol[0].global = elementI.geometry().center(); @@ -271,7 +271,7 @@ protected: problem.spatialParams().solidThermalConductivity(elementI, fvGeometryI, 0), problem.spatialParams().porosity(elementI, fvGeometryI, 0)); - const Element & elementJ = *fvGeometry.neighbors[j]; + const Element & elementJ = fvGeometry.neighbors[j]; FVElementGeometry fvGeometryJ; fvGeometryJ.subContVol[0].global = elementJ.geometry().center(); diff --git a/dumux/implicit/nonisothermal/nifluxvariables.hh b/dumux/implicit/nonisothermal/nifluxvariables.hh index 09ecbd2b2b5f32f7113a05552bcb4047ec8c04aa..3ad5064804018629963b3fc6ec6d85ba27d39ec4 100644 --- a/dumux/implicit/nonisothermal/nifluxvariables.hh +++ b/dumux/implicit/nonisothermal/nifluxvariables.hh @@ -149,7 +149,7 @@ protected: } else { - const Element& elementI = *this->fvGeometry_.neighbors[i]; + const Element& elementI = this->fvGeometry_.neighbors[i]; FVElementGeometry fvGeometryI; fvGeometryI.subContVol[0].global = elementI.geometry().center(); @@ -158,7 +158,7 @@ protected: problem.spatialParams(), elementI, fvGeometryI, 0); - const Element& elementJ = *this->fvGeometry_.neighbors[j]; + const Element& elementJ = this->fvGeometry_.neighbors[j]; FVElementGeometry fvGeometryJ; fvGeometryJ.subContVol[0].global = elementJ.geometry().center(); diff --git a/test/decoupled/2p/buckleyleverettanalyticsolution.hh b/test/decoupled/2p/buckleyleverettanalyticsolution.hh index 3297ed8a2a31fad22d8c1efd15c1026e8118236d..5ec62412f9f4db8ac8d28edba2498d87216b685e 100644 --- a/test/decoupled/2p/buckleyleverettanalyticsolution.hh +++ b/test/decoupled/2p/buckleyleverettanalyticsolution.hh @@ -88,7 +88,6 @@ template<class TypeTag> class BuckleyLeverettAnalytic }; typedef Dune::BlockVector<Dune::FieldVector<Scalar, 1> > BlockVector; - typedef typename GridView::Traits::template Codim<0>::EntityPointer ElementPointer; typedef typename GridView::template Codim<0>::Iterator ElementIterator; typedef Dune::FieldVector<Scalar, dimworld> GlobalPosition; @@ -201,12 +200,11 @@ private: for (ElementIterator eIt = problem_.gridView().template begin<0> (); eIt != eEndIt; ++eIt) { // get entity - ElementPointer element = *eIt; - int index = problem_.variables().index(*element); + int index = problem_.variables().index(*eIt); Scalar sat = problem_.variables().cellData(index).saturation(wPhaseIdx); - Scalar volume = element->geometry().volume(); + Scalar volume = eIt->geometry().volume(); Scalar error = analyticSolution_[index] - sat; diff --git a/test/decoupled/2p/mcwhorteranalyticsolution.hh b/test/decoupled/2p/mcwhorteranalyticsolution.hh index bccf81761d391eb6d104b78cb8dcb015c133c7c9..c82ca7984ba5619241bbb4be981fd48918292827 100644 --- a/test/decoupled/2p/mcwhorteranalyticsolution.hh +++ b/test/decoupled/2p/mcwhorteranalyticsolution.hh @@ -70,7 +70,6 @@ class McWhorterAnalytic }; typedef Dune::BlockVector<Dune::FieldVector<Scalar, 1> > BlockVector; - typedef typename GridView::Traits::template Codim<0>::EntityPointer ElementPointer; typedef typename GridView::template Codim<0>::Iterator ElementIterator; typedef Dune::FieldVector<Scalar, dimworld> GlobalPosition; @@ -100,12 +99,11 @@ private: for (ElementIterator eIt = problem_.gridView().template begin<0> (); eIt != eEndIt; ++eIt) { // get entity - ElementPointer element = *eIt; - int index = problem_.variables().index(*element); + int index = problem_.variables().index(*eIt); Scalar sat = problem_.variables().cellData(index).saturation(wPhaseIdx); - Scalar volume = element->geometry().volume(); + Scalar volume = eIt->geometry().volume(); Scalar error = analyticSolution_[index] - sat; diff --git a/test/decoupled/2p/test_3d2pproblem.hh b/test/decoupled/2p/test_3d2pproblem.hh index 4f4e784d9bc792fa1caa1a5366741d9d07c0749b..dfd8a692e246816f3b9536bcb3b0b47a898a29fc 100644 --- a/test/decoupled/2p/test_3d2pproblem.hh +++ b/test/decoupled/2p/test_3d2pproblem.hh @@ -171,8 +171,6 @@ enum typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef typename GridView::Traits::template Codim<0>::Entity Element; -typedef typename GridView::Traits::template Codim<0>::EntityPointer ElementPointer; -typedef typename GridView::Traits::template Codim<dim>::EntityPointer VertexPointer; typedef typename GridView::Intersection Intersection; typedef Dune::FieldVector<Scalar, dimWorld> GlobalPosition; typedef Dune::FieldVector<Scalar, dim> LocalPosition; @@ -295,7 +293,7 @@ void source(PrimaryVariables &values,const Element& element) const int numVertices = element.geometry().corners(); for(int i = 0; i < numVertices; i++) { - GlobalPosition globalPos(element.template subEntity<dim>(i)->geometry().center()); + GlobalPosition globalPos(element.template subEntity<dim>(i).geometry().center()); if (globalPos[0] < inflowEdge_[0] + eps_ && globalPos[1] < inflowEdge_[1] + eps_ && globalPos[2] < inflowEdge_[2] + eps_) { @@ -338,11 +336,11 @@ void boundaryTypesAtPos(BoundaryTypes &bcTypes, const GlobalPosition& globalPos) void boundaryTypes(BoundaryTypes &bcTypes, const Intersection& intersection) const { #if PROBLEM == 2 //Nine-Spot - ElementPointer element = intersection.inside(); - int numVertices = element->geometry().corners(); + auto element = intersection.inside(); + int numVertices = element.geometry().corners(); for(int i = 0; i < numVertices; i++) { - GlobalPosition globalPos(element->template subEntity<dim>(i)->geometry().center()); + GlobalPosition globalPos(element.template subEntity<dim>(i).geometry().center()); if (globalPos[0] > outflowEdge_[0] - eps_ && globalPos[1] > outflowEdge_[1] - eps_ && globalPos[2] > outflowEdge_[2] - eps_) { diff --git a/test/decoupled/2p2c/test_adaptive2p2c2dproblem.hh b/test/decoupled/2p2c/test_adaptive2p2c2dproblem.hh index 6261ea559588f6364e37de3c976b8477a3579826..8899d795c5bc9c763da28b641152823e18036a49 100644 --- a/test/decoupled/2p2c/test_adaptive2p2c2dproblem.hh +++ b/test/decoupled/2p2c/test_adaptive2p2c2dproblem.hh @@ -140,7 +140,6 @@ enum typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef typename GridView::Traits::template Codim<0>::Entity Element; -typedef typename Grid::Traits::template Codim<0>::EntityPointer ElementPointer; typedef typename GridView::Intersection Intersection; typedef Dune::FieldVector<Scalar, dimWorld> GlobalPosition; @@ -235,13 +234,13 @@ void neumannAtPos(PrimaryVariables &neumannValues, const GlobalPosition& globalP void source(PrimaryVariables &values, const Element &element) { this->setZero(values); - ElementPointer father(element); + auto father = element; // access level 1 entity - while (father->level() != this->gridAdapt().getMinLevel()) + while (father.level() != this->gridAdapt().getMinLevel()) { - father = father->father(); + father = father.father(); } - GlobalPosition globalPos = father->geometry().center(); + GlobalPosition globalPos = father.geometry().center(); if (fabs(globalPos[0] - 4.8) < 0.5 && fabs(globalPos[1] - 4.8) < 0.5) values[Indices::contiNEqIdx] = 0.0001; }