25#ifndef DUMUX_PNM_TWOP_STATIC_DRAINAGE_HH
26#define DUMUX_PNM_TWOP_STATIC_DRAINAGE_HH
39template<
class Gr
idGeometry,
class Scalar>
42 using GridView =
typename GridGeometry::GridView;
47 const std::vector<Scalar>&
pcEntry,
48 const std::vector<int>& throatLabel,
49 const int inletPoreLabel,
50 const int outletPoreLabel,
51 const bool allowDraingeOfOutlet =
false)
52 : gridView_(gridGeometry.gridView())
54 , throatLabel_(throatLabel)
55 , inletThroatLabel_(inletPoreLabel)
56 , outletThroatLabel_(outletPoreLabel)
57 , allowDraingeOfOutlet_(allowDraingeOfOutlet)
69 for (
const auto& element : elements(gridView_))
71 const auto eIdx = gridView_.indexSet().index(element);
74 if (elementIsInvaded[eIdx])
81 if (throatLabel_[eIdx] == inletThroatLabel_ && pcGlobal >= pcEntry_[eIdx])
91 for (
const auto& intersection : intersections(gridView_, element))
93 if (intersection.neighbor())
95 const auto& neighborElement = intersection.outside();
96 const auto nIdx = gridView_.indexSet().index(neighborElement);
97 if (elementIsInvaded[nIdx] && pcGlobal >= pcEntry_[eIdx] && (allowDraingeOfOutlet_ || throatLabel_[eIdx] != outletThroatLabel_))
110 elementIsInvaded[eIdx] =
true;
113 using Element =
typename GridView::template Codim<0>::Entity;
114 std::stack<Element> elementStack;
115 elementStack.push(element);
116 while (!elementStack.empty())
118 auto e = elementStack.top();
121 for (
const auto& intersection : intersections(gridView_, e))
123 if (intersection.neighbor())
125 const auto& neighborElement = intersection.outside();
126 const auto nIdx = gridView_.indexSet().index(neighborElement);
127 if (!elementIsInvaded[nIdx] && pcGlobal >= pcEntry_[nIdx] && (allowDraingeOfOutlet_ || throatLabel_[nIdx] != outletThroatLabel_))
129 ++numThroatsInvaded_;
130 elementIsInvaded[nIdx] =
true;
131 elementStack.push(neighborElement);
144 {
return numThroatsInvaded_; }
147 const GridView& gridView_;
148 const std::vector<Scalar>& pcEntry_;
149 const std::vector<int>& throatLabel_;
150 const int inletThroatLabel_;
151 const int outletThroatLabel_;
152 const int allowDraingeOfOutlet_;
153 std::size_t numThroatsInvaded_ = 0;
Definition: discretization/porenetwork/fvelementgeometry.hh:34
Scalar pcEntry(const Scalar surfaceTension, const Scalar contactAngle, const Scalar inscribedRadius, const Scalar shapeFactor) noexcept
The entry capillary pressure of a pore throat.
Definition: thresholdcapillarypressures.hh:94
Base class for the finite volume geometry for porenetwork models.
Definition: discretization/porenetwork/gridgeometry.hh:489
A (quasi-) static two-phase pore-network model for drainage processes. This assumes that there are no...
Definition: staticdrainge.hh:41
std::size_t numThroatsInvaded() const
Returns the number of invaded throats.
Definition: staticdrainge.hh:143
void updateInvasionState(std::vector< bool > &elementIsInvaded, const Scalar pcGlobal)
Updates the invasion state of the network for the given global capillary pressure.
Definition: staticdrainge.hh:66
TwoPStaticDrainage(const GridGeometry &gridGeometry, const std::vector< Scalar > &pcEntry, const std::vector< int > &throatLabel, const int inletPoreLabel, const int outletPoreLabel, const bool allowDraingeOfOutlet=false)
Definition: staticdrainge.hh:46