aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/RK4.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/RK4.c b/src/RK4.c
index 55a4a4e..f0ebc8f 100644
--- a/src/RK4.c
+++ b/src/RK4.c
@@ -100,6 +100,8 @@ CCTK_WARN(0, "not implemented");
we know the "real" alpha (including round-off errors) when we
calculate the final result. */
static CCTK_REAL sum_alpha;
+ /* the last MoL intermediate step that was summed */
+ static CCTK_INT last_sum_step;
totalsize = 1;
for (arraydim = 0; arraydim < cctk_dim; arraydim++)
@@ -134,8 +136,14 @@ CCTK_WARN(0, "not implemented");
if (MoL_Intermediate_Steps == (*MoL_Intermediate_Step))
{
sum_alpha = 0.0;
+ last_sum_step = -1;
+ }
+ /* Add alpha once per intermediate step */
+ if (last_sum_step != (*MoL_Intermediate_Step))
+ {
+ sum_alpha += alpha;
+ last_sum_step = (*MoL_Intermediate_Step);
}
- sum_alpha += alpha;
/* FIXME */