aboutsummaryrefslogtreecommitdiff
path: root/src/SetTime.c
diff options
context:
space:
mode:
authorrhaas <rhaas@578cdeb0-5ea1-4b81-8215-5a3b8777ee0b>2012-08-02 16:34:52 +0000
committerrhaas <rhaas@578cdeb0-5ea1-4b81-8215-5a3b8777ee0b>2012-08-02 16:34:52 +0000
commit26067015fd74e5079d09a589fc3bab9e7fd13f22 (patch)
treea3939c89d8d4643ebf529722c1edfc8b8cbbe2a6 /src/SetTime.c
parent7923fe9d90ae7b78450708403bd7d451e0227d15 (diff)
MoL: add Multirate capabilities. This add three new multirate RK schemes to MoL.
Flags indicate whether it is time to execute slow RHS computation. For instance, in the RK4-RK2 scheme, there are 4 substeps in total, but the RK2 RHS are only evaluated in the very first and in the very last step of the four substeps. From: Christian Reisswig, minor changes by Roland Haas git-svn-id: http://svn.cactuscode.org/arrangements/CactusNumerical/MoL/trunk@175 578cdeb0-5ea1-4b81-8215-5a3b8777ee0b
Diffstat (limited to 'src/SetTime.c')
-rw-r--r--src/SetTime.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/SetTime.c b/src/SetTime.c
index c04cc0b..32e893c 100644
--- a/src/SetTime.c
+++ b/src/SetTime.c
@@ -298,6 +298,63 @@ void MoL_ResetTime(CCTK_ARGUMENTS)
+ ((alpha_array87[substep] - 1)
* (* Original_Delta_Time) / cctkGH->cctk_timefac));
}
+ else if (CCTK_EQUALS(ODE_Method,"RK2-MR-2:1"))
+ {
+ const int substep = MoL_Intermediate_Steps - (* MoL_Intermediate_Step);
+
+ CCTK_REAL dt = (*Original_Delta_Time)/cctkGH->cctk_timefac;
+ switch (substep)
+ {
+ case 1:
+ case 2:
+ dt *= 0.5;
+ break;
+ default:
+ dt = 0;
+ }
+ cctkGH->cctk_time = (*Original_Time) - dt;
+ }
+ else if (CCTK_EQUALS(ODE_Method,"RK4-MR-2:1"))
+ {
+ const int substep = MoL_Intermediate_Steps - (* MoL_Intermediate_Step);
+
+ CCTK_REAL dt = (*Original_Delta_Time)/cctkGH->cctk_timefac;
+ switch (substep)
+ {
+ case 1:
+ case 2:
+ dt *= 3.0/4.0;
+ break;
+ case 3:
+ case 4:
+ case 5:
+ dt *= 1.0/2.0;
+ break;
+ case 6:
+ case 7:
+ dt *= 1.0/4.0;
+ break;
+ default:
+ dt = 0;
+ }
+ cctkGH->cctk_time = (*Original_Time) - dt;
+ }
+ else if (CCTK_EQUALS(ODE_Method,"RK4-RK2"))
+ {
+ const int substep = MoL_Intermediate_Steps - (* MoL_Intermediate_Step);
+
+ CCTK_REAL dt = (*Original_Delta_Time)/cctkGH->cctk_timefac;
+ switch (substep)
+ {
+ case 1:
+ case 2:
+ dt *= 0.5;
+ break;
+ default:
+ dt = 0;
+ }
+ cctkGH->cctk_time = (*Original_Time) - dt;
+ }
#ifdef MOLDEBUG
printf("MoL has once more reset t (%d): %f.\n",
*MoL_Intermediate_Step, cctkGH->cctk_time);