diff options
Diffstat (limited to 'src/IndexArrays.c')
-rw-r--r-- | src/IndexArrays.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/IndexArrays.c b/src/IndexArrays.c index d3ceccb..485a4bd 100644 --- a/src/IndexArrays.c +++ b/src/IndexArrays.c @@ -110,6 +110,23 @@ void MoL_SetupIndexArrays(CCTK_ARGUMENTS) } } + if (MoL_Num_Evolved_Vars_Slow) + { + EvolvedVariableIndexSlow = (CCTK_INT *)malloc(MoL_Num_Evolved_Vars_Slow * + sizeof(CCTK_INT)); + if (!EvolvedVariableIndexSlow) + { + CCTK_WARN(0,"Failed to allocate the slow evolved variable index array"); + } + + RHSVariableIndexSlow = (CCTK_INT *)malloc(MoL_Num_Evolved_Vars_Slow * + sizeof(CCTK_INT)); + if (!RHSVariableIndexSlow) + { + CCTK_WARN(0,"Failed to allocate the slow RHS variable index array"); + } + } + if (MoL_Num_Constrained_Vars) { ConstrainedVariableIndex = (CCTK_INT *)malloc(MoL_Num_Constrained_Vars * @@ -335,6 +352,18 @@ void MoL_SetupIndexArrays(CCTK_ARGUMENTS) "Averaging iterative Crank Nicholson with %i iterations", MoL_Intermediate_Steps); } + else if (CCTK_EQUALS(ODE_Method,"RK2-MR-2:1")) + { + sprintf(infoline, "Multi-rate 2:1 Runge-Kutta 2"); + } + else if (CCTK_EQUALS(ODE_Method,"RK4-MR-2:1")) + { + sprintf(infoline, "Multi-rate 2:1 Runge-Kutta 4"); + } + else if (CCTK_EQUALS(ODE_Method,"RK4-RK2")) + { + sprintf(infoline, "Multi-rate 2:1 Runge-Kutta 4 and Runge-Kutta 2"); + } else { CCTK_WARN(0, "ODE_Method not recognized!"); @@ -345,6 +374,12 @@ void MoL_SetupIndexArrays(CCTK_ARGUMENTS) free(infoline); infoline = NULL; + // These scalars must be 1 oustide of the MoL loop. + // They will only be zero for certain substeps when multirate methods are used. + // Otherwise, they are guaranteed to always be ONE. + *MoL_SlowPostStep = 1; + *MoL_SlowStep = 1; + return; } @@ -381,6 +416,18 @@ void MoL_FreeIndexArrays(CCTK_ARGUMENTS) RHSVariableIndex = NULL; } + if (EvolvedVariableIndexSlow) + { + free(EvolvedVariableIndexSlow); + EvolvedVariableIndexSlow = NULL; + } + + if (RHSVariableIndexSlow) + { + free(RHSVariableIndexSlow); + RHSVariableIndexSlow = NULL; + } + if (ConstrainedVariableIndex) { free(ConstrainedVariableIndex); |