35#ifndef LIMEX_INTEGRATOR_HPP_
36#define LIMEX_INTEGRATOR_HPP_
45#include "common/stopwatch.h"
47#include "lib_algebra/operator/interface/operator.h"
48#include "lib_algebra/operator/interface/operator_inverse.h"
49#include "lib_algebra/operator/linear_solver/linear_solver.h"
50#include "lib_algebra/operator/debug_writer.h"
52#include "lib_disc/function_spaces/grid_function.h"
53#include "lib_disc/assemble_interface.h"
54#include "lib_disc/operator/linear_operator/assembled_linear_operator.h"
55#include "lib_disc/operator/non_linear_operator/assembled_non_linear_operator.h"
56#include "lib_disc/spatial_disc/domain_disc.h"
57#include "lib_disc/time_disc/time_disc_interface.h"
58#include "lib_disc/time_disc/theta_time_step.h"
59#include "lib_disc/time_disc/solution_time_series.h"
60#include "lib_disc/function_spaces/grid_function_util.h"
61#include "lib_disc/function_spaces/metric_spaces.h"
62#include "lib_disc/io/vtkoutput.h"
64#include "lib_grid/refinement/refiner_interface.h"
68#include "time_extrapolation.h"
69#include "time_integrator.hpp"
70#include "../limex_tools.h"
75#include <nlohmann/json.hpp>
78#undef LIMEX_MULTI_THREAD
101static void MyPrintError(UGError &err)
103 for(
size_t i=0;i<err.num_msg();++i)
105 UG_LOG(
"MYERROR "<<i<<
":"<<err.get_msg(i)<<std::endl);
106 UG_LOG(
" [at "<<err.get_file(i)<<
107 ", line "<<err.get_line(i)<<
"]\n");
116 SmartPtr<IRefiner> m_spRefiner;
128 virtual void update_cost(std::vector<number> &costA,
const std::vector<size_t> &vSteps,
const size_t nstages) = 0;
136 LimexDefaultCost(){};
137 void update_cost(std::vector<number> &m_costA,
const std::vector<size_t> &m_vSteps,
const size_t nstages)
139 UG_ASSERT(m_costA.size() >= nstages,
"Huhh: Vectors match in size:" << m_costA.size() <<
"vs." << nstages);
141 UG_LOG(
"A_0="<< m_vSteps[0] << std::endl);
142 m_costA[0] = (1.0)*m_vSteps[0];
143 for (
size_t i=1; i<nstages; ++i)
145 m_costA[i] = m_costA[i-1] + (1.0)*m_vSteps[i];
146 UG_LOG(
"A_i="<< m_vSteps[i] << std::endl);
137 void update_cost(std::vector<number> &m_costA,
const std::vector<size_t> &m_vSteps,
const size_t nstages) {
…}
155 LimexNonlinearCost() :
159 void update_cost(std::vector<number> &m_costA,
const std::vector<size_t> &nSteps,
const size_t nstages)
161 UG_ASSERT(m_costA.size() >= nstages,
"Huhh: Vectors match in size:" << m_costA.size() <<
"vs." << nstages);
165 for (
size_t i=1; i<=nstages; ++i)
159 void update_cost(std::vector<number> &m_costA,
const std::vector<size_t> &nSteps,
const size_t nstages) {
…}
182class LimexTimeIntegratorConfig
186 LimexTimeIntegratorConfig()
190 m_sigmaReduction(0.5),
191 m_greedyOrderIncrease(2.0),
194 m_useCachedMatrices(
false),
198 LimexTimeIntegratorConfig(
unsigned int nstages)
202 m_sigmaReduction(0.5),
203 m_greedyOrderIncrease(2.0),
206 m_useCachedMatrices(
false),
215 double m_sigmaReduction;
217 double m_greedyOrderIncrease;
219 size_t m_max_reductions;
222 bool m_useCachedMatrices;
223 unsigned int m_conservative;
226 NLOHMANN_DEFINE_TYPE_INTRUSIVE(LimexTimeIntegratorConfig,
229 m_useCachedMatrices, m_conservative)
232 std::string config_string()
const {
235 nlohmann::json j(*
this);
239 return std::string(
"EXCEPTION!!!");
242 return std::string(
"LimexTimeIntegratorConfig::config_string()");
182class LimexTimeIntegratorConfig {
…};
249template<
class TDomain,
class TAlgebra>
250class LimexTimeIntegrator
251:
public INonlinearTimeIntegrator<TDomain, TAlgebra>,
252 public DebugWritingObject<TAlgebra>,
253 public LimexTimeIntegratorConfig
258 typedef TAlgebra algebra_type;
259 typedef typename algebra_type::matrix_type matrix_type;
260 typedef typename algebra_type::vector_type vector_type;
261 typedef GridFunction<TDomain, TAlgebra> grid_function_type;
262 typedef INonlinearTimeIntegrator<TDomain, TAlgebra> base_type;
263 typedef typename base_type::solver_type solver_type;
265 typedef IDomainDiscretization<algebra_type> domain_discretization_type;
268 typedef INonlinearTimeIntegrator<TDomain, TAlgebra> itime_integrator_type;
278 ThreadData(SmartPtr<timestep_type> spTimeStep)
279 : m_stepper(spTimeStep)
283 SmartPtr<timestep_type> get_time_stepper()
284 {
return m_stepper; }
287 void set_solver(SmartPtr<solver_type> solver)
288 { m_solver = solver;}
290 SmartPtr<solver_type> get_solver()
293 void set_error(
int e)
301 void set_solution(SmartPtr<grid_function_type> sol)
304 SmartPtr<grid_function_type> get_solution()
307 void set_derivative(SmartPtr<grid_function_type> sol)
310 SmartPtr<grid_function_type> get_derivative()
315 SmartPtr<timestep_type> m_stepper;
316 SmartPtr<solver_type> m_solver;
318 SmartPtr<grid_function_type> m_sol;
319 SmartPtr<grid_function_type> m_dot;
273 class ThreadData {
…};
323 typedef std::vector<SmartPtr<ThreadData> > thread_vector_type;
332 m_vThreadData[i].get_time_stepper()->set_debug(spDebugWriter);
367 void set_stepsize_safety_factor(
double rho) { m_rhoSafety = rho;}
368 void set_stepsize_reduction_factor(
double sigma) { m_sigmaReduction = sigma;}
369 void set_stepsize_greedy_order_factor(
double sigma) { m_greedyOrderIncrease = sigma;}
371 void set_max_reductions(
size_t nred) { m_max_reductions = nred;}
378 { m_spErrorEstimator = spErrorEstim; }
381 void add_stage_base(
size_t nsteps, SmartPtr<solver_type> solver, SmartPtr<domain_discretization_type> spDD, SmartPtr<domain_discretization_type> spGamma=SPNULL)
383 UG_ASSERT(
m_vThreadData.size() ==
m_vSteps.size(),
"ERROR: m_vThreadData and m_vSteps differ in size!");
385 UG_ASSERT(
m_vThreadData.empty() ||
m_vSteps.back()<nsteps,
"ERROR: Sequence of steps must be increasing." );
396 SmartPtr<timestep_type> limexStepSingleton;
397#ifndef LIMEX_MULTI_THREAD
401 limexStepSingleton =
m_vThreadData.back().get_time_stepper();
408 if (spGamma.invalid()) {
409 limexStepSingleton = make_sp(
new timestep_type(spDD));
411 limexStepSingleton = make_sp(
new timestep_type(spDD, spDD, spGamma));
413 UG_ASSERT(limexStepSingleton.valid(),
"Huhh: Invalid pointer")
414#ifndef LIMEX_MULTI_THREAD
418 limexStepSingleton->set_debug(VectorDebugWritingObject<vector_type>::vector_debug_writer());
422 UG_ASSERT(solver.valid(),
"Huhh: Need to supply solver!");
424 UG_ASSERT(
m_vThreadData.back().get_solver().valid(),
"Huhh: Need to supply solver!");
381 void add_stage_base(
size_t nsteps, SmartPtr<solver_type> solver, SmartPtr<domain_discretization_type> spDD, SmartPtr<domain_discretization_type> spGamma=SPNULL) {
…}
427 void add_stage(
size_t nsteps, SmartPtr<solver_type> solver, SmartPtr<domain_discretization_type> spDD)
430 void add_stage_ext(
size_t nsteps, SmartPtr<solver_type> solver, SmartPtr<domain_discretization_type> spDD, SmartPtr<domain_discretization_type> spGamma)
434 void add_stage(
size_t i,
size_t nsteps, SmartPtr<domain_discretization_type> spDD, SmartPtr<solver_type> solver)
436 UG_LOG(
"WARNING: add_stage(i, nsteps ,...) is deprecated. Please use 'add_stage(nsteps ,...) instead!'");
437 add_stage(nsteps, solver, spDD);
434 void add_stage(
size_t i,
size_t nsteps, SmartPtr<domain_discretization_type> spDD, SmartPtr<solver_type> solver) {
…}
441 SmartPtr<timestep_type> get_time_stepper(
size_t i)
468 bool apply(SmartPtr<grid_function_type> u, number t1, ConstSmartPtr<grid_function_type> u0, number t0);
470 number get_cost(
size_t i) {
return m_costA[i]; }
471 number get_gamma(
size_t i) {
return m_gamma[i]; }
472 number get_workload(
size_t i) {
return m_workload[i]; }
476 number& monitor(
size_t k,
size_t q) {
477 UG_ASSERT(k<
m_nstages,
"Huhh: k mismatch");
478 UG_ASSERT(q<
m_nstages,
"Huhh: q mismatch");
505 UG_LOG(
"k= "<< k<<
", A[k]=" <<
m_costA[k] <<
", gamma[k]=" <<
m_gamma[k] <<
"\t");
510 double alpha = pow(m_tol, gamma);
514 monitor(k,q) = pow(alpha/(m_tol * m_rhoSafety), 1.0/
m_gamma[k]);
515 UG_LOG(monitor(k,q) <<
"[" << pow(alpha/(m_tol), 1.0/
m_gamma[k]) <<
"," << gamma<<
","<<
m_costA[k+1] <<
"," <<
m_costA[q+1]<<
","<< alpha <<
"]" <<
"\t");
526 size_t find_optimal_solution(
const std::vector<number>& eps,
size_t ntest,
size_t &qpred);
542 void select_cost_strategy(SmartPtr<ILimexCostStrategy> cost)
543 { m_spCostStrategy = cost;}
547 void set_space(SmartPtr<IGridFunctionSpace<grid_function_type> > spSpace)
547 void set_space(SmartPtr<IGridFunctionSpace<grid_function_type> > spSpace) {
…}
556 void set_conservative(
bool c)
557 { m_conservative = (c) ? 1 : 0; }
559 std::string config_string()
const
560 {
return LimexTimeIntegratorConfig::config_string(); }
564 SmartPtr<error_estim_type> m_spErrorEstimator;
574 std::vector<number> m_workload;
575 std::vector<number> m_lambda;
583 SmartPtr<ILimexCostStrategy> m_spCostStrategy;
596template<
class TDomain,
class TAlgebra>
599 PROFILE_FUNC_GROUP(
"limex");
601 for (
int i=nstages; i>=0; --i)
605 m_vThreadData[i].get_time_stepper()->set_matrix_cache(m_useCachedMatrices);
610template<
class TDomain,
class TAlgebra>
613 PROFILE_FUNC_GROUP(
"limex");
615 for (
int i=nstages; i>=0; --i)
639template<
class TDomain,
class TAlgebra>
642 PROFILE_FUNC_GROUP(
"limex");
654 for (
int i=0; i<=(int)nstages; ++i)
668 time_integrator_type integrator(
m_vThreadData[i].get_time_stepper());
670 integrator.set_dt_min(dtcurr/
m_vSteps[i]);
671 integrator.set_dt_max(dtcurr/
m_vSteps[i]);
672 integrator.set_reduction_factor(0.0);
674 integrator.set_derivative(
m_vThreadData[i].get_derivative());
676 if(this->debug_writer_valid())
678 integrator.set_debug(this->debug_writer());
679 char debug_name_ext[16]; snprintf(debug_name_ext, 16,
"%04d", i);
680 this->enter_debug_writer_section(std::string(
"Stage_") + debug_name_ext);
683 UG_ASSERT(
m_spBanachSpace.valid(),
"Huhh: Need valid (default) banach space");
690 exec = integrator.apply(
m_vThreadData[i].get_solution(), t0+dtcurr, u0, t0);
693 catch(ug::UGError& err)
698 UG_LOGN(
"Step "<< i<<
" failed on stage " << i <<
": " << err.get_msg());
703 this->leave_debug_writer_section();
708 UG_LOGN(
"Step "<< i<<
" failed on stage " << i <<
": reason not clear!" );
721template<
class TDomain,
class TAlgebra>
727 for (
int i=nstages; i>=0; --i)
734template<
class TDomain,
class TAlgebra>
738 for (
int i=nstages; i>=0; --i)
740 UG_ASSERT(
m_vThreadData[i].get_solution()->size()==ucommon->size(),
"LIMEX: Vectors must match in size!")
745template<
class TDomain,
class TAlgebra>
750 const size_t qold=qpred;
758 m_lambda[k] = pow(m_rhoSafety*m_tol/eps[j], 1.0/m_gamma[k]);
759 m_workload[k] = m_costA[j]/m_lambda[k];
760 UG_LOG(
"j=" << j <<
": eps=" << eps[j] <<
", lambda(j)=" <<m_lambda[k] <<
", epsilon(j)=" <<1.0/m_lambda[k] <<
"<= alpha(k, qcurr)=" << monitor(k,qold-1) <<
"< alpha(k, qcurr+1)=" << monitor(k,qold) <<
", A="<< m_costA[j] <<
", W="<< m_workload[k] <<std::endl);
762 for (j=2; j<ntest; ++j)
765 m_lambda[k] = pow(m_rhoSafety*m_tol/eps[j], 1.0/m_gamma[k]);
766 m_workload[k] = m_costA[j]/m_lambda[k];
767 UG_LOG(
"j=" << j <<
": eps=" << eps[j] <<
", lambda(j)=" <<m_lambda[k] <<
", epsilon(j)=" <<1.0/m_lambda[k] <<
"<= alpha(k, qcurr)=" << monitor(k,qold-1) <<
"< alpha(k, qcurr+1)=" << monitor(k,qold) <<
", A="<< m_costA[j] <<
", W="<< m_workload[k] <<std::endl);
772 qpred = (m_workload[qpred-1] > m_workload[k]) ? j : qpred;
773 jbest = (eps[jbest] > eps [j]) ? j : jbest;
779template<
class TDomain,
class TAlgebra>
781apply(SmartPtr<grid_function_type> u, number t1, ConstSmartPtr<grid_function_type> u0, number t0)
783 PROFILE_FUNC_GROUP(
"limex");
791 if (u.get() != u0.get())
802 std::ostringstream ossName;
803 ossName << std::setfill(
'0') << std::setw(4);
804 ossName <<
"Limex_Init_iter" << 0 <<
"_stage" << i;
805 this->write_debug(*
m_vThreadData[i].get_solution(), ossName.str().c_str());
809 double dtcurr = ITimeIntegrator<TDomain, TAlgebra>::get_time_step();
812 size_t qpred = kmax-1;
813 size_t qcurr = qpred;
822 SmartPtr<grid_function_type> ubest = SPNULL;
823 size_t limex_total = 1;
824 size_t limex_success = 0;
828 m_bInterrupt =
false;
830 bool bAsymptoticReduction =
false;
832 const size_t nSwitchHistory=16;
833 const size_t nSwitchLookBack=5;
834 int vSwitchHistory[nSwitchHistory] ={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
837 while ((t < t1) && ((t1-t) > base_type::m_precisionBound))
842 UG_LOG(
"+++ LimexTimestep +++" <<
m_limex_step <<
"\n");
851 number dt = std::min(dtcurr, t1-t);
852 UG_COND_THROW(dt < base_type::get_dt_min(),
"Time step size below minimum. ABORTING! dt=" << dt <<
"; dt_min=" << base_type::get_dt_min() <<
"\n");
856 itime_integrator_type::notify_init_step(u,
m_limex_step, t, dt);
861 ntest = std::min(kmax, qcurr+1);
862 UG_LOG(
"ntest="<< ntest << std::endl);
865 UG_ASSERT(
m_vSteps.size() >= ntest,
"Huhh: sizes do not match: " <<
m_vSteps.size() <<
"<"<<ntest);
872 for (
size_t i=0; i<ntest; ++i)
874 std::ostringstream ossName;
875 ossName << std::setfill(
'0') << std::setw(4);
876 ossName <<
"Limex_BeforeSerial_iter" <<
m_limex_step <<
"_stage" << i <<
"_total" << limex_total;
877 this->write_debug(*
m_vThreadData[i].get_solution(), ossName.str().c_str());
879 if(this->debug_writer_valid())
881 char debug_step_id_ext[16]; snprintf(debug_step_id_ext, 16,
"%04d",
m_limex_step);
882 char debug_total_id_ext[16]; snprintf(debug_total_id_ext, 16,
"%04d", (
int) limex_total);
883 this->enter_debug_writer_section(std::string(
"LimexTimeIntegrator_iter") + debug_step_id_ext +
"_total" + debug_total_id_ext);
889 this->leave_debug_writer_section();
892 for (
size_t i=0; i<ntest; ++i)
894 std::ostringstream ossName;
895 ossName << std::setfill(
'0') << std::setw(4);
896 ossName <<
"Limex_AfterSerial_iter" <<
m_limex_step <<
"_stage" << i <<
"_total" << limex_total;
897 this->write_debug(*
m_vThreadData[i].get_solution(), ossName.str().c_str());
909 UG_ASSERT(m_spErrorEstimator.valid(),
"Huhh: Invalid Error estimator?");
913 bool limexConverged =
false;
917 for (
unsigned int i=1; i<ntest; ++i)
924 for (
unsigned int i=0; i<ntest; ++i)
926 UG_ASSERT(
m_vThreadData[i].get_solution().valid(),
"Huhh: no valid solution?");
932 for (
size_t i=0; i<ntest; ++i)
934 std::ostringstream ossName;
935 ossName << std::setfill(
'0') << std::setw(4);
936 ossName <<
"Limex_Extrapolates_iter" <<
m_limex_step <<
"_stage" << i <<
"_total" << limex_total;
937 this->write_debug(*
m_vThreadData[i].get_solution(), ossName.str().c_str());
942 const std::vector<number>& eps = timex.get_error_estimates();
943 UG_ASSERT(ntest<=eps.size(),
"Huhh: Not enough solutions?");
947 jbest = find_optimal_solution(eps, ntest, qpred);
948 UG_ASSERT(jbest < ntest,
"Huhh: Not enough solutions?");
951 ubest = timex.
get_solution(jbest-m_conservative).template cast_dynamic<grid_function_type>();
955 limexConverged = (epsmin <= m_tol) ;
961 vSwitchHistory[
m_limex_step%nSwitchHistory] = (qpred - qcurr);
962 UG_DLOG(LIB_LIMEX, 5,
"LIMEX-ASYMPTOTIC-ORDER switch: = " << (qpred - qcurr)<< std::endl);
965 for (
int s=nSwitchLookBack-1; s>=0; s--)
967 nSwitches += std::abs(vSwitchHistory[(
m_limex_step-s)%nSwitchHistory]);
968 UG_DLOG(LIB_LIMEX, 6,
"LIMEX-ASYMPTOTIC-ORDER: s[" << s<<
"] = " << vSwitchHistory[(
m_limex_step-s)%nSwitchHistory] << std::endl);
970 UG_DLOG(LIB_LIMEX, 5,
"LIMEX-ASYMPTOTIC-ORDER: nSwitches = " << nSwitches << std::endl);
1014 if (nSwitches >= m_max_reductions) {
1018 bAsymptoticReduction =
true;
1020 for (
int s=nSwitchLookBack-1; s>=0; s--)
1030 if (bAsymptoticReduction)
1034 UG_DLOG(LIB_LIMEX, 5,
"LIMEX-ASYMPTOTIC-ORDER: Reduction: "<< qpred );
1035 UG_DLOG(LIB_LIMEX, 5,
"(kmax=" << kmax <<
", asymptotic"<<
m_asymptotic_order <<
") after "<<m_max_reductions<< std::endl);
1079 double dtpred = dtcurr*std::min(m_lambda[qpred-1], itime_integrator_type::get_increase_factor());
1081 UG_LOG(
"+++++\nget_increase_factor() gives "<<itime_integrator_type::get_increase_factor()<<
" \n+++++++")
1082 UG_LOG(
"koptim=\t" << jbest <<
",\t eps(k)=" << epsmin <<
",\t q=\t" << qpred<<
"("<< ntest <<
"), lambda(q)=" << m_lambda[qpred-1] <<
", alpha(q-1,q)=" << monitor(qpred-1, qpred) <<
"dt(q)=" << dtpred<< std::endl);
1090 if ((qpred+1==ntest)
1095 const double alpha = monitor(qpred-1, qpred);
1096 UG_LOG(
"CHECKING for order increase: "<<
m_costA[qpred] <<
"*" << alpha <<
">" <<
m_costA[qpred+1]);
1101 if (m_greedyOrderIncrease >0.0) {
1102 dtpred *= (1.0-m_greedyOrderIncrease) + m_greedyOrderIncrease*alpha;
1104 UG_LOG(
"... yes.\n")
1107 vSwitchHistory[
m_limex_step%nSwitchHistory] = (qpred - qcurr);
1108 UG_LOG(
"LIMEX-ASYMPTOTIC-ORDER switch update: = " << (qpred - qcurr)<< std::endl);
1111 UG_LOG(
"... nope.\n")
1122 dtcurr = std::min(dtpred, itime_integrator_type::get_dt_max());
1129 number base_dtmin=base_type::get_dt_min();
1130 if(dtcurr <= base_dtmin)
1131 base_type::set_dt_min(base_dtmin*m_sigmaReduction);
1133 dtcurr=std::max(base_type::get_dt_min(), dtcurr*m_sigmaReduction);
1139 number watchTime = stopwatch.ms()/1000.0;
1140 UG_LOGN(
"Time: " << std::setprecision(3) << watchTime <<
"s");
1142 if ((err==0) && limexConverged)
1145 UG_LOG(
"+++ LimexTimestep +++" <<
m_limex_step <<
" ACCEPTED"<< std::endl);
1146 UG_LOG(
" :\t time \t dt (success) \t dt (pred) \tq=\t order (curr)" << qcurr+1 << std::endl);
1147 UG_LOG(
"LIMEX-ACCEPTING:\t" << t <<
"\t"<< dt <<
"\t" << dtcurr <<
"\tq=\t" << qcurr+1 << std::endl);
1156 UG_LOG(
"Computing derivative" << std::endl);
1159 for (
size_t i=0; i<=jbest; ++i)
1163 timex.
apply(jbest+1,
false);
1165 udot = *timex.
get_solution(jbest).template cast_dynamic<grid_function_type>();
1167 std::ostringstream ossName;
1168 ossName << std::setfill(
'0');
1169 ossName <<
"Limex_Derivative_iter" <<
m_limex_step <<
"_total" << limex_total;
1170 this->write_debug(udot, ossName.str().c_str());
1175 UG_ASSERT(ubest.valid(),
"Huhh: Invalid error estimate?");
1180 itime_integrator_type::notify_finalize_step(u,
m_limex_step++, t, dt);
1193 UG_LOG(
"+++ LimexTimestep +++" <<
m_limex_step <<
" FAILED" << std::endl);
1194 UG_LOG(
" :\t time \t dt (failed) \t dt (curr) \teps=\t" << epsmin <<
"\t(tol="<<m_tol<<
")\terr="<<err<< std::endl);
1195 UG_LOG(
"LIMEX-REJECTING:\t" << t <<
"\t"<< dt <<
"\t" << dtcurr <<std::endl);
1197 itime_integrator_type::notify_rewind_step(ubest,
m_limex_step, t+dt, dt);
1204 UG_LOGN(
"Limex interrupted by external command.");
250class LimexTimeIntegrator {
…};
Definition time_extrapolation.h:986
SmartPtr< vector_type > get_solution(size_t i)
get solution (on stage i)
Definition time_extrapolation.h:1020
void set_error_estimate(SmartPtr< ISubDiagErrorEst< vector_type > > subdiag)
set error estimator
Definition time_extrapolation.h:1024
void apply(size_t nstages, bool with_error=true)
best error estimate
Definition time_extrapolation.h:1065
void set_solution(SmartPtr< vector_type > soli, int i)
set solution (for stage i)
Definition time_extrapolation.h:1016
Abstract class for the cost of a limex stage.
Definition limex_integrator.hpp:122
virtual ~ILimexCostStrategy()
destructor
Definition limex_integrator.hpp:125
virtual void update_cost(std::vector< number > &costA, const std::vector< size_t > &vSteps, const size_t nstages)=0
provides the cost for all 0...nstages stages.
Definition limex_integrator.hpp:112
Interface for sub-diagonal error estimator (w.r.t time in Aitken-Neville scheme)
Definition time_extrapolation.h:144
void set_time_step(double dt)
Set initial time step.
Definition time_integrator.hpp:152
Cost is identical to (summation over) number of steps.
Definition limex_integrator.hpp:134
void update_cost(std::vector< number > &m_costA, const std::vector< size_t > &m_vSteps, const size_t nstages)
provides the cost for all 0...nstages stages.
Definition limex_integrator.hpp:137
double m_cMatAdd
! Cost for matrix assembly
Definition limex_integrator.hpp:174
void update_cost(std::vector< number > &m_costA, const std::vector< size_t > &nSteps, const size_t nstages)
provides the cost for all 0...nstages stages.
Definition limex_integrator.hpp:159
int m_useGamma
! Cost for solving Jx=b
Definition limex_integrator.hpp:177
double m_cSolution
! Cost for J=A+B
Definition limex_integrator.hpp:175
Definition limex_integrator.hpp:184
unsigned int m_nstages
Number of Aitken-Neville stages.
Definition limex_integrator.hpp:212
size_t m_asymptotic_order
For PDEs, we may apply an symptotic order reduction.
Definition limex_integrator.hpp:220
Contains all data for parallel execution of time steps.
Definition limex_integrator.hpp:274
Base class for LIMEX time integrator.
Definition limex_integrator.hpp:254
bool apply(SmartPtr< grid_function_type > u, number t1, ConstSmartPtr< grid_function_type > u0, number t0)
Integrating from t0 -> t1.
Definition limex_integrator.hpp:781
void set_debug_for_timestepper(SmartPtr< IDebugWriter< algebra_type > > spDebugWriter)
forward debug info to time integrators
Definition limex_integrator.hpp:328
SmartPtr< grid_function_type > m_spDtSol
Time derivative.
Definition limex_integrator.hpp:581
void init_gamma()
aux: compute exponents gamma_k (for roots)
Definition limex_integrator.hpp:483
std::vector< number > m_costA
Cost A_i (for completing stage i)
Definition limex_integrator.hpp:571
std::vector< number > m_gamma
gamma_i: exponent
Definition limex_integrator.hpp:569
SmartPtr< IGridFunctionSpace< grid_function_type > > m_spBanachSpace
metric space
Definition limex_integrator.hpp:586
void add_error_estimator(SmartPtr< error_estim_type > spErrorEstim)
add an error estimator
Definition limex_integrator.hpp:377
void set_tolerance(double tol)
tolerance
Definition limex_integrator.hpp:366
std::vector< ThreadData > m_vThreadData
vector with thread information
Definition limex_integrator.hpp:567
std::vector< size_t > m_num_reductions
history of reductions
Definition limex_integrator.hpp:577
int m_limex_step
Current counter.
Definition limex_integrator.hpp:589
std::vector< number > m_monitor
Convergence monitor \alpha.
Definition limex_integrator.hpp:572
void set_time_derivative(SmartPtr< grid_function_type > udot)
setter for time derivative info (optional for setting $\Gamma$)
Definition limex_integrator.hpp:530
void add_stage(size_t i, size_t nsteps, SmartPtr< domain_discretization_type > spDD, SmartPtr< solver_type > solver)
! TODO: remove this function!
Definition limex_integrator.hpp:434
std::vector< number > m_consistency_error
Consistency error.
Definition limex_integrator.hpp:579
void dispose_integrator_threads()
Dispose integrator threads (w/ solutions)
Definition limex_integrator.hpp:611
void disable_matrix_cache()
Select approximate Newton (default)
Definition limex_integrator.hpp:540
std::vector< size_t > m_vSteps
generating sequence for extrapolation
Definition limex_integrator.hpp:566
void set_space(SmartPtr< IGridFunctionSpace< grid_function_type > > spSpace)
set banach space (e.g. for computing consistency error)
Definition limex_integrator.hpp:547
bool has_time_derivative()
status for time derivative info (optional for setting $\Gamma$)
Definition limex_integrator.hpp:536
SmartPtr< grid_function_type > get_time_derivative()
getter for time derivative info (optional for setting $\Gamma$)
Definition limex_integrator.hpp:533
void update_integrator_threads(ConstSmartPtr< grid_function_type > ucommon, number t)
Override thread-wise solutions with common solution.
Definition limex_integrator.hpp:735
void enable_matrix_cache()
Select classic LIMEX.
Definition limex_integrator.hpp:539
void interrupt()
interrupt execution of apply() by external call via observer
Definition limex_integrator.hpp:554
void update_monitor()
convergence monitor
Definition limex_integrator.hpp:500
void init_integrator_threads(ConstSmartPtr< grid_function_type > u)
Initialize integrator threads (w/ solutions)
Definition limex_integrator.hpp:597
void update_cost()
Updating workloads A_i for computing T_ii.
Definition limex_integrator.hpp:493
void add_stage_base(size_t nsteps, SmartPtr< solver_type > solver, SmartPtr< domain_discretization_type > spDD, SmartPtr< domain_discretization_type > spGamma=SPNULL)
add a new stage (at end of list)
Definition limex_integrator.hpp:381
int apply_integrator_threads(number dtcurr, ConstSmartPtr< grid_function_type > u0, number t0, size_t nstages)
(Tentatively) apply integrators
Definition limex_integrator.hpp:640
void join_integrator_threads()
e.g. wait for all threads to complete
Definition limex_integrator.hpp:722
Definition linear_implicit_timestep.h:76
Integrate (a non-linear problem) over a given time interval.
Definition simple_integrator.hpp:50