tests, tutorials, lecture problems: make them all compile

This commit is contained in:
Andreas Lauser 2011-10-31 17:49:08 +01:00 committed by Andreas Lauser
parent dc920d9030
commit 2591f9cca0
2 changed files with 57 additions and 60 deletions

View File

@ -110,10 +110,18 @@ class TutorialProblemCoupled : public TwoPProblem<TypeTag> /*@\label{tutorial-co
// Dumux specific types // Dumux specific types
typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager; typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager;
typedef typename GET_PROP_TYPE(TypeTag, TwoPIndices) Indices;
typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables; typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables;
typedef typename GET_PROP_TYPE(TypeTag, BoundaryTypes) BoundaryTypes; typedef typename GET_PROP_TYPE(TypeTag, BoundaryTypes) BoundaryTypes;
typedef typename GET_PROP_TYPE(TypeTag, FVElementGeometry) FVElementGeometry; typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
typedef typename GET_PROP_TYPE(TypeTag, TwoPIndices) Indices;
// indices of the conservation equations
enum { contiWEqIdx = Indices::conti0EqIdx + FluidSystem::wPhaseIdx };
enum { contiNEqIdx = Indices::conti0EqIdx + FluidSystem::nPhaseIdx };
// indices of the primary variables
enum { pwIdx = Indices::pwIdx };
enum { SnIdx = Indices::SnIdx };
public: public:
TutorialProblemCoupled(TimeManager &timeManager) TutorialProblemCoupled(TimeManager &timeManager)
@ -142,25 +150,28 @@ public:
//! Returns the temperature within a finite volume. We use constant //! Returns the temperature within a finite volume. We use constant
//! 10 degrees Celsius. //! 10 degrees Celsius.
Scalar temperature() const template <class Context>
Scalar temperature(const Context &context, int localIdx) const
{ return 283.15; }; { return 283.15; };
//! Specifies which kind of boundary condition should be used for //! Specifies which kind of boundary condition should be used for
//! which equation for a finite volume on the boundary. //! which equation for a finite volume on the boundary.
void boundaryTypes(BoundaryTypes &BCtypes, const Vertex &vertex) const template <class Context>
void boundaryTypes(BoundaryTypes &bcTypes, const Context &context, int localIdx) const
{ {
const GlobalPosition &pos = vertex.geometry().center(); const GlobalPosition &pos = context.pos(localIdx);
if (pos[0] < eps_) // Dirichlet conditions on left boundary if (pos[0] < eps_) // Dirichlet conditions on left boundary
BCtypes.setAllDirichlet(); bcTypes.setAllDirichlet();
else // neuman for the remaining boundaries else // neuman for the remaining boundaries
BCtypes.setAllNeumann(); bcTypes.setAllNeumann();
} }
//! Evaluates the Dirichlet boundary conditions for a finite volume //! Evaluates the Dirichlet boundary conditions for a finite volume
//! on the grid boundary. Here, the 'values' parameter stores //! on the grid boundary. Here, the 'values' parameter stores
//! primary variables. //! primary variables.
void dirichlet(PrimaryVariables &values, const Vertex &vertex) const template <class Context>
void dirichlet(PrimaryVariables &values, const Context &context, int localIdx) const
{ {
values[Indices::pwIdx] = 200.0e3; // 200 kPa = 2 bar values[Indices::pwIdx] = 200.0e3; // 200 kPa = 2 bar
values[Indices::SnIdx] = 0.0; // 0 % oil saturation on left boundary values[Indices::SnIdx] = 0.0; // 0 % oil saturation on left boundary
@ -169,51 +180,41 @@ public:
//! Evaluates the boundary conditions for a Neumann boundary //! Evaluates the boundary conditions for a Neumann boundary
//! segment. Here, the 'values' parameter stores the mass flux in //! segment. Here, the 'values' parameter stores the mass flux in
//! [kg/(m^2 * s)] in normal direction of each phase. Negative //! [kg/(m^2 * s)] in normal direction of each phase. Negative
//! values mean influx. template <class Context>
void neumann(PrimaryVariables &values, void neumann(PrimaryVariables &values, const Context &context, int localIdx) const
const Element &element,
const FVElementGeometry &fvElemGeom,
const Intersection &isIt,
int scvIdx,
int boundaryFaceIdx) const
{ {
const GlobalPosition &pos = const GlobalPosition &pos = context.pos(localIdx);
fvElemGeom.boundaryFace[boundaryFaceIdx].ipGlobal;
Scalar right = this->bboxMax()[0]; Scalar right = this->bboxMax()[0];
// extraction of oil on the right boundary for approx. 1.e6 seconds // extraction of oil on the right boundary for approx. 1.e6 seconds
if (pos[0] > right - eps_) { if (pos[0] > right - eps_) {
// oil outflux of 30 g/(m * s) on the right boundary. // oil outflux of 30 g/(m * s) on the right boundary.
values[Indices::contiWEqIdx] = 0; values[contiWEqIdx] = 0;
values[Indices::contiNEqIdx] = 3e-2; values[contiNEqIdx] = 3e-2;
} else { } else {
// no-flow on the remaining Neumann-boundaries. // no-flow on the remaining Neumann-boundaries.
values[Indices::contiWEqIdx] = 0; values[contiWEqIdx] = 0;
values[Indices::contiNEqIdx] = 0; values[contiNEqIdx] = 0;
} }
} }
//! Evaluates the initial value for a control volume. For this
//! method, the 'values' parameter stores primary variables.
void initial(PrimaryVariables &values,
const Element &element,
const FVElementGeometry &fvElemGeom,
int scvIdx) const
{
values[Indices::pwIdx] = 200.0e3; // 200 kPa = 2 bar
values[Indices::SnIdx] = 1.0;
}
//! Evaluates the source term for all phases within a given //! Evaluates the source term for all phases within a given
//! sub-control-volume. In this case, the 'values' parameter //! sub-control-volume. In this case, the 'values' parameter
//! stores the rate mass generated or annihilated per volume unit //! stores the rate mass generated or annihilated per volume unit
//! in [kg / (m^3 * s)]. Positive values mean that mass is created. //! in [kg / (m^3 * s)]. Positive values mean that mass is created.
void source(PrimaryVariables &values, template <class Context>
const Element &element, void source(PrimaryVariables &values, const Context &context, int localIdx) const
const FVElementGeometry &fvElemGeom,
int scvIdx) const
{ {
values[Indices::contiWEqIdx] = 0.0; values[contiWEqIdx] = 0.0;
values[Indices::contiNEqIdx]= 0.0; values[contiNEqIdx]= 0.0;
}
// Evaluates the initial value for a control volume. For this
// method, the 'values' parameter stores primary variables.
template <class Context>
void initial(PrimaryVariables &values, const Context &context, int localIdx) const
{
values[pwIdx] = 200.0e3; // 200 kPa = 2 bar
values[SnIdx] = 1.0;
} }
private: private:

View File

@ -81,6 +81,7 @@ class TutorialSpatialParametersCoupled: public BoxSpatialParameters<TypeTag> /*@
dim = Grid::dimension, dim = Grid::dimension,
dimWorld = Grid::dimensionworld dimWorld = Grid::dimensionworld
}; };
typedef Dune::FieldMatrix<Scalar, dim, dim> Tensor;
// Get object types for function arguments // Get object types for function arguments
typedef typename GET_PROP_TYPE(TypeTag, FVElementGeometry) FVElementGeometry; typedef typename GET_PROP_TYPE(TypeTag, FVElementGeometry) FVElementGeometry;
@ -95,52 +96,47 @@ public:
/*! Intrinsic permeability tensor K \f$[m^2]\f$ depending /*! Intrinsic permeability tensor K \f$[m^2]\f$ depending
* on the position in the domain * on the position in the domain
* *
* \param element The finite volume element * \param context The execution context
* \param fvElemGeom The finite-volume geometry in the box scheme * \param scvIdx The local index of the degree of freedom
* \param scvIdx The local vertex index
* *
* Alternatively, the function intrinsicPermeabilityAtPos(const GlobalPosition& globalPos) * Alternatively, the function intrinsicPermeabilityAtPos(const GlobalPosition& globalPos)
* could be defined, where globalPos is the vector including the global coordinates * could be defined, where globalPos is the vector including the global coordinates
* of the finite volume. * of the finite volume.
*/ */
const Dune::FieldMatrix<Scalar, dim, dim> &intrinsicPermeability(const Element &element, /*@\label{tutorial-coupled:permeability}@*/ template <class Context>
const FVElementGeometry &fvElemGeom, const Tensor &intrinsicPermeability(const Context &context, /*@\label{tutorial-coupled:permeability}@*/
int scvIdx) const int localIdx) const
{ return K_; } { return K_; }
/*! Defines the porosity \f$[-]\f$ of the porous medium depending /*! Defines the porosity \f$[-]\f$ of the porous medium depending
* on the position in the domain * on the position in the domain
* *
* \param element The finite volume element * \param context The execution context
* \param fvElemGeom The finite-volume geometry in the box scheme * \param scvIdx The local index of the degree of freedom
* \param scvIdx The local vertex index
* *
* Alternatively, the function porosityAtPos(const GlobalPosition& globalPos) * Alternatively, the function porosityAtPos(const GlobalPosition& globalPos)
* could be defined, where globalPos is the vector including the global coordinates * could be defined, where globalPos is the vector including the global coordinates
* of the finite volume. * of the finite volume.
*/ */
Scalar porosity(const Element &element, /*@\label{tutorial-coupled:porosity}@*/ template <class Context>
const FVElementGeometry &fvElemGeom, Scalar porosity(const Context &context, /*@\label{tutorial-coupled:porosity}@*/
int scvIdx) const int localIdx) const
{ return 0.2; } { return 0.2; }
/*! Returns the parameter object for the material law (i.e. Brooks-Corey) /*! Returns the parameter object for the material law (i.e. Brooks-Corey)
* depending on the position in the domain * depending on the position in the domain
* *
* \param element The finite volume element * \param context The execution context
* \param fvElemGeom The finite-volume geometry in the box scheme * \param scvIdx The local index of the degree of freedom
* \param scvIdx The local vertex index
* *
* Alternatively, the function materialLawParamsAtPos(const GlobalPosition& globalPos) * Alternatively, the function materialLawParamsAtPos(const GlobalPosition& globalPos)
* could be defined, where globalPos is the vector including the global coordinates * could be defined, where globalPos is the vector including the global coordinates
* of the finite volume. * of the finite volume.
*/ */
const MaterialLawParams& materialLawParams(const Element &element, /*@\label{tutorial-coupled:matLawParams}@*/ template <class Context>
const FVElementGeometry &fvElemGeom, const MaterialLawParams& materialLawParams(const Context &context, /*@\label{tutorial-coupled:matLawParams}@*/
int scvIdx) const int contextIdx) const
{ { return materialParams_; }
return materialParams_;
}
// constructor // constructor
TutorialSpatialParametersCoupled(const GridView& gridView) : TutorialSpatialParametersCoupled(const GridView& gridView) :
@ -162,7 +158,7 @@ public:
} }
private: private:
Dune::FieldMatrix<Scalar, dim, dim> K_; Tensor K_;
// Object that holds the values/parameters of the selected material law. // Object that holds the values/parameters of the selected material law.
MaterialLawParams materialParams_; /*@\label{tutorial-coupled:matParamsObject}@*/ MaterialLawParams materialParams_; /*@\label{tutorial-coupled:matParamsObject}@*/
}; };