Commit f68e001f authored by Maziar Veyskarami's avatar Maziar Veyskarami Committed by Timo Koch
Browse files

[lec-mm][fractures][fuelcell] move properties to properties header file

parent 3d00ad02
......@@ -19,6 +19,7 @@ install(FILES
fractures.cc
matrixproblem.hh
fractureproblem.hh
properties.hh
matrixspatialparams.hh
fracturespatialparams.hh
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/lecture/mm/fractures)
......@@ -23,74 +23,13 @@
#ifndef DUMUX_COURSE_FRACTURESEXERCISE_FRACTURE_PROBLEM_HH
#define DUMUX_COURSE_FRACTURESEXERCISE_FRACTURE_PROBLEM_HH
// we use alu grid for the discretization of the fracture domain
// as this grid manager is able to represent network/surface grids
#include <dune/foamgrid/foamgrid.hh>
// we want to simulate methan gas transport in a water-saturated medium
#include <dumux/material/fluidsystems/2pimmiscible.hh>
#include <dumux/material/fluidsystems/1pliquid.hh>
#include <dumux/material/fluidsystems/1pgas.hh>
#include <dumux/material/components/tabulatedcomponent.hh>
#include <dumux/material/components/h2o.hh>
#include <dumux/material/components/ch4.hh>
// we use a cell-centered finite volume scheme with tpfa here
#include <dumux/discretization/cctpfa.hh>
// include the base problem and the model we inherit from
#include <dumux/porousmediumflow/problem.hh>
#include <dumux/porousmediumflow/2p/model.hh>
#include <dumux/common/properties.hh>
#include <dumux/common/parameters.hh>
// the spatial parameters (permeabilities, material parameters etc.)
#include "fracturespatialparams.hh"
// include the base problem we inherit from
#include <dumux/porousmediumflow/problem.hh>
namespace Dumux {
// forward declarations
template<class TypeTag> class FractureSubProblem;
namespace Properties {
// template<class TypeTag, class MyTypeTag>
// struct GridData { using type = UndefinedProperty; }; // forward declaration of property
// create the type tag nodes
// Create new type tags
namespace TTag {
struct FractureProblemTypeTag { using InheritsFrom = std::tuple<TwoP, CCTpfaModel>; };
} // end namespace TTag
// Set the grid type
template<class TypeTag>
struct Grid<TypeTag, TTag::FractureProblemTypeTag> { using type = Dune::FoamGrid<1, 2>; };
// Set the problem type
template<class TypeTag>
struct Problem<TypeTag, TTag::FractureProblemTypeTag> { using type = FractureSubProblem<TypeTag>; };
// Set the spatial parameters
template<class TypeTag>
struct SpatialParams<TypeTag, TTag::FractureProblemTypeTag>
{
using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>;
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
using type = FractureSpatialParams<FVGridGeometry, Scalar>;
};
// the fluid system
template<class TypeTag>
struct FluidSystem<TypeTag, TTag::FractureProblemTypeTag>
{
private:
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
using H2O = Dumux::Components::H2O<Scalar>;
using TabH2O = Dumux::Components::TabulatedComponent<H2O>;
using CH4 = Dumux::Components::CH4<Scalar>;
// turn components into gas/liquid phase
using LiquidPhase = Dumux::FluidSystems::OnePLiquid<Scalar, TabH2O>;
using GasPhase = Dumux::FluidSystems::OnePGas<Scalar, CH4>;
public:
using type = Dumux::FluidSystems::TwoPImmiscible<Scalar, LiquidPhase, GasPhase>;
};
} // end namespace Properties
/*!
* \brief The sub-problem for the fracture domain in the exercise on two-phase flow in fractured porous media.
......
......@@ -25,10 +25,8 @@
#include <dune/common/parallel/mpihelper.hh>
// include the headers of the two sub-problems
// i.e. the problems for fractures and matrix
#include "matrixproblem.hh"
#include "fractureproblem.hh"
// include the properties header
#include "properties.hh"
#include <dumux/common/properties.hh>
#include <dumux/common/parameters.hh>
......
......@@ -23,87 +23,18 @@
#ifndef DUMUX_COURSE_FRACTURESEXERCISE_MATRIX_PROBLEM_HH
#define DUMUX_COURSE_FRACTURESEXERCISE_MATRIX_PROBLEM_HH
// we use alu grid for the discretization of the matrix domain
#include <dune/alugrid/grid.hh>
// we need this in this test in order to define the domain
// id of the fracture problem (see function interiorBoundaryTypes())
#include <dune/common/indices.hh>
// we want to simulate methan gas transport in a water-saturated medium
#include <dumux/material/fluidsystems/2pimmiscible.hh>
#include <dumux/material/fluidsystems/1pliquid.hh>
#include <dumux/material/fluidsystems/1pgas.hh>
#include <dumux/material/components/tabulatedcomponent.hh>
#include <dumux/material/components/h2o.hh>
#include <dumux/material/components/ch4.hh>
// We are using the framework for models that consider coupling
// across the element facets of the bulk domain. This has some
// properties defined, which we have to inherit here. In this
// exercise we want to use a cell-centered finite volume scheme
// with tpfa.
#include <dumux/multidomain/facet/cellcentered/tpfa/properties.hh>
// include the base problem and the model we inherit from
#include <dumux/porousmediumflow/problem.hh>
#include <dumux/porousmediumflow/2p/model.hh>
#include <dumux/common/properties.hh>
#include <dumux/common/parameters.hh>
// the spatial parameters (permeabilities, material parameters etc.)
#include "matrixspatialparams.hh"
// include the base problem we inherit from
#include <dumux/porousmediumflow/problem.hh>
namespace Dumux {
// forward declaration of the problem class
template<class TypeTag> class MatrixSubProblem;
namespace Properties {
template<class TypeTag, class MyTypeTag>
struct GridData { using type = UndefinedProperty; }; // forward declaration of property
// create the type tag node for the matrix sub-problem
// We need to put the facet-coupling type tag after the physics-related type tag
// because it overwrites some of the properties inherited from "TwoP". This is
// necessary because we need e.g. a modified implementation of darcys law that
// evaluates the coupling conditions on faces that coincide with the fractures.
// Create new type tags
namespace TTag {
struct MatrixProblemTypeTag { using InheritsFrom = std::tuple<CCTpfaFacetCouplingModel, TwoP>; };
} // end namespace TTag
// Set the grid type
template<class TypeTag>
struct Grid<TypeTag, TTag::MatrixProblemTypeTag> { using type = Dune::ALUGrid<2, 2, Dune::simplex, Dune::conforming>; };
// Set the problem type
template<class TypeTag>
struct Problem<TypeTag, TTag::MatrixProblemTypeTag> { using type = MatrixSubProblem<TypeTag>; };
// Set the spatial parameters
template<class TypeTag>
struct SpatialParams<TypeTag, TTag::MatrixProblemTypeTag>
{
using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>;
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
using type = MatrixSpatialParams<FVGridGeometry, Scalar>;
};
// the fluid system
template<class TypeTag>
struct FluidSystem<TypeTag, TTag::MatrixProblemTypeTag>
{
private:
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
using H2O = Dumux::Components::H2O<Scalar>;
using TabH2O = Dumux::Components::TabulatedComponent<H2O>;
using CH4 = Dumux::Components::CH4<Scalar>;
// turn components into gas/liquid phase
using LiquidPhase = Dumux::FluidSystems::OnePLiquid<Scalar, TabH2O>;
using GasPhase = Dumux::FluidSystems::OnePGas<Scalar, CH4>;
public:
using type = Dumux::FluidSystems::TwoPImmiscible<Scalar, LiquidPhase, GasPhase>;
};
} // end namespace Properties
/*!
* \brief The sub-problem for the matrix domain in the exercise on two-phase flow in fractured porous media.
*/
......
// -*- 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 2 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
* \brief The properties file of the exercise on two-phase flow in fractured porous media.
*/
#ifndef DUMUX_COURSE_FRACTURESEXERCISE_PROPERTIES_HH
#define DUMUX_COURSE_FRACTURESEXERCISE_PROPERTIES_HH
// Both matrix and fracture sub-problem
// we want to simulate methan gas transport in a water-saturated medium
#include <dumux/material/fluidsystems/2pimmiscible.hh>
#include <dumux/material/fluidsystems/1pliquid.hh>
#include <dumux/material/fluidsystems/1pgas.hh>
#include <dumux/material/components/tabulatedcomponent.hh>
#include <dumux/material/components/h2o.hh>
#include <dumux/material/components/ch4.hh>
// include the model we inherit from
#include <dumux/porousmediumflow/2p/model.hh>
// Fracture sub-problem
// we use alu grid for the discretization of the fracture domain
// as this grid manager is able to represent network/surface grids
#include <dune/foamgrid/foamgrid.hh>
// we use a cell-centered finite volume scheme with tpfa here
#include <dumux/discretization/cctpfa.hh>
// the spatial parameters (permeabilities, material parameters etc.)
#include "fracturespatialparams.hh"
//The problem file, where setup-specific boundary and initial conditions are defined.
#include "fractureproblem.hh"
// Matrix sub-problem
// we use alu grid for the discretization of the matrix domain
#include <dune/alugrid/grid.hh>
// We are using the framework for models that consider coupling
// across the element facets of the bulk domain. This has some
// properties defined, which we have to inherit here. In this
// exercise we want to use a cell-centered finite volume scheme
// with tpfa.
#include <dumux/multidomain/facet/cellcentered/tpfa/properties.hh>
// the spatial parameters (permeabilities, material parameters etc.)
#include "matrixspatialparams.hh"
//The problem file, where setup-specific boundary and initial conditions are defined.
#include "matrixproblem.hh"
namespace Dumux::Properties {
// create the type tag nodes
// Create new type tags
namespace TTag {
// create the typetag for fracture sub-problem
struct FractureProblemTypeTag { using InheritsFrom = std::tuple<TwoP, CCTpfaModel>; };
// create the type tag node for the matrix sub-problem
// We need to put the facet-coupling type tag after the physics-related type tag
// because it overwrites some of the properties inherited from "TwoP". This is
// necessary because we need e.g. a modified implementation of darcys law that
// evaluates the coupling conditions on faces that coincide with the fractures.
struct MatrixProblemTypeTag { using InheritsFrom = std::tuple<CCTpfaFacetCouplingModel, TwoP>; };
} // end namespace TTag
// Set the grid type for fracture sub-problem
template<class TypeTag>
struct Grid<TypeTag, TTag::FractureProblemTypeTag> { using type = Dune::FoamGrid<1, 2>; };
// Set the grid type for matrix sub-problem
template<class TypeTag>
struct Grid<TypeTag, TTag::MatrixProblemTypeTag> { using type = Dune::ALUGrid<2, 2, Dune::simplex, Dune::conforming>; };
// Set the problem type for fracture sub-problem
template<class TypeTag>
struct Problem<TypeTag, TTag::FractureProblemTypeTag> { using type = FractureSubProblem<TypeTag>; };
// Set the grid type for matrix sub-problem
template<class TypeTag>
struct Problem<TypeTag, TTag::MatrixProblemTypeTag> { using type = MatrixSubProblem<TypeTag>; };
// Set the spatial parameters for fracture sub-problem
template<class TypeTag>
struct SpatialParams<TypeTag, TTag::FractureProblemTypeTag>
{
using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>;
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
using type = FractureSpatialParams<FVGridGeometry, Scalar>;
};
// Set the grid type for matrix sub-problem
template<class TypeTag>
struct SpatialParams<TypeTag, TTag::MatrixProblemTypeTag>
{
using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>;
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
using type = MatrixSpatialParams<FVGridGeometry, Scalar>;
};
// the fluid system for fracture sub-problem
template<class TypeTag>
struct FluidSystem<TypeTag, TTag::FractureProblemTypeTag>
{
private:
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
using H2O = Dumux::Components::H2O<Scalar>;
using TabH2O = Dumux::Components::TabulatedComponent<H2O>;
using CH4 = Dumux::Components::CH4<Scalar>;
// turn components into gas/liquid phase
using LiquidPhase = Dumux::FluidSystems::OnePLiquid<Scalar, TabH2O>;
using GasPhase = Dumux::FluidSystems::OnePGas<Scalar, CH4>;
public:
using type = Dumux::FluidSystems::TwoPImmiscible<Scalar, LiquidPhase, GasPhase>;
};
// Set the grid type for matrix sub-problem
template<class TypeTag>
struct FluidSystem<TypeTag, TTag::MatrixProblemTypeTag>
{
private:
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
using H2O = Dumux::Components::H2O<Scalar>;
using TabH2O = Dumux::Components::TabulatedComponent<H2O>;
using CH4 = Dumux::Components::CH4<Scalar>;
// turn components into gas/liquid phase
using LiquidPhase = Dumux::FluidSystems::OnePLiquid<Scalar, TabH2O>;
using GasPhase = Dumux::FluidSystems::OnePGas<Scalar, CH4>;
public:
using type = Dumux::FluidSystems::TwoPImmiscible<Scalar, LiquidPhase, GasPhase>;
};
} // end namespace Dumux::Properties
#endif
add_input_file_links()
dune_add_test(NAME fuelcell
TIMEOUT 1800
TIMEOUT 1800
SOURCES fuelcell.cc
COMMAND ${dumux_INCLUDE_DIRS}/bin/testing/runtest.py
CMD_ARGS --script fuzzy
......@@ -12,5 +12,6 @@ dune_add_test(NAME fuelcell
# headers for installation and headercheck
install(FILES
fuelcellproblem.hh
fuelcellproperties.hh
fuelcellspatialparams.hh
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/lecture/mm/fuelcell)
......@@ -46,7 +46,7 @@
// O: NON-ISOTHERMAL MODEL, 1: ISOTHERMAL MODEL
#define ISOTHERMAL 0
#include "fuelcellproblem.hh"
#include "fuelcellproperties.hh"
/*!
* \brief Provides an interface for customizing error messages associated with
......
......@@ -24,12 +24,10 @@
#ifndef DUMUX_FUELCELL_LECTURE_PROBLEM_HH
#define DUMUX_FUELCELL_LECTURE_PROBLEM_HH
#include <dune/grid/yaspgrid.hh>
#include <dumux/common/properties.hh>
#include <dumux/common/parameters.hh>
#include <dumux/porousmediumflow/problem.hh>
#include <dumux/porousmediumflow/2pnc/model.hh>
#include <dumux/material/fluidsystems/h2on2o2.hh>
#include <dumux/discretization/box.hh>
#if !ISOTHERMAL
#include <dumux/material/chemistry/electrochemistry/electrochemistryni.hh>
......@@ -37,58 +35,8 @@
#include <dumux/material/chemistry/electrochemistry/electrochemistry.hh>
#endif
#include "fuelcellspatialparams.hh"
namespace Dumux {
// Forward declaration
template <class TypeTag>
class FuelCellLectureProblem;
namespace Properties {
#if ISOTHERMAL
// Create new type tags
namespace TTag {
struct FuelCellLectureProblem { using InheritsFrom = std::tuple<FuelCellLectureSpatialParamsTypeTag, TwoPNC, BoxModel>; };
} // end namespace TTag
#else
namespace TTag {
struct FuelCellLectureProblem { using InheritsFrom = std::tuple<FuelCellLectureSpatialParams, TwoPNCNI, BoxModel>; };
} // end namespace TTag
#endif
// Set the grid type
template<class TypeTag>
struct Grid<TypeTag, TTag::FuelCellLectureProblem> { using type = Dune::YaspGrid<2>; };
// Set the problem property
template<class TypeTag>
struct Problem<TypeTag, TTag::FuelCellLectureProblem> { using type = FuelCellLectureProblem<TypeTag>; };
// Set the primary variable combination for the 2pnc model
template<class TypeTag>
struct Formulation<TypeTag, TTag::FuelCellLectureProblem>
{
static constexpr auto value = TwoPFormulation::p1s0;
};
// Set fluid configuration
template<class TypeTag>
struct FluidSystem<TypeTag, TTag::FuelCellLectureProblem>
{
private:
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
public:
using type = FluidSystems::H2ON2O2<Scalar>;
};
// Define which component balance equation gets replaced by total balance {0,1,2,..,numComponents(none)}
template<class TypeTag>
struct ReplaceCompEqIdx<TypeTag, TTag::FuelCellLectureProblem> { static constexpr int value = 3; };
} // end namespace Properties
/*!
* \brief Problem or water management in PEM fuel cells.
*
......
// -*- 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 2 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
*
* \brief Properties file for water management in PEM fuel cells.
*/
#ifndef DUMUX_FUELCELL_LECTURE_PROPERTIES_HH
#define DUMUX_FUELCELL_LECTURE_PROPERTIES_HH
#include <dune/grid/yaspgrid.hh>
#include <dumux/porousmediumflow/2pnc/model.hh>
#include <dumux/material/fluidsystems/h2on2o2.hh>
#include <dumux/discretization/box.hh>
#include "fuelcellspatialparams.hh"
#include "fuelcellproblem.hh"
namespace Dumux::Properties {
#if ISOTHERMAL
// Create new type tags
namespace TTag {
struct FuelCellLectureProblem { using InheritsFrom = std::tuple<FuelCellLectureSpatialParamsTypeTag, TwoPNC, BoxModel>; };
} // end namespace TTag
#else
namespace TTag {
struct FuelCellLectureProblem { using InheritsFrom = std::tuple<FuelCellLectureSpatialParams, TwoPNCNI, BoxModel>; };
} // end namespace TTag
#endif
// Set the grid type
template<class TypeTag>
struct Grid<TypeTag, TTag::FuelCellLectureProblem> { using type = Dune::YaspGrid<2>; };
// Set the problem property
template<class TypeTag>
struct Problem<TypeTag, TTag::FuelCellLectureProblem> { using type = FuelCellLectureProblem<TypeTag>; };
// Set the primary variable combination for the 2pnc model
template<class TypeTag>
struct Formulation<TypeTag, TTag::FuelCellLectureProblem>
{
static constexpr auto value = TwoPFormulation::p1s0;
};
// Set fluid configuration
template<class TypeTag>
struct FluidSystem<TypeTag, TTag::FuelCellLectureProblem>
{
private:
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
public:
using type = FluidSystems::H2ON2O2<Scalar>;
};
// Define which component balance equation gets replaced by total balance {0,1,2,..,numComponents(none)}
template<class TypeTag>
struct ReplaceCompEqIdx<TypeTag, TTag::FuelCellLectureProblem> { static constexpr int value = 3; };
} // end namespace Dumux::Properties
#endif // DUMUX_FUELCELL_LECTURE_PROBLEM_HH
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