28#ifndef DUMUX_1PNI_CONVECTION_PROBLEM_HH
29#define DUMUX_1PNI_CONVECTION_PROBLEM_HH
32#include <dune/grid/yaspgrid.hh>
47template <
class TypeTag>
48class OnePNIConvectionProblem;
61template<
class TypeTag>
62struct Grid<TypeTag, TTag::OnePNIConvection> {
using type = Dune::YaspGrid<1>; };
65template<
class TypeTag>
69template<
class TypeTag>
77template<
class TypeTag>
109template <
class TypeTag>
116 using SubControlVolumeFace =
typename FVElementGeometry::SubControlVolumeFace;
122 using ElementVolumeVariables =
typename GridVariables::GridVolumeVariables::LocalView;
123 using ElementFluxVariablesCache =
typename GridVariables::GridFluxVariablesCache::LocalView;
124 using VolumeVariables =
typename GridVariables::GridVolumeVariables::VolumeVariables;
128 enum { dimWorld = GridView::dimensionworld };
134 pressureIdx = Indices::pressureIdx,
135 temperatureIdx = Indices::temperatureIdx
139 conti0EqIdx = Indices::conti0EqIdx,
140 energyEqIdx = Indices::energyEqIdx
144 using Element =
typename GridView::template Codim<0>::Entity;
145 using GlobalPosition =
typename Element::Geometry::GlobalCoordinate;
155 name_ = getParam<std::string>(
"Problem.Name");
156 darcyVelocity_ = getParam<Scalar>(
"Problem.DarcyVelocity");
158 temperatureHigh_ = 291.0;
159 temperatureLow_ = 290.0;
163 temperatureExact_.resize(this->
gridGeometry().numDofs());
169 return temperatureExact_;
175 const auto someElement = *(elements(this->
gridGeometry().gridView()).begin());
178 const auto someInitSol =
initialAtPos(someElement.geometry().center());
181 someFvGeometry.bindElement(someElement);
182 const auto someScv = *(scvs(someFvGeometry).begin());
184 VolumeVariables volVars;
185 volVars.update(someElemSol, *
this, someElement, someScv);
188 const auto densityW = volVars.density();
190 const auto storageW = densityW*heatCapacityW*
porosity;
191 const auto densityS = volVars.solidDensity();
192 const auto heatCapacityS = volVars.solidHeatCapacity();
193 const auto storageTotal = storageW + densityS*heatCapacityS*(1 -
porosity);
194 std::cout <<
"storage: " << storageTotal <<
'\n';
197 time = max(time, 1e-10);
198 const Scalar retardedFrontVelocity = darcyVelocity_*storageW/storageTotal/
porosity;
199 std::cout <<
"retarded velocity: " << retardedFrontVelocity <<
'\n';
201 for (
const auto& element : elements(this->
gridGeometry().gridView()))
204 fvGeometry.bindElement(element);
205 for (
auto&& scv : scvs(fvGeometry))
207 auto dofIdxGlobal = scv.dofIndex();
208 auto dofPosition = scv.dofPosition();
209 temperatureExact_[dofIdxGlobal] = (dofPosition[0] < retardedFrontVelocity*time) ? temperatureHigh_ : temperatureLow_;
224 const std::string&
name()
const
244 BoundaryTypes bcTypes;
246 if(globalPos[0] > this->
gridGeometry().bBoxMax()[0] - eps_)
247 bcTypes.setAllDirichlet();
249 bcTypes.setAllNeumann();
263 return initial_(globalPos);
282 const FVElementGeometry& fvGeometry,
283 const ElementVolumeVariables& elemVolVars,
284 const ElementFluxVariablesCache& elemFluxVarsCache,
285 const SubControlVolumeFace& scvf)
const
287 NumEqVector values(0.0);
288 const auto globalPos = scvf.ipGlobal();
289 const auto& volVars = elemVolVars[scvf.insideScvIdx()];
291 if(globalPos[0] < eps_)
293 values[conti0EqIdx] = -darcyVelocity_*volVars.density();
316 return initial_(globalPos);
323 PrimaryVariables initial_(
const GlobalPosition &globalPos)
const
325 PrimaryVariables priVars(0.0);
326 priVars[pressureIdx] = pressureLow_;
327 priVars[temperatureIdx] = temperatureLow_;
331 Scalar temperatureHigh_;
332 Scalar temperatureLow_;
333 Scalar pressureHigh_;
335 Scalar darcyVelocity_;
336 static constexpr Scalar eps_ = 1e-6;
338 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 mpfa.
Properties for all models using cell-centered finite volume scheme with TPFA.
Material properties of pure water .
Reation for a simple effective thermal conductivity.
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
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
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 porosity() noexcept
I/O name of porosity.
Definition: name.hh:139
Base class for all finite-volume problems.
Definition: common/fvproblem.hh:50
const std::string & paramGroup() const
The parameter group in which to retrieve runtime parameters.
Definition: common/fvproblem.hh:592
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
A liquid phase consisting of a single component.
Definition: 1pliquid.hh:46
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
Test for the OnePModel in combination with the NI model for a convection problem.
Definition: problem_convection.hh:111
const std::vector< Scalar > & getExactTemperature()
Get exact temperature vector for output.
Definition: problem_convection.hh:167
OnePNIConvectionProblem(std::shared_ptr< const GridGeometry > gridGeometry, const std::string ¶mGroup)
Definition: problem_convection.hh:149
const std::string & name() const
The problem name.
Definition: problem_convection.hh:224
PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
Evaluates the boundary conditions for a Dirichlet control volume.
Definition: problem_convection.hh:261
void updateExactTemperature(const SolutionVector &curSol, Scalar time)
Udpate the analytical temperature.
Definition: problem_convection.hh:173
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 in dependency on the current solutio...
Definition: problem_convection.hh:281
BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
Specifies which kind of boundary condition should be used for which equation on a given boundary segm...
Definition: problem_convection.hh:242
PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
Evaluates the initial value for a control volume.
Definition: problem_convection.hh:314
Definition: problem_convection.hh:54
std::tuple< OnePNI > InheritsFrom
Definition: problem_convection.hh:54
Definition: problem_convection.hh:55
std::tuple< OnePNIConvection, BoxModel > InheritsFrom
Definition: problem_convection.hh:55
Definition: problem_convection.hh:56
std::tuple< OnePNIConvection, CCTpfaModel > InheritsFrom
Definition: problem_convection.hh:56
Definition: problem_convection.hh:57
std::tuple< OnePNIConvection, CCMpfaModel > InheritsFrom
Definition: problem_convection.hh:57
Dune::YaspGrid< 1 > type
Definition: problem_convection.hh:62
GetPropType< TypeTag, Properties::GridGeometry > GridGeometry
Definition: problem_convection.hh:80
GetPropType< TypeTag, Properties::Scalar > Scalar
Definition: problem_convection.hh:81
Definition of the spatial parameters for the 1pni problems.
Definition: porousmediumflow/1p/implicit/nonisothermal/spatialparams.hh:41
A single-phase, isothermal flow model using the fully implicit scheme.
Base class for all porous media problems.
Definition of the spatial parameters for the MaxwellStefan problem.