Commit 1179001a authored by Mathis Kelm's avatar Mathis Kelm Committed by Timo Koch
Browse files

[test][2pnc] Separate properties into their own header

parent 39a888d9
......@@ -23,13 +23,10 @@
*/
#include <config.h>
#include <ctime>
#include <iostream>
#include <dune/common/parallel/mpihelper.hh>
#include <dune/common/timer.hh>
#include <dune/grid/io/file/vtk/vtksequencewriter.hh>
#include <dune/istl/io.hh>
#include <dumux/common/properties.hh>
#include <dumux/common/parameters.hh>
......@@ -40,38 +37,11 @@
#include <dumux/porousmediumflow/nonequilibrium/newtonsolver.hh>
#include <dumux/assembly/fvassembler.hh>
#include <dumux/assembly/diffmethod.hh>
#include <dumux/io/vtkoutputmodule.hh>
#include <dumux/io/grid/gridmanager.hh>
#include <dumux/io/grid/gridmanager_yasp.hh>
#include "problem.hh"
/*!
* \brief Provides an interface for customizing error messages associated with
* reading in parameters.
*
* \param progName The name of the program, that was tried to be started.
* \param errorMsg The error message that was issued by the start function.
* Comprises the thing that went wrong and a general help message.
*/
void usage(const char *progName, const std::string &errorMsg)
{
if (errorMsg.size() > 0) {
std::string errorMessageOut = "\nUsage: ";
errorMessageOut += progName;
errorMessageOut += " [options]\n";
errorMessageOut += errorMsg;
errorMessageOut += "\n\nThe list of mandatory options for this program is:\n"
"\t-TimeManager.TEnd End of the simulation [s] \n"
"\t-TimeManager.DtInitial Initial timestep size [s] \n"
"\t-Grid.Cells Number of cells in respective coordinate directions\n"
"\t-Grid.UpperRight Upper right corner coordinates\n";
std::cout << errorMessageOut
<< "\n";
}
}
#include "properties.hh"
////////////////////////
// the main function
......@@ -91,7 +61,7 @@ int main(int argc, char** argv)
DumuxMessage::print(/*firstCall=*/true);
// parse command line arguments and input file
Parameters::init(argc, argv, usage);
Parameters::init(argc, argv);
// try to create a grid (from the given grid file or the input file)
GridManager<GetPropType<TypeTag, Properties::Grid>> gridManager;
......
......@@ -27,96 +27,14 @@
#ifndef DUMUX_TWOPTWOC_NONEQUILIBRIUM_PROBLEM_HH
#define DUMUX_TWOPTWOC_NONEQUILIBRIUM_PROBLEM_HH
#include <dune/grid/yaspgrid.hh>
#include <dune/common/parametertreeparser.hh>
#include <dumux/common/properties.hh>
#include <dumux/common/parameters.hh>
#include <dumux/common/boundarytypes.hh>
#include <dumux/discretization/box.hh>
#include <dumux/discretization/cctpfa.hh>
#include <dumux/porousmediumflow/2p2c/model.hh>
#include <dumux/porousmediumflow/problem.hh>
#include <dumux/material/fluidsystems/h2oair.hh>
#include <dumux/material/fluidstates/compositional.hh>
#include "spatialparams.hh"
namespace Dumux {
template <class TypeTag>
class TwoPTwoCChemicalNonequilibriumProblem;
namespace Properties {
// Create new type tags
namespace TTag {
struct TwoPTwoCChemicalNonequilibrium { using InheritsFrom = std::tuple<TwoPTwoCNINonEquil>; };
struct TwoPTwoCChemicalNonequilibriumBox { using InheritsFrom = std::tuple<TwoPTwoCChemicalNonequilibrium, BoxModel>; };
struct TwoPTwoCChemicalNonequilibriumCC { using InheritsFrom = std::tuple<TwoPTwoCChemicalNonequilibrium, CCTpfaModel>; };
} // end namespace TTag
// Set the grid type
template<class TypeTag>
struct Grid<TypeTag, TTag::TwoPTwoCChemicalNonequilibrium> { using type = Dune::YaspGrid<2>; };
// Set the problem property
template<class TypeTag>
struct Problem<TypeTag, TTag::TwoPTwoCChemicalNonequilibrium>
{ using type = TwoPTwoCChemicalNonequilibriumProblem<TypeTag>; };
// Set fluid configuration
template<class TypeTag>
struct FluidSystem<TypeTag, TTag::TwoPTwoCChemicalNonequilibrium>
{
private:
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
public:
using type = FluidSystems::H2OAir<Scalar,
Components::TabulatedComponent<Components::H2O<Scalar>>,
FluidSystems::H2OAirDefaultPolicy</*fastButSimplifiedRelations=*/true>,
true /*useKelvinEquation*/>;
};
// Set the spatial parameters
template<class TypeTag>
struct SpatialParams<TypeTag, TTag::TwoPTwoCChemicalNonequilibrium>
{
using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>;
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
using type = TwoPTwoCChemicalNonequilibriumSpatialParams<GridGeometry, Scalar>;
};
// decide which type to use for floating values (double / quad)
template<class TypeTag>
struct Scalar<TypeTag, TTag::TwoPTwoCChemicalNonequilibrium> { using type = double; };
template<class TypeTag>
struct Formulation<TypeTag, TTag::TwoPTwoCChemicalNonequilibrium>
{
public:
static const TwoPFormulation value = TwoPFormulation::p0s1;
};
template<class TypeTag>
struct UseMoles<TypeTag, TTag::TwoPTwoCChemicalNonequilibrium>
{ static constexpr bool value = true; };
template<class TypeTag>
struct EnableThermalNonEquilibrium<TypeTag, TTag::TwoPTwoCChemicalNonequilibrium>
{ static constexpr bool value = false; };
template<class TypeTag>
struct HeatConductionType<TypeTag, TTag::TwoPTwoCChemicalNonequilibrium>
{ using type = FouriersLaw<TypeTag>; };
template<class TypeTag>
struct EnergyLocalResidual<TypeTag, TTag::TwoPTwoCChemicalNonequilibrium>
{ using type = Dumux::EnergyLocalResidual<TypeTag>; };
} // end namespace Properties
/*!
* \ingroup TwoPTwoCTests
* \brief Problem where air is injected in a unsaturated porous medium.
......
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*****************************************************************************
* See the file COPYING for full copying permissions. *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*****************************************************************************/
/*!
* \file
* \ingroup TwoPTwoCTests
* \brief The properties of the problem where air is injected in a unsaturated porous medium.
*/
#ifndef DUMUX_TWOPTWOC_NONEQUILIBRIUM_PROPERTIES_HH
#define DUMUX_TWOPTWOC_NONEQUILIBRIUM_PROPERTIES_HH
#include <dune/grid/yaspgrid.hh>
#include <dumux/discretization/box.hh>
#include <dumux/discretization/cctpfa.hh>
#include <dumux/porousmediumflow/2p2c/model.hh>
#include <dumux/material/fluidsystems/h2oair.hh>
#include <dumux/material/fluidstates/compositional.hh>
#include "spatialparams.hh"
#include "problem.hh"
namespace Dumux::Properties {
// Create new type tags
namespace TTag {
struct TwoPTwoCChemicalNonequilibrium { using InheritsFrom = std::tuple<TwoPTwoCNINonEquil>; };
struct TwoPTwoCChemicalNonequilibriumBox { using InheritsFrom = std::tuple<TwoPTwoCChemicalNonequilibrium, BoxModel>; };
struct TwoPTwoCChemicalNonequilibriumCC { using InheritsFrom = std::tuple<TwoPTwoCChemicalNonequilibrium, CCTpfaModel>; };
} // end namespace TTag
// Set the grid type
template<class TypeTag>
struct Grid<TypeTag, TTag::TwoPTwoCChemicalNonequilibrium> { using type = Dune::YaspGrid<2>; };
// Set the problem property
template<class TypeTag>
struct Problem<TypeTag, TTag::TwoPTwoCChemicalNonequilibrium>
{ using type = TwoPTwoCChemicalNonequilibriumProblem<TypeTag>; };
// Set fluid configuration
template<class TypeTag>
struct FluidSystem<TypeTag, TTag::TwoPTwoCChemicalNonequilibrium>
{
private:
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
public:
using type = FluidSystems::H2OAir<Scalar,
Components::TabulatedComponent<Components::H2O<Scalar>>,
FluidSystems::H2OAirDefaultPolicy</*fastButSimplifiedRelations=*/true>,
true /*useKelvinEquation*/>;
};
// Set the spatial parameters
template<class TypeTag>
struct SpatialParams<TypeTag, TTag::TwoPTwoCChemicalNonequilibrium>
{
using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>;
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
using type = TwoPTwoCChemicalNonequilibriumSpatialParams<GridGeometry, Scalar>;
};
// decide which type to use for floating values (double / quad)
template<class TypeTag>
struct Scalar<TypeTag, TTag::TwoPTwoCChemicalNonequilibrium> { using type = double; };
template<class TypeTag>
struct Formulation<TypeTag, TTag::TwoPTwoCChemicalNonequilibrium>
{
public:
static const TwoPFormulation value = TwoPFormulation::p0s1;
};
template<class TypeTag>
struct UseMoles<TypeTag, TTag::TwoPTwoCChemicalNonequilibrium>
{ static constexpr bool value = true; };
template<class TypeTag>
struct EnableThermalNonEquilibrium<TypeTag, TTag::TwoPTwoCChemicalNonequilibrium>
{ static constexpr bool value = false; };
template<class TypeTag>
struct HeatConductionType<TypeTag, TTag::TwoPTwoCChemicalNonequilibrium>
{ using type = FouriersLaw<TypeTag>; };
template<class TypeTag>
struct EnergyLocalResidual<TypeTag, TTag::TwoPTwoCChemicalNonequilibrium>
{ using type = Dumux::EnergyLocalResidual<TypeTag>; };
} // end namespace Dumux::Properties
#endif
......@@ -22,13 +22,11 @@
* \brief Test for the two-phase two-component CC model.
*/
#include <config.h>
#include <ctime>
#include <iostream>
#include <dune/common/parallel/mpihelper.hh>
#include <dune/common/timer.hh>
#include <dune/grid/io/file/vtk.hh>
#include <dune/istl/io.hh>
#include <dumux/common/properties.hh>
#include <dumux/common/parameters.hh>
......@@ -39,16 +37,12 @@
#include <dumux/nonlinear/newtonsolver.hh>
#include <dumux/assembly/fvassembler.hh>
#include <dumux/assembly/diffmethod.hh>
#include <dumux/discretization/method.hh>
#include <dumux/io/vtkoutputmodule.hh>
#include <dumux/io/grid/gridmanager.hh>
#include <dumux/io/grid/gridmanager_yasp.hh>
#include <dumux/io/loadsolution.hh>
// the problem definitions
#include "problem.hh"
#include "properties.hh"
int main(int argc, char** argv)
{
......
......@@ -25,96 +25,16 @@
#ifndef DUMUX_INJECTION_PROBLEM_HH
#define DUMUX_INJECTION_PROBLEM_HH
#include <dune/grid/yaspgrid.hh>
#include <dumux/common/boundarytypes.hh>
#include <dumux/common/properties.hh>
#include <dumux/common/parameters.hh>
#include <dumux/common/numeqvector.hh>
#include <dumux/discretization/cellcentered/mpfa/omethod/staticinteractionvolume.hh>
#include <dumux/discretization/ccmpfa.hh>
#include <dumux/discretization/cctpfa.hh>
#include <dumux/discretization/box.hh>
#include <dumux/porousmediumflow/problem.hh>
#include <dumux/porousmediumflow/2p2c/model.hh>
#include <dumux/material/fluidsystems/h2on2.hh>
#include "spatialparams.hh"
namespace Dumux {
#ifndef ENABLECACHING
#define ENABLECACHING 0
#endif
template <class TypeTag>
class InjectionProblem;
namespace Properties {
// Create new type tags
namespace TTag {
struct Injection { using InheritsFrom = std::tuple<TwoPTwoC>; };
struct InjectionBox { using InheritsFrom = std::tuple<Injection, BoxModel>; };
struct InjectionCCTpfa { using InheritsFrom = std::tuple<Injection, CCTpfaModel>; };
struct InjectionCCMpfa { using InheritsFrom = std::tuple<Injection, CCMpfaModel>; };
} // end namespace TTag
// Set the grid type
template<class TypeTag>
struct Grid<TypeTag, TTag::Injection> { using type = Dune::YaspGrid<2>; };
// Set the problem property
template<class TypeTag>
struct Problem<TypeTag, TTag::Injection> { using type = InjectionProblem<TypeTag>; };
// Set fluid configuration
template<class TypeTag>
struct FluidSystem<TypeTag, TTag::Injection>
{
using type = FluidSystems::H2ON2<GetPropType<TypeTag, Properties::Scalar>,
FluidSystems::H2ON2DefaultPolicy</*fastButSimplifiedRelations=*/true>>;
};
// Set the spatial parameters
template<class TypeTag>
struct SpatialParams<TypeTag, TTag::Injection>
{
using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>;
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
using type = InjectionSpatialParams<GridGeometry, Scalar>;
};
// Define whether mole(true) or mass (false) fractions are used
template<class TypeTag>
struct UseMoles<TypeTag, TTag::Injection> { static constexpr bool value = true; };
// Enable caching or not (reference solutions created without caching)
template<class TypeTag>
struct EnableGridGeometryCache<TypeTag, TTag::Injection> { static constexpr bool value = ENABLECACHING; };
template<class TypeTag>
struct EnableGridVolumeVariablesCache<TypeTag, TTag::Injection> { static constexpr bool value = ENABLECACHING; };
template<class TypeTag>
struct EnableGridFluxVariablesCache<TypeTag, TTag::Injection> { static constexpr bool value = ENABLECACHING; };
// use the static interaction volume around interior vertices in the mpfa test
template<class TypeTag>
struct PrimaryInteractionVolume<TypeTag, TTag::InjectionCCMpfa>
{
private:
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
using NodalIndexSet = GetPropType<TypeTag, Properties::DualGridNodalIndexSet>;
// structured two-d grid
static constexpr int numIvScvs = 4;
static constexpr int numIvScvfs = 4;
// use the default traits
using Traits = CCMpfaODefaultStaticInteractionVolumeTraits< NodalIndexSet, Scalar, numIvScvs, numIvScvfs >;
public:
using type = CCMpfaOStaticInteractionVolume< Traits >;
};
} // end namespace Properties
/*!
* \ingroup TwoPTwoCTests
* \brief Problem where air is injected under a low permeable layer in a depth of 2700m.
......
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*****************************************************************************
* See the file COPYING for full copying permissions. *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*****************************************************************************/
/*!
* \file
* \ingroup TwoPTwoCTests
* \brief The properties of the problem where air is injected under a low permeable layer in a depth
* of 2700m.
*/
#ifndef DUMUX_INJECTION_PROPERTIES_HH
#define DUMUX_INJECTION_PROPERTIES_HH
#include <dune/grid/yaspgrid.hh>
#include <dumux/discretization/cellcentered/mpfa/omethod/staticinteractionvolume.hh>
#include <dumux/discretization/ccmpfa.hh>
#include <dumux/discretization/cctpfa.hh>
#include <dumux/discretization/box.hh>
#include <dumux/porousmediumflow/2p2c/model.hh>
#ifndef ENABLECACHING
#define ENABLECACHING 0
#endif
#include "spatialparams.hh"
#include "problem.hh"
namespace Dumux::Properties {
// Create new type tags
namespace TTag {
struct Injection { using InheritsFrom = std::tuple<TwoPTwoC>; };
struct InjectionBox { using InheritsFrom = std::tuple<Injection, BoxModel>; };
struct InjectionCCTpfa { using InheritsFrom = std::tuple<Injection, CCTpfaModel>; };
struct InjectionCCMpfa { using InheritsFrom = std::tuple<Injection, CCMpfaModel>; };
} // end namespace TTag
// Set the grid type
template<class TypeTag>
struct Grid<TypeTag, TTag::Injection> { using type = Dune::YaspGrid<2>; };
// Set the problem property
template<class TypeTag>
struct Problem<TypeTag, TTag::Injection> { using type = InjectionProblem<TypeTag>; };
// Set fluid configuration
template<class TypeTag>
struct FluidSystem<TypeTag, TTag::Injection>
{
using type = FluidSystems::H2ON2<GetPropType<TypeTag, Properties::Scalar>,
FluidSystems::H2ON2DefaultPolicy</*fastButSimplifiedRelations=*/true>>;
};
// Set the spatial parameters
template<class TypeTag>
struct SpatialParams<TypeTag, TTag::Injection>
{
using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>;
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
using type = InjectionSpatialParams<GridGeometry, Scalar>;
};
// Define whether mole(true) or mass (false) fractions are used
template<class TypeTag>
struct UseMoles<TypeTag, TTag::Injection> { static constexpr bool value = true; };
// Enable caching or not (reference solutions created without caching)
template<class TypeTag>
struct EnableGridGeometryCache<TypeTag, TTag::Injection> { static constexpr bool value = ENABLECACHING; };
template<class TypeTag>
struct EnableGridVolumeVariablesCache<TypeTag, TTag::Injection> { static constexpr bool value = ENABLECACHING; };
template<class TypeTag>
struct EnableGridFluxVariablesCache<TypeTag, TTag::Injection> { static constexpr bool value = ENABLECACHING; };
// use the static interaction volume around interior vertices in the mpfa test
template<class TypeTag>
struct PrimaryInteractionVolume<TypeTag, TTag::InjectionCCMpfa>
{
private:
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
using NodalIndexSet = GetPropType<TypeTag, Properties::DualGridNodalIndexSet>;
// structured two-d grid
static constexpr int numIvScvs = 4;
static constexpr int numIvScvfs = 4;
// use the default traits
using Traits = CCMpfaODefaultStaticInteractionVolumeTraits< NodalIndexSet, Scalar, numIvScvs, numIvScvfs >;
public:
using type = CCMpfaOStaticInteractionVolume< Traits >;
};
} // end namespace Dumux::Properties
#endif
......@@ -23,13 +23,10 @@
*/
#include <config.h>
#include <ctime>
#include <iostream>
#include <dune/common/parallel/mpihelper.hh>
#include <dune/common/timer.hh>
#include <dune/grid/io/file/vtk/vtksequencewriter.hh>
#include <dune/istl/io.hh>
#include <dumux/common/properties.hh>
#include <dumux/common/parameters.hh>
......@@ -40,38 +37,11 @@
#include <dumux/nonlinear/newtonsolver.hh>
#include <dumux/assembly/fvassembler.hh>
#include <dumux/assembly/diffmethod.hh>
#include <dumux/io/vtkoutputmodule.hh>
#include <dumux/io/grid/gridmanager.hh>
#include <dumux/io/grid/gridmanager_yasp.hh>
#include "problem.hh"
/*!
* \brief Provides an interface for customizing error messages associated with
* reading in parameters.
*
* \param progName The name of the program, that was tried to be started.
* \param errorMsg The error message that was issued by the start function.
* Comprises the thing that went wrong and a general help message.
*/
void usage(const char *progName, const std::string &errorMsg)
{
if (errorMsg.size() > 0) {
std::string errorMessageOut = "\nUsage: ";
errorMessageOut += progName;
errorMessageOut += " [options]\n";
errorMessageOut += errorMsg;
errorMessageOut += "\n\nThe list of mandatory options for this program is:\n"
"\t-TimeManager.TEnd End of the simulation [s] \n"
"\t-TimeManager.DtInitial Initial timestep size [s] \n"
"\t-Grid.Cells Number of cells in respective coordinate directions\n"
"\t-Grid.UpperRight Upper right corner coordinates\n";
std::cout << errorMessageOut
<< "\n";
}
}
#include "properties.hh"
////////////////////////
// the main function
......@@ -91,7 +61,7 @@ int main(int argc, char** argv)
DumuxMessage::print(/*firstCall=*/true);
// parse command line arguments and input file
Parameters::init(argc, argv, usage);
Parameters::init(argc, argv);
// try to create a grid (from the given grid file or the input file)
GridManager<GetPropType<TypeTag, Properties::Grid>> gridManager;
......
......@@ -27,78 +27,14 @@
#ifndef DUMUX_TWOPTWOC_MPNC_PROBLEM_HH
#define DUMUX_TWOPTWOC_MPNC_PROBLEM_HH
#include <dune/grid/yaspgrid.hh>
#include <dumux/common/boundarytypes.hh>
#include <dune/common/parametertreeparser.hh>