306 parabolic_module_->set_id_violation_strategy(
308 hyperbolic_module_->set_cfl(cfl_max_);
312 return single_step();
314 }
catch (
const Restart &restart) {
317 dealii::ExcInternalError());
326 <<
" restart with bang bang control: setting cfl to cfl_min"
329 hyperbolic_module_->set_cfl(cfl_min_);
336 <<
" restart with cruise control: using suggested_tau_max"
350 std::min(tau_max, efficiency_ * Number(restart.suggested_tau_max));
353 return single_step();
365 template <
typename Description,
int dim,
typename Number>
366 Number TimeIntegrator<Description, dim, Number>::step_ssprk_22(
367 StateVector &state_vector, Number t, Number tau_max)
372 std::cout <<
"TimeIntegrator<dim, Number>::step_ssprk_22()" << std::endl;
375 Assert(efficiency_ == 1., dealii::ExcInternalError());
378 Number tau = hyperbolic_module_->template step<0>(
379 state_vector, {}, {}, temp_[0], Number(0.), tau_max);
382 hyperbolic_module_->prepare_state_vector(temp_[0], t + 1.0 * tau);
383 hyperbolic_module_->template step<0>(temp_[0], {}, {}, temp_[1], tau);
386 sadd(temp_[1], Number(1.0 / 2.0), Number(1.0 / 2.0), state_vector);
388 state_vector.swap(temp_[1]);
393 template <
typename Description,
int dim,
typename Number>
394 Number TimeIntegrator<Description, dim, Number>::step_ssprk_33(
395 StateVector &state_vector, Number t, Number tau_max)
400 std::cout <<
"TimeIntegrator<dim, Number>::step_ssprk_33()" << std::endl;
403 Assert(efficiency_ == 1., dealii::ExcInternalError());
406 Number tau = hyperbolic_module_->template step<0>(
407 state_vector, {}, {}, temp_[0], Number(0.), tau_max);
410 hyperbolic_module_->prepare_state_vector(temp_[0], t + 1.0 * tau);
411 hyperbolic_module_->template step<0>(temp_[0], {}, {}, temp_[1], tau);
414 sadd(temp_[1], Number(1.0 / 4.0), Number(3.0 / 4.0), state_vector);
417 hyperbolic_module_->prepare_state_vector(temp_[1], t + 0.5 * tau);
418 hyperbolic_module_->template step<0>(temp_[1], {}, {}, temp_[0], tau);
421 sadd(temp_[0], Number(2.0 / 3.0), Number(1.0 / 3.0), state_vector);
423 state_vector.swap(temp_[0]);
428 template <
typename Description,
int dim,
typename Number>
429 Number TimeIntegrator<Description, dim, Number>::step_erk_11(
430 StateVector &state_vector, Number , Number tau_max)
433 std::cout <<
"TimeIntegrator<dim, Number>::step_erk_11()" << std::endl;
436 Assert(efficiency_ == 1., dealii::ExcInternalError());
439 Number tau = hyperbolic_module_->template step<0>(
440 state_vector, {}, {}, temp_[0], Number(0.), tau_max);
442 state_vector.swap(temp_[0]);
447 template <
typename Description,
int dim,
typename Number>
448 Number TimeIntegrator<Description, dim, Number>::step_erk_22(
449 StateVector &state_vector, Number t, Number tau_max)
452 std::cout <<
"TimeIntegrator<dim, Number>::step_erk_22()" << std::endl;
455 Assert(efficiency_ == 2., dealii::ExcInternalError());
458 Number tau = hyperbolic_module_->template step<0>(
459 state_vector, {}, {}, temp_[0], Number(.0), tau_max / efficiency_);
462 hyperbolic_module_->prepare_state_vector(temp_[0], t + 1.0 * tau);
463 hyperbolic_module_->template step<1>(
464 temp_[0], {{state_vector}}, {{Number(-1.)}}, temp_[1], tau);
466 state_vector.swap(temp_[1]);
467 return efficiency_ * tau;
471 template <
typename Description,
int dim,
typename Number>
472 Number TimeIntegrator<Description, dim, Number>::step_erk_33(
473 StateVector &state_vector, Number t, Number tau_max)
476 std::cout <<
"TimeIntegrator<dim, Number>::step_erk_33()" << std::endl;
479 Assert(efficiency_ == 3., dealii::ExcInternalError());
482 Number tau = hyperbolic_module_->template step<0>(
483 state_vector, {}, {}, temp_[0], Number(0.), tau_max / efficiency_);
486 hyperbolic_module_->prepare_state_vector(temp_[0], t + 1.0 * tau);
487 hyperbolic_module_->template step<1>(
488 temp_[0], {{state_vector}}, {{Number(-1.)}}, temp_[1], tau);
494 hyperbolic_module_->prepare_state_vector(temp_[1], t + 2.0 * tau);
495 hyperbolic_module_->template step<2>(temp_[1],
496 {{state_vector, temp_[0]}},
497 {{Number(0.75), Number(-2.)}},
501 state_vector.swap(temp_[2]);
502 return efficiency_ * tau;
506 template <
typename Description,
int dim,
typename Number>
507 Number TimeIntegrator<Description, dim, Number>::step_erk_43(
508 StateVector &state_vector, Number t, Number tau_max)
511 std::cout <<
"TimeIntegrator<dim, Number>::step_erk_43()" << std::endl;
514 Assert(efficiency_ == 4., dealii::ExcInternalError());
517 Number tau = hyperbolic_module_->template step<0>(
518 state_vector, {}, {}, temp_[0], Number(0.), tau_max / efficiency_);
521 hyperbolic_module_->prepare_state_vector(temp_[0], t + 1.0 * tau);
522 hyperbolic_module_->template step<1>(
523 temp_[0], {{state_vector}}, {{Number(-1.)}}, temp_[1], tau);
526 hyperbolic_module_->prepare_state_vector(temp_[1], t + 2.0 * tau);
527 hyperbolic_module_->template step<1>(
528 temp_[1], {{temp_[0]}}, {{Number(-1.)}}, temp_[2], tau);
534 hyperbolic_module_->prepare_state_vector(temp_[2], t + 3.0 * tau);
535 hyperbolic_module_->template step<2>(temp_[2],
536 {{temp_[0], temp_[1]}},
537 {{Number(5. / 3.), Number(-10. / 3.)}},
541 state_vector.swap(temp_[3]);
542 return efficiency_ * tau;
546 template <
typename Description,
int dim,
typename Number>
547 Number TimeIntegrator<Description, dim, Number>::step_erk_54(
548 StateVector &state_vector, Number t, Number tau_max)
551 std::cout <<
"TimeIntegrator<dim, Number>::step_erk_54()" << std::endl;
554 Assert(efficiency_ == 5., dealii::ExcInternalError());
556 constexpr Number c = 0.2;
557 constexpr Number a_21 = +0.2;
558 constexpr Number a_31 = +0.26075582269554909;
559 constexpr Number a_32 = +0.13924417730445096;
560 constexpr Number a_41 = -0.25856517872570289;
561 constexpr Number a_42 = +0.91136274166280729;
562 constexpr Number a_43 = -0.05279756293710430;
563 constexpr Number a_51 = +0.21623276431503774;
564 constexpr Number a_52 = +0.51534223099602405;
565 constexpr Number a_53 = -0.81662794199265554;
566 constexpr Number a_54 = +0.88505294668159373;
567 constexpr Number a_61 = -0.10511678454691901;
568 constexpr Number a_62 = +0.87880047152100838;
569 constexpr Number a_63 = -0.58903404061484477;
570 constexpr Number a_64 = +0.46213380485434047;
571 constexpr Number a_65 [[maybe_unused]] = +0.35321654878641495;
574 Number tau = hyperbolic_module_->template step<0>(
575 state_vector, {}, {}, temp_[0], Number(0.), tau_max / efficiency_);
578 hyperbolic_module_->prepare_state_vector(temp_[0], t + 1.0 * tau);
579 hyperbolic_module_->template step<1>(
580 temp_[0], {{state_vector}}, {{(a_31 - a_21) / c}}, temp_[1], tau);
583 hyperbolic_module_->prepare_state_vector(temp_[1], t + 2.0 * tau);
584 hyperbolic_module_->template step<2>(
586 {{state_vector, temp_[0]}},
587 {{(a_41 - a_31) / c, (a_42 - a_32) / c}},
592 hyperbolic_module_->prepare_state_vector(temp_[2], t + 3.0 * tau);
593 hyperbolic_module_->template step<3>(
595 {{state_vector, temp_[0], temp_[1]}},
596 {{(a_51 - a_41) / c, (a_52 - a_42) / c, (a_53 - a_43) / c}},
601 hyperbolic_module_->prepare_state_vector(temp_[3], t + 4.0 * tau);
602 hyperbolic_module_->template step<4>(
604 {{state_vector, temp_[0], temp_[1], temp_[2]}},
612 state_vector.swap(temp_[4]);
613 return efficiency_ * tau;
617 template <
typename Description,
int dim,
typename Number>
618 Number TimeIntegrator<Description, dim, Number>::step_strang_ssprk_33_cn(
619 StateVector &state_vector, Number t, Number tau_max)
624 std::cout <<
"TimeIntegrator<dim, Number>::step_strang_ssprk_33_cn()"
628 Assert(efficiency_ == 2., dealii::ExcInternalError());
632 Number tau = hyperbolic_module_->template step<0>(
633 state_vector, {}, {}, temp_[0], Number(0.0), tau_max / efficiency_);
635 hyperbolic_module_->prepare_state_vector(temp_[0], t + 1.0 * tau);
636 hyperbolic_module_->template step<0>(temp_[0], {}, {}, temp_[1], tau);
637 sadd(temp_[1], Number(1.0 / 4.0), Number(3.0 / 4.0), state_vector);
639 hyperbolic_module_->prepare_state_vector(temp_[1], t + 0.5 * tau);
640 hyperbolic_module_->template step<0>(temp_[1], {}, {}, temp_[0], tau);
641 sadd(temp_[0], Number(2.0 / 3.0), Number(1.0 / 3.0), state_vector);
646 parabolic_module_->crank_nicolson_step(temp_[0], t, temp_[2], 2.0 * tau);
647 }
catch (Restart &restart) {
649 restart.suggested_tau_max /= efficiency_;
655 hyperbolic_module_->prepare_state_vector( temp_[2], t + 1.0 * tau);
656 hyperbolic_module_->template step<0>( temp_[2], {}, {}, temp_[0], tau);
658 hyperbolic_module_->prepare_state_vector(temp_[0], t + 2.0 * tau);
659 hyperbolic_module_->template step<0>(temp_[0], {}, {}, temp_[1], tau);
660 sadd(temp_[1], Number(1.0 / 4.0), Number(3.0 / 4.0), temp_[2]);
662 hyperbolic_module_->prepare_state_vector(temp_[1], t + 1.5 * tau);
663 hyperbolic_module_->template step<0>(temp_[1], {}, {}, temp_[0], tau);
664 sadd(temp_[0], Number(2.0 / 3.0), Number(1.0 / 3.0), temp_[2]);
666 state_vector.swap(temp_[0]);
667 return efficiency_ * tau;
671 template <
typename Description,
int dim,
typename Number>
672 Number TimeIntegrator<Description, dim, Number>::step_strang_erk_33_cn(
673 StateVector &state_vector, Number t, Number tau_max)
678 std::cout <<
"TimeIntegrator<dim, Number>::step_strang_erk_33_cn()"
682 Assert(efficiency_ == 6., dealii::ExcInternalError());
686 Number tau = hyperbolic_module_->template step<0>(
687 state_vector, {}, {}, temp_[0], Number(0.), tau_max / efficiency_);
689 hyperbolic_module_->prepare_state_vector(temp_[0], t + 1.0 * tau);
690 hyperbolic_module_->template step<1>(
691 temp_[0], {{state_vector}}, {{Number(-1.)}}, temp_[1], tau);
693 hyperbolic_module_->prepare_state_vector(temp_[1], t + 2.0 * tau);
694 hyperbolic_module_->template step<2>(temp_[1],
695 {{state_vector, temp_[0]}},
696 {{Number(0.75), Number(-2.)}},
703 parabolic_module_->crank_nicolson_step(temp_[2], t, temp_[3], 6.0 * tau);
704 }
catch (Restart &restart) {
706 restart.suggested_tau_max /= efficiency_;
712 hyperbolic_module_->prepare_state_vector(temp_[3], t + 3.0 * tau);
713 hyperbolic_module_->template step<0>(
714 temp_[3], {}, {}, temp_[0], tau);
716 hyperbolic_module_->prepare_state_vector(temp_[0], t + 4.0 * tau);
717 hyperbolic_module_->template step<1>(
718 temp_[0], {{ temp_[3]}}, {{Number(-1.)}}, temp_[1], tau);
720 hyperbolic_module_->prepare_state_vector(temp_[1], t + 5.0 * tau);
721 hyperbolic_module_->template step<2>(temp_[1],
722 {{ temp_[3], temp_[0]}},
723 {{Number(0.75), Number(-2.)}},
727 state_vector.swap(temp_[2]);
728 return efficiency_ * tau;
732 template <
typename Description,
int dim,
typename Number>
733 Number TimeIntegrator<Description, dim, Number>::step_strang_erk_43_cn(
734 StateVector &state_vector, Number t, Number tau_max)
739 std::cout <<
"TimeIntegrator<dim, Number>::step_strang_erk_43_cn()"
743 Assert(efficiency_ == 8., dealii::ExcInternalError());
747 Number tau = hyperbolic_module_->template step<0>(
748 state_vector, {}, {}, temp_[0], Number(0.), tau_max / efficiency_);
750 hyperbolic_module_->prepare_state_vector(temp_[0], t + 1.0 * tau);
751 hyperbolic_module_->template step<1>(
752 temp_[0], {{state_vector}}, {{Number(-1.)}}, temp_[1], tau);
754 hyperbolic_module_->prepare_state_vector(temp_[1], t + 2.0 * tau);
755 hyperbolic_module_->template step<1>(
756 temp_[1], {{temp_[0]}}, {{Number(-1.)}}, temp_[2], tau);
758 hyperbolic_module_->prepare_state_vector(temp_[2], t + 3.0 * tau);
759 hyperbolic_module_->template step<2>(temp_[2],
760 {{temp_[0], temp_[1]}},
761 {{Number(5. / 3.), Number(-10. / 3.)}},
768 parabolic_module_->crank_nicolson_step(temp_[3], t, temp_[2], 8.0 * tau);
769 }
catch (Restart &restart) {
771 restart.suggested_tau_max /= efficiency_;
777 hyperbolic_module_->prepare_state_vector(temp_[2], t + 4.0 * tau);
778 hyperbolic_module_->template step<0>(
779 temp_[2], {}, {}, temp_[0], tau);
781 hyperbolic_module_->prepare_state_vector(temp_[0], t + 5.0 * tau);
782 hyperbolic_module_->template step<1>(
783 temp_[0], {{ temp_[2]}}, {{Number(-1.)}}, temp_[1], tau);
785 hyperbolic_module_->prepare_state_vector(temp_[1], t + 6.0 * tau);
786 hyperbolic_module_->template step<1>(
787 temp_[1], {{temp_[0]}}, {{Number(-1.)}}, temp_[2], tau);
789 hyperbolic_module_->prepare_state_vector(temp_[2], t + 7.0 * tau);
790 hyperbolic_module_->template step<2>(temp_[2],
791 {{temp_[0], temp_[1]}},
792 {{Number(5. / 3.), Number(-10. / 3.)}},
796 state_vector.swap(temp_[3]);
797 return efficiency_ * tau;
801 template <
typename Description,
int dim,
typename Number>
802 Number TimeIntegrator<Description, dim, Number>::step_imex_11(
803 StateVector &state_vector, Number t, Number tau_max)
806 std::cout <<
"TimeIntegrator<dim, Number>::step_imex_11()" << std::endl;
809 Assert(efficiency_ == 1., dealii::ExcInternalError());
812 Number tau = hyperbolic_module_->template step<0>(
813 state_vector, {}, {}, temp_[0], Number(0.), tau_max);
816 parabolic_module_->template backward_euler_step<0>(
817 temp_[0], t, {}, {}, temp_[1], 1.0 * tau);
819 state_vector.swap(temp_[1]);
824 template <
typename Description,
int dim,
typename Number>
825 Number TimeIntegrator<Description, dim, Number>::step_imex_22(
826 StateVector &state_vector, Number t, Number tau_max)
829 std::cout <<
"TimeIntegrator<dim, Number>::step_imex_22()" << std::endl;
832 Assert(efficiency_ == 2., dealii::ExcInternalError());
835 Number tau = hyperbolic_module_->template step<0>(
836 state_vector, {}, {}, temp_[0], Number(0.), tau_max / efficiency_);
839 parabolic_module_->template backward_euler_step<0>(
840 temp_[0], t, {}, {}, temp_[1], tau);
843 hyperbolic_module_->prepare_state_vector(temp_[1], t + 1.0 * tau);
844 hyperbolic_module_->template step<1>(
845 temp_[1], {{state_vector}}, {{Number(-1.)}}, temp_[2], tau);
848 parabolic_module_->template backward_euler_step<1>(temp_[2],
855 state_vector.swap(temp_[3]);
856 return efficiency_ * tau;
860 template <
typename Description,
int dim,
typename Number>
861 Number TimeIntegrator<Description, dim, Number>::step_imex_33(
862 StateVector &state_vector, Number t, Number tau_max)
865 std::cout <<
"TimeIntegrator<dim, Number>::step_imex_33()" << std::endl;
868 Assert(efficiency_ == 3., dealii::ExcInternalError());
872 const Number gamma = Number(0.5) + std::sqrt(Number(3.0)) / Number(6.0);
875 Number tau = hyperbolic_module_->template step<0>(
876 state_vector, {}, {}, temp_[0], Number(0.), tau_max / efficiency_);
879 parabolic_module_->template backward_euler_step<1>(
883 {{Number(1. - 3. * gamma)}},
888 hyperbolic_module_->prepare_state_vector(temp_[1], t + 1.0 * tau);
889 hyperbolic_module_->template step<1>(
890 temp_[1], {{state_vector}}, {{Number(-1.)}}, temp_[2], tau);
896 parabolic_module_->template backward_euler_step<2>(
899 {{state_vector, temp_[1]}},
900 {{Number(6. * gamma - 1.), Number(2. - 9 * gamma)}},
905 hyperbolic_module_->prepare_state_vector(temp_[3], t + 2. * tau);
906 hyperbolic_module_->template step<2>(temp_[3],
907 {{state_vector, temp_[1]}},
908 {{Number(0.75), Number(-2.)}},
913 parabolic_module_->template backward_euler_step<3>(
916 {{state_vector, temp_[1], temp_[3]}},
917 {{Number(0.75 - 3. * gamma),
918 Number(6. * gamma - 2.),
919 Number(9. / 4. - 3. * gamma)}},
923 state_vector.swap(temp_[5]);
924 return efficiency_ * tau;