24#ifndef DUMUX_TWOP_CORNERPOINT_TEST_PROBLEM_HH
25#define DUMUX_TWOP_CORNERPOINT_TEST_PROBLEM_HH
28#include <opm/grid/CpGrid.hpp>
41#include "spatialparams.hh"
45template<
class TypeTag>
class TwoPCornerPointTestProblem;
50struct TwoPCornerPoint {
using InheritsFrom = std::tuple<CCTpfaModel, TwoP>; };
54template<
class TypeTag>
55struct Grid<TypeTag, TTag::TwoPCornerPoint> {
using type = Dune::CpGrid; };
58template<
class TypeTag>
59struct Problem<TypeTag, TTag::TwoPCornerPoint> {
using type = TwoPCornerPointTestProblem<TypeTag>; };
62template<
class TypeTag>
63struct LocalResidual<TypeTag, TTag::TwoPCornerPoint> {
using type = TwoPIncompressibleLocalResidual<TypeTag>; };
66template<
class TypeTag>
67struct FluidSystem<TypeTag, TTag::TwoPCornerPoint>
69 using Scalar = GetPropType<TypeTag, Properties::Scalar>;
70 using WettingPhase = FluidSystems::OnePLiquid<Scalar, Components::SimpleH2O<Scalar> >;
71 using NonwettingPhase = FluidSystems::OnePLiquid<Scalar, Components::Trichloroethene<Scalar> >;
72 using type = FluidSystems::TwoPImmiscible<Scalar, WettingPhase, NonwettingPhase>;
76template<
class TypeTag>
77struct SpatialParams<TypeTag, TTag::TwoPCornerPoint>
80 using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>;
81 using Scalar = GetPropType<TypeTag, Properties::Scalar>;
83 using type = TwoPCornerPointTestSpatialParams<GridGeometry, Scalar>;
87template<
class TypeTag>
88struct EnableGridVolumeVariablesCache<TypeTag, TTag::TwoPCornerPoint> {
static constexpr bool value =
false; };
89template<
class TypeTag>
90struct EnableGridFluxVariablesCache<TypeTag, TTag::TwoPCornerPoint> {
static constexpr bool value =
false; };
91template<
class TypeTag>
92struct EnableGridGeometryCache<TypeTag, TTag::TwoPCornerPoint> {
static constexpr bool value =
false; };
99template<
class TypeTag>
100class TwoPCornerPointTestProblem :
public PorousMediumFlowProblem<TypeTag>
102 using ParentType = PorousMediumFlowProblem<TypeTag>;
103 using Scalar = GetPropType<TypeTag, Properties::Scalar>;
104 using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>;
105 using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>;
106 using ElementVolumeVariables =
typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView;
107 using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>;
108 using GridView =
typename GridGeometry::GridView;
109 using Element =
typename GridView::template Codim<0>::Entity;
110 using FVElementGeometry =
typename GridGeometry::LocalView;
111 using SubControlVolumeFace =
typename FVElementGeometry::SubControlVolumeFace;
112 using SubControlVolume =
typename FVElementGeometry::SubControlVolume;
113 using GlobalPosition =
typename Element::Geometry::GlobalCoordinate;
114 using BoundaryTypes = GetPropType<TypeTag, Properties::BoundaryTypes>;
115 using NumEqVector = GetPropType<TypeTag, Properties::NumEqVector>;
117 enum { dimWorld = GridView::dimensionworld };
120 TwoPCornerPointTestProblem(std::shared_ptr<const GridGeometry> gridGeometry,
121 std::shared_ptr<typename ParentType::SpatialParams> spatialParams)
122 : ParentType(gridGeometry, spatialParams)
124 gravity_ = {0, 0, 9.81};
125 injectionElement_ = getParam<int>(
"Problem.InjectionElement");
126 injectionRate_ = getParam<Scalar>(
"Problem.InjectionRate");
136 BoundaryTypes boundaryTypes(
const Element &element,
137 const SubControlVolumeFace &scvf)
const
139 BoundaryTypes bcTypes;
143 const auto& normal = scvf.unitOuterNormal();
145 if (abs(normal[dimWorld-1]) > 0.5)
146 bcTypes.setAllNeumann();
148 bcTypes.setAllDirichlet();
160 PrimaryVariables dirichletAtPos(
const GlobalPosition &globalPos)
const
162 return initialAtPos(globalPos);
175 NumEqVector neumannAtPos(
const GlobalPosition &globalPos)
const
177 return NumEqVector(0.0);
181 NumEqVector source(
const Element &element,
182 const FVElementGeometry& fvGeometry,
183 const ElementVolumeVariables& elemVolVars,
184 const SubControlVolume &scv)
const
186 NumEqVector values(0.0);
188 int eIdx = this->gridGeometry().gridView().indexSet().index(element);
189 if (eIdx == injectionElement_)
190 values[FluidSystem::phase1Idx] = injectionRate_/element.geometry().volume();
195 const GlobalPosition& gravity()
const
207 PrimaryVariables initialAtPos(
const GlobalPosition &globalPos)
const
209 PrimaryVariables values;
212 Scalar densityW = 1000;
213 values[Indices::pressureIdx] = 1e5 + densityW*(this->spatialParams().gravity(globalPos)*globalPos);
214 values[Indices::saturationIdx] = 0.0;
236 template<
class VTKWriter>
237 void addFieldsToWriter(VTKWriter& vtk)
239 const auto numElements = this->gridGeometry().gridView().size(0);
241 permX_.resize(numElements);
242 permZ_.resize(numElements);
244 vtk.addField(permX_,
"PERMX [mD]");
245 vtk.addField(permZ_,
"PERMZ [mD]");
247 const auto& gridView = this->gridGeometry().gridView();
248 for (
const auto& element : elements(gridView))
250 const auto eIdx = this->gridGeometry().elementMapper().index(element);
253 permX_[eIdx] = this->spatialParams().permeabilityX(eIdx)/9.86923e-16;
254 permZ_[eIdx] = this->spatialParams().permeabilityZ(eIdx)/9.86923e-16;
259 GlobalPosition gravity_;
260 int injectionElement_;
261 Scalar injectionRate_;
262 std::vector<Scalar> permX_, permZ_;
268#warning "The opm-grid module is needed to use this class!"
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 simple implementation of Trichloroethene (TCE), a DNAPL.
A liquid phase consisting of a single component.
A fluid system for two-phase models assuming immiscibility and thermodynamic equilibrium.
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
Property tag Indices
Definition: porousmediumflow/sequential/properties.hh:59
std::string temperature() noexcept
I/O name of temperature for equilibrium models.
Definition: name.hh:51
UndefinedProperty type
Definition: common/properties.hh:57
UndefinedProperty type
Definition: common/properties.hh:69
UndefinedProperty type
Definition: common/properties.hh:91
UndefinedProperty type
Definition: common/properties.hh:221
UndefinedProperty type
Definition: common/properties.hh:223
Adaption of the fully implicit scheme to the two-phase flow model.
Base class for all porous media problems.
Element-wise calculation of the residual and its derivatives for a two-phase, incompressible test pro...