27#ifndef DUMUX_RICHARDS_CONVECTION_PROBLEM_HH
28#define DUMUX_RICHARDS_CONVECTION_PROBLEM_HH
31#include <dune/grid/yaspgrid.hh>
50template <
class TypeTag>
62template<
class TypeTag>
63struct Grid<TypeTag,
TTag::RichardsNIConvection> {
using type = Dune::YaspGrid<2>; };
66template<
class TypeTag>
70template<
class TypeTag>
74template<
class TypeTag>
106template <
class TypeTag>
121 using ElementVolumeVariables =
typename GridVariables::GridVolumeVariables::LocalView;
122 using ElementFluxVariablesCache =
typename GridVariables::GridFluxVariablesCache::LocalView;
123 using VolumeVariables =
typename GridVariables::GridVolumeVariables::VolumeVariables;
125 using SubControlVolumeFace =
typename FVElementGeometry::SubControlVolumeFace;
130 enum { dimWorld = GridView::dimensionworld };
133 pressureIdx = Indices::pressureIdx,
134 liquidPhaseOnly = Indices::liquidPhaseOnly,
135 liquidPhaseIdx = FluidSystem::liquidPhaseIdx,
136 temperatureIdx = Indices::temperatureIdx
139 using Element =
typename GridView::template Codim<0>::Entity;
141 using GlobalPosition =
typename SubControlVolumeFace::GlobalPosition;
152 temperatureHigh_ = 291.;
153 temperatureLow_ = 290.;
162 return temperatureExact_;
168 const auto someElement = *(elements(this->
gridGeometry().gridView()).begin());
171 const auto someInitSol =
initialAtPos(someElement.geometry().center());
174 someFvGeometry.bindElement(someElement);
175 const auto someScv = *(scvs(someFvGeometry).begin());
177 VolumeVariables volVars;
178 volVars.update(someElemSol, *
this, someElement, someScv);
180 const auto porosity = this->
spatialParams().porosity(someElement, someScv, someElemSol);
181 const auto densityW = volVars.density(liquidPhaseIdx);
183 const auto densityS = volVars.solidDensity();
184 const auto heatCapacityS = volVars.solidHeatCapacity();
185 const auto storage = densityW*heatCapacityW*porosity + densityS*heatCapacityS*(1 - porosity);
186 const auto effectiveThermalConductivity = ThermalConductivityModel::effectiveThermalConductivity(volVars);
188 time = max(time, 1e-10);
189 for (
const auto& element : elements(this->
gridGeometry().gridView()))
192 fvGeometry.bindElement(element);
194 for (
auto&& scv : scvs(fvGeometry))
196 auto globalIdx = scv.dofIndex();
197 const auto& globalPos = scv.dofPosition();
200 temperatureExact_[globalIdx] = temperatureHigh_ + (someInitSol[temperatureIdx] - temperatureHigh_)
201 *erf(0.5*sqrt(globalPos[0]*globalPos[0]*storage/time/effectiveThermalConductivity));
216 const std::string&
name()
const
236 BoundaryTypes values;
237 if(globalPos[0] > this->
gridGeometry().bBoxMax()[0] - eps_)
239 values.setAllDirichlet();
243 values.setAllNeumann();
257 return initial_(globalPos);
271 const FVElementGeometry& fvGeometry,
272 const ElementVolumeVariables& elemVolVars,
273 const ElementFluxVariablesCache& elemFluxVarsCache,
274 const SubControlVolumeFace& scvf)
const
276 NumEqVector values(0.0);
277 const auto globalPos = scvf.ipGlobal();
279 if(globalPos[0] < eps_)
281 values[pressureIdx] = -darcyVelocity_*elemVolVars[scvf.insideScvIdx()].density(liquidPhaseIdx);
282 values[temperatureIdx] = -darcyVelocity_*elemVolVars[scvf.insideScvIdx()].density(liquidPhaseIdx)
315 return initial_(globalPos);
321 PrimaryVariables initial_(
const GlobalPosition &globalPos)
const
323 PrimaryVariables priVars(0.0);
324 priVars.setState(liquidPhaseOnly);
325 priVars[pressureIdx] = pressureLow_;
326 priVars[temperatureIdx] = temperatureLow_;
330 Scalar temperatureHigh_;
331 Scalar temperatureLow_;
332 Scalar pressureHigh_;
334 Scalar darcyVelocity_;
335 static constexpr Scalar eps_ = 1e-6;
337 std::vector<Scalar> temperatureExact_;
Element solution classes and factory functions.
Defines a type tag and some properties for models using the box scheme.
Properties for all models using cell-centered finite volume scheme with TPFA.
Relation for the saturation-dependent effective thermal conductivity.
A two-phase fluid system with two components water Nitrogen for non-equilibrium models.
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
T getParam(Args &&... args)
A free function to get a parameter from the parameter tree singleton.
Definition parameters.hh:428
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
Definition common/properties.hh:47
Type tag for numeric models.
Definition grid.hh:35
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
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
Material properties of pure water .
Definition h2o.hh:61
static const Scalar liquidHeatCapacity(Scalar temperature, Scalar pressure)
Specific isobaric heat capacity of liquid water .
Definition h2o.hh:281
static const Scalar liquidEnthalpy(Scalar temperature, Scalar pressure)
Specific enthalpy of liquid water .
Definition h2o.hh:217
Policy for the H2O-N2 fluid system.
Definition h2on2.hh:52
A two-phase fluid system with two components water Nitrogen for non-equilibrium models.
Definition h2on2.hh:69
SpatialParams & spatialParams()
Returns the spatial parameters object.
Definition dumux/porousmediumflow/problem.hh:146
PorousMediumFlowProblem(std::shared_ptr< const GridGeometry > gridGeometry, std::shared_ptr< SpatialParams > spatialParams, const std::string ¶mGroup="")
Constructor, passing the spatial parameters.
Definition dumux/porousmediumflow/problem.hh:67
Test for the RichardsModel in combination with the NI model for a convection problem: The simulation ...
Definition test/porousmediumflow/richards/implicit/nonisothermal/convection/problem.hh:108
PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
Evaluates the initial value for a control volume.
Definition test/porousmediumflow/richards/implicit/nonisothermal/convection/problem.hh:313
BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
Specifies which kind of boundary condition should be used for which equation on a given boundary segm...
Definition test/porousmediumflow/richards/implicit/nonisothermal/convection/problem.hh:234
PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
Evaluates the boundary conditions for a Dirichlet boundary segment.
Definition test/porousmediumflow/richards/implicit/nonisothermal/convection/problem.hh:255
Scalar nonWettingReferencePressure() const
Returns the reference pressure [Pa] of the non-wetting fluid phase within a finite volume.
Definition test/porousmediumflow/richards/implicit/nonisothermal/convection/problem.hh:302
void updateExactTemperature(const SolutionVector &curSol, Scalar time)
Update the analytical temperature.
Definition test/porousmediumflow/richards/implicit/nonisothermal/convection/problem.hh:166
const std::string & name() const
The problem name.
Definition test/porousmediumflow/richards/implicit/nonisothermal/convection/problem.hh:216
NumEqVector neumann(const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const ElementFluxVariablesCache &elemFluxVarsCache, const SubControlVolumeFace &scvf) const
Evaluates the boundary conditions for a Neumann boundary segment.
Definition test/porousmediumflow/richards/implicit/nonisothermal/convection/problem.hh:270
RichardsNIConvectionProblem(std::shared_ptr< const GridGeometry > gridGeometry)
Definition test/porousmediumflow/richards/implicit/nonisothermal/convection/problem.hh:144
const std::vector< Scalar > & getExactTemperature()
Get the analytical temperature.
Definition test/porousmediumflow/richards/implicit/nonisothermal/convection/problem.hh:160
Definition test/porousmediumflow/richards/implicit/nonisothermal/convection/problem.hh:56
std::tuple< RichardsNI > InheritsFrom
Definition test/porousmediumflow/richards/implicit/nonisothermal/convection/problem.hh:56
Definition test/porousmediumflow/richards/implicit/nonisothermal/convection/problem.hh:57
std::tuple< RichardsNIConvection, BoxModel > InheritsFrom
Definition test/porousmediumflow/richards/implicit/nonisothermal/convection/problem.hh:57
Definition test/porousmediumflow/richards/implicit/nonisothermal/convection/problem.hh:58
std::tuple< RichardsNIConvection, CCTpfaModel > InheritsFrom
Definition test/porousmediumflow/richards/implicit/nonisothermal/convection/problem.hh:58
Dune::YaspGrid< 2 > type
Definition test/porousmediumflow/richards/implicit/nonisothermal/convection/problem.hh:63
RichardsNIConvectionProblem< TypeTag > type
Definition test/porousmediumflow/richards/implicit/nonisothermal/convection/problem.hh:67
FluidSystems::H2ON2< GetPropType< TypeTag, Properties::Scalar >, FluidSystems::H2ON2DefaultPolicy< true > > type
Definition test/porousmediumflow/richards/implicit/nonisothermal/convection/problem.hh:71
RichardsNISpatialParams< GridGeometry, Scalar > type
Definition test/porousmediumflow/richards/implicit/nonisothermal/convection/problem.hh:79
GetPropType< TypeTag, Properties::Scalar > Scalar
Definition test/porousmediumflow/richards/implicit/nonisothermal/convection/problem.hh:78
GetPropType< TypeTag, Properties::GridGeometry > GridGeometry
Definition test/porousmediumflow/richards/implicit/nonisothermal/convection/problem.hh:77
Definition porousmediumflow/richards/implicit/nonisothermal/spatialparams.hh:40
This model implements a variant of the Richards' equation for quasi-twophase flow.
Base class for all porous media problems.
Definition of the spatial parameters for the non-isothermal Richards problems.