From 61f9c25dfe93612d6803cd9c43a69d79284d9a01 Mon Sep 17 00:00:00 2001 From: Kilian Weishaupt <kilian.weishaupt@iws.uni-stuttgart.de> Date: Mon, 6 Nov 2017 08:09:02 +0100 Subject: [PATCH] [staggered] Allow update of the own face only * used in dCCdFace * should be slightly faster * add some docu --- dumux/assembly/staggeredlocalassembler.hh | 13 ++---- .../staggered/freeflow/facevariables.hh | 44 ++++++++++++++++++- 2 files changed, 47 insertions(+), 10 deletions(-) diff --git a/dumux/assembly/staggeredlocalassembler.hh b/dumux/assembly/staggeredlocalassembler.hh index 13ac1307d6..a7debdde3d 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 f696873cfe..337b6e419d 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]; -- GitLab