From a69ca9960f5eed7aec267de705a2b8554fe5c450 Mon Sep 17 00:00:00 2001 From: allen Date: Tue, 12 Sep 2000 07:45:27 +0000 Subject: Adding fixed timestep option Will update documentation.tex later today. git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/Time/trunk@27 5633253d-7678-4964-a54d-f87795f8ee59 --- README | 13 ++++++++++--- param.ccl | 29 +++++++++++++++++++---------- schedule.ccl | 11 ++++++++--- src/Given.c | 25 +++++++++++++++++++++++++ src/make.code.defn | 2 +- 5 files changed, 63 insertions(+), 17 deletions(-) create mode 100644 src/Given.c diff --git a/README b/README index aae1da0..3f731b9 100644 --- a/README +++ b/README @@ -3,8 +3,15 @@ Authors : Gabrielle Allen CVS info : $Header$ -------------------------------------------------------------------------- -Thorn Time sets the timestep for an evolution. Currently it -uses a simple Courant condition with speed one. That is +Thorn Time sets the timestep for the simulation by either + + - setting the timestep directly from a parameter value + + - using a Courant-type condition to set the timestep based + on the grid-spacing used. + +The Courant condition can be applied either once at the start of the +simulation, or the timestep can be calculated dynamically before each timestep. + -cctk_delta_time = dtfac * min(cctk_delta_space) diff --git a/param.ccl b/param.ccl index 317be03..79ce823 100644 --- a/param.ccl +++ b/param.ccl @@ -3,18 +3,9 @@ restricted: -REAL dtfac "The standard timestep condition dt = dtfac*max(delta_space)" -{ - 0:* :: "Probably only makes sense to be bigger than zero" -} 0.5 - -REAL courant_fac "The courant timestep condition dt = courant_fac*max(delta_space)/speed/sqrt(dim)" -{ - 0:* :: "Probably only makes sense to be bigger than zero" -} 0.9 - KEYWORD courant_method "Method for calculating timestep" { + "none" :: "Use given timestep" "standard" :: "Courant condition at BASEGRID" "courant" :: "Courant condition at PRESTEP (using wavespeed)" "courant_time" :: "Courant condition at PRESTEP (using min time)" @@ -24,6 +15,24 @@ BOOLEAN courant_outonly "Only output courant timestep?" { } "no" + +private: + +REAL timestep "Absolute value for timestep" +{ + *:* :: "Could be anything" +} 0.0 + +REAL dtfac "The standard timestep condition dt = dtfac*max(delta_space)" +{ + 0:* :: "Probably only makes sense to be bigger than zero" +} 0.5 + +REAL courant_fac "The courant timestep condition dt = courant_fac*max(delta_space)/speed/sqrt(dim)" +{ + 0:* :: "Probably only makes sense to be bigger than zero" +} 0.9 + INT outcourant_every "How often to output courant timestep" { 0:* :: "Zero means no output" diff --git a/schedule.ccl b/schedule.ccl index 84b646f..2399f7f 100644 --- a/schedule.ccl +++ b/schedule.ccl @@ -8,8 +8,7 @@ if (CCTK_Equals(courant_method,"standard")) LANG: C } "Set timestep based on Courant condition" } - -if (CCTK_Equals(courant_method,"courant") || CCTK_Equals(courant_method,"courant_time")) +else if (CCTK_Equals(courant_method,"courant") || CCTK_Equals(courant_method,"courant_time")) { schedule Time_Simple at CCTK_BASEGRID after SpatialCoordinates { @@ -21,6 +20,12 @@ if (CCTK_Equals(courant_method,"courant") || CCTK_Equals(courant_method,"courant LANG: C } "Reset timestep each iteration" } - +else +{ + schedule Time_Given at CCTK_BASEGRID + { + LANG: C + } "Set fixed timestep" +} diff --git a/src/Given.c b/src/Given.c new file mode 100644 index 0000000..645c422 --- /dev/null +++ b/src/Given.c @@ -0,0 +1,25 @@ + /*@@ + @file Simple.c + @date September 4 1999 + @author Gabrielle Allen + @desc + Standard specification of timestep + @enddesc + @@*/ + +#include + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" + +void Time_Given(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_PARAMETERS + DECLARE_CCTK_ARGUMENTS + + cctkGH->cctk_delta_time = timestep; +} + + + diff --git a/src/make.code.defn b/src/make.code.defn index a37cea0..4571048 100644 --- a/src/make.code.defn +++ b/src/make.code.defn @@ -2,7 +2,7 @@ # $Header$ # Source files in this directory -SRCS = Simple.c Courant.c +SRCS = Simple.c Courant.c Given.c # Subdirectories containing source files SUBDIRS = -- cgit v1.2.3