diff --git a/dumux/porousmediumflow/3pwateroil/model.hh b/dumux/porousmediumflow/3pwateroil/model.hh index 02d0582309e5bcb8f5d33c042980b6c67bbecf5f..5a30c8825e3a3bce7bdf0319c16ea4b67e3ddf1f 100644 --- a/dumux/porousmediumflow/3pwateroil/model.hh +++ b/dumux/porousmediumflow/3pwateroil/model.hh @@ -152,38 +152,25 @@ public: setSwitched_(false); - if (isBox) - { - for (const auto& vertex : vertices(this->gridView_())) - { - int globalIdx = this->dofMapper().index(vertex); - const GlobalPosition &globalPos = vertex.geometry().corner(0); - - // initialize phase presence - staticDat_[globalIdx].phasePresence - = this->problem_().initialPhasePresence(vertex, globalIdx, - globalPos); - staticDat_[globalIdx].wasSwitched = false; + FVElementGeometry fvGeometry; - staticDat_[globalIdx].oldPhasePresence - = staticDat_[globalIdx].phasePresence; - } - } - else + for (const auto& element : elements(this->gridView_())) { - for (const auto& element : elements(this->gridView_())) + // deal with the current element + fvGeometry.update(this->gridView_(), element); + + // loop over all element vertices, i.e. sub control volumes + for (int scvIdx = 0; scvIdx < fvGeometry.numScv; scvIdx++) { - int globalIdx = this->dofMapper().index(element); - const GlobalPosition &globalPos = element.geometry().center(); + // get the global index of the degree of freedom + int dofIdxGlobal = this->dofMapper().subIndex(element, scvIdx, dofCodim); // initialize phase presence - staticDat_[globalIdx].phasePresence - = this->problem_().initialPhasePresence(*this->gridView_().template begin<dim> (), - globalIdx, globalPos); - staticDat_[globalIdx].wasSwitched = false; + staticDat_[dofIdxGlobal].phasePresence = this->problem_().initialPhasePresence(element, fvGeometry, scvIdx); + + staticDat_[dofIdxGlobal].wasSwitched = false; - staticDat_[globalIdx].oldPhasePresence - = staticDat_[globalIdx].phasePresence; + staticDat_[dofIdxGlobal].oldPhasePresence = staticDat_[dofIdxGlobal].phasePresence; } } } diff --git a/test/porousmediumflow/3pwateroil/implicit/3pwateroilsagdproblem.hh b/test/porousmediumflow/3pwateroil/implicit/3pwateroilsagdproblem.hh index ff9675705640436873d372a9536a36a024705e88..0602f0da37b8b0779cd2cf33ec1bff2e842dba21 100644 --- a/test/porousmediumflow/3pwateroil/implicit/3pwateroilsagdproblem.hh +++ b/test/porousmediumflow/3pwateroil/implicit/3pwateroilsagdproblem.hh @@ -406,13 +406,9 @@ public: /*! * \brief Return the initial phase state inside a control volume. * - * \param vert The vertex - * \param globalIdx The index of the global vertex * \param globalPos The global position */ - int initialPhasePresence(const Vertex &vert, - int &globalIdx, - const GlobalPosition &globalPos) const + int initialPhasePresenceAtPos(const GlobalPosition &globalPos) const { return wnPhaseOnly; }