diff --git a/dumux/implicit/1p2c/1p2cfluxvariables.hh b/dumux/implicit/1p2c/1p2cfluxvariables.hh index 81a09a609889ad456799bb5b921f587de3daeb1f..9dd73c15635172005f11af43b8b22105e5cabd7d 100644 --- a/dumux/implicit/1p2c/1p2cfluxvariables.hh +++ b/dumux/implicit/1p2c/1p2cfluxvariables.hh @@ -351,14 +351,22 @@ protected: const ElementVolumeVariables &elemVolVars) { const SpatialParams &sp = problem.spatialParams(); - sp.meanK(K_, - sp.intrinsicPermeability(element, - fvGeometry_, - face().i), - sp.intrinsicPermeability(element, - fvGeometry_, - face().j)); - + if (GET_PROP_VALUE(TypeTag, ImplicitIsBox)) + { + sp.meanK(K_, + sp.intrinsicPermeability(element, + fvGeometry_, + face().i), + sp.intrinsicPermeability(element, + fvGeometry_, + face().j)); + } + else + { + sp.meanK(K_, + sp.elementIntrinsicPermeability(*fvGeometry_.neighbors[face().i]), + sp.elementIntrinsicPermeability(*fvGeometry_.neighbors[face().j])); + } } /*! diff --git a/dumux/implicit/box/boxdarcyfluxvariables.hh b/dumux/implicit/box/boxdarcyfluxvariables.hh index 6e5d3df449f65a22a12966497c6a5a2c0a6e800c..e950b5323ec5eea0ed052e5473f033e73b590843 100644 --- a/dumux/implicit/box/boxdarcyfluxvariables.hh +++ b/dumux/implicit/box/boxdarcyfluxvariables.hh @@ -91,7 +91,7 @@ public: const int faceIdx, const ElementVolumeVariables &elemVolVars, const bool onBoundary = false) - : fvGeometry_(fvGeometry), faceIdx_(faceIdx), onBoundary_(onBoundary) + : fvGeometry_(fvGeometry), faceIdx_(faceIdx), onBoundary_(onBoundary) { mobilityUpwindWeight_ = GET_PARAM_FROM_GROUP(TypeTag, Scalar, Implicit, MobilityUpwindWeight); calculateGradients_(problem, element, elemVolVars); @@ -165,17 +165,7 @@ public: } protected: - const FVElementGeometry &fvGeometry_; //!< Information about the geometry of discretization - const unsigned int faceIdx_; //!< The index of the sub control volume face - const bool onBoundary_; //!< Specifying whether we are currently on the boundary of the simulation domain - unsigned int upstreamIdx_[numPhases] , downstreamIdx_[numPhases]; //!< local index of the upstream / downstream vertex - Scalar volumeFlux_[numPhases] ; //!< Velocity multiplied with normal (magnitude=area) - DimVector velocity_[numPhases] ; //!< The velocity as determined by Darcy's law or by the Forchheimer relation - Scalar kGradPNormal_[numPhases] ; //!< Permeability multiplied with gradient in potential, multiplied with normal (magnitude=area) - DimVector kGradP_[numPhases] ; //!< Permeability multiplied with gradient in potential - DimVector gradPotential_[numPhases] ; //!< Gradient of potential, which drives flow - Scalar mobilityUpwindWeight_; //!< Upwind weight for mobility. Set to one for full upstream weighting - + /* * \brief Calculation of the potential gradients * @@ -255,13 +245,23 @@ protected: // calculate the mean intrinsic permeability const SpatialParams &spatialParams = problem.spatialParams(); Tensor K; - spatialParams.meanK(K, - spatialParams.intrinsicPermeability(element, - fvGeometry_, - face().i), - spatialParams.intrinsicPermeability(element, - fvGeometry_, - face().j)); + if (GET_PROP_VALUE(TypeTag, ImplicitIsBox)) + { + spatialParams.meanK(K, + spatialParams.intrinsicPermeability(element, + fvGeometry_, + face().i), + spatialParams.intrinsicPermeability(element, + fvGeometry_, + face().j)); + } + else + { + spatialParams.meanK(K, + spatialParams.elementIntrinsicPermeability(*fvGeometry_.neighbors[face().i]), + spatialParams.elementIntrinsicPermeability(*fvGeometry_.neighbors[face().j])); + } + // loop over all phases for (int phaseIdx = 0; phaseIdx < numPhases; phaseIdx++) { @@ -306,6 +306,17 @@ protected: volumeFlux_[phaseIdx] = velocity_[phaseIdx] * face().normal ; }// loop all phases } + + const FVElementGeometry &fvGeometry_; //!< Information about the geometry of discretization + const unsigned int faceIdx_; //!< The index of the sub control volume face + const bool onBoundary_; //!< Specifying whether we are currently on the boundary of the simulation domain + unsigned int upstreamIdx_[numPhases] , downstreamIdx_[numPhases]; //!< local index of the upstream / downstream vertex + Scalar volumeFlux_[numPhases] ; //!< Velocity multiplied with normal (magnitude=area) + DimVector velocity_[numPhases] ; //!< The velocity as determined by Darcy's law or by the Forchheimer relation + Scalar kGradPNormal_[numPhases] ; //!< Permeability multiplied with gradient in potential, multiplied with normal (magnitude=area) + DimVector kGradP_[numPhases] ; //!< Permeability multiplied with gradient in potential + DimVector gradPotential_[numPhases] ; //!< Gradient of potential, which drives flow + Scalar mobilityUpwindWeight_; //!< Upwind weight for mobility. Set to one for full upstream weighting }; } // end namespace diff --git a/dumux/implicit/box/boxforchheimerfluxvariables.hh b/dumux/implicit/box/boxforchheimerfluxvariables.hh index ec3117cb08f9215b4d3048aaec4f665abbb11de9..78d008f20316903f1c6235e14cbc7bea4d4c3fd5 100644 --- a/dumux/implicit/box/boxforchheimerfluxvariables.hh +++ b/dumux/implicit/box/boxforchheimerfluxvariables.hh @@ -133,14 +133,23 @@ protected: // calculate the mean intrinsic permeability const SpatialParams &spatialParams = problem.spatialParams(); Tensor K; - spatialParams.meanK(K, - spatialParams.intrinsicPermeability(element, - this->fvGeometry_, - this->face().i), - spatialParams.intrinsicPermeability(element, - this->fvGeometry_, - this->face().j)); - + if (GET_PROP_VALUE(TypeTag, ImplicitIsBox)) + { + spatialParams.meanK(K, + spatialParams.intrinsicPermeability(element, + fvGeometry_, + face().i), + spatialParams.intrinsicPermeability(element, + fvGeometry_, + face().j)); + } + else + { + spatialParams.meanK(K, + spatialParams.elementIntrinsicPermeability(*fvGeometry_.neighbors[face().i]), + spatialParams.elementIntrinsicPermeability(*fvGeometry_.neighbors[face().j])); + } + // obtain the Forchheimer coefficient from the spatial parameters const Scalar forchCoeff = spatialParams.forchCoeff(element, this->fvGeometry_, diff --git a/dumux/implicit/box/boxfvelementgeometry.hh b/dumux/implicit/box/boxfvelementgeometry.hh index db674645941f728837bc572cdca3b2b9fca771ff..2a8dcf4c97767c2b14ca59d88a5527e7f3f180ca 100644 --- a/dumux/implicit/box/boxfvelementgeometry.hh +++ b/dumux/implicit/box/boxfvelementgeometry.hh @@ -591,7 +591,10 @@ public: std::vector<ElementPointer> neighbors; //!< needed for compatibility with cc models const LocalFiniteElementCache feCache_; - + + void updateInner(const Element& element) //!< needed for compatibility with cc models + {} + void update(const GridView& gridView, const Element& element) { const Geometry& geometry = element.geometry(); diff --git a/dumux/implicit/cellcentered/ccelementvolumevariables.hh b/dumux/implicit/cellcentered/ccelementvolumevariables.hh index 6700444b86789bf78fff7d38484efb089280bd11..8a34634c1f8e6d0f6bd9d6d0dc9e2a74a3a6f9f3 100644 --- a/dumux/implicit/cellcentered/ccelementvolumevariables.hh +++ b/dumux/implicit/cellcentered/ccelementvolumevariables.hh @@ -90,7 +90,7 @@ public: = globalSol[problem.elementMapper().map(neighbor)]; FVElementGeometry neighborFVGeom; - neighborFVGeom.updateInner(problem.gridView(), neighbor); + neighborFVGeom.updateInner(neighbor); (*this)[i].update(solI, problem, diff --git a/dumux/implicit/cellcentered/ccfvelementgeometry.hh b/dumux/implicit/cellcentered/ccfvelementgeometry.hh index 9c9020db2342cbc06e450f446fd356c6cc2ab2fc..79e88ddee03724039274a614596d16d41ff4c3f1 100644 --- a/dumux/implicit/cellcentered/ccfvelementgeometry.hh +++ b/dumux/implicit/cellcentered/ccfvelementgeometry.hh @@ -114,7 +114,7 @@ public: int numFAP; //!< number of flux approximation points std::vector<ElementPointer> neighbors; //!< stores pointers for the neighboring elements - void updateInner(const GridView& gridView, const Element& e) + void updateInner(const Element& e) { const Geometry& geometry = e.geometry(); @@ -143,7 +143,7 @@ public: void update(const GridView& gridView, const Element& e) { - updateInner(gridView, e); + updateInner(e); const Geometry& geometry = e.geometry(); diff --git a/dumux/implicit/cellcentered/cclocaljacobian.hh b/dumux/implicit/cellcentered/cclocaljacobian.hh index 2da777b72afaab0ee1c26706ed506ab075edceb3..1aa4d7ff50bf071ac15e734397c70fbcb1b64403 100644 --- a/dumux/implicit/cellcentered/cclocaljacobian.hh +++ b/dumux/implicit/cellcentered/cclocaljacobian.hh @@ -390,7 +390,7 @@ protected: { const Element& neighbor = *(fvElemGeom_.neighbors[neighborIdx]); FVElementGeometry neighborFVGeom; - neighborFVGeom.updateInner(problemPtr_->gridView(), neighbor); + neighborFVGeom.updateInner(neighbor); int globalIdx = problemPtr_->elementMapper().map(neighbor); diff --git a/dumux/material/spatialparams/boxspatialparams1p.hh b/dumux/material/spatialparams/boxspatialparams1p.hh index bb73bcfd7b32ac89a5606949faa3e097a8a058b3..b1c6e0e7060ac44a42eb260f29110408694dd288 100644 --- a/dumux/material/spatialparams/boxspatialparams1p.hh +++ b/dumux/material/spatialparams/boxspatialparams1p.hh @@ -107,6 +107,13 @@ public: result[i][j] = harmonicMean(K1[i][j], K2[i][j]); } + Scalar elementIntrinsicPermeability (const Element &element) const + { + FVElementGeometry fvGeometry; + fvGeometry.subContVol[0].global = element.geometry().center(); + return asImp_().intrinsicPermeability(element, fvGeometry, /*scvIdx=*/0); + } + /*! * \brief Function for defining the intrinsic (absolute) permeability. * diff --git a/test/implicit/2p/lensspatialparams.hh b/test/implicit/2p/lensspatialparams.hh index 50d24f97836a13c45c894b86d82232b1781996f5..63b909c947bd371495045a0b7b741e058e1b832c 100644 --- a/test/implicit/2p/lensspatialparams.hh +++ b/test/implicit/2p/lensspatialparams.hh @@ -146,16 +146,13 @@ public: const FVElementGeometry &fvElemGeom, int scvIdx) const { - if (!isBox_ && scvIdx > 0) - return intrinsicPermeability(*(fvElemGeom.neighbors[scvIdx]), fvElemGeom, 0); - const GlobalPosition& globalPos = fvElemGeom.subContVol[scvIdx].global; if (isInLens_(globalPos)) return lensK_; return outerK_; } - + /*! * \brief Porosity * @@ -181,9 +178,6 @@ public: const FVElementGeometry &fvElemGeom, int scvIdx) const { - if (!isBox_ && scvIdx > 0) - return materialLawParams(*(fvElemGeom.neighbors[scvIdx]), fvElemGeom, 0); - const GlobalPosition& globalPos = fvElemGeom.subContVol[scvIdx].global; if (isInLens_(globalPos))