Commit 6aa6d6d5 authored by Markus Wolff's avatar Markus Wolff
Browse files

splitted spatial parameters base file

   - one file (DiscretizationTypeSpatialParametersOneP) includes everything which is valid
     for both, single-phase and multi-phase systems
   - one file (DiscretizationTypeSpatialParameters) includes everything
     which is only valid for multi-phase systems
   - For singel-phase problems this means that the spatial parameters
     class now has to be derived from the ...SpatialParametersOneP base
     class!



git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@6430 2fb0f335-1f38-0410-981e-8018bf24f1b0
parent 4b0a1e17
......@@ -25,7 +25,7 @@
#ifndef GROUNDWATER_SPATIALPARAMETERS_HH
#define GROUNDWATER_SPATIALPARAMETERS_HH
#include <dumux/material/spatialparameters/fvspatialparameters.hh>
#include <dumux/material/spatialparameters/fvspatialparameters1p.hh>
namespace Dumux
{
......@@ -35,7 +35,7 @@ namespace Dumux
* \brief spatial parameters for the test problem for diffusion models.
*/
template<class TypeTag>
class GroundwaterSpatialParams: public FVSpatialParameters<TypeTag>
class GroundwaterSpatialParams: public FVSpatialParametersOneP<TypeTag>
{
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Grid)) Grid;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(GridView)) GridView;
......@@ -80,7 +80,7 @@ public:
}
GroundwaterSpatialParams(const GridView& gridView)
: FVSpatialParameters<TypeTag>(gridView), permeability_(0)
: FVSpatialParametersOneP<TypeTag>(gridView), permeability_(0)
{
Dumux::InterfaceSoilProperties interfaceSoilProps("interface_groundwater.xml");
porosity_ = interfaceSoilProps.porosity;
......
......@@ -23,7 +23,7 @@
#ifndef DUMUX_LENSSPATIALPARAMETERS_1P2C_HH
#define DUMUX_LENSSPATIALPARAMETERS_1P2C_HH
#include <dumux/material/spatialparameters/boxspatialparameters.hh>
#include <dumux/material/spatialparameters/boxspatialparameters1p.hh>
#include <dumux/boxmodels/1p2c/1p2cmodel.hh>
/**
......@@ -38,9 +38,9 @@ namespace Dumux
/** \todo Please doc me! */
template<class TypeTag>
class LensSpatialParameters1p2c : public BoxSpatialParameters<TypeTag>
class LensSpatialParameters1p2c : public BoxSpatialParametersOneP<TypeTag>
{
typedef BoxSpatialParameters<TypeTag> ParentType;
typedef BoxSpatialParametersOneP<TypeTag> ParentType;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Grid)) Grid;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(GridView)) GridView;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
......
......@@ -26,8 +26,6 @@
#ifndef DUMUX_1P_PROPERTIES_DATA_HH
#define DUMUX_1P_PROPERTIES_DATA_HH
#define OnePModel
#include <dumux/boxmodels/common/boxproperties.hh>
namespace Dumux
......
......@@ -29,7 +29,6 @@
#ifndef DUMUX_1P2C_PROPERTIES_HH
#define DUMUX_1P2C_PROPERTIES_HH
#define OnePModel
#include<dumux/boxmodels/common/boxproperties.hh>
......
......@@ -30,8 +30,6 @@
#ifndef DUMUX_1PPROPERTIES_HH
#define DUMUX_1PPROPERTIES_HH
#define OnePModel
//Dune-includes
#include <dune/istl/operators.hh>
#include <dune/istl/solvers.hh>
......
......@@ -54,7 +54,7 @@ template<class TypeTag> class IMPET
typedef typename GET_PROP_TYPE(TypeTag, PTAG(GridView)) GridView;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Problem)) Problem;
typedef typename GET_PROP(TypeTag, PTAG(ParameterTree)) Parameters;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
......@@ -67,14 +67,11 @@ template<class TypeTag> class IMPET
typedef typename SolutionTypes::ScalarSolution ScalarSolutionType;
typedef Dune::FieldVector<Scalar, dim> LocalPosition;
typedef Dune::FieldVector<Scalar, dimWorld> GlobalPosition;
public:
typedef typename SolutionTypes::ScalarSolution SolutionType;
//! Set initial solution and initialize parameters
virtual void initialize()
void initialize()
{
//initial values of transported quantity
problem.transportModel().initialize();
......
......@@ -27,12 +27,7 @@
#ifndef DUMUX_BOX_SPATIAL_PARAMETERS_HH
#define DUMUX_BOX_SPATIAL_PARAMETERS_HH
#include <dumux/common/propertysystem.hh>
#include <dumux/common/math.hh>
#include <dumux/boxmodels/common/boxproperties.hh>
#include <dune/common/fmatrix.hh>
#include "boxspatialparameters1p.hh"
namespace Dumux {
// forward declation of property tags
......@@ -50,15 +45,13 @@ NEW_PROP_TAG(SpatialParameters);
* box method.
*/
template<class TypeTag>
class BoxSpatialParameters
class BoxSpatialParameters: public BoxSpatialParametersOneP<TypeTag>
{
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(GridView)) GridView;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(SpatialParameters)) Implementation;
# ifndef OnePModel
typedef typename GET_PROP_TYPE(TypeTag, PTAG(MaterialLawParams)) MaterialLawParams;
#endif
enum {
dimWorld = GridView::dimensionworld
......@@ -68,149 +61,13 @@ class BoxSpatialParameters
typedef typename GET_PROP_TYPE(TypeTag, PTAG(FVElementGeometry)) FVElementGeometry;
typedef typename GridView::ctype CoordScalar;
typedef Dune::FieldMatrix<CoordScalar, dimWorld, dimWorld> Tensor;
typedef Dune::FieldVector<CoordScalar,dimWorld> GlobalPosition;
public:
BoxSpatialParameters(const GridView &gv)
:BoxSpatialParametersOneP<TypeTag>(gv)
{ }
~BoxSpatialParameters()
{}
/*!
* \brief Returns the factor by which the volume of a sub control
* volume needs to be multiplied in order to get cubic
* meters.
*
* \param element The current finite element
* \param fvElemGeom The current finite volume geometry of the element
* \param scvIdx The index sub-control volume face where the
* factor ought to be calculated.
*
* By default that's just 1.0
*/
Scalar extrusionFactorScv(const Element &element,
const FVElementGeometry &fvElemGeom,
int scvIdx) const
{ return 1.0; }
/*!
* \brief Returns the factor by which the area of a sub control
* volume face needs to be multiplied in order to get
* square meters.
*
* \param element The current finite element
* \param fvElemGeom The current finite volume geometry of the element
* \param scvfIdx The index sub-control volume face where the
* factor ought to be calculated.
*
* By default it is the arithmetic mean of the extrusion factor of
* the face's two sub-control volumes.
*/
Scalar extrusionFactorScvf(const Element &element,
const FVElementGeometry &fvElemGeom,
int scvfIdx) const
{
return
0.5 *
(asImp_().extrusionFactorScv(element,
fvElemGeom,
fvElemGeom.subContVolFace[scvfIdx].i)
+
asImp_().extrusionFactorScv(element,
fvElemGeom,
fvElemGeom.subContVolFace[scvfIdx].j));
}
/*!
* \brief Averages the intrinsic permeability (Scalar).
* \param result averaged intrinsic permeability
* \param K1 intrinsic permeability of the first node
* \param K2 intrinsic permeability of the second node
*/
void meanK(Tensor &result,
Scalar K1,
Scalar K2) const
{
const Scalar K = Dumux::harmonicMean(K1, K2);
for (int i = 0; i < dimWorld; ++i) {
for (int j = 0; j < dimWorld; ++j)
result[i][j] = 0;
result[i][i] = K;
}
}
/*!
* \brief Averages the intrinsic permeability (Tensor).
* \param result averaged intrinsic permeability
* \param K1 intrinsic permeability of the first node
* \param K2 intrinsic permeability of the second node
*/
void meanK(Tensor &result,
const Tensor &K1,
const Tensor &K2) const
{
// entry-wise harmonic mean. this is almost certainly wrong if
// you have off-main diagonal entries in your permeabilities!
for (int i = 0; i < dimWorld; ++i)
for (int j = 0; j < dimWorld; ++j)
result[i][j] = harmonicMean(K1[i][j], K2[i][j]);
}
/*!
* \brief Function for defining the intrinsic (absolute) permeability.
*
* \return intrinsic (absolute) permeability
* \param element The element
*/
const Tensor& intrinsicPermeability (const Element &element,
const FVElementGeometry &fvElemGeom,
int scvIdx) const
{
return asImp_().intrinsicPermeabilityAtPos(element.geometry().center());
}
/*!
* \brief Function for defining the intrinsic (absolute) permeability.
*
* \return intrinsic (absolute) permeability
* \param globalPos The position of the center of the element
*/
const Tensor& intrinsicPermeabilityAtPos (const GlobalPosition& globalPos) const
{
DUNE_THROW(Dune::InvalidStateException,
"The spatial parameters do not provide "
"a intrinsicPermeabilityAtPos() method.");
}
/*!
* \brief Function for defining the porosity.
*
* \return porosity
* \param element The element
*/
Scalar porosity(const Element &element,
const FVElementGeometry &fvElemGeom,
int scvIdx) const
{
return asImp_().porosityAtPos(element.geometry().center());
}
/*!
* \brief Function for defining the porosity.
*
* \return porosity
* \param globalPos The position of the center of the element
*/
Scalar porosityAtPos(const GlobalPosition& globalPos) const
{
DUNE_THROW(Dune::InvalidStateException,
"The spatial parameters do not provide "
"a porosityAtPos() method.");
}
# ifndef OnePModel
/*!
* \brief Function for defining the parameters needed by constitutive relationships (kr-Sw, pc-Sw, etc.).
*
......@@ -236,9 +93,8 @@ public:
"The spatial parameters do not provide "
"a materialLawParamsAtPos() method.");
}
#endif
protected:
private:
Implementation &asImp_()
{ return *static_cast<Implementation*>(this); }
......
/*****************************************************************************
* Copyright (C) 2010 by Andreas Lauser *
* Institute of Hydraulic Engineering *
* University of Stuttgart, Germany *
* email: <givenname>.<name>@iws.uni-stuttgart.de *
* *
* 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
*
* \ingroup SpatialParameters
* \brief The base class for spatial parameters of problems using the
* box method.
*/
#ifndef DUMUX_BOX_SPATIAL_PARAMETERS_ONE_P_HH
#define DUMUX_BOX_SPATIAL_PARAMETERS_ONE_P_HH
#include <dumux/common/propertysystem.hh>
#include <dumux/common/math.hh>
#include <dumux/boxmodels/common/boxproperties.hh>
#include <dune/common/fmatrix.hh>
namespace Dumux {
// forward declation of property tags
namespace Properties {
NEW_PROP_TAG(SpatialParameters);
};
/*!
* \ingroup SpatialParameters
*/
/**
* \brief The base class for spatial parameters of problems using the
* box method.
*/
template<class TypeTag>
class BoxSpatialParametersOneP
{
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(GridView)) GridView;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(SpatialParameters)) Implementation;
enum {
dimWorld = GridView::dimensionworld
};
typedef typename GridView::template Codim<0>::Entity Element;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(FVElementGeometry)) FVElementGeometry;
typedef typename GridView::ctype CoordScalar;
typedef Dune::FieldMatrix<CoordScalar, dimWorld, dimWorld> Tensor;
typedef Dune::FieldVector<CoordScalar,dimWorld> GlobalPosition;
public:
BoxSpatialParametersOneP(const GridView &gv)
{ }
~BoxSpatialParametersOneP()
{}
/*!
* \brief Returns the factor by which the volume of a sub control
* volume needs to be multiplied in order to get cubic
* meters.
*
* \param element The current finite element
* \param fvElemGeom The current finite volume geometry of the element
* \param scvIdx The index sub-control volume face where the
* factor ought to be calculated.
*
* By default that's just 1.0
*/
Scalar extrusionFactorScv(const Element &element,
const FVElementGeometry &fvElemGeom,
int scvIdx) const
{ return 1.0; }
/*!
* \brief Returns the factor by which the area of a sub control
* volume face needs to be multiplied in order to get
* square meters.
*
* \param element The current finite element
* \param fvElemGeom The current finite volume geometry of the element
* \param scvfIdx The index sub-control volume face where the
* factor ought to be calculated.
*
* By default it is the arithmetic mean of the extrusion factor of
* the face's two sub-control volumes.
*/
Scalar extrusionFactorScvf(const Element &element,
const FVElementGeometry &fvElemGeom,
int scvfIdx) const
{
return
0.5 *
(asImp_().extrusionFactorScv(element,
fvElemGeom,
fvElemGeom.subContVolFace[scvfIdx].i)
+
asImp_().extrusionFactorScv(element,
fvElemGeom,
fvElemGeom.subContVolFace[scvfIdx].j));
}
/*!
* \brief Averages the intrinsic permeability (Scalar).
* \param result averaged intrinsic permeability
* \param K1 intrinsic permeability of the first node
* \param K2 intrinsic permeability of the second node
*/
void meanK(Tensor &result,
Scalar K1,
Scalar K2) const
{
const Scalar K = Dumux::harmonicMean(K1, K2);
for (int i = 0; i < dimWorld; ++i) {
for (int j = 0; j < dimWorld; ++j)
result[i][j] = 0;
result[i][i] = K;
}
}
/*!
* \brief Averages the intrinsic permeability (Tensor).
* \param result averaged intrinsic permeability
* \param K1 intrinsic permeability of the first node
* \param K2 intrinsic permeability of the second node
*/
void meanK(Tensor &result,
const Tensor &K1,
const Tensor &K2) const
{
// entry-wise harmonic mean. this is almost certainly wrong if
// you have off-main diagonal entries in your permeabilities!
for (int i = 0; i < dimWorld; ++i)
for (int j = 0; j < dimWorld; ++j)
result[i][j] = harmonicMean(K1[i][j], K2[i][j]);
}
/*!
* \brief Function for defining the intrinsic (absolute) permeability.
*
* \return intrinsic (absolute) permeability
* \param element The element
*/
const Tensor& intrinsicPermeability (const Element &element,
const FVElementGeometry &fvElemGeom,
int scvIdx) const
{
return asImp_().intrinsicPermeabilityAtPos(element.geometry().center());
}
/*!
* \brief Function for defining the intrinsic (absolute) permeability.
*
* \return intrinsic (absolute) permeability
* \param globalPos The position of the center of the element
*/
const Tensor& intrinsicPermeabilityAtPos (const GlobalPosition& globalPos) const
{
DUNE_THROW(Dune::InvalidStateException,
"The spatial parameters do not provide "
"a intrinsicPermeabilityAtPos() method.");
}
/*!
* \brief Function for defining the porosity.
*
* \return porosity
* \param element The element
*/
Scalar porosity(const Element &element,
const FVElementGeometry &fvElemGeom,
int scvIdx) const
{
return asImp_().porosityAtPos(element.geometry().center());
}
/*!
* \brief Function for defining the porosity.
*
* \return porosity
* \param globalPos The position of the center of the element
*/
Scalar porosityAtPos(const GlobalPosition& globalPos) const
{
DUNE_THROW(Dune::InvalidStateException,
"The spatial parameters do not provide "
"a porosityAtPos() method.");
}
private:
Implementation &asImp_()
{ return *static_cast<Implementation*>(this); }
const Implementation &asImp_() const
{ return *static_cast<const Implementation*>(this); }
};
} // namespace Dumux
#endif
......@@ -27,32 +27,21 @@
#ifndef DUMUX_FV_SPATIAL_PARAMETERS_HH
#define DUMUX_FV_SPATIAL_PARAMETERS_HH
#include <dumux/common/propertysystem.hh>
#include <dumux/common/math.hh>
#include <dumux/decoupled/common/decoupledproperties.hh>
#include <dune/common/fmatrix.hh>
#include "fvspatialparameters1p.hh"
namespace Dumux
{
// forward declation of property tags
namespace Properties
{
NEW_PROP_TAG( SpatialParameters);
}
;
/*!
* \ingroup SpatialParameters
*/
/**
* \brief The base class for spatial parameters of problems using the
* \brief The base class for spatial parameters of a multi-phase problem using the
* fv method.
*/
template<class TypeTag>
class FVSpatialParameters
class FVSpatialParameters: public FVSpatialParametersOneP<TypeTag>
{
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(GridView)) GridView;
......@@ -65,156 +54,14 @@ class FVSpatialParameters
typedef typename GridView::template Codim<0>::Entity Element;
typedef Dune::FieldVector<Scalar, dimWorld> GlobalPosition;
typedef Dune::FieldMatrix<Scalar, dimWorld, dimWorld> Tensor;
# ifndef OnePModel
typedef typename GET_PROP_TYPE(TypeTag, PTAG(MaterialLawParams)) MaterialLawParams;
#endif
public:
FVSpatialParameters(const GridView &gv)
{
}
~FVSpatialParameters()
:FVSpatialParametersOneP<TypeTag>(gv)
{
}
/*!
* \brief Averages the intrinsic permeability (Scalar).
* \param K1 intrinsic permeability of the first element
* \param K2 intrinsic permeability of the second element
*/
Scalar meanK(Scalar K1, Scalar K2) const
{
const Scalar K = Dumux::harmonicMean(K1, K2);
return K;
}
/*!
* \brief Averages the intrinsic permeability (Scalar).
* \param result averaged intrinsic permeability
* \param K1 intrinsic permeability of the first element
* \param K2 intrinsic permeability of the second element
*/
void meanK(Tensor &result, Scalar K1, Scalar K2) const
{
const Scalar K = Dumux::harmonicMean(K1, K2);
for (int i = 0; i < dimWorld; ++i)
{
for (int j = 0; j < dimWorld; ++j)
result[i][j] = 0;
result[i][i] = K;
}
}
/*!
* \brief Averages the intrinsic permeability (Tensor).
* \param result averaged intrinsic permeability
* \param K1 intrinsic permeability of the first element
* \param K2 intrinsic permeability of the second element