From 7713df3ebfc0c630cbc04a1b35f1f23e6effcdb5 Mon Sep 17 00:00:00 2001 From: Grzegorz Kowal Date: Tue, 17 Aug 2021 11:23:36 -0300 Subject: [PATCH] EVOLUTION: Add dth to track hydrodynamic timestep. Signed-off-by: Grzegorz Kowal --- sources/evolution.F90 | 6 ++++-- sources/integrals.F90 | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/sources/evolution.F90 b/sources/evolution.F90 index 10a37c4..329ba12 100644 --- a/sources/evolution.F90 +++ b/sources/evolution.F90 @@ -77,6 +77,7 @@ module evolution real(kind=8) , save :: time = 0.0d+00 real(kind=8) , save :: dt = 1.0d+00 real(kind=8) , save :: dtn = 1.0d+00 + real(kind=8) , save :: dth = 1.0d+00 real(kind=8) , save :: dte = 0.0d+00 ! the absolute and relative tolerances, limiting factors, the maximum error, @@ -108,7 +109,7 @@ module evolution ! declare public variables ! - public :: step, time, dt, dtn, dte, cfl, glm_alpha, registers + public :: step, time, dt, dtn, dth, dte, cfl, glm_alpha, registers public :: atol, rtol, mrej, niterations, nrejections, errs, maxerr !- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -635,11 +636,12 @@ module evolution ! calculate the new time step ! - dtn = cfl * dx_min / max(cmax & + dth = cfl * dx_min / max(cmax & + 2.0d+00 * max(viscosity, resistivity) / dx_min, eps) ! round the time ! + dtn = dth if (error_control .and. dte > 0.0d+00) dtn = min(dtn, dte) if (dtnext > 0.0d+00) dtn = min(dtn, dtnext) dt = dtn diff --git a/sources/integrals.F90 b/sources/integrals.F90 index d208f6b..c0ff7df 100644 --- a/sources/integrals.F90 +++ b/sources/integrals.F90 @@ -380,7 +380,7 @@ module integrals use equations , only : ien, imx, imy, imz use equations , only : magnetized, adiabatic_index, csnd use equations , only : errors - use evolution , only : step, time, dtn, dte + use evolution , only : step, time, dtn, dth, dte use forcing , only : einj, rinj, arms use helpers , only : flush_and_sync #ifdef MPI @@ -650,7 +650,7 @@ module integrals , avarr(5), mnarr(5), mxarr(5) & , avarr(6), mnarr(6), mxarr(6) & , avarr(7), mnarr(7), mxarr(7) - write(eunit,efmt) step, time, dtn, dte, maxval(errors(:)), errors(:) + write(eunit,efmt) step, time, dth, dte, maxval(errors(:)), errors(:) call flush_and_sync(funit) call flush_and_sync(sunit)