From 05d0ca08de4f7307509f01c48482f83d337faa0f Mon Sep 17 00:00:00 2001 From: Kilian Weishaupt <kilian.weishaupt@iws.uni-stuttgart.de> Date: Wed, 8 Mar 2017 18:13:32 +0100 Subject: [PATCH] [2p2c] Adapt to new interface of intialPhasePresence[2p2c] --- dumux/porousmediumflow/2p2c/implicit/model.hh | 43 ++++++------------- .../2p2c/implicit/injectionproblem.hh | 8 +--- .../2p2c/implicit/waterairproblem.hh | 6 +-- 3 files changed, 16 insertions(+), 41 deletions(-) diff --git a/dumux/porousmediumflow/2p2c/implicit/model.hh b/dumux/porousmediumflow/2p2c/implicit/model.hh index 3a01803085..e551673bdd 100644 --- a/dumux/porousmediumflow/2p2c/implicit/model.hh +++ b/dumux/porousmediumflow/2p2c/implicit/model.hh @@ -147,46 +147,29 @@ public: { ParentType::init(problem); - unsigned numDofs = this->numDofs(); - - staticDat_.resize(numDofs); + staticDat_.resize(this->numDofs()); setSwitched_(false); - // check, if velocity output can be used (works only for cubes so far) + FVElementGeometry fvGeometry; + for (const auto& element : elements(this->gridView_())) { - if (!isBox) // i.e. cell-centered discretization - { - int eIdxGlobal = this->dofMapper().index(element); - const GlobalPosition &globalPos = element.geometry().center(); - - // initialize phase presence - staticDat_[eIdxGlobal].phasePresence - = this->problem_().initialPhasePresence(*(this->gridView_().template begin<dim>()), - eIdxGlobal, globalPos); - staticDat_[eIdxGlobal].wasSwitched = false; - - staticDat_[eIdxGlobal].oldPhasePresence - = staticDat_[eIdxGlobal].phasePresence; - } - } + // deal with the current element + fvGeometry.update(this->gridView_(), element); - if (isBox) // i.e. vertex-centered discretization - { - for (const auto& vertex : vertices(this->gridView_())) + // loop over all element vertices, i.e. sub control volumes + for (int scvIdx = 0; scvIdx < fvGeometry.numScv; scvIdx++) { - int vIdxGlobal = this->dofMapper().index(vertex); - const GlobalPosition &globalPos = vertex.geometry().corner(0); + // get the global index of the degree of freedom + int dofIdxGlobal = this->dofMapper().subIndex(element, scvIdx, dofCodim); // initialize phase presence - staticDat_[vIdxGlobal].phasePresence - = this->problem_().initialPhasePresence(vertex, vIdxGlobal, - globalPos); - staticDat_[vIdxGlobal].wasSwitched = false; + staticDat_[dofIdxGlobal].phasePresence = this->problem_().initialPhasePresence(element, fvGeometry, scvIdx); + + staticDat_[dofIdxGlobal].wasSwitched = false; - staticDat_[vIdxGlobal].oldPhasePresence - = staticDat_[vIdxGlobal].phasePresence; + staticDat_[dofIdxGlobal].oldPhasePresence = staticDat_[dofIdxGlobal].phasePresence; } } } diff --git a/test/porousmediumflow/2p2c/implicit/injectionproblem.hh b/test/porousmediumflow/2p2c/implicit/injectionproblem.hh index 23e41f822c..8e8d26c5f4 100644 --- a/test/porousmediumflow/2p2c/implicit/injectionproblem.hh +++ b/test/porousmediumflow/2p2c/implicit/injectionproblem.hh @@ -329,15 +329,11 @@ public: } /*! - * \brief Returns the initial phase state for a control volume. + * \brief Return the initial phase state inside a control volume. * - * \param vertex The vertex - * \param vIdxGlobal The global index of the vertex * \param globalPos The global position */ - int initialPhasePresence(const Vertex &vertex, - int &vIdxGlobal, - const GlobalPosition &globalPos) const + int initialPhasePresenceAtPos(const GlobalPosition &globalPos) const { return Indices::wPhaseOnly; } // \} diff --git a/test/porousmediumflow/2p2c/implicit/waterairproblem.hh b/test/porousmediumflow/2p2c/implicit/waterairproblem.hh index 5fee95755f..cd5d211872 100644 --- a/test/porousmediumflow/2p2c/implicit/waterairproblem.hh +++ b/test/porousmediumflow/2p2c/implicit/waterairproblem.hh @@ -326,13 +326,9 @@ public: /*! * \brief Return the initial phase state inside a control volume. * - * \param vertex The vertex - * \param vIdxGlobal The global index of the vertex * \param globalPos The global position */ - int initialPhasePresence(const Vertex &vertex, - int &vIdxGlobal, - const GlobalPosition &globalPos) const + int initialPhasePresenceAtPos(const GlobalPosition &globalPos) const { return wPhaseOnly; } -- GitLab