Commit abb4a4c9 authored by Andreas Lauser's avatar Andreas Lauser
Browse files

2p box model: put the indices into an extra file, derive the volume variables...

2p box model: put the indices into an extra file, derive the volume variables from for the base class

git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@4181 2fb0f335-1f38-0410-981e-8018bf24f1b0
parent 0606de03
// $Id: 2pproperties.hh 3357 2010-03-25 13:02:05Z lauser $
/*****************************************************************************
* Copyright (C) 2008-2010 by Andreas Lauser *
* Copyright (C) 2008 by Bernd Flemisch *
* 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, as long as this copyright notice *
* is included in its original form. *
* *
* This program is distributed WITHOUT ANY WARRANTY. *
*****************************************************************************/
/*!
* \file
*
* \brief Defines the indices required for the twophase box model.
*/
#ifndef DUMUX_BOX_2P_INDICES_HH
#define DUMUX_BOX_2P_INDICES_HH
namespace Dumux
{
/*!
* \addtogroup TwoPBoxModel
*/
// \{
/*!
* \brief The common indices for the isothermal two-phase model.
*/
struct TwoPCommonIndices
{
// Formulations
static const int pwSn = 0; //!< Pw and Sn as primary variables
static const int pnSw = 1; //!< Pn and Sw as primary variables
// Phase indices
static const int wPhaseIdx = 0; //!< Index of the wetting phase in a phase vector
static const int nPhaseIdx = 1; //!< Index of the non-wetting phase in a phase vector
};
/*!
* \brief The indices for the \f$p_w-S_n\f$ formulation of the
* isothermal two-phase model.
*
* \tparam PVOffset The first index in a primary variable vector.
*/
template <int formulation = TwoPCommonIndices::pwSn, int PVOffset = 0>
struct TwoPIndices : public TwoPCommonIndices
{
// Primary variable indices
static const int pressureIdx = PVOffset + 0; //!< Index for wetting/non-wetting phase pressure (depending on formulation) in a solution vector
static const int saturationIdx = PVOffset + 1; //!< Index of the saturation of the non-wetting/wetting phase
// indices of the primary variables
static const int pwIdx = PVOffset + 0; //!< Pressure index of the wetting phase
static const int SnIdx = PVOffset + 1; //!< Saturation index of the wetting phase
// indices of the equations
static const int contiWEqIdx = PVOffset + 0; //!< Index of the continuity equation of the wetting phase
static const int contiNEqIdx = PVOffset + 1; //!< Index of the continuity equation of the non-wetting phase
};
/*!
* \brief The indices for the \f$p_w-S_n\f$ formulation of the
* isothermal two-phase model.
*
* \tparam PVOffset The first index in a primary variable vector.
*/
template <int PVOffset>
struct TwoPIndices<TwoPCommonIndices::pnSw, PVOffset>
: public TwoPCommonIndices
{
// Primary variable indices
static const int pressureIdx = PVOffset + 0; //!< Index for wetting/non-wetting phase pressure (depending on formulation) in a solution vector
static const int saturationIdx = PVOffset + 1; //!< Index of the saturation of the non-wetting/wetting phase
// indices of the primary variables
static const int pnIdx = PVOffset + 0; //!< Pressure index of the wetting phase
static const int SwIdx = PVOffset + 1; //!< Saturation index of the wetting phase
// indices of the equations
static const int contiNEqIdx = PVOffset + 0; //!< Index of the continuity equation of the non-wetting phase
static const int contiWEqIdx = PVOffset + 1; //!< Index of the continuity equation of the wetting phase
};
// \}
} // namespace Dumux
#endif
......@@ -17,7 +17,8 @@
/*!
* \file
*
* \brief Defines the properties required for the twophase BOX model.
* \brief Defines default values for the properties required by the
* twophase box model.
*/
#ifndef DUMUX_2P_PROPERTY_DEFAULTS_HH
#define DUMUX_2P_PROPERTY_DEFAULTS_HH
......@@ -26,6 +27,7 @@
#include "2pmodel.hh"
#include "2pproblem.hh"
#include "2pindices.hh"
#include "2pfluxvariables.hh"
#include "2pvolumevariables.hh"
#include "2pfluidstate.hh"
......@@ -37,68 +39,6 @@ namespace Dumux
* \addtogroup TwoPBoxModel
*/
// \{
/*!
* \brief The common indices for the isothermal two-phase model.
*/
struct TwoPCommonIndices
{
// Formulations
static const int pwSn = 0; //!< Pw and Sn as primary variables
static const int pnSw = 1; //!< Pn and Sw as primary variables
// Phase indices
static const int wPhaseIdx = 0; //!< Index of the wetting phase in a phase vector
static const int nPhaseIdx = 1; //!< Index of the non-wetting phase in a phase vector
};
/*!
* \brief The indices for the \f$p_w-S_n\f$ formulation of the
* isothermal two-phase model.
*
* \tparam PVOffset The first index in a primary variable vector.
*/
template <int formulation = TwoPCommonIndices::pwSn, int PVOffset = 0>
struct TwoPIndices : public TwoPCommonIndices
{
// Primary variable indices
static const int pressureIdx = PVOffset + 0; //!< Index for wetting/non-wetting phase pressure (depending on formulation) in a solution vector
static const int saturationIdx = PVOffset + 1; //!< Index of the saturation of the non-wetting/wetting phase
// indices of the primary variables
static const int pwIdx = PVOffset + 0; //!< Pressure index of the wetting phase
static const int SnIdx = PVOffset + 1; //!< Saturation index of the wetting phase
// indices of the equations
static const int contiWEqIdx = PVOffset + 0; //!< Index of the continuity equation of the wetting phase
static const int contiNEqIdx = PVOffset + 1; //!< Index of the continuity equation of the non-wetting phase
};
/*!
* \brief The indices for the \f$p_w-S_n\f$ formulation of the
* isothermal two-phase model.
*
* \tparam PVOffset The first index in a primary variable vector.
*/
template <int PVOffset>
struct TwoPIndices<TwoPCommonIndices::pnSw, PVOffset>
: public TwoPCommonIndices
{
// Primary variable indices
static const int pressureIdx = PVOffset + 0; //!< Index for wetting/non-wetting phase pressure (depending on formulation) in a solution vector
static const int saturationIdx = PVOffset + 1; //!< Index of the saturation of the non-wetting/wetting phase
// indices of the primary variables
static const int pnIdx = PVOffset + 0; //!< Pressure index of the wetting phase
static const int SwIdx = PVOffset + 1; //!< Saturation index of the wetting phase
// indices of the equations
static const int contiNEqIdx = PVOffset + 0; //!< Index of the continuity equation of the non-wetting phase
static const int contiWEqIdx = PVOffset + 1; //!< Index of the continuity equation of the wetting phase
};
// \}
namespace Properties
{
//////////////////////////////////////////////////////////////////
......@@ -172,8 +112,8 @@ SET_BOOL_PROP(BoxTwoP, EnablePartialReassemble, true);
// enable time-step ramp up by default
SET_BOOL_PROP(BoxTwoP, EnableTimeStepRampUp, false);
// \}
}
// \}
}
......
......@@ -25,6 +25,8 @@
#include "2pproperties.hh"
#include "2pfluidstate.hh"
#include <dumux/boxmodels/common/boxvolumevariables.hh>
#include <dune/common/fvector.hh>
namespace Dumux
......@@ -36,8 +38,10 @@ namespace Dumux
* finite volume in the two-phase model.
*/
template <class TypeTag>
class TwoPVolumeVariables
class TwoPVolumeVariables : public BoxVolumeVariables<TypeTag>
{
typedef BoxVolumeVariables<TypeTag> ParentType;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(GridView)) GridView;
......@@ -93,7 +97,12 @@ public:
int scvIdx,
bool isOldSol)
{
primaryVars_ = priVars;
ParentType::update(priVars,
problem,
element,
elemGeom,
scvIdx,
isOldSol);
asImp().updateTemperature_(priVars,
element,
......@@ -145,18 +154,6 @@ public:
scvIdx);
}
/*!
* \brief Return the vector of primary variables
*/
const PrimaryVariables &primaryVars() const
{ return primaryVars_; }
/*!
* \brief Sets the evaluation point used in the by the local jacobian.
*/
void setEvalPoint(const Implementation *ep)
{ }
/*!
* \brief Returns the phase state for the control-volume.
*/
......@@ -223,7 +220,6 @@ protected:
temperature_ = problem.temperature(element, elemGeom, scvIdx);
}
PrimaryVariables primaryVars_;
FluidState fluidState_;
Scalar porosity_;
Scalar temperature_;
......
......@@ -26,6 +26,7 @@
#include "boxelementboundarytypes.hh"
#include "boxlocaljacobian.hh"
#include "boxelementvolumevariables.hh"
#include "boxvolumevariables.hh"
#include <dune/pdelab/finiteelementmap/p1fem.hh>
#include <dune/pdelab/finiteelementmap/q1fem.hh>
......@@ -173,6 +174,13 @@ public:
SET_PROP(BoxModel, PrimaryVariables)
{ typedef typename GET_PROP_TYPE(TypeTag, PTAG(SolutionVector))::block_type type; };
/*!
* \brief The volume variable class.
*
* This should almost certainly be overloaded by the model...
*/
SET_TYPE_PROP(BoxModel, VolumeVariables, Dumux::BoxVolumeVariables<TypeTag>);
/*!
* \brief An array of secondary variable containers.
*/
......
......@@ -29,8 +29,7 @@
namespace Dumux
{
/*!
* \brief A much simpler (and thus potentially less buggy) version of
* pure water.
* \brief A much simple component for an exemplary dense NAPL (TCE).
*/
template <class Scalar>
class SimpleDNAPL : public Component<Scalar, SimpleDNAPL<Scalar> >
......@@ -39,89 +38,75 @@ class SimpleDNAPL : public Component<Scalar, SimpleDNAPL<Scalar> >
public:
/*!
* \brief A human readable name for the water.
* \brief A human readable name for the TCE.
*/
static const char *name()
{ return "DNAPL"; }
{ return "TCE"; }
/*!
* \brief The mass in [kg] of one mole of DNAPL.
* \brief The mass in [kg] of one mole of TCE.
*/
static Scalar molarMass()
{
DUNE_THROW(Dune::NotImplemented, "molarMass for DNAPL");
return 0;
DUNE_THROW(Dune::NotImplemented, "molarMass for TCE");
};
/*!
* \brief Returns the critical temperature [K] of DNAPL
* \brief Returns the critical temperature [K] of TCE
*/
static Scalar criticalTemperature()
{
DUNE_THROW(Dune::NotImplemented, "criticalTemperature for DNAPL");
return 0;
DUNE_THROW(Dune::NotImplemented, "criticalTemperature for TCE");
};
/*!
* \brief Returns the critical pressure [Pa] of DNAPL
* \brief Returns the critical pressure [Pa] of TCE
*/
static Scalar criticalPressure()
{
DUNE_THROW(Dune::NotImplemented, "criticalPressure for DNAPL");
return 0;
DUNE_THROW(Dune::NotImplemented, "criticalPressure for TCE");
};
/*!
* \brief Returns the temperature [K]at DNAPL's triple point.
* \brief Returns the temperature [K]at TCE's triple point.
*/
static Scalar tripleTemperature()
{
DUNE_THROW(Dune::NotImplemented, "tripleTemperature for DNAPL");
return 0;
DUNE_THROW(Dune::NotImplemented, "tripleTemperature for TCE");
};
/*!
* \brief Returns the pressure [Pa] at DNAPL's triple point.
* \brief Returns the pressure [Pa] at TCE's triple point.
*/
static Scalar triplePressure()
{
DUNE_THROW(Dune::NotImplemented, "triplePressure for DNAPL");
return 0;
DUNE_THROW(Dune::NotImplemented, "triplePressure for TCE");
};
/*!
* \brief The vapor pressure in [N/m^2] of pure DNAPL
* \brief The vapor pressure in [N/m^2] of pure TCE
* at a given temperature.
*
* See:
*
* IAPWS: "Revised Release on the IAPWS Industrial Formulation
* 1997 for the Thermodynamic Properties of Water and Steam",
* http://www.iapws.org/relguide/IF97-Rev.pdf
*/
static Scalar vaporPressure(Scalar T)
{
DUNE_THROW(Dune::NotImplemented, "vaporPressure for DNAPL");
return 0;
DUNE_THROW(Dune::NotImplemented, "vaporPressure for TCE");
};
/*!
* \brief Specific enthalpy of DNAPL steam [J/kg].
* \brief Specific enthalpy of TCE steam [J/kg].
*/
static const Scalar gasEnthalpy(Scalar temperature,
Scalar pressure)
{
DUNE_THROW(Dune::NotImplemented, "gasEnthalpy for DNAPL");
return 0;
DUNE_THROW(Dune::NotImplemented, "gasEnthalpy for TCE");
};
/*!
* \brief Specific enthalpy of liquid DNAPL [J/kg].
* \brief Specific enthalpy of liquid TCE [J/kg].
*/
static const Scalar liquidEnthalpy(Scalar temperature,
Scalar pressure)
{
DUNE_THROW(Dune::NotImplemented, "liquidEnthalpy for DNAPL");
return 0;
DUNE_THROW(Dune::NotImplemented, "liquidEnthalpy for TCE");
};
/*!
......@@ -129,12 +114,11 @@ public:
*/
static Scalar gasDensity(Scalar temperature, Scalar pressure)
{
DUNE_THROW(Dune::NotImplemented, "gasDensity for DNAPL");
return 0;
DUNE_THROW(Dune::NotImplemented, "gasDensity for TCE");
};
/*!
* \brief The density of pure DNAPL at a given pressure and temperature [kg/m^3].
* \brief The density of pure TCE at a given pressure and temperature [kg/m^3].
*/
static Scalar liquidDensity(Scalar temperature, Scalar pressure)
{
......@@ -146,16 +130,15 @@ public:
*/
static Scalar gasViscosity(Scalar temperature, Scalar pressure, bool regularize=true)
{
DUNE_THROW(Dune::NotImplemented, "gasViscosity for DNAPL");
return 0;
DUNE_THROW(Dune::NotImplemented, "gasViscosity for TCE");
};
/*!
* \brief The dynamic viscosity [N/m^3*s] of pure DNAPL.
* \brief The dynamic viscosity [N/m^3*s] of pure TCE.
*/
static Scalar liquidViscosity(Scalar temperature, Scalar pressure)
{
return 5.7e-4;//[kg/(ms)]
return 5.7e-4;//[Pa s]
};
};
......
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