26#ifndef DUMUX_ROOT_PROBLEM_HH
27#define DUMUX_ROOT_PROBLEM_HH
29#include <dune/foamgrid/foamgrid.hh>
46template <
class TypeTag>
class RootProblem;
56template<
class TypeTag>
57struct Grid<TypeTag, TTag::Root> {
using type = Dune::FoamGrid<1, 3>; };
59template<
class TypeTag>
61template<
class TypeTag>
62struct EnableGridVolumeVariablesCache<TypeTag, TTag::Root> {
static constexpr bool value =
true; };
63template<
class TypeTag>
64struct EnableGridFluxVariablesCache<TypeTag, TTag::Root> {
static constexpr bool value =
true; };
65template<
class TypeTag>
66struct SolutionDependentAdvection<TypeTag, TTag::Root> {
static constexpr bool value =
false; };
67template<
class TypeTag>
68struct SolutionDependentMolecularDiffusion<TypeTag, TTag::Root> {
static constexpr bool value =
false; };
69template<
class TypeTag>
70struct SolutionDependentHeatConduction<TypeTag, TTag::Root> {
static constexpr bool value =
false; };
73template<
class TypeTag>
77template<
class TypeTag>
85template<
class TypeTag>
89template<
class TypeTag>
101template <
class TypeTag>
112 using GridView =
typename GridGeometry::GridView;
113 using FVElementGeometry =
typename GridGeometry::LocalView;
114 using SubControlVolume =
typename GridGeometry::SubControlVolume;
115 using SubControlVolumeFace =
typename GridGeometry::SubControlVolumeFace;
116 using GlobalPosition =
typename GridGeometry::GlobalCoordinate;
119 using Element =
typename GridView::template Codim<0>::Entity;
124 template<
class SpatialParams>
132 name_ = getParam<std::string>(
"Vtk.OutputName") +
"_" + getParamFromGroup<std::string>(this->
paramGroup(),
"Problem.Name");
133 transpirationRate_ = getParam<Scalar>(
"BoundaryConditions.TranspirationRate");
142 template<
class ElementSolution>
144 const SubControlVolume &scv,
145 const ElementSolution& elemSol)
const
147 const auto eIdx = this->
gridGeometry().elementMapper().index(element);
149 return M_PI*radius*radius;
162 const std::string&
name()
const
169 {
return 273.15 + 10.0; }
185 BoundaryTypes values;
186 values.setAllNeumann();
208 template<
class ElementVolumeVariables,
class ElementFluxVarsCache>
210 const FVElementGeometry& fvGeometry,
211 const ElementVolumeVariables& elemVolvars,
212 const ElementFluxVarsCache& elemFluxVarsCache,
213 const SubControlVolumeFace& scvf)
const
215 NeumannFluxes values(0.0);
216 if (scvf.center()[2] + eps_ > this->gridGeometry().bBoxMax()[2])
218 const auto r = this->
spatialParams().radius(scvf.insideScvIdx());
219 values[Indices::conti0EqIdx] = transpirationRate_/(M_PI*r*r)/scvf.area();
263 template<
class ElementVolumeVariables>
265 const Element &element,
266 const FVElementGeometry& fvGeometry,
267 const ElementVolumeVariables& elemVolVars,
268 const SubControlVolume &scv)
const
271 const Scalar pressure3D = this->
couplingManager().bulkPriVars(source.id())[Indices::pressureIdx];
272 const Scalar pressure1D = this->
couplingManager().lowDimPriVars(source.id())[Indices::pressureIdx];
274 const auto lowDimElementIdx = this->
couplingManager().pointSourceData(source.id()).lowDimElementIdx();
275 const Scalar Kr = this->
spatialParams().Kr(lowDimElementIdx);
276 const Scalar rootRadius = this->
spatialParams().radius(lowDimElementIdx);
280 const Scalar sourceValue = 2* M_PI *rootRadius * Kr *(pressure3D - pressure1D)*
density;
291 {
return PrimaryVariables(0.0); }
299 PrimaryVariables
source(0.0);
300 for (
const auto& element : elements(this->
gridGeometry().gridView()))
303 fvGeometry.bindElement(element);
305 auto elemVolVars =
localView(gridVars.curGridVolVars());
306 elemVolVars.bindElement(element, fvGeometry, sol);
308 for (
auto&& scv : scvs(fvGeometry))
310 auto pointSources = this->
scvPointSources(element, fvGeometry, elemVolVars, scv);
311 pointSources *= scv.volume()*elemVolVars[scv].extrusionFactor();
316 std::cout <<
"Global integrated source (root): " <<
source <<
" (kg/s) / "
317 <<
source*3600*24*1000 <<
" (g/day)" <<
'\n';
325 template<
class VtkOutputModule>
333 {
return *couplingManager_; }
336 Scalar transpirationRate_;
338 static constexpr Scalar eps_ = 1.5e-7;
341 std::shared_ptr<CouplingManager> couplingManager_;
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.
Properties for all models using cell-centered finite volume scheme with TPFA.
A much simpler (and thus potentially less buggy) version of pure water.
A liquid phase consisting of a single component.
GridCache::LocalView localView(const GridCache &gridCache)
Free function to get the local view of a grid cache object.
Definition: localview.hh:38
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property (equivalent to old macro GET_PROP_TYPE(....
Definition: propertysystem.hh:149
std::string density(int phaseIdx) noexcept
I/O name of density for multiphase systems.
Definition: name.hh:65
Base class for all finite-volume problems.
Definition: common/fvproblem.hh:50
NumEqVector scvPointSources(const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const SubControlVolume &scv) const
Adds contribution of point sources for a specific sub control volume to the values....
Definition: common/fvproblem.hh:435
const std::string & paramGroup() const
The parameter group in which to retrieve runtime parameters.
Definition: common/fvproblem.hh:592
NumEqVector source(const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const SubControlVolume &scv) const
Evaluate the source term for all phases within a given sub-control-volume.
Definition: common/fvproblem.hh:327
const GridGeometry & gridGeometry() const
The finite volume grid geometry.
Definition: common/fvproblem.hh:588
The DUNE grid type.
Definition: common/properties.hh:57
Property to specify the type of a problem which has to be solved.
Definition: common/properties.hh:69
Definition: common/properties.hh:91
Definition: common/properties.hh:169
The type of the spatial parameters object.
Definition: common/properties.hh:221
The type of the fluid system to use.
Definition: common/properties.hh:223
A VTK output module to simplify writing dumux simulation data to VTK format.
Definition: io/vtkoutputmodule.hh:66
void addField(const Vector &v, const std::string &name, FieldType fieldType=FieldType::automatic)
Definition: io/vtkoutputmodule.hh:161
A liquid phase consisting of a single component.
Definition: 1pliquid.hh:46
A liquid phase consisting of a two components, a main component and a conservative tracer component.
Definition: liquidphase2c.hh:46
Element-wise calculation of the residual and its derivatives for a single-phase, incompressible,...
Definition: 1p/incompressiblelocalresidual.hh:41
Base class for all fully implicit porous media problems.
Definition: dumux/porousmediumflow/problem.hh:39
SpatialParams & spatialParams()
Returns the spatial parameters object.
Definition: dumux/porousmediumflow/problem.hh:146
Exact solution 1D-3D.
Definition: 1p_richards/problem_root.hh:103
void addVtkOutputFields(VtkOutputModule &vtk) const
Adds additional VTK output data to the VTKWriter.
Definition: 1p_richards/problem_root.hh:326
const CouplingManager & couplingManager() const
Get the coupling manager.
Definition: 1p2c_richards2c/problem_root.hh:347
void pointSource(PointSource &source, const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const SubControlVolume &scv) const
Evaluates the point sources (added by addPointSources) for all phases within a given sub control volu...
Definition: 1p_richards/problem_root.hh:264
void addPointSources(std::vector< PointSource > &pointSources) const
Applies a vector of point sources which are possibly solution dependent.
Definition: 1p_richards/problem_root.hh:242
void computeSourceIntegral(const SolutionVector &sol, const GridVariables &gridVars)
Definition: 1p_richards/problem_root.hh:297
RootProblem(std::shared_ptr< const GridGeometry > gridGeometry, std::shared_ptr< SpatialParams > spatialParams, std::shared_ptr< CouplingManager > couplingManager)
Definition: 1p_richards/problem_root.hh:125
Scalar temperature() const
Returns the temperature within the domain in [K].
Definition: 1p_richards/problem_root.hh:168
PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
Evaluates the initial value for a control volume.
Definition: 1p2c_richards2c/problem_root.hh:330
BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
Specifies which kind of boundary condition should be used for which equation on a given boundary segm...
Definition: 1p_richards/problem_root.hh:183
const std::string & name() const
The problem name.
Definition: 1p_richards/problem_root.hh:162
NeumannFluxes neumann(const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolvars, const ElementFluxVarsCache &elemFluxVarsCache, const SubControlVolumeFace &scvf) const
Evaluates the boundary conditions for a Neumann boundary segment.
Definition: 1p_richards/problem_root.hh:209
Scalar extrusionFactor(const Element &element, const SubControlVolume &scv, const ElementSolution &elemSol) const
Returns how much the domain is extruded at a given sub-control volume.
Definition: 1p_richards/problem_root.hh:143
PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
Evaluates the boundary conditions for a Dirichlet control volume.
Definition: 1p_richards/problem_root.hh:197
Indices
Definition: 1p2c_richards2c/problem_root.hh:125
Definition: 1p2c_richards2c/problem_root.hh:51
std::tuple< OnePNC, CCTpfaModel > InheritsFrom
Definition: 1p2c_richards2c/problem_root.hh:51
Dune::FoamGrid< 1, 3 > type
Definition: 1p2c_richards2c/problem_root.hh:56
GetPropType< TypeTag, Properties::Scalar > Scalar
Definition: 1p2c_richards2c/problem_root.hh:79
Definition of the spatial parameters for the root xylem flow.
Definition: 1p2c_richards2c/spatialparams_root.hh:42
Declares all properties used in Dumux.
A single-phase, isothermal flow model using the fully implicit scheme.
Base class for all porous media problems.
Element-wise calculation of the residual and its derivatives for a single-phase, incompressible,...
The spatial parameters class blood flow problem.