diff --git a/dumux/discretization/staggered/globalvolumevariables.hh b/dumux/discretization/staggered/globalvolumevariables.hh index 3f697b5872e0669014125c4adbe05b67e2ca44a1..e9d4ae7446ac1c5433066c03a617a43ff88756e0 100644 --- a/dumux/discretization/staggered/globalvolumevariables.hh +++ b/dumux/discretization/staggered/globalvolumevariables.hh @@ -108,7 +108,7 @@ public: for(int eqIdx = 0; eqIdx < numEqCellCenter; ++eqIdx) { if(bcTypes.isDirichlet(eqIdx)) - boundaryPriVars[cellCenterIdx][eqIdx] = problem.dirichlet(element, scvf)[eqIdx]; + boundaryPriVars[cellCenterIdx][eqIdx] = problem.dirichletAtPos(scvf.center())[cellCenterIdx][eqIdx]; else if(bcTypes.isNeumann(eqIdx)) boundaryPriVars[cellCenterIdx][eqIdx] = sol[cellCenterIdx][scvf.insideScvIdx()][eqIdx]; //TODO: this assumes a zero-gradient for e.g. the pressure on the boundary diff --git a/dumux/freeflow/staggered/fluxvariables.hh b/dumux/freeflow/staggered/fluxvariables.hh index 395db9da3f42d8001a9d1718a78bd779ad6dacd7..edabf142e1d11634d83161763b63144b0d297403 100644 --- a/dumux/freeflow/staggered/fluxvariables.hh +++ b/dumux/freeflow/staggered/fluxvariables.hh @@ -90,6 +90,10 @@ class FreeFlowFluxVariablesImpl<TypeTag, false, false> momentumBalanceIdx = Indices::momentumBalanceIdx }; + using DofTypeIndices = typename GET_PROP(TypeTag, DofTypeIndices); + typename DofTypeIndices::CellCenterIdx cellCenterIdx; + typename DofTypeIndices::FaceIdx faceIdx; + public: CellCenterPrimaryVariables computeFluxForCellCenter(const Element &element, @@ -292,7 +296,7 @@ private: if(outerDofIdx >= 0) transportedVelocity = velocity(outerDofIdx); else // this is the case when the outer parallal dof would lie outside the domain - transportedVelocity = problem.dirichlet(scvf)[velocityIdx]; + transportedVelocity = problem.dirichletAtPos(scvf.center())[faceIdx][scvf.directionIndex()]; } const Scalar momentum = upVolVars.density() * transportedVelocity; @@ -329,7 +333,7 @@ private: const Scalar outerNormalVelocity = outerNormalVelocityIdx >= 0 ? velocity(outerNormalVelocityIdx) : - problem.dirichletAtPos(subFaceData.virtualOuterNormalFaceDofPos, normalDirIdx)[velocityIdx]; + problem.dirichletAtPos(subFaceData.virtualOuterNormalFaceDofPos)[faceIdx][normalDirIdx]; const Scalar normalDeltaV = scvf.normalInPosCoordDir() ? (outerNormalVelocity - innerNormalVelocity) : @@ -344,7 +348,7 @@ private: const int outerParallelFaceDofIdx = subFaceData.outerParallelFaceDofIdx; const Scalar outerParallelVelocity = outerParallelFaceDofIdx >= 0 ? velocity(outerParallelFaceDofIdx) : - problem.dirichletAtPos(subFaceData.virtualOuterParallelFaceDofPos, scvf.directionIndex())[velocityIdx]; + problem.dirichletAtPos(subFaceData.virtualOuterParallelFaceDofPos)[faceIdx][scvf.directionIndex()]; const Scalar parallelDeltaV = normalFace.normalInPosCoordDir() ? (outerParallelVelocity - innerParallelVelocity) : diff --git a/dumux/freeflow/staggered/localresidual.hh b/dumux/freeflow/staggered/localresidual.hh index c9fd71fe9afb4df9cb8f4764c5d6ac930d4d1fc5..c4006e0119ad701dfbbec6c98a554eff726c9b61 100644 --- a/dumux/freeflow/staggered/localresidual.hh +++ b/dumux/freeflow/staggered/localresidual.hh @@ -260,7 +260,7 @@ protected: { const auto& insideScv = fvGeometry.scv(scvf.insideScvIdx()); const auto& insideVolVars = elemVolVars[insideScv]; - this->ccResidual_[pressureIdx] = insideVolVars.pressure() - this->problem().dirichletAtPos(insideScv.dofPosition(), 0)[pressureIdx]; + this->ccResidual_[pressureIdx] = insideVolVars.pressure() - this->problem().dirichletAtPos(insideScv.dofPosition())[cellCenterIdx][pressureIdx]; } } } @@ -286,7 +286,7 @@ protected: if(bcTypes.isDirichlet(momentumBalanceIdx)) { const Scalar velocity = faceVars.faceVars(scvf.dofIndex()).velocity(); - const Scalar dirichletValue = this->problem().dirichlet(scvf)[velocityIdx]; + const Scalar dirichletValue = this->problem().dirichletAtPos(scvf.center())[faceIdx][scvf.directionIndex()]; this->faceResiduals_[scvf.localFaceIdx()] = velocity - dirichletValue; } @@ -325,7 +325,7 @@ private: // treat outflow BCs if(scvf.boundary()) { - const Scalar pressure = this->problem().dirichlet(element, scvf)[pressureIdx]; + const Scalar pressure = this->problem().dirichletAtPos(scvf.center())[cellCenterIdx][pressureIdx]; result += pressure * scvf.area() * sign(scvf.outerNormalScalar()); } return result; diff --git a/dumux/freeflow/staggered/problem.hh b/dumux/freeflow/staggered/problem.hh index bbfb4c64fc62e085e50e90010089bddb2164b82f..e26ef8d7b7a6fe9952f908e5c9f512e2c9b80387 100644 --- a/dumux/freeflow/staggered/problem.hh +++ b/dumux/freeflow/staggered/problem.hh @@ -117,108 +117,10 @@ public: const GlobalPosition &gravity() const { return gravity_; } - /*! - * \brief Evaluate the initial value for a subcontrolvolume face. - * This set the initial velocity on the face. - * - * \param scvf The subcontrolvolume face - */ - using ParentType::initial; - PrimaryVariables initial(const SubControlVolumeFace &scvf) const - { - // forward to specialized method - return initialAtPos(scvf.center(), scvf.directionIndex()); - } - - /*! - * \brief Evaluate the initial value for a subcontrolvolume. - * This sets e.g. the initital pressure - * - * \param scvIdx The subcontrolvolume - */ - PrimaryVariables initial(const SubControlVolume &scv) const - { - // forward to specialized method - return initialAtPos(scv.dofPosition(), 0); - } - - /*! - * \brief Evaluate the initial conditions on a face - * - * \param globalPos The center of the finite volume which ought to be set. - * \param directionIdx The direction index of the face - */ - PrimaryVariables initialAtPos(const GlobalPosition &globalPos, const int directionIdx) const - { - const auto initialValues = asImp_().initialAtPos(globalPos); - - PrimaryVariables priVars(0.0); - priVars[pressureIdx] = initialValues[cellCenterIdx][pressureIdx]; - priVars[velocityIdx] = initialValues[faceIdx][directionIdx]; - - return priVars; - } - - /*! - * \brief Evaluate the dirichlet boundary conditions on a face - * - * \param scvf the subcontrolvolume face - */ - PrimaryVariables dirichlet(const Element &element, const SubControlVolumeFace &scvf) const - { - return dirichletAtPos(scvf.center(), scvf.directionIndex()); - } - - /*! - * \brief Evaluate the dirichlet boundary conditions on a face - * - * \param scvf the subcontrolvolume face - */ - PrimaryVariables dirichlet(const SubControlVolumeFace &scvf) const - { - return dirichletAtPos(scvf.center(), scvf.directionIndex()); - } - - /*! - * \brief Evaluate the dirichlet boundary conditions on a face - * - * \param globalPos The center of the finite volume which ought to be set. - * \param directionIdx The direction index of the face - */ - PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos, const int directionIdx) const - { - const auto boundaryValues = asImp_().dirichletAtPos(globalPos); - - PrimaryVariables priVars(0.0); - priVars[pressureIdx] = boundaryValues[cellCenterIdx][pressureIdx]; - priVars[velocityIdx] = boundaryValues[faceIdx][directionIdx]; - - return priVars; - } - - /*! - * \brief Evaluate the source term at a given position on a face - * - * \param globalPos The center of face where the source is positioned - * \param directionIdx The direction index of the face - */ - PrimaryVariables sourceAtPos(const GlobalPosition &globalPos, const int directionIdx) const - { - const auto sourceValues = asImp_().sourceAtPos(globalPos); - - PrimaryVariables priVars(0.0); - priVars[pressureIdx] = sourceValues[cellCenterIdx][pressureIdx]; - priVars[velocityIdx] = sourceValues[faceIdx][directionIdx]; - - return priVars; - } - // \} private: - - //! Returns the implementation of the problem (i.e. static polymorphism) Implementation &asImp_() { return *static_cast<Implementation *>(this); } diff --git a/dumux/implicit/staggered/model.hh b/dumux/implicit/staggered/model.hh index 3a888283b01649a43963fc101b57e22e14d41861..4d76130143fd41ca09b2e11d8d257f47631f7790 100644 --- a/dumux/implicit/staggered/model.hh +++ b/dumux/implicit/staggered/model.hh @@ -254,7 +254,7 @@ public: { // let the problem do the dirty work of nailing down // the initial solution. - auto initPriVars = this->problem_().initial(scv)[cellCenterIdx]; + auto initPriVars = this->problem_().initialAtPos(scv.center())[cellCenterIdx]; auto dofIdxGlobal = scv.dofIndex(); this->uCur_[cellCenterIdx][dofIdxGlobal] += initPriVars; @@ -263,7 +263,7 @@ public: // loop over faces for(auto&& scvf : scvfs(fvGeometry)) { - auto initPriVars = this->problem_().initial(scvf)[faceIdx]; + auto initPriVars = this->problem_().initialAtPos(scvf.center())[faceIdx][scvf.directionIndex()]; this->uCur_[faceIdx][scvf.dofIndex()] = initPriVars; } }