Commit 61efc64a authored by Lukas Riedel's avatar Lukas Riedel 📝

Fix severe bug in the error indicator

Unquaring must occur outside the error indicator because summation
occurs over multiple intersections.
parent ec4b5a17
......@@ -121,7 +121,7 @@ public:
do { // Loop for multiple refinements
Dune::Timer timer3;
float t_setup,t_est,t_strtgy,t_mark,t_adapt;
float t_setup, t_sqrt, t_est, t_strtgy, t_mark, t_adapt;
if(verbose>1)
std::cout << " Refinement Step " << multiRefinementCounter << ": ";
......@@ -144,12 +144,21 @@ public:
estgo.residual(uold,eta);
t_est = timer3.elapsed();
timer3.reset();
// unsquare errors
using Dune::PDELab::Backend::native;
auto& eta_nat = native(eta);
std::transform(eta_nat.begin(), eta_nat.end(), eta_nat.begin(),
[](const auto val) { return std::sqrt(val); }
);
// compute largest error
maxeta = eta.infinity_norm();
if (verbose>1)
std::cout << "Largest Local Error: " << maxeta << " " << std::endl;
t_sqrt = timer3.elapsed();
timer3.reset();
// Stop adaptivity if target error is reached
......
......@@ -195,8 +195,8 @@ namespace Dune {
C_F_T_n *= C_P_T * (2.0 / dim + C_P_T);
// accumulate indicator
r_s.accumulate(lfsv_s,0, std::sqrt( h_T_s * C_F_T_s * sum ));
r_n.accumulate(lfsv_n,0, std::sqrt( h_T_n * C_F_T_n * sum ));
r_s.accumulate(lfsv_s,0, h_T_s * C_F_T_s * sum );
r_n.accumulate(lfsv_n,0, h_T_n * C_F_T_n * sum );
}
template<typename IG, typename LFSU, typename X, typename LFSV, typename R>
......@@ -298,7 +298,7 @@ namespace Dune {
C_F_T_s *= C_P_T * (2.0 / dim + C_P_T);
// accumulate indicator
r_s.accumulate(lfsv_s,0, std::sqrt( h_T_s * C_F_T_s * sum ));
r_s.accumulate(lfsv_s,0, h_T_s * C_F_T_s * sum );
}
private:
......
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