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$
|
// $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 *
|
* Institute of Hydraulic Engineering *
|
||||||
* University of Stuttgart, Germany *
|
* University of Stuttgart, Germany *
|
||||||
* email: <givenname>.<name>@iws.uni-stuttgart.de *
|
* email: <givenname>.<name>@iws.uni-stuttgart.de *
|
||||||
@ -14,104 +16,98 @@
|
|||||||
* This program is distributed WITHOUT ANY WARRANTY. *
|
* This program is distributed WITHOUT ANY WARRANTY. *
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
#include "config.h"
|
#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)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
try{
|
try {
|
||||||
// define the problem dimensions
|
typedef TTAG(TutorialProblemDecoupled) TypeTag;
|
||||||
const int dim=2; /*@\label{tutorial-decoupled:dim}@*/
|
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
|
static const int dim = Grid::dimension;
|
||||||
typedef double Scalar; /*@\label{tutorial-decoupled:grid-begin}@*/
|
|
||||||
typedef Dune::SGrid<dim,dim> Grid;
|
// initialize MPI, finalize is done automatically on exit
|
||||||
typedef Grid::LevelGridView GridView;
|
Dune::MPIHelper::instance(argc, argv);
|
||||||
typedef Dune::FieldVector<Grid::ctype,dim> FieldVector;
|
|
||||||
Dune::FieldVector<int,dim> N(10); N[0] = 30;
|
////////////////////////////////////////////////////////////
|
||||||
FieldVector L(0);
|
// parse the command line arguments
|
||||||
FieldVector H(60); H[0] = 300;
|
////////////////////////////////////////////////////////////
|
||||||
|
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);
|
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
|
Problem problem(grid.leafView(), L, H);
|
||||||
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}@*/
|
|
||||||
|
|
||||||
// create object containing the variables
|
// load restart file if necessarry
|
||||||
typedef Dumux::VariableClass<GridView, Scalar> VariableClass;
|
if (restart)
|
||||||
VariableClass variables(gridView);
|
problem.deserialize(restartTime);
|
||||||
|
|
||||||
//choose kind of two-phase model. Default: pw, Sw, vtotal
|
// run the simulation
|
||||||
struct Dumux::DefineModel modelDef;
|
if (!problem.simulate(dt, tEnd))
|
||||||
// modelDef.pressureType = modelDef.pressureW;
|
return 2;
|
||||||
// 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}@*/
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
catch (Dune::Exception &e){
|
catch (Dune::Exception &e) {
|
||||||
std::cerr << "Dune reported error: " << e << std::endl;
|
std::cerr << "Dune reported error: " << e << std::endl;
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
catch (...){
|
catch (...) {
|
||||||
std::cerr << "Unknown exception thrown!" << std::endl;
|
std::cerr << "Unknown exception thrown!\n";
|
||||||
return 1;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 3;
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ SET_PROP(TutorialProblemCoupled, FluidSystem) /*@\label{tutorial-coupled:set-f
|
|||||||
// Set the spatial parameters
|
// Set the spatial parameters
|
||||||
SET_PROP(TutorialProblemCoupled, SpatialParameters) /*@\label{tutorial-coupled:set-spatialparameters}@*/
|
SET_PROP(TutorialProblemCoupled, SpatialParameters) /*@\label{tutorial-coupled:set-spatialparameters}@*/
|
||||||
{
|
{
|
||||||
typedef Dumux::TutorialSpatialParameters<TypeTag> type;
|
typedef Dumux::TutorialSpatialParametersCoupled<TypeTag> type;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Disable gravity
|
// Disable gravity
|
||||||
|
@ -1,130 +1,260 @@
|
|||||||
// $Id$
|
// $Id$
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Copyright (C) 2008-2009 by Markus Wolff *
|
* Copyright (C) 2007-2008 by Klaus Mosthaf *
|
||||||
* Institute of Hydraulic Engineering *
|
* Copyright (C) 2007-2008 by Bernd Flemisch *
|
||||||
* University of Stuttgart, Germany *
|
* Copyright (C) 2008-2009 by Andreas Lauser *
|
||||||
* email: <givenname>.<name>@iws.uni-stuttgart.de *
|
* Institute of Hydraulic Engineering *
|
||||||
* *
|
* University of Stuttgart, Germany *
|
||||||
* This program is free software; you can redistribute it and/or modify *
|
* email: <givenname>.<name>@iws.uni-stuttgart.de *
|
||||||
* it under the terms of the GNU General Public License as published by *
|
* *
|
||||||
* the Free Software Foundation; either version 2 of the License, or *
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
* (at your option) any later version, as long as this copyright notice *
|
* it under the terms of the GNU General Public License as published by *
|
||||||
* is included in its original form. *
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
* *
|
* (at your option) any later version, as long as this copyright notice *
|
||||||
* This program is distributed WITHOUT ANY WARRANTY. *
|
* is included in its original form. *
|
||||||
*****************************************************************************/
|
* *
|
||||||
#ifndef TUTORIALPROBLEM_DECOUPLED_HH
|
* This program is distributed WITHOUT ANY WARRANTY. *
|
||||||
#define TUTORIALPROBLEM_DECOUPLED_HH
|
*****************************************************************************/
|
||||||
|
#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
|
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
|
NEW_TYPE_TAG(TutorialProblemDecoupled, INHERITS_FROM(DecoupledTwoP, Transport));
|
||||||
{dim=GridView::dimension, dimWorld = GridView::dimensionworld};
|
|
||||||
enum{wetting = 0, nonwetting = 1};
|
// Set the grid type
|
||||||
typedef typename GridView::Grid Grid;
|
SET_PROP(TutorialProblemDecoupled, Grid)
|
||||||
typedef typename GridView::Intersection Intersection;
|
{
|
||||||
typedef typename GridView::Traits::template Codim<0>::Entity Element;
|
// typedef Dune::YaspGrid<2> type;
|
||||||
typedef Dune::FieldVector<Scalar,dim> LocalPosition;
|
typedef Dune::SGrid<2, 2> type;
|
||||||
typedef Dune::FieldVector<Scalar,dimWorld> GlobalPosition;
|
};
|
||||||
|
|
||||||
|
// 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:
|
public:
|
||||||
TutorialProblemDecoupled(VariableClass& variables, Fluid& wettingphase, Fluid& nonwettingphase, Matrix2p<Grid, Scalar>& soil,
|
typedef Dumux::TutorialSpatialParametersDecoupled<TypeTag> type;
|
||||||
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)
|
|
||||||
{}
|
|
||||||
|
|
||||||
// function returning source/sink terms for the pressure equation
|
SET_TYPE_PROP(TutorialProblemDecoupled, DiffusivePart, Dumux::CapillaryDiffusion<TypeTag>);
|
||||||
// depending on the position within the domain
|
|
||||||
virtual std::vector<Scalar> source(const GlobalPosition& globalPos,
|
// Disable gravity
|
||||||
const Element& e, /*@\label{tutorial-decoupled:qpress}@*/
|
SET_BOOL_PROP(TutorialProblemDecoupled, EnableGravity, false);
|
||||||
const LocalPosition& localPos)
|
|
||||||
|
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
|
* \brief The problem name.
|
||||||
typename BoundaryConditions::Flags bctypePress(const GlobalPosition& globalPos, const Intersection& intersection) const /*@\label{tutorial-decoupled:bctypepress}@*/
|
*
|
||||||
|
* 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
|
// all other boundaries
|
||||||
return BoundaryConditions::neumann;
|
return BoundaryConditions::neumann;
|
||||||
}
|
}
|
||||||
|
|
||||||
// function returning the boundary condition type for solution
|
BoundaryConditions::Flags bctypeSat(const GlobalPosition& globalPos, const Intersection& intersection) const
|
||||||
// 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}@*/
|
|
||||||
{
|
{
|
||||||
if (globalPos[0]> (Right_ - eps_) || globalPos[0] < eps_)
|
if (globalPos[0] < lowerLeft_[0] + eps_)
|
||||||
{
|
|
||||||
return Dumux::BoundaryConditions::dirichlet;
|
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
|
// all other boundaries
|
||||||
return Dumux::BoundaryConditions::neumann;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// function returning the Dirichlet boundary condition for the solution
|
Scalar dirichletSat(const GlobalPosition& globalPos, const Intersection& intersection) const
|
||||||
// of the pressure equation depending on the position within the domain
|
|
||||||
Scalar dirichletPress(const GlobalPosition& globalPos, const Intersection& intersection) const /*@\label{tutorial-decoupled:gpress}@*/
|
|
||||||
{
|
{
|
||||||
return 1e6;
|
if (globalPos[0] < lowerLeft_[0] + eps_)
|
||||||
|
return 1;
|
||||||
|
// all other boundaries
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// function returning the Dirichlet boundary condition for the solution
|
std::vector<Scalar> neumannPress(const GlobalPosition& globalPos, const Intersection& intersection) const
|
||||||
// of the saturation equation depending on the position within the domain
|
|
||||||
Scalar dirichletSat(const GlobalPosition& globalPos, const Intersection& intersection) const /*@\label{tutorial-decoupled:gsat}@*/
|
|
||||||
{
|
{
|
||||||
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;
|
return neumannFlux;
|
||||||
}
|
}
|
||||||
|
|
||||||
// function returning the initial saturation
|
Scalar neumannSat(const GlobalPosition& globalPos, const Intersection& intersection, Scalar factor) const
|
||||||
// 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
|
|
||||||
{
|
{
|
||||||
return 0.0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
Scalar initSat(const GlobalPosition& globalPos, const Element& element) const
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Scalar Left_;
|
GlobalPosition lowerLeft_;
|
||||||
Scalar Right_;
|
GlobalPosition upperRight_;
|
||||||
|
|
||||||
Scalar eps_;
|
static const Scalar eps_ = 1e-6;
|
||||||
};
|
};
|
||||||
} // end namespace
|
} //end namespace
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -27,7 +27,7 @@ namespace Dumux
|
|||||||
{
|
{
|
||||||
|
|
||||||
template<class TypeTag>
|
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
|
// Get informations for current implementation via property system
|
||||||
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Grid)) Grid;
|
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Grid)) Grid;
|
||||||
@ -81,7 +81,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
TutorialSpatialParameters(const GridView& gridView) :
|
TutorialSpatialParametersCoupled(const GridView& gridView) :
|
||||||
BoxSpatialParameters<TypeTag>(gridView), K_(0)
|
BoxSpatialParameters<TypeTag>(gridView), K_(0)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < dim; i++)
|
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