coupled tutorial updated to new material/soil system

This commit is contained in:
Benjamin Faigle 2010-04-06 09:47:25 +00:00 committed by Andreas Lauser
parent 84efa910ae
commit acc1d8557c
2 changed files with 144 additions and 20 deletions

View File

@ -18,8 +18,9 @@
#define DUMUX_TUTORIALPROBLEM_COUPLED_HH
// fluid properties
#include <dumux/material/fluids/water.hh>
#include <dumux/material/fluids/lowviscosityoil.hh>
#include <dumux/new_material/components/simpleh2o.hh>
#include <dumux/new_material/components/simplednapl.hh>
#include <dumux/new_material/fluidsystems/h2o_n2_system.hh>
// the numerical model
#include <dumux/boxmodels/2p/2pboxmodel.hh>
@ -29,7 +30,7 @@
#include <dune/grid/io/file/dgfparser/dgfs.hh>
// the soil to be used
#include "tutorialsoil_coupled.hh"
#include "tutorialspatialparameters_coupled.hh"
namespace Dumux
{
@ -55,7 +56,7 @@ SET_PROP(TutorialProblemCoupled, Grid) /*@\label{tutorial-coupled:set-grid}@*/
typedef Dune::SGrid<2,2> type;
static type *create() /*@\label{tutorial-coupled:create-grid-method}@*/
{
typedef typename SGrid<2,2>::ctype ctype;
typedef typename type::ctype ctype;
Dune::FieldVector<int, 2> cellRes;
Dune::FieldVector<ctype, 2> lowerLeft(0.0);
Dune::FieldVector<ctype, 2> upperRight;
@ -70,18 +71,37 @@ SET_PROP(TutorialProblemCoupled, Grid) /*@\label{tutorial-coupled:set-grid}@*/
};
// Set the wetting and non-wetting phases
SET_TYPE_PROP(TutorialProblemCoupled, WettingPhase, Dumux::Water); /*@\label{tutorial-coupled:set-wetting}@*/
SET_TYPE_PROP(TutorialProblemCoupled, NonwettingPhase, Dumux::LowViscosityOil);/*@\label{tutorial-coupled:set-nonwetting}@*/
SET_PROP(TutorialProblemCoupled, WettingPhase) /*@\label{tutorial-coupled:set-wetting}@*/
{
private:
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
public:
typedef Dumux::LiquidPhase<Scalar, Dumux::SimpleH2O<Scalar> > type;
};
SET_PROP(TutorialProblemCoupled, NonwettingPhase)/*@\label{tutorial-coupled:set-nonwetting}@*/
{
private:
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
public:
typedef Dumux::LiquidPhase<Scalar, Dumux::SimpleDNAPL<Scalar> > type;
};
//SET_PROP(TutorialProblemCoupled, FluidSystem)
//{
// //typedef Dune::Brine_CO2_System<TypeTag, Dune::IFP::CO2Tables> type;
// typedef Dumux::H2O_N2_System<TypeTag> type;
//};
// Set the soil properties
SET_PROP(TutorialProblemCoupled, Soil) /*@\label{tutorial-coupled:set-soil}@*/
SET_PROP(TutorialProblemCoupled, SpatialParameters) /*@\label{tutorial-coupled:set-soil}@*/
{
private:
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Grid)) Grid;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
public:
typedef Dumux::TutorialSoil<Grid, Scalar> type;
typedef Dumux::TutorialSpatialParameters<TypeTag> type;
};
// Disable gravity
@ -141,9 +161,9 @@ public:
{
const GlobalPosition &pos = element.geometry().corner(scvIdx);
if (pos[0] < eps_) // dirichlet conditions on left boundary
values = BoundaryConditions::dirichlet;
values.setAllDirichlet();
else // neuman for the remaining boundaries
values = BoundaryConditions::neumann;
values.setAllNeumann();
}
@ -157,8 +177,8 @@ public:
int scvIdx,
int boundaryFaceIdx) const
{
values[Indices::pW] = 200.0e3; // 200 kPa = 2 bar
values[Indices::sN] = 0.0; // 0 % oil saturation on left boundary
values[Indices::pwIdx] = 200.0e3; // 200 kPa = 2 bar
values[Indices::SnIdx] = 0.0; // 0 % oil saturation on left boundary
}
// Evaluate the boundary conditions for a neumann boundary
@ -178,12 +198,12 @@ public:
if (pos[0] > right - eps_) {
// oil outflux of 0.3 g/(m * s) on the right boundary of
// the domain.
values[Indices::phase2Mass(Indices::wPhase)] = 0;
values[Indices::phase2Mass(Indices::nPhase)] = 0.3e-3;
values[Indices::contiWEqIdx] = 0;
values[Indices::contiNEqIdx] = 0.3e-3;
} else {
// no-flow on the remaining neumann-boundaries
values[Indices::phase2Mass(Indices::wPhase)] = 0;
values[Indices::phase2Mass(Indices::nPhase)] = 0;
values[Indices::contiWEqIdx] = 0;
values[Indices::contiNEqIdx] = 0;
}
}
@ -194,8 +214,8 @@ public:
const FVElementGeometry &fvElemGeom,
int scvIdx) const
{
values[Indices::pW] = 200.0e3; // 200 kPa = 2 bar
values[Indices::sN] = 1.0;
values[Indices::pwIdx] = 200.0e3; // 200 kPa = 2 bar
values[Indices::SnIdx] = 1.0;
}
// Evaluate the source term for all phases within a given
@ -208,8 +228,8 @@ public:
const FVElementGeometry &fvElemGeom,
int scvIdx) const
{
values[Indices::phase2Mass(Indices::wPhase)] = 0.0;
values[Indices::phase2Mass(Indices::nPhase)] = 0.0;
values[Indices::contiWEqIdx] = 0.0;
values[Indices::contiNEqIdx]= 0.0;
}
private:

View File

@ -0,0 +1,104 @@
// $Id$
/*****************************************************************************
* Copyright (C) 2008-2009 by Melanie Darcis *
* 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_COUPLED_HH
#define TUTORIALSPATIALPARAMETERS_COUPLED_HH
#include <dumux/new_material/spatialparameters/boxspatialparameters.hh>
#include <dumux/new_material/fluidmatrixinteractions/2p/regularizedbrookscorey.hh>
#include <dumux/new_material/fluidmatrixinteractions/2p/regularizedlinearmaterial.hh>
#include <dumux/new_material/fluidmatrixinteractions/2p/efftoabslaw.hh>
namespace Dumux
{
template<class TypeTag>
class TutorialSpatialParameters: public BoxSpatialParameters<TypeTag> /*@\label{tutorial-coupled:tutorialSpatialParameters}@*/
{
// Get informations for current implementation via property system
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;
enum
{
dim = Grid::dimension,
dimWorld = Grid::dimensionworld,
};
// Get object types for function arguments
typedef typename GET_PROP_TYPE(TypeTag, PTAG(FVElementGeometry)) FVElementGeometry;
typedef typename Grid::Traits::template Codim<0>::Entity Element;
// select materialLaw to be used
typedef RegularizedBrooksCorey<Scalar> RawMaterialLaw;
// typedef RegularizedLinearMaterial<Scalar> RawMaterialLaw; // example for linear Materiallaw
public:
typedef EffToAbsLaw<RawMaterialLaw> MaterialLaw; // adapter for absolute law
typedef typename MaterialLaw::Params MaterialLawParams; // determine appropriate parameters depening on selected materialLaw
// method returning the intrinsic permeability tensor K depending
// on the position within the domain
const Dune::FieldMatrix<Scalar, dim, dim> &intrinsicPermeability(const Element &element,
const FVElementGeometry &fvElemGeom,
int scvIdx) const
{
return K_;
}
// method returning the porosity of the porous matrix depending on
// the position within the domain
double porosity(const Element &element,
const FVElementGeometry &fvElemGeom,
int scvIdx) const
{
return 0.2;
}
// return the materialLaw context (i.e. BC, regularizedVG, etc) depending on the position
const MaterialLawParams& materialLawParams(const Element &element,
const FVElementGeometry &fvElemGeom,
int scvIdx) const
{
return materialParams_;
}
// constructor
TutorialSpatialParameters(const GridView& gridView) :
BoxSpatialParameters<TypeTag>(gridView), K_(0)
{
for (int i = 0; i < dim; i++)
K_[i][i] = 1e-7;
//set residual saturations
materialParams_.setSwr(0.0);
materialParams_.setSnr(0.0);
//brooks-corey law
materialParams_.setPe(0.0);
materialParams_.setAlpha(2.0);
//linear material law
// materialParams_.setEntryPC(0.0);
// materialParams_.setMaxPC(0.0);
}
private:
Dune::FieldMatrix<Scalar, dim, dim> K_;
// Object that helds the values/parameters of the selected material law.
MaterialLawParams materialParams_;
};
} // end namespace
#endif