25#ifndef DUMUX_PNM_2P_SPATIAL_PARAMS_HH
26#define DUMUX_PNM_2P_SPATIAL_PARAMS_HH
42template<
class Gr
idGeometry,
class Scalar,
class LocalRules,
class Implementation>
47 using GridView =
typename GridGeometry::GridView;
48 using SubControlVolume =
typename GridGeometry::SubControlVolume;
49 using Element =
typename GridView::template Codim<0>::Entity;
50 using GlobalPosition =
typename Element::Geometry::GlobalCoordinate;
57 if (!
gridGeometry->useSameGeometryForAllPores() && LocalRules::supportsMultipleGeometries())
58 DUNE_THROW(Dune::InvalidStateException,
"Your MaterialLaw does not support multiple pore body shapes.");
62 cornerHalfAngles_.resize(1);
64 cornerHalfAngles_[0] = Throat::cornerHalfAngles<Scalar>(
shape);
71 const auto eIdx = this->
gridGeometry().elementMapper().index(element);
73 cornerHalfAngles_[eIdx] = Throat::cornerHalfAngles<Scalar>(
shape);
81 template<
class FS,
class ElementVolumeVariables>
83 const ElementVolumeVariables& elemVolVars)
const
84 {
return this->
asImp_().template wettingPhaseAtPos<FS>(element.geometry().center()); }
89 template<
class FS,
class ElementSolutionVector>
91 const SubControlVolume& scv,
92 const ElementSolutionVector& elemSol)
const
93 {
return this->
asImp_().template wettingPhaseAtPos<FS>(scv.center()); }
101 template<
class Flu
idSystem>
104 DUNE_THROW(Dune::InvalidStateException,
105 "The spatial parameters do not provide "
106 "a wettingPhaseAtPos() method.");
116 template<
class ElementVolumeVariables>
118 const ElementVolumeVariables& elemVolVars)
const
119 {
return this->
asImp_().contactAngleAtPos(element.geometry().center()); }
129 template<
class ElementSolutionVector>
131 const SubControlVolume& scv,
132 const ElementSolutionVector& elemSol)
const
133 {
return this->
asImp_().contactAngleAtPos(scv.center()); }
138 DUNE_THROW(Dune::InvalidStateException,
139 "The spatial parameters do not provide "
140 "a contactAngleAtPos() method.");
150 template<
class ElementSolution>
152 const SubControlVolume& scv,
153 const ElementSolution& elemSol)
const
154 {
return this->
asImp_().surfaceTensionAtPos(scv.center()); }
159 DUNE_THROW(Dune::InvalidStateException,
160 "The spatial parameters do not provide "
161 "a surfaceTensionAtPos() method.");
169 template<
class ElementVolumeVariables>
171 const ElementVolumeVariables& elemVolVars)
const
173 const auto eIdx = this->
gridGeometry().elementMapper().index(element);
175 const Scalar
surfaceTension = 0.5*(elemVolVars[0].surfaceTension() + elemVolVars[1].surfaceTension());
187 template<
class ElementVolumeVariables>
189 const ElementVolumeVariables& elemVolVars)
const
192 const Scalar
surfaceTension = 0.5*(elemVolVars[0].surfaceTension() + elemVolVars[1].surfaceTension());
206 template<
class ElementSolution>
208 const SubControlVolume& scv,
209 const ElementSolution& elemSol)
const
211 const auto params =
typename LocalRules::BasicParams(*
this, element, scv, elemSol);
218 return cornerHalfAngles_[0];
221 const auto eIdx = this->
gridGeometry().gridView().indexSet().index(element);
222 return cornerHalfAngles_[eIdx];
227 std::vector<Dune::ReservedVector<Scalar, 4>> cornerHalfAngles_;
235template<
class Gr
idGeometry,
class Scalar,
class LocalRules>
236class TwoPDefaultSpatialParams
237:
public TwoPSpatialParams<GridGeometry, Scalar, LocalRules, TwoPDefaultSpatialParams<GridGeometry, Scalar, LocalRules>>
240 TwoPDefaultSpatialParams<GridGeometry, Scalar, LocalRules>>;
241 using GridView =
typename GridGeometry::GridView;
242 using Element =
typename GridView::template Codim<0>::Entity;
243 using GlobalPosition =
typename Element::Geometry::GlobalCoordinate;
245 using ParentType::ParentType;
257 template<
class Flu
idSystem>
259 {
return FluidSystem::phase0Idx; }
269 static const Scalar theta = getParam<Scalar>(
"SpatialParams.ContactAngle", 0.0);
281 static const Scalar gamma = getParam<Scalar>(
"SpatialParams.SurfaceTension", 0.0725);
Wrapper type to combine an arbitrary number of different laws for fluid-matrix interaction (e....
Specification of threshold capillary pressures for the PNM.
This file contains functions related to calculate pore-body properties.
This file contains functions related to calculate pore-throat properties.
auto makeFluidMatrixInteraction(Laws &&... laws)
Helper function to create an FluidMatrixInteraction object containing an arbitrary number of fluid ma...
Definition: fluidmatrixinteraction.hh:51
Definition: discretization/porenetwork/fvelementgeometry.hh:34
constexpr Shape shape(const Scalar shapeFactor) noexcept
Returns the shape for a given shape factor.
Definition: throatproperties.hh:176
The base class for spatial parameters used with finite-volume schemes.
Definition: common/fvspatialparams.hh:46
Implementation & asImp_()
Returns the implementation of the spatial parameters (static polymorphism)
Definition: common/fvspatialparams.hh:147
const GridGeometry & gridGeometry() const
The finite volume grid geometry.
Definition: common/fvspatialparams.hh:142
static constexpr Scalar pcSnapoff(const Scalar surfaceTension, const Scalar contactAngle, const Scalar inscribedRadius) noexcept
The snap-off capillary pressure of a pore throat.
Definition: thresholdcapillarypressures.hh:37
static constexpr 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:55
TwoPDefaultSpatialParams(std::shared_ptr< const GridGeometry > gridGeometry)
Definition: porenetwork/2p/spatialparams.hh:247
int wettingPhaseAtPos(const GlobalPosition &globalPos) const
Function for defining which phase is to be considered as the wetting phase.
Definition: porenetwork/2p/spatialparams.hh:258
Scalar surfaceTensionAtPos(const GlobalPosition &globalPos) const
Function for defining the surface Tension.
Definition: porenetwork/2p/spatialparams.hh:279
int contactAngleAtPos(const GlobalPosition &globalPos) const
Function for defining the Contact Angle.
Definition: porenetwork/2p/spatialparams.hh:267
const GridGeometry & gridGeometry() const
The finite volume grid geometry.
Definition: porenetworkbase.hh:205
The base class for spatial parameters for pore-network models.
Definition: porenetwork/2p/spatialparams.hh:45
int wettingPhase(const Element &element, const ElementVolumeVariables &elemVolVars) const
The index of the wetting phase within a pore throat.
Definition: porenetwork/2p/spatialparams.hh:82
Scalar contactAngle(const Element &element, const ElementVolumeVariables &elemVolVars) const
The contact angle within a pore throat .
Definition: porenetwork/2p/spatialparams.hh:117
Scalar surfaceTension(const Element &element, const SubControlVolume &scv, const ElementSolution &elemSol) const
Returns the surface tension .
Definition: porenetwork/2p/spatialparams.hh:151
int contactAngleAtPos(const GlobalPosition &globalPos) const
Function for defining the Contact Angle.
Definition: porenetwork/2p/spatialparams.hh:136
int wettingPhase(const Element &element, const SubControlVolume &scv, const ElementSolutionVector &elemSol) const
The index of the wetting phase within a pore body.
Definition: porenetwork/2p/spatialparams.hh:90
TwoPSpatialParams(std::shared_ptr< const GridGeometry > gridGeometry)
Definition: porenetwork/2p/spatialparams.hh:54
Scalar surfaceTensionAtPos(const GlobalPosition &globalPos) const
Function for defining the surface Tension.
Definition: porenetwork/2p/spatialparams.hh:157
const Scalar pcEntry(const Element &element, const ElementVolumeVariables &elemVolVars) const
Return the element (throat) specific entry capillary pressure .
Definition: porenetwork/2p/spatialparams.hh:170
int wettingPhaseAtPos(const GlobalPosition &globalPos) const
Function for defining which phase is to be considered as the wetting phase.
Definition: porenetwork/2p/spatialparams.hh:102
Scalar contactAngle(const Element &element, const SubControlVolume &scv, const ElementSolutionVector &elemSol) const
The contact angle within a pore body .
Definition: porenetwork/2p/spatialparams.hh:130
const Scalar pcSnapoff(const Element &element, const ElementVolumeVariables &elemVolVars) const
Return the element (throat) specific snap-off capillary pressure .
Definition: porenetwork/2p/spatialparams.hh:188
const Dune::ReservedVector< Scalar, 4 > & cornerHalfAngles(const Element &element) const
Definition: porenetwork/2p/spatialparams.hh:215
auto fluidMatrixInteraction(const Element &element, const SubControlVolume &scv, const ElementSolution &elemSol) const
Returns the parameter object for the pore-local pc-Sw law.
Definition: porenetwork/2p/spatialparams.hh:207
The base class for spatial parameters for pore-network models.
Definition: porenetwork/common/spatialparams.hh:45
Scalar throatInscribedRadius(const Element &element, const ElementVolumeVariables &elemVolVars) const
Inscribed radius of the throat . Can be solution-dependent.
Definition: porenetwork/common/spatialparams.hh:84
const GridView & gridView() const
Returns a reference to the gridview.
Definition: porenetwork/common/spatialparams.hh:123
The base class for spatial parameters for pore-network models.