2009-06-18 12:38:19 -05:00
|
|
|
// $Id$
|
2009-06-10 07:08:28 -05:00
|
|
|
/*****************************************************************************
|
|
|
|
* Copyright (C) 2008-2009 by Melanie Darcis *
|
|
|
|
* Copyright (C) 2009 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, as long as this copyright notice *
|
|
|
|
* is included in its original form. *
|
|
|
|
* *
|
|
|
|
* This program is distributed WITHOUT ANY WARRANTY. *
|
|
|
|
*****************************************************************************/
|
2010-03-25 08:02:05 -05:00
|
|
|
#ifndef DUMUX_TUTORIALPROBLEM_COUPLED_HH
|
|
|
|
#define DUMUX_TUTORIALPROBLEM_COUPLED_HH
|
2009-06-10 07:08:28 -05:00
|
|
|
|
|
|
|
// fluid properties
|
2010-04-07 04:49:17 -05:00
|
|
|
#include <dumux/new_material/fluidsystems/h2o_n2_system.hh>
|
2010-04-06 08:11:09 -05:00
|
|
|
|
2009-06-10 07:08:28 -05:00
|
|
|
// the numerical model
|
|
|
|
#include <dumux/boxmodels/2p/2pboxmodel.hh>
|
|
|
|
|
|
|
|
// the grid used
|
|
|
|
#include <dune/grid/yaspgrid.hh>
|
2009-06-18 11:46:37 -05:00
|
|
|
#include <dune/grid/io/file/dgfparser/dgfs.hh>
|
2009-06-10 07:08:28 -05:00
|
|
|
|
2010-04-07 04:49:17 -05:00
|
|
|
// assign parameters dependent on space (e.g. soil properties)
|
|
|
|
#include "tutorialspatialparameters_coupled.hh"
|
2009-06-10 07:08:28 -05:00
|
|
|
|
2010-03-25 08:02:05 -05:00
|
|
|
namespace Dumux
|
2009-06-10 07:08:28 -05:00
|
|
|
{
|
|
|
|
|
|
|
|
// forward declaration of the problem class
|
|
|
|
template <class TypeTag>
|
|
|
|
class TutorialProblemCoupled;
|
|
|
|
|
|
|
|
namespace Properties
|
|
|
|
{
|
|
|
|
// create a new type tag for the problem
|
2009-06-18 11:46:37 -05:00
|
|
|
NEW_TYPE_TAG(TutorialProblemCoupled, INHERITS_FROM(BoxTwoP)); /*@\label{tutorial-coupled:create-type-tag}@*/
|
2009-06-10 07:08:28 -05:00
|
|
|
|
|
|
|
// Set the "Problem" property
|
2009-06-18 11:46:37 -05:00
|
|
|
SET_PROP(TutorialProblemCoupled, Problem) /*@\label{tutorial-coupled:set-problem}@*/
|
2009-06-10 07:08:28 -05:00
|
|
|
{
|
2010-03-25 08:02:05 -05:00
|
|
|
typedef Dumux::TutorialProblemCoupled<TTAG(TutorialProblemCoupled)> type;
|
2009-06-10 07:08:28 -05:00
|
|
|
};
|
|
|
|
|
2009-06-18 11:46:37 -05:00
|
|
|
// Set the grid
|
|
|
|
SET_PROP(TutorialProblemCoupled, Grid) /*@\label{tutorial-coupled:set-grid}@*/
|
|
|
|
{
|
|
|
|
typedef Dune::SGrid<2,2> type;
|
|
|
|
static type *create() /*@\label{tutorial-coupled:create-grid-method}@*/
|
|
|
|
{
|
2010-04-06 04:47:25 -05:00
|
|
|
typedef typename type::ctype ctype;
|
2009-06-18 11:46:37 -05:00
|
|
|
Dune::FieldVector<int, 2> cellRes;
|
|
|
|
Dune::FieldVector<ctype, 2> lowerLeft(0.0);
|
|
|
|
Dune::FieldVector<ctype, 2> upperRight;
|
2009-08-05 09:11:46 -05:00
|
|
|
cellRes[0] = 30;
|
|
|
|
cellRes[1] = 10;
|
2009-06-18 11:46:37 -05:00
|
|
|
upperRight[0] = 300;
|
2009-08-05 09:11:46 -05:00
|
|
|
upperRight[1] = 60;
|
2009-06-18 11:46:37 -05:00
|
|
|
return new Dune::SGrid<2,2>(cellRes,
|
|
|
|
lowerLeft,
|
|
|
|
upperRight);
|
|
|
|
}
|
|
|
|
};
|
2009-06-10 07:08:28 -05:00
|
|
|
|
2010-04-07 04:49:17 -05:00
|
|
|
// Select fluid system
|
2010-04-12 10:00:00 -05:00
|
|
|
SET_PROP(TutorialProblemCoupled, FluidSystem) /*@\label{tutorial-coupled:set-fluidsystem}@*/
|
2010-04-07 04:49:17 -05:00
|
|
|
{
|
|
|
|
typedef Dumux::H2O_N2_System<TypeTag> type;
|
|
|
|
};
|
2010-04-06 04:47:25 -05:00
|
|
|
|
2010-04-12 10:00:00 -05:00
|
|
|
// Set the spatial parameters
|
|
|
|
SET_PROP(TutorialProblemCoupled, SpatialParameters) /*@\label{tutorial-coupled:set-spatialparameters}@*/
|
2009-06-10 07:08:28 -05:00
|
|
|
{
|
2010-05-25 08:27:16 -05:00
|
|
|
typedef Dumux::TutorialSpatialParametersCoupled<TypeTag> type;
|
2009-06-10 07:08:28 -05:00
|
|
|
};
|
|
|
|
|
2009-06-18 11:46:37 -05:00
|
|
|
// Disable gravity
|
|
|
|
SET_BOOL_PROP(TutorialProblemCoupled, EnableGravity, false); /*@\label{tutorial-coupled:gravity}@*/
|
2009-06-10 07:08:28 -05:00
|
|
|
}
|
|
|
|
|
2009-06-18 11:46:37 -05:00
|
|
|
// Definition of the actual problem
|
2009-06-10 07:08:28 -05:00
|
|
|
template <class TypeTag = TTAG(TutorialProblemCoupled) >
|
2009-06-18 11:46:37 -05:00
|
|
|
class TutorialProblemCoupled : public TwoPBoxProblem<TypeTag, /*@\label{tutorial-coupled:def-problem}@*/
|
2009-06-10 07:08:28 -05:00
|
|
|
TutorialProblemCoupled<TypeTag> >
|
|
|
|
{
|
|
|
|
typedef TutorialProblemCoupled<TypeTag> ThisType;
|
|
|
|
typedef TwoPBoxProblem<TypeTag, ThisType> ParentType;
|
|
|
|
typedef typename GET_PROP_TYPE(TypeTag, PTAG(GridView)) GridView;
|
|
|
|
|
|
|
|
// Grid and world dimension
|
|
|
|
enum {
|
|
|
|
dim = GridView::dimension,
|
|
|
|
dimWorld = GridView::dimensionworld,
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef typename GridView::Grid::ctype CoordScalar;
|
|
|
|
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
|
|
|
|
|
|
|
|
typedef typename GET_PROP_TYPE(TypeTag, PTAG(TwoPIndices)) Indices;
|
|
|
|
typedef typename GridView::template Codim<0>::Entity Element;
|
|
|
|
typedef typename GridView::template Codim<dim>::Entity Vertex;
|
2009-11-02 08:02:06 -06:00
|
|
|
typedef typename GridView::Intersection Intersection;
|
2009-06-10 07:08:28 -05:00
|
|
|
typedef Dune::FieldVector<CoordScalar, dim> LocalPosition;
|
|
|
|
typedef Dune::FieldVector<CoordScalar, dimWorld> GlobalPosition;
|
|
|
|
|
|
|
|
typedef typename GET_PROP(TypeTag, PTAG(SolutionTypes)) SolutionTypes;
|
|
|
|
typedef typename SolutionTypes::PrimaryVarVector PrimaryVarVector;
|
|
|
|
typedef typename SolutionTypes::BoundaryTypeVector BoundaryTypeVector;
|
|
|
|
typedef typename GET_PROP_TYPE(TypeTag, PTAG(FVElementGeometry)) FVElementGeometry;
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
TutorialProblemCoupled(const GridView &gridView)
|
|
|
|
: ParentType(gridView)
|
2009-06-18 11:46:37 -05:00
|
|
|
{}
|
2009-06-10 07:08:28 -05:00
|
|
|
|
2009-06-18 11:46:37 -05:00
|
|
|
// Return the temperature within the domain. We use 10 degrees Celsius.
|
2009-11-02 08:02:06 -06:00
|
|
|
Scalar temperature(const Element &element,
|
|
|
|
const FVElementGeometry &fvElemGeom,
|
|
|
|
int scvIdx) const
|
2009-06-10 07:08:28 -05:00
|
|
|
{ return 283.15; };
|
|
|
|
|
2009-06-18 11:46:37 -05:00
|
|
|
// Specifies which kind of boundary condition should be used for
|
|
|
|
// which equation on a given boundary segment.
|
2010-04-12 10:00:00 -05:00
|
|
|
void boundaryTypes(BoundaryTypeVector &BCtype,
|
2009-06-10 07:08:28 -05:00
|
|
|
const Element &element,
|
|
|
|
const FVElementGeometry &fvElemGeom,
|
2009-11-02 08:02:06 -06:00
|
|
|
const Intersection &isIt,
|
2009-06-10 07:08:28 -05:00
|
|
|
int scvIdx,
|
|
|
|
int boundaryFaceIdx) const
|
|
|
|
{
|
|
|
|
const GlobalPosition &pos = element.geometry().corner(scvIdx);
|
2009-06-18 11:46:37 -05:00
|
|
|
if (pos[0] < eps_) // dirichlet conditions on left boundary
|
2010-04-12 10:00:00 -05:00
|
|
|
BCtype.setAllDirichlet();
|
2009-06-18 11:46:37 -05:00
|
|
|
else // neuman for the remaining boundaries
|
2010-04-12 10:00:00 -05:00
|
|
|
BCtype.setAllNeumann();
|
2009-06-10 07:08:28 -05:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2009-06-18 11:46:37 -05:00
|
|
|
// Evaluate the boundary conditions for a dirichlet boundary
|
|
|
|
// segment. For this method, the 'values' parameter stores
|
|
|
|
// primary variables.
|
2009-06-10 07:08:28 -05:00
|
|
|
void dirichlet(PrimaryVarVector &values,
|
|
|
|
const Element &element,
|
|
|
|
const FVElementGeometry &fvElemGeom,
|
2009-11-02 08:02:06 -06:00
|
|
|
const Intersection &isIt,
|
2009-06-10 07:08:28 -05:00
|
|
|
int scvIdx,
|
|
|
|
int boundaryFaceIdx) const
|
|
|
|
{
|
2010-04-06 04:47:25 -05:00
|
|
|
values[Indices::pwIdx] = 200.0e3; // 200 kPa = 2 bar
|
|
|
|
values[Indices::SnIdx] = 0.0; // 0 % oil saturation on left boundary
|
2009-06-10 07:08:28 -05:00
|
|
|
}
|
|
|
|
|
2009-06-18 11:46:37 -05:00
|
|
|
// Evaluate the boundary conditions for a neumann boundary
|
|
|
|
// segment. For this method, the 'values' parameter stores the
|
|
|
|
// mass flux in normal direction of each phase. Negative values
|
|
|
|
// mean influx.
|
2009-06-10 07:08:28 -05:00
|
|
|
void neumann(PrimaryVarVector &values,
|
|
|
|
const Element &element,
|
|
|
|
const FVElementGeometry &fvElemGeom,
|
2009-11-02 08:02:06 -06:00
|
|
|
const Intersection &isIt,
|
2009-06-10 07:08:28 -05:00
|
|
|
int scvIdx,
|
|
|
|
int boundaryFaceIdx) const
|
|
|
|
{
|
2009-08-05 09:11:46 -05:00
|
|
|
const GlobalPosition &pos =
|
|
|
|
fvElemGeom.boundaryFace[boundaryFaceIdx].ipGlobal;
|
2009-06-10 07:36:33 -05:00
|
|
|
Scalar right = this->bboxMax()[0];
|
|
|
|
if (pos[0] > right - eps_) {
|
2009-08-05 09:11:46 -05:00
|
|
|
// oil outflux of 0.3 g/(m * s) on the right boundary of
|
|
|
|
// the domain.
|
2010-04-06 04:47:25 -05:00
|
|
|
values[Indices::contiWEqIdx] = 0;
|
|
|
|
values[Indices::contiNEqIdx] = 0.3e-3;
|
2009-06-10 07:08:28 -05:00
|
|
|
} else {
|
|
|
|
// no-flow on the remaining neumann-boundaries
|
2010-04-06 04:47:25 -05:00
|
|
|
values[Indices::contiWEqIdx] = 0;
|
|
|
|
values[Indices::contiNEqIdx] = 0;
|
2009-06-10 07:08:28 -05:00
|
|
|
}
|
|
|
|
}
|
2009-06-18 11:46:37 -05:00
|
|
|
|
|
|
|
// Evaluate the initial value for a control volume. For this
|
|
|
|
// method, the 'values' parameter stores primary variables.
|
2009-06-10 07:08:28 -05:00
|
|
|
void initial(PrimaryVarVector &values,
|
|
|
|
const Element &element,
|
|
|
|
const FVElementGeometry &fvElemGeom,
|
|
|
|
int scvIdx) const
|
|
|
|
{
|
2010-04-06 04:47:25 -05:00
|
|
|
values[Indices::pwIdx] = 200.0e3; // 200 kPa = 2 bar
|
|
|
|
values[Indices::SnIdx] = 1.0;
|
2009-06-10 07:08:28 -05:00
|
|
|
}
|
|
|
|
|
2009-06-18 11:46:37 -05:00
|
|
|
// Evaluate the source term for all phases within a given
|
|
|
|
// sub-control-volume. For this method, the \a values parameter
|
|
|
|
// stores the rate mass generated or annihilate per volume
|
|
|
|
// unit. Positive values mean that mass is created, negative ones
|
|
|
|
// mean that it vanishes.
|
2009-06-10 07:08:28 -05:00
|
|
|
void source(PrimaryVarVector &values,
|
|
|
|
const Element &element,
|
2009-06-18 11:46:37 -05:00
|
|
|
const FVElementGeometry &fvElemGeom,
|
|
|
|
int scvIdx) const
|
2009-06-10 07:08:28 -05:00
|
|
|
{
|
2010-04-06 04:47:25 -05:00
|
|
|
values[Indices::contiWEqIdx] = 0.0;
|
|
|
|
values[Indices::contiNEqIdx]= 0.0;
|
2009-06-10 07:08:28 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
static const Scalar eps_ = 3e-6;
|
|
|
|
};
|
2009-06-18 11:46:37 -05:00
|
|
|
}
|
2009-06-10 07:08:28 -05:00
|
|
|
|
|
|
|
#endif
|