Files
opm-simulators/examples/tutorialspatialparameters_coupled.hh
Andreas Lauser f4f7190c72 change the 2p(ni) and 2p2c(ni) models to the generic capillary pressure laws
also change the 2p model to "smart primary variables" and rate vectors and
make the 2p and 2p2c test problems model agnostic
2012-07-12 21:25:06 +02:00

174 lines
7.4 KiB
C++

// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*****************************************************************************
* Copyright (C) 2008-2009 by Melanie Darcis *
* Institute for Modelling Hydraulic and Environmental Systems *
* 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
*
* \brief The spatial parameters for the fully coupled tutorial problem
* which uses the twophase box model.
*/
#ifndef DUMUX_TUTORIAL_SPATIAL_PARAMETERS_COUPLED_HH
#define DUMUX_TUTORIAL_SPATIAL_PARAMETERS_COUPLED_HH
// include parent spatialparameters
#include <dumux/material/spatialparameters/boxspatialparameters.hh>
// include material laws
#include <dumux/material/fluidmatrixinteractions/2p/regularizedbrookscorey.hh> /*@\label{tutorial-coupled:rawLawInclude}@*/
#include <dumux/material/fluidmatrixinteractions/2p/efftoabslaw.hh>
#include <dumux/material/fluidmatrixinteractions/Mp/2padapter.hh>
namespace Dumux {
//forward declaration
template<class TypeTag>
class TutorialSpatialParametersCoupled;
namespace Properties
{
// The spatial parameters TypeTag
NEW_TYPE_TAG(TutorialSpatialParametersCoupled);/*@\label{tutorial-coupled:define-spatialparameters-typetag}@*/
// Set the spatial parameters
SET_TYPE_PROP(TutorialSpatialParametersCoupled, SpatialParameters,
Dumux::TutorialSpatialParametersCoupled<TypeTag>); /*@\label{tutorial-coupled:set-spatialparameters}@*/
// Set the material law
SET_PROP(TutorialSpatialParametersCoupled, MaterialLaw)
{
private:
// material law typedefs
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
// select material law to be used
typedef RegularizedBrooksCorey<Scalar> RawMaterialLaw; /*@\label{tutorial-coupled:rawlaw}@*/
// adapter for absolute law
typedef EffToAbsLaw<RawMaterialLaw> TwoPMaterialLaw; /*@\label{tutorial-coupled:eff2abs}@*/
typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
enum { wPhaseIdx = FluidSystem::wPhaseIdx };
public:
typedef TwoPAdapter<wPhaseIdx, TwoPMaterialLaw> type;
};
}
/*!
* \ingroup TwoPBoxModel
*
* \brief The spatial parameters for the fully coupled tutorial problem
* which uses the twophase box model.
*/
template<class TypeTag>
class TutorialSpatialParametersCoupled: public BoxSpatialParameters<TypeTag> /*@\label{tutorial-coupled:tutorialSpatialParameters}@*/
{
// Get informations for current implementation via property system
typedef typename GET_PROP_TYPE(TypeTag, Grid) Grid;
typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
enum
{
dim = Grid::dimension,
dimWorld = Grid::dimensionworld
};
typedef Dune::FieldMatrix<Scalar, dim, dim> Tensor;
// Get object types for function arguments
typedef typename GET_PROP_TYPE(TypeTag, FVElementGeometry) FVElementGeometry;
typedef typename Grid::Traits::template Codim<0>::Entity Element;
public:
// get material law from property system
typedef typename GET_PROP_TYPE(TypeTag, MaterialLaw) MaterialLaw;
// determine appropriate parameters depending on selected materialLaw
typedef typename MaterialLaw::Params MaterialLawParams; /*@\label{tutorial-coupled:matLawObjectType}@*/
/*! Intrinsic permeability tensor K \f$[m^2]\f$ depending
* on the position in the domain
*
* \param context The execution context
* \param scvIdx The local index of the degree of freedom
*
* Alternatively, the function intrinsicPermeabilityAtPos(const GlobalPosition& globalPos)
* could be defined, where globalPos is the vector including the global coordinates
* of the finite volume.
*/
template <class Context>
const Tensor &intrinsicPermeability(const Context &context, /*@\label{tutorial-coupled:permeability}@*/
int spaceIdx, int timeIdx) const
{ return K_; }
/*! Defines the porosity \f$[-]\f$ of the porous medium depending
* on the position in the domain
*
* \param context The execution context
* \param scvIdx The local index of the degree of freedom
*
* Alternatively, the function porosityAtPos(const GlobalPosition& globalPos)
* could be defined, where globalPos is the vector including the global coordinates
* of the finite volume.
*/
template <class Context>
Scalar porosity(const Context &context, /*@\label{tutorial-coupled:porosity}@*/
int spaceIdx, int timeIdx) const
{ return 0.2; }
/*! Returns the parameter object for the material law (i.e. Brooks-Corey)
* depending on the position in the domain
*
* \param context The execution context
* \param scvIdx The local index of the degree of freedom
*
* Alternatively, the function materialLawParamsAtPos(const GlobalPosition& globalPos)
* could be defined, where globalPos is the vector including the global coordinates
* of the finite volume.
*/
template <class Context>
const MaterialLawParams& materialLawParams(const Context &context, /*@\label{tutorial-coupled:matLawParams}@*/
int spaceIdx, int timeIdx) const
{ return materialParams_; }
// constructor
TutorialSpatialParametersCoupled(const GridView& gridView) :
BoxSpatialParameters<TypeTag>(gridView),
K_(0)
{
//set main diagonal entries of the permeability tensor to a value
//setting to one value means: isotropic, homogeneous
for (int i = 0; i < dim; i++)
K_[i][i] = 1e-7;
//set residual saturations
materialParams_.setSwr(0.0); /*@\label{tutorial-coupled:setLawParams}@*/
materialParams_.setSnr(0.0);
//parameters of Brooks & Corey Law
materialParams_.setPe(500.0);
materialParams_.setLambda(2);
}
private:
Tensor K_;
// Object that holds the values/parameters of the selected material law.
MaterialLawParams materialParams_; /*@\label{tutorial-coupled:matParamsObject}@*/
};
} // end namespace
#endif