2010-08-24 06:11:18 -05:00
|
|
|
// $Id$
|
2009-06-18 12:06:44 -05:00
|
|
|
/*****************************************************************************
|
2010-05-25 08:27:16 -05:00
|
|
|
* Copyright (C) 2007-2008 by Klaus Mosthaf *
|
|
|
|
* Copyright (C) 2007-2008 by Bernd Flemisch *
|
|
|
|
* Copyright (C) 2008-2009 by Andreas Lauser *
|
|
|
|
* Institute of Hydraulic Engineering *
|
|
|
|
* University of Stuttgart, Germany *
|
|
|
|
* email: <givenname>.<name>@iws.uni-stuttgart.de *
|
|
|
|
* *
|
2011-01-04 09:49:28 -06:00
|
|
|
* 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. *
|
|
|
|
* *
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU General Public License *
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
2010-05-25 08:27:16 -05:00
|
|
|
*****************************************************************************/
|
2010-11-12 01:13:58 -06:00
|
|
|
/*!
|
|
|
|
* \file
|
|
|
|
*
|
|
|
|
* \brief problem for the sequential tutorial
|
|
|
|
*/
|
2011-02-25 08:52:18 -06:00
|
|
|
#ifndef DUMUX_TUTORIALPROBLEM_DECOUPLED_HH // guardian macro /*@\label{tutorial-decoupled:guardian1}@*/
|
|
|
|
#define DUMUX_TUTORIALPROBLEM_DECOUPLED_HH // guardian macro /*@\label{tutorial-decoupled:guardian2}@*/
|
2010-05-25 08:27:16 -05:00
|
|
|
|
2010-10-05 03:04:16 -05:00
|
|
|
// the grid includes
|
2010-05-25 08:27:16 -05:00
|
|
|
#include <dune/grid/sgrid.hh>
|
|
|
|
|
2010-10-05 03:04:16 -05:00
|
|
|
// dumux 2p-decoupled environment
|
|
|
|
#include <dumux/decoupled/2p/impes/impesproblem2p.hh> /*@\label{tutorial-decoupled:parent-problem}@*/
|
2010-06-22 02:02:51 -05:00
|
|
|
#include <dumux/decoupled/2p/diffusion/fv/fvvelocity2p.hh>
|
|
|
|
#include <dumux/decoupled/2p/transport/fv/fvsaturation2p.hh>
|
|
|
|
#include <dumux/decoupled/2p/transport/fv/capillarydiffusion.hh>
|
2010-05-25 08:27:16 -05:00
|
|
|
|
2010-10-05 03:04:16 -05:00
|
|
|
// assign parameters dependent on space (e.g. spatial parameters)
|
|
|
|
#include "tutorialspatialparameters_decoupled.hh" /*@\label{tutorial-decoupled:spatialparameters}@*/
|
2009-06-10 07:08:28 -05:00
|
|
|
|
2011-03-02 06:49:24 -06:00
|
|
|
// the components that are used
|
|
|
|
#include <dumux/material/components/h2o.hh>
|
|
|
|
#include <dumux/material/components/oil.hh>
|
|
|
|
|
2010-03-25 08:02:05 -05:00
|
|
|
namespace Dumux
|
2009-06-10 07:08:28 -05:00
|
|
|
{
|
|
|
|
|
2010-05-25 08:27:16 -05:00
|
|
|
template<class TypeTag>
|
|
|
|
class TutorialProblemDecoupled;
|
|
|
|
|
|
|
|
//////////
|
|
|
|
// Specify the properties for the lens problem
|
|
|
|
//////////
|
|
|
|
namespace Properties
|
|
|
|
{
|
2010-10-05 03:04:16 -05:00
|
|
|
// 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}@*/
|
|
|
|
{
|
2010-12-02 03:43:52 -06:00
|
|
|
typedef Dumux::TutorialProblemDecoupled<TypeTag> type;
|
2010-10-05 03:04:16 -05:00
|
|
|
};
|
2010-05-25 08:27:16 -05:00
|
|
|
|
|
|
|
// Set the grid type
|
2010-10-05 03:04:16 -05:00
|
|
|
SET_PROP(TutorialProblemDecoupled, Grid) /*@\label{tutorial-decoupled:grid-begin}@*/
|
2010-05-25 08:27:16 -05:00
|
|
|
{
|
2010-11-10 08:24:22 -06:00
|
|
|
typedef Dune::SGrid<2, 2> type; /*@\label{tutorial-decoupled:set-grid-type}@*/
|
2010-10-05 03:04:16 -05:00
|
|
|
static type *create() /*@\label{tutorial-decoupled:create-grid-method}@*/
|
2010-10-01 10:08:25 -05:00
|
|
|
{
|
|
|
|
typedef typename type::ctype ctype;
|
2011-02-04 09:11:02 -06:00
|
|
|
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
|
2010-10-01 10:08:25 -05:00
|
|
|
cellRes[0] = 100;
|
|
|
|
cellRes[1] = 1;
|
2011-02-04 09:11:02 -06:00
|
|
|
upperRight[0] = 300;
|
|
|
|
upperRight[1] = 60;
|
2010-10-01 10:08:25 -05:00
|
|
|
return new Dune::SGrid<2,2>(cellRes,
|
|
|
|
lowerLeft,
|
|
|
|
upperRight);
|
|
|
|
} /*@\label{tutorial-decoupled:grid-end}@*/
|
2010-05-25 08:27:16 -05:00
|
|
|
};
|
2009-06-10 07:08:28 -05:00
|
|
|
|
2010-05-25 08:27:16 -05:00
|
|
|
// Set the wetting phase
|
2010-10-05 03:04:16 -05:00
|
|
|
SET_PROP(TutorialProblemDecoupled, WettingPhase) /*@\label{tutorial-decoupled:2p-system-start}@*/
|
2010-05-25 08:27:16 -05:00
|
|
|
{
|
|
|
|
private:
|
|
|
|
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
|
|
|
|
public:
|
2010-10-05 03:04:16 -05:00
|
|
|
typedef Dumux::LiquidPhase<Scalar, Dumux::H2O<Scalar> > type; /*@\label{tutorial-decoupled:wettingPhase}@*/
|
2010-05-25 08:27:16 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
// Set the non-wetting phase
|
|
|
|
SET_PROP(TutorialProblemDecoupled, NonwettingPhase)
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
|
|
|
|
public:
|
2010-10-05 03:04:16 -05:00
|
|
|
typedef Dumux::LiquidPhase<Scalar, Dumux::Oil<Scalar> > type; /*@\label{tutorial-decoupled:nonwettingPhase}@*/
|
|
|
|
}; /*@\label{tutorial-decoupled:2p-system-end}@*/
|
2010-05-25 08:27:16 -05:00
|
|
|
|
2010-08-05 07:11:43 -05:00
|
|
|
// Set the spatial parameters
|
2010-10-05 03:04:16 -05:00
|
|
|
SET_PROP(TutorialProblemDecoupled, SpatialParameters) /*@\label{tutorial-decoupled:set-spatialparameters}@*/
|
2010-05-25 08:27:16 -05:00
|
|
|
{
|
|
|
|
typedef Dumux::TutorialSpatialParametersDecoupled<TypeTag> type;
|
|
|
|
};
|
|
|
|
|
2010-10-05 03:04:16 -05:00
|
|
|
// Set the model properties
|
|
|
|
SET_PROP(TutorialProblemDecoupled, TransportModel) /*@\label{tutorial-decoupled:TransportModel}@*/
|
|
|
|
{
|
|
|
|
typedef Dumux::FVSaturation2P<TTAG(TutorialProblemDecoupled)> type;
|
|
|
|
};
|
2010-05-25 08:27:16 -05:00
|
|
|
|
2010-10-05 03:04:16 -05:00
|
|
|
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}@*/
|
2010-05-25 08:27:16 -05:00
|
|
|
|
2010-10-20 08:01:24 -05:00
|
|
|
SET_SCALAR_PROP(TutorialProblemDecoupled, CFLFactor, 0.5); /*@\label{tutorial-decoupled:cfl}@*/
|
2010-10-05 03:04:16 -05:00
|
|
|
|
|
|
|
// Disable gravity
|
|
|
|
SET_BOOL_PROP(TutorialProblemDecoupled, EnableGravity, false); /*@\label{tutorial-decoupled:gravity}@*/
|
|
|
|
} /*@\label{tutorial-decoupled:propertysystem-end}@*/
|
2010-05-25 08:27:16 -05:00
|
|
|
|
2010-10-05 05:12:50 -05:00
|
|
|
/*! \ingroup DecoupledProblems
|
|
|
|
* @brief Problem class for the decoupled tutorial
|
2010-05-25 08:27:16 -05:00
|
|
|
*/
|
2010-12-02 03:43:52 -06:00
|
|
|
template<class TypeTag>
|
2010-10-05 03:04:16 -05:00
|
|
|
class TutorialProblemDecoupled: public IMPESProblem2P<TypeTag, TutorialProblemDecoupled<TypeTag> > /*@\label{tutorial-decoupled:def-problem}@*/
|
2010-05-25 08:27:16 -05:00
|
|
|
{
|
|
|
|
typedef TutorialProblemDecoupled<TypeTag> ThisType;
|
|
|
|
typedef IMPESProblem2P<TypeTag, ThisType> ParentType;
|
|
|
|
typedef typename GET_PROP_TYPE(TypeTag, PTAG(GridView)) GridView;
|
|
|
|
|
|
|
|
typedef typename GET_PROP_TYPE(TypeTag, PTAG(TwoPIndices)) Indices;
|
|
|
|
|
|
|
|
typedef typename GET_PROP_TYPE(TypeTag, PTAG(FluidSystem)) FluidSystem;
|
|
|
|
typedef typename GET_PROP_TYPE(TypeTag, PTAG(FluidState)) FluidState;
|
|
|
|
|
2009-06-10 07:08:28 -05:00
|
|
|
enum
|
2010-05-25 08:27:16 -05:00
|
|
|
{
|
|
|
|
dim = GridView::dimension, dimWorld = GridView::dimensionworld
|
|
|
|
};
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
wPhaseIdx = Indices::wPhaseIdx, nPhaseIdx = Indices::nPhaseIdx
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
|
|
|
|
|
2009-06-10 07:08:28 -05:00
|
|
|
typedef typename GridView::Traits::template Codim<0>::Entity Element;
|
2010-05-25 08:27:16 -05:00
|
|
|
typedef typename GridView::Intersection Intersection;
|
|
|
|
typedef Dune::FieldVector<Scalar, dimWorld> GlobalPosition;
|
|
|
|
typedef Dune::FieldVector<Scalar, dim> LocalPosition;
|
2009-06-10 07:08:28 -05:00
|
|
|
|
|
|
|
public:
|
2011-02-23 05:20:51 -06:00
|
|
|
TutorialProblemDecoupled(const GridView &gridView,
|
|
|
|
const GlobalPosition lowerLeft = GlobalPosition(0.),
|
2010-10-05 03:04:16 -05:00
|
|
|
const GlobalPosition upperRight = GlobalPosition(0.)) : ParentType(gridView) /*@\label{tutorial-decoupled:constructor-problem}@*/
|
|
|
|
{ }
|
2010-05-25 08:27:16 -05:00
|
|
|
|
2010-10-05 05:12:50 -05:00
|
|
|
//! The problem name.
|
|
|
|
/*! This is used as a prefix for files generated by the simulation.
|
2010-05-25 08:27:16 -05:00
|
|
|
*/
|
2010-10-05 03:04:16 -05:00
|
|
|
const char *name() const /*@\label{tutorial-decoupled:name}@*/
|
2010-05-25 08:27:16 -05:00
|
|
|
{
|
|
|
|
return "tutorial_decoupled";
|
|
|
|
}
|
|
|
|
|
2010-10-05 05:12:50 -05:00
|
|
|
//! Returns true if a restart file should be written.
|
|
|
|
/* The default behaviour is to write no restart file.
|
2010-10-05 03:04:16 -05:00
|
|
|
*/
|
|
|
|
bool shouldWriteRestartFile() const /*@\label{tutorial-decoupled:restart}@*/
|
2010-05-25 08:27:16 -05:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2010-10-05 05:12:50 -05:00
|
|
|
//! 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.
|
2010-10-05 03:04:16 -05:00
|
|
|
*/
|
|
|
|
bool shouldWriteOutput() const /*@\label{tutorial-decoupled:output}@*/
|
|
|
|
{
|
|
|
|
return this->timeManager().timeStepIndex() > 0 &&
|
2010-12-02 05:15:16 -06:00
|
|
|
(this->timeManager().timeStepIndex() % 1 == 0);
|
2010-10-05 03:04:16 -05:00
|
|
|
}
|
|
|
|
|
2010-10-05 05:12:50 -05:00
|
|
|
//! Returns the temperature within the domain.
|
|
|
|
/*! This problem assumes a temperature of 10 degrees Celsius.
|
|
|
|
*/
|
2010-10-05 03:04:16 -05:00
|
|
|
Scalar temperature(const GlobalPosition& globalPos, const Element& element) const /*@\label{tutorial-decoupled:temperature}@*/
|
2009-06-10 07:08:28 -05:00
|
|
|
{
|
2010-05-25 08:27:16 -05:00
|
|
|
return 273.15 + 10; // -> 10°C
|
2009-06-10 07:08:28 -05:00
|
|
|
}
|
|
|
|
|
2010-10-05 05:12:50 -05:00
|
|
|
//! Returns a constant pressure to enter material laws
|
|
|
|
/* For incrompressible simulations, a constant pressure is necessary
|
2010-11-19 08:43:58 -06:00
|
|
|
* to enter the material laws to gain a constant density etc. In the compressible
|
|
|
|
* case, the pressure is used for the initialization of material laws.
|
2010-10-05 05:12:50 -05:00
|
|
|
*/
|
2010-10-05 03:04:16 -05:00
|
|
|
Scalar referencePressure(const GlobalPosition& globalPos, const Element& element) const /*@\label{tutorial-decoupled:refPressure}@*/
|
2009-06-10 07:08:28 -05:00
|
|
|
{
|
2010-10-05 03:04:16 -05:00
|
|
|
return 2e5;
|
2010-05-25 08:27:16 -05:00
|
|
|
}
|
2010-10-05 05:12:50 -05:00
|
|
|
//! 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.
|
|
|
|
*/
|
2010-10-05 03:04:16 -05:00
|
|
|
std::vector<Scalar> source(const GlobalPosition& globalPos, const Element& element) /*@\label{tutorial-decoupled:source}@*/
|
2010-10-05 05:12:50 -05:00
|
|
|
{
|
2010-10-05 03:04:16 -05:00
|
|
|
return std::vector<Scalar>(2, 0.);
|
2010-10-05 05:12:50 -05:00
|
|
|
}
|
2010-05-25 08:27:16 -05:00
|
|
|
|
2010-10-05 05:12:50 -05:00
|
|
|
//! Type of pressure boundary condition.
|
|
|
|
/*! Defines the type the boundary condition for the pressure equation,
|
|
|
|
* either pressure (dirichlet) or flux (neumann).
|
2010-10-05 03:04:16 -05:00
|
|
|
*/
|
2011-02-23 05:20:51 -06:00
|
|
|
typename BoundaryConditions::Flags bctypePress(const GlobalPosition& globalPos,
|
|
|
|
const Intersection& intersection) const /*@\label{tutorial-decoupled:bctypePress}@*/
|
2010-05-25 08:27:16 -05:00
|
|
|
{
|
2010-11-19 08:43:58 -06:00
|
|
|
if (globalPos[0] < this->bboxMin()[0] + eps_)
|
2010-05-25 08:27:16 -05:00
|
|
|
return BoundaryConditions::dirichlet;
|
2011-02-04 09:11:02 -06:00
|
|
|
else // all other boundaries
|
|
|
|
return BoundaryConditions::neumann;
|
2009-06-10 07:08:28 -05:00
|
|
|
}
|
|
|
|
|
2010-10-05 05:12:50 -05:00
|
|
|
//! Type of Transport boundary condition.
|
|
|
|
/*! Defines the type the boundary condition for the transport equation,
|
|
|
|
* either saturation (dirichlet) or flux (neumann).
|
2010-10-05 03:04:16 -05:00
|
|
|
*/
|
2011-02-23 05:20:51 -06:00
|
|
|
BoundaryConditions::Flags bctypeSat(const GlobalPosition& globalPos,
|
|
|
|
const Intersection& intersection) const /*@\label{tutorial-decoupled:bctypeSat}@*/
|
2009-06-10 07:08:28 -05:00
|
|
|
{
|
2010-10-20 08:01:24 -05:00
|
|
|
if (globalPos[0] < this->bboxMin()[0] + eps_)
|
2011-02-04 09:11:02 -06:00
|
|
|
return BoundaryConditions::dirichlet;
|
2010-05-25 08:27:16 -05:00
|
|
|
else
|
2011-02-04 09:11:02 -06:00
|
|
|
return BoundaryConditions::neumann;
|
2009-06-10 07:08:28 -05:00
|
|
|
}
|
2010-10-05 05:12:50 -05:00
|
|
|
//! 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.
|
2010-10-05 03:04:16 -05:00
|
|
|
*/
|
2011-02-23 05:20:51 -06:00
|
|
|
Scalar dirichletPress(const GlobalPosition& globalPos,
|
|
|
|
const Intersection& intersection) const /*@\label{tutorial-decoupled:dirichletPress}@*/
|
2009-06-10 07:08:28 -05:00
|
|
|
{
|
2010-11-19 08:43:58 -06:00
|
|
|
return 2e5;
|
2009-06-10 07:08:28 -05:00
|
|
|
}
|
2010-10-05 05:12:50 -05:00
|
|
|
//! Value for transport dirichlet boundary condition (dimensionless).
|
|
|
|
/*! In case of a dirichlet BC for the transport equation, a saturation
|
2010-11-19 08:43:58 -06:00
|
|
|
* has to be defined on boundaries.
|
2010-10-05 03:04:16 -05:00
|
|
|
*/
|
2011-02-23 05:20:51 -06:00
|
|
|
Scalar dirichletSat(const GlobalPosition& globalPos,
|
|
|
|
const Intersection& intersection) const /*@\label{tutorial-decoupled:dirichletSat}@*/
|
2009-06-10 07:08:28 -05:00
|
|
|
{
|
2010-11-19 08:43:58 -06:00
|
|
|
return 1;
|
2009-06-10 07:08:28 -05:00
|
|
|
}
|
2011-01-03 04:56:26 -06:00
|
|
|
//! Value for neumann boundary condition \f$ [\frac{kg}{m^3 \cdot s}] \f$.
|
2010-10-05 05:12:50 -05:00
|
|
|
/*! In case of a neumann boundary condition, the flux of matter
|
|
|
|
* is returned as a vector.
|
|
|
|
*/
|
2011-02-23 05:20:51 -06:00
|
|
|
std::vector<Scalar> neumann(const GlobalPosition& globalPos,
|
|
|
|
const Intersection& intersection) const /*@\label{tutorial-decoupled:neumann}@*/
|
2009-06-10 07:08:28 -05:00
|
|
|
{
|
2010-05-25 08:27:16 -05:00
|
|
|
std::vector<Scalar> neumannFlux(2,0.0);
|
2010-10-20 08:01:24 -05:00
|
|
|
if (globalPos[0] > this->bboxMax()[0] - eps_)
|
2009-06-10 07:08:28 -05:00
|
|
|
{
|
2010-12-02 05:14:57 -06:00
|
|
|
neumannFlux[nPhaseIdx] = 3e-2;
|
2009-06-10 07:08:28 -05:00
|
|
|
}
|
2009-09-08 05:38:51 -05:00
|
|
|
return neumannFlux;
|
2009-06-10 07:08:28 -05:00
|
|
|
}
|
2010-10-05 03:04:16 -05:00
|
|
|
//! Saturation initial condition (dimensionless)
|
2010-10-05 05:12:50 -05:00
|
|
|
/*! The problem is initialized with the following saturation.
|
2010-10-05 03:04:16 -05:00
|
|
|
*/
|
|
|
|
Scalar initSat(const GlobalPosition& globalPos, const Element& element) const /*@\label{tutorial-decoupled:initSat}@*/
|
2010-05-25 08:27:16 -05:00
|
|
|
{
|
|
|
|
return 0;
|
2009-06-10 07:08:28 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2010-05-25 08:27:16 -05:00
|
|
|
GlobalPosition lowerLeft_;
|
|
|
|
GlobalPosition upperRight_;
|
2009-06-10 07:08:28 -05:00
|
|
|
|
2010-05-25 08:27:16 -05:00
|
|
|
static const Scalar eps_ = 1e-6;
|
2009-06-10 07:08:28 -05:00
|
|
|
};
|
2010-05-25 08:27:16 -05:00
|
|
|
} //end namespace
|
|
|
|
|
2009-06-10 07:08:28 -05:00
|
|
|
#endif
|