Commit 0887632a authored by Katharina Heck's avatar Katharina Heck
Browse files

[cleanup][convectivemixing] propertymacros, warnings, use Brine.Salinity to...

[cleanup][convectivemixing] propertymacros, warnings, use Brine.Salinity to adapt to changes in master
parent abcae18a
......@@ -54,7 +54,7 @@ int main(int argc, char** argv) try
using namespace Dumux;
// define the type tag for this problem
using TypeTag = TTAG(ConvmixBoxTypeTag);
using TypeTag = Properties::TTag::ConvmixBoxTypeTag;
////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
......@@ -73,7 +73,7 @@ int main(int argc, char** argv) try
// try to create a grid (from the given grid file or the input file)
/////////////////////////////////////////////////////////////////////
GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager;
GridManager<GetPropType<TypeTag, Properties::Grid>> gridManager;
gridManager.init();
////////////////////////////////////////////////////////////
......@@ -84,27 +84,27 @@ int main(int argc, char** argv) try
const auto& leafGridView = gridManager.grid().leafGridView();
// create the finite volume grid geometry
using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
using FVGridGeometry = GetPropType<TypeTag, Properties::FVGridGeometry>;
auto fvGridGeometry = std::make_shared<FVGridGeometry>(leafGridView);
fvGridGeometry->update();
// the problem (initial and boundary conditions)
using Problem = typename GET_PROP_TYPE(TypeTag, Problem);
using Problem = GetPropType<TypeTag, Properties::Problem>;
auto problem = std::make_shared<Problem>(fvGridGeometry);
// the solution vector
using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector);
using SolutionVector = GetPropType<TypeTag, Properties::SolutionVector>;
SolutionVector x(fvGridGeometry->numDofs());
problem->applyInitialSolution(x);
auto xOld = x;
// the grid variables
using GridVariables = typename GET_PROP_TYPE(TypeTag, GridVariables);
using GridVariables = GetPropType<TypeTag, Properties::GridVariables>;
auto gridVariables = std::make_shared<GridVariables>(problem, fvGridGeometry);
gridVariables->init(x, xOld);
gridVariables->init(x);
// get some time loop parameters
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
auto tEnd = getParam<Scalar>("TimeLoop.TEnd");
auto dt = getParam<Scalar>("TimeLoop.DtInitial");
auto maxDt = getParam<Scalar>("TimeLoop.MaxTimeStepSize");
......@@ -115,11 +115,11 @@ int main(int argc, char** argv) try
restartTime = getParam<Scalar>("TimeLoop.Restart");
// intialize the vtk output module
using IOFields = GetPropType<TypeTag, Properties::IOFields>;
VtkOutputModule<GridVariables, SolutionVector> vtkWriter(*gridVariables, x, problem->name());
using VelocityOutput = typename GET_PROP_TYPE(TypeTag, VelocityOutput);
using VelocityOutput = GetPropType<TypeTag, Properties::VelocityOutput>;
vtkWriter.addVelocityOutput(std::make_shared<VelocityOutput>(*gridVariables));
using VtkOutputFields = typename GET_PROP_TYPE(TypeTag, VtkOutputFields);
VtkOutputFields::init(vtkWriter); //!< Add model specific output fields
IOFields::initOutputModule(vtkWriter); //!< Add model specific output fields
vtkWriter.write(0.0);
// instantiate time loop
......
......@@ -17,8 +17,8 @@ Name = convmix # name passed to the output routines
EnableGravity = 1 # enable gravity
DepthBOR = 1400 # [m] depth below ground surface
[FluidSystem]
Salinity = 0.05
[Brine]
Salinity = 0.05 # brine salinity
[Vtk]
AddVelocity = 1 # enable velocity output
......
......@@ -55,39 +55,48 @@ class ConvmixProblem;
namespace Properties {
NEW_TYPE_TAG(ConvmixTypeTag, INHERITS_FROM(OnePNC));
NEW_TYPE_TAG(ConvmixBoxTypeTag, INHERITS_FROM(BoxModel, ConvmixTypeTag));
// Create new type tags
namespace TTag {
struct ConvmixTypeTag { using InheritsFrom = std::tuple<OnePNC>; };
struct ConvmixBoxTypeTag { using InheritsFrom = std::tuple<ConvmixTypeTag, BoxModel>; };
} // end namespace TTag
SET_TYPE_PROP(ConvmixTypeTag, Grid, Dune::YaspGrid<2>);
template<class TypeTag>
struct Grid<TypeTag, TTag::ConvmixTypeTag> { using type = Dune::YaspGrid<2>; };
// Set the problem property
SET_TYPE_PROP(ConvmixTypeTag, Problem, ConvmixProblem<TypeTag>);
template<class TypeTag>
struct Problem<TypeTag, TTag::ConvmixTypeTag> { using type = ConvmixProblem<TypeTag>; };
SET_PROP(ConvmixTypeTag, FluidSystem)
template<class TypeTag>
struct FluidSystem<TypeTag, TTag::ConvmixTypeTag>
{
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
using BrineCO2 = FluidSystems::BrineCO2<Scalar, CO2TablesBenchmarkThree::CO2Tables,
Components::TabulatedComponent<Components::H2O<typename GET_PROP_TYPE(TypeTag, Scalar)>>,
Components::TabulatedComponent<Components::H2O<GetPropType<TypeTag, Properties::Scalar>>>,
FluidSystems::BrineCO2DefaultPolicy</*constantSalinity=*/true, /*simplified=*/true>>;
using type = FluidSystems::OnePAdapter<BrineCO2, BrineCO2::liquidPhaseIdx>;
};
// Set the spatial parameters
SET_PROP(ConvmixTypeTag, SpatialParams)
template<class TypeTag>
struct SpatialParams<TypeTag, TTag::ConvmixTypeTag>
{
using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
using FVGridGeometry = GetPropType<TypeTag, Properties::FVGridGeometry>;
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
using type = ConvmixSpatialParams<FVGridGeometry, Scalar>;
};
SET_PROP(ConvmixTypeTag, EffectiveDiffusivityModel)
template<class TypeTag>
struct EffectiveDiffusivityModel<TypeTag, TTag::ConvmixTypeTag>
{
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
using type = DiffusivityConstantTortuosity<Scalar>;
};
// Define whether mole(true) or mass (false) fractions are used
SET_BOOL_PROP(ConvmixTypeTag, UseMoles, true);
template<class TypeTag>
struct UseMoles<TypeTag, TTag::ConvmixTypeTag> { static constexpr bool value = true; };
}
......@@ -103,16 +112,16 @@ class ConvmixProblem : public PorousMediumFlowProblem<TypeTag>
{
using ParentType = PorousMediumFlowProblem<TypeTag>;
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
using Indices = typename GET_PROP_TYPE(TypeTag, ModelTraits)::Indices;
using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem);
using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes);
using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables);
using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView;
using NumEqVector = typename GET_PROP_TYPE(TypeTag, NumEqVector);
using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, GridVolumeVariables)::LocalView;
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices;
using GridView = GetPropType<TypeTag, Properties::GridView>;
using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>;
using BoundaryTypes = GetPropType<TypeTag, Properties::BoundaryTypes>;
using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>;
using FVGridGeometry = GetPropType<TypeTag, Properties::FVGridGeometry>;
using FVElementGeometry = typename GetPropType<TypeTag, Properties::FVGridGeometry>::LocalView;
using NumEqVector = GetPropType<TypeTag, Properties::NumEqVector>;
using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView;
using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace;
using Element = typename GridView::template Codim<0>::Entity;
......@@ -135,8 +144,8 @@ class ConvmixProblem : public PorousMediumFlowProblem<TypeTag>
};
//! property that defines whether mole or mass fractions are used
static constexpr bool useMoles = GET_PROP_VALUE(TypeTag, UseMoles);
static const bool isBox = GET_PROP_TYPE(TypeTag, FVGridGeometry)::discMethod == DiscretizationMethod::box;
static constexpr bool useMoles = getPropValue<TypeTag, Properties::UseMoles>();
static const bool isBox = GetPropType<TypeTag, Properties::FVGridGeometry>::discMethod == DiscretizationMethod::box;
static const int dimWorld = GridView::dimensionworld;
using GlobalPosition = typename SubControlVolumeFace::GlobalPosition;
......@@ -286,7 +295,7 @@ private:
PrimaryVariables priVars;
const Scalar temp = temperatureAtPos(globalPos);
const Scalar salinity = getParam<Scalar>("FluidSystem.Salinity");
const Scalar salinity = getParam<Scalar>("Brine.Salinity");
priVars[pressureIdx] = 1.013e5 + (depthBOR_ - globalPos[1]) * 1100 * 9.81; // hydrostatic pressure distribution
priVars[CO2Idx] = 0.; // initial condition for the CO2 massfraction
......@@ -299,11 +308,6 @@ private:
moleFracCO2,
xgH2O);
const Scalar M1 = FluidSystem::molarMass(0);
const Scalar M2 = FluidSystem::molarMass(1);
const Scalar avgMolarMass = moleFracCO2 * M2 + (1-moleFracCO2) * M1;
const Scalar massFracCO2 = moleFracCO2 * FluidSystem::molarMass(1)/avgMolarMass;
if(globalPos[1] > this->fvGridGeometry().bBoxMax()[1] - eps_)
{
priVars[CO2Idx] = moleFracCO2; // massfraction at top boundary [-]
......
Supports Markdown
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