Commit 55bc0042 authored by Timo Koch's avatar Timo Koch
Browse files

[co2] Adapt parameters to new gridcreator interface

The gridcreator interface was slightly changes (see CHANGELOG)
The gridPtr method is no longer publicly available. All grid
methds can bee called through a reference to the grid obtained
by the grid() method. The parameter method for dgf parameters
is now accessible through GridCreator::parameters(...).



git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@15314 2fb0f335-1f38-0410-981e-8018bf24f1b0
parent e772f825
......@@ -15,10 +15,17 @@ Differences Between DuMuX 2.7 and DuMuX 2.8
directly from the start.hh, identical to the other problems. The new parameter
are the TimeManager and the HostGrid.
- The interfacegridcreator is now available as a new GridCreator type.
- The gridcreator is now the new standard grid creator replacing the dgfgridcreator,
it comprises all functionality from the dgf grid creator (see also immediate
interface changes), plus the ability to read gmsh, or build a
structured grid (only with dune 2.4) by merely changing the input file.
* IMMEDIATE INTERFACE CHANGES not allowing/requiring a deprecation period:
- The use and support for SGrid is dropped. SGrid is deprecated in Dune 2.4.
Use YaspGrid instead.
- The (new standard) GridCreator's public method gridPtr has been removed. For
using PARAMETERS from DGF files use the GridCreators parameters method via
GridCreator::parameters(...). See co2 test for an example.
* Deprecated PROPERTY and PARAMETER NAMES, to be removed after 2.8: BEWARE: The
compiler will not print any warning if a deprecated property or parameter name
......
......@@ -113,7 +113,6 @@ class HeterogeneousProblem : public ImplicitPorousMediaProblem<TypeTag>
typedef ImplicitPorousMediaProblem<TypeTag> ParentType;
typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
typedef typename GET_PROP_TYPE(TypeTag, Grid) Grid;
typedef Dune::GridPtr<Grid> GridPointer;
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
typedef typename GET_PROP_TYPE(TypeTag, VolumeVariables) VolumeVariables;
......@@ -128,14 +127,17 @@ class HeterogeneousProblem : public ImplicitPorousMediaProblem<TypeTag>
typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices;
enum {
lPhaseIdx = Indices::wPhaseIdx,
gPhaseIdx = Indices::nPhaseIdx,
gPhaseIdx = Indices::nPhaseIdx
};
enum {
wCompIdx = FluidSystem::wCompIdx,
nCompIdx = FluidSystem::nCompIdx,
nCompIdx = FluidSystem::nCompIdx
};
enum {
BrineIdx = FluidSystem::BrineIdx,
CO2Idx = FluidSystem::CO2Idx,
CO2Idx = FluidSystem::CO2Idx
};
enum {
conti0EqIdx = Indices::conti0EqIdx,
contiCO2EqIdx = conti0EqIdx + CO2Idx
};
......@@ -196,8 +198,9 @@ public:
* - Reporting whether it was used does not work
* - Overwriting on command line not possible
*/
GridPointer *gridPtr = &GridCreator::gridPtr();
this->spatialParams().setParams(gridPtr);
// set the spatial parameters by reading the DGF grid file
this->spatialParams().setParams();
eps_ = 1e-6;
......@@ -245,7 +248,7 @@ public:
* writer.
*/
void addOutputVtkFields()
{
{
typedef Dune::BlockVector<Dune::FieldVector<double, 1> > ScalarField;
// get the number of degrees of freedom
......@@ -292,7 +295,8 @@ public:
this->resultWriter().attachDofData(*Kxx, "Kxx", false); //element data
this->resultWriter().attachDofData(*cellPorosity, "cellwisePorosity", false); //element data
this->resultWriter().attachDofData(*boxVolume, "boxVolume", isBox);
}
}
/*!
* \name Problem parameters
*/
......
......@@ -203,10 +203,8 @@ public:
* - Overwriting on command line not possible
*/
GridPointer *gridPtr = &GridCreator::gridPtr();
this->spatialParams().setParams(gridPtr);
// set the spatial parameters by reading the DGF grid file
this->spatialParams().setParams();
eps_ = 1e-6;
......
......@@ -74,14 +74,12 @@ class HeterogeneousSpatialParams : public ImplicitSpatialParams<TypeTag>
{
typedef ImplicitSpatialParams<TypeTag> ParentType;
typedef typename GET_PROP_TYPE(TypeTag, Grid) Grid;
typedef typename GET_PROP_TYPE(TypeTag, GridCreator) GridCreator;
typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
typedef Dune::GridPtr<Grid> GridPointer;
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
enum {
dim=GridView::dimension
};
enum { dim=GridView::dimension };
typedef typename GET_PROP_TYPE(TypeTag, FVElementGeometry) FVElementGeometry;
typedef typename GridView::template Codim<0>::Entity Element;
......@@ -97,7 +95,7 @@ public:
* \param gridView The grid view
*/
HeterogeneousSpatialParams(const GridView &gridView)
: ParentType(gridView)
: ParentType(gridView), gridView_(gridView)
{
/*
* Layer Index Setup:
......@@ -134,18 +132,17 @@ public:
*
* \param gridPtr The grid pointer
*/
void setParams(GridPointer *gridPtr)
void setParams()
{
gridPtr_ = gridPtr;
int numElements = (*gridPtr_)->leafGridView().size(0);
int numElements = gridView_.size(0);
paramIdx_.resize(numElements);
ElementIterator eIt = (*gridPtr_)->leafGridView().template begin<0>();
const ElementIterator eEndIt = (*gridPtr_)->leafGridView().template end<0>();
ElementIterator eIt = gridView_.template begin<0>();
const ElementIterator eEndIt = gridView_.template end<0>();
for (; eIt != eEndIt; ++eIt)
{
int eIdx = (*gridPtr_)->leafGridView().indexSet().index(*eIt);
int param = (*gridPtr_).parameters(*eIt)[0];
int eIdx = gridView_.indexSet().index(*eIt);
int param = GridCreator::parameters(*eIt)[0];
paramIdx_[eIdx] = param;
}
}
......@@ -162,7 +159,7 @@ public:
int scvIdx) const
{
//Get the global index of the element
int eIdx = (*gridPtr_)->leafGridView().indexSet().index(element);
int eIdx = gridView_.indexSet().index(element);
if (paramIdx_[eIdx] == barrierTop_)
return barrierTopK_;
......@@ -184,7 +181,7 @@ public:
int scvIdx) const
{
//Get the global index of the element
int eIdx = (*gridPtr_)->leafGridView().indexSet().index(element);
int eIdx = gridView_.indexSet().index(element);
if (paramIdx_[eIdx] == barrierTop_)
return barrierTopPorosity_;
......@@ -277,7 +274,7 @@ private:
MaterialLawParams materialParams_;
GridPointer *gridPtr_;
const GridView gridView_;
std::vector<int> paramIdx_;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment