mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
doc: (almost) finish the design patterns chapter in the handbook
also remove the ReferenceElements property because changing to the old DUNE entity numbering would not work anyways...
This commit is contained in:
committed by
Andreas Lauser
parent
99e13c14fe
commit
02ddfea028
@@ -17,17 +17,13 @@
|
||||
#ifndef DUMUX_TUTORIALPROBLEM_COUPLED_HH
|
||||
#define DUMUX_TUTORIALPROBLEM_COUPLED_HH
|
||||
|
||||
// fluid properties
|
||||
#include <dumux/material/fluidsystems/2p_system.hh>
|
||||
|
||||
// the numerical model
|
||||
#include <dumux/boxmodels/2p/2pmodel.hh>
|
||||
|
||||
// the grid used
|
||||
#include <dune/grid/yaspgrid.hh>
|
||||
#include <dune/grid/io/file/dgfparser/dgfs.hh>
|
||||
// the DUNE grid used
|
||||
#include <dune/grid/sgrid.hh>
|
||||
|
||||
// assign parameters dependent on space (e.g. spatial parameters)
|
||||
// spatialy dependent parameters
|
||||
#include "tutorialspatialparameters_coupled.hh"
|
||||
|
||||
namespace Dumux
|
||||
@@ -44,9 +40,7 @@ NEW_TYPE_TAG(TutorialProblemCoupled, INHERITS_FROM(BoxTwoP)); /*@\label{tutorial
|
||||
|
||||
// Set the "Problem" property
|
||||
SET_PROP(TutorialProblemCoupled, Problem) /*@\label{tutorial-coupled:set-problem}@*/
|
||||
{
|
||||
typedef Dumux::TutorialProblemCoupled<TTAG(TutorialProblemCoupled)> type;
|
||||
};
|
||||
{ typedef Dumux::TutorialProblemCoupled<TypeTag> type;};
|
||||
|
||||
// Set the grid
|
||||
SET_PROP(TutorialProblemCoupled, Grid) /*@\label{tutorial-coupled:set-grid}@*/
|
||||
@@ -71,61 +65,49 @@ SET_PROP(TutorialProblemCoupled, Grid) /*@\label{tutorial-coupled:set-grid}@*/
|
||||
// Set the wetting phase
|
||||
SET_PROP(TutorialProblemCoupled, WettingPhase) /*@\label{tutorial-coupled:2p-system-start}@*/
|
||||
{
|
||||
private:
|
||||
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
|
||||
public:
|
||||
typedef Dumux::LiquidPhase<Scalar, Dumux::H2O<Scalar> > type; /*@\label{tutorial-coupled:wettingPhase}@*/
|
||||
private: typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
|
||||
public: typedef Dumux::LiquidPhase<Scalar, Dumux::H2O<Scalar> > type; /*@\label{tutorial-coupled:wettingPhase}@*/
|
||||
};
|
||||
|
||||
// Set the non-wetting phase
|
||||
SET_PROP(TutorialProblemCoupled, NonwettingPhase)
|
||||
{
|
||||
private:
|
||||
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
|
||||
public:
|
||||
typedef Dumux::LiquidPhase<Scalar, Dumux::Oil<Scalar> > type; /*@\label{tutorial-coupled:nonwettingPhase}@*/
|
||||
private: typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
|
||||
public: typedef Dumux::LiquidPhase<Scalar, Dumux::Oil<Scalar> > type; /*@\label{tutorial-coupled:nonwettingPhase}@*/
|
||||
}; /*@\label{tutorial-coupled:2p-system-end}@*/
|
||||
|
||||
|
||||
// Set the spatial parameters
|
||||
SET_PROP(TutorialProblemCoupled, SpatialParameters) /*@\label{tutorial-coupled:set-spatialparameters}@*/
|
||||
{
|
||||
typedef Dumux::TutorialSpatialParametersCoupled<TypeTag> type;
|
||||
};
|
||||
{ typedef Dumux::TutorialSpatialParametersCoupled<TypeTag> type; };
|
||||
|
||||
// Disable gravity
|
||||
SET_BOOL_PROP(TutorialProblemCoupled, EnableGravity, false); /*@\label{tutorial-coupled:gravity}@*/
|
||||
}
|
||||
|
||||
// Definition of the actual problem
|
||||
template <class TypeTag = TTAG(TutorialProblemCoupled) >
|
||||
template <class TypeTag>
|
||||
class TutorialProblemCoupled : public TwoPProblem<TypeTag> /*@\label{tutorial-coupled:def-problem}@*/
|
||||
{
|
||||
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;
|
||||
|
||||
// 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(GridView)) GridView;
|
||||
|
||||
typedef typename GET_PROP_TYPE(TypeTag, PTAG(TwoPIndices)) Indices;
|
||||
// Grid dimension
|
||||
enum { dim = GridView::dimension };
|
||||
|
||||
// Types from DUNE-Grid
|
||||
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;
|
||||
typedef Dune::FieldVector<Scalar, dim> GlobalPosition;
|
||||
|
||||
// Dumux specific types
|
||||
typedef typename GET_PROP_TYPE(TypeTag, PTAG(TimeManager)) TimeManager;
|
||||
typedef typename GET_PROP_TYPE(TypeTag, PTAG(TwoPIndices)) Indices;
|
||||
typedef typename GET_PROP_TYPE(TypeTag, PTAG(PrimaryVariables)) PrimaryVariables;
|
||||
typedef typename GET_PROP_TYPE(TypeTag, PTAG(BoundaryTypes)) BoundaryTypes;
|
||||
typedef typename GET_PROP_TYPE(TypeTag, PTAG(FVElementGeometry)) FVElementGeometry;
|
||||
typedef typename GET_PROP_TYPE(TypeTag, PTAG(FluidSystem)) FluidSystem;
|
||||
|
||||
public:
|
||||
TutorialProblemCoupled(TimeManager &timeManager,
|
||||
@@ -133,37 +115,35 @@ public:
|
||||
: ParentType(timeManager, gridView)
|
||||
{
|
||||
// initialize the tables of the fluid system
|
||||
FluidSystem::init();
|
||||
GET_PROP_TYPE(TypeTag, PTAG(FluidSystem))::init();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief The problem name.
|
||||
*
|
||||
* This is used as a prefix for files generated by the simulation.
|
||||
*/
|
||||
// Specified the problem name. This is used as a prefix for files
|
||||
// generated by the simulation.
|
||||
const char *name() const
|
||||
{ return "tutorial_coupled"; }
|
||||
|
||||
// Return the temperature within the domain. We use 10 degrees Celsius.
|
||||
// Return the temperature within a finite volume. We use constant
|
||||
// 10 degrees Celsius.
|
||||
Scalar temperature(const Element &element,
|
||||
const FVElementGeometry &fvElemGeom,
|
||||
int scvIdx) const
|
||||
{ return 283.15; };
|
||||
|
||||
// Specifies which kind of boundary condition should be used for
|
||||
// which equation on a given boundary segment.
|
||||
void boundaryTypes(BoundaryTypes &BCtype, const Vertex &vertex) const
|
||||
// which equation for a finite volume on the boundary.
|
||||
void boundaryTypes(BoundaryTypes &BCtypes, const Vertex &vertex) const
|
||||
{
|
||||
const GlobalPosition &pos = vertex.geometry().center();
|
||||
if (pos[0] < eps_) // dirichlet conditions on left boundary
|
||||
BCtype.setAllDirichlet();
|
||||
if (pos[0] < eps_) // Dirichlet conditions on left boundary
|
||||
BCtypes.setAllDirichlet();
|
||||
else // neuman for the remaining boundaries
|
||||
BCtype.setAllNeumann();
|
||||
BCtypes.setAllNeumann();
|
||||
|
||||
}
|
||||
|
||||
// Evaluate the boundary conditions for a dirichlet boundary
|
||||
// segment. For this method, the 'values' parameter stores
|
||||
// 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
|
||||
{
|
||||
@@ -171,10 +151,9 @@ public:
|
||||
values[Indices::SnIdx] = 0.0; // 0 % oil saturation on left boundary
|
||||
}
|
||||
|
||||
// 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.
|
||||
// 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.
|
||||
void neumann(PrimaryVariables &values,
|
||||
const Element &element,
|
||||
const FVElementGeometry &fvElemGeom,
|
||||
@@ -186,12 +165,11 @@ public:
|
||||
fvElemGeom.boundaryFace[boundaryFaceIdx].ipGlobal;
|
||||
Scalar right = this->bboxMax()[0];
|
||||
if (pos[0] > right - eps_) {
|
||||
// oil outflux of 0.3 g/(m * s) on the right boundary of
|
||||
// the domain.
|
||||
// oil outflux of 0.3 g/(m * s) on the right boundary.
|
||||
values[Indices::contiWEqIdx] = 0;
|
||||
values[Indices::contiNEqIdx] = 3e-4;
|
||||
} else {
|
||||
// no-flow on the remaining neumann-boundaries
|
||||
// no-flow on the remaining Neumann-boundaries.
|
||||
values[Indices::contiWEqIdx] = 0;
|
||||
values[Indices::contiNEqIdx] = 0;
|
||||
}
|
||||
@@ -209,10 +187,9 @@ public:
|
||||
}
|
||||
|
||||
// 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.
|
||||
// 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.
|
||||
void source(PrimaryVariables &values,
|
||||
const Element &element,
|
||||
const FVElementGeometry &fvElemGeom,
|
||||
@@ -223,6 +200,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
// small epsilon value
|
||||
static const Scalar eps_ = 3e-6;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user