update the tutorial for the coupled models

This commit is contained in:
Andreas Lauser
2012-07-12 21:24:53 +02:00
committed by Andreas Lauser
parent 7e14c1964f
commit 25aba6a3f2
5 changed files with 337 additions and 362 deletions
+41 -66
View File
@@ -2,7 +2,7 @@
// vi: set et ts=4 sw=4 sts=4:
/*****************************************************************************
* Copyright (C) 2008-2009 by Melanie Darcis, Klaus Mosthaf *
* Copyright (C) 2009 by Andreas Lauser *
* Copyright (C) 2009-2012 by Andreas Lauser *
* Institute for Modelling Hydraulic and Environmental Systems *
* University of Stuttgart, Germany *
* email: <givenname>.<name>@iws.uni-stuttgart.de *
@@ -28,54 +28,36 @@
#ifndef DUMUX_TUTORIAL_PROBLEM_COUPLED_HH // guardian macro /*@\label{tutorial-coupled:guardian1}@*/
#define DUMUX_TUTORIAL_PROBLEM_COUPLED_HH // guardian macro /*@\label{tutorial-coupled:guardian2}@*/
// the numerical model
// The numerical model
#include <dumux/boxmodels/2p/2pmodel.hh>
// the DUNE grid used
#include <dune/grid/sgrid.hh>
// The DUNE grid used
#include <dune/grid/yaspgrid.hh>
// spatialy dependent parameters
// Spatialy dependent parameters
#include "tutorialspatialparameters_coupled.hh"
// the components that are used
// The components that are used
#include <dumux/material/components/h2o.hh>
#include <dumux/material/components/oil.hh>
#include <dumux/common/structuredcubegridcreator.hh>
namespace Dumux
{
// forward declaration of the problem class
namespace Dumux{
// Forward declaration of the problem class
template <class TypeTag>
class TutorialProblemCoupled;
namespace Properties
{
// create a new type tag for the problem
namespace Properties {
// Create a new type tag for the problem
NEW_TYPE_TAG(TutorialProblemCoupled, INHERITS_FROM(BoxTwoP, TutorialSpatialParametersCoupled)); /*@\label{tutorial-coupled:create-type-tag}@*/
// Set the "Problem" property
SET_PROP(TutorialProblemCoupled, Problem) /*@\label{tutorial-coupled:set-problem}@*/
{ typedef Dumux::TutorialProblemCoupled<TypeTag> type;};
// 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}@*/
{
typedef typename type::ctype ctype;
Dune::FieldVector<int, 2> cellRes; // vector holding resolution of the grid
Dune::FieldVector<ctype, 2> lowerLeft(0.0); // Coordinate of lower left corner of the grid
Dune::FieldVector<ctype, 2> upperRight; // Coordinate of upper right corner of the grid
cellRes[0] = 100;
cellRes[1] = 1;
upperRight[0] = 300;
upperRight[1] = 60;
return new Dune::SGrid<2,2>(cellRes,
lowerLeft,
upperRight);
}
};
// Set grid and the grid creator to be used
SET_TYPE_PROP(TutorialProblemCoupled, Grid, Dune::YaspGrid</*dim=*/2>); /*@\label{tutorial-coupled:set-grid}@*/
SET_TYPE_PROP(TutorialProblemCoupled, GridCreator, Dumux::CubeGridCreator<TypeTag>); /*@\label{tutorial-coupled:set-grid}@*/
// Set the wetting phase
SET_PROP(TutorialProblemCoupled, WettingPhase) /*@\label{tutorial-coupled:2p-system-start}@*/
@@ -97,12 +79,10 @@ SET_BOOL_PROP(TutorialProblemCoupled, EnableGravity, false); /*@\label{tutorial-
}
/*!
* \ingroup TwoPBoxModel
*
* \brief Tutorial problem for a fully coupled twophase box model.
*/
// Definition of the actual problem
* \ingroup TwoPBoxModel
*
* \brief Tutorial problem for a fully coupled twophase box model.
*/
template <class TypeTag>
class TutorialProblemCoupled : public TwoPProblem<TypeTag> /*@\label{tutorial-coupled:def-problem}@*/
{
@@ -134,23 +114,17 @@ public:
{
}
// Specifies the problem name. This is used as a prefix for files
// generated by the simulation.
//! Specifies the problem name. This is used as a prefix for files
//! generated by the simulation.
const char *name() const
{ return "tutorial_coupled"; }
//! Returns true if a restart file should be written.
/* The default behaviour is to write no restart file.
*/
//! Returns true if a restart file should be written.
bool shouldWriteRestartFile() const /*@\label{tutorial-coupled:restart}@*/
{
return false;
}
{ return false; }
//! Returns true if the current solution should be written to disk (i.e. as a VTK file)
/*! The default behaviour is to write out the solution for
* every time step. Else, the user has to change the divisor in this function.
*/
//! Returns true if the current solution should be written to disk
//! as a VTK file
bool shouldWriteOutput() const /*@\label{tutorial-coupled:output}@*/
{
return
@@ -158,13 +132,13 @@ public:
(this->timeManager().timeStepIndex() % 1 == 0);
}
// Return the temperature within a finite volume. We use constant
// 10 degrees Celsius.
//! Return the temperature within a finite volume. We use constant
//! 10 degrees Celsius.
Scalar temperature() const
{ return 283.15; };
// Specifies which kind of boundary condition should be used for
// which equation for a finite volume on the boundary.
//! Specifies which kind of boundary condition should be used for
//! which equation for a finite volume on the boundary.
void boundaryTypes(BoundaryTypes &BCtypes, const Vertex &vertex) const
{
const GlobalPosition &pos = vertex.geometry().center();
@@ -175,18 +149,19 @@ public:
}
// Evaluate the Dirichlet boundary conditions for a finite volume
// on the grid boundary. Here, the 'values' parameter stores
// primary variables.
//! Evaluate the Dirichlet boundary conditions for a finite volume
//! on the grid boundary. Here, the 'values' parameter stores
//! primary variables.
void dirichlet(PrimaryVariables &values, const Vertex &vertex) const
{
values[Indices::pwIdx] = 200.0e3; // 200 kPa = 2 bar
values[Indices::SnIdx] = 0.0; // 0 % oil saturation on left boundary
}
// Evaluate the boundary conditions for a Neumann boundary
// segment. Here, the 'values' parameter stores the mass flux in
// normal direction of each phase. Negative values mean influx.
//! Evaluate the boundary conditions for a Neumann boundary
//! segment. Here, the 'values' parameter stores the mass flux in
//! [kg/(m^2 * s)] in normal direction of each phase. Negative
//! values mean influx.
void neumann(PrimaryVariables &values,
const Element &element,
const FVElementGeometry &fvElemGeom,
@@ -209,8 +184,8 @@ public:
}
}
// Evaluate the initial value for a control volume. For this
// method, the 'values' parameter stores primary variables.
//! Evaluate 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,
@@ -220,10 +195,10 @@ public:
values[Indices::SnIdx] = 1.0;
}
// Evaluate the source term for all phases within a given
// sub-control-volume. In this case, the 'values' parameter stores
// the rate mass generated or annihilate per volume unit. Positive
// values mean that mass is created.
//! Evaluate the source term for all phases within a given
//! sub-control-volume. In this case, the 'values' parameter
//! stores the rate mass generated or annihilate per volume unit
//! in [kg / (m^3 * s)]. Positive values mean that mass is created.
void source(PrimaryVariables &values,
const Element &element,
const FVElementGeometry &fvElemGeom,