24#ifndef DUMUX_PYTHON_POROUSMEDIUMFLOW_PROBLEM_HH
25#define DUMUX_PYTHON_POROUSMEDIUMFLOW_PROBLEM_HH
28#include <dune/python/pybind11/pybind11.h>
38template<
class Gr
idGeometry_,
class SpatialParams_,
class PrimaryVariables,
bool enableInternalDirichletConstra
ints>
40:
public Dumux::Python::FVProblem<GridGeometry_, SpatialParams_, PrimaryVariables, enableInternalDirichletConstraints>
46 using Scalar =
typename PrimaryVariables::value_type;
47 using NumEqVector = Dune::FieldVector<Scalar, PrimaryVariables::dimension>;
48 using Element =
typename GridGeometry::GridView::template Codim<0>::Entity;
55 static constexpr std::size_t
numEq =
static_cast<std::size_t
>(PrimaryVariables::dimension);
60 pybind11::object pyProblem)
66 {
return *spatialParams_; }
69 std::shared_ptr<const SpatialParams> spatialParams_;
73template<
class Problem,
class... options>
76 using pybind11::operator
""_a;
77 using namespace Dune::Python;
79 using GridGeometry =
typename Problem::GridGeometry;
80 using SpatialParams =
typename Problem::SpatialParams;
81 cls.def(pybind11::init([](std::shared_ptr<const GridGeometry> gridGeometry,
82 std::shared_ptr<SpatialParams> spatialParams,
84 return std::make_shared<Problem>(gridGeometry, spatialParams, p);
87 cls.def_property_readonly(
"name", &Problem::name);
88 cls.def_property_readonly(
"numEq", [](Problem&){
return Problem::numEq; });
90 using GridView =
typename GridGeometry::GridView;
91 using Element =
typename GridView::template Codim<0>::Entity;
92 using Vertex =
typename GridView::template Codim<GridView::dimension>::Entity;
94 if constexpr (Problem::isBox)
96 using SCV =
typename Problem::SubControlVolume;
97 cls.def(
"boundaryTypes", pybind11::overload_cast<const Element&, const SCV&>(&Problem::boundaryTypes, pybind11::const_),
"element"_a,
"scv"_a);
98 cls.def(
"dirichlet", pybind11::overload_cast<const Element&, const SCV&>(&Problem::dirichlet, pybind11::const_),
"element"_a,
"scv"_a);
102 using SCVF =
typename Problem::SubControlVolumeFace;
103 cls.def(
"boundaryTypes", pybind11::overload_cast<const Element&, const SCVF&>(&Problem::boundaryTypes, pybind11::const_),
"element"_a,
"scvf"_a);
104 cls.def(
"dirichlet", pybind11::overload_cast<const Element&, const SCVF&>(&Problem::dirichlet, pybind11::const_),
"element"_a,
"scvf"_a);
107 cls.def(
"neumann", &Problem::template neumann<
decltype(std::ignore),
decltype(std::ignore)>);
108 cls.def(
"source", &Problem::template source<
decltype(std::ignore)>);
109 cls.def(
"sourceAtPos", &Problem::sourceAtPos);
110 cls.def(
"initial", &Problem::template initial<Element>);
111 cls.def(
"initial", &Problem::template initial<Vertex>);
112 cls.def(
"gridGeometry", &Problem::gridGeometry);
113 cls.def(
"spatialParams", &Problem::spatialParams);
constexpr Box box
Definition: method.hh:139
Definition: python/assembly/fvassembler.hh:30
void registerPorousMediumFlowProblem(pybind11::handle scope, pybind11::class_< Problem, options... > cls)
Definition: python/porousmediumflow/problem.hh:74
Class to specify the type of a boundary.
Definition: common/boundarytypes.hh:38
A C++ wrapper for a Python problem.
Definition: python/common/fvproblem.hh:48
const GridGeometry & gridGeometry() const
Definition: python/common/fvproblem.hh:233
A C++ wrapper for a Python PorousMediumFlow problem.
Definition: python/porousmediumflow/problem.hh:41
typename GridGeometry::SubControlVolume SubControlVolume
Definition: python/porousmediumflow/problem.hh:50
typename PrimaryVariables::value_type Scalar
Definition: python/porousmediumflow/problem.hh:46
typename GridGeometry::LocalView FVElementGeometry
Definition: python/porousmediumflow/problem.hh:49
Dune::FieldVector< Scalar, PrimaryVariables::dimension > NumEqVector
Definition: python/porousmediumflow/problem.hh:47
typename Element::Geometry::GlobalCoordinate GlobalPosition
Definition: python/porousmediumflow/problem.hh:52
static constexpr std::size_t numEq
Definition: python/porousmediumflow/problem.hh:55
SpatialParams_ SpatialParams
Definition: python/porousmediumflow/problem.hh:45
PorousMediumFlowProblem(std::shared_ptr< const GridGeometry > gridGeometry, std::shared_ptr< const SpatialParams > spatialParams, pybind11::object pyProblem)
Definition: python/porousmediumflow/problem.hh:58
typename GridGeometry::GridView::template Codim< 0 >::Entity Element
Definition: python/porousmediumflow/problem.hh:48
GridGeometry_ GridGeometry
Definition: python/porousmediumflow/problem.hh:44
static constexpr bool isBox
Definition: python/porousmediumflow/problem.hh:54
typename GridGeometry::SubControlVolumeFace SubControlVolumeFace
Definition: python/porousmediumflow/problem.hh:51
const SpatialParams & spatialParams() const
Definition: python/porousmediumflow/problem.hh:65