Skip to content
Snippets Groups Projects
Commit 4af7836a authored by Benjamin Faigle's avatar Benjamin Faigle
Browse files

Tolerance levels can now be accessed & changed:

- default implementation still apply tolerances from dune grid howto
- problem can specify other levels via setTolerance(...)

git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@6684 2fb0f335-1f38-0410-981e-8018bf24f1b0
parent 4d19c1aa
No related branches found
No related tags found
No related merge requests found
...@@ -54,9 +54,6 @@ class GridAdapt ...@@ -54,9 +54,6 @@ class GridAdapt
typedef typename Grid::template Codim<0>::Entity Entity; typedef typename Grid::template Codim<0>::Entity Entity;
typedef typename GET_PROP(TypeTag, PTAG(SolutionTypes))::ScalarSolution ScalarSolutionType; typedef typename GET_PROP(TypeTag, PTAG(SolutionTypes))::ScalarSolution ScalarSolutionType;
static constexpr double refinetol = 0.05;
static constexpr double coarsentol = 0.001;
public: public:
/*! /*!
* Constructor for h-adaptive simulations (adaptive grids) * Constructor for h-adaptive simulations (adaptive grids)
...@@ -72,6 +69,8 @@ public: ...@@ -72,6 +69,8 @@ public:
<< " : Dune cannot coarsen to gridlevels smaller 0! "<< std::endl; << " : Dune cannot coarsen to gridlevels smaller 0! "<< std::endl;
standardIndicator_ = true; standardIndicator_ = true;
refinetol_ = 0.05;
coarsentol_ = 0.001;
} }
/*! /*!
...@@ -217,6 +216,24 @@ public: ...@@ -217,6 +216,24 @@ public:
levelMin_ = levMin; levelMin_ = levMin;
levelMax_ = levMax; levelMax_ = levMax;
} }
/*!
* Sets minimum and maximum refinement tolerances
*
* @param coarsentol minimum tolerance when to coarsen
* @param refinetol maximum tolerance when to refine
*/
void setTolerance(Scalar coarsentol, Scalar refinetol)
{
if (coarsentol < 0. or refinetol < 0. )
Dune::dgrave << __FILE__<< ":" <<__LINE__
<< " : Tolerance levels out of meaningful bounds! "<< std::endl;
if (coarsentol > refinetol )
Dune::dgrave << __FILE__<< ":" <<__LINE__
<< " : Check tolerance levels: coarsentol > refinetol! "<< std::endl;
coarsentol_ = coarsentol;
refinetol_ = refinetol;
}
/*! /*!
* Gets maximum refinement level * Gets maximum refinement level
* *
...@@ -272,8 +289,8 @@ private: ...@@ -272,8 +289,8 @@ private:
Scalar globaldelta = globalMax_- globalMin_; Scalar globaldelta = globalMax_- globalMin_;
// globaldelta = std::max(globaldelta,0.1); // globaldelta = std::max(globaldelta,0.1);
refineBound_ = refinetol*globaldelta; refineBound_ = refinetol_*globaldelta;
coarsenBound_ = coarsentol*globaldelta; coarsenBound_ = coarsentol_*globaldelta;
return; return;
} }
...@@ -369,6 +386,8 @@ private: ...@@ -369,6 +386,8 @@ private:
Scalar refineBound_, coarsenBound_; Scalar refineBound_, coarsenBound_;
int marked_, coarsened_; int marked_, coarsened_;
int levelMin_, levelMax_; int levelMin_, levelMax_;
Scalar refinetol_;
Scalar coarsentol_;
Problem& problem_; Problem& problem_;
}; };
...@@ -392,6 +411,8 @@ public: ...@@ -392,6 +411,8 @@ public:
{}; {};
void setLevels(int, int) void setLevels(int, int)
{}; {};
void setTolerance(int, int)
{};
const void setIndicator(const ScalarSolutionType&, const void setIndicator(const ScalarSolutionType&,
const Scalar&, const Scalar&) const Scalar&, const Scalar&)
{}; {};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment