diff --git a/dumux/porousmediumflow/2p2c/implicit/model.hh b/dumux/porousmediumflow/2p2c/implicit/model.hh index 3a01803085d6ee1f8fa6906db5692bd9103c5bab..e551673bdd8715a06214d830865a2b058ba6a866 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 23e41f822c2bafc7af742462805dcbc78febba5e..8e8d26c5f4e9abf6417cfd9d6746d4d680b832a8 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 5fee95755f2436e78c6b01a7d4f74d1939598ecb..cd5d2118724b2154dd13d6a48cfcf53bdd6e218d 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; }