10 #ifndef __TSEPADAPT_HPP__
11 #define __TSEPADAPT_HPP__
13 #include <petsc/private/tsimpl.h>
15 #define TSADAPTEP "ep"
20 PetscInt *next_sc, PetscReal *next_h,
21 PetscBool *accept, PetscReal *wlte,
22 PetscReal *wltea, PetscReal *wlter) {
36 ierr = TSGetSNES(ts, &snes);
39 SNESConvergedReason reason;
40 ierr = SNESGetConvergedReason(snes, &reason);
44 ierr = SNESGetIterationNumber(snes, &it);
52 "\tDiverged set step length: it = %d, h = %3.4g set h = %3.4g \n", it,
54 }
else if (reason > 0) {
62 *next_h = PetscClipInterval(
h, adapt->dt_min, adapt->dt_max);
65 "\tConverged set step length: it = %d, h = %3.4g set h = %3.4g \n", it,
69 PetscFunctionReturn(0);
75 PetscFunctionReturn(0);
82 ierr = PetscFree(adapt->data);
84 PetscFunctionReturn(0);
90 ierr = PetscNewLog(adapt, &ep);
92 adapt->data = (
void *)ep;
96 PetscFunctionReturn(0);
99 #endif // __TSEPADAPT_HPP__