24#ifndef DUMUX_DISSOLUTION_PROBLEM_HH
25#define DUMUX_DISSOLUTION_PROBLEM_HH
27#include <dune/grid/yaspgrid.hh>
48template <
class TypeTag>
49class DissolutionProblem;
60template<
class TypeTag>
61struct Grid<TypeTag, TTag::Dissolution> {
using type = Dune::YaspGrid<2>; };
64template<
class TypeTag>
68template<
class TypeTag>
75template<
class TypeTag>
81 static constexpr int numInertComponents = 1;
86template<
class TypeTag>
95template<
class TypeTag>
96struct ReplaceCompEqIdx<TypeTag, TTag::Dissolution> {
static constexpr int value = 1; };
97template<
class TypeTag>
129template <
class TypeTag>
143 pressureIdx = Indices::pressureIdx,
144 switchIdx = Indices::switchIdx,
149 xwNaClIdx = FluidSystem::NaClIdx,
150 precipNaClIdx = FluidSystem::numComponents,
153 H2OIdx = FluidSystem::H2OIdx,
154 NaClIdx = FluidSystem::NaClIdx,
157 liquidPhaseIdx = FluidSystem::liquidPhaseIdx,
158 gasPhaseIdx = FluidSystem::gasPhaseIdx,
161 sPhaseIdx = SolidSystem::comp0Idx,
165 conti0EqIdx = Indices::conti0EqIdx,
166 precipNaClEqIdx = Indices::conti0EqIdx + FluidSystem::numComponents,
169 bothPhases = Indices::bothPhases,
172 dim = GridView::dimension,
173 dimWorld = GridView::dimensionworld,
180 using Element =
typename GridView::template Codim<0>::Entity;
184 using SubControlVolume =
typename FVElementGeometry::SubControlVolume;
185 using GlobalPosition =
typename SubControlVolume::GlobalPosition;
191 outerSalinity_ = getParam<Scalar>(
"Problem.OuterSalinity");
192 temperature_ = getParam<Scalar>(
"Problem.Temperature");
193 reservoirPressure_ = getParam<Scalar>(
"Problem.ReservoirPressure");
194 initLiqSaturation_ = getParam<Scalar>(
"Problem.LiquidSaturation");
195 initPrecipitatedSaltBlock_ = getParam<Scalar>(
"Problem.InitPrecipitatedSaltBlock");
197 outerLiqSaturation_ = getParam<Scalar>(
"Problem.OuterLiqSaturation");
198 innerLiqSaturation_ = getParam<Scalar>(
"Problem.InnerLiqSaturation");
199 innerSalinity_ = getParam<Scalar>(
"Problem.InnerSalinity");
200 innerPressure_ = getParam<Scalar>(
"Problem.InnerPressure");
201 outerPressure_ = getParam<Scalar>(
"Problem.OuterPressure");
202 reservoirSaturation_ = getParam<Scalar>(
"Problem.reservoirSaturation");
204 nTemperature_ = getParam<int>(
"FluidSystem.NTemperature");
205 nPressure_ = getParam<int>(
"FluidSystem.NPressure");
206 pressureLow_ = getParam<Scalar>(
"FluidSystem.PressureLow");
207 pressureHigh_ = getParam<Scalar>(
"FluidSystem.PressureHigh");
208 temperatureLow_ = getParam<Scalar>(
"FluidSystem.TemperatureLow");
209 temperatureHigh_ = getParam<Scalar>(
"FluidSystem.TemperatureHigh");
210 name_ = getParam<std::string>(
"Problem.Name");
213 permeability_.resize(
gridGeometry->gridView().size(codim));
215 FluidSystem::init(temperatureLow_,
230 timeStepSize_ = timeStepSize;
243 const std::string&
name()
const
252 {
return temperature_; }
265 BoundaryTypes bcTypes;
271 bcTypes.setAllNeumann();
274 if(globalPos[0] > rmax - eps_)
275 bcTypes.setAllDirichlet();
278 if(globalPos[0] < rmin + eps_)
279 bcTypes.setAllDirichlet();
289 PrimaryVariables priVars(0.0);
290 priVars.setState(bothPhases);
295 if(globalPos[0] > rmax - eps_)
297 priVars[pressureIdx] = outerPressure_ ;
298 priVars[switchIdx] = outerLiqSaturation_;
299 priVars[xwNaClIdx] = massToMoleFrac_(outerSalinity_);
300 priVars[precipNaClIdx] = 0.0;
303 if(globalPos[0] < rmin + eps_)
305 priVars[pressureIdx] = innerPressure_ ;
306 priVars[switchIdx] = innerLiqSaturation_;
307 priVars[xwNaClIdx] = massToMoleFrac_(innerSalinity_);
308 priVars[precipNaClIdx] = 0.0;
324 PrimaryVariables priVars(0.0);
325 priVars.setState(bothPhases);
327 priVars[pressureIdx] = reservoirPressure_;
328 priVars[switchIdx] = initLiqSaturation_;
329 priVars[xwNaClIdx] = massToMoleFrac_(outerSalinity_);
330 if(globalPos[0] > 5.0 - eps_ && globalPos[0] < 19.0 + eps_)
331 priVars[precipNaClIdx] = initPrecipitatedSaltBlock_;
333 priVars[precipNaClIdx] = 0.0;
361 NumEqVector
source(
const Element &element,
362 const FVElementGeometry& fvGeometry,
363 const ElementVolumeVariables& elemVolVars,
364 const SubControlVolume &scv)
const
368 const auto& volVars = elemVolVars[scv];
370 Scalar moleFracNaCl_wPhase = volVars.moleFraction(liquidPhaseIdx, NaClIdx);
371 Scalar massFracNaCl_Max_wPhase = this->
spatialParams().solubilityLimit();
372 Scalar moleFracNaCl_Max_wPhase = massToMoleFrac_(massFracNaCl_Max_wPhase);
373 Scalar saltPorosity = this->
spatialParams().minimalPorosity(element, scv);
377 Scalar precipSalt = volVars.porosity() * volVars.molarDensity(liquidPhaseIdx)
378 * volVars.saturation(liquidPhaseIdx)
379 * abs(moleFracNaCl_wPhase - moleFracNaCl_Max_wPhase);
380 if (moleFracNaCl_wPhase < moleFracNaCl_Max_wPhase)
384 if (precipSalt*timeStepSize_ + volVars.solidVolumeFraction(sPhaseIdx)* volVars.solidComponentMolarDensity(sPhaseIdx)< 0)
385 precipSalt = -volVars.solidVolumeFraction(sPhaseIdx)* volVars.solidComponentMolarDensity(sPhaseIdx)/timeStepSize_;
387 if (volVars.solidVolumeFraction(sPhaseIdx) >= this->spatialParams().referencePorosity(element, scv) - saltPorosity && precipSalt > 0)
390 source[conti0EqIdx + NaClIdx] += -precipSalt;
391 source[precipNaClEqIdx] += precipSalt;
404 return permeability_;
409 for (
const auto& element : elements(this->
gridGeometry().gridView()))
414 fvGeometry.bindElement(element);
416 for (
auto&& scv : scvs(fvGeometry))
418 VolumeVariables volVars;
419 volVars.update(elemSol, *
this, element, scv);
420 const auto dofIdxGlobal = scv.dofIndex();
421 permeability_[dofIdxGlobal] = volVars.permeability();
433 static Scalar massToMoleFrac_(Scalar XwNaCl)
435 const Scalar Mw = 18.015e-3;
436 const Scalar Ms = 58.44e-3;
438 const Scalar X_NaCl = XwNaCl;
440 auto xwNaCl = -Mw * X_NaCl / ((Ms - Mw) * X_NaCl - Ms);
448 Scalar pressureLow_, pressureHigh_;
449 Scalar temperatureLow_, temperatureHigh_;
450 Scalar outerSalinity_;
451 Scalar reservoirPressure_;
452 Scalar innerPressure_;
453 Scalar outerPressure_;
455 Scalar initLiqSaturation_;
456 Scalar outerLiqSaturation_;
457 Scalar innerLiqSaturation_;
458 Scalar initPrecipitatedSaltBlock_;
459 Scalar innerSalinity_;
461 Scalar timeStepSize_ = 0.0;
462 static constexpr Scalar eps_ = 1e-6;
463 Scalar reservoirSaturation_;
464 std::vector<double> permeability_;
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.
The available discretization methods in Dumux.
Properties of pure molecular oxygen .
Material properties of pure salt .
A compositional two-phase fluid system with a liquid and a gaseous phase and , and (dissolved miner...
A solid phase consisting of multiple inert solid components.
@ p1s0
first phase saturation and second phase pressure as primary variables
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
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
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 component balance index that should be replaced by the total mass/mole balance.
Definition: common/properties.hh:104
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
The type of the solid system to use.
Definition: common/properties.hh:227
The formulation of the model.
Definition: common/properties.hh:237
Properties of granite.
Definition: granite.hh:45
A class for the NaCl properties.
Definition: nacl.hh:47
A compositional two-phase fluid system with a liquid and a gaseous phase and , and (dissolved miner...
Definition: brineair.hh:75
A solid phase consisting of multiple inert solid components.
Definition: compositionalsolidphase.hh:42
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
Problem where water is injected in a for flushing precipitated salt clogging a gas reservoir.
Definition: test/porousmediumflow/2pncmin/implicit/isothermal/problem.hh:131
void updateVtkOutput(const SolutionVector &curSol)
Definition: test/porousmediumflow/2pncmin/implicit/isothermal/problem.hh:407
DissolutionProblem(std::shared_ptr< const GridGeometry > gridGeometry)
Definition: test/porousmediumflow/2pncmin/implicit/isothermal/problem.hh:188
PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
Evaluates the boundary conditions for a Dirichlet boundary segment.
Definition: test/porousmediumflow/2pncmin/implicit/isothermal/problem.hh:287
NumEqVector source(const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const SubControlVolume &scv) const
Evaluates the source term for all phases within a given sub-controlvolume.
Definition: test/porousmediumflow/2pncmin/implicit/isothermal/problem.hh:361
const std::vector< Scalar > & getPermeability()
Adds additional VTK output data to the VTKWriter.
Definition: test/porousmediumflow/2pncmin/implicit/isothermal/problem.hh:402
PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
Evaluates the initial value for a control volume.
Definition: test/porousmediumflow/2pncmin/implicit/isothermal/problem.hh:322
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/2pncmin/implicit/isothermal/problem.hh:263
void setTimeStepSize(Scalar timeStepSize)
Definition: test/porousmediumflow/2pncmin/implicit/isothermal/problem.hh:228
void setTime(Scalar time)
Definition: test/porousmediumflow/2pncmin/implicit/isothermal/problem.hh:223
Scalar temperature() const
Returns the temperature within the domain.
Definition: test/porousmediumflow/2pncmin/implicit/isothermal/problem.hh:251
const std::string & name() const
The problem name.
Definition: test/porousmediumflow/2pncmin/implicit/isothermal/problem.hh:243
Definition: test/porousmediumflow/2pncmin/implicit/isothermal/problem.hh:54
std::tuple< TwoPNCMin > InheritsFrom
Definition: test/porousmediumflow/2pncmin/implicit/isothermal/problem.hh:54
Definition: test/porousmediumflow/2pncmin/implicit/isothermal/problem.hh:55
std::tuple< Dissolution, BoxModel > InheritsFrom
Definition: test/porousmediumflow/2pncmin/implicit/isothermal/problem.hh:55
Definition: test/porousmediumflow/2pncmin/implicit/isothermal/problem.hh:56
std::tuple< Dissolution, CCTpfaModel > InheritsFrom
Definition: test/porousmediumflow/2pncmin/implicit/isothermal/problem.hh:56
Dune::YaspGrid< 2 > type
Definition: test/porousmediumflow/2pncmin/implicit/isothermal/problem.hh:61
GetPropType< TypeTag, Properties::Scalar > Scalar
Definition: test/porousmediumflow/2pncmin/implicit/isothermal/problem.hh:71
GetPropType< TypeTag, Properties::Scalar > Scalar
Definition: test/porousmediumflow/2pncmin/implicit/isothermal/problem.hh:78
GetPropType< TypeTag, Properties::Scalar > Scalar
Definition: test/porousmediumflow/2pncmin/implicit/isothermal/problem.hh:90
GetPropType< TypeTag, Properties::GridGeometry > GridGeometry
Definition: test/porousmediumflow/2pncmin/implicit/isothermal/problem.hh:89
Spatial parameters for the dissolution problem where water is injected in a for flushing precipitated...
Definition: porousmediumflow/2pncmin/implicit/isothermal/spatialparams.hh:47
Adaption of the fully implicit scheme to the two-phase n-component fully implicit model with addition...
Base class for all porous media problems.
Definition of the spatial parameters for the MaxwellStefan problem.