795 {
797
798 auto ts_adapt_amentum =
static_cast<TSAdaptAmentum *
>(adapt->data);
799 const PetscReal accepted_step_len =
h;
800
801 *next_sc = 0;
802 *wlte = -1;
803 *wltea = -1;
804 *wlter = -1;
805
808
810
811 PetscReal current_t;
812 CHKERR TSGetTime(ts, ¤t_t);
813
814 const PetscReal accepted_t = current_t + accepted_step_len;
815
816 if (ts_adapt_amentum->restoreAfterShutdown) {
818 ts_adapt_amentum->restoreAfterShutdown = PETSC_FALSE;
819 ts_adapt_amentum->rampUpAfterShutdown = PETSC_TRUE;
821 "\tShutdown step complete: t = %3.12g set restore h = %3.4g\n",
822 accepted_t, *next_h);
823 } else if (ts_adapt_amentum->rampUpAfterShutdown) {
824 *next_h = ts_adapt_amentum->regularStepLen;
825 ts_adapt_amentum->rampUpAfterShutdown = PETSC_FALSE;
826 while (!ts_adapt_amentum->shutdownTimes.empty() &&
827 accepted_t >= ts_adapt_amentum->shutdownTimes.front() -
829 ts_adapt_amentum->shutdownTimes.erase(
830 ts_adapt_amentum->shutdownTimes.begin());
831 }
833 "\tField restore step complete: t = %3.12g set h = %3.4g\n",
834 accepted_t, *next_h);
835 } else if (!ts_adapt_amentum->shutdownTimes.empty()) {
836 const PetscReal nextShutdownTime = ts_adapt_amentum->shutdownTimes.front();
837
838 if (PetscAbsReal(accepted_t - nextShutdownTime) <=
841 ts_adapt_amentum->restoreAfterShutdown = PETSC_TRUE;
843 "\tShutdown step after t = %3.12g set h = %3.4g \n",
844 accepted_t, *next_h);
845 } else {
846 const PetscReal next_t = accepted_t + *next_h;
847 if (accepted_t < nextShutdownTime && next_t >= nextShutdownTime) {
848 *next_h = nextShutdownTime - accepted_t;
850 "\tClip step to shutdown: t = %3.12g shutdown = "
851 "%3.12g set h = %3.4g \n",
852 accepted_t, nextShutdownTime, *next_h);
853 }
854 }
855 }
856
858}
int h
Corner vertex and its two front neighbours.
#define MOFEM_LOG_C(channel, severity, format,...)
static PetscErrorCode chooseAmentumStepSize(TSAdapt adapt, TS ts, PetscReal h, PetscReal *next_h)
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
static constexpr PetscReal AMENTUM_SHUTDOWN_TIME_TOL
static constexpr PetscReal AMENTUM_SHUTDOWN_STEP_LEN
Custom TSAdaptivity in MoFEM for Amentum Umat.