12#ifndef DUMUX_PYTHON_POROUSMEDIUMFLOW_PROBLEM_HH
13#define DUMUX_PYTHON_POROUSMEDIUMFLOW_PROBLEM_HH
16#include <dune/python/pybind11/pybind11.h>
26template<
class Gr
idGeometry_,
class SpatialParams_,
class PrimaryVariables,
bool enableInternalDirichletConstra
ints>
28:
public Dumux::Python::FVProblem<GridGeometry_, SpatialParams_, PrimaryVariables, enableInternalDirichletConstraints>
34 using Scalar =
typename PrimaryVariables::value_type;
35 using NumEqVector = Dune::FieldVector<Scalar, PrimaryVariables::dimension>;
36 using Element =
typename GridGeometry::GridView::template Codim<0>::Entity;
43 static constexpr std::size_t
numEq =
static_cast<std::size_t
>(PrimaryVariables::dimension);
48 pybind11::object pyProblem)
54 {
return *spatialParams_; }
57 std::shared_ptr<const SpatialParams> spatialParams_;
61template<
class Problem,
class... options>
64 using pybind11::operator
""_a;
65 using namespace Dune::Python;
67 using GridGeometry =
typename Problem::GridGeometry;
68 using SpatialParams =
typename Problem::SpatialParams;
69 cls.def(pybind11::init([](std::shared_ptr<const GridGeometry> gridGeometry,
70 std::shared_ptr<SpatialParams> spatialParams,
72 return std::make_shared<Problem>(gridGeometry, spatialParams, p);
75 cls.def_property_readonly(
"name", &Problem::name);
76 cls.def_property_readonly(
"numEq", [](Problem&){
return Problem::numEq; });
78 using GridView =
typename GridGeometry::GridView;
79 using Element =
typename GridView::template Codim<0>::Entity;
80 using Vertex =
typename GridView::template Codim<GridView::dimension>::Entity;
82 if constexpr (Problem::isBox)
84 using SCV =
typename Problem::SubControlVolume;
85 cls.def(
"boundaryTypes", pybind11::overload_cast<const Element&, const SCV&>(&Problem::boundaryTypes, pybind11::const_),
"element"_a,
"scv"_a);
86 cls.def(
"dirichlet", pybind11::overload_cast<const Element&, const SCV&>(&Problem::dirichlet, pybind11::const_),
"element"_a,
"scv"_a);
90 using SCVF =
typename Problem::SubControlVolumeFace;
91 cls.def(
"boundaryTypes", pybind11::overload_cast<const Element&, const SCVF&>(&Problem::boundaryTypes, pybind11::const_),
"element"_a,
"scvf"_a);
92 cls.def(
"dirichlet", pybind11::overload_cast<const Element&, const SCVF&>(&Problem::dirichlet, pybind11::const_),
"element"_a,
"scvf"_a);
95 cls.def(
"neumann", &Problem::template neumann<
decltype(std::ignore),
decltype(std::ignore)>);
96 cls.def(
"source", &Problem::template source<
decltype(std::ignore)>);
97 cls.def(
"sourceAtPos", &Problem::sourceAtPos);
98 cls.def(
"initial", &Problem::template initial<Element>);
99 cls.def(
"initial", &Problem::template initial<Vertex>);
100 cls.def(
"gridGeometry", &Problem::gridGeometry);
101 cls.def(
"spatialParams", &Problem::spatialParams);
Class to specify the type of a boundary.
Definition: common/boundarytypes.hh:26
A C++ wrapper for a Python problem.
Definition: python/common/fvproblem.hh:37
const GridGeometry & gridGeometry() const
Definition: python/common/fvproblem.hh:212
A C++ wrapper for a Python PorousMediumFlow problem.
Definition: python/porousmediumflow/problem.hh:29
typename GridGeometry::SubControlVolume SubControlVolume
Definition: python/porousmediumflow/problem.hh:38
typename PrimaryVariables::value_type Scalar
Definition: python/porousmediumflow/problem.hh:34
typename GridGeometry::LocalView FVElementGeometry
Definition: python/porousmediumflow/problem.hh:37
Dune::FieldVector< Scalar, PrimaryVariables::dimension > NumEqVector
Definition: python/porousmediumflow/problem.hh:35
typename Element::Geometry::GlobalCoordinate GlobalPosition
Definition: python/porousmediumflow/problem.hh:40
static constexpr std::size_t numEq
Definition: python/porousmediumflow/problem.hh:43
SpatialParams_ SpatialParams
Definition: python/porousmediumflow/problem.hh:33
PorousMediumFlowProblem(std::shared_ptr< const GridGeometry > gridGeometry, std::shared_ptr< const SpatialParams > spatialParams, pybind11::object pyProblem)
Definition: python/porousmediumflow/problem.hh:46
typename GridGeometry::GridView::template Codim< 0 >::Entity Element
Definition: python/porousmediumflow/problem.hh:36
GridGeometry_ GridGeometry
Definition: python/porousmediumflow/problem.hh:32
static constexpr bool isBox
Definition: python/porousmediumflow/problem.hh:42
typename GridGeometry::SubControlVolumeFace SubControlVolumeFace
Definition: python/porousmediumflow/problem.hh:39
const SpatialParams & spatialParams() const
Definition: python/porousmediumflow/problem.hh:53
constexpr Box box
Definition: method.hh:147
Definition: python/assembly/fvassembler.hh:18
void registerPorousMediumFlowProblem(pybind11::handle scope, pybind11::class_< Problem, options... > cls)
Definition: python/porousmediumflow/problem.hh:62