Commit cbc39ecb authored by Katharina Heck's avatar Katharina Heck
Browse files

Merge branch 'fix/remove-phaseIdx' into 'master'

[1pncmin] fix phaseIdx

See merge request !1119
parents b4506d6d 0778c59d
......@@ -123,7 +123,7 @@ SET_PROP(OnePNCMin, ModelTraits)
private:
using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem);
using SolidSystem = typename GET_PROP_TYPE(TypeTag, SolidSystem);
using NonMinTraits = OnePNCModelTraits<FluidSystem::numComponents, GET_PROP_VALUE(TypeTag, PhaseIdx), GET_PROP_VALUE(TypeTag, UseMoles), GET_PROP_VALUE(TypeTag, ReplaceCompEqIdx)>;
using NonMinTraits = OnePNCModelTraits<FluidSystem::numComponents, GET_PROP_VALUE(TypeTag, UseMoles), GET_PROP_VALUE(TypeTag, ReplaceCompEqIdx)>;
public:
using type = MineralizationModelTraits<NonMinTraits, SolidSystem::numComponents, SolidSystem::numInertComponents>;
};
......@@ -155,7 +155,7 @@ SET_PROP(OnePNCMinNI, ModelTraits)
private:
using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem);
using SolidSystem = typename GET_PROP_TYPE(TypeTag, SolidSystem);
using OnePNCTraits = OnePNCModelTraits<FluidSystem::numComponents, GET_PROP_VALUE(TypeTag, PhaseIdx), GET_PROP_VALUE(TypeTag, UseMoles), GET_PROP_VALUE(TypeTag, ReplaceCompEqIdx)>;
using OnePNCTraits = OnePNCModelTraits<FluidSystem::numComponents, GET_PROP_VALUE(TypeTag, UseMoles), GET_PROP_VALUE(TypeTag, ReplaceCompEqIdx)>;
using IsothermalTraits = MineralizationModelTraits<OnePNCTraits, SolidSystem::numComponents, SolidSystem::numInertComponents>;
public:
using type = PorousMediumFlowNIModelTraits<IsothermalTraits>;
......
......@@ -136,7 +136,7 @@ int main(int argc, char** argv) try
auto maxDt = getParam<Scalar>("TimeLoop.MaxTimeStepSize");
// intialize the vtk output module
VtkOutputModule<TypeTag, GET_PROP_VALUE(TypeTag, PhaseIdx)> vtkWriter(*problem, *fvGridGeometry, *gridVariables, x, problem->name());
VtkOutputModule<TypeTag> vtkWriter(*problem, *fvGridGeometry, *gridVariables, x, problem->name());
using VtkOutputFields = typename GET_PROP_TYPE(TypeTag, VtkOutputFields);
VtkOutputFields::init(vtkWriter);
......
......@@ -32,6 +32,7 @@
#include <dumux/discretization/cellcentered/tpfa/properties.hh>
#include <dumux/discretization/cellcentered/mpfa/properties.hh>
#include <dumux/porousmediumflow/problem.hh>
#include <dumux/material/fluidsystems/1padapter.hh>
#include <dumux/material/fluidsystems/h2on2.hh>
#include <dumux/material/fluidmatrixinteractions/1p/thermalconductivityaverage.hh>
#include <dumux/material/components/cao2h2.hh>
......@@ -41,7 +42,6 @@
#include "thermochemreaction.hh"
#include "modifiedcao.hh"
namespace Dumux {
template <class TypeTag>
......@@ -55,17 +55,16 @@ NEW_TYPE_TAG(ThermoChemBoxTypeTag, INHERITS_FROM(BoxModel, ThermoChemTypeTag));
SET_TYPE_PROP(ThermoChemTypeTag, Grid, Dune::YaspGrid<2>);
// Set the problem property
SET_TYPE_PROP(ThermoChemTypeTag, Problem, ThermoChemProblem<TypeTag>);
// Set fluid configuration
// The fluid system
SET_PROP(ThermoChemTypeTag, FluidSystem)
{ /*private:*/
{
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
using type = FluidSystems::H2ON2<Scalar>;
using H2ON2 = FluidSystems::H2ON2<Scalar>;
static constexpr auto phaseIdx = H2ON2::gasPhaseIdx; // simulate the air phase
using type = FluidSystems::OnePAdapter<H2ON2, phaseIdx>;
};
// set phase index (gas)
SET_INT_PROP(ThermoChemTypeTag, PhaseIdx, GET_PROP_TYPE(TypeTag, FluidSystem)::gasPhaseIdx);
SET_PROP(ThermoChemTypeTag, SolidSystem)
{
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
......@@ -125,7 +124,7 @@ class ThermoChemProblem : public PorousMediumFlowProblem<TypeTag>
{
// Indices of the primary variables
pressureIdx = Indices::pressureIdx, //gas-phase pressure
H2OIdx = FluidSystem::H2OIdx, // mole fraction water
H2OIdx = FluidSystem::compIdx(FluidSystem::MultiPhaseFluidSystem::H2OIdx), // mole fraction water
CaOIdx = FluidSystem::numComponents,
CaO2H2Idx = FluidSystem::numComponents+1,
......
......@@ -34,8 +34,8 @@ namespace Dumux {
*
* It contains simple and advanced reaction kinetics according to Nagel et al. (2014).
*/
class ThermoChemReaction
{
class ThermoChemReaction {
public:
/*!
* \brief evaluates the reaction kinetics (see Nagel et al. 2014)
......@@ -47,6 +47,7 @@ public:
using FluidSystem = typename VolumeVariables::FluidSystem;
using SolidSystem = typename VolumeVariables::SolidSystem;
static constexpr auto H2OIdx = FluidSystem::compIdx(FluidSystem::MultiPhaseFluidSystem::H2OIdx);
static constexpr int cPhaseIdx = SolidSystem::comp0Idx;
static constexpr int hPhaseIdx = SolidSystem::comp1Idx;
......@@ -58,12 +59,12 @@ public:
Scalar moleFractionVapor = 1e-3;
if(volVars.moleFraction(FluidSystem::gasPhaseIdx, FluidSystem::H2OIdx) > 1e-3)
moleFractionVapor = volVars.moleFraction(FluidSystem::gasPhaseIdx, FluidSystem::H2OIdx);
if(volVars.moleFraction(0, H2OIdx) > 1e-3)
moleFractionVapor = volVars.moleFraction(0, H2OIdx);
if(volVars.moleFraction(FluidSystem::gasPhaseIdx, FluidSystem::H2OIdx) >= 1.0) moleFractionVapor = 1;
if(volVars.moleFraction(0, H2OIdx) >= 1.0) moleFractionVapor = 1;
Scalar pV = volVars.pressure(FluidSystem::gasPhaseIdx) *moleFractionVapor;
Scalar pV = volVars.pressure(0) *moleFractionVapor;
Scalar vaporPressure = pV*1.0e-5;
Scalar pFactor = log(vaporPressure);
......@@ -166,6 +167,7 @@ public:
using FluidSystem = typename VolumeVariables::FluidSystem;
using SolidSystem = typename VolumeVariables::SolidSystem;
static constexpr auto H2OIdx = FluidSystem::compIdx(FluidSystem::MultiPhaseFluidSystem::H2OIdx);
static constexpr int cPhaseIdx = SolidSystem::comp0Idx;
static constexpr int hPhaseIdx = SolidSystem::comp1Idx;
......@@ -177,12 +179,12 @@ public:
Scalar moleFractionVapor = 1e-3;
if(volVars.moleFraction(FluidSystem::gasPhaseIdx, FluidSystem::H2OIdx) > 1e-3)
moleFractionVapor = volVars.moleFraction(FluidSystem::gasPhaseIdx, FluidSystem::H2OIdx);
if(volVars.moleFraction(0, H2OIdx) > 1e-3)
moleFractionVapor = volVars.moleFraction(0, H2OIdx);
if(volVars.moleFraction(FluidSystem::gasPhaseIdx, FluidSystem::H2OIdx) >= 1.0) moleFractionVapor = 1;
if(volVars.moleFraction(0, H2OIdx) >= 1.0) moleFractionVapor = 1;
Scalar pV = volVars.pressure(FluidSystem::gasPhaseIdx) *moleFractionVapor;
Scalar pV = volVars.pressure(0) *moleFractionVapor;
Scalar vaporPressure = pV*1.0e-5;
Scalar pFactor = log(vaporPressure);
......@@ -209,7 +211,7 @@ public:
//discharge or hydration
if (T < Teq){
Scalar massFracH2O_fPhase = volVars.massFraction(FluidSystem::gasPhaseIdx, FluidSystem::H2OIdx);
Scalar massFracH2O_fPhase = volVars.massFraction(0, H2OIdx);
Scalar krh = 0.2;
Scalar rHydration = - massFracH2O_fPhase* (volVars.solidComponentDensity(hPhaseIdx)- realSolidDensityAverage)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment