1#ifndef __DUNE_ACFEM_ALGORITHMS_STATIONARY_ADAPTIVE_ALGORITHM_HH__
2#define __DUNE_ACFEM_ALGORITHMS_STATIONARY_ADAPTIVE_ALGORITHM_HH__
4#include <dune/fem/solver/timeprovider.hh>
5#include "../algorithms/femschemeinterface.hh"
38 std::pair<double, double>
41 std::string prefix = prefix_ == std::string(
"") ? prefix_ : prefix_ +
".";
43 const bool verbose = Dune::Fem::Parameter::getValue<int>(
"fem.verboserank", -1) != -1;
55 double error = -1., oldError;
56 double estimate = 1., oldEstimate;
57 size_t size = 0, oldSize;
60 const double tolerance = Dune::Fem::Parameter::getValue<double>(prefix+
"adaptation.tolerance", 0.1);
68 error = scheme.
error();
69 size_t size = scheme.
size();
70 if (Fem::Parameter::verbose()) {
71 std::cout <<
"Error: " << error << std::endl;
72 std::cout <<
"#DoFs: " << size << std::endl;
77 while (estimate > tolerance) {
79 scheme.
mark(tolerance);
91 oldEstimate = estimate;
100 error = scheme.
error();
102 size = scheme.
size();
103 if (Fem::Parameter::verbose()) {
104 std::cout <<
"Estimate/Error: " << estimate <<
", " << error << std::endl;
105 std::cout <<
"#DoFs: " << size << std::endl;
106 if (oldEstimate > 0) {
107 double estimatorRatio = oldEstimate/estimate;
108 double errorRatio = oldError/error;
109 double sizeRatio = (double)size/(
double)oldSize;
111 std::cout <<
"Efficiency: "
122 error = scheme.
error();
125 return std::pair<double,double>(estimate, error);
Abstract space adaptative FEM scheme.
Definition: femschemeinterface.hh:60
virtual bool mark(const double tolerance)=0
mark elements for adaptation
virtual void adapt()=0
do the adaptation for a given marking
virtual double estimate()=0
calculate error estimator
virtual size_t size() const =0
return some measure about the number of DOFs in use
virtual double error() const =0
calculate L2/H1 error
virtual int output()=0
data I/O, return -1 if no data has been written otherwise the sequence number of the file
virtual void solve(bool forceMatrixAssembling=true)=0
Solve the system.
virtual void initialize()=0
initialize the solution
static std::pair< double, double > adaptiveAlgorithm(AdaptiveFemScheme &scheme, const std::string &prefix_="")
Stationary adaptive algorithm like adapt_method_stat() from poor old ALBERTA.
Definition: stationaryadaptivealgorithm.hh:39
static UnaryGridFunctionExpression< LogOperation, Function > log(const Fem::Function< typename Function::FunctionSpaceType, Function > &f_)
Component-wise logarithm, log(f)(x) = [log(f(x)_0),...,log(f(x)_N].
Definition: gridfunctionexpression.hh:2844