diff --git a/dumux/assembly/staggeredlocalassembler.hh b/dumux/assembly/staggeredlocalassembler.hh index 13ac1307d6d0c4160dd98f4584cf95ca37eb1a3f..a7debdde3df2ce4450f0d435af9974a4669863bc 100644 --- a/dumux/assembly/staggeredlocalassembler.hh +++ b/dumux/assembly/staggeredlocalassembler.hh @@ -388,16 +388,11 @@ static void dCCdFace_(Assembler& assembler, for(auto pvIdx : PriVarIndices(faceIdx)) { - PrimaryVariables priVars(CellCenterPrimaryVariables(0.0), FacePrimaryVariables(curSol[faceIdx][globalJ])); + FacePrimaryVariables facePriVars(curSol[faceIdx][globalJ]); + const Scalar eps = numericEpsilon(facePriVars[pvIdx], cellCenterIdx, faceIdx); + facePriVars[pvIdx] += eps; - auto faceSolution = StaggeredFaceSolution<TypeTag>(scvfJ, curSol[faceIdx], assembler.fvGridGeometry()); - - - const Scalar eps = numericEpsilon(priVars[pvIdx], cellCenterIdx, faceIdx); - priVars[pvIdx] += eps; - - faceSolution[globalJ][pvIdx] += eps; - faceVars.update(faceSolution, problem, element, fvGeometry, scvfJ); + faceVars.updateOwnFaceOnly(facePriVars); const auto deflectedResidual = localResidual.evalCellCenter(problem, element, fvGeometry, prevElemVolVars, curElemVolVars, diff --git a/dumux/discretization/staggered/freeflow/facevariables.hh b/dumux/discretization/staggered/freeflow/facevariables.hh index f696873cfeda070a0f5712b7d064b12cb22819e0..337b6e419d801d6615d80ff09232be05117b7f4b 100644 --- a/dumux/discretization/staggered/freeflow/facevariables.hh +++ b/dumux/discretization/staggered/freeflow/facevariables.hh @@ -18,7 +18,8 @@ *****************************************************************************/ /*! * \file - * \brief The face variables class for free flow staggered grid models + * \brief The face variables class for free flow staggered grid models. + * Contains all relevant velocities for the assembly of the momentum balance. */ #ifndef DUMUX_DISCRETIZATION_STAGGERED_FREEFLOW_FACEVARIABLES_HH #define DUMUX_DISCRETIZATION_STAGGERED_FREEFLOW_FACEVARIABLES_HH @@ -55,6 +56,26 @@ class StaggeredFaceVariables public: + /*! + * \brief Partial update of the face variables. Only the face itself is considered. + * + * \param priVars The face-specific primary variales + */ + void updateOwnFaceOnly(const FacePrimaryVariables& priVars) + { + velocitySelf_ = priVars[0]; + } + + /*! + * \brief Complete update of the face variables (i.e. velocities for free flow) + * for a given face + * + * \param faceSol The face-specific solution vector + * \param problem The problem + * \param element The element + * \param fvGeometry The finite-volume geometry + * \param scvf The sub-control volume face of interest + */ template<class SolVector> void update(const SolVector& faceSol, const Problem& problem, @@ -109,26 +130,47 @@ public: } } + /*! + * \brief Returns the velocity at the face itself + */ Scalar velocitySelf() const { return velocitySelf_; } + /*! + * \brief Returns the velocity at the opposing face + */ Scalar velocityOpposite() const { return velocityOpposite_; } + /*! + * \brief Returns the velocity at the parallel face + * + * \param localSubFaceIdx The local index of the subface + */ Scalar velocityParallel(const int localSubFaceIdx) const { return velocityParallel_[localSubFaceIdx]; } + /*! + * \brief Returns the velocity at the inner normal face + * + * \param localSubFaceIdx The local index of the subface + */ Scalar velocityNormalInside(const int localSubFaceIdx) const { return velocityNormalInside_[localSubFaceIdx]; } + /*! + * \brief Returns the velocity at the outer normal face + * + * \param localSubFaceIdx The local index of the subface + */ Scalar velocityNormalOutside(const int localSubFaceIdx) const { return velocityNormalOutside_[localSubFaceIdx];