mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
adapted decoupled tutorial to the new material system
This commit is contained in:
parent
4324b50f0f
commit
f669136297
@ -1,6 +1,8 @@
|
||||
// $Id$
|
||||
/*****************************************************************************
|
||||
* Copyright (C) 2008-2009 by Markus Wolff *
|
||||
* Copyright (C) 20010 by Markus Wolff *
|
||||
* 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 *
|
||||
@ -14,104 +16,98 @@
|
||||
* This program is distributed WITHOUT ANY WARRANTY. *
|
||||
*****************************************************************************/
|
||||
#include "config.h"
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <dune/grid/sgrid.hh> /*@\label{tutorial-decoupled:include-begin}@*/
|
||||
#include <dune/grid/io/file/vtk/vtkwriter.hh>
|
||||
#include <dune/istl/io.hh>
|
||||
#include <dune/common/timer.hh>
|
||||
#include "dumux/fractionalflow/variableclass2p.hh"
|
||||
#include "dumux/fractionalflow/define2pmodel.hh"
|
||||
#include "dumux/material/fluids/water.hh"
|
||||
#include "dumux/material/fluids/lowviscosityoil.hh"
|
||||
#include "tutorial_soilproperties_decoupled.hh"
|
||||
#include "dumux/material/twophaserelations.hh"
|
||||
#include "tutorialproblem_decoupled.hh"
|
||||
#include "dumux/diffusion/fv/fvvelocity2p.hh"
|
||||
#include "dumux/transport/fv/fvsaturation2p.hh"
|
||||
#include "dumux/fractionalflow/impes/impes.hh"
|
||||
#include "dumux/timedisc/timeloop.hh" /*@\label{tutorial-decoupled:include-end}@*/
|
||||
|
||||
#include "tutorialproblem_decoupled.hh"
|
||||
|
||||
#include <dune/grid/common/gridinfo.hh>
|
||||
|
||||
#include <dune/common/exceptions.hh>
|
||||
#include <dune/common/mpihelper.hh>
|
||||
|
||||
#include <iostream>
|
||||
#include <boost/format.hpp>
|
||||
|
||||
|
||||
////////////////////////
|
||||
// the main function
|
||||
////////////////////////
|
||||
void usage(const char *progname)
|
||||
{
|
||||
std::cout << boost::format("usage: %s [--restart restartTime] tEnd\n")%progname;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
try{
|
||||
// define the problem dimensions
|
||||
const int dim=2; /*@\label{tutorial-decoupled:dim}@*/
|
||||
try {
|
||||
typedef TTAG(TutorialProblemDecoupled) TypeTag;
|
||||
typedef GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
|
||||
typedef GET_PROP_TYPE(TypeTag, PTAG(Grid)) Grid;
|
||||
typedef GET_PROP_TYPE(TypeTag, PTAG(Problem)) Problem;
|
||||
typedef Dune::FieldVector<Scalar, Grid::dimensionworld> GlobalPosition;
|
||||
|
||||
// create a grid object
|
||||
typedef double Scalar; /*@\label{tutorial-decoupled:grid-begin}@*/
|
||||
typedef Dune::SGrid<dim,dim> Grid;
|
||||
typedef Grid::LevelGridView GridView;
|
||||
typedef Dune::FieldVector<Grid::ctype,dim> FieldVector;
|
||||
Dune::FieldVector<int,dim> N(10); N[0] = 30;
|
||||
FieldVector L(0);
|
||||
FieldVector H(60); H[0] = 300;
|
||||
static const int dim = Grid::dimension;
|
||||
|
||||
// initialize MPI, finalize is done automatically on exit
|
||||
Dune::MPIHelper::instance(argc, argv);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// parse the command line arguments
|
||||
////////////////////////////////////////////////////////////
|
||||
if (argc < 2)
|
||||
usage(argv[0]);
|
||||
|
||||
// deal with the restart stuff
|
||||
int argPos = 1;
|
||||
bool restart = false;
|
||||
double restartTime = 0;
|
||||
if (std::string("--restart") == argv[argPos]) {
|
||||
restart = true;
|
||||
++argPos;
|
||||
|
||||
std::istringstream(argv[argPos++]) >> restartTime;
|
||||
}
|
||||
|
||||
if (argc - argPos != 1) {
|
||||
usage(argv[0]);
|
||||
}
|
||||
|
||||
// read the initial time step and the end time
|
||||
double tEnd, dt;
|
||||
std::istringstream(argv[argPos++]) >> tEnd;
|
||||
dt = tEnd;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// create the grid
|
||||
////////////////////////////////////////////////////////////
|
||||
Dune::FieldVector<int,dim> N(1); N[0] = 100;
|
||||
Dune::FieldVector<double ,dim> L(0);
|
||||
Dune::FieldVector<double,dim> H(60); H[0] = 300;
|
||||
Grid grid(N,L,H);
|
||||
GridView gridView(grid.levelView(0));/*@\label{tutorial-decoupled:grid-end}@*/
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// instantiate and run the concrete problem
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
// define fluid and solid properties and constitutive relationships
|
||||
Dumux::Water wettingfluid; /*@\label{tutorial-decoupled:water}@*/
|
||||
Dumux::LowViscosityOil nonwettingfluid; /*@\label{tutorial-decoupled:oil}@*/
|
||||
Dumux::TutorialSoil<Grid, Scalar> soil; /*@\label{tutorial-decoupled:soil}@*/
|
||||
Dumux::TwoPhaseRelations<Grid, Scalar> materialLaw(soil, wettingfluid, nonwettingfluid);/*@\label{tutorial-decoupled:twophaserelations}@*/
|
||||
Problem problem(grid.leafView(), L, H);
|
||||
|
||||
// create object containing the variables
|
||||
typedef Dumux::VariableClass<GridView, Scalar> VariableClass;
|
||||
VariableClass variables(gridView);
|
||||
// load restart file if necessarry
|
||||
if (restart)
|
||||
problem.deserialize(restartTime);
|
||||
|
||||
//choose kind of two-phase model. Default: pw, Sw, vtotal
|
||||
struct Dumux::DefineModel modelDef;
|
||||
// modelDef.pressureType = modelDef.pressureW;
|
||||
// modelDef.saturationType = modelDef.saturationW;
|
||||
// modelDef.velocityType = modelDef.velocityTotal;
|
||||
|
||||
// create object including the problem definition
|
||||
typedef Dumux::TutorialProblemDecoupled<GridView, Scalar, VariableClass> Problem;
|
||||
Problem problem(variables, wettingfluid, nonwettingfluid, soil, materialLaw,L, H); /*@\label{tutorial-decoupled:problem}@*/
|
||||
|
||||
// create object including the discretisation of the pressure equation
|
||||
typedef Dumux::FVVelocity2P<GridView, Scalar, VariableClass, Problem> Diffusion;
|
||||
Diffusion diffusion(gridView, problem, modelDef); /*@\label{tutorial-decoupled:diffusion}@*/
|
||||
|
||||
// create object including the space discretisation of the saturation equation
|
||||
typedef Dumux::FVSaturation2P<GridView, Scalar, VariableClass, Problem> Transport;
|
||||
Transport transport(gridView, problem, modelDef); /*@\label{tutorial-decoupled:transport}@*/
|
||||
|
||||
// some parameters used in the IMPES-object
|
||||
int iterFlag = 0;
|
||||
int nIter = 2;
|
||||
double maxDefect = 1e-5;
|
||||
|
||||
// create object including the IMPES (IMplicit Pressure Explicit Saturation) algorithm
|
||||
typedef Dune::IMPES<GridView, Diffusion, Transport, VariableClass> IMPES;
|
||||
IMPES impes(diffusion, transport, iterFlag, nIter, maxDefect); /*@\label{tutorial-decoupled:impes}@*/
|
||||
|
||||
// some parameters needed for the TimeLoop-object
|
||||
double tStart = 0; // start simulation at t = tStart
|
||||
double tEnd = 4e7; // stop simulation at t = tEnd
|
||||
const char* fileName = "tutorial_decoupled"; // name of the output files
|
||||
int modulo = 1; // define time step interval in which output files are generated
|
||||
double cFLFactor = 0.9; // security factor for the Courant-Friedrichs-Lewy-Criterion
|
||||
|
||||
// create TimeLoop-object
|
||||
Dumux::TimeLoop<GridView, IMPES> timeloop(gridView, tStart, tEnd, fileName, modulo, cFLFactor); /*@\label{tutorial-decoupled:timeloop}@*/
|
||||
|
||||
Dune::Timer timer;
|
||||
timer.reset();
|
||||
|
||||
// start simulation
|
||||
timeloop.execute(impes); /*@\label{tutorial-decoupled:execute}@*/
|
||||
// run the simulation
|
||||
if (!problem.simulate(dt, tEnd))
|
||||
return 2;
|
||||
|
||||
return 0;
|
||||
}
|
||||
catch (Dune::Exception &e){
|
||||
catch (Dune::Exception &e) {
|
||||
std::cerr << "Dune reported error: " << e << std::endl;
|
||||
return 1;
|
||||
}
|
||||
catch (...){
|
||||
std::cerr << "Unknown exception thrown!" << std::endl;
|
||||
return 1;
|
||||
catch (...) {
|
||||
std::cerr << "Unknown exception thrown!\n";
|
||||
throw;
|
||||
}
|
||||
|
||||
return 3;
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ SET_PROP(TutorialProblemCoupled, FluidSystem) /*@\label{tutorial-coupled:set-f
|
||||
// Set the spatial parameters
|
||||
SET_PROP(TutorialProblemCoupled, SpatialParameters) /*@\label{tutorial-coupled:set-spatialparameters}@*/
|
||||
{
|
||||
typedef Dumux::TutorialSpatialParameters<TypeTag> type;
|
||||
typedef Dumux::TutorialSpatialParametersCoupled<TypeTag> type;
|
||||
};
|
||||
|
||||
// Disable gravity
|
||||
|
@ -1,130 +1,260 @@
|
||||
// $Id$
|
||||
/*****************************************************************************
|
||||
* Copyright (C) 2008-2009 by Markus Wolff *
|
||||
* 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. *
|
||||
*****************************************************************************/
|
||||
#ifndef TUTORIALPROBLEM_DECOUPLED_HH
|
||||
#define TUTORIALPROBLEM_DECOUPLED_HH
|
||||
* 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 *
|
||||
* *
|
||||
* 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. *
|
||||
*****************************************************************************/
|
||||
#ifndef DUMUX_TUTORIALPROBLEM_DECOUPLED_HH
|
||||
#define DUMUX_TUTORIALPROBLEM_DECOUPLED_HH
|
||||
|
||||
#include "dumux/fractionalflow/fractionalflowproblem.hh"
|
||||
#if HAVE_UG
|
||||
#include <dune/grid/uggrid.hh>
|
||||
#endif
|
||||
|
||||
#include <dune/grid/yaspgrid.hh>
|
||||
#include <dune/grid/sgrid.hh>
|
||||
|
||||
#include <dumux/new_material/components/h2o.hh>
|
||||
#include <dumux/new_material/components/oil.hh>
|
||||
|
||||
#include <dumux/new_decoupled/2p/impes/impesproblem2p.hh>
|
||||
#include <dumux/new_decoupled/2p/diffusion/fv/fvvelocity2p.hh>
|
||||
#include <dumux/new_decoupled/2p/transport/fv/fvsaturation2p.hh>
|
||||
#include <dumux/new_decoupled/2p/transport/fv/capillarydiffusion.hh>
|
||||
#include <dumux/new_decoupled/2p/transport/fv/gravitypart.hh>
|
||||
|
||||
#include "tutorialspatialparameters_decoupled.hh"
|
||||
|
||||
namespace Dumux
|
||||
{
|
||||
|
||||
/** \todo Please doc me! */
|
||||
template<class TypeTag>
|
||||
class TutorialProblemDecoupled;
|
||||
|
||||
template<class GridView, class Scalar, class VariableClass> class TutorialProblemDecoupled /*@\label{tutorial-decoupled:tutorialproblem}@*/
|
||||
: public FractionalFlowProblem<GridView, Scalar, VariableClass>
|
||||
//////////
|
||||
// Specify the properties for the lens problem
|
||||
//////////
|
||||
namespace Properties
|
||||
{
|
||||
enum
|
||||
{dim=GridView::dimension, dimWorld = GridView::dimensionworld};
|
||||
enum{wetting = 0, nonwetting = 1};
|
||||
typedef typename GridView::Grid Grid;
|
||||
typedef typename GridView::Intersection Intersection;
|
||||
typedef typename GridView::Traits::template Codim<0>::Entity Element;
|
||||
typedef Dune::FieldVector<Scalar,dim> LocalPosition;
|
||||
typedef Dune::FieldVector<Scalar,dimWorld> GlobalPosition;
|
||||
NEW_TYPE_TAG(TutorialProblemDecoupled, INHERITS_FROM(DecoupledTwoP, Transport));
|
||||
|
||||
// Set the grid type
|
||||
SET_PROP(TutorialProblemDecoupled, Grid)
|
||||
{
|
||||
// typedef Dune::YaspGrid<2> type;
|
||||
typedef Dune::SGrid<2, 2> type;
|
||||
};
|
||||
|
||||
// Set the problem property
|
||||
SET_PROP(TutorialProblemDecoupled, Problem)
|
||||
{
|
||||
public:
|
||||
typedef Dumux::TutorialProblemDecoupled<TTAG(TutorialProblemDecoupled)> type;
|
||||
};
|
||||
|
||||
// Set the model properties
|
||||
SET_PROP(TutorialProblemDecoupled, SaturationModel)
|
||||
{
|
||||
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_PROP(TutorialProblemDecoupled, WettingPhase)
|
||||
{
|
||||
private:
|
||||
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
|
||||
public:
|
||||
typedef Dumux::LiquidPhase<Scalar, Dumux::H2O<Scalar> > type;
|
||||
};
|
||||
|
||||
// Set the non-wetting phase
|
||||
SET_PROP(TutorialProblemDecoupled, NonwettingPhase)
|
||||
{
|
||||
private:
|
||||
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
|
||||
public:
|
||||
typedef Dumux::LiquidPhase<Scalar, Dumux::Oil<Scalar> > type;
|
||||
};
|
||||
|
||||
// Set the soil properties
|
||||
SET_PROP(TutorialProblemDecoupled, SpatialParameters)
|
||||
{
|
||||
private:
|
||||
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Grid)) Grid;
|
||||
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
|
||||
|
||||
public:
|
||||
TutorialProblemDecoupled(VariableClass& variables, Fluid& wettingphase, Fluid& nonwettingphase, Matrix2p<Grid, Scalar>& soil,
|
||||
TwoPhaseRelations<Grid, Scalar>& materialLaw = *(new TwoPhaseRelations<Grid,Scalar>),
|
||||
const Dune::FieldVector<Scalar,dim> Left = 0, const Dune::FieldVector<Scalar,dim> Right = 0)
|
||||
: FractionalFlowProblem<GridView, Scalar, VariableClass>(variables, wettingphase, nonwettingphase, soil, materialLaw),
|
||||
Left_(Left[0]), Right_(Right[0]), eps_(1e-8)
|
||||
{}
|
||||
typedef Dumux::TutorialSpatialParametersDecoupled<TypeTag> type;
|
||||
};
|
||||
|
||||
// function returning source/sink terms for the pressure equation
|
||||
// depending on the position within the domain
|
||||
virtual std::vector<Scalar> source(const GlobalPosition& globalPos,
|
||||
const Element& e, /*@\label{tutorial-decoupled:qpress}@*/
|
||||
const LocalPosition& localPos)
|
||||
SET_TYPE_PROP(TutorialProblemDecoupled, DiffusivePart, Dumux::CapillaryDiffusion<TypeTag>);
|
||||
|
||||
// Disable gravity
|
||||
SET_BOOL_PROP(TutorialProblemDecoupled, EnableGravity, false);
|
||||
|
||||
SET_SCALAR_PROP(TutorialProblemDecoupled, CFLFactor, 0.3);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \ingroup DecoupledProblems
|
||||
*/
|
||||
template<class TypeTag = TTAG(TutorialProblemDecoupled)>
|
||||
class TutorialProblemDecoupled: public IMPESProblem2P<TypeTag, TutorialProblemDecoupled<TypeTag> >
|
||||
{
|
||||
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;
|
||||
|
||||
enum
|
||||
{
|
||||
dim = GridView::dimension, dimWorld = GridView::dimensionworld
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
wPhaseIdx = Indices::wPhaseIdx, nPhaseIdx = Indices::nPhaseIdx
|
||||
};
|
||||
|
||||
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
|
||||
|
||||
typedef typename GridView::Traits::template Codim<0>::Entity Element;
|
||||
typedef typename GridView::Intersection Intersection;
|
||||
typedef Dune::FieldVector<Scalar, dimWorld> GlobalPosition;
|
||||
typedef Dune::FieldVector<Scalar, dim> LocalPosition;
|
||||
|
||||
public:
|
||||
TutorialProblemDecoupled(const GridView &gridView, const GlobalPosition lowerLeft = 0, const GlobalPosition upperRight = 0) :
|
||||
ParentType(gridView), lowerLeft_(lowerLeft), upperRight_(upperRight)
|
||||
{
|
||||
return std::vector<Scalar>(2,0.0);
|
||||
}
|
||||
|
||||
using FractionalFlowProblem<GridView, Scalar, VariableClass>::bctypePress;
|
||||
/*!
|
||||
* \name Problem parameters
|
||||
*/
|
||||
// \{
|
||||
|
||||
// function returning the boundary condition type for solution
|
||||
// of the pressure equation depending on the position within the domain
|
||||
typename BoundaryConditions::Flags bctypePress(const GlobalPosition& globalPos, const Intersection& intersection) const /*@\label{tutorial-decoupled:bctypepress}@*/
|
||||
/*!
|
||||
* \brief The problem name.
|
||||
*
|
||||
* This is used as a prefix for files generated by the simulation.
|
||||
*/
|
||||
const char *name() const
|
||||
{
|
||||
if (globalPos[0] < eps_)
|
||||
return "tutorial_decoupled";
|
||||
}
|
||||
|
||||
bool shouldWriteRestartFile() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Returns the temperature within the domain.
|
||||
*
|
||||
* This problem assumes a temperature of 10 degrees Celsius.
|
||||
*/
|
||||
Scalar temperature(const GlobalPosition& globalPos, const Element& element) const
|
||||
{
|
||||
return 273.15 + 10; // -> 10°C
|
||||
}
|
||||
|
||||
// \}
|
||||
|
||||
Scalar referencePressure(const GlobalPosition& globalPos, const Element& element) const
|
||||
{
|
||||
return 1e5; // -> 10°C
|
||||
}
|
||||
|
||||
std::vector<Scalar> source(const GlobalPosition& globalPos, const Element& element)
|
||||
{
|
||||
return BoundaryConditions::dirichlet;
|
||||
return std::vector<Scalar>(2, 0.0);
|
||||
}
|
||||
|
||||
typename BoundaryConditions::Flags bctypePress(const GlobalPosition& globalPos, const Intersection& intersection) const
|
||||
{
|
||||
if ((globalPos[0] < lowerLeft_[0] + eps_))
|
||||
return BoundaryConditions::dirichlet;
|
||||
// all other boundaries
|
||||
return BoundaryConditions::neumann;
|
||||
}
|
||||
|
||||
// function returning the boundary condition type for solution
|
||||
// of the saturation equation depending on the position within the domain
|
||||
BoundaryConditions::Flags bctypeSat (const GlobalPosition& globalPos, const Intersection& intersection) const /*@\label{tutorial-decoupled:bctypesat}@*/
|
||||
BoundaryConditions::Flags bctypeSat(const GlobalPosition& globalPos, const Intersection& intersection) const
|
||||
{
|
||||
if (globalPos[0]> (Right_ - eps_) || globalPos[0] < eps_)
|
||||
{
|
||||
if (globalPos[0] < lowerLeft_[0] + eps_)
|
||||
return Dumux::BoundaryConditions::dirichlet;
|
||||
}
|
||||
else
|
||||
return Dumux::BoundaryConditions::neumann;
|
||||
}
|
||||
|
||||
Scalar dirichletPress(const GlobalPosition& globalPos, const Intersection& intersection) const
|
||||
{
|
||||
if (globalPos[0] < lowerLeft_[0] + eps_)
|
||||
return 2e5;
|
||||
// all other boundaries
|
||||
return Dumux::BoundaryConditions::neumann;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// function returning the Dirichlet boundary condition for the solution
|
||||
// of the pressure equation depending on the position within the domain
|
||||
Scalar dirichletPress(const GlobalPosition& globalPos, const Intersection& intersection) const /*@\label{tutorial-decoupled:gpress}@*/
|
||||
Scalar dirichletSat(const GlobalPosition& globalPos, const Intersection& intersection) const
|
||||
{
|
||||
return 1e6;
|
||||
if (globalPos[0] < lowerLeft_[0] + eps_)
|
||||
return 1;
|
||||
// all other boundaries
|
||||
return 0;
|
||||
}
|
||||
|
||||
// function returning the Dirichlet boundary condition for the solution
|
||||
// of the saturation equation depending on the position within the domain
|
||||
Scalar dirichletSat(const GlobalPosition& globalPos, const Intersection& intersection) const /*@\label{tutorial-decoupled:gsat}@*/
|
||||
std::vector<Scalar> neumannPress(const GlobalPosition& globalPos, const Intersection& intersection) const
|
||||
{
|
||||
if (globalPos[0] < eps_)
|
||||
std::vector<Scalar> neumannFlux(2,0.0);
|
||||
if (globalPos[0] > upperRight_[0] - eps_)
|
||||
{
|
||||
return 1.0;
|
||||
neumannFlux[nPhaseIdx] = 3e-4;
|
||||
}
|
||||
// all other boundaries
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
using FractionalFlowProblem<GridView, Scalar, VariableClass>::neumannPress;
|
||||
|
||||
// function returning the Neumann boundary condition for the solution
|
||||
// of the pressure equation depending on the position within the domain
|
||||
std::vector<Scalar> neumannPress(const GlobalPosition& globalPos, const Intersection& intersection) const /*@\label{tutorial-decoupled:jpress}@*/
|
||||
{
|
||||
std::vector<Scalar> neumannFlux(2, 0.0);
|
||||
if (globalPos[0]> Right_ - eps_)
|
||||
{
|
||||
neumannFlux[nonwetting] = 3e-4;
|
||||
}
|
||||
// all other boundaries
|
||||
return neumannFlux;
|
||||
}
|
||||
|
||||
// function returning the initial saturation
|
||||
// depending on the position within the domain
|
||||
Scalar initSat (const GlobalPosition& globalPos, const Element& e, /*@\label{tutorial-decoupled:initsat}@*/
|
||||
const Dune::FieldVector<Scalar,dim>& xi) const
|
||||
Scalar neumannSat(const GlobalPosition& globalPos, const Intersection& intersection, Scalar factor) const
|
||||
{
|
||||
return 0.0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Scalar initSat(const GlobalPosition& globalPos, const Element& element) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
private:
|
||||
Scalar Left_;
|
||||
Scalar Right_;
|
||||
GlobalPosition lowerLeft_;
|
||||
GlobalPosition upperRight_;
|
||||
|
||||
Scalar eps_;
|
||||
static const Scalar eps_ = 1e-6;
|
||||
};
|
||||
} // end namespace
|
||||
} //end namespace
|
||||
|
||||
#endif
|
||||
|
@ -27,7 +27,7 @@ namespace Dumux
|
||||
{
|
||||
|
||||
template<class TypeTag>
|
||||
class TutorialSpatialParameters: public BoxSpatialParameters<TypeTag> /*@\label{tutorial-coupled:tutorialSpatialParameters}@*/
|
||||
class TutorialSpatialParametersCoupled: public BoxSpatialParameters<TypeTag> /*@\label{tutorial-coupled:tutorialSpatialParameters}@*/
|
||||
{
|
||||
// Get informations for current implementation via property system
|
||||
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Grid)) Grid;
|
||||
@ -81,7 +81,7 @@ public:
|
||||
}
|
||||
|
||||
// constructor
|
||||
TutorialSpatialParameters(const GridView& gridView) :
|
||||
TutorialSpatialParametersCoupled(const GridView& gridView) :
|
||||
BoxSpatialParameters<TypeTag>(gridView), K_(0)
|
||||
{
|
||||
for (int i = 0; i < dim; i++)
|
||||
|
98
examples/tutorialspatialparameters_decoupled.hh
Normal file
98
examples/tutorialspatialparameters_decoupled.hh
Normal file
@ -0,0 +1,98 @@
|
||||
// $Id: test_2p_spatialparamsinjection.hh 3456 2010-04-09 12:11:51Z mwolff $
|
||||
/*****************************************************************************
|
||||
* Copyright (C) 2008-2009 by Markus Wolff *
|
||||
* 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. *
|
||||
*****************************************************************************/
|
||||
#ifndef TUTORIALSPATIALPARAMETERS_DECOUPLED_HH
|
||||
#define TUTORIALSPATIALPARAMETERS_DECOUPLED_HH
|
||||
|
||||
|
||||
//#include <dumux/new_material/fluidmatrixinteractions/2p/linearmaterial.hh>
|
||||
#include <dumux/new_material/fluidmatrixinteractions/2p/regularizedbrookscorey.hh>
|
||||
#include <dumux/new_material/fluidmatrixinteractions/2p/efftoabslaw.hh>
|
||||
|
||||
namespace Dumux
|
||||
{
|
||||
|
||||
/** \todo Please doc me! */
|
||||
|
||||
template<class TypeTag>
|
||||
class TutorialSpatialParametersDecoupled
|
||||
{
|
||||
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Grid)) Grid;
|
||||
typedef typename GET_PROP_TYPE(TypeTag, PTAG(GridView)) GridView;
|
||||
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
|
||||
typedef typename Grid::ctype CoordScalar;
|
||||
|
||||
enum
|
||||
{dim=Grid::dimension, dimWorld=Grid::dimensionworld, numEq=1};
|
||||
typedef typename Grid::Traits::template Codim<0>::Entity Element;
|
||||
|
||||
typedef Dune::FieldVector<CoordScalar, dimWorld> GlobalPosition;
|
||||
typedef Dune::FieldVector<CoordScalar, dim> LocalPosition;
|
||||
typedef Dune::FieldMatrix<Scalar,dim,dim> FieldMatrix;
|
||||
|
||||
typedef RegularizedBrooksCorey<Scalar> RawMaterialLaw;
|
||||
// typedef LinearMaterial<Scalar> RawMaterialLaw;
|
||||
public:
|
||||
typedef EffToAbsLaw<RawMaterialLaw> MaterialLaw;
|
||||
typedef typename MaterialLaw::Params MaterialLawParams;
|
||||
|
||||
void update (Scalar saturationW, const Element& element)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
const FieldMatrix& intrinsicPermeability (const GlobalPosition& globalPos, const Element& element) const
|
||||
{
|
||||
return K_;
|
||||
}
|
||||
|
||||
double porosity(const GlobalPosition& globalPos, const Element& element) const
|
||||
{
|
||||
return 0.2;
|
||||
}
|
||||
|
||||
|
||||
// return the brooks-corey context depending on the position
|
||||
const MaterialLawParams& materialLawParams(const GlobalPosition& globalPos, const Element &element) const
|
||||
{
|
||||
return materialLawParams_;
|
||||
}
|
||||
|
||||
|
||||
TutorialSpatialParametersDecoupled(const GridView& gridView)
|
||||
: K_(0)
|
||||
{
|
||||
for (int i = 0; i < dim; i++)
|
||||
K_[i][i] = 1e-7;
|
||||
|
||||
// residual saturations
|
||||
materialLawParams_.setSwr(0);
|
||||
materialLawParams_.setSnr(0);
|
||||
|
||||
// parameters for the Brooks-Corey Law
|
||||
// entry pressures
|
||||
materialLawParams_.setPe(10000);
|
||||
|
||||
// Brooks-Corey shape parameters
|
||||
materialLawParams_.setAlpha(2);
|
||||
}
|
||||
|
||||
private:
|
||||
MaterialLawParams materialLawParams_;
|
||||
FieldMatrix K_;
|
||||
};
|
||||
|
||||
} // end namespace
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user