26 const std::string type,
27 const bool only_Ti_is_ghosted)
30 , only_Ti_is_ghosted(only_Ti_is_ghosted)
36 bi = {{0.245170287303492, 0.184896052186740, 0.569933660509768}};
37 ai = {{0.755726351946097, 0.386954477304099}};
39 else if (type ==
"rk45")
41 bi = {{1153189308089. / 22510343858157.,
42 1772645290293. / 4653164025191.,
43 -1672844663538. / 4480602732383.,
44 2114624349019. / 3568978502595.,
45 5198255086312. / 14908931495163.}};
46 ai = {{970286171893. / 4311952581923.,
47 6584761158862. / 12103376702013.,
48 2251764453980. / 15575788980749.,
49 26877169314380. / 34165994151039.}};
51 else if (type ==
"rk47")
53 bi = {{0.0941840925477795334,
56 -0.122201846148053668,
57 0.0605151571191401122,
59 0.186627171718797670}};
60 ai = {{0.241566650129646868 + bi[0],
61 0.0423866513027719953 + bi[1],
62 0.215602732678803776 + bi[2],
63 0.232328007537583987 + bi[3],
64 0.256223412574146438 + bi[4],
65 0.0978694102142697230 + bi[5]}};
67 else if (type ==
"rk59")
69 bi = {{2274579626619. / 23610510767302.,
70 693987741272. / 12394497460941.,
71 -347131529483. / 15096185902911.,
72 1144057200723. / 32081666971178.,
73 1562491064753. / 11797114684756.,
74 13113619727965. / 44346030145118.,
75 393957816125. / 7825732611452.,
76 720647959663. / 6565743875477.,
77 3559252274877. / 14424734981077.}};
78 ai = {{1107026461565. / 5417078080134.,
79 38141181049399. / 41724347789894.,
80 493273079041. / 11940823631197.,
81 1851571280403. / 6147804934346.,
82 11782306865191. / 62590030070788.,
83 9452544825720. / 13648368537481.,
84 4435885630781. / 26285702406235.,
85 2357909744247. / 11371140753790.}};
88 AssertThrow(
false, dealii::StandardExceptions::ExcNotImplemented());
94 VectorType & solution,
95 const Number ¤t_time,
96 const Number &time_step,
97 const std::function<
void(
const VectorType &, VectorType &,
const Number)>
100 const auto &local_elements = solution.locally_owned_elements();
103 auto perform_stage = [&](
const Number current_time,
104 const Number factor_solution,
105 const Number factor_ai,
106 const VectorType ¤t_Ti,
108 VectorType & solution,
109 VectorType & next_Ti) {
111 op(current_Ti, vec_Ki, current_time);
113 const Number ai = factor_ai;
114 const Number bi = factor_solution;
117 for (
const auto i : local_elements)
119 const Number K_i = vec_Ki(i);
120 const Number sol_i = solution(i);
121 solution(i) = sol_i + bi * K_i;
126 for (
const auto i : local_elements)
128 const Number K_i = vec_Ki(i);
129 const Number sol_i = solution(i);
130 solution(i) = sol_i + bi * K_i;
131 next_Ti(i) = sol_i + ai * K_i;
133 if constexpr (manual_compress)
134 next_Ti.compress(dealii::VectorOperation::insert);
136 if constexpr (manual_compress)
137 solution.compress(dealii::VectorOperation::insert);
142 if (only_Ti_is_ghosted)
145 for (
const auto i : local_elements)
146 vec_Ti(i) = solution(i);
147 if constexpr (manual_compress)
148 vec_Ti.compress(dealii::VectorOperation::insert);
150 perform_stage(current_time,
160 perform_stage(current_time,
171 Number sum_previous_bi = 0;
172 for (
unsigned int stage = 1; stage < bi.size(); ++stage)
174 const Number c_i = sum_previous_bi + ai[stage - 1];
175 perform_stage(current_time + c_i * time_step,
176 bi[stage] * time_step,
177 (stage == bi.size() - 1 ? 0 : ai[stage] * time_step),
182 sum_previous_bi += bi[stage - 1];
void perform_time_step(VectorType &solution, const Number ¤t_time, const Number &time_step, const std::function< void(const VectorType &, VectorType &, const Number)> &op)
Definition time_integrators.templates.h:93