mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
improved documentation for tutorial decoupled
This commit is contained in:
parent
e49d8dd6ec
commit
cff0aaf797
@ -18,23 +18,21 @@
|
|||||||
#ifndef DUMUX_TUTORIALPROBLEM_DECOUPLED_HH
|
#ifndef DUMUX_TUTORIALPROBLEM_DECOUPLED_HH
|
||||||
#define DUMUX_TUTORIALPROBLEM_DECOUPLED_HH
|
#define DUMUX_TUTORIALPROBLEM_DECOUPLED_HH
|
||||||
|
|
||||||
|
// the grid includes
|
||||||
#if HAVE_UG
|
#if HAVE_UG
|
||||||
#include <dune/grid/uggrid.hh>
|
#include <dune/grid/uggrid.hh>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <dune/grid/yaspgrid.hh>
|
#include <dune/grid/yaspgrid.hh>
|
||||||
#include <dune/grid/sgrid.hh>
|
#include <dune/grid/sgrid.hh>
|
||||||
|
|
||||||
// fluid properties
|
// dumux 2p-decoupled environment
|
||||||
#include <dumux/material/fluidsystems/2p_system.hh>
|
#include <dumux/decoupled/2p/impes/impesproblem2p.hh> /*@\label{tutorial-decoupled:parent-problem}@*/
|
||||||
|
|
||||||
#include <dumux/decoupled/2p/impes/impesproblem2p.hh>
|
|
||||||
#include <dumux/decoupled/2p/diffusion/fv/fvvelocity2p.hh>
|
#include <dumux/decoupled/2p/diffusion/fv/fvvelocity2p.hh>
|
||||||
#include <dumux/decoupled/2p/transport/fv/fvsaturation2p.hh>
|
#include <dumux/decoupled/2p/transport/fv/fvsaturation2p.hh>
|
||||||
#include <dumux/decoupled/2p/transport/fv/capillarydiffusion.hh>
|
#include <dumux/decoupled/2p/transport/fv/capillarydiffusion.hh>
|
||||||
#include <dumux/decoupled/2p/transport/fv/gravitypart.hh>
|
|
||||||
|
|
||||||
#include "tutorialspatialparameters_decoupled.hh"
|
// assign parameters dependent on space (e.g. spatial parameters)
|
||||||
|
#include "tutorialspatialparameters_decoupled.hh" /*@\label{tutorial-decoupled:spatialparameters}@*/
|
||||||
|
|
||||||
namespace Dumux
|
namespace Dumux
|
||||||
{
|
{
|
||||||
@ -47,13 +45,21 @@ class TutorialProblemDecoupled;
|
|||||||
//////////
|
//////////
|
||||||
namespace Properties
|
namespace Properties
|
||||||
{
|
{
|
||||||
NEW_TYPE_TAG(TutorialProblemDecoupled, INHERITS_FROM(DecoupledTwoP, Transport));
|
// create a new type tag for the problem
|
||||||
|
NEW_TYPE_TAG(TutorialProblemDecoupled, INHERITS_FROM(DecoupledTwoP)); /*@\label{tutorial-decoupled:create-type-tag}@*/
|
||||||
|
|
||||||
|
// Set the problem property
|
||||||
|
SET_PROP(TutorialProblemDecoupled, Problem) /*@\label{tutorial-decoupled:set-problem}@*/
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef Dumux::TutorialProblemDecoupled<TTAG(TutorialProblemDecoupled)> type;
|
||||||
|
};
|
||||||
|
|
||||||
// Set the grid type
|
// Set the grid type
|
||||||
SET_PROP(TutorialProblemDecoupled, Grid)
|
SET_PROP(TutorialProblemDecoupled, Grid) /*@\label{tutorial-decoupled:grid-begin}@*/
|
||||||
{
|
{
|
||||||
typedef Dune::SGrid<2, 2> type;
|
typedef Dune::SGrid<2, 2> type;
|
||||||
static type *create() /*@\label{tutorial-coupled:create-grid-method}@*/
|
static type *create() /*@\label{tutorial-decoupled:create-grid-method}@*/
|
||||||
{
|
{
|
||||||
typedef typename type::ctype ctype;
|
typedef typename type::ctype ctype;
|
||||||
Dune::FieldVector<int, 2> cellRes;
|
Dune::FieldVector<int, 2> cellRes;
|
||||||
@ -69,37 +75,13 @@ SET_PROP(TutorialProblemDecoupled, Grid)
|
|||||||
} /*@\label{tutorial-decoupled:grid-end}@*/
|
} /*@\label{tutorial-decoupled:grid-end}@*/
|
||||||
};
|
};
|
||||||
|
|
||||||
// Set the problem property
|
|
||||||
SET_PROP(TutorialProblemDecoupled, Problem)
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
typedef Dumux::TutorialProblemDecoupled<TTAG(TutorialProblemDecoupled)> type;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Set the model properties
|
|
||||||
SET_PROP(TutorialProblemDecoupled, TransportModel)
|
|
||||||
{
|
|
||||||
typedef Dumux::FVSaturation2P<TTAG(TutorialProblemDecoupled)> type;
|
|
||||||
};
|
|
||||||
|
|
||||||
SET_PROP(TutorialProblemDecoupled, PressureModel)
|
|
||||||
{
|
|
||||||
typedef Dumux::FVVelocity2P<TTAG(TutorialProblemDecoupled)> type;
|
|
||||||
};
|
|
||||||
|
|
||||||
SET_INT_PROP(TutorialProblemDecoupled, VelocityFormulation,
|
|
||||||
GET_PROP_TYPE(TypeTag, PTAG(TwoPIndices))::velocityW);
|
|
||||||
|
|
||||||
//SET_INT_PROP(TutorialProblemDecoupled, PressureFormulation,
|
|
||||||
// GET_PROP_TYPE(TypeTag, PTAG(TwoPIndices))::pressureGlobal);
|
|
||||||
|
|
||||||
// Set the wetting phase
|
// Set the wetting phase
|
||||||
SET_PROP(TutorialProblemDecoupled, WettingPhase)
|
SET_PROP(TutorialProblemDecoupled, WettingPhase) /*@\label{tutorial-decoupled:2p-system-start}@*/
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
|
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
|
||||||
public:
|
public:
|
||||||
typedef Dumux::LiquidPhase<Scalar, Dumux::H2O<Scalar> > type;
|
typedef Dumux::LiquidPhase<Scalar, Dumux::H2O<Scalar> > type; /*@\label{tutorial-decoupled:wettingPhase}@*/
|
||||||
};
|
};
|
||||||
|
|
||||||
// Set the non-wetting phase
|
// Set the non-wetting phase
|
||||||
@ -108,11 +90,11 @@ SET_PROP(TutorialProblemDecoupled, NonwettingPhase)
|
|||||||
private:
|
private:
|
||||||
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
|
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
|
||||||
public:
|
public:
|
||||||
typedef Dumux::LiquidPhase<Scalar, Dumux::Oil<Scalar> > type;
|
typedef Dumux::LiquidPhase<Scalar, Dumux::Oil<Scalar> > type; /*@\label{tutorial-decoupled:nonwettingPhase}@*/
|
||||||
};
|
}; /*@\label{tutorial-decoupled:2p-system-end}@*/
|
||||||
|
|
||||||
// Set the spatial parameters
|
// Set the spatial parameters
|
||||||
SET_PROP(TutorialProblemDecoupled, SpatialParameters)
|
SET_PROP(TutorialProblemDecoupled, SpatialParameters) /*@\label{tutorial-decoupled:set-spatialparameters}@*/
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Grid)) Grid;
|
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Grid)) Grid;
|
||||||
@ -122,19 +104,36 @@ public:
|
|||||||
typedef Dumux::TutorialSpatialParametersDecoupled<TypeTag> type;
|
typedef Dumux::TutorialSpatialParametersDecoupled<TypeTag> type;
|
||||||
};
|
};
|
||||||
|
|
||||||
SET_TYPE_PROP(TutorialProblemDecoupled, DiffusivePart, Dumux::CapillaryDiffusion<TypeTag>);
|
// Set the model properties
|
||||||
|
SET_PROP(TutorialProblemDecoupled, TransportModel) /*@\label{tutorial-decoupled:TransportModel}@*/
|
||||||
|
{
|
||||||
|
typedef Dumux::FVSaturation2P<TTAG(TutorialProblemDecoupled)> type;
|
||||||
|
};
|
||||||
|
|
||||||
|
SET_PROP(TutorialProblemDecoupled, PressureModel) /*@\label{tutorial-decoupled:PressureModel}@*/
|
||||||
|
{
|
||||||
|
typedef Dumux::FVVelocity2P<TTAG(TutorialProblemDecoupled)> type;
|
||||||
|
};
|
||||||
|
|
||||||
|
// model-specific settings
|
||||||
|
SET_INT_PROP(TutorialProblemDecoupled, VelocityFormulation,
|
||||||
|
GET_PROP_TYPE(TypeTag, PTAG(TwoPIndices))::velocityW); /*@\label{tutorial-decoupled:velocityFormulation}@*/
|
||||||
|
|
||||||
|
|
||||||
|
SET_TYPE_PROP(TutorialProblemDecoupled, DiffusivePart,
|
||||||
|
Dumux::CapillaryDiffusion<TypeTag>); /*@\label{tutorial-decoupled:DiffusivePart}@*/
|
||||||
|
|
||||||
|
SET_SCALAR_PROP(TutorialProblemDecoupled, CFLFactor, 0.3); /*@\label{tutorial-decoupled:cfl}@*/
|
||||||
|
|
||||||
// Disable gravity
|
// Disable gravity
|
||||||
SET_BOOL_PROP(TutorialProblemDecoupled, EnableGravity, false);
|
SET_BOOL_PROP(TutorialProblemDecoupled, EnableGravity, false); /*@\label{tutorial-decoupled:gravity}@*/
|
||||||
|
} /*@\label{tutorial-decoupled:propertysystem-end}@*/
|
||||||
SET_SCALAR_PROP(TutorialProblemDecoupled, CFLFactor, 0.3);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \ingroup DecoupledProblems
|
* \ingroup DecoupledProblems
|
||||||
*/
|
*/
|
||||||
template<class TypeTag = TTAG(TutorialProblemDecoupled)>
|
template<class TypeTag = TTAG(TutorialProblemDecoupled)>
|
||||||
class TutorialProblemDecoupled: public IMPESProblem2P<TypeTag, TutorialProblemDecoupled<TypeTag> >
|
class TutorialProblemDecoupled: public IMPESProblem2P<TypeTag, TutorialProblemDecoupled<TypeTag> > /*@\label{tutorial-decoupled:def-problem}@*/
|
||||||
{
|
{
|
||||||
typedef TutorialProblemDecoupled<TypeTag> ThisType;
|
typedef TutorialProblemDecoupled<TypeTag> ThisType;
|
||||||
typedef IMPESProblem2P<TypeTag, ThisType> ParentType;
|
typedef IMPESProblem2P<TypeTag, ThisType> ParentType;
|
||||||
@ -163,54 +162,82 @@ class TutorialProblemDecoupled: public IMPESProblem2P<TypeTag, TutorialProblemDe
|
|||||||
typedef Dune::FieldVector<Scalar, dim> LocalPosition;
|
typedef Dune::FieldVector<Scalar, dim> LocalPosition;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TutorialProblemDecoupled(const GridView &gridView, const GlobalPosition lowerLeft = GlobalPosition(0.), const GlobalPosition upperRight = GlobalPosition(0.)) :
|
TutorialProblemDecoupled(const GridView &gridView, const GlobalPosition lowerLeft = GlobalPosition(0.),
|
||||||
ParentType(gridView), lowerLeft_(lowerLeft), upperRight_(upperRight)
|
const GlobalPosition upperRight = GlobalPosition(0.)) : ParentType(gridView) /*@\label{tutorial-decoupled:constructor-problem}@*/
|
||||||
{
|
{ }
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \name Problem parameters
|
|
||||||
*/
|
|
||||||
// \{
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief The problem name.
|
* \brief The problem name.
|
||||||
*
|
*
|
||||||
* This is used as a prefix for files generated by the simulation.
|
* This is used as a prefix for files generated by the simulation.
|
||||||
*/
|
*/
|
||||||
const char *name() const
|
const char *name() const /*@\label{tutorial-decoupled:name}@*/
|
||||||
{
|
{
|
||||||
return "tutorial_decoupled";
|
return "tutorial_decoupled";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool shouldWriteRestartFile() const
|
/*!
|
||||||
|
* \brief Returns true if a restart file should be written.
|
||||||
|
*
|
||||||
|
* The default behaviour is to write no restart file.
|
||||||
|
*/
|
||||||
|
bool shouldWriteRestartFile() const /*@\label{tutorial-decoupled:restart}@*/
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Returns true if the current solution should be written to
|
||||||
|
* disk (i.e. as a VTK file)
|
||||||
|
*
|
||||||
|
* The default behaviour is to write out every the solution for
|
||||||
|
* very time step. Else, change divisor.
|
||||||
|
*/
|
||||||
|
bool shouldWriteOutput() const /*@\label{tutorial-decoupled:output}@*/
|
||||||
|
{
|
||||||
|
return this->timeManager().timeStepIndex() > 0 &&
|
||||||
|
(this->timeManager().timeStepIndex() % 1 == 0);
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Returns the temperature within the domain.
|
* \brief Returns the temperature within the domain.
|
||||||
*
|
*
|
||||||
* This problem assumes a temperature of 10 degrees Celsius.
|
* This problem assumes a temperature of 10 degrees Celsius.
|
||||||
*/
|
*/
|
||||||
Scalar temperature(const GlobalPosition& globalPos, const Element& element) const
|
Scalar temperature(const GlobalPosition& globalPos, const Element& element) const /*@\label{tutorial-decoupled:temperature}@*/
|
||||||
{
|
{
|
||||||
return 273.15 + 10; // -> 10°C
|
return 273.15 + 10; // -> 10°C
|
||||||
}
|
}
|
||||||
|
|
||||||
// \}
|
/*!
|
||||||
|
* \brief Returns a constant pressure to enter material laws
|
||||||
Scalar referencePressure(const GlobalPosition& globalPos, const Element& element) const
|
*
|
||||||
|
* For incrompressible simulations, a constant pressure is necessary
|
||||||
|
* to enter the material laws to gain a constant density etc.
|
||||||
|
*/
|
||||||
|
Scalar referencePressure(const GlobalPosition& globalPos, const Element& element) const /*@\label{tutorial-decoupled:refPressure}@*/
|
||||||
{
|
{
|
||||||
return 1e5; // -> 10°C
|
return 2e5;
|
||||||
}
|
}
|
||||||
|
/*!
|
||||||
std::vector<Scalar> source(const GlobalPosition& globalPos, const Element& element)
|
* \brief Source of mass \f$ [\frac{kg}{m^3 \cdot s}] \f$
|
||||||
|
*
|
||||||
|
* Evaluate the source term for all phases within a given
|
||||||
|
* volume. The method returns the mass generated (positive) or
|
||||||
|
* annihilated (negative) per volume unit.
|
||||||
|
*/
|
||||||
|
std::vector<Scalar> source(const GlobalPosition& globalPos, const Element& element) /*@\label{tutorial-decoupled:source}@*/
|
||||||
{
|
{
|
||||||
return std::vector<Scalar>(2, 0.0);
|
return std::vector<Scalar>(2, 0.);
|
||||||
}
|
}
|
||||||
|
|
||||||
typename BoundaryConditions::Flags bctypePress(const GlobalPosition& globalPos, const Intersection& intersection) const
|
/*!
|
||||||
|
* \brief Type of pressure boundary condition.
|
||||||
|
*
|
||||||
|
* Defines the type the boundary condition for the pressure equation,
|
||||||
|
* either pressure (dirichlet) or flux (neumann).
|
||||||
|
*/
|
||||||
|
typename BoundaryConditions::Flags bctypePress(const GlobalPosition& globalPos, const Intersection& intersection) const /*@\label{tutorial-decoupled:bctypePress}@*/
|
||||||
{
|
{
|
||||||
if ((globalPos[0] < lowerLeft_[0] + eps_))
|
if ((globalPos[0] < lowerLeft_[0] + eps_))
|
||||||
return BoundaryConditions::dirichlet;
|
return BoundaryConditions::dirichlet;
|
||||||
@ -218,31 +245,50 @@ public:
|
|||||||
return BoundaryConditions::neumann;
|
return BoundaryConditions::neumann;
|
||||||
}
|
}
|
||||||
|
|
||||||
BoundaryConditions::Flags bctypeSat(const GlobalPosition& globalPos, const Intersection& intersection) const
|
/*!
|
||||||
|
* \brief Type of Transport boundary condition.
|
||||||
|
*
|
||||||
|
* Defines the type the boundary condition for the transport equation,
|
||||||
|
* either saturation (dirichlet) or flux (neumann).
|
||||||
|
*/
|
||||||
|
BoundaryConditions::Flags bctypeSat(const GlobalPosition& globalPos, const Intersection& intersection) const /*@\label{tutorial-decoupled:bctypeSat}@*/
|
||||||
{
|
{
|
||||||
if (globalPos[0] < lowerLeft_[0] + eps_)
|
if (globalPos[0] < lowerLeft_[0] + eps_)
|
||||||
return Dumux::BoundaryConditions::dirichlet;
|
return Dumux::BoundaryConditions::dirichlet;
|
||||||
else
|
else
|
||||||
return Dumux::BoundaryConditions::neumann;
|
return Dumux::BoundaryConditions::neumann;
|
||||||
}
|
}
|
||||||
|
/*!
|
||||||
Scalar dirichletPress(const GlobalPosition& globalPos, const Intersection& intersection) const
|
* \brief Value for dirichlet pressure boundary condition \f$ [Pa] \f$.
|
||||||
|
*
|
||||||
|
* In case of a dirichlet BC for the pressure equation, the pressure
|
||||||
|
* have to be defined on boundaries.
|
||||||
|
*/
|
||||||
|
Scalar dirichletPress(const GlobalPosition& globalPos, const Intersection& intersection) const /*@\label{tutorial-decoupled:dirichletPress}@*/
|
||||||
{
|
{
|
||||||
if (globalPos[0] < lowerLeft_[0] + eps_)
|
if (globalPos[0] < lowerLeft_[0] + eps_)
|
||||||
return 2e5;
|
return 2e5;
|
||||||
// all other boundaries
|
// all other boundaries
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
/*!
|
||||||
Scalar dirichletSat(const GlobalPosition& globalPos, const Intersection& intersection) const
|
* \brief Value for transport dirichlet boundary condition (dimensionless).
|
||||||
|
*
|
||||||
|
* In case of a dirichlet BC for the transport equation, a saturation
|
||||||
|
* have to be defined on boundaries.
|
||||||
|
*/
|
||||||
|
Scalar dirichletSat(const GlobalPosition& globalPos, const Intersection& intersection) const /*@\label{tutorial-decoupled:dirichletSat}@*/
|
||||||
{
|
{
|
||||||
if (globalPos[0] < lowerLeft_[0] + eps_)
|
if (globalPos[0] < lowerLeft_[0] + eps_)
|
||||||
return 1;
|
return 1;
|
||||||
// all other boundaries
|
// all other boundaries
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
//! Value for pressure neumann boundary condition \f$ [\frac{kg}{m^3 \cdot s}] \f$.
|
||||||
std::vector<Scalar> neumannPress(const GlobalPosition& globalPos, const Intersection& intersection) const
|
/** In case of a neumann boundary condition, the flux of matter
|
||||||
|
* is returned as a vector.
|
||||||
|
*/
|
||||||
|
std::vector<Scalar> neumannPress(const GlobalPosition& globalPos, const Intersection& intersection) const /*@\label{tutorial-decoupled:neumannPress}@*/
|
||||||
{
|
{
|
||||||
std::vector<Scalar> neumannFlux(2,0.0);
|
std::vector<Scalar> neumannFlux(2,0.0);
|
||||||
if (globalPos[0] > upperRight_[0] - eps_)
|
if (globalPos[0] > upperRight_[0] - eps_)
|
||||||
@ -251,13 +297,20 @@ public:
|
|||||||
}
|
}
|
||||||
return neumannFlux;
|
return neumannFlux;
|
||||||
}
|
}
|
||||||
|
//! Value for transport neumann boundary condition \f$ [\frac{kg}{m^3 \cdot s}] \f$.
|
||||||
Scalar neumannSat(const GlobalPosition& globalPos, const Intersection& intersection, Scalar factor) const
|
/** In case of a neumann boundary condition for the transport equation
|
||||||
|
* the flux of matter for the primary variable is returned as a scalar.
|
||||||
|
*/
|
||||||
|
Scalar neumannSat(const GlobalPosition& globalPos, const Intersection& intersection, Scalar factor) const /*@\label{tutorial-decoupled:neumannSat}@*/
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
//! Saturation initial condition (dimensionless)
|
||||||
Scalar initSat(const GlobalPosition& globalPos, const Element& element) const
|
/*
|
||||||
|
* @param element reference to the cell for which the function is to be evaluated
|
||||||
|
* @param localPos local coordinates inside element
|
||||||
|
*/
|
||||||
|
Scalar initSat(const GlobalPosition& globalPos, const Element& element) const /*@\label{tutorial-decoupled:initSat}@*/
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user