# Schedule definitions for thorn MoL # $Header$ ########################################################## ### Always require storage for the counters and time ### ########################################################## STORAGE: MoL_Counters, MoL_Original_Time ######################################################## ### Storage for the scratch space if memory hungry ### ######################################################## if (MoL_Memory_Always_On) { STORAGE: ScratchSpace STORAGE: SandRScratchSpace } ############################################################ ### If using the generic Runge-Kutta solver, switch on ### ### storage for the coefficient arrays ### ############################################################ if (CCTK_Equals(MoL_ODE_Method,"Generic")) { STORAGE: RKAlphaCoefficients STORAGE: RKBetaCoefficients } ############################# ### The actual routines ### ############################# ######################## ### Startup banner ### ######################## schedule MoL_Startup AT Startup { LANG: C } "Startup banner" ##################################### ### Parameter checking routine. ### ##################################### schedule MoL_ParamCheck AT ParamCheck { LANG: C } "Basic parameter checking" ################################################# ### Allocate the arrays for the GF indexes. ### ################################################# schedule MoL_SetupIndexArrays AT Initial { LANG: C } "Set up the MoL bookkeeping index arrays" ################################################ ### Initialize the coefficients for the RK ### ### arrays if required ### ################################################ if (CCTK_Equals(MoL_ODE_Method,"Generic")) { schedule MoL_SetupRKCoefficients AT Initial { LANG: C STORAGE: RKAlphaCoefficients STORAGE: RKBetaCoefficients } "Initialize the generic Runge-Kutta coefficients" } ################################################# ### The group where physics thorns call the ### ### registration functions ### ################################################# schedule GROUP MoL_Register AT PostInitial { LANG:C } "The group where physics thorns register variables with MoL" schedule MoL_FillAllLevels AT PostInitial AFTER MoL_Register { LANG:C } "A bad routine. Fills all previous timelevels with data copied from the current." ###################################################### ### The evolution step. This is almost a self ### ### contained EVOL step with PRE and POST steps ### ### to allow changing the type of the variables, ### ### boundary enforcement and so on. ### ###################################################### schedule GROUP MoL_Evolution AT Evol { LANG: C STORAGE: ScratchSpace STORAGE: SandRScratchSpace } "A single Cactus evolution step using MoL" ###################################################### ### StartStep contains the routines that just do ### ### internal MoL stuff; setting the counter, and ### ### changing the time and timestep if required. ### ###################################################### schedule GROUP MoL_StartStep IN MoL_Evolution { LANG: C } "MoL internal setup for the evolution step" schedule MoL_SetCounter IN MoL_StartStep { LANG: C } "Set the counter for the ODE method to loop over" ######################################################## ### Note that the option GLOBAL here is to ensure ### ### that the time is set once per refinement level ### ### and not once overall. ### ### I think with current implementations this is ### ### not required. ### ######################################################## schedule MoL_SetTime IN MoL_StartStep { LANG: C ### OPTION: GLOBAL } "Ensure the correct time and timestep are used" ################################################################# ### PreStep is where physics thorns can do their own setup. ### ### This would include scheduling the function calls to ### ### change the type of variable. ### ################################################################# schedule GROUP MoL_PreStep IN MoL_Evolution AFTER MoL_StartStep BEFORE MoL_Step { LANG: C } "Physics thorns can schedule preloop setup routines in here" ####################################################################### ### Check to see if any type changing functions have been called, ### ### and if so do the necessary bookkeeping. ### ### Right now, I think this is unnecessary, now that we don't ### ### reallocate any scratch space. ### ####################################################################### #schedule MoL_CheckVariableType IN MoL_Evolution AFTER MoL_PreStep BEFORE MoL_Step #{ # LANG: C #} "If a physics thorn wants to change the type of a variable, do the bookkeeping" ################################################################# ### Copy (ouch) the data into the correct timelevel so that ### ### the physics thorn knows where to find it. ### ################################################################# schedule MoL_InitialCopy IN MoL_Evolution AFTER MoL_PreStep BEFORE MoL_Step { LANG: C } "Ensure the data is in the correct timelevel" ################################################# ### The actual loop which updates the data. ### ################################################# schedule GROUP MoL_Step WHILE MoL::MoL_Intermediate_Step IN MoL_Evolution AFTER MoL_PreStep { LANG: C } "The loop over the intermediate steps for the ODE integrator" ##################################################### ### The group where all the physics takes place ### ##################################################### schedule GROUP MoL_CalcRHS IN MoL_Step { LANG: C } "Physics thorns schedule the calculation of the discrete spatial operator in here" ###################################################### ### The time integrator performs the update here ### ###################################################### if (CCTK_Equals(MoL_ODE_Method,"Generic")) { schedule MoL_GenericRKAdd AS MoL_Add IN MoL_Step AFTER MoL_CalcRHS BEFORE MoL_PostStep { LANG: C } "Updates calculated with a generic method" } else if (CCTK_Equals(MoL_ODE_Method,"RK2")) { schedule MoL_RK2Add AS MoL_Add IN MoL_Step AFTER MoL_CalcRHS BEFORE MoL_PostStep { LANG: C } "Updates calculated with the efficient Runge-Kutta 2 method" } else if (CCTK_Equals(MoL_ODE_Method,"ICN")) { schedule MoL_ICNAdd AS MoL_Add IN MoL_Step AFTER MoL_CalcRHS BEFORE MoL_PostStep { LANG: C } "Updates calculated with the efficient ICN method" } ################################################## ### Physics thorns can apply boundaries and ### ### recalculate constrained variables and so ### ### on in PostStep ### ################################################## schedule GROUP MoL_PostStep IN MoL_Step AFTER MoL_Add { LANG: C } "The group for physics thorns to schedule boundary calls etc." ################################################# ### Final internal MoL stuff; decrement the ### ### counter, change time and timestep ### ################################################# schedule MoL_DecrementCounter IN MoL_Step AFTER MoL_Step BEFORE MoL_PostStep { LANG: C } "Alter the counter number" schedule MoL_ResetTime IN MoL_Step AFTER MoL_DecrementCounter BEFORE MoL_PostStep { LANG: C } "If necessary, change the time and timestep" ################################################## ### Finally, restore any SaveAndRestore type ### ### variables to their original state. ### ################################################## schedule MoL_RestoreSandR IN MoL_Evolution AFTER MoL_PostStep { LANG: C } "Restoring the Save and Restore variables to the original state" ################################################################ ### At the end (but before driver terminate to avoid those ### ### irritating segfaults) free the index arrays. ### ################################################################ schedule MoL_FreeIndexArrays AT Terminate BEFORE Driver_Terminate { LANG: C } "Free the MoL bookkeeping index arrays"