25#ifndef DUMUX_2P_BOX_MATERIAL_INTERFACE_PARAMS_HH
26#define DUMUX_2P_BOX_MATERIAL_INTERFACE_PARAMS_HH
28#include <dune/common/exceptions.hh>
45template<
class SpatialParams>
58 template<
class Gr
idGeometry,
class SolutionVector>
59 void update(
const GridGeometry& gridGeometry,
60 const SpatialParams& spatialParams,
61 const SolutionVector& x)
63 using MaterialLaw =
typename SpatialParams::MaterialLaw;
66 using Elem =
typename GridGeometry::GridView::template Codim<0>::Entity;
68 using Scv =
typename GridGeometry::SubControlVolume;
69 using ReturnType =
decltype(spatialParams.materialLawParams(Elem(), Scv(), ElemSol()));
70 static_assert(std::is_lvalue_reference<ReturnType>::value,
71 "In order to use the box-interface solver please provide access "
72 "to the material law parameters via returning (const) references");
76 DUNE_THROW(Dune::InvalidStateException,
"Determination of the interface material parameters with "
77 "this class only makes sense when using the box method!");
80 isOnMaterialInterface_.resize(gridGeometry.numDofs(),
false);
81 dofParams_.resize(gridGeometry.numDofs(),
nullptr);
82 for (
const auto& element : elements(gridGeometry.gridView()))
86 auto fvGeometry =
localView(gridGeometry);
87 fvGeometry.bind(element);
88 for (
const auto& scv : scvs(fvGeometry))
90 const auto& params = spatialParams.materialLawParams(element, scv, elemSol);
93 if (dofParams_[scv.dofIndex()] ==
nullptr)
94 dofParams_[scv.dofIndex()] = ¶ms;
97 else if (MaterialLaw::endPointPc( params ) < MaterialLaw::endPointPc( *(dofParams_[scv.dofIndex()]) ))
99 dofParams_[scv.dofIndex()] = ¶ms;
100 isOnMaterialInterface_[scv.dofIndex()] =
true;
104 else if ( !(params == *(dofParams_[scv.dofIndex()])) )
105 isOnMaterialInterface_[scv.dofIndex()] =
true;
113 { assert(isUpdated_);
return isOnMaterialInterface_[scv.dofIndex()]; }
118 { assert(isUpdated_);
return *(dofParams_[scv.dofIndex()]); }
121 bool isUpdated_{
false};
122 std::vector<bool> isOnMaterialInterface_;
123 std::vector<const MaterialLawParams*> dofParams_;
The available discretization methods in Dumux.
GridCache::LocalView localView(const GridCache &gridCache)
Free function to get the local view of a grid cache object.
Definition: localview.hh:38
auto elementSolution(const Element &element, const SolutionVector &sol, const GridGeometry &gg) -> std::enable_if_t< GridGeometry::discMethod==DiscretizationMethod::box, BoxElementSolution< typename GridGeometry::LocalView, std::decay_t< decltype(std::declval< SolutionVector >()[0])> > >
Make an element solution for box schemes.
Definition: box/elementsolution.hh:115
Class that determines the material with the lowest capillary pressure (under fully water-saturated co...
Definition: boxmaterialinterfaceparams.hh:47
typename SpatialParams::MaterialLaw::Params MaterialLawParams
Definition: boxmaterialinterfaceparams.hh:49
void update(const GridGeometry &gridGeometry, const SpatialParams &spatialParams, const SolutionVector &x)
Updates the scv -> dofparameter map.
Definition: boxmaterialinterfaceparams.hh:59
const MaterialLawParams & getDofParams(const Scv &scv) const
Returns the material parameters associated with the dof.
Definition: boxmaterialinterfaceparams.hh:117
bool isOnMaterialInterface(const Scv &scv) const
Returns if this scv is connected to a material interface.
Definition: boxmaterialinterfaceparams.hh:112
The local element solution class for the box method.