Commit 795e5130 authored by Bernd Flemisch's avatar Bernd Flemisch
Browse files

implicit branch: replace BoxSpatialParams* by ImplicitSpatialParams*....

implicit branch: replace BoxSpatialParams* by ImplicitSpatialParams*. Deprecate the old classes, adapt includes and names.

git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/branches/implicit@9756 2fb0f335-1f38-0410-981e-8018bf24f1b0
parent 8cd8367c
......@@ -39,7 +39,7 @@
#include <dumux/material/fluidsystems/liquidphase.hh>
#include <dumux/material/components/nullcomponent.hh>
#include <dumux/material/fluidsystems/1pfluidsystem.hh>
#include <dumux/material/spatialparams/boxspatialparams1p.hh>
#include <dumux/material/spatialparams/implicitspatialparams1p.hh>
namespace Dumux
{
......@@ -70,8 +70,8 @@ SET_TYPE_PROP(OneP, FluxVariables, ImplicitDarcyFluxVariables<TypeTag>);
SET_TYPE_PROP(OneP, Indices, OnePIndices);
//! The spatial parameters to be employed.
//! Use BoxSpatialParamsOneP by default.
SET_TYPE_PROP(OneP, SpatialParams, BoxSpatialParamsOneP<TypeTag>);
//! Use ImplicitSpatialParamsOneP by default.
SET_TYPE_PROP(OneP, SpatialParams, ImplicitSpatialParamsOneP<TypeTag>);
//! The weight of the upwind control volume when calculating
//! fluxes. Use central differences by default.
......
......@@ -37,7 +37,7 @@
#include "1p2cfluxvariables.hh"
#include "1p2cindices.hh"
#include <dumux/material/spatialparams/boxspatialparams1p.hh>
#include <dumux/material/spatialparams/implicitspatialparams1p.hh>
namespace Dumux
{
......@@ -73,8 +73,8 @@ SET_SCALAR_PROP(OnePTwoC, ImplicitMassUpwindWeight, 1.0);
SET_TYPE_PROP(OnePTwoC, Indices, Dumux::OnePTwoCIndices<TypeTag, 0>);
//! The spatial parameters to be employed.
//! Use BoxSpatialParamsOneP by default.
SET_TYPE_PROP(OnePTwoC, SpatialParams, BoxSpatialParamsOneP<TypeTag>);
//! Use ImplicitSpatialParamsOneP by default.
SET_TYPE_PROP(OnePTwoC, SpatialParams, ImplicitSpatialParamsOneP<TypeTag>);
//! Set the phaseIndex per default to zero (important for two-phase fluidsystems).
SET_INT_PROP(OnePTwoC, PhaseIdx, 0);
......
......@@ -39,7 +39,7 @@
#include <dumux/material/components/nullcomponent.hh>
#include <dumux/material/fluidsystems/2pimmisciblefluidsystem.hh>
#include <dumux/material/fluidstates/immisciblefluidstate.hh>
#include <dumux/material/spatialparams/boxspatialparams.hh>
#include <dumux/material/spatialparams/implicitspatialparams.hh>
namespace Dumux
{
......@@ -82,8 +82,8 @@ SET_TYPE_PROP(TwoP,
TwoPIndices<TypeTag, GET_PROP_VALUE(TypeTag, Formulation), 0>);
//! The spatial parameters to be employed.
//! Use BoxSpatialParams by default.
SET_TYPE_PROP(TwoP, SpatialParams, BoxSpatialParams<TypeTag>);
//! Use ImplicitSpatialParams by default.
SET_TYPE_PROP(TwoP, SpatialParams, ImplicitSpatialParams<TypeTag>);
/*!
* \brief Set the property for the material parameters by extracting
......
......@@ -36,7 +36,7 @@
#include "2p2cnewtoncontroller.hh"
#include <dumux/implicit/common/implicitdarcyfluxvariables.hh>
#include <dumux/material/spatialparams/boxspatialparams.hh>
#include <dumux/material/spatialparams/implicitspatialparams.hh>
namespace Dumux
{
......@@ -139,8 +139,8 @@ SET_PROP(TwoPTwoC, Indices)
};
//! The spatial parameters to be employed.
//! Use BoxSpatialParams by default.
SET_TYPE_PROP(TwoPTwoC, SpatialParams, BoxSpatialParams<TypeTag>);
//! Use ImplicitSpatialParams by default.
SET_TYPE_PROP(TwoPTwoC, SpatialParams, ImplicitSpatialParams<TypeTag>);
// disable velocity output by default
SET_BOOL_PROP(TwoPTwoC, VtkAddVelocity, false);
......
......@@ -33,7 +33,7 @@
#include <dumux/material/fluidsystems/2pimmisciblefluidsystem.hh>
#include <dumux/material/fluidsystems/gasphase.hh>
#include <dumux/material/fluidsystems/liquidphase.hh>
#include <dumux/material/spatialparams/boxspatialparams.hh>
#include <dumux/material/spatialparams/implicitspatialparams.hh>
#include "2pdfmmodel.hh"
#include "2pdfmproblem.hh"
......@@ -87,8 +87,8 @@ SET_PROP(TwoPDFM, Indices)
//! The spatial parameters to be employed.
//! Use BoxSpatialParams by default.
SET_TYPE_PROP(TwoPDFM, SpatialParams, BoxSpatialParams<TypeTag>);
//! Use ImplicitSpatialParams by default.
SET_TYPE_PROP(TwoPDFM, SpatialParams, ImplicitSpatialParams<TypeTag>);
/*!
* \brief Set the property for the material parameters by extracting
......
......@@ -39,7 +39,7 @@
// #include "3p3cboundaryvariables.hh"
#include <dumux/implicit/common/implicitdarcyfluxvariables.hh>
#include <dumux/material/spatialparams/boxspatialparams.hh>
#include <dumux/material/spatialparams/implicitspatialparams.hh>
namespace Dumux
{
......@@ -123,8 +123,8 @@ SET_BOOL_PROP(ThreePThreeC, UseConstraintSolver, false);
SET_TYPE_PROP(ThreePThreeC, Indices, ThreePThreeCIndices<TypeTag, /*PVOffset=*/0>);
//! The spatial parameters to be employed.
//! Use BoxSpatialParams by default.
SET_TYPE_PROP(ThreePThreeC, SpatialParams, BoxSpatialParams<TypeTag>);
//! Use ImplicitSpatialParams by default.
SET_TYPE_PROP(ThreePThreeC, SpatialParams, ImplicitSpatialParams<TypeTag>);
// enable gravity by default
SET_BOOL_PROP(ThreePThreeC, ProblemEnableGravity, true);
......
......@@ -34,7 +34,7 @@
#include "energy/mpncvtkwriterenergy.hh"
#include <dumux/material/constraintsolvers/compositionfromfugacities.hh>
#include <dumux/material/spatialparams/boxspatialparams.hh>
#include <dumux/material/spatialparams/implicitspatialparams.hh>
/*!
......@@ -188,8 +188,8 @@ SET_SCALAR_PROP(MPNC, ImplicitMassUpwindWeight, 1.0);
SET_SCALAR_PROP(MPNC, ImplicitMobilityUpwindWeight, 1.0);
//! The spatial parameters to be employed.
//! Use BoxSpatialParams by default.
SET_TYPE_PROP(MPNC, SpatialParams, BoxSpatialParams<TypeTag>);
//! Use ImplicitSpatialParams by default.
SET_TYPE_PROP(MPNC, SpatialParams, ImplicitSpatialParams<TypeTag>);
//! The VTK writer module for common quantities
SET_PROP(MPNC, MPNCVtkCommonModule)
......
......@@ -38,7 +38,7 @@
#include <dumux/material/components/nullcomponent.hh>
#include <dumux/material/fluidsystems/2pimmisciblefluidsystem.hh>
#include <dumux/material/spatialparams/boxspatialparams.hh>
#include <dumux/material/spatialparams/implicitspatialparams.hh>
namespace Dumux
{
......@@ -80,8 +80,8 @@ SET_SCALAR_PROP(Richards, ImplicitMobilityUpwindWeight, 1.0);
SET_TYPE_PROP(Richards, Indices, RichardsIndices<TypeTag>);
//! The spatial parameters to be employed.
//! Use BoxSpatialParams by default.
SET_TYPE_PROP(Richards, SpatialParams, BoxSpatialParams<TypeTag>);
//! Use ImplicitSpatialParams by default.
SET_TYPE_PROP(Richards, SpatialParams, ImplicitSpatialParams<TypeTag>);
/*!
* \brief Set type of the parameter objects for the material law
......
......@@ -26,14 +26,9 @@
#ifndef DUMUX_BOX_SPATIAL_PARAMS_HH
#define DUMUX_BOX_SPATIAL_PARAMS_HH
#include "boxspatialparams1p.hh"
#include "implicitspatialparams.hh"
namespace Dumux {
// forward declaration of property tags
namespace Properties {
NEW_PROP_TAG(MaterialLaw);
NEW_PROP_TAG(MaterialLawParams);
}
/*!
* \ingroup SpatialParameters
......@@ -45,95 +40,16 @@ NEW_PROP_TAG(MaterialLawParams);
* box method.
*/
template<class TypeTag>
class BoxSpatialParams: public BoxSpatialParamsOneP<TypeTag>
class BoxSpatialParams: public ImplicitSpatialParams<TypeTag>
{
typedef ImplicitSpatialParams<TypeTag> ParentType;
typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
typedef typename GET_PROP_TYPE(TypeTag, SpatialParams) Implementation;
typedef typename GET_PROP_TYPE(TypeTag, MaterialLawParams) MaterialLawParams;
enum {
dimWorld = GridView::dimensionworld
};
typedef typename GridView::template Codim<0>::Entity Element;
typedef typename GET_PROP_TYPE(TypeTag, FVElementGeometry) FVElementGeometry;
typedef typename GET_PROP_TYPE(TypeTag, FluxVariables) FluxVariables;
typedef typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables) ElementVolumeVariables;
typedef typename GridView::ctype CoordScalar;
typedef Dune::FieldVector<CoordScalar,dimWorld> GlobalPosition;
typedef Dune::FieldVector<CoordScalar,dimWorld> Vector;
public:
DUNE_DEPRECATED_MSG("Use ImplicitSpatialParams from dumux/material/spatialparams/implicitspatialparams.hh instead.")
BoxSpatialParams(const GridView &gridView)
:BoxSpatialParamsOneP<TypeTag>(gridView)
: ParentType(gridView)
{ }
/*!
* \brief Function for defining the parameters needed by constitutive relationships (kr-Sw, pc-Sw, etc.).
*
* \param element The current element
* \param fvGeometry The current finite volume geometry of the element
* \param scvIdx The index of the sub-control volume.
* \return the material parameters object
*/
const MaterialLawParams& materialLawParams(const Element &element,
const FVElementGeometry &fvGeometry,
int scvIdx) const
{
return asImp_().materialLawParamsAtPos(element.geometry().center());
}
/*!
* \brief Function for defining the parameters needed by constitutive relationships (kr-Sw, pc-Sw, etc.).
*
* \return the material parameters object
* \param globalPos The position of the center of the element
*/
const MaterialLawParams& materialLawParamsAtPos(const GlobalPosition& globalPos) const
{
DUNE_THROW(Dune::InvalidStateException,
"The spatial parameters do not provide "
"a materialLawParamsAtPos() method.");
}
/*!
* \brief Calculate the heat flux \f$[W/m^2]\f$ through the
* rock matrix based on the temperature gradient \f$[K / m]\f$
* at the integration point of a (boundary or SCV) face
*
* This is only required for non-isothermal models that use outflow
* boundary conditions.
*
* \param heatFlux The resulting heat flux vector
* \param fluxVars The flux variables
* \param elemVolVars The volume variables
* \param face The boundary or sub-control-volume face
* \param element The current finite element
* \param fvGeometry The finite volume geometry of the current element
* \tparam FaceType The type of the face (boundary face / SCV face)
*/
template <class FaceType>
void boundaryMatrixHeatFlux(Vector &heatFlux,
const FluxVariables &fluxVars,
const ElementVolumeVariables &elemVolVars,
const FaceType &face,
const Element &element,
const FVElementGeometry &fvGeometry) const
{
DUNE_THROW(Dune::InvalidStateException,
"The spatial parameters do not provide "
"a matrixHeatFlux() method.");
}
private:
Implementation &asImp_()
{ return *static_cast<Implementation*>(this); }
const Implementation &asImp_() const
{ return *static_cast<const Implementation*>(this); }
};
} // namespace Dumux
......
......@@ -26,19 +26,9 @@
#ifndef DUMUX_BOX_SPATIAL_PARAMS_ONE_P_HH
#define DUMUX_BOX_SPATIAL_PARAMS_ONE_P_HH
#include <dumux/common/propertysystem.hh>
#include <dumux/common/math.hh>
#include <dumux/implicit/box/boxproperties.hh>
#include <dune/common/fmatrix.hh>
#include "implicitspatialparams1p.hh"
namespace Dumux {
// forward declaration of property tags
namespace Properties {
NEW_PROP_TAG(SpatialParams);
NEW_PROP_TAG(SpatialParamsForchCoeff);
}
/*!
* \ingroup SpatialParameters
......@@ -50,159 +40,16 @@ NEW_PROP_TAG(SpatialParamsForchCoeff);
* box method.
*/
template<class TypeTag>
class BoxSpatialParamsOneP
class BoxSpatialParamsOneP : public ImplicitSpatialParamsOneP<TypeTag>
{
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
typedef ImplicitSpatialParamsOneP<TypeTag> ParentType;
typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
typedef typename GET_PROP_TYPE(TypeTag, SpatialParams) Implementation;
enum { dimWorld = GridView::dimensionworld };
typedef typename GridView::template Codim<0>::Entity Element;
typedef typename GET_PROP_TYPE(TypeTag, FVElementGeometry) FVElementGeometry;
typedef typename GridView::ctype CoordScalar;
typedef Dune::FieldMatrix<Scalar, dimWorld, dimWorld> Tensor;
typedef Dune::FieldVector<CoordScalar,dimWorld> GlobalPosition;
public:
DUNE_DEPRECATED_MSG("Use ImplicitSpatialParamsOneP from dumux/material/spatialparams/implicitspatialparams1p.hh instead.")
BoxSpatialParamsOneP(const GridView &gridView)
: ParentType(gridView)
{ }
~BoxSpatialParamsOneP()
{}
/*!
* \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.
*
* \param element The current element
* \param fvGeometry The current finite volume geometry of the element
* \param scvIdx The index of the sub-control volume.
* \return the intrinsic permeability
*/
const Tensor& intrinsicPermeability (const Element &element,
const FVElementGeometry &fvGeometry,
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.
*
* \param element The current element
* \param fvGeometry The current finite volume geometry of the element
* \param scvIdx The index of the sub-control volume.
* \return porosity
*/
Scalar porosity(const Element &element,
const FVElementGeometry &fvGeometry,
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.");
}
/*!
* \brief Apply the Forchheimer coefficient for inertial forces
* calculation.
*
* Source: Ward, J.C. 1964 Turbulent flow in porous media. ASCE J. Hydraul. Div 90.
* Actually the Forchheimer coefficient is also a function of the dimensions of the
* porous medium. Taking it as a constant is only a first approximation
* (Nield, Bejan, Convection in porous media, 2006, p. 10)
*
* \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
* intrinsic velocity ought to be calculated.
*/
Scalar forchCoeff(const Element &element,
const FVElementGeometry &fvElemGeom,
const unsigned int scvIdx) const
{
try
{
const Scalar forchCoeff = GET_PARAM_FROM_GROUP(TypeTag, Scalar, SpatialParams, ForchCoeff);
return forchCoeff ;
}
catch (Dumux::ParameterException &e) {
std::cerr << e << ". Aborted in file "<< __FILE__ << "!\n";
exit(1) ;
}
catch (...) {
std::cerr << "Unknown exception thrown!\n";
exit(1) ;
}
}
private:
Implementation &asImp_()
{ return *static_cast<Implementation*>(this); }
const Implementation &asImp_() const
{ return *static_cast<const Implementation*>(this); }
};
} // namespace Dumux
......
// -*- 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
*
* \ingroup SpatialParameters
* \brief The base class for spatial parameters of multi-phase problems
* using a fully implicit discretization method.
*/
#ifndef DUMUX_IMPLICIT_SPATIAL_PARAMS_HH
#define DUMUX_IMPLICIT_SPATIAL_PARAMS_HH
#include "implicitspatialparams1p.hh"
namespace Dumux {
// forward declaration of property tags
namespace Properties {
NEW_PROP_TAG(MaterialLaw);
NEW_PROP_TAG(MaterialLawParams);
}
/*!
* \ingroup SpatialParameters
*/
/**
* \brief The base class for spatial parameters of multi-phase problems
* using a fully implicit discretization method.
*/
template<class TypeTag>
class ImplicitSpatialParams: public ImplicitSpatialParamsOneP<TypeTag>
{
typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
typedef typename GET_PROP_TYPE(TypeTag, SpatialParams) Implementation;
typedef typename GET_PROP_TYPE(TypeTag, MaterialLawParams) MaterialLawParams;
enum {
dimWorld = GridView::dimensionworld
};
typedef typename GridView::template Codim<0>::Entity Element;
typedef typename GET_PROP_TYPE(TypeTag, FVElementGeometry) FVElementGeometry;
typedef typename GET_PROP_TYPE(TypeTag, FluxVariables) FluxVariables;
typedef typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables) ElementVolumeVariables;
typedef typename GridView::ctype CoordScalar;
typedef Dune::FieldVector<CoordScalar,dimWorld> GlobalPosition;
typedef Dune::FieldVector<CoordScalar,dimWorld> Vector;
public:
ImplicitSpatialParams(const GridView &gridView)
:ImplicitSpatialParamsOneP<TypeTag>(gridView)
{ }
/*!
* \brief Function for defining the parameters needed by constitutive relationships (kr-Sw, pc-Sw, etc.).
*
* \param element The current element
* \param fvGeometry The current finite volume geometry of the element
* \param scvIdx The index of the sub-control volume.
* \return the material parameters object
*/
const MaterialLawParams& materialLawParams(const Element &element,
const FVElementGeometry &fvGeometry,
int scvIdx) const
{
return asImp_().materialLawParamsAtPos(element.geometry().center());
}
/*!
* \brief Function for defining the parameters needed by constitutive relationships (kr-Sw, pc-Sw, etc.).
*
* \return the material parameters object
* \param globalPos The position of the center of the element
*/
const MaterialLawParams& materialLawParamsAtPos(const GlobalPosition& globalPos) const
{
DUNE_THROW(Dune::InvalidStateException,
"The spatial parameters do not provide "
"a materialLawParamsAtPos() method.");
}
/*!
* \brief Calculate the heat flux \f$[W/m^2]\f$ through the
* rock matrix based on the temperature gradient \f$[K / m]\f$
* at the integration point of a (boundary or SCV) face
*
* This is only required for non-isothermal models that use outflow
* boundary conditions.
*
* \param heatFlux The resulting heat flux vector
* \param fluxVars The flux variables
* \param elemVolVars The volume variables
* \param face The boundary or sub-control-volume face
* \param element The current finite element
* \param fvGeometry The finite volume geometry of the current element
* \tparam FaceType The type of the face (boundary face / SCV face)
*/
template <class FaceType>
void boundaryMatrixHeatFlux(Vector &heatFlux,
const FluxVariables &fluxVars,
const ElementVolumeVariables &elemVolVars,
const FaceType &face,
const Element &element,
const FVElementGeometry &fvGeometry) const
{
DUNE_THROW(Dune::InvalidStateException,
"The spatial parameters do not provide "
"a matrixHeatFlux() method.");
}
private:
Implementation &asImp_()
{ return *static_cast<Implementation*>(this); }
const Implementation &asImp_() const
{ return *static_cast<const Implementation*>(this); }
};