28#ifndef DUMUX_OBSTACLEPROBLEM_HH
29#define DUMUX_OBSTACLEPROBLEM_HH
31#include <dune/common/parametertreeparser.hh>
32#include <dune/grid/yaspgrid.hh>
56template <
class TypeTag>
68template<
class TypeTag>
69struct Grid<TypeTag, TTag::Obstacle> {
using type = Dune::YaspGrid<2>; };
72template<
class TypeTag>
76template<
class TypeTag>
85template<
class TypeTag>
93template<
class TypeTag>
94struct Scalar<TypeTag, TTag::Obstacle> {
using type = double; };
126template <
class TypeTag>
138 using SubControlVolume =
typename FVElementGeometry::SubControlVolume;
139 using SubControlVolumeFace =
typename FVElementGeometry::SubControlVolumeFace;
141 using Element =
typename GridView::template Codim<0>::Entity;
144 using ParameterCache =
typename FluidSystem::ParameterCache;
149 enum { dimWorld = GridView::dimensionworld };
150 enum { numPhases = ModelTraits::numFluidPhases() };
151 enum { numComponents = ModelTraits::numFluidComponents() };
152 enum { gasPhaseIdx = FluidSystem::gasPhaseIdx };
153 enum { liquidPhaseIdx = FluidSystem::liquidPhaseIdx };
154 enum { H2OIdx = FluidSystem::H2OIdx };
155 enum { N2Idx = FluidSystem::N2Idx };
156 enum { fug0Idx = Indices::fug0Idx };
157 enum { s0Idx = Indices::s0Idx };
158 enum { p0Idx = Indices::p0Idx };
160 using GlobalPosition =
typename SubControlVolume::GlobalPosition;
161 using PhaseVector = Dune::FieldVector<Scalar, numPhases>;
167 temperature_ = 273.15 + 25;
170 Scalar Tmin = temperature_ - 1.0;
171 Scalar Tmax = temperature_ + 1.0;
174 Scalar pmin = 1.0e5 * 0.75;
175 Scalar pmax = 2.0e5 * 1.25;
178 FluidSystem::init(Tmin, Tmax, nT, pmin, pmax, np);
179 name_ = getParam<std::string>(
"Problem.Name");
199 {
return temperature_; }
206 return ParentType::shouldWriteRestartFile();
223 BoundaryTypes bcTypes;
224 if (onInlet_(globalPos) || onOutlet_(globalPos))
225 bcTypes.setAllDirichlet();
227 bcTypes.setAllNeumann();
238 return initial_(globalPos);
246 return NumEqVector(0.0);
267 NumEqVector
source(
const Element &element,
268 const FVElementGeometry& fvGeometry,
269 const ElementVolumeVariables& elemVolVars,
270 const SubControlVolume &scv)
const
272 return NumEqVector(0.0);
285 return initial_(globalPos);
292 PrimaryVariables initial_(
const GlobalPosition &globalPos)
const
294 PrimaryVariables values(0.0);
303 if (onInlet_(globalPos))
306 refPhaseIdx = liquidPhaseIdx;
307 otherPhaseIdx = gasPhaseIdx;
310 fs.setSaturation(liquidPhaseIdx, 1.0);
313 fs.setPressure(liquidPhaseIdx, 2e5);
316 fs.setMoleFraction(liquidPhaseIdx, N2Idx, 0.0);
317 fs.setMoleFraction(liquidPhaseIdx, H2OIdx, 1.0);
321 refPhaseIdx = gasPhaseIdx;
322 otherPhaseIdx = liquidPhaseIdx;
325 fs.setSaturation(gasPhaseIdx, 1.0);
328 fs.setPressure(gasPhaseIdx, 1e5);
331 fs.setMoleFraction(gasPhaseIdx, N2Idx, 0.99);
332 fs.setMoleFraction(gasPhaseIdx, H2OIdx, 0.01);
336 fs.setSaturation(otherPhaseIdx, 1.0 - fs.saturation(refPhaseIdx));
339 const auto& matParams = this->
spatialParams().materialLawParamsAtPos(globalPos);
341 using MaterialLaw =
typename ParentType::SpatialParams::MaterialLaw;
342 using MPAdapter = MPAdapter<MaterialLaw, numPhases>;
344 const int wPhaseIdx = this->
spatialParams().template wettingPhaseAtPos<FluidSystem>(globalPos);
345 MPAdapter::capillaryPressures(pc, matParams, fs, wPhaseIdx);
346 fs.setPressure(otherPhaseIdx,
347 fs.pressure(refPhaseIdx)
348 + (pc[otherPhaseIdx] - pc[refPhaseIdx]));
352 using ComputeFromReferencePhase = ComputeFromReferencePhase<Scalar, FluidSystem>;
354 ParameterCache paramCache;
364 for (
int compIdx = 0; compIdx < numComponents; ++compIdx)
365 values[fug0Idx + compIdx] = fs.fugacity(refPhaseIdx, compIdx);
368 for (
int phaseIdx = 0; phaseIdx < numPhases - 1; ++phaseIdx)
369 values[s0Idx + phaseIdx] = fs.saturation(phaseIdx);
372 values[p0Idx] = fs.pressure(0);
376 bool onInlet_(
const GlobalPosition &globalPos)
const
378 Scalar x = globalPos[0];
379 Scalar y = globalPos[1];
380 return x >= 60 - eps_ && y <= 10 + eps_;
383 bool onOutlet_(
const GlobalPosition &globalPos)
const
385 Scalar x = globalPos[0];
386 Scalar y = globalPos[1];
387 return x < eps_ && y <= 10 + eps_;
391 static constexpr Scalar eps_ = 1e-6;
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.
Computes all quantities of a generic fluid state if a reference phase has been specified.
Represents all relevant thermodynamic quantities of a multi-phase, multi-component fluid system assum...
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
Property tag Indices
Definition: porousmediumflow/sequential/properties.hh:59
Base class for all finite-volume problems.
Definition: common/fvproblem.hh:50
const GridGeometry & gridGeometry() const
The finite volume grid geometry.
Definition: common/fvproblem.hh:588
Property to specify the type of scalar values.
Definition: common/properties.hh:53
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
static void solve(FluidState &fluidState, ParameterCache ¶mCache, int refPhaseIdx)
Computes all quantities of a generic fluid state if a reference phase has been specified.
Definition: computefromreferencephase.hh:112
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
Base class for all fully implicit porous media problems.
Definition: dumux/porousmediumflow/problem.hh:39
Scalar temperatureAtPos(const GlobalPosition &globalPos) const
Returns the temperature at a given global position.
Definition: dumux/porousmediumflow/problem.hh:105
SpatialParams & spatialParams()
Returns the spatial parameters object.
Definition: dumux/porousmediumflow/problem.hh:146
Problem where liquid water is injected which has to go around an obstacle with lower permeability.
Definition: test/porousmediumflow/mpnc/implicit/obstacle/problem.hh:129
PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
Evaluates the boundary conditions for a Dirichlet boundary segment.
Definition: test/porousmediumflow/mpnc/implicit/obstacle/problem.hh:236
bool shouldWriteRestartFile() const
Write a restart file?
Definition: test/porousmediumflow/mpnc/implicit/obstacle/problem.hh:204
PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
Evaluates the initial value for a control volume.
Definition: test/porousmediumflow/mpnc/implicit/obstacle/problem.hh:283
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/mpnc/implicit/obstacle/problem.hh:221
NumEqVector source(const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const SubControlVolume &scv) const
Evaluates the source term for all balance equations within a given sub-control volume.
Definition: test/porousmediumflow/mpnc/implicit/obstacle/problem.hh:267
Scalar temperature() const
Returns the temperature .
Definition: test/porousmediumflow/mpnc/implicit/obstacle/problem.hh:198
const std::string name() const
Returns the problem name.
Definition: test/porousmediumflow/mpnc/implicit/obstacle/problem.hh:192
ObstacleProblem(std::shared_ptr< const GridGeometry > gridGeometry)
Definition: test/porousmediumflow/mpnc/implicit/obstacle/problem.hh:164
NumEqVector neumannAtPos(const GlobalPosition &globalPos) const
Evaluates the boundary conditions for a Neumann boundary segment.
Definition: test/porousmediumflow/mpnc/implicit/obstacle/problem.hh:244
Definition: test/porousmediumflow/mpnc/implicit/obstacle/problem.hh:62
std::tuple< MPNC > InheritsFrom
Definition: test/porousmediumflow/mpnc/implicit/obstacle/problem.hh:62
Definition: test/porousmediumflow/mpnc/implicit/obstacle/problem.hh:63
std::tuple< Obstacle, BoxModel > InheritsFrom
Definition: test/porousmediumflow/mpnc/implicit/obstacle/problem.hh:63
Definition: test/porousmediumflow/mpnc/implicit/obstacle/problem.hh:64
std::tuple< Obstacle, CCTpfaModel > InheritsFrom
Definition: test/porousmediumflow/mpnc/implicit/obstacle/problem.hh:64
Dune::YaspGrid< 2 > type
Definition: test/porousmediumflow/mpnc/implicit/obstacle/problem.hh:69
GetPropType< TypeTag, Properties::GridGeometry > GridGeometry
Definition: test/porousmediumflow/mpnc/implicit/obstacle/problem.hh:79
GetPropType< TypeTag, Properties::Scalar > Scalar
Definition: test/porousmediumflow/mpnc/implicit/obstacle/problem.hh:80
double type
Definition: test/porousmediumflow/mpnc/implicit/obstacle/problem.hh:94
Definition of the spatial params properties for the obstacle problem.
Definition: porousmediumflow/mpnc/implicit/obstacle/spatialparams.hh:44
A fully implicit model for MpNc flow using vertex centered finite volumes.
Base class for all porous media problems.
Definition of the spatial parameters for the MaxwellStefan problem.