12#ifndef DUMUX_PYTHON_POROUSMEDIUMFLOW_FVSPATIALPARAMS_1P_HH 
   13#define DUMUX_PYTHON_POROUSMEDIUMFLOW_FVSPATIALPARAMS_1P_HH 
   15#include <dune/python/pybind11/pybind11.h> 
   16#include <dune/python/pybind11/stl.h> 
   22template<
class Gr
idGeometry_, 
class PT>
 
   30    using Scalar = 
typename GridGeometry::GridView::ctype;
 
   31    using Element = 
typename GridGeometry::GridView::template Codim<0>::Entity;
 
   36                        pybind11::object pySpatialParams)
 
   38    , pySpatialParams_(pySpatialParams)
 
 
   41    template<
class ElementSolution>
 
   44                                  const ElementSolution& elemSol)
 const 
   46        if (pybind11::hasattr(pySpatialParams_, 
"permeability"))
 
   47            return pySpatialParams_.attr(
"permeability")(element, scv, elemSol).
template cast<PermeabilityType>();
 
   49            return pySpatialParams_.attr(
"permeabilityAtPos")(scv.center()).template cast<PermeabilityType>();
 
 
   52    template<
class ElementSolution>
 
   55                    const ElementSolution& elemSol)
 const 
   57        if (pybind11::hasattr(pySpatialParams_, 
"porosity"))
 
   58            return pySpatialParams_.attr(
"porosity")(element, scv, elemSol).
template cast<Scalar>();
 
   60            return pySpatialParams_.attr(
"porosityAtPos")(scv.center()).template cast<Scalar>();
 
 
   63    template<
class Sol
idSystem, 
class ElementSolution>
 
   66                               const ElementSolution& elemSol,
 
   70        if (pybind11::hasattr(pySpatialParams_, 
"inertVolumeFraction"))
 
   71            return pySpatialParams_.attr(
"inertVolumeFraction")(element, scv, elemSol, compIdx).
template cast<Scalar>();
 
   72        else if (pybind11::hasattr(pySpatialParams_, 
"inertVolumeFractionAtPos"))
 
   73            return pySpatialParams_.attr(
"inertVolumeFractionAtPos")(scv.center(), compIdx).template cast<Scalar>();
 
   75            return 1.0 - this->
porosity(element, scv, elemSol);
 
 
   82    pybind11::object pySpatialParams_;
 
 
   85template <
class SpatialParams, 
class... options>
 
   88    using pybind11::operator
""_a;
 
   89    using GridGeometry = 
typename SpatialParams::GridGeometry;
 
   91    cls.def(pybind11::init([](std::shared_ptr<const GridGeometry> gridGeometry, pybind11::object p){
 
   92        return std::make_shared<SpatialParams>(gridGeometry, p);
 
   95    cls.def(
"permeability", &SpatialParams::template permeability<
decltype(std::ignore)>);
 
   96    cls.def(
"porosity", &SpatialParams::template porosity<
decltype(std::ignore)>);
 
   97    cls.def(
"inertVolumeFraction", &SpatialParams::template inertVolumeFraction<
decltype(std::ignore), 
decltype(std::ignore)>);
 
 
The base class for spatial parameters used with finite-volume schemes.
Definition python/common/fvspatialparams.hh:34
const GridGeometry & gridGeometry() const
The finite volume grid geometry.
Definition python/common/fvspatialparams.hh:127
Definition python/porousmediumflow/spatialparams.hh:25
static constexpr bool evaluatePermeabilityAtScvfIP()
Definition python/porousmediumflow/spatialparams.hh:78
GridGeometry_ GridGeometry
Definition python/porousmediumflow/spatialparams.hh:29
PermeabilityType permeability(const Element &element, const SubControlVolume &scv, const ElementSolution &elemSol) const
Definition python/porousmediumflow/spatialparams.hh:42
Scalar inertVolumeFraction(const Element &element, const SubControlVolume &scv, const ElementSolution &elemSol, int compIdx) const
Definition python/porousmediumflow/spatialparams.hh:64
FVSpatialParamsOneP(std::shared_ptr< const GridGeometry > gridGeometry, pybind11::object pySpatialParams)
Definition python/porousmediumflow/spatialparams.hh:35
typename GridGeometry::GridView::template Codim< 0 >::Entity Element
Definition python/porousmediumflow/spatialparams.hh:31
Scalar porosity(const Element &element, const SubControlVolume &scv, const ElementSolution &elemSol) const
Definition python/porousmediumflow/spatialparams.hh:53
PT PermeabilityType
Definition python/porousmediumflow/spatialparams.hh:33
typename GridGeometry::GridView::ctype Scalar
Definition python/porousmediumflow/spatialparams.hh:30
typename GridGeometry::SubControlVolume SubControlVolume
Definition python/porousmediumflow/spatialparams.hh:32
Definition python/assembly/fvassembler.hh:18
void registerFVSpatialParamsOneP(pybind11::handle scope, pybind11::class_< SpatialParams, options... > cls)
Definition python/porousmediumflow/spatialparams.hh:86
Basic spatial parameters to be used with finite-volume schemes.