From 69d85e287d7cd42b998fda5d51af78d0d5b1a2f0 Mon Sep 17 00:00:00 2001 From: allen Date: Sun, 31 Oct 1999 13:26:59 +0000 Subject: Improved implementation of dynamic courant condition git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/Time/trunk@13 5633253d-7678-4964-a54d-f87795f8ee59 --- src/Courant.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/Courant.c b/src/Courant.c index d0c36ef..71b62b2 100644 --- a/src/Courant.c +++ b/src/Courant.c @@ -50,14 +50,13 @@ void Time_Courant(CCTK_CARGUMENTS) } /* Calculate the courant timestep */ - courant_speed = *wave_speed; - *courant_dt = courant_fac/courant_speed/sqrt((CCTK_REAL )cctk_dim); - - /* Output timestep if required */ - - if (outcourant_every > 0 && cctk_iteration%outcourant_every == 0) - { - CCTK_OutputVarAsByMethod(cctkGH,"time::courant_dt","Scalar","courant"); + if (CCTK_Equals(courant_method,"courant_time")) + { + *courant_dt = courant_fac*(*courant_time)/sqrt((CCTK_REAL )cctk_dim); + } + else if (CCTK_Equals(courant_method,"courant")) + { + *courant_dt = courant_fac/(*courant_wave_speed)/sqrt((CCTK_REAL )cctk_dim); } /* Set the Cactus timestep */ @@ -70,10 +69,11 @@ void Time_Courant(CCTK_CARGUMENTS) sprintf(message,"Time step set to %f",cctkGH->cctk_delta_time); CCTK_INFO(message); free(message); + } else { - cctkGH->cctk_delta_time = dtfac*min_spacing; + cctkGH->cctk_delta_time = dtfac*min_spacing; } } -- cgit v1.2.3