2010-08-24 06:11:18 -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-06-24 01:28:17 -05:00
|
|
|
#include <dumux/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
|
2010-08-03 12:11:34 -05:00
|
|
|
#include <dumux/boxmodels/2p/2pmodel.hh>
|
2009-06-10 07:08:28 -05:00
|
|
|
|
|
|
|
// 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-08-05 07:11:43 -05:00
|
|
|
// assign parameters dependent on space (e.g. spatial parameters)
|
2010-04-07 04:49:17 -05:00
|
|
|
#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}@*/
|
2010-06-15 04:52:10 -05:00
|
|
|
{
|
2009-06-18 11:46:37 -05:00
|
|
|
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) >
|
2010-08-03 12:11:34 -05:00
|
|
|
class TutorialProblemCoupled : public TwoPProblem<TypeTag> /*@\label{tutorial-coupled:def-problem}@*/
|
2009-06-10 07:08:28 -05:00
|
|
|
{
|
2010-08-03 12:11:34 -05:00
|
|
|
typedef TutorialProblemCoupled<TypeTag> ThisType;
|
|
|
|
typedef TwoPProblem<TypeTag> ParentType;
|
|
|
|
typedef typename GET_PROP_TYPE(TypeTag, PTAG(GridView)) GridView;
|
|
|
|
typedef typename GET_PROP_TYPE(TypeTag, PTAG(TimeManager)) TimeManager;
|
2009-06-10 07:08:28 -05:00
|
|
|
|
|
|
|
// Grid and world dimension
|
2010-06-15 04:52:10 -05:00
|
|
|
enum {
|
2010-08-03 12:11:34 -05:00
|
|
|
dim = GridView::dimension,
|
|
|
|
dimWorld = GridView::dimensionworld,
|
2009-06-10 07:08:28 -05:00
|
|
|
};
|
|
|
|
|
2010-08-03 12:11:34 -05:00
|
|
|
typedef typename GridView::Grid::ctype CoordScalar;
|
|
|
|
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
|
2009-06-10 07:08:28 -05:00
|
|
|
|
|
|
|
typedef typename GET_PROP_TYPE(TypeTag, PTAG(TwoPIndices)) Indices;
|
2010-08-03 12:11:34 -05:00
|
|
|
typedef typename GridView::template Codim<0>::Entity Element;
|
|
|
|
typedef typename GridView::template Codim<dim>::Entity Vertex;
|
|
|
|
typedef typename GridView::Intersection Intersection;
|
|
|
|
typedef Dune::FieldVector<CoordScalar, dim> LocalPosition;
|
|
|
|
typedef Dune::FieldVector<CoordScalar, dimWorld> GlobalPosition;
|
|
|
|
|
2010-08-05 07:11:43 -05:00
|
|
|
typedef typename GET_PROP_TYPE(TypeTag, PTAG(PrimaryVariables)) PrimaryVariables;
|
2010-08-03 12:11:34 -05:00
|
|
|
typedef typename GET_PROP_TYPE(TypeTag, PTAG(BoundaryTypes)) BoundaryTypes;
|
2009-06-10 07:08:28 -05:00
|
|
|
typedef typename GET_PROP_TYPE(TypeTag, PTAG(FVElementGeometry)) FVElementGeometry;
|
2010-10-15 10:11:37 -05:00
|
|
|
typedef typename GET_PROP_TYPE(TypeTag, PTAG(FluidSystem)) FluidSystem;
|
2010-08-05 07:11:43 -05:00
|
|
|
|
2009-06-10 07:08:28 -05:00
|
|
|
public:
|
2010-08-03 12:11:34 -05:00
|
|
|
TutorialProblemCoupled(TimeManager &timeManager,
|
|
|
|
const GridView &gridView)
|
|
|
|
: ParentType(timeManager, gridView)
|
2010-10-15 10:11:37 -05:00
|
|
|
{
|
|
|
|
// initialize the tables of the fluid system
|
|
|
|
FluidSystem::init();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief The problem name.
|
|
|
|
*
|
|
|
|
* This is used as a prefix for files generated by the simulation.
|
|
|
|
*/
|
|
|
|
const char *name() const
|
|
|
|
{ return "tutorial_coupled"; }
|
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.
|
2010-08-03 12:11:34 -05:00
|
|
|
Scalar temperature(const Element &element,
|
2009-11-02 08:02:06 -06:00
|
|
|
const FVElementGeometry &fvElemGeom,
|
2010-08-03 12:11:34 -05:00
|
|
|
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-10-15 08:37:28 -05:00
|
|
|
void boundaryTypes(BoundaryTypes &BCtype, const Vertex &vertex) const
|
2010-06-15 04:52:10 -05:00
|
|
|
{
|
2010-10-15 08:37:28 -05:00
|
|
|
const GlobalPosition &pos = vertex.geometry().center();
|
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.
|
2010-10-15 08:37:28 -05:00
|
|
|
void dirichlet(PrimaryVariables &values, const Vertex &vertex) const
|
2009-06-10 07:08:28 -05:00
|
|
|
{
|
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.
|
2010-08-05 07:11:43 -05:00
|
|
|
void neumann(PrimaryVariables &values,
|
2010-08-03 12:11:34 -05:00
|
|
|
const Element &element,
|
|
|
|
const FVElementGeometry &fvElemGeom,
|
|
|
|
const Intersection &isIt,
|
|
|
|
int scvIdx,
|
|
|
|
int boundaryFaceIdx) const
|
2009-06-10 07:08:28 -05:00
|
|
|
{
|
2010-06-15 04:52:10 -05:00
|
|
|
const GlobalPosition &pos =
|
2009-08-05 09:11:46 -05:00
|
|
|
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.
|
2010-08-05 07:11:43 -05:00
|
|
|
void initial(PrimaryVariables &values,
|
2010-08-03 12:11:34 -05:00
|
|
|
const Element &element,
|
2009-06-10 07:08:28 -05:00
|
|
|
const FVElementGeometry &fvElemGeom,
|
2010-08-03 12:11:34 -05:00
|
|
|
int scvIdx) const
|
2009-06-10 07:08:28 -05:00
|
|
|
{
|
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.
|
2010-08-05 07:11:43 -05:00
|
|
|
void source(PrimaryVariables &values,
|
2010-08-03 12:11:34 -05:00
|
|
|
const Element &element,
|
2009-06-18 11:46:37 -05:00
|
|
|
const FVElementGeometry &fvElemGeom,
|
2010-08-03 12:11:34 -05:00
|
|
|
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
|