13#ifndef DUMUX_PNM_TWOP_STATIC_DRAINAGE_HH
14#define DUMUX_PNM_TWOP_STATIC_DRAINAGE_HH
27template<
class Gr
idGeometry,
class Scalar>
30 using GridView =
typename GridGeometry::GridView;
35 const std::vector<Scalar>&
pcEntry,
36 const std::vector<int>& throatLabel,
37 const int inletPoreLabel,
38 const int outletPoreLabel,
39 const bool allowDraingeOfOutlet =
false)
40 : gridView_(gridGeometry.gridView())
42 , throatLabel_(throatLabel)
43 , inletThroatLabel_(inletPoreLabel)
44 , outletThroatLabel_(outletPoreLabel)
45 , allowDraingeOfOutlet_(allowDraingeOfOutlet)
57 for (
const auto& element : elements(gridView_))
59 const auto eIdx = gridView_.indexSet().index(element);
62 if (elementIsInvaded[eIdx])
69 if (throatLabel_[eIdx] == inletThroatLabel_ && pcGlobal >= pcEntry_[eIdx])
79 for (
const auto& intersection : intersections(gridView_, element))
81 if (intersection.neighbor())
83 const auto& neighborElement = intersection.outside();
84 const auto nIdx = gridView_.indexSet().index(neighborElement);
85 if (elementIsInvaded[nIdx] && pcGlobal >= pcEntry_[eIdx] && (allowDraingeOfOutlet_ || throatLabel_[eIdx] != outletThroatLabel_))
98 elementIsInvaded[eIdx] =
true;
101 using Element =
typename GridView::template Codim<0>::Entity;
102 std::stack<Element> elementStack;
103 elementStack.push(element);
104 while (!elementStack.empty())
106 auto e = elementStack.top();
109 for (
const auto& intersection : intersections(gridView_, e))
111 if (intersection.neighbor())
113 const auto& neighborElement = intersection.outside();
114 const auto nIdx = gridView_.indexSet().index(neighborElement);
115 if (!elementIsInvaded[nIdx] && pcGlobal >= pcEntry_[nIdx] && (allowDraingeOfOutlet_ || throatLabel_[nIdx] != outletThroatLabel_))
117 ++numThroatsInvaded_;
118 elementIsInvaded[nIdx] =
true;
119 elementStack.push(neighborElement);
132 {
return numThroatsInvaded_; }
135 const GridView& gridView_;
136 const std::vector<Scalar>& pcEntry_;
137 const std::vector<int>& throatLabel_;
138 const int inletThroatLabel_;
139 const int outletThroatLabel_;
140 const int allowDraingeOfOutlet_;
141 std::size_t numThroatsInvaded_ = 0;
Base class for the finite volume geometry for porenetwork models.
Definition: discretization/porenetwork/gridgeometry.hh:477
A (quasi-) static two-phase pore-network model for drainage processes. This assumes that there are no...
Definition: staticdrainge.hh:29
std::size_t numThroatsInvaded() const
Returns the number of invaded throats.
Definition: staticdrainge.hh:131
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:54
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: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:82
Definition: discretization/porenetwork/fvelementgeometry.hh:24