From 987143abc37941a4ea0e31bbc7cb028c278c9de3 Mon Sep 17 00:00:00 2001 From: eschnett Date: Mon, 29 Oct 2012 22:38:34 +0000 Subject: Slightly reduce round-off error git-svn-id: http://svn.cactuscode.org/arrangements/CactusNumerical/MoL/trunk@182 578cdeb0-5ea1-4b81-8215-5a3b8777ee0b --- src/RK4.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/RK4.c b/src/RK4.c index f0ebc8f..1d790ab 100644 --- a/src/RK4.c +++ b/src/RK4.c @@ -118,11 +118,11 @@ CCTK_WARN(0, "not implemented"); { case 0: alpha = 1.0 / 3.0; - beta = 0.5; + beta = 1.0 / 2.0; break; case 1: alpha = 2.0 / 3.0; - beta = 0.5; + beta = 1.0 / 2.0; break; case 2: alpha = 1.0 / 3.0; @@ -133,6 +133,7 @@ CCTK_WARN(0, "not implemented"); beta = 1.0 / 6.0; } + /* Initialise alpha before the first intermediate step */ if (MoL_Intermediate_Steps == (*MoL_Intermediate_Step)) { sum_alpha = 0.0; @@ -292,7 +293,7 @@ CCTK_WARN(0, "not done"); #pragma omp parallel for for (index = 0; index < arraytotalsize; index++) { - UpdateVar[index] += ScratchVar[index] - 4.0 / 3.0 * OldVar[index]; + UpdateVar[index] += ScratchVar[index] - (sum_alpha - 1.0) * OldVar[index]; } } arrayscratchlocation += arraytotalsize; -- cgit v1.2.3