307 return step_imex_22(state_vector, t, tau_max);
309 return step_imex_33(state_vector, t, tau_max);
311 __builtin_unreachable();
316 hyperbolic_module_->set_id_violation_strategy(
318 parabolic_module_->set_id_violation_strategy(
320 hyperbolic_module_->set_cfl(cfl_max_);
324 return single_step();
326 }
catch (
const Restart &restart) {
329 dealii::ExcInternalError());
338 <<
" restart with bang bang control: setting cfl to cfl_min"
341 hyperbolic_module_->set_cfl(cfl_min_);
348 <<
" restart with cruise control: using suggested_tau_max"
365 return single_step();
377 template <
typename Description,
int dim,
typename Number>
378 Number TimeIntegrator<Description, dim, Number>::step_ssprk_22(
379 StateVector &state_vector, Number t, Number tau_max)
384 std::cout <<
"TimeIntegrator<dim, Number>::step_ssprk_22()" << std::endl;
387 Assert(efficiency_ == 1., dealii::ExcInternalError());
390 Number tau = hyperbolic_module_->template step<0>(
391 state_vector, {}, {}, temp_[0], Number(0.), tau_max);
394 hyperbolic_module_->prepare_state_vector(temp_[0], t + 1.0 * tau);
395 hyperbolic_module_->template step<0>(temp_[0], {}, {}, temp_[1], tau);
398 sadd(temp_[1], Number(1.0 / 2.0), Number(1.0 / 2.0), state_vector);
400 state_vector.swap(temp_[1]);
405 template <
typename Description,
int dim,
typename Number>
406 Number TimeIntegrator<Description, dim, Number>::step_ssprk_33(
407 StateVector &state_vector, Number t, Number tau_max)
412 std::cout <<
"TimeIntegrator<dim, Number>::step_ssprk_33()" << std::endl;
415 Assert(efficiency_ == 1., dealii::ExcInternalError());
418 Number tau = hyperbolic_module_->template step<0>(
419 state_vector, {}, {}, temp_[0], Number(0.), tau_max);
422 hyperbolic_module_->prepare_state_vector(temp_[0], t + 1.0 * tau);
423 hyperbolic_module_->template step<0>(temp_[0], {}, {}, temp_[1], tau);
426 sadd(temp_[1], Number(1.0 / 4.0), Number(3.0 / 4.0), state_vector);
429 hyperbolic_module_->prepare_state_vector(temp_[1], t + 0.5 * tau);
430 hyperbolic_module_->template step<0>(temp_[1], {}, {}, temp_[0], tau);
433 sadd(temp_[0], Number(2.0 / 3.0), Number(1.0 / 3.0), state_vector);
435 state_vector.swap(temp_[0]);
440 template <
typename Description,
int dim,
typename Number>
441 Number TimeIntegrator<Description, dim, Number>::step_erk_11(
442 StateVector &state_vector, Number , Number tau_max)
445 std::cout <<
"TimeIntegrator<dim, Number>::step_erk_11()" << std::endl;
448 Assert(efficiency_ == 1., dealii::ExcInternalError());
451 Number tau = hyperbolic_module_->template step<0>(
452 state_vector, {}, {}, temp_[0], Number(0.), tau_max);
454 state_vector.swap(temp_[0]);
459 template <
typename Description,
int dim,
typename Number>
460 Number TimeIntegrator<Description, dim, Number>::step_erk_22(
461 StateVector &state_vector, Number t, Number tau_max)
464 std::cout <<
"TimeIntegrator<dim, Number>::step_erk_22()" << std::endl;
467 Assert(efficiency_ == 2., dealii::ExcInternalError());
470 Number tau = hyperbolic_module_->template step<0>(
471 state_vector, {}, {}, temp_[0], Number(.0), tau_max / efficiency_);
474 hyperbolic_module_->prepare_state_vector(temp_[0], t + 1.0 * tau);
475 hyperbolic_module_->template step<1>(
476 temp_[0], {{state_vector}}, {{Number(-1.)}}, temp_[1], tau);
478 state_vector.swap(temp_[1]);
479 return efficiency_ * tau;
483 template <
typename Description,
int dim,
typename Number>
484 Number TimeIntegrator<Description, dim, Number>::step_erk_33(
485 StateVector &state_vector, Number t, Number tau_max)
488 std::cout <<
"TimeIntegrator<dim, Number>::step_erk_33()" << std::endl;
491 Assert(efficiency_ == 3., dealii::ExcInternalError());
494 Number tau = hyperbolic_module_->template step<0>(
495 state_vector, {}, {}, temp_[0], Number(0.), tau_max / efficiency_);
498 hyperbolic_module_->prepare_state_vector(temp_[0], t + 1.0 * tau);
499 hyperbolic_module_->template step<1>(
500 temp_[0], {{state_vector}}, {{Number(-1.)}}, temp_[1], tau);
506 hyperbolic_module_->prepare_state_vector(temp_[1], t + 2.0 * tau);
507 hyperbolic_module_->template step<2>(temp_[1],
508 {{state_vector, temp_[0]}},
509 {{Number(0.75), Number(-2.)}},
513 state_vector.swap(temp_[2]);
514 return efficiency_ * tau;
518 template <
typename Description,
int dim,
typename Number>
519 Number TimeIntegrator<Description, dim, Number>::step_erk_43(
520 StateVector &state_vector, Number t, Number tau_max)
523 std::cout <<
"TimeIntegrator<dim, Number>::step_erk_43()" << std::endl;
526 Assert(efficiency_ == 4., dealii::ExcInternalError());
529 Number tau = hyperbolic_module_->template step<0>(
530 state_vector, {}, {}, temp_[0], Number(0.), tau_max / efficiency_);
533 hyperbolic_module_->prepare_state_vector(temp_[0], t + 1.0 * tau);
534 hyperbolic_module_->template step<1>(
535 temp_[0], {{state_vector}}, {{Number(-1.)}}, temp_[1], tau);
538 hyperbolic_module_->prepare_state_vector(temp_[1], t + 2.0 * tau);
539 hyperbolic_module_->template step<1>(
540 temp_[1], {{temp_[0]}}, {{Number(-1.)}}, temp_[2], tau);
546 hyperbolic_module_->prepare_state_vector(temp_[2], t + 3.0 * tau);
547 hyperbolic_module_->template step<2>(temp_[2],
548 {{temp_[0], temp_[1]}},
549 {{Number(5. / 3.), Number(-10. / 3.)}},
553 state_vector.swap(temp_[3]);
554 return efficiency_ * tau;
558 template <
typename Description,
int dim,
typename Number>
559 Number TimeIntegrator<Description, dim, Number>::step_erk_54(
560 StateVector &state_vector, Number t, Number tau_max)
563 std::cout <<
"TimeIntegrator<dim, Number>::step_erk_54()" << std::endl;
566 Assert(efficiency_ == 5., dealii::ExcInternalError());
568 constexpr Number c = 0.2;
569 constexpr Number a_21 = +0.2;
570 constexpr Number a_31 = +0.26075582269554909;
571 constexpr Number a_32 = +0.13924417730445096;
572 constexpr Number a_41 = -0.25856517872570289;
573 constexpr Number a_42 = +0.91136274166280729;
574 constexpr Number a_43 = -0.05279756293710430;
575 constexpr Number a_51 = +0.21623276431503774;
576 constexpr Number a_52 = +0.51534223099602405;
577 constexpr Number a_53 = -0.81662794199265554;
578 constexpr Number a_54 = +0.88505294668159373;
579 constexpr Number a_61 = -0.10511678454691901;
580 constexpr Number a_62 = +0.87880047152100838;
581 constexpr Number a_63 = -0.58903404061484477;
582 constexpr Number a_64 = +0.46213380485434047;
583 constexpr Number a_65 [[maybe_unused]] = +0.35321654878641495;
586 Number tau = hyperbolic_module_->template step<0>(
587 state_vector, {}, {}, temp_[0], Number(0.), tau_max / efficiency_);
590 hyperbolic_module_->prepare_state_vector(temp_[0], t + 1.0 * tau);
591 hyperbolic_module_->template step<1>(
592 temp_[0], {{state_vector}}, {{(a_31 - a_21) / c}}, temp_[1], tau);
595 hyperbolic_module_->prepare_state_vector(temp_[1], t + 2.0 * tau);
596 hyperbolic_module_->template step<2>(
598 {{state_vector, temp_[0]}},
599 {{(a_41 - a_31) / c, (a_42 - a_32) / c}},
604 hyperbolic_module_->prepare_state_vector(temp_[2], t + 3.0 * tau);
605 hyperbolic_module_->template step<3>(
607 {{state_vector, temp_[0], temp_[1]}},
608 {{(a_51 - a_41) / c, (a_52 - a_42) / c, (a_53 - a_43) / c}},
613 hyperbolic_module_->prepare_state_vector(temp_[3], t + 4.0 * tau);
614 hyperbolic_module_->template step<4>(
616 {{state_vector, temp_[0], temp_[1], temp_[2]}},
624 state_vector.swap(temp_[4]);
625 return efficiency_ * tau;
629 template <
typename Description,
int dim,
typename Number>
630 Number TimeIntegrator<Description, dim, Number>::step_strang_ssprk_33_cn(
631 StateVector &state_vector, Number t, Number tau_max)
636 std::cout <<
"TimeIntegrator<dim, Number>::step_strang_ssprk_33_cn()"
640 Assert(efficiency_ == 2., dealii::ExcInternalError());
644 Number tau = hyperbolic_module_->template step<0>(
645 state_vector, {}, {}, temp_[0], Number(0.0), tau_max / efficiency_);
647 hyperbolic_module_->prepare_state_vector(temp_[0], t + 1.0 * tau);
648 hyperbolic_module_->template step<0>(temp_[0], {}, {}, temp_[1], tau);
649 sadd(temp_[1], Number(1.0 / 4.0), Number(3.0 / 4.0), state_vector);
651 hyperbolic_module_->prepare_state_vector(temp_[1], t + 0.5 * tau);
652 hyperbolic_module_->template step<0>(temp_[1], {}, {}, temp_[0], tau);
653 sadd(temp_[0], Number(2.0 / 3.0), Number(1.0 / 3.0), state_vector);
658 parabolic_module_->crank_nicolson_step(temp_[0], t, temp_[2], 2.0 * tau);
659 }
catch (Restart &restart) {
661 restart.suggested_tau_max /= efficiency_;
667 hyperbolic_module_->prepare_state_vector( temp_[2], t + 1.0 * tau);
668 hyperbolic_module_->template step<0>( temp_[2], {}, {}, temp_[0], tau);
670 hyperbolic_module_->prepare_state_vector(temp_[0], t + 2.0 * tau);
671 hyperbolic_module_->template step<0>(temp_[0], {}, {}, temp_[1], tau);
672 sadd(temp_[1], Number(1.0 / 4.0), Number(3.0 / 4.0), temp_[2]);
674 hyperbolic_module_->prepare_state_vector(temp_[1], t + 1.5 * tau);
675 hyperbolic_module_->template step<0>(temp_[1], {}, {}, temp_[0], tau);
676 sadd(temp_[0], Number(2.0 / 3.0), Number(1.0 / 3.0), temp_[2]);
678 state_vector.swap(temp_[0]);
679 return efficiency_ * tau;
683 template <
typename Description,
int dim,
typename Number>
684 Number TimeIntegrator<Description, dim, Number>::step_strang_erk_33_cn(
685 StateVector &state_vector, Number t, Number tau_max)
690 std::cout <<
"TimeIntegrator<dim, Number>::step_strang_erk_33_cn()"
694 Assert(efficiency_ == 6., dealii::ExcInternalError());
698 Number tau = hyperbolic_module_->template step<0>(
699 state_vector, {}, {}, temp_[0], Number(0.), tau_max / efficiency_);
701 hyperbolic_module_->prepare_state_vector(temp_[0], t + 1.0 * tau);
702 hyperbolic_module_->template step<1>(
703 temp_[0], {{state_vector}}, {{Number(-1.)}}, temp_[1], tau);
705 hyperbolic_module_->prepare_state_vector(temp_[1], t + 2.0 * tau);
706 hyperbolic_module_->template step<2>(temp_[1],
707 {{state_vector, temp_[0]}},
708 {{Number(0.75), Number(-2.)}},
715 parabolic_module_->crank_nicolson_step(temp_[2], t, temp_[3], 6.0 * tau);
716 }
catch (Restart &restart) {
718 restart.suggested_tau_max /= efficiency_;
724 hyperbolic_module_->prepare_state_vector(temp_[3], t + 3.0 * tau);
725 hyperbolic_module_->template step<0>(
726 temp_[3], {}, {}, temp_[0], tau);
728 hyperbolic_module_->prepare_state_vector(temp_[0], t + 4.0 * tau);
729 hyperbolic_module_->template step<1>(
730 temp_[0], {{ temp_[3]}}, {{Number(-1.)}}, temp_[1], tau);
732 hyperbolic_module_->prepare_state_vector(temp_[1], t + 5.0 * tau);
733 hyperbolic_module_->template step<2>(temp_[1],
734 {{ temp_[3], temp_[0]}},
735 {{Number(0.75), Number(-2.)}},
739 state_vector.swap(temp_[2]);
740 return efficiency_ * tau;
744 template <
typename Description,
int dim,
typename Number>
745 Number TimeIntegrator<Description, dim, Number>::step_strang_erk_43_cn(
746 StateVector &state_vector, Number t, Number tau_max)
751 std::cout <<
"TimeIntegrator<dim, Number>::step_strang_erk_43_cn()"
755 Assert(efficiency_ == 8., dealii::ExcInternalError());
759 Number tau = hyperbolic_module_->template step<0>(
760 state_vector, {}, {}, temp_[0], Number(0.), tau_max / efficiency_);
762 hyperbolic_module_->prepare_state_vector(temp_[0], t + 1.0 * tau);
763 hyperbolic_module_->template step<1>(
764 temp_[0], {{state_vector}}, {{Number(-1.)}}, temp_[1], tau);
766 hyperbolic_module_->prepare_state_vector(temp_[1], t + 2.0 * tau);
767 hyperbolic_module_->template step<1>(
768 temp_[1], {{temp_[0]}}, {{Number(-1.)}}, temp_[2], tau);
770 hyperbolic_module_->prepare_state_vector(temp_[2], t + 3.0 * tau);
771 hyperbolic_module_->template step<2>(temp_[2],
772 {{temp_[0], temp_[1]}},
773 {{Number(5. / 3.), Number(-10. / 3.)}},
780 parabolic_module_->crank_nicolson_step(temp_[3], t, temp_[2], 8.0 * tau);
781 }
catch (Restart &restart) {
783 restart.suggested_tau_max /= efficiency_;
789 hyperbolic_module_->prepare_state_vector(temp_[2], t + 4.0 * tau);
790 hyperbolic_module_->template step<0>(
791 temp_[2], {}, {}, temp_[0], tau);
793 hyperbolic_module_->prepare_state_vector(temp_[0], t + 5.0 * tau);
794 hyperbolic_module_->template step<1>(
795 temp_[0], {{ temp_[2]}}, {{Number(-1.)}}, temp_[1], tau);
797 hyperbolic_module_->prepare_state_vector(temp_[1], t + 6.0 * tau);
798 hyperbolic_module_->template step<1>(
799 temp_[1], {{temp_[0]}}, {{Number(-1.)}}, temp_[2], tau);
801 hyperbolic_module_->prepare_state_vector(temp_[2], t + 7.0 * tau);
802 hyperbolic_module_->template step<2>(temp_[2],
803 {{temp_[0], temp_[1]}},
804 {{Number(5. / 3.), Number(-10. / 3.)}},
808 state_vector.swap(temp_[3]);
809 return efficiency_ * tau;
813 template <
typename Description,
int dim,
typename Number>
814 Number TimeIntegrator<Description, dim, Number>::step_imex_11(
815 StateVector &state_vector, Number t, Number tau_max)
818 std::cout <<
"TimeIntegrator<dim, Number>::step_imex_11()" << std::endl;
821 Assert(efficiency_ == 1., dealii::ExcInternalError());
824 Number tau = hyperbolic_module_->template step<0>(
825 state_vector, {}, {}, temp_[0], Number(0.), tau_max);
828 parabolic_module_->template backward_euler_step<0>(
829 temp_[0], t, {}, {}, temp_[1], 1.0 * tau);
831 state_vector.swap(temp_[1]);
836 template <
typename Description,
int dim,
typename Number>
837 Number TimeIntegrator<Description, dim, Number>::step_imex_22(
838 StateVector &state_vector, Number t, Number tau_max)
841 std::cout <<
"TimeIntegrator<dim, Number>::step_imex_22()" << std::endl;
844 Assert(efficiency_ == 2., dealii::ExcInternalError());
847 Number tau = hyperbolic_module_->template step<0>(
848 state_vector, {}, {}, temp_[0], Number(0.), tau_max / efficiency_);
851 parabolic_module_->template backward_euler_step<0>(
852 temp_[0], t, {}, {}, temp_[1], tau);
855 hyperbolic_module_->prepare_state_vector(temp_[1], t + 1.0 * tau);
856 hyperbolic_module_->template step<1>(
857 temp_[1], {{state_vector}}, {{Number(-1.)}}, temp_[2], tau);
860 parabolic_module_->template backward_euler_step<1>(temp_[2],
867 state_vector.swap(temp_[3]);
868 return efficiency_ * tau;
872 template <
typename Description,
int dim,
typename Number>
873 Number TimeIntegrator<Description, dim, Number>::step_imex_33(
874 StateVector &state_vector, Number t, Number tau_max)
877 std::cout <<
"TimeIntegrator<dim, Number>::step_imex_33()" << std::endl;
880 Assert(efficiency_ == 3., dealii::ExcInternalError());
884 const Number gamma = Number(0.5) + std::sqrt(Number(3.0)) / Number(6.0);
887 Number tau = hyperbolic_module_->template step<0>(
888 state_vector, {}, {}, temp_[0], Number(0.), tau_max / efficiency_);
891 parabolic_module_->template backward_euler_step<1>(
895 {{Number(1. - 3. * gamma)}},
900 hyperbolic_module_->prepare_state_vector(temp_[1], t + 1.0 * tau);
901 hyperbolic_module_->template step<1>(
902 temp_[1], {{state_vector}}, {{Number(-1.)}}, temp_[2], tau);
908 parabolic_module_->template backward_euler_step<2>(
911 {{state_vector, temp_[1]}},
912 {{Number(6. * gamma - 1.), Number(2. - 9 * gamma)}},
917 hyperbolic_module_->prepare_state_vector(temp_[3], t + 2. * tau);
918 hyperbolic_module_->template step<2>(temp_[3],
919 {{state_vector, temp_[1]}},
920 {{Number(0.75), Number(-2.)}},
925 parabolic_module_->template backward_euler_step<3>(
928 {{state_vector, temp_[1], temp_[3]}},
929 {{Number(0.75 - 3. * gamma),
930 Number(6. * gamma - 2.),
931 Number(9. / 4. - 3. * gamma)}},
935 state_vector.swap(temp_[5]);
936 return efficiency_ * tau;