diff --git a/dumux/assembly/staggeredlocalresidual.hh b/dumux/assembly/staggeredlocalresidual.hh index 2d5b6e4138c7d1acd0fcd7bbb1204e9cc34c5d56..19802d650cbdfac486f55b89b53590ee93b9cabc 100644 --- a/dumux/assembly/staggeredlocalresidual.hh +++ b/dumux/assembly/staggeredlocalresidual.hh @@ -362,6 +362,9 @@ protected: auto prevFaceStorage = asImp_().computeStorageForFace(problem, scvf, prevVolVars, prevFaceVars); auto curFaceStorage = asImp_().computeStorageForFace(problem, scvf, curVolVars, curFaceVars); + prevFaceStorage *= prevVolVars.extrusionFactor(); + curFaceStorage *= curVolVars.extrusionFactor(); + // the storage term residual = std::move(curFaceStorage); residual -= std::move(prevFaceStorage); diff --git a/dumux/discretization/staggered/freeflow/fickslaw.hh b/dumux/discretization/staggered/freeflow/fickslaw.hh index c640bb4035a337688f32ce13ea204f149f2af04c..33b3f9910202502b57d89c4897fca61dfae2618b 100644 --- a/dumux/discretization/staggered/freeflow/fickslaw.hh +++ b/dumux/discretization/staggered/freeflow/fickslaw.hh @@ -160,7 +160,7 @@ public: const Scalar insideDistance = (insideScv.dofPosition() - scvf.ipGlobal()).two_norm(); const Scalar insideD = insideVolVars.effectiveDiffusivity(compIdx); - const Scalar ti = calculateOmega_(insideDistance, insideD, 1.0); + const Scalar ti = calculateOmega_(insideDistance, insideD, insideVolVars.extrusionFactor()); if(scvf.boundary()) tij = scvf.area() * ti; @@ -170,7 +170,7 @@ public: const auto& outsideVolVars = elemVolVars[scvf.outsideScvIdx()]; const Scalar outsideDistance = (outsideScv.dofPosition() - scvf.ipGlobal()).two_norm(); const Scalar outsideD = outsideVolVars.effectiveDiffusivity(compIdx); - const Scalar tj = calculateOmega_(outsideDistance, outsideD, 1.0); + const Scalar tj = calculateOmega_(outsideDistance, outsideD, outsideVolVars.extrusionFactor()); tij = scvf.area()*(ti * tj)/(ti + tj); } diff --git a/dumux/freeflow/navierstokes/staggered/fluxvariables.hh b/dumux/freeflow/navierstokes/staggered/fluxvariables.hh index a3c6026e4fbe4d5e0f26a7c32b164d542f82ef74..f3191ef751c020b39e9ea5a89c9754a01f0ec06e 100644 --- a/dumux/freeflow/navierstokes/staggered/fluxvariables.hh +++ b/dumux/freeflow/navierstokes/staggered/fluxvariables.hh @@ -113,7 +113,7 @@ public: (1.0 - upWindWeight) * upwindTerm(downstreamVolVars)) * velocity * scvf.area() * scvf.directionSign(); - return flux; + return flux * extrusionFactor_(elemVolVars, scvf); } /*! @@ -193,7 +193,7 @@ public: const ElementVolumeVariables& elemVolVars, const ElementFaceVariables& elemFaceVars) { - FacePrimaryVariables normalFlux(0.0); + FacePrimaryVariables frontalFlux(0.0); // The velocities of the dof at interest and the one of the opposite scvf. const Scalar velocitySelf = elemFaceVars[scvf].velocitySelf(); @@ -226,7 +226,7 @@ public: // Account for the orientation of the staggered face's normal outer normal vector // (pointing in opposite direction of the scvf's one). - normalFlux += transportingVelocity * momentum * -1.0 * scvf.directionSign(); + frontalFlux += transportingVelocity * momentum * -1.0 * scvf.directionSign(); } // Diffusive flux. @@ -236,8 +236,8 @@ public: static const bool enableUnsymmetrizedVelocityGradient = getParamFromGroup(GET_PROP_VALUE(TypeTag, ModelParameterGroup), "FreeFlow.EnableUnsymmetrizedVelocityGradient", false); - Scalar factor = enableUnsymmetrizedVelocityGradient ? 1.0 : 2.0; - normalFlux -= factor * insideVolVars.effectiveViscosity() * gradV; + const Scalar factor = enableUnsymmetrizedVelocityGradient ? 1.0 : 2.0; + frontalFlux -= factor * insideVolVars.effectiveViscosity() * gradV; // The pressure term. // If specified, the pressure can be normalized using the initial value on the scfv of interest. @@ -248,7 +248,7 @@ public: // Account for the orientation of the staggered face's normal outer normal vector // (pointing in opposite direction of the scvf's one). - normalFlux += pressure * -1.0 * scvf.directionSign(); + frontalFlux += pressure * -1.0 * scvf.directionSign(); // Treat outflow conditions. if(scvf.boundary()) @@ -257,13 +257,13 @@ public: { // Treat the staggered half-volume adjacent to the boundary as if it was on the opposite side of the boundary. // The respective face's outer normal vector will point in the same direction as the scvf's one. - normalFlux += outflowBoundaryFlux_(problem, element, scvf, elemVolVars, elemFaceVars); + frontalFlux += outflowBoundaryFlux_(problem, element, scvf, elemVolVars, elemFaceVars); } } // Account for the staggered face's area. For rectangular elements, this equals the area of the scvf // our velocity dof of interest lives on. - return normalFlux * scvf.area(); + return frontalFlux * scvf.area() * insideVolVars.extrusionFactor(); } /*! @@ -415,7 +415,7 @@ private: // Account for the orientation of the staggered normal face's outer normal vector // and its area (0.5 of the coinciding scfv). - return transportingVelocity * momentum * normalFace.directionSign() * normalFace.area() * 0.5; + return transportingVelocity * momentum * normalFace.directionSign() * normalFace.area() * 0.5 * extrusionFactor_(elemVolVars, normalFace); } /*! @@ -519,7 +519,7 @@ private: normalDiffusiveFlux -= muAvg * parallelGradient; // Account for the area of the staggered normal face (0.5 of the coinciding scfv). - return normalDiffusiveFlux * normalFace.area() * 0.5; + return normalDiffusiveFlux * normalFace.area() * 0.5 * extrusionFactor_(elemVolVars, normalFace); } /*! @@ -589,6 +589,14 @@ private: return makeGhostFace_(ownScvf, ownScvf.pairData(localSubFaceIdx).virtualOuterParallelFaceDofPos); }; + //! helper function to get the averaged extrusion factor for a face + static Scalar extrusionFactor_(const ElementVolumeVariables& elemVolVars, const SubControlVolumeFace& scvf) + { + const auto& insideVolVars = elemVolVars[scvf.insideScvIdx()]; + const auto& outsideVolVars = elemVolVars[scvf.outsideScvIdx()]; + return harmonicMean(insideVolVars.extrusionFactor(), outsideVolVars.extrusionFactor()); + } + }; } // end namespace diff --git a/dumux/freeflow/navierstokes/staggered/localresidual.hh b/dumux/freeflow/navierstokes/staggered/localresidual.hh index 7ef4336a84df321e2a90f91a02b915c4c68cec91..eb68642847c3d4ebecd106cc29324e6c0ed2174d 100644 --- a/dumux/freeflow/navierstokes/staggered/localresidual.hh +++ b/dumux/freeflow/navierstokes/staggered/localresidual.hh @@ -221,6 +221,7 @@ protected: if (scvf.boundary()) { auto boundaryFlux = computeFluxForCellCenter(problem, element, fvGeometry, elemVolVars, elemFaceVars, scvf, elemFluxVarsCache); + const auto& scv = fvGeometry.scv(scvf.insideScvIdx()); // handle the actual boundary conditions: const auto bcTypes = problem.boundaryTypes(element, scvf); @@ -242,7 +243,7 @@ protected: residual += boundaryFlux; - asImp_().setFixedCell_(residual, problem, fvGeometry.scv(scvf.insideScvIdx()), elemVolVars, bcTypes); + asImp_().setFixedCell_(residual, problem, scv, elemVolVars, bcTypes); } } }