| { |
| "thorn_name": "CactusNumerical/MoL", |
| "url": "https://bitbucket.org/cactuscode/cactusnumerical.git", |
| "configuration": "# Configuration definition for thorn MoL\n# $Header$\n", |
| "interface": "# Interface definition for thorn MoL\n# $Header$\n\nimplements: MethodOfLines\n\n##################################################\n### Functions from NaNChecker that may be used ###\n##################################################\n\nCCTK_INT FUNCTION CheckVarsForNaN \\\n (CCTK_POINTER_TO_CONST IN cctkGH, \\\n CCTK_INT IN report_max, \\\n CCTK_STRING IN vars, \\\n CCTK_STRING IN check_for, \\\n CCTK_STRING IN action_if_found)\nUSES FUNCTION CheckVarsForNaN\n\n##############################################\n### Functions from Carpet that may be used ###\n##############################################\n\nCCTK_INT FUNCTION EnableProlongating(CCTK_INT IN Status)\nUSES FUNCTION EnableProlongating\n\nCCTK_INT FUNCTION Driver_GetValidRegion(CCTK_POINTER_TO_CONST IN cctkGH,\n CCTK_INT IN vi,\n CCTK_INT IN tl)\nUSES FUNCTION Driver_GetValidRegion\n\nvoid FUNCTION Driver_SetValidRegion(CCTK_POINTER_TO_CONST IN cctkGH,\n CCTK_INT IN vi,\n CCTK_INT IN tl,\n CCTK_INT IN wh)\nUSES FUNCTION Driver_SetValidRegion\n################################################################\n### Aliased registration and type changing functions for the ###\n### standard (i.e., real) GFs. ###\n################################################################\n\nCCTK_INT FUNCTION MoLRegisterEvolved(CCTK_INT IN EvolvedIndex, \\\n CCTK_INT IN RHSIndex)\nCCTK_INT FUNCTION MoLRegisterEvolvedSlow(CCTK_INT IN EvolvedIndex, \\\n CCTK_INT IN RHSIndexSlow)\n\nCCTK_INT FUNCTION MoLRegisterConstrained(CCTK_INT IN ConstrainedIndex)\nCCTK_INT FUNCTION MoLRegisterSaveAndRestore(CCTK_INT IN SandRIndex)\nCCTK_INT FUNCTION MoLRegisterEvolvedGroup(CCTK_INT IN EvolvedIndex, \\\n CCTK_INT IN RHSIndex)\nCCTK_INT FUNCTION MoLRegisterEvolvedGroupSlow(CCTK_INT IN EvolvedIndex, \\\n CCTK_INT IN RHSIndexSlow)\nCCTK_INT FUNCTION MoLRegisterConstrainedGroup(CCTK_INT IN ConstrainedIndex)\nCCTK_INT FUNCTION MoLRegisterSaveAndRestoreGroup(CCTK_INT IN SandRIndex)\nCCTK_INT FUNCTION MoLChangeToEvolved(CCTK_INT IN EvolvedIndex, \\\n CCTK_INT IN RHSIndex)\nCCTK_INT FUNCTION MoLChangeToEvolvedSlow(CCTK_INT IN EvolvedIndex, \\\n CCTK_INT IN RHSIndexSlow)\nCCTK_INT FUNCTION MoLChangeToConstrained(CCTK_INT IN ConstrainedIndex)\nCCTK_INT FUNCTION MoLChangeToSaveAndRestore(CCTK_INT IN SandRIndex)\nCCTK_INT FUNCTION MoLChangeToNone(CCTK_INT IN RemoveIndex)\nCCTK_INT FUNCTION MoLQueryEvolvedRHS(CCTK_INT IN EvolvedIndex)\nCCTK_INT FUNCTION MoLNumIntegratorSubsteps()\n\nPROVIDES FUNCTION MoLRegisterEvolved WITH MoL_RegisterEvolved LANGUAGE C\nPROVIDES FUNCTION MoLRegisterEvolvedSlow WITH MoL_RegisterEvolvedSlow LANGUAGE C\nPROVIDES FUNCTION MoLRegisterConstrained WITH MoL_RegisterConstrained \\\n LANGUAGE C\nPROVIDES FUNCTION MoLRegisterSaveAndRestore WITH MoL_RegisterSaveAndRestore \\\n LANGUAGE C\nPROVIDES FUNCTION MoLRegisterEvolvedGroup WITH MoL_RegisterEvolvedGroup \\\n LANGUAGE C\nPROVIDES FUNCTION MoLRegisterEvolvedGroupSlow WITH MoL_RegisterEvolvedGroupSlow \\\n LANGUAGE C\nPROVIDES FUNCTION MoLRegisterConstrainedGroup WITH \\\n MoL_RegisterConstrainedGroup LANGUAGE C\nPROVIDES FUNCTION MoLRegisterSaveAndRestoreGroup WITH \\\n MoL_RegisterSaveAndRestoreGroup LANGUAGE C\nPROVIDES FUNCTION MoLChangeToEvolved WITH MoL_ChangeToEvolved LANGUAGE C\nPROVIDES FUNCTION MoLChangeToEvolvedSlow WITH MoL_ChangeToEvolvedSlow LANGUAGE C\nPROVIDES FUNCTION MoLChangeToConstrained WITH MoL_ChangeToConstrained \\\n LANGUAGE C\nPROVIDES FUNCTION MoLChangeToSaveAndRestore WITH MoL_ChangeToSaveAndRestore \\\n LANGUAGE C\nPROVIDES FUNCTION MoLChangeToNone WITH MoL_ChangeToNone LANGUAGE C\nPROVIDES FUNCTION MoLQueryEvolvedRHS WITH MoL_QueryEvolvedRHS LANGUAGE C\nPROVIDES FUNCTION MoLNumIntegratorSubsteps WITH MoL_NumIntegratorSubsteps \\\n LANGUAGE C\n\n##############################################################\n### Aliased functions that can be provided by other thorns ###\n### to override low-level grid variable operations. ###\n##############################################################\n\nCCTK_INT FUNCTION GetRefinementLevel \\\n (CCTK_POINTER_TO_CONST IN cctkGH)\nUSES FUNCTION GetRefinementLevel\n\nCCTK_INT FUNCTION Device_GetDevice \\\n (CCTK_POINTER_TO_CONST IN cctkGH)\nUSES FUNCTION Device_GetDevice\n\n# Computes:\n# var = scale * var + \\sum_i^nsrcs facts[i] * scrcs[i][tls[i]]\nCCTK_INT FUNCTION LinearCombination \\\n (CCTK_POINTER_TO_CONST IN cctkGH, \\\n CCTK_INT IN var, \\\n CCTK_INT IN rl , \\\n CCTK_INT IN tl , \\\n CCTK_REAL IN scale, \\\n CCTK_INT ARRAY IN srcs, \\\n CCTK_INT ARRAY IN tls, \\\n CCTK_REAL ARRAY IN facts, \\\n CCTK_INT IN nsrcs)\nUSES FUNCTION LinearCombination\n\nCCTK_INT FUNCTION Accelerator_NotifyDataModified \\\n (CCTK_POINTER_TO_CONST IN cctkGH, \\\n CCTK_INT ARRAY IN variables, \\\n CCTK_INT ARRAY IN rls, \\\n CCTK_INT ARRAY IN tls, \\\n CCTK_INT IN nvariables, \\\n CCTK_INT IN on_device)\nUSES FUNCTION Accelerator_NotifyDataModified\n\nprivate:\n\nCCTK_REAL RKAlphaCoefficients \\\n TYPE = ARRAY \\\n DIM = 2 \\\n SIZE = MoL_Intermediate_Steps,MoL_Num_Scratch_Levels+1 \\\n DISTRIB = CONSTANT \\\n TAGS = 'Checkpoint=\"no\"'\n#{\n#} \"The alpha coefficients used by the generic Runge-Kutta integrators\"\n\nCCTK_REAL RKBetaCoefficients \\\n TYPE = ARRAY \\\n DIM = 1 \\\n SIZE = MoL_Intermediate_Steps \\\n DISTRIB = CONSTANT \\\n TAGS = 'Checkpoint=\"no\"'\n#{\n#} \"The beta coefficients used by the generic Runge-Kutta integrators\"\n\nCCTK_INT MoL_Counters \\\n TYPE = SCALAR \\\n TAGS = 'Checkpoint=\"no\"'\n{\n MoL_Intermediate_Step\n MoL_Stepsize_Bad\n \n # A flag indicating whether it is time for slow RHS evaluation. \n # Oustide the MoL loop, it is guaranteed to be 1.\n # It is only zero for certain MoL substeps when multirate methods are used.\n MoL_SlowStep\n \n # A flag indicating whether it is time for slow post step computations (e.g. applying BCs)\n # Oustide the MoL loop, it is guaranteed to be 1.\n # It is only zero for certain MoL substeps when multirate methods are used.\n MoL_SlowPostStep\n \n} \"The counter for the time integration method\"\n\nCCTK_REAL MoL_Original_Time \\\n TYPE = SCALAR \\\n TAGS = 'Checkpoint=\"no\"'\n{\n Original_Time\n Original_Delta_Time\n} \"The original time and delta time which are reset by MoL during evolution\"\n\n# there is a hard-coded limit on the number of scratch levels of 99\n# changing it here will increase this limit\nCCTK_REAL ScratchSpaceSlow[MoL_Num_Scratch_Levels] \\\n TYPE = GF \\\n Timelevels = 99 \\\n TAGS = 'Prolongation=\"None\" Checkpoint=\"no\"'\n\nCCTK_REAL ScratchSpace[MoL_Num_Scratch_Levels] \\\n TYPE = GF \\\n Timelevels = 99 \\\n TAGS = 'Prolongation=\"None\" Checkpoint=\"no\"'\n\nCCTK_REAL SandRScratchSpace \\\n TYPE = GF \\\n Timelevels = 99 \\\n TAGS = 'Prolongation=\"None\" Checkpoint=\"no\"'\n\n# Error vector and scalars for RK45\n\nCCTK_REAL ErrorEstimate \\\n TYPE = GF \\\n Timelevels = 99 \\\n TAGS = 'Prolongation=\"None\" Checkpoint=\"no\"'\n\nCCTK_REAL ErrorScalars \\\n TYPE = SCALAR\n{\n Error\n Count\n EstimatedDt\n} \"Global error estimate\"\n", |
| "param": "# Parameter definitions for thorn MoL\n# $Header$\n\nshares: cactus\n\nUSES KEYWORD presync_mode\n\nrestricted:\n\nCCTK_INT MoL_Num_Evolved_Vars \"The maximum number of variables to be evolved by MoL (DPRECATED)\" ACCUMULATOR = (x+y)\n{\n 0:*\t\t:: \"Anything non negative. Added to by other thorns.\"\n} 0\n\nCCTK_INT MoL_Num_Evolved_Vars_Slow \"The maximum number of 'slow' variables to be evolved by MoL (DPRECATED)\" ACCUMULATOR = (x+y)\n{\n 0:*\t\t:: \"Anything non negative. Added to by other thorns.\"\n} 0\n\n\nCCTK_INT MoL_Num_Constrained_Vars \"The maximum number of constrained variables with timelevels that MoL needs to know about (DPRECATED)\" ACCUMULATOR = (x+y)\n{\n 0:*\t\t:: \"Anything non negative. Added to by other thorns.\"\n} 0\n\nCCTK_INT MoL_Num_SaveAndRestore_Vars \"The maximum number of variables to be evolved outside of MoL but that MoL needs to know about (DPRECATED)\" ACCUMULATOR = (x+y)\n{\n 0:*\t\t:: \"Anything non negative. Added to by other thorns.\"\n} 0\n\nCCTK_INT MoL_Max_Evolved_Array_Size \"The maximum total size of any grid arrays to be evolved\" ACCUMULATOR = (x+y)\n{\n 0:* :: \"Anything non negative. Accumulated by other thorns\"\n} 0\n\nCCTK_INT MoL_Num_ArrayEvolved_Vars \"The maximum number of array variables to be evolved by MoL (DPRECATED)\" ACCUMULATOR = (x+y)\n{\n 0:*\t\t:: \"Anything non negative. Added to by other thorns.\"\n} 0\n\nCCTK_INT MoL_Num_ArrayConstrained_Vars \"The maximum number of array constrained variables with timelevels that MoL needs to know about (DPRECATED)\" ACCUMULATOR = (x+y)\n{\n 0:*\t\t:: \"Anything non negative. Added to by other thorns.\"\n} 0\n\nCCTK_INT MoL_Num_ArraySaveAndRestore_Vars \"The maximum number of array variables to be evolved outside of MoL but that MoL needs to know about (DPRECATED)\" ACCUMULATOR = (x+y)\n{\n 0:*\t\t:: \"Anything non negative. Added to by other thorns.\"\n} 0\n\nCCTK_INT MoL_Num_Scratch_Levels \"Number of scratch levels required by the ODE method\"\n{\n 0:*\t\t:: \"Anything non negative\"\n} 0\n\nprivate:\n\nKEYWORD ODE_Method \"The ODE method use by MoL to do time integration\"\n{\n \"Generic\"\t:: \"Generic Shu-Osher Runge-Kutta type\"\n \"ICN\"\t\t:: \"Iterative Crank Nicholson\"\n \"ICN-avg\"\t:: \"Iterative Crank Nicholson with averaging\"\n \"Euler\"\t:: \"Euler\"\n \"RK2\"\t\t:: \"Efficient RK2\"\n \"RK2-central\"\t:: \"Central RK2\"\n \"RK3\"\t\t:: \"Efficient RK3\"\n \"RK4\"\t\t:: \"Efficient RK4\"\n \"RK45\" :: \"RK45 (Fehlberg) with error estimation\"\n \"RK45CK\" :: \"RK45CK (Cash-Karp) with error estimation\"\n \"RK65\" :: \"RK65 with error estimation\"\n \"RK87\" :: \"RK87 with error estimation\"\n \"AB\" :: \"Adams-Bashforth\"\n \"RK2-MR-2:1\" :: \"2nd order 2:1 multirate RK scheme based on RK2 due to Schlegel et al 2009. This requires init_RHS_zero='no'.\"\n \"RK4-MR-2:1\" :: \"3rd order 2:1 multirate RK scheme based on RK43 due to Schlegel et al 2009. This requires init_RHS_zero='no'.\"\n \"RK4-RK2\" :: \"RK4 as fast method and RK2 as slow method\"\n} \"ICN\"\n\nKEYWORD Generic_Type \"If using the generic method, which sort\"\n{\n \"RK\"\t\t:: \"One of the standard TVD Runge-Kutta methods\"\n \"ICN\"\t\t:: \"Iterative Crank Nicholson as a generic method\"\n \"Table\" :: \"Given from the generic method descriptor parameter\"\n \"Classic RK3\"\t:: \"Efficient RK3 - classical version\"\n} \"RK\"\n\nCCTK_REAL ICN_avg_theta \"theta of averaged ICN method, usually 0.5\"\n{\n 0:1 :: \"0 <= theta <= 1\"\n} 0.5\n\nBOOLEAN ICN_avg_swapped \"Use swapped averages in ICN method?\"\n{\n} \"no\"\n\nKEYWORD AB_Type \"If using the the AB method, which sort\"\n{\n \"1\" :: \"same as forward Euler\"\n \"2\" :: \"second order\"\n \"3\" :: \"third order\"\n \"4\" :: \"fourth order\"\n \"5\" :: \"fifth order\"\n} \"1\"\n\nBOOLEAN AB_initially_reduce_order \"Reduce order of accuracy initially so that no past timelevels of initial data are required\"\n{\n} \"yes\"\n\nCCTK_INT MoL_Intermediate_Steps \"Number of intermediate steps taken by the ODE method\"\n{\n 1:*\t\t:: \"Anything greater than 1\"\n} 3\n\nBOOLEAN MoL_Memory_Always_On \"Do we keep the scratch arrays allocated all the time?\"\n{\n} \"yes\"\n\nCCTK_REAL MoL_Tiny \"Effective local machine zero; required by generic solvers\"\n{\n 0:*\t\t:: \"Defaults to 1.e-15\"\n} 1.e-15\n\nBOOLEAN initial_data_is_crap \"If the initial data routine fails to set up the previous time levels, copy the current backwards\"\n{\n} \"no\"\n\n# If initial_data_is_crap is false, this parameter is ignored.\n# If initial_data_is_crap is true, this parameter controls *when*\n# in CCTK_POSTINITIAL we copy the initial data to previous time levels,\n# relative to our scheduling of MoL_PostStep.\n# false ==> copy *before* MoL_PostStep (default, matches old behavior)\n# true ==> copy *after* MoL_PostStep (may be preferable for new code)\nBOOLEAN copy_ID_after_MoL_PostStep \\\n \"if initial_data_is_crap is true, *when* should we copy the\t\t\\\n current time level to all previous time levels:\t\t\t\\\n false ==> copy *before* MoL_PostStep (default, matches old behavior)\\\n true ==> copy *after* MoL_PostStep (maybe preferable for new code)\"\n{\n} \"no\"\n\nBOOLEAN run_MoL_PostStep_in_Post_Recover_Variables \"Schedule the PostStep parts after recovery so that symmetries are automatically done correctly.\" STEERABLE=recover\n{\n} \"yes\"\n\n\nBOOLEAN set_ID_boundaries \"Should boundaries be overwritten (via synchronization, prolongation, boundary conditions) by MoL?\"\n{\n} \"yes\"\n\n\n\n# The default for this parameter corresponds to generic RK2\nSTRING Generic_Method_Descriptor \"A string used to create a table containing the description of the generic method\"\n{\n \".*\" :: \"Should contain the Alpha and Beta arrays, and the number of intermediate steps\"\n} \"GenericIntermediateSteps = 2 \\\n GenericAlphaCoeffs = { 1.0 0.0 0.5 0.5 } \\\n GenericBetaCoeffs = { 1.0 0.5 }\"\n \nBOOLEAN MoL_NaN_Check \"Should the RHS GFs be checked for NaNs?\"\n{\n} \"no\"\n\nBOOLEAN disable_prolongation \"If Mesh refinement is enabled should we use buffer zones in intermediate steps?\"\n{\n} \"yes\"\n\n\n\nBOOLEAN skip_initial_copy \"Skip initial copy from previous to current time level\" STEERABLE=recover\n{\n} \"no\"\n\nBOOLEAN init_RHS_zero \"Initialise the RHS to zero\" STEERABLE=recover\n{\n} \"yes\"\n\n\n\nBOOLEAN adaptive_stepsize \"Choose the time step size adaptively\"\n{\n} \"no\"\n\nREAL maximum_absolute_error \"Maximum allowed absolute error for adaptive stepsize control\"\n{\n 0.0:*) :: \"\"\n} 1.0e-6\n\nREAL maximum_relative_error \"Maximum allowed relative error for adaptive stepsize control\"\n{\n 0.0:*) :: \"\"\n} 1.0e-6\n\nREAL RHS_error_weight \"Weight of the RHS in the relative error calculation\"\n{\n 0.0:* :: \"should be between zero and one\"\n} 1.0\n\nREAL safety_factor \"Safety factor for stepsize control\"\n{\n (0.0:*) :: \"should be less than one\"\n} 0.9\n\nREAL maximum_decrease \"Maximum stepsize decrease factor\"\n{\n (1.0:*) :: \"should be larger than one\"\n} 10.0\n\nREAL maximum_increase \"Maximum stepsize increase factor\"\n{\n (1.0:*) :: \"should be larger than one\"\n} 5.0\n\n\n\nKEYWORD verbose \"How verbose should MoL be?\"\n{\n \"none\" :: \"No output at all (not implemented)\"\n \"normal\" :: \"Standard verbosity\"\n \"register\" :: \"List the variables registered as well\"\n \"extreme\" :: \"Everything you never wanted to know\"\n} \"normal\"\n\n\n\nshares: Cactus\n\nUSES CCTK_REAL cctk_initial_time\n", |
| "schedule": "# Schedule definitions for thorn MoL\n# $Header$\n\n##########################################################\n### Always require storage for the counters and time ###\n##########################################################\n\nSTORAGE: MoL_Counters, MoL_Original_Time\n\n\n############################################################\n### If using the generic Runge-Kutta solver, switch on ###\n### storage for the coefficient arrays ###\n############################################################\n\nif (CCTK_Equals(ODE_Method,\"Generic\"))\n{\n STORAGE: RKAlphaCoefficients\n STORAGE: RKBetaCoefficients\n}\n\n#############################\n### The actual routines ###\n#############################\n\n########################\n### Startup banner ###\n########################\n\nschedule MoL_Startup AT Startup\n{\n LANG: C\n} \"Startup banner\"\n\n#####################################\n### Parameter checking routine. ###\n#####################################\n\nschedule MoL_ParamCheck AT ParamCheck\n{\n LANG: C\n} \"Basic parameter checking\"\n\n#################################################\n### Allocate the arrays for the GF indexes. ###\n#################################################\n\nschedule MoL_SetupIndexArrays AT Wragh\n{\n LANG: C\n WRITES: MoL_Original_Time\n WRITES: MoL_SlowPostStep, MoL_SlowStep\n\n} \"Set up the MoL bookkeeping index arrays\"\n\n################################################\n### Initialize the coefficients for the RK ###\n### arrays if required ###\n################################################\n\nif (CCTK_Equals(ODE_Method,\"Generic\"))\n{\n schedule MoL_SetupRKCoefficients AT Wragh\n {\n LANG: C\n OPTIONS: GLOBAL\n STORAGE: RKAlphaCoefficients\n STORAGE: RKBetaCoefficients\n WRITES: RKAlphaCoefficients, RKBetaCoefficients\n } \"Initialize the generic Runge-Kutta coefficients\"\n}\n\n#################################################\n### The group where physics thorns call the ###\n### registration functions ###\n#################################################\n\nschedule MoL_SetScheduleStatus AT Wragh AFTER MoL_SetupIndexArrays\n{\n LANG: C\n OPTIONS: GLOBAL\n} \"Set the flag so it is ok to register with MoL\"\n\nschedule GROUP MoL_Register AT Wragh AFTER MoL_SetScheduleStatus\n{\n} \"The group where physics thorns register variables with MoL\"\n\nschedule MoL_ReportNumberVariables AT Wragh AFTER MoL_Register\n{\n LANG:C\n OPTIONS:META\n} \"Report how many of each type of variable there are\"\n\nif (initial_data_is_crap)\n{\n if (copy_ID_after_MoL_PostStep)\n {\n schedule MoL_FillAllLevels AT PostInitial AFTER MoL_PostStep\n {\n LANG:C\n } \"A bad routine. Fills all previous timelevels with data copied from the current.\"\n }\n else\n {\n schedule MoL_FillAllLevels AT PostInitial BEFORE MoL_PostStep\n {\n LANG:C\n } \"A bad routine. Fills all previous timelevels with data copied from the current.\"\n }\n}\n\n##########################################\n### Initialise the step size control ###\n##########################################\n\nschedule MoL_StartLoop AT Evol BEFORE MoL_Evolution\n{\n LANG: C\n OPTIONS: LEVEL\n WRITES: MoL_Stepsize_Bad, EstimatedDt\n} \"Initialise the step size control\"\n\nschedule MoL_StartLoop AT Initial\n{\n LANG: C\n OPTIONS: LEVEL\n WRITES: MoL_Stepsize_Bad, EstimatedDt\n} \"Initialise the step size control\"\n\n######################################################\n### The evolution step. This is almost a self ###\n### contained EVOL step with PRE and POST steps ###\n### to allow changing the type of the variables, ###\n### boundary enforcement and so on. ###\n######################################################\n\nschedule GROUP MoL_Evolution AT Evol WHILE MoL::MoL_Stepsize_Bad\n{\n} \"A single Cactus evolution step using MoL\"\n \n######################################################\n### StartStep contains the routines that just do ###\n### internal MoL stuff; setting the counter, and ###\n### changing the time and timestep if required. ###\n######################################################\n\nschedule GROUP MoL_StartStep IN MoL_Evolution\n{\n} \"MoL internal setup for the evolution step\"\n\nschedule MoL_SetCounter IN MoL_StartStep \n{\n LANG: C\n OPTIONS: LEVEL\n WRITES: MoL_Intermediate_Step\n WRITES: MoL_SlowStep, MoL_SlowPostStep\n} \"Set the counter for the ODE method to loop over\"\n\n########################################################\n### Note that the option LEVEL here is to ensure ###\n### that the time is set once per refinement level ###\n### and not once overall. ###\n########################################################\n\nschedule MoL_SetTime IN MoL_StartStep \n{\n LANG: C\n OPTIONS: LEVEL\n WRITES: MoL_Original_Time\n READS: RKAlphaCoefficients, RKBetaCoefficients\n READS: MoL_Intermediate_Step\n} \"Ensure the correct time and timestep are used\"\n\nschedule MoL_AllocateScratchSpace IN MoL_StartStep \n{\n LANG: C\n OPTIONS: LEVEL\n} \"Allocate storage for scratch levels\"\n\n#################################################################\n### PreStep is where physics thorns can do their own setup. ###\n### This would include scheduling the function calls to ###\n### change the type of variable. ###\n#################################################################\n\nschedule GROUP MoL_PreStep IN MoL_Evolution AFTER MoL_StartStep BEFORE MoL_Step\n{\n} \"Physics thorns can schedule preloop setup routines in here\"\n\n#######################################################################\n### Check to see if any type changing functions have been called, ###\n### and if so do the necessary bookkeeping. ###\n### Right now, I think this is unnecessary, now that we don't ###\n### reallocate any scratch space. ###\n#######################################################################\n\n#schedule MoL_CheckVariableType IN MoL_Evolution AFTER MoL_PreStep BEFORE MoL_Step\n#{\n# LANG: C\n#} \"If a physics thorn wants to change the type of a variable, do the bookkeeping\"\n\n#################################################################\n### Copy (ouch) the data into the correct timelevel so that ###\n### the physics thorn knows where to find it. ###\n#################################################################\n\nschedule MoL_AllocateScratch IN MoL_Evolution AFTER MoL_PreStep BEFORE MoL_Step\n{\n LANG: C\n} \"Allocate sufficient space for array scratch variables\"\n\nif (!skip_initial_copy)\n{\n schedule MoL_InitialCopy IN MoL_Evolution AFTER (MoL_PreStep MoL_AllocateScratch) BEFORE MoL_Step\n {\n LANG: C\n } \"Ensure the data is in the correct timelevel\"\n}\n\nif(!CCTK_EQUALS(presync_mode, \"off\")) {\n schedule MoL_UpdateValidForInitialCopy in MoL_Evolution after MoL_InitialCopy before MoL_Step\n {\n LANG: C\n } \"Automatically update valid regions based on MoL\"\n}\n\n#################################################\n### The actual loop which updates the data. ###\n#################################################\n\nschedule GROUP MoL_Step WHILE MoL::MoL_Intermediate_Step IN MoL_Evolution AFTER MoL_PreStep\n{\n} \"The loop over the intermediate steps for the ODE integrator\"\n\n####################################################\n### The time integrator prepares the time step ###\n####################################################\n\nif (CCTK_Equals(ODE_Method,\"ICN-avg\")) \n{\n schedule MoL_ICNAverage AS MoL_Prepare IN MoL_Step BEFORE MoL_CalcRHS\n {\n LANG: C\n READS: MoL_Intermediate_Step\n } \"Averages the time levels for the averaging ICN method\"\n}\n\n##############################################\n### The time step is initialised to zero ###\n##############################################\n\nif (init_RHS_zero)\n{\n schedule MoL_InitRHS IN MoL_Step BEFORE MoL_CalcRHS\n {\n LANG: C\n } \"Initialise the RHS functions\"\n}\n\n#####################################################\n### The group where all the physics takes place ###\n#####################################################\n\nschedule GROUP MoL_CalcRHS IN MoL_Step\n{\n} \"Physics thorns schedule the calculation of the discrete spatial operator in here\"\n\n#############################################################\n### Any modification of the RHS done by external thorns ###\n### (dissipation etc.) should be done in MoL_PostRHS ###\n#############################################################\n\nschedule GROUP MoL_PostRHS IN MoL_Step AFTER MoL_CalcRHS BEFORE (MoL_NaNCheck MoL_Add) \n{\n} \"Modify RHS functions\"\n\n###############################################################\n### Certain operations, specifically boundary conditions ###\n### applied to the RHS must be performed after all other ###\n### operations. These can be scheduled in this bin, under ###\n### the assumption that things like dissipation are ###\n### scheduled in the MoL_PostRHS bin. It is the users ###\n### problem to ensure that this is really done. ###\n###############################################################\n\nschedule GROUP MoL_RHSBoundaries IN MoL_Step AFTER MoL_PostRHS BEFORE (MoL_NaNCheck MoL_Add)\n{\n} \"Any 'final' modifications to the RHS functions (boundaries etc.)\"\n\n#####################################################\n### If required, check for any NaNs in the RHSs ###\n#####################################################\n\nif (MoL_NaN_Check)\n{\n schedule MoL_NaNCheck IN MoL_Step AFTER MoL_CalcRHS BEFORE MoL_Add\n {\n LANG: C\n READS: MoL_Intermediate_Step\n } \"Check the RHS GFs for NaNs\"\n}\n\n######################################################\n### The time integrator performs the update here ###\n######################################################\n\nif (CCTK_Equals(ODE_Method,\"Generic\"))\n{\n schedule MoL_GenericRKAdd AS MoL_Add IN MoL_Step AFTER MoL_CalcRHS BEFORE (MoL_PostStep MoL_PostStepModify)\n {\n LANG: C\n READS: MoL_Intermediate_Step\n READS: Original_Delta_Time\n READS: RKAlphaCoefficients, RKBetaCoefficients\n } \"Updates calculated with a generic method\"\n}\nelse if (CCTK_Equals(ODE_Method,\"Euler\")) \n{\n schedule MoL_EulerAdd AS MoL_Add IN MoL_Step AFTER MoL_CalcRHS BEFORE MoL_PostStep\n {\n LANG: C\n READS: MoL_Intermediate_Step\n } \"Updates calculated with the Euler method\"\n}\nelse if (CCTK_Equals(ODE_Method,\"RK2\")) \n{\n schedule MoL_RK2Add AS MoL_Add IN MoL_Step AFTER MoL_CalcRHS BEFORE MoL_PostStep\n {\n LANG: C\n READS: MoL_Intermediate_Step\n } \"Updates calculated with the efficient Runge-Kutta 2 method\"\n}\nelse if (CCTK_Equals(ODE_Method,\"RK2-central\")) \n{\n schedule MoL_RK2CentralAdd AS MoL_Add IN MoL_Step AFTER MoL_CalcRHS BEFORE MoL_PostStep\n {\n LANG: C\n READS: Original_Delta_Time\n READS: MoL_Intermediate_Step\n } \"Updates calculated with the central Runge-Kutta 2 method\"\n}\nelse if (CCTK_Equals(ODE_Method,\"RK3\")) \n{\n schedule MoL_RK3Add AS MoL_Add IN MoL_Step AFTER MoL_CalcRHS BEFORE MoL_PostStep\n {\n LANG: C\n READS: MoL_Intermediate_Step\n } \"Updates calculated with the efficient Runge-Kutta 3 method\"\n}\nelse if (CCTK_Equals(ODE_Method,\"RK4\"))\n{\n schedule MoL_RK4Add AS MoL_Add IN MoL_Step AFTER MoL_CalcRHS BEFORE MoL_PostStep\n {\n LANG: C\n READS: MoL_Intermediate_Step\n READS: Original_Delta_Time\n } \"Updates calculated with the efficient Runge-Kutta 4 method\"\n}\nelse if (CCTK_Equals(ODE_Method,\"RK45\") || CCTK_Equals(ODE_Method,\"RK45CK\"))\n{\n STORAGE: ErrorScalars\n\n schedule MoL_RK45Add AS MoL_Add IN MoL_Step AFTER MoL_CalcRHS BEFORE MoL_PostStep\n {\n LANG: C\n READS: MoL_Intermediate_Step\n READS: Original_Delta_Time\n } \"Updates calculated with the Runge-Kutta 45 method\"\n}\nelse if (CCTK_Equals(ODE_Method,\"RK65\")) \n{\n STORAGE: ErrorScalars\n\n schedule MoL_RK65Add AS MoL_Add IN MoL_Step AFTER MoL_CalcRHS BEFORE MoL_PostStep\n {\n LANG: C\n READS: MoL_Intermediate_Step\n READS: Original_Delta_Time\n } \"Updates calculated with the Runge-Kutta 65 method\"\n}\nelse if (CCTK_Equals(ODE_Method,\"RK87\")) \n{\n STORAGE: ErrorScalars\n\n schedule MoL_RK87Add AS MoL_Add IN MoL_Step AFTER MoL_CalcRHS BEFORE MoL_PostStep\n {\n LANG: C\n READS: MoL_Intermediate_Step\n READS: Original_Delta_Time\n } \"Updates calculated with the Runge-Kutta 87 method\"\n}\nelse if (CCTK_Equals(ODE_Method,\"ICN\"))\n{\n schedule MoL_ICNAdd AS MoL_Add IN MoL_Step AFTER MoL_CalcRHS BEFORE MoL_PostStep\n {\n LANG: C\n READS: MoL_Intermediate_Step\n } \"Updates calculated with the efficient ICN method\"\n}\nelse if (CCTK_Equals(ODE_Method,\"ICN-avg\"))\n{\n schedule MoL_ICNAdd AS MoL_Add IN MoL_Step AFTER MoL_CalcRHS BEFORE MoL_PostStep\n {\n LANG: C\n READS: MoL_Intermediate_Step\n } \"Updates calculated with the averaging ICN method\"\n}\nelse if (CCTK_Equals(ODE_Method,\"AB\"))\n{\n schedule MoL_ABAdd AS MoL_Add IN MoL_Step AFTER MoL_CalcRHS BEFORE MoL_PostStep\n {\n LANG: C\n READS: MoL_Intermediate_Step\n } \"Updates calculated with the Adams-Bashforth\"\n}\nelse if (CCTK_Equals(ODE_Method,\"RK2-MR-2:1\")) \n{\n schedule MoL_RK2_MR_2_1_Add AS MoL_Add IN MoL_Step AFTER MoL_CalcRHS BEFORE MoL_PostStep\n {\n LANG: C\n READS: MoL_Intermediate_Step\n READS: Original_Delta_Time\n } \"Updates calculated with the multirate Runge-Kutta 2 method\"\n}\nelse if (CCTK_Equals(ODE_Method,\"RK4-MR-2:1\")) \n{\n schedule MoL_RK4_MR_2_1_Add AS MoL_Add IN MoL_Step AFTER MoL_CalcRHS BEFORE MoL_PostStep\n {\n LANG: C\n READS: MoL_Intermediate_Step\n READS: Original_Delta_Time\n } \"Updates calculated with the multirate Runge-Kutta 4 method\"\n}\nelse if (CCTK_Equals(ODE_Method,\"RK4-RK2\")) \n{\n schedule MoL_RK4_RK2_Add AS MoL_Add IN MoL_Step AFTER MoL_CalcRHS BEFORE MoL_PostStep\n {\n LANG: C\n READS: MoL_Intermediate_Step\n READS: Original_Delta_Time\n } \"Updates calculated with the multirate RK4/RK2 method\"\n}\n\nif(!CCTK_EQUALS(presync_mode, \"off\")) {\n schedule MoL_UpdateValidForAdd in MoL_Step after MoL_Add\n {\n LANG: C\n } \"Automatically update valid regions based on MoL\"\n}\n\n##################################################\n### Physics thorns can apply boundaries and ###\n### recalculate constrained variables and so ###\n### on in PostStep ###\n##################################################\n\nschedule GROUP MoL_PostStep IN MoL_Step AFTER MoL_Add\n{\n} \"The group for physics thorns to schedule boundary calls etc.\"\n\nif (set_ID_boundaries)\n{\n schedule GROUP MoL_PostStep AT PostInitial\n {\n } \"Ensure that everything is correct after the initial data have been set up\"\n}\n\n##################################################################\n### Schedule the PostStep parts in the Carpet 'PostRegrid' ###\n### bin so that symmetries are automatically done correctly. ###\n### We may want to change this later as it could be ###\n### expensive, but it's simplest for the moment. ###\n##################################################################\n\nschedule GROUP MoL_PostStep AT PostRegrid\n{\n} \"Ensure that everything is correct after regridding\"\n\n##################################################################\n### Schedule the PostStep parts in the Carpet 'PostRestrict' ###\n### bin so that symmetries are automatically done correctly. ###\n### We may want to change this later as it could be ###\n### expensive, but it's simplest for the moment. ###\n##################################################################\n\nif (set_ID_boundaries)\n{\n schedule GROUP MoL_PostStep AT PostRestrictInitial\n {\n } \"Ensure that everything is correct after restriction\"\n}\n\nschedule GROUP MoL_PostStep AT PostRestrict\n{\n} \"Ensure that everything is correct after restriction\"\n\n##############################################################\n### Schedule the PostStep parts after recovery ###\n### so that symmetries are automatically done correctly. ###\n### We may want to change this later as it could be ###\n### expensive, but it's simplest for the moment. ###\n##############################################################\n\nif (run_MoL_PostStep_in_Post_Recover_Variables) {\n schedule GROUP MoL_PostStep AT Post_Recover_Variables\n {\n } \"Ensure that everything is correct after recovery\"\n}\n\n#########################################################################\n### Physics thorns can enforce constraints in PostStepModify. ###\n### The difference between PostStep and PostStepModify is that ###\n### PostStep is scheduled at many other occasions, whereas the ###\n### PostStepModify is only scheduled during evolution. ###\n#########################################################################\n\nschedule GROUP MoL_PostStepModify IN MoL_Step AFTER MoL_Add BEFORE MoL_PostStep\n{\n} \"The group for physics thorns to schedule enforcing constraints\"\n\nschedule GROUP MoL_PostStepModify At PostInitial BEFORE MoL_PostStep\n{\n} \"The group for physics thorns to schedule enforcing constraints\"\n\n##########################################################################\n### Schedule a pseudo-evolution group to handle variables which are ###\n### not evolved, but which should be calculated at every time step. ###\n##########################################################################\n\nschedule GROUP MoL_PseudoEvolution AT PostInitial AFTER MoL_PostStep\n{\n} \"Calculate pseudo-evolved quantities\"\n\nschedule GROUP MoL_PseudoEvolution AT Evol AFTER MoL_Evolution\n{\n} \"Calculate pseudo-evolved quantities\"\n\nschedule GROUP MoL_PseudoEvolutionBoundaries AT PostRegridInitial AFTER MoL_PostStep\n{\n} \"Apply boundary conditions to pseudo-evolved quantities\"\n\nschedule GROUP MoL_PseudoEvolutionBoundaries AT PostRegrid AFTER MoL_PostStep\n{\n} \"Apply boundary conditions to pseudo-evolved quantities\"\n\nschedule GROUP MoL_PseudoEvolutionBoundaries AT PostRestrictInitial AFTER MoL_PostStep\n{\n} \"Apply boundary conditions to pseudo-evolved quantities\"\n\nschedule GROUP MoL_PseudoEvolutionBoundaries AT PostRestrict AFTER MoL_PostStep\n{\n} \"Apply boundary conditions to pseudo-evolved quantities\"\n\n#################################################\n### Final internal MoL stuff; decrement the ###\n### counter, change time and timestep ###\n#################################################\n\nschedule MoL_DecrementCounter IN MoL_Step AFTER MoL_Add BEFORE (MoL_PostStep MoL_PostStepModify)\n{\n LANG: C\n OPTIONS: LEVEL\n WRITES: MoL_Intermediate_Step\n WRITES: MoL_SlowStep, MoL_SlowPostStep\n} \"Alter the counter number\"\n\nschedule MoL_ResetTime IN MoL_Step AFTER MoL_DecrementCounter BEFORE (MoL_PostStep MoL_PostStepModify)\n{\n LANG: C\n OPTIONS: LEVEL\n READS: MoL_Original_Time\n READS: RKAlphaCoefficients, RKBetaCoefficients\n READS: MoL_Intermediate_Step\n} \"If necessary, change the time\"\n\nschedule MoL_ResetDeltaTime IN MoL_Step AFTER (MoL_PostStep MoL_PostStepModify)\n{\n LANG: C\n OPTIONS: LEVEL\n READS: Original_Delta_Time\n READS: RKAlphaCoefficients, RKBetaCoefficients\n READS: MoL_Intermediate_Step\n} \"If necessary, change the timestep\"\n\n##################################################\n### Finally, restore any SaveAndRestore type ###\n### variables to their original state. ###\n##################################################\n\nschedule MoL_RestoreSandR IN MoL_Evolution AFTER (MoL_ReduceAdaptiveError MoL_FinishLoop)\n{\n LANG: C\n} \"Restoring the Save and Restore variables to the original state\"\n\nschedule MoL_FreeScratchSpace IN MoL_Evolution AFTER MoL_RestoreSandR\n{\n LANG: C\n OPTIONS: LEVEL\n} \"Free storage for scratch levels\"\n\n\n###################################################\n### Loop until the step size was small enough ###\n###################################################\n\nif (adaptive_stepsize)\n{\n # Adaptive step size control\n schedule MoL_InitAdaptiveError IN MoL_Evolution AFTER MoL_Step\n {\n LANG: C\n OPTIONS: LEVEL\n WRITES: Error, Count\n } \"Control the step size: initialize error check variables\"\n \n schedule MoL_FindAdaptiveError IN MoL_Evolution AFTER MoL_InitAdaptiveError\n {\n LANG: C\n READS: Original_Delta_Time\n WRITES: Error, Count\n } \"Control the step size: compute error check variables\"\n \n schedule MoL_ReduceAdaptiveError IN MoL_Evolution AFTER MoL_FindAdaptiveError\n {\n LANG: C\n OPTIONS: LEVEL\n READS: Original_Delta_Time\n WRITES: Error, Count, MoL_StepSize_Bad, EstimatedDt\n } \"Control the step size: reduce error check variables\"\n\n schedule MoL_SetEstimatedDt AT POSTSTEP \n {\n LANG: C\n OPTIONS: LEVEL\n READS: EstimatedDt\n } \"Control the step size: set the new timestep\"\n}\nelse\n{\n schedule MoL_FinishLoop IN MoL_Evolution AFTER MoL_Step\n {\n LANG: C\n OPTIONS: LEVEL\n WRITES: MoL_Stepsize_Bad, MoL_SlowPostStep, MoL_SlowStep\n } \"Control the step size\"\n}\n\n################################################################\n### At the end (but before driver terminate to avoid those ###\n### irritating segfaults) free the index arrays. ###\n################################################################\n\nschedule MoL_FreeIndexArrays AT Terminate BEFORE Driver_Terminate\n{\n LANG: C\n} \"Free the MoL bookkeeping index arrays\"\n", |
| "src": { |
| "RKCoefficients.c": " /*@@\n @file RKCoefficients.c\n @date Tue May 21 02:46:51 2002\n @author Ian Hawke\n @desc \n The routine setting up the coefficients for the generic Runge-Kutta\n style integrator. At some point this should be extended so that\n these can be set from the parameter file.\n @version $Header$\n @enddesc \n @@*/\n\n#include \"cctk.h\"\n#include \"cctk_Arguments.h\"\n#include \"cctk_Parameters.h\"\n\n#include \"util_ErrorCodes.h\"\n#include \"util_Table.h\"\n\nstatic const char *rcsid = \"$Header$\";\n\nCCTK_FILEVERSION(CactusBase_MoL_RKCoefficients_c);\n\n/********************************************************************\n ********************* Local Data Types ***********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Local Routine Prototypes *********************\n ********************************************************************/\n\n/********************************************************************\n ***************** Scheduled Routine Prototypes *********************\n ********************************************************************/\n\nvoid MoL_SetupRKCoefficients(CCTK_ARGUMENTS);\n\n/********************************************************************\n ********************* Other Routine Prototypes *********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Local Data *****************************\n ********************************************************************/\n\n/********************************************************************\n ********************* External Routines **********************\n ********************************************************************/\n\n /*@@\n @routine MoL_SetupRKCoefficients\n @date Tue May 21 02:49:06 2002\n @author Ian Hawke\n @desc \n Sets up the coefficients of the RKAlpha and Beta arrays. These\n are currently set \"by hand\" for the Runge-Kutta and generic ICN\n methods. Should add the ability to set from a parameter file.\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nvoid MoL_SetupRKCoefficients(CCTK_ARGUMENTS)\n{\n DECLARE_CCTK_ARGUMENTS_CHECKED(MoL_SetupRKCoefficients);\n DECLARE_CCTK_PARAMETERS;\n \n CCTK_INT i, j;\n\n CCTK_INT ierr, options_table;\n\n if (CCTK_EQUALS(Generic_Type,\"Classic RK3\"))\n {\n if (MoL_Num_Scratch_Levels != 2)\n {\n CCTK_ERROR(\"For Classic RK3, MoL_Num_Scratch_Levels \"\n \"should be at least 2\");\n }\n if (MoL_Intermediate_Steps != 3)\n {\n CCTK_ERROR(\"For Classic RK3, MoL_Intermediate_Steps \"\n \"should be at least 3\");\n }\n for (i = 0; i < MoL_Intermediate_Steps; i++) \n {\n for (j = 0; j < MoL_Num_Scratch_Levels + 1; j++) \n { \n RKAlphaCoefficients[i * MoL_Intermediate_Steps + j] = 0.0;\n }\n RKBetaCoefficients[i] = 0.0;\n }\n RKAlphaCoefficients[0] = 1.0;\n RKAlphaCoefficients[3] = 1.0;\n RKAlphaCoefficients[6] = 1.0 / 9.0;\n RKAlphaCoefficients[7] = 4.0 / 9.0;\n RKAlphaCoefficients[8] = 4.0 / 9.0;\n RKBetaCoefficients[0] = 0.5;\n RKBetaCoefficients[1] = 0.75;\n RKBetaCoefficients[2] = 4.0 / 9.0; \n }\n else if (CCTK_EQUALS(Generic_Type,\"ICN\")) \n {\n for (i = 0; i < MoL_Intermediate_Steps; i++) \n {\n RKAlphaCoefficients[i * MoL_Intermediate_Steps] = 1.0;\n for (j = 1; j < MoL_Num_Scratch_Levels + 1; j++) \n {\n RKAlphaCoefficients[i * MoL_Intermediate_Steps + j] = 0.0;\n }\n if (i == MoL_Intermediate_Steps-1)\n {\n RKBetaCoefficients[i] = 1.0;\n }\n else\n {\n RKBetaCoefficients[i] = 0.5;\n } \n }\n }\n else if (CCTK_EQUALS(Generic_Type,\"RK\")) \n {\n if (MoL_Num_Scratch_Levels < MoL_Intermediate_Steps - 1)\n {\n CCTK_ERROR(\"For generic RK methods, MoL_Num_Scratch_Levels \"\n \"should be at least MoL_Intermediate_Steps - 1\");\n }\n for (i = 0; i < MoL_Intermediate_Steps; i++) \n {\n for (j = 0; j < MoL_Num_Scratch_Levels + 1; j++) \n { \n RKAlphaCoefficients[i * MoL_Intermediate_Steps + j] = 0.0;\n }\n RKBetaCoefficients[i] = 0.0;\n }\n if (MoL_Intermediate_Steps == 1)\n {\n RKAlphaCoefficients[0] = 1.0;\n RKBetaCoefficients[0] = 1.0;\n }\n else if (MoL_Intermediate_Steps == 2)\n {\n RKAlphaCoefficients[0] = 1.0;\n RKAlphaCoefficients[2] = 0.5;\n RKAlphaCoefficients[3] = 0.5;\n RKBetaCoefficients[0] = 1.0;\n RKBetaCoefficients[1] = 0.5;\n\n }\n else if (MoL_Intermediate_Steps == 3)\n {\n RKAlphaCoefficients[0] = 1.0;\n RKAlphaCoefficients[3] = 0.75;\n RKAlphaCoefficients[4] = 0.25;\n RKAlphaCoefficients[6] = 1.0 / 3.0;\n RKAlphaCoefficients[8] = 2.0 / 3.0;\n RKBetaCoefficients[0] = 1.0;\n RKBetaCoefficients[1] = 0.25;\n RKBetaCoefficients[2] = 2.0 / 3.0;\n }\n else if (MoL_Intermediate_Steps == 4)\n {\n RKAlphaCoefficients[0] = 1.0;\n RKAlphaCoefficients[4] = 1.0;\n RKAlphaCoefficients[8] = 1.0;\n RKAlphaCoefficients[12] = -1.0 / 3.0;\n RKAlphaCoefficients[13] = 1.0 / 3.0;\n RKAlphaCoefficients[14] = 2.0 / 3.0;\n RKAlphaCoefficients[15] = 1.0 / 3.0;\n RKBetaCoefficients[0] = 0.5;\n RKBetaCoefficients[1] = 0.5;\n RKBetaCoefficients[2] = 1.0;\n RKBetaCoefficients[3] = 1.0 / 6.0;\n }\n else \n {\n CCTK_ERROR(\"RKCoefficients cannot do generic RK methods \"\n \"with MoL_Intermediate_Steps greater than 4\");\n }\n }\n else if (CCTK_EQUALS(Generic_Type,\"Table\")) \n {\n if (MoL_Num_Scratch_Levels < MoL_Intermediate_Steps - 1)\n {\n CCTK_ERROR(\"For generic methods, MoL_Num_Scratch_Levels \"\n \"should be at least MoL_Intermediate_Steps - 1\");\n }\n options_table =\n Util_TableCreateFromString(Generic_Method_Descriptor);\n if (options_table < 0)\n {\n CCTK_ERROR(\"Failed to create table from \"\n \"Generic_Method_Descriptor!\");\n }\n ierr = Util_TableGetRealArray(options_table,\n (MoL_Num_Scratch_Levels + 1) * \n MoL_Intermediate_Steps,\n RKAlphaCoefficients,\n \"GenericAlphaCoeffs\");\n if (ierr < (MoL_Num_Scratch_Levels + 1) * MoL_Intermediate_Steps )\n {\n if (ierr >= 0)\n {\n CCTK_ERROR(\"Insufficient elements in the specified \"\n \"GenericAlphaCoeffs array\");\n }\n else if (ierr == UTIL_ERROR_TABLE_NO_SUCH_KEY)\n {\n CCTK_ERROR(\"When using the generic table options you \"\n \"must set \\\"GenericAlphaCoeffs\\\" in the options table\");\n }\n else\n {\n CCTK_ERROR(\"Table error - check with Ian.\");\n }\n }\n ierr = Util_TableGetRealArray(options_table,\n MoL_Intermediate_Steps,\n RKBetaCoefficients,\n \"GenericBetaCoeffs\");\n if (ierr < MoL_Intermediate_Steps)\n {\n if (ierr >= 0)\n {\n CCTK_ERROR(\"Insufficient elements in the specified \"\n \"GenericBetaCoeffs array\");\n }\n else if (ierr == UTIL_ERROR_TABLE_NO_SUCH_KEY)\n {\n CCTK_ERROR(\"When using the generic table options you \"\n \"must set \\\"GenericBetaCoeffs\\\" in the options table\");\n }\n else\n {\n CCTK_ERROR(\"Table error - check with Ian.\");\n }\n }\n ierr = Util_TableDestroy(options_table);\n }\n else\n {\n CCTK_ERROR(\"RKCoefficients does not recognize the value \"\n \"of Generic_Type\");\n }\n}\n\n/********************************************************************\n ********************* Local Routines *************************\n ********************************************************************/\n", |
| "MoLFunctions.h": " /*@@\n @file MoLFunctions.h\n @date Thu Jun 13 22:17:32 2002\n @author Ian Hawke\n @desc \n A header file with the definitions of the functions to be \n called by other thorns. This will exist until the function\n aliasing is sorted out.\n @enddesc \n @@*/\n\n#ifndef MOL_FUNCTIONS_H\n#define MOL_FUNCTIONS_H\n\nCCTK_INT MoL_RegisterEvolved(CCTK_INT EvolvedIndex, CCTK_INT RHSIndex);\nCCTK_INT MoL_RegisterEvolvedSlow(CCTK_INT EvolvedIndex, CCTK_INT RHSIndexSlow);\nCCTK_INT MoL_RegisterConstrained(CCTK_INT ConstrainedIndex);\nCCTK_INT MoL_RegisterSaveAndRestore(CCTK_INT SandRIndex);\nCCTK_INT MoL_ChangeToEvolved(CCTK_INT EvolvedIndex, CCTK_INT RHSIndex);\nCCTK_INT MoL_ChangeToConstrained(CCTK_INT ConstrainedIndex);\nCCTK_INT MoL_ChangeToSaveAndRestore(CCTK_INT SandRIndex);\nCCTK_INT MoL_ChangeToNone(CCTK_INT RemoveIndex);\nCCTK_INT MoL_RegisterEvolvedGroup(CCTK_INT EvolvedGroupIndex, \n CCTK_INT RHSGroupIndex);\nCCTK_INT MoL_RegisterEvolvedGroupSlow(CCTK_INT EvolvedGroupIndexSlow,\n CCTK_INT RHSGroupIndexSlow);\nCCTK_INT MoL_RegisterConstrainedGroup(CCTK_INT ConstrainedGroupIndex);\nCCTK_INT MoL_RegisterSaveAndRestoreGroup(CCTK_INT SandRGroupIndex);\n\n#endif\n", |
| "make.code.defn": "# Main make.code.defn file for thorn MoL\n# $Header$\n\n# Source files in this directory\nSRCS = \tAB.c \\\n\tChangeType.c \\\n\tCounter.c \\\n\tEuler.c \\\n\tGenericRK.c \\\n\tICN.c \\\n\tIndexArrays.c \\\n\tInitialCopy.c \\\n\tMoLPresync.cc \\\n\tOperators.c \\\n\tParamCheck.c \\\n\tScratchSpace.c \\\n\tRK2.c \\\n\tRK2-central.c \\\n\tRK2-MR-2_1.c \\\n\tRK4-MR-2_1.c \\\n\tRK4-RK2.c \\\n\tRK3.c \\\n\tRK4.c \\\n\tRK45.c \\\n\tRK65.c \\\n\tRK87.c \\\n\tRegistration.c \\\n\tRKCoefficients.c \\\n\tRHSNaNCheck.c \\\n\tSandR.c \\\n\tSetTime.c \\\n\tStartup.c \\\n\tStepSize.c\n\n# Subdirectories containing source files\nSUBDIRS = \n\n", |
| "RK65.c": " /*@@\n @file RK65.c\n @date Sun May 26 03:47:15 2002\n @author Peter Diener (based on RK45.c by Ian Hawke)\n @desc \n RK65 following P. J. Prince and J. R. Dormand\n Journal of Computational and Applied Mathematics, volume 7, no 1, 1981\n @enddesc \n @version $Header$\n @@*/\n\n#include \"cctk.h\"\n#include \"cctk_Arguments.h\"\n#include \"cctk_Parameters.h\"\n\n#include \"ExternalVariables.h\"\n\nstatic const char *rcsid = \"$Header$\";\n\nCCTK_FILEVERSION(CactusBase_MoL_RK65_c);\n\n/********************************************************************\n ********************* Local Data Types ***********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Local Routine Prototypes *********************\n ********************************************************************/\n\n/********************************************************************\n ***************** Scheduled Routine Prototypes *********************\n ********************************************************************/\n\nvoid MoL_RK65Add(CCTK_ARGUMENTS);\n\n/********************************************************************\n ********************* Other Routine Prototypes *********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Local Data *****************************\n ********************************************************************/\n\n/********************************************************************\n ********************* External Routines **********************\n ********************************************************************/\n\n /*@@\n @routine MoL_RK65Add\n @date Sun May 26 03:50:44 2002\n @author Peter Diener (based on MoL_RK45Add by Ian Hawke)\n @desc \n Performs a single step of a Runge-Kutta 65 type time\n integration, storing the error estimate.\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nvoid MoL_RK65Add(CCTK_ARGUMENTS)\n{\n\n DECLARE_CCTK_ARGUMENTS_CHECKED(MoL_RK65Add);\n DECLARE_CCTK_PARAMETERS;\n \n CCTK_INT arraydim;\n\n CCTK_INT index, var, scratchstep;\n CCTK_INT totalsize;\n\n CCTK_REAL * restrict UpdateVar;\n CCTK_REAL const * restrict RHSVar;\n CCTK_REAL * restrict ScratchVar;\n CCTK_REAL * restrict ErrorVar;\n CCTK_REAL const * restrict OldVar;\n\n CCTK_REAL beta, gamma, gamma_error;\n\n static const CCTK_REAL beta_array[7][7] = {\n { 1.0/10.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 },\n { -2.0/81.0, 20.0/81.0, 0.0, 0.0, 0.0, 0.0, 0.0 },\n { 615.0/1372.0, -270.0/343.0, 1053.0/1372.0, 0.0, 0.0, 0.0, 0.0 },\n { 3243.0/5500.0, -54.0/55.0, 50949.0/71500.0, 4998.0/17875.0, 0.0, 0.0, 0.0 },\n { -26492.0/37125.0, 72.0/55.0, 2808.0/23375.0, -24206.0/37125.0, 338.0/459.0, 0.0, 0.0 },\n { 5561.0/2376.0, -35.0/11.0, -24117.0/31603.0, 899983.0/200772.0, -5225.0/1836.0, 3925.0/4056.0, 0.0 },\n { 465467.0/266112.0, -2945.0/1232.0, -5610201.0/14158144.0, 10513573.0/3212352.0, -424325.0/205632.0, 376225.0/454272.0, 0.0 }\n };\n\n static const CCTK_REAL gamma_array[8] = \n { 61.0/864.0, \n 0.0, \n 98415.0/321776.0, \n 16807.0/146016.0, \n 1375.0/7344.0, \n 1375.0/5408.0,\n -37.0/1120.0,\n 1.0/10.0\n };\n\n static const CCTK_REAL gammastar_array[8] = \n { 821.0/10800.0,\n 0.0, \n 19683.0/71825.0, \n 175273.0/912600.0, \n 395.0/3672.0, \n 785.0/2704.0,\n 3.0/50.0,\n 0.0 \n };\n\n totalsize = 1;\n for (arraydim = 0; arraydim < cctk_dim; arraydim++)\n {\n totalsize *= cctk_ash[arraydim];\n } \n\n /* Real GFs */\n\n /* First store (dt times) the rhs in the scratch array. */\n\n for (var = 0; var < MoLNumEvolvedVariables; var++)\n {\n const CCTK_REAL tmp = (*Original_Delta_Time) / cctkGH->cctk_timefac;\n\n UpdateVar = (CCTK_REAL *)CCTK_VarDataPtrI(cctkGH, 0, \n EvolvedVariableIndex[var]);\n RHSVar = (CCTK_REAL const *)CCTK_VarDataPtrI(cctkGH, 0, \n\t\t\t\t\t\t RHSVariableIndex[var]);\n ScratchVar = (CCTK_REAL*)CCTK_VarDataPtrI(cctkGH, var, \n CCTK_FirstVarIndex(\"MOL::SCRATCHSPACE\")\n + (MoL_Intermediate_Steps - \n (*MoL_Intermediate_Step)));\n#pragma omp /*parallel for*/ simd\n for (index = 0; index < totalsize; index++)\n {\n ScratchVar[index] = tmp * RHSVar[index];\n }\n }\n\n\n for (var = 0; var < MoLNumEvolvedVariables; var++)\n {\n OldVar = (CCTK_REAL const *)CCTK_VarDataPtrI(cctkGH, 1, \n\t\t\t\t\t\t EvolvedVariableIndex[var]);\n UpdateVar = (CCTK_REAL *)CCTK_VarDataPtrI(cctkGH, 0, \n EvolvedVariableIndex[var]);\n RHSVar = (CCTK_REAL const *)CCTK_VarDataPtrI(cctkGH, var, \n\t\t\t\t\t\t CCTK_FirstVarIndex(\"MOL::SCRATCHSPACE\")\n\t\t\t\t\t\t + (MoL_Intermediate_Steps - \n\t\t\t\t\t\t (*MoL_Intermediate_Step)));\n ErrorVar = (CCTK_REAL*)CCTK_VarDataPtrI(cctkGH, var, \n CCTK_FirstVarIndex(\"MOL::ERRORESTIMATE\"));\n\n if (*MoL_Intermediate_Step - 1)\n { \n\n#pragma omp /*parallel for*/ simd\n for (index = 0; index < totalsize; index++)\n {\n UpdateVar[index] = OldVar[index];\n }\n\n for (scratchstep = 0; \n scratchstep < MoL_Intermediate_Steps - (*MoL_Intermediate_Step) + 1;\n scratchstep++)\n {\n \n ScratchVar = (CCTK_REAL*)CCTK_VarDataPtrI(cctkGH, var, \n CCTK_FirstVarIndex(\"MOL::SCRATCHSPACE\")\n + scratchstep);\n \n beta = beta_array[MoL_Intermediate_Steps - (*MoL_Intermediate_Step)][scratchstep];\n \n if ( (beta > MoL_Tiny)||(beta < -MoL_Tiny) )\n {\n#pragma omp /*parallel for*/ simd\n for (index = 0; index < totalsize; index++)\n {\n UpdateVar[index] += beta * ScratchVar[index];\n }\n }\n \n }\n \n }\n else\n {\n\n#pragma omp /*parallel for*/ simd\n for (index = 0; index < totalsize; index++)\n {\n UpdateVar[index] = OldVar[index];\n ErrorVar[index] = 0;\n }\n \n for (scratchstep = 0; scratchstep < 8; scratchstep++)\n {\n \n ScratchVar = (CCTK_REAL*)CCTK_VarDataPtrI(cctkGH, var, \n CCTK_FirstVarIndex(\"MOL::SCRATCHSPACE\")\n + scratchstep);\n \n gamma = gamma_array[scratchstep];\n gamma_error = gamma - gammastar_array[scratchstep];\n \n if ( (gamma > MoL_Tiny)||(gamma < -MoL_Tiny) )\n {\n#pragma omp /*parallel for*/ simd\n for (index = 0; index < totalsize; index++)\n {\n UpdateVar[index] += gamma * ScratchVar[index];\n ErrorVar[index] += gamma_error * ScratchVar[index];\n }\n }\n }\n \n }\n \n }\n\n /* Real arrays */\n\n for (var = 0; var < MoLNumEvolvedArrayVariables; var++)\n {\n\n CCTK_ERROR(\"Peter has been too lazy to write the RK65 routine \"\n \"out for array variables. Better send him an email...\");\n\n }\n \n return;\n}\n\n/********************************************************************\n ********************* Local Routines *************************\n ********************************************************************/\n\n", |
| "ScratchSpace.c": " /*@@\n @file ScratchSpace.c\n @date Tue Jul 10 11:26:48 PDT 2012\n @author Roland Haas\n @desc \n Allocates and deallocates memory for scratch levels.\n @enddesc \n @version $Header$\n @@*/\n\n#include <stdlib.h>\n#include <stdio.h>\n#include <string.h>\n\n#include \"cctk.h\"\n#include \"cctk_Arguments.h\"\n#include \"cctk_Parameters.h\"\n\n#include \"ExternalVariables.h\"\n\nstatic const char *rcsid = \"$Header$\";\n\nCCTK_FILEVERSION(CactusBase_MoL_ScratchSpace_c);\n\n/********************************************************************\n ********************* Local Data Types ***********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Local Routine Prototypes *********************\n ********************************************************************/\n\nstatic void MoL_AllocateScratchLevelsForVar(const cGH *cctkGH, const char *scratchgroupname, int timelevels);\n\nstatic void MoL_FreeScratchLevelsForVar(const cGH *cctkGH, const char *scratchgroupname);\n\n/* support old versions of the flesh */\n#ifndef HAVE_CCTK_DECLARED_TIMELEVELS\n#define CCTK_DeclaredTimeLevelsGI(gi) CCTK_MaxTimeLevelsGI(gi)\n#endif\n\n/********************************************************************\n ***************** Scheduled Routine Prototypes *********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Other Routine Prototypes *********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Local Data *****************************\n ********************************************************************/\n\n/********************************************************************\n ********************* External Routines **********************\n ********************************************************************/\n\n /*@@\n @routine MoL_AllocateScratchSpace\n @date Tue Jul 10 11:29:00 PDT 2012\n @author Roland Haas\n @desc \n Allocates scratch space for a all registered variables.\n @enddesc \n @calls MoL_AllocateScratchLevelsForVar\n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nvoid MoL_AllocateScratchSpace(CCTK_ARGUMENTS)\n{\n DECLARE_CCTK_PARAMETERS;\n\n const int need_error_estimate = CCTK_Equals(ODE_Method,\"RK45\") || \n CCTK_Equals(ODE_Method,\"RK45CK\") || CCTK_Equals(ODE_Method,\"RK65\") || CCTK_Equals(ODE_Method,\"RK87\");\n\n /* we abuse the Cactus timelevels (since they are something we can change at\n * run time) to obtain mesh refined scratch space */\n\n /* CCTK_REAL GF */\n MoL_AllocateScratchLevelsForVar(cctkGH, \"MoL::ScratchSpace\", MoLNumEvolvedVariables);\n MoL_AllocateScratchLevelsForVar(cctkGH, \"MoL::ScratchSpaceSlow\", MoLNumEvolvedVariablesSlow);\n MoL_AllocateScratchLevelsForVar(cctkGH, \"MoL::SandRScratchSpace\", MoLNumSandRVariables);\n if (need_error_estimate) /* adaptive stepping is only supported for CCTK_REAL grid functions */\n MoL_AllocateScratchLevelsForVar(cctkGH, \"MoL::ErrorEstimate\", MoLNumEvolvedVariables);\n\n /* CCTK_REAL GA */\n /*MoL_AllocateScratchLevelsForVar(cctkGH, \"MoL::ArrayScratchSpace\", MoLNumEvolvedArrayVariables);*/\n /*MoL_AllocateScratchLevelsForVar(cctkGH, \"MoL::ArraySandRScratchSpace\", MoLNumSandRArrayVariables);*/\n\n}\n\n /*@@\n @routine MoL_FreeScratchSpace\n @date Tue Jul 10 11:29:00 PDT 2012\n @author Roland Haas\n @desc \n Free all scratch space.\n @enddesc \n @calls MoL_FreeScratchLevelsForVar\n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nvoid MoL_FreeScratchSpace(CCTK_ARGUMENTS)\n{\n /* CCTK_REAL GF */\n MoL_FreeScratchLevelsForVar(cctkGH, \"MoL::ScratchSpace\");\n MoL_FreeScratchLevelsForVar(cctkGH, \"MoL::ScratchSpaceSlow\");\n MoL_FreeScratchLevelsForVar(cctkGH, \"MoL::SandRScratchSpace\");\n MoL_FreeScratchLevelsForVar(cctkGH, \"MoL::ErrorEstimate\");\n\n /* CCTK_REAL GA */\n /*MoL_FreeScratchLevelsForVar(cctkGH, \"MoL::ArrayScratchSpace\");*/\n /*MoL_FreeScratchLevelsForVar(cctkGH, \"MoL::ArraySandRScratchSpace\");*/\n}\n\n/********************************************************************\n ********************* Local Routines *************************\n ********************************************************************/\n\n /*@@\n @routine MoL_AllocateScratchLevelsForVar\n @date Tue Jul 10 11:29:00 PDT 2012\n @author Roland Haas\n @desc \n Allocates scratch space for a single variable by manipulating the number of\n timelevels present.\n @enddesc \n @calls CCTK_GroupStorageIncrease\n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nstatic void MoL_AllocateScratchLevelsForVar(const cGH *cctkGH, const char *scratchgroupname, int timelevels)\n{\n int scratchgroup, ierr, activetimelevels;\n cGroup group;\n\n scratchgroup = CCTK_GroupIndex(scratchgroupname);\n if (scratchgroup < 0)\n {\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"Failed to obtain group index for group %s, ierr = %d.\", \n scratchgroupname, scratchgroup);\n }\n /* ODE methods without scratch levels lead to SCRATCHSPACE having 0 variables */\n CCTK_GroupData(scratchgroup, &group);\n if (group.numvars > 0)\n {\n int maxtimelevels = CCTK_DeclaredTimeLevelsGI(scratchgroup);\n if (timelevels > maxtimelevels)\n {\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"Too many (%d) scratch variables required. Only %d are supported. You will have to change interface.ccl\",\n timelevels, (int)maxtimelevels);\n }\n\n ierr = CCTK_GroupStorageIncrease(cctkGH, 1, &scratchgroup, &timelevels, NULL);\n ierr += CCTK_GroupStorageDecrease(cctkGH, 1, &scratchgroup, &timelevels, NULL);\n activetimelevels = CCTK_ActiveTimeLevelsGI(cctkGH, scratchgroup);\n if (ierr < 0 || timelevels != activetimelevels)\n {\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"Failed to adjust space for %s, ierr = %d, %d variables of %d active.\", \n scratchgroupname, ierr, activetimelevels, timelevels);\n }\n }\n}\n\n /*@@\n @routine MoL_FreeScratchLevelsForVar\n @date Tue Jul 10 11:29:00 PDT 2012\n @author Roland Haas\n @desc \n Deallocates scratch space for a single variable by manipulating the number\n of timelevels present.\n @enddesc \n @calls CCTK_GroupStorageDecrease\n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nstatic void MoL_FreeScratchLevelsForVar(const cGH *cctkGH, const char *scratchgroupname)\n{\n int scratchgroup, ierr, activetimelevels;\n int timelevels = 0;\n\n scratchgroup = CCTK_GroupIndex(scratchgroupname);\n if (scratchgroup < 0)\n {\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"Failed to obtain group index for group %s, ierr = %d.\", \n scratchgroupname, scratchgroup);\n }\n ierr = CCTK_GroupStorageDecrease(cctkGH, 1, &scratchgroup, &timelevels, NULL);\n activetimelevels = CCTK_ActiveTimeLevelsGI(cctkGH, scratchgroup);\n if (ierr < 0 || timelevels != activetimelevels)\n {\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"Failed to deallocate space for %s, ierr = %d, %d variables of %d still active.\", \n scratchgroupname, ierr, activetimelevels, timelevels);\n }\n}\n\n", |
| "AB.c": "#include \"cctk.h\"\n#include \"cctk_Arguments.h\"\n#include \"cctk_Parameters.h\"\n\n#include <assert.h>\n#include <math.h>\n#include <stdlib.h>\n\n#include \"ExternalVariables.h\"\n\n\n\n/* Coefficients taken from\n * http://en.wikipedia.org/wiki/Linear_multistep_method, which cites\n * (Hairer, Noersett & Wanner 1993, III.1; Butcher 2003, p. 103).\n * \n * Hairer, Ernst; Noersett, Syvert Paul; Wanner, Gerhard (1993),\n * Solving ordinary differential equations I: Nonstiff problems (2nd\n * ed.), Berlin: Springer Verlag, ISBN 978-3-540-56670-0.\n *\n * Butcher, John C. (2003), Numerical Methods for Ordinary\n * Differential Equations, John Wiley, ISBN 978-0-471-96758-3.\n */\n\n/* The following Mathematic expression (see\n * http://en.wikipedia.org/wiki/Linear_multistep_method) calculates\n * Adams-Bashforth coefficients for arbitrary orders:\n *\n * b = Table[\n * Table[(-1)^j/(j! (s - j - 1)!) Integrate[\n * Product[If[j == i, 1, u + i], {i, 0, s - 1}], {u, 0, 1}], {j, 0, \n * s - 1}], {s, 1, 8}]\n *\n * where s is the desired order. The coefficients up to order 8 are:\n * \n * {1}\n *\n * {3/2, -(1/2)}\n *\n * {23/12, -(4/3), 5/12}\n *\n * {55/24, -(59/24), 37/24, -(3/8)}\n *\n * {1901/720, -(1387/360), 109/30, -(637/360), 251/720}\n *\n * {4277/1440, -(2641/480), 4991/720, -(3649/720), 959/480, -(95/288)}\n *\n * {198721/60480, -(18637/2520), 235183/20160, -(10754/945),\n * 135713/20160, -(5603/2520), 19087/60480}\n *\n * {16083/4480, -(1152169/120960), 242653/13440, -(296053/13440),\n * 2102243/120960, -(115747/13440), 32863/13440, -(5257/17280)}\n */\n\n\n\nstatic void order1 (CCTK_REAL* restrict const UpdateVar,\n CCTK_REAL const* restrict *restrict const RHSVars,\n CCTK_REAL const dt,\n int const totalsize)\n{\n CCTK_REAL const* restrict const RHSVar0 = RHSVars[0];\n#pragma omp /*parallel for*/ simd\n for (int index = 0; index < totalsize; index++) {\n UpdateVar[index] += dt * RHSVar0[index];\n }\n}\n\nstatic void order2 (CCTK_REAL* restrict const UpdateVar,\n CCTK_REAL const* restrict *restrict const RHSVars,\n CCTK_REAL const dt,\n int const totalsize)\n{\n CCTK_REAL const* restrict const RHSVar0 = RHSVars[0];\n CCTK_REAL const* restrict const RHSVar1 = RHSVars[1];\n CCTK_REAL const f0 = + (3.0/2.0) * dt;\n CCTK_REAL const f1 = - (1.0/2.0) * dt;\n#pragma omp /*parallel for*/ simd\n for (int index = 0; index < totalsize; index++) {\n UpdateVar[index] += f0 * RHSVar0[index] + f1 * RHSVar1[index];\n }\n}\n\nstatic void order3 (CCTK_REAL* restrict const UpdateVar,\n CCTK_REAL const* restrict *restrict const RHSVars,\n CCTK_REAL const dt,\n int const totalsize)\n{\n CCTK_REAL const* restrict const RHSVar0 = RHSVars[0];\n CCTK_REAL const* restrict const RHSVar1 = RHSVars[1];\n CCTK_REAL const* restrict const RHSVar2 = RHSVars[2];\n CCTK_REAL const f0 = + (23.0/12.0) * dt;\n CCTK_REAL const f1 = - ( 4.0/ 3.0) * dt;\n CCTK_REAL const f2 = + ( 5.0/12.0) * dt;\n#pragma omp /*parallel for*/ simd\n for (int index = 0; index < totalsize; index++) {\n UpdateVar[index] +=\n f0 * RHSVar0[index] + f1 * RHSVar1[index] + f2 * RHSVar2[index];\n }\n}\n\nstatic void order4 (CCTK_REAL* restrict const UpdateVar,\n CCTK_REAL const* restrict *restrict const RHSVars,\n CCTK_REAL const dt,\n int const totalsize)\n{\n CCTK_REAL const* restrict const RHSVar0 = RHSVars[0];\n CCTK_REAL const* restrict const RHSVar1 = RHSVars[1];\n CCTK_REAL const* restrict const RHSVar2 = RHSVars[2];\n CCTK_REAL const* restrict const RHSVar3 = RHSVars[3];\n CCTK_REAL const f0 = + (55.0/24.0) * dt;\n CCTK_REAL const f1 = - (59.0/24.0) * dt;\n CCTK_REAL const f2 = + (37.0/24.0) * dt;\n CCTK_REAL const f3 = - ( 3.0/ 8.0) * dt;\n#pragma omp /*parallel for*/ simd\n for (int index = 0; index < totalsize; index++) {\n UpdateVar[index] +=\n f0 * RHSVar0[index] + f1 * RHSVar1[index] + f2 * RHSVar2[index] +\n f3 * RHSVar3[index];\n }\n}\n\nstatic void order5 (CCTK_REAL* restrict const UpdateVar,\n CCTK_REAL const* restrict *restrict const RHSVars,\n CCTK_REAL const dt,\n int const totalsize)\n{\n CCTK_REAL const* restrict const RHSVar0 = RHSVars[0];\n CCTK_REAL const* restrict const RHSVar1 = RHSVars[1];\n CCTK_REAL const* restrict const RHSVar2 = RHSVars[2];\n CCTK_REAL const* restrict const RHSVar3 = RHSVars[3];\n CCTK_REAL const* restrict const RHSVar4 = RHSVars[4];\n CCTK_REAL const f0 = + (1901.0/720.0) * dt;\n CCTK_REAL const f1 = - (1387.0/360.0) * dt;\n CCTK_REAL const f2 = + ( 109.0/ 30.0) * dt;\n CCTK_REAL const f3 = - ( 637.0/360.0) * dt;\n CCTK_REAL const f4 = + ( 251.0/720.0) * dt;\n#pragma omp /*parallel for*/ simd\n for (int index = 0; index < totalsize; index++) {\n UpdateVar[index] +=\n f0 * RHSVar0[index] + f1 * RHSVar1[index] + f2 * RHSVar2[index] +\n f3 * RHSVar3[index] + f4 * RHSVar4[index];\n }\n}\n\n/* Array of function pointers */\nstatic\nvoid (* const orders[]) (CCTK_REAL* restrict const UpdateVar,\n CCTK_REAL const* restrict *restrict const RHSVars,\n CCTK_REAL const dt,\n int const totalsize)\n= { order1, order2, order3, order4, order5 };\nstatic int const max_order = sizeof orders / sizeof *orders;\n\n\n\nvoid MoL_ABAdd(CCTK_ARGUMENTS)\n{\n DECLARE_CCTK_ARGUMENTS_CHECKED(MoL_ABAdd);\n DECLARE_CCTK_PARAMETERS;\n \n CCTK_REAL const dt = CCTK_DELTA_TIME;\n \n /* Determine the order of accuracy */\n int order;\n if (CCTK_EQUALS(AB_Type,\"1\")) {\n order = 1 ;\n } else if (CCTK_EQUALS(AB_Type,\"2\")) {\n order = 2;\n } else if (CCTK_EQUALS(AB_Type,\"3\")) {\n order = 3;\n } else if (CCTK_EQUALS(AB_Type,\"4\")) {\n order = 4;\n } else if (CCTK_EQUALS(AB_Type,\"5\")) {\n order = 5;\n } else {\n abort();\n }\n if (AB_initially_reduce_order) {\n /* Reduce the order for the first time steps */\n /* int const iteration = cctk_iteration; */\n int const iteration = 1 + lrint((cctk_time - cctk_initial_time) / dt);\n if (order > iteration) {\n order = iteration;\n CCTK_VInfo (CCTK_THORNSTRING,\n \"Reducing Adams-Bashforth order to %d\", order);\n }\n }\n/* printf (\"MoL AB: iter=%d, order=%d\\n\", cctk_iteration, order); */\n assert (order >= 1 && order <= max_order);\n \n int totalsize = 1;\n for (int arraydim = 0; arraydim < cctk_dim; arraydim++) {\n totalsize *= cctk_ash[arraydim];\n }\n \n for (int var = 0; var < MoLNumEvolvedVariables; var++) {\n CCTK_REAL* restrict const UpdateVar =\n CCTK_VarDataPtrI(cctkGH, 0, EvolvedVariableIndex[var]);\n CCTK_REAL const* restrict RHSVars[order];\n for (int tl = 0; tl < order; tl++) {\n RHSVars[tl] = CCTK_VarDataPtrI(cctkGH, tl, RHSVariableIndex[var]);\n }\n \n /* Add RHS */\n (orders[order-1]) (UpdateVar, RHSVars, dt, totalsize);\n } /* var */\n \n for (int var = 0; var < MoLNumEvolvedArrayVariables; var++) {\n CCTK_REAL* restrict const UpdateVar =\n CCTK_VarDataPtrI(cctkGH, 0, EvolvedArrayVariableIndex[var]);\n CCTK_REAL const* restrict RHSVars[order];\n for (int tl = 0; tl < order; tl++) {\n RHSVars[tl] = CCTK_VarDataPtrI(cctkGH, tl, RHSArrayVariableIndex[var]);\n }\n \n int const groupindex =\n CCTK_GroupIndexFromVarI(EvolvedArrayVariableIndex[var]);\n cGroupDynamicData arraydata;\n int const ierr = CCTK_GroupDynamicData(cctkGH, groupindex, &arraydata);\n if (ierr) {\n CCTK_VError(__LINE__, __FILE__, CCTK_THORNSTRING, \n \"The driver does not return group information for group '%s'.\",\n CCTK_GroupName(groupindex));\n }\n int arraytotalsize = 1;\n for (int arraydim = 0; arraydim < arraydata.dim; arraydim++) {\n arraytotalsize *= arraydata.ash[arraydim];\n }\n \n /* Add RHS */\n (orders[order-1]) (UpdateVar, RHSVars, dt, arraytotalsize);\n } /* var */\n\n}\n", |
| "ExternalVariables.h": " /*@@\n @file ExternalVariables.h\n @date Wed May 22 02:32:10 2002\n @author Ian Hawke\n @desc \n The header file containing the local variables used across routines.\n These are the arrays containing GF indexes for all types of variables,\n and the number of each type of variable currently in use (the \n parameters only give the maximum possible number).\n No function prototypes are defined in this file, so we do not protect\n it with an ifdef so that we can do inclusion within multiple routines\n in the same file.\n @enddesc \n @version $Header$\n @@*/\n\n\n#include <cctk.h>\n\n\nextern CCTK_INT *restrict EvolvedVariableIndex;\nextern CCTK_INT *restrict EvolvedVariableIndexSlow;\nextern CCTK_INT *restrict RHSVariableIndex;\nextern CCTK_INT *restrict RHSVariableIndexSlow;\nextern CCTK_INT *restrict ConstrainedVariableIndex;\nextern CCTK_INT *restrict SandRVariableIndex;\n\n\nextern CCTK_INT MoLNumEvolvedVariables;\nextern CCTK_INT MoLNumEvolvedVariablesSlow;\nextern CCTK_INT MoLNumConstrainedVariables;\nextern CCTK_INT MoLNumSandRVariables;\n\n\n\nextern CCTK_INT *restrict EvolvedArrayVariableIndex;\nextern CCTK_INT *restrict RHSArrayVariableIndex;\nextern CCTK_INT *restrict ConstrainedArrayVariableIndex;\nextern CCTK_INT *restrict SandRArrayVariableIndex;\n\n\nextern CCTK_INT MoLNumEvolvedArrayVariables;\nextern CCTK_INT MoLNumConstrainedArrayVariables;\nextern CCTK_INT MoLNumSandRArrayVariables;\n\n\n\nextern CCTK_INT ScheduleStatus;\n\n\nextern CCTK_REAL *restrict ArrayScratchSpace;\nextern CCTK_INT *restrict ArrayScratchSizes;\nextern CCTK_INT CurrentArrayScratchSize;\n\nextern CCTK_REAL *restrict ArrayErrorSpace;\nextern CCTK_INT *restrict ArrayErrorSizes;\nextern CCTK_INT CurrentArrayErrorSize;\n\nextern CCTK_INT MoLMaxNumRegisteredVariables;\n", |
| "Registration.c": " /*@@\n @file Registration.c\n @date Thu May 30 11:21:44 2002\n @author Ian Hawke\n @desc \n The external functions called (via function aliasing) by physics\n thorns to tell MoL that they want these GFs to be treated as a\n given type.\n @enddesc \n @version $Header$\n @@*/\n\n#include <string.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <assert.h>\n\n#include <stdlib.h>\n#ifdef MOLDEBUG\n#include <stdio.h>\n#endif\n\n#include \"cctk.h\"\n#include \"cctk_Arguments.h\"\n#include \"cctk_Parameters.h\"\n\n#include \"ExternalVariables.h\"\n\nstatic const char *rcsid = \"$Header$\";\n\nCCTK_FILEVERSION(CactusBase_MoL_Registration_c);\n\n/********************************************************************\n ********************* Local Data Types ***********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Local Routine Prototypes *********************\n ********************************************************************/\nstatic char *VarListToString(const CCTK_INT varindices[], const int nvars);\n\n/* support old versions of the flesh */\n#ifndef HAVE_CCTK_DECLARED_TIMELEVELS\n#define CCTK_DeclaredTimeLevelsVI(vi) CCTK_MaxTimeLevelsVI(vi)\n#endif\n\n/********************************************************************\n ***************** Scheduled Routine Prototypes *********************\n ********************************************************************/\n\nvoid MoL_SetScheduleStatus(CCTK_ARGUMENTS);\n\n/********************************************************************\n ********************* Other Routine Prototypes *********************\n ********************************************************************/\n\nCCTK_INT MoL_RegisterEvolved(CCTK_INT EvolvedIndex, CCTK_INT RHSIndex);\n\nCCTK_INT MoL_RegisterEvolvedSlow(CCTK_INT EvolvedIndex, CCTK_INT RHSIndexSlow);\n\nCCTK_INT MoL_RegisterConstrained(CCTK_INT ConstrainedIndex);\n\nCCTK_INT MoL_RegisterSaveAndRestore(CCTK_INT SandRIndex);\n\nCCTK_INT MoL_RegisterEvolvedGroup(CCTK_INT EvolvedGroupIndex, \n CCTK_INT RHSGroupIndex);\n\nCCTK_INT MoL_RegisterConstrainedGroup(CCTK_INT ConstrainedGroupIndex);\n\nCCTK_INT MoL_RegisterSaveAndRestoreGroup(CCTK_INT SandRGroupIndex);\n\n\nCCTK_INT MoL_RegisterEvolvedReal(CCTK_INT EvolvedIndex, CCTK_INT RHSIndex);\n\nCCTK_INT MoL_RegisterEvolvedRealSlow(CCTK_INT EvolvedIndex, CCTK_INT RHSIndexSlow);\n\nCCTK_INT MoL_RegisterConstrainedReal(CCTK_INT ConstrainedIndex);\n\nCCTK_INT MoL_RegisterSaveAndRestoreReal(CCTK_INT SandRIndex);\n\nCCTK_INT MoL_RegisterEvolvedRealGroup(CCTK_INT EvolvedGroupIndex, \n CCTK_INT RHSGroupIndex);\n\nCCTK_INT MoL_RegisterEvolvedRealGroupSlow(CCTK_INT EvolvedGroupIndex, \n CCTK_INT RHSGroupIndexSlow);\n\n\nCCTK_INT MoL_RegisterConstrainedRealGroup(CCTK_INT ConstrainedGroupIndex);\n\nCCTK_INT MoL_RegisterSaveAndRestoreRealGroup(CCTK_INT SandRGroupIndex);\n\n\nCCTK_INT MoL_RegisterEvolvedArray(CCTK_INT EvolvedIndex, CCTK_INT RHSIndex);\n\nCCTK_INT MoL_RegisterConstrainedArray(CCTK_INT ConstrainedIndex);\n\nCCTK_INT MoL_RegisterSaveAndRestoreArray(CCTK_INT SandRIndex);\n\nCCTK_INT MoL_RegisterEvolvedArrayGroup(CCTK_INT EvolvedGroupIndex, \n CCTK_INT RHSGroupIndex);\n\nCCTK_INT MoL_RegisterConstrainedArrayGroup(CCTK_INT ConstrainedGroupIndex);\n\nCCTK_INT MoL_RegisterSaveAndRestoreArrayGroup(CCTK_INT SandRGroupIndex);\n\n\nCCTK_INT MoL_QueryEvolvedRHS(CCTK_INT EvolvedIndex);\n \nCCTK_INT MoL_NumIntegratorSubsteps(void);\n\n/********************************************************************\n ********************* Local Data *****************************\n ********************************************************************/\n\n/********************************************************************\n ********************* External Routines **********************\n ********************************************************************/\n\n /*@@\n @routine MoL_SetScheduleStatus\n @date Mon Jan 31 16:01:51 2005\n @author Ian Hawke\n @desc \n Set the ScheduleStatus flag. This is to ensure that we can catch\n calls to the registration routines that happen too early.\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\n\n\nvoid MoL_SetScheduleStatus(CCTK_ARGUMENTS)\n{\n ScheduleStatus = 1;\n}\n\n\n /*@@\n @routine MoL_RegisterEvolved\n @date Thu May 30 11:36:59 2002\n @author Ian Hawke\n @desc \n Given the index of the GF to be evolved and the RHS GF, it stores \n the indexes for later use together with various error checking.\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nCCTK_INT MoL_RegisterEvolved(CCTK_INT EvolvedIndex, CCTK_INT RHSIndex)\n{\n\n CCTK_INT retval, GroupType;\n \n retval = 0;\n\n if (!ScheduleStatus)\n {\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"MoL registration routine called too early!\\n\"\n \"Trying to register variable '%s',\"\n \"Please ensure that all calls to MoL registration routines \"\n \"occur within the \\\"MoL_Register\\\" timebin.\",\n CCTK_VarName(EvolvedIndex));\n retval++;\n }\n\n GroupType = CCTK_GroupTypeFromVarI(EvolvedIndex);\n if (GroupType < 0)\n {\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"Evolved index %i is not a valid variable index.\",\n (int)EvolvedIndex);\n retval++;\n }\n\n if (!retval)\n {\n switch (CCTK_VarTypeI(EvolvedIndex))\n {\n case CCTK_VARIABLE_REAL:\n {\n switch (GroupType)\n {\n case CCTK_GF:\n {\n retval +=\n MoL_RegisterEvolvedReal(EvolvedIndex, \n RHSIndex);\n break;\n }\n case CCTK_ARRAY:\n case CCTK_SCALAR:\n {\n retval +=\n MoL_RegisterEvolvedArray(EvolvedIndex, \n RHSIndex);\n break;\n }\n default:\n {\n CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"The variable '%s' is not a GF or an array\", \n CCTK_VarName(EvolvedIndex));\n retval++;\n break;\n }\n }\n break;\n }\n default:\n {\n CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"The variable '%s' is not REAL.\", \n CCTK_VarName(EvolvedIndex));\n retval++;\n break;\n }\n } \n }\n \n return retval;\n\n}\n\n\n /*@@\n @routine MoL_RegisterEvolvedSlow\n @date Thu May 30 11:36:59 2002\n @author Ian Hawke\n @desc \n Given the index of the GF to be evolved and the RHS GF, it stores \n the indexes for later use together with various error checking.\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nCCTK_INT MoL_RegisterEvolvedSlow(CCTK_INT EvolvedIndex, CCTK_INT RHSIndexSlow)\n{\n\n CCTK_INT retval, GroupType;\n \n retval = 0;\n\n if (!ScheduleStatus)\n {\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"MoL registration routine called too early!\\n\"\n \"Trying to register variable '%s',\"\n \"Please ensure that all calls to MoL registration routines \"\n \"occur within the \\\"MoL_Register\\\" timebin.\",\n CCTK_VarName(EvolvedIndex));\n retval++;\n }\n\n GroupType = CCTK_GroupTypeFromVarI(EvolvedIndex);\n if (GroupType < 0)\n {\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"Evolved index %i is not a valid variable index.\",\n (int)EvolvedIndex);\n retval++;\n }\n\n if (!retval)\n {\n switch (CCTK_VarTypeI(EvolvedIndex))\n {\n case CCTK_VARIABLE_REAL:\n {\n switch (GroupType)\n {\n case CCTK_GF:\n {\n retval +=\n MoL_RegisterEvolvedRealSlow(EvolvedIndex,\n RHSIndexSlow);\n break;\n }\n case CCTK_ARRAY:\n case CCTK_SCALAR:\n {\n CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"The variable '%s' is not supported for multirate methods\", \n CCTK_VarName(EvolvedIndex));\n retval++;\n break;\n }\n default:\n {\n CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"The variable '%s' is not supported for multirate methods\", \n CCTK_VarName(EvolvedIndex));\n retval++;\n break;\n }\n }\n break;\n }\n default:\n {\n CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"The variable '%s' is not REAL.\", \n CCTK_VarName(EvolvedIndex));\n retval++;\n break;\n }\n } \n }\n \n return retval;\n\n}\n\n\n\n /*@@\n @routine MoL_RegisterConstrained\n @date Thu May 30 12:35:58 2002\n @author Ian Hawke\n @desc \n Given the index of the GF, register it as a constrained variable.\n If there's only one timelevel then ignore it as there will be no\n rotation and so MoL doesn't have to do anything.\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nCCTK_INT MoL_RegisterConstrained(CCTK_INT ConstrainedIndex)\n{\n \n CCTK_INT retval, GroupType;\n \n retval = 0;\n\n if (!ScheduleStatus)\n {\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"MoL registration routine called too early!\\n\"\n \"Trying to register variable '%s',\"\n \"Please ensure that all calls to MoL registration routines \"\n \"occur within the \\\"MoL_Register\\\" timebin.\",\n CCTK_VarName(ConstrainedIndex));\n retval++;\n }\n\n GroupType = CCTK_GroupTypeFromVarI(ConstrainedIndex);\n if (GroupType < 0)\n {\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"Constrained index %i is not a valid variable index.\",\n (int)ConstrainedIndex);\n retval++;\n return retval;\n }\n \n switch (CCTK_VarTypeI(ConstrainedIndex))\n {\n case CCTK_VARIABLE_REAL:\n {\n switch (GroupType)\n {\n case CCTK_GF:\n {\n retval +=\n MoL_RegisterConstrainedReal(ConstrainedIndex);\n break;\n }\n case CCTK_ARRAY:\n case CCTK_SCALAR:\n {\n retval +=\n MoL_RegisterConstrainedArray(ConstrainedIndex);\n break;\n }\n default:\n {\n CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"The variable '%s' is not a GF or an array\", \n CCTK_VarName(ConstrainedIndex));\n retval++;\n break;\n }\n }\n break;\n }\n default:\n {\n CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"The variable '%s' is not REAL.\", \n CCTK_VarName(ConstrainedIndex));\n retval++;\n break;\n }\n } \n \n return retval;\n\n}\n\n /*@@\n @routine MoL_RegisterSaveAndRestore\n @date Thu May 30 12:37:40 2002\n @author Ian Hawke\n @desc \n Given a GF index store it for later use as a save and restore type.\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nCCTK_INT MoL_RegisterSaveAndRestore(CCTK_INT SandRIndex)\n{\n \n CCTK_INT retval, GroupType;\n \n retval = 0;\n\n if (!ScheduleStatus)\n {\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"MoL registration routine called too early!\\n\"\n \"Trying to register variable '%s',\"\n \"Please ensure that all calls to MoL registration routines \"\n \"occur within the \\\"MoL_Register\\\" timebin.\",\n CCTK_VarName(SandRIndex));\n retval++;\n }\n\n GroupType = CCTK_GroupTypeFromVarI(SandRIndex);\n if (GroupType < 0)\n {\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"SaveAndRestore index %i is not a valid variable index.\",\n (int)SandRIndex);\n retval++;\n return retval;\n }\n \n switch (CCTK_VarTypeI(SandRIndex))\n {\n case CCTK_VARIABLE_REAL:\n {\n switch (GroupType)\n {\n case CCTK_GF:\n {\n retval +=\n MoL_RegisterSaveAndRestoreReal(SandRIndex);\n break;\n }\n case CCTK_ARRAY:\n case CCTK_SCALAR:\n {\n retval +=\n MoL_RegisterSaveAndRestoreArray(SandRIndex);\n break;\n }\n default:\n {\n CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"The variable '%s' is not a GF or an array\", \n CCTK_VarName(SandRIndex));\n retval++;\n break;\n }\n }\n break;\n }\n default:\n {\n CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"The variable '%s' is not REAL.\", \n CCTK_VarName(SandRIndex));\n retval++;\n break;\n }\n } \n \n return retval;\n \n}\n\nCCTK_INT MoL_RegisterEvolvedGroup(CCTK_INT EvolvedGroupIndex, \n CCTK_INT RHSGroupIndex)\n{\n\n CCTK_INT retval, GroupFirstVar;\n \n retval = 0;\n\n if (!ScheduleStatus)\n {\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"MoL registration routine called too early!\\n\"\n \"Trying to register group '%s',\"\n \"Please ensure that all calls to MoL registration routines \"\n \"occur within the \\\"MoL_Register\\\" timebin.\",\n CCTK_GroupName(EvolvedGroupIndex));\n retval++;\n }\n\n GroupFirstVar = CCTK_FirstVarIndexI(EvolvedGroupIndex);\n if (GroupFirstVar < 0)\n {\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"Evolved group index %i is not a valid group index.\",\n (int)EvolvedGroupIndex);\n retval++;\n }\n \n switch (CCTK_VarTypeI(CCTK_FirstVarIndexI(EvolvedGroupIndex)))\n {\n case CCTK_VARIABLE_REAL:\n {\n switch (CCTK_GroupTypeI(EvolvedGroupIndex))\n {\n case CCTK_GF:\n {\n retval +=\n MoL_RegisterEvolvedRealGroup(EvolvedGroupIndex, \n RHSGroupIndex);\n break;\n }\n case CCTK_ARRAY:\n case CCTK_SCALAR:\n {\n retval +=\n MoL_RegisterEvolvedArrayGroup(EvolvedGroupIndex, \n RHSGroupIndex);\n break;\n }\n default:\n {\n char *groupname = CCTK_GroupName(EvolvedGroupIndex);\n CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"The group '%s' is not a GF or an array\", \n groupname);\n free(groupname);\n retval++;\n break;\n }\n }\n break;\n }\n default:\n {\n char *groupname = CCTK_GroupName(EvolvedGroupIndex);\n CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"The group '%s' is not REAL.\", \n groupname);\n free(groupname);\n retval++;\n break;\n }\n } \n \n return retval;\n\n}\n\n\nCCTK_INT MoL_RegisterEvolvedGroupSlow(CCTK_INT EvolvedGroupIndex, \n CCTK_INT RHSGroupIndex2)\n{\n\n CCTK_INT retval, GroupFirstVar;\n \n retval = 0;\n\n if (!ScheduleStatus)\n {\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"MoL registration routine called too early!\\n\"\n \"Trying to register group '%s',\"\n \"Please ensure that all calls to MoL registration routines \"\n \"occur within the \\\"MoL_Register\\\" timebin.\",\n CCTK_GroupName(EvolvedGroupIndex));\n retval++;\n }\n\n GroupFirstVar = CCTK_FirstVarIndexI(EvolvedGroupIndex);\n if (GroupFirstVar < 0)\n {\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"Evolved group index %i is not a valid group index.\",\n (int)EvolvedGroupIndex);\n retval++;\n }\n \n switch (CCTK_VarTypeI(CCTK_FirstVarIndexI(EvolvedGroupIndex)))\n {\n case CCTK_VARIABLE_REAL:\n {\n switch (CCTK_GroupTypeI(EvolvedGroupIndex))\n {\n case CCTK_GF:\n {\n retval +=\n MoL_RegisterEvolvedRealGroupSlow(EvolvedGroupIndex, \n RHSGroupIndex2);\n break;\n }\n case CCTK_ARRAY:\n case CCTK_SCALAR:\n {\n char *groupname = CCTK_GroupName(EvolvedGroupIndex);\n CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"The group '%s' is not supported by multirate RK\", \n groupname);\n free(groupname);\n retval++;\n break;\n }\n default:\n {\n char *groupname = CCTK_GroupName(EvolvedGroupIndex);\n CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"The group '%s' is not supported by multirate RK\", \n groupname);\n free(groupname);\n retval++;\n break;\n }\n }\n break;\n }\n default:\n {\n char *groupname = CCTK_GroupName(EvolvedGroupIndex);\n CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"The group '%s' is not REAL.\", \n groupname);\n free(groupname);\n retval++;\n break;\n }\n } \n \n return retval;\n\n}\n\n\n\nCCTK_INT MoL_RegisterConstrainedGroup(CCTK_INT ConstrainedGroupIndex)\n{\n\n CCTK_INT retval, GroupFirstVar;\n \n retval = 0;\n\n if (!ScheduleStatus)\n {\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"MoL registration routine called too early!\\n\"\n \"Trying to register group '%s',\"\n \"Please ensure that all calls to MoL registration routines \"\n \"occur within the \\\"MoL_Register\\\" timebin.\",\n CCTK_VarName(ConstrainedGroupIndex));\n retval++;\n }\n\n GroupFirstVar = CCTK_FirstVarIndexI(ConstrainedGroupIndex);\n if (GroupFirstVar < 0)\n {\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"Constrained group index %i is not a valid group index.\",\n (int)ConstrainedGroupIndex);\n retval++;\n }\n \n switch (CCTK_VarTypeI(CCTK_FirstVarIndexI(ConstrainedGroupIndex)))\n {\n case CCTK_VARIABLE_REAL:\n {\n switch (CCTK_GroupTypeI(ConstrainedGroupIndex))\n {\n case CCTK_GF:\n {\n retval +=\n MoL_RegisterConstrainedRealGroup(ConstrainedGroupIndex);\n break;\n }\n case CCTK_ARRAY:\n case CCTK_SCALAR:\n {\n retval +=\n MoL_RegisterConstrainedArrayGroup(ConstrainedGroupIndex);\n break;\n }\n default:\n {\n char *groupname = CCTK_GroupName(ConstrainedGroupIndex);\n CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"The group '%s' is not a GF or an array\", \n groupname);\n free(groupname);\n retval++;\n break;\n }\n }\n break;\n }\n default:\n {\n char *groupname = CCTK_GroupName(ConstrainedGroupIndex);\n CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"The group '%s' is not REAL.\", \n groupname);\n free(groupname);\n retval++;\n break;\n }\n } \n \n return retval;\n\n}\n\nCCTK_INT MoL_RegisterSaveAndRestoreGroup(CCTK_INT SandRGroupIndex)\n{\n\n CCTK_INT retval, GroupFirstVar;\n \n retval = 0;\n\n if (!ScheduleStatus)\n {\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"MoL registration routine called too early!\\n\"\n \"Trying to register group '%s',\"\n \"Please ensure that all calls to MoL registration routines \"\n \"occur within the \\\"MoL_Register\\\" timebin.\",\n CCTK_VarName(SandRGroupIndex));\n retval++;\n }\n\n GroupFirstVar = CCTK_FirstVarIndexI(SandRGroupIndex);\n if (GroupFirstVar < 0)\n {\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"SaveAndRestore group index %i is not a valid group index.\",\n (int)SandRGroupIndex);\n retval++;\n }\n \n switch (CCTK_VarTypeI(CCTK_FirstVarIndexI(SandRGroupIndex)))\n {\n case CCTK_VARIABLE_REAL:\n {\n switch (CCTK_GroupTypeI(SandRGroupIndex))\n {\n case CCTK_GF:\n {\n retval +=\n MoL_RegisterSaveAndRestoreRealGroup(SandRGroupIndex);\n break;\n }\n case CCTK_ARRAY:\n case CCTK_SCALAR:\n {\n retval +=\n MoL_RegisterSaveAndRestoreArrayGroup(SandRGroupIndex);\n break;\n }\n default:\n {\n char *groupname = CCTK_GroupName(SandRGroupIndex);\n CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"The group '%s' is not a GF or an array\", \n groupname);\n free(groupname);\n retval++;\n break;\n }\n }\n break;\n }\n default:\n {\n char *groupname = CCTK_GroupName(SandRGroupIndex);\n CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"The group '%s' is not REAL.\", \n groupname);\n free(groupname);\n retval++;\n break;\n }\n } \n \n return retval;\n\n}\n\n/*\n Temporary no-op functions for testing.\n*/\n\n /*@@\n @routine MoL_RegisterEvolved\n @date Thu May 30 11:36:59 2002\n @author Ian Hawke\n @desc \n Given the index of the GF to be evolved and the RHS GF, it stores \n the indexes for later use together with various error checking.\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nCCTK_INT MoL_RegisterEvolvedReal(CCTK_INT EvolvedIndex, CCTK_INT RHSIndex)\n{\n\n DECLARE_CCTK_PARAMETERS;\n\n CCTK_INT /* ierr, */ index, varused, numtimelevs1, numtimelevs2;\n \n#ifdef MOLDEBUG\n printf(\"Arrived in MoLRegisterEvolved \\n\");\n printf(\"The indexes are %d and %d.\\n\",EvolvedIndex, RHSIndex);\n printf(\"These correspond to variables %s and %s.\\n\",\n CCTK_VarName(EvolvedIndex),CCTK_VarName(RHSIndex));\n printf(\"The pointer to EvolvedVariableIndex: %p\\n\",\n EvolvedVariableIndex);\n#endif\n\n if (!(CCTK_GroupTypeFromVarI(EvolvedIndex)==CCTK_GF))\n {\n CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"The variable %s is not a GF and so should \"\n \"not be registered with MoLRegisterEvolved.\", \n CCTK_VarName(EvolvedIndex)); \n }\n\n if (!(CCTK_GroupTypeFromVarI(RHSIndex)==CCTK_GF))\n {\n CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"The rhs variable %s is not a GF and so should \"\n \"not be registered with MoLRegisterEvolved.\", \n CCTK_VarName(RHSIndex)); \n } \n\n if (!(CCTK_VarTypeI(EvolvedIndex)==CCTK_VARIABLE_REAL))\n {\n CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"The variable %s is not of type CCTK_REAL and so \"\n \"should not be registered with MoLRegisterEvolved.\", \n CCTK_VarName(EvolvedIndex)); \n }\n\n if (!(CCTK_VarTypeI(RHSIndex)==CCTK_VARIABLE_REAL))\n {\n CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"The rhs variable %s is not of type CCTK_REAL and \"\n \"so should not be registered with MoLRegisterEvolved.\", \n CCTK_VarName(RHSIndex)); \n }\n\n numtimelevs1 = CCTK_DeclaredTimeLevelsVI(EvolvedIndex);\n numtimelevs2 = CCTK_DeclaredTimeLevelsVI(RHSIndex);\n \n if ( (numtimelevs1 < 0) || (numtimelevs2 < 0) ) \n {\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"Warning for variable index %i\", (int)EvolvedIndex); \n CCTK_ERROR(\"The index passed does not correspond to a GF.\");\n }\n\n if (numtimelevs1 < 2)\n {\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"Warning for variable index %i name %s\", \n (int)EvolvedIndex, CCTK_VarName(EvolvedIndex));\n CCTK_ERROR(\"The GF passed only has one timelevel. \"\n \"It must have at least two.\");\n }\n\n varused = 0;\n\n for (index = 0; (index < MoLNumEvolvedVariables)&&(!varused); index++)\n {\n varused = (EvolvedIndex == EvolvedVariableIndex[index]);\n#ifdef MOLDEBUG\n printf(\"Registering %d. Checking index %d which is %d\\n\",EvolvedIndex,\n index,EvolvedVariableIndex[index]);\n#endif\n }\n\n if (varused)\n {\n\n CCTK_VWarn(2,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"The GF %s has already been registered \"\n \"as an evolved variable with RHS GF %s. \"\n \"The attempt to register with RHS GF %s will be ignored\",\n CCTK_VarName(EvolvedIndex),\n CCTK_VarName(RHSVariableIndex[index-1]),\n CCTK_VarName(RHSIndex));\n\n }\n else\n {\n\n if (MoLNumEvolvedVariables+1 > MoLMaxNumRegisteredVariables)\n {\n const char *evolvedvarname = CCTK_VarName(EvolvedIndex);\n char *registeredvars = \n VarListToString(EvolvedVariableIndex, MoLNumEvolvedVariables);\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"You tried to register more than %d evolved variables. Since \"\n \"this should be the total number of Cactus variables, this \"\n \"looks like a bug. You tried to register '%s'. The \"\n \"registered variables are: %s.\",\n (int)MoLMaxNumRegisteredVariables,\n evolvedvarname, registeredvars);\n free(registeredvars); /* NOTREACHED */\n }\n \n EvolvedVariableIndex[MoLNumEvolvedVariables] = EvolvedIndex;\n RHSVariableIndex[MoLNumEvolvedVariables] = RHSIndex;\n \n MoLNumEvolvedVariables++;\n\n#ifdef MOLDEBUG\n printf(\"The max number is now %d. Just added %d (%s).\\n\",\n MoLNumEvolvedVariables, EvolvedIndex,\n CCTK_VarName(EvolvedIndex));\n#endif\n\n }\n\n varused = -1;\n\n for (index = 0; (index < MoLNumConstrainedVariables)&&(!(varused+1)); \n index++)\n {\n if (EvolvedIndex == ConstrainedVariableIndex[index])\n {\n varused = index;\n }\n \n }\n \n if ((varused+1))\n {\n for (index = varused; index < MoLNumConstrainedVariables-1; index++)\n {\n ConstrainedVariableIndex[index] = ConstrainedVariableIndex[index+1];\n }\n MoLNumConstrainedVariables--;\n }\n \n varused = -1;\n\n for (index = 0; (index < MoLNumSandRVariables)&&(!(varused+1)); index++)\n {\n if (EvolvedIndex == SandRVariableIndex[index])\n {\n varused = index;\n }\n \n#ifdef MOLDEBUG\n printf(\"Checking SandR var %d. Index %d (evolvedindex %d).\\n\",\n index, SandRVariableIndex[index], EvolvedIndex); \n#endif\n\n }\n \n if ((varused+1))\n {\n for (index = varused; index < MoLNumSandRVariables-1; index++)\n {\n SandRVariableIndex[index] = SandRVariableIndex[index+1];\n\n#ifdef MOLDEBUG\n printf(\"The registered evolved variable was SandR.\"\n \" Now index %d is %d (%s).\\n\",\n index, SandRVariableIndex[index], \n CCTK_VarName(SandRVariableIndex[index])); \n#endif\n\n }\n MoLNumSandRVariables--;\n }\n \n return 0;\n\n}\n\n\n /*@@\n @routine MoL_RegisterEvolvedSlow\n @date Thu May 30 11:36:59 2002\n @author Ian Hawke\n @desc \n Given the index of the GF to be evolved and the RHS GF, it stores \n the indexes for later use together with various error checking.\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nCCTK_INT MoL_RegisterEvolvedRealSlow(CCTK_INT EvolvedIndex, CCTK_INT RHSIndexSlow)\n{\n\n DECLARE_CCTK_PARAMETERS;\n\n CCTK_INT /* ierr, */ index, varused, numtimelevs1, numtimelevs2;\n \n#ifdef MOLDEBUG\n printf(\"Arrived in MoLRegisterEvolvedSlow \\n\");\n printf(\"The indexes are %d and %d.\\n\",EvolvedIndex, RHSIndexSlow);\n printf(\"These correspond to variables %s and %s.\\n\",\n CCTK_VarName(EvolvedIndex),CCTK_VarName(RHSIndexSlow));\n printf(\"The pointer to EvolvedVariableIndex: %p\\n\",\n EvolvedVariableIndex);\n#endif\n\n if (!(CCTK_GroupTypeFromVarI(EvolvedIndex)==CCTK_GF))\n {\n CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"The variable %s is not a GF and so should \"\n \"not be registered with MoLRegisterEvolved.\", \n CCTK_VarName(EvolvedIndex)); \n }\n\n if (!(CCTK_GroupTypeFromVarI(RHSIndexSlow)==CCTK_GF))\n {\n CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"The rhs variable %s is not a GF and so should \"\n \"not be registered with MoLRegisterEvolved.\", \n CCTK_VarName(RHSIndexSlow)); \n } \n\n if (!(CCTK_VarTypeI(EvolvedIndex)==CCTK_VARIABLE_REAL))\n {\n CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"The variable %s is not of type CCTK_REAL and so \"\n \"should not be registered with MoLRegisterEvolved.\", \n CCTK_VarName(EvolvedIndex)); \n }\n\n if (!(CCTK_VarTypeI(RHSIndexSlow)==CCTK_VARIABLE_REAL))\n {\n CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"The rhs variable %s is not of type CCTK_REAL and \"\n \"so should not be registered with MoLRegisterEvolved.\", \n CCTK_VarName(RHSIndexSlow));\n }\n\n numtimelevs1 = CCTK_DeclaredTimeLevelsVI(EvolvedIndex);\n numtimelevs2 = CCTK_DeclaredTimeLevelsVI(RHSIndexSlow);\n \n if ( (numtimelevs1 < 0) || (numtimelevs2 < 0) ) \n {\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"Warning for variable index %i\", (int)EvolvedIndex); \n CCTK_ERROR(\"The index passed does not correspond to a GF.\");\n }\n\n if (numtimelevs1 < 2)\n {\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"Warning for variable index %i name %s\", \n (int)EvolvedIndex, CCTK_VarName(EvolvedIndex));\n CCTK_ERROR(\"The GF passed only has one timelevel. \"\n \"It must have at least two.\");\n }\n\n varused = 0;\n\n for (index = 0; (index < MoLNumEvolvedVariablesSlow)&&(!varused); index++)\n {\n varused = (EvolvedIndex == EvolvedVariableIndexSlow[index]);\n#ifdef MOLDEBUG\n printf(\"Registering %d. Checking index %d which is %d\\n\",EvolvedIndex,\n index,EvolvedVariableIndexSlow[index]);\n#endif\n }\n\n if (varused)\n {\n\n CCTK_VWarn(2,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"The GF %s has already been registered \"\n \"as an evolved variable with RHS GF %s. \"\n \"The attempt to register with RHS GF %s will be ignored\",\n CCTK_VarName(EvolvedIndex),\n CCTK_VarName(RHSVariableIndexSlow[index-1]),\n CCTK_VarName(RHSIndexSlow));\n\n }\n else\n {\n\n if (MoLNumEvolvedVariablesSlow+1 > MoLMaxNumRegisteredVariables)\n {\n const char *evolvedvarname = CCTK_VarName(EvolvedIndex);\n char *registeredvars = \n VarListToString(EvolvedVariableIndex, MoLNumEvolvedVariablesSlow);\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"You tried to register more than %d slow evolved variables. \"\n \"Since this should be the total number of Cactus variables, \"\n \"this looks like a bug. You tried to register '%s'. The \"\n \"registered variables are: %s.\",\n (int)MoLMaxNumRegisteredVariables,\n evolvedvarname, registeredvars);\n free(registeredvars); /* NOTREACHED */\n }\n\n EvolvedVariableIndexSlow[MoLNumEvolvedVariablesSlow] = EvolvedIndex;\n RHSVariableIndexSlow[MoLNumEvolvedVariablesSlow] = RHSIndexSlow;\n \n MoLNumEvolvedVariablesSlow++;\n\n#ifdef MOLDEBUG\n printf(\"The max number is now %d. Just added %d (%s).\\n\",\n MoLNumEvolvedVariablesSlow, EvolvedIndex,\n CCTK_VarName(EvolvedIndex));\n#endif\n\n }\n\n varused = -1;\n\n for (index = 0; (index < MoLNumConstrainedVariables)&&(!(varused+1)); \n index++)\n {\n if (EvolvedIndex == ConstrainedVariableIndex[index])\n {\n varused = index;\n }\n \n }\n \n if ((varused+1))\n {\n for (index = varused; index < MoLNumConstrainedVariables-1; index++)\n {\n ConstrainedVariableIndex[index] = ConstrainedVariableIndex[index+1];\n }\n MoLNumConstrainedVariables--;\n }\n \n varused = -1;\n\n for (index = 0; (index < MoLNumSandRVariables)&&(!(varused+1)); index++)\n {\n if (EvolvedIndex == SandRVariableIndex[index])\n {\n varused = index;\n }\n \n#ifdef MOLDEBUG\n printf(\"Checking SandR var %d. Index %d (evolvedindex %d).\\n\",\n index, SandRVariableIndex[index], EvolvedIndex); \n#endif\n\n }\n \n if ((varused+1))\n {\n for (index = varused; index < MoLNumSandRVariables-1; index++)\n {\n SandRVariableIndex[index] = SandRVariableIndex[index+1];\n\n#ifdef MOLDEBUG\n printf(\"The registered evolved variable was SandR.\"\n \" Now index %d is %d (%s).\\n\",\n index, SandRVariableIndex[index], \n CCTK_VarName(SandRVariableIndex[index])); \n#endif\n\n }\n MoLNumSandRVariables--;\n }\n \n return 0;\n\n}\n\n\n\n\n /*@@\n @routine MoL_RegisterConstrained\n @date Thu May 30 12:35:58 2002\n @author Ian Hawke\n @desc \n Given the index of the GF, register it as a constrained variable.\n If there's only one timelevel then ignore it as there will be no\n rotation and so MoL doesn't have to do anything.\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nCCTK_INT MoL_RegisterConstrainedReal(CCTK_INT ConstrainedIndex)\n{\n\n DECLARE_CCTK_PARAMETERS;\n \n CCTK_INT numtimelevs, varused, evolved, index;\n\n if (!(CCTK_GroupTypeFromVarI(ConstrainedIndex)==CCTK_GF))\n {\n CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,\"The variable %s is \"\n \"not a GF and so should not be registered with \"\n \"MoLRegisterConstrained.\", \n CCTK_VarName(ConstrainedIndex)); \n }\n\n if (!(CCTK_VarTypeI(ConstrainedIndex)==CCTK_VARIABLE_REAL))\n {\n CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,\"The variable %s is \"\n \"not of type CCTK_REAL and so should not be \"\n \"registered with MoLRegisterConstrained.\", \n CCTK_VarName(ConstrainedIndex)); \n }\n \n numtimelevs = CCTK_DeclaredTimeLevelsVI(ConstrainedIndex);\n\n if (numtimelevs < 1) {\n\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\"Warning for \"\n \"constrained variable index %i\", (int)ConstrainedIndex);\n CCTK_ERROR(\"The index passed does not correspond to a GF.\");\n\n }\n else if (numtimelevs > 1) {\n \n varused = 0;\n \n for (evolved = 0; (evolved < MoLNumEvolvedVariables)&&(!varused); \n evolved++)\n {\n varused = (EvolvedVariableIndex[evolved] == ConstrainedIndex);\n }\n \n for (evolved = 0; (evolved < MoLNumConstrainedVariables)&&(!varused); \n evolved++)\n {\n varused = (ConstrainedVariableIndex[evolved] == ConstrainedIndex);\n }\n \n if (!varused)\n {\n\n if (MoLNumConstrainedVariables+1 > MoLMaxNumRegisteredVariables)\n {\n const char *constrainedvarname = CCTK_VarName(ConstrainedIndex);\n char *registeredvars = \n VarListToString(ConstrainedVariableIndex, MoLNumConstrainedVariables);\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"You tried to register more than %d constrained variables. Since \"\n \"this should be the total number of Cactus variables, this \"\n \"looks like a bug. You tried to register '%s'. The \"\n \"registered variables are: %s.\",\n (int)MoLMaxNumRegisteredVariables, constrainedvarname,\n registeredvars);\n free(registeredvars); /* NOTREACHED */\n }\n\n ConstrainedVariableIndex[MoLNumConstrainedVariables] = ConstrainedIndex;\n MoLNumConstrainedVariables++;\n\n }\n \n varused = -1;\n \n for (evolved = 0; (evolved < MoLNumSandRVariables)&&(!(varused+1)); \n evolved++)\n {\n if (SandRVariableIndex[evolved] == ConstrainedIndex)\n {\n varused = evolved;\n }\n \n }\n \n if ((varused+1))\n {\n for (index = varused; index < MoLNumSandRVariables-1; index++)\n {\n SandRVariableIndex[index] = SandRVariableIndex[index+1];\n }\n MoLNumSandRVariables--;\n }\n \n }\n else\n {\n \n CCTK_VInfo(CCTK_THORNSTRING,\n \"MoL will not treat variable %s as a constrained \"\n \"variable as it has only one timelevel. This should \"\n \"not cause problems with the evolution.\", \n CCTK_VarName(ConstrainedIndex));\n\n }\n \n return 0;\n \n}\n\n /*@@\n @routine MoL_RegisterSaveAndRestore\n @date Thu May 30 12:37:40 2002\n @author Ian Hawke\n @desc \n Given a GF index store it for later use as a save and restore type.\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nCCTK_INT MoL_RegisterSaveAndRestoreReal(CCTK_INT SandRIndex)\n{\n\n DECLARE_CCTK_PARAMETERS;\n\n CCTK_INT numtimelevs, varused, evolved;\n\n if (!(CCTK_GroupTypeFromVarI(SandRIndex)==CCTK_GF))\n {\n CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,\"The variable %s is not \"\n \"a GF and so should not be registered with \"\n \"MoLRegisterSaveAndRestore.\", \n CCTK_VarName(SandRIndex)); \n }\n\n if (!(CCTK_VarTypeI(SandRIndex)==CCTK_VARIABLE_REAL))\n {\n CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,\"The variable %s is \"\n \"not of type CCTK_REAL and so should not be \"\n \"registered with MoLRegisterSaveAndRestore.\", \n CCTK_VarName(SandRIndex)); \n }\n \n numtimelevs = CCTK_DeclaredTimeLevelsVI(SandRIndex);\n\n if (numtimelevs < 1) {\n\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\"Warning for save \"\n \"and restore variable index %i\", (int)SandRIndex);\n CCTK_ERROR(\"The index passed does not correspond to a GF.\");\n\n }\n else if (numtimelevs > 1) {\n \n varused = 0;\n \n for (evolved = 0; (evolved < MoLNumEvolvedVariables)&&(!varused); \n evolved++)\n {\n varused = (EvolvedVariableIndex[evolved] == SandRIndex);\n }\n \n for (evolved = 0; (evolved < MoLNumConstrainedVariables)&&(!varused); \n evolved++)\n {\n varused = (ConstrainedVariableIndex[evolved] == SandRIndex);\n }\n \n for (evolved = 0; (evolved < MoLNumSandRVariables)&&(!varused); evolved++)\n {\n varused = (SandRVariableIndex[evolved] == SandRIndex);\n }\n\n if (!varused)\n {\n\n if (MoLNumSandRVariables+1 > MoLMaxNumRegisteredVariables)\n {\n const char *saveandrestorevarname = CCTK_VarName(SandRIndex);\n char *registeredvars = \n VarListToString(SandRVariableIndex, MoLNumSandRVariables);\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"You tried to register more than %d safe and restore variables. Since \"\n \"this should be the total number of Cactus variables, this \"\n \"looks like a bug. You tried to register '%s'. The \"\n \"registered variables are: %s.\",\n (int)MoLMaxNumRegisteredVariables, saveandrestorevarname,\n registeredvars);\n free(registeredvars); /* NOTREACHED */\n }\n\n SandRVariableIndex[MoLNumSandRVariables] = SandRIndex;\n MoLNumSandRVariables++;\n\n }\n \n }\n else\n {\n \n CCTK_VInfo(CCTK_THORNSTRING,\n \"MoL will not treat variable %s as a save and \"\n \"restore variable as it has only one timelevel. \"\n \"This should not cause problems with the evolution.\", \n CCTK_VarName(SandRIndex));\n\n }\n \n return 0;\n \n}\n\nCCTK_INT MoL_RegisterEvolvedRealGroup(CCTK_INT EvolvedGroupIndex, \n CCTK_INT RHSGroupIndex)\n{\n\n CCTK_INT EvolvedGroupFirstVar, RHSGroupFirstVar, GroupNumVars, retval;\n CCTK_INT EvolvedVar, RHSVar;\n \n EvolvedGroupFirstVar = CCTK_FirstVarIndexI(EvolvedGroupIndex);\n if (EvolvedGroupFirstVar < 0)\n {\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"Evolved group index %i is not a valid group index.\",\n (int)EvolvedGroupIndex);\n }\n \n RHSGroupFirstVar = CCTK_FirstVarIndexI(RHSGroupIndex);\n if (RHSGroupFirstVar < 0)\n {\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"RHS group index %d is not a valid group index.\",\n (int)RHSGroupIndex);\n }\n\n GroupNumVars = CCTK_NumVarsInGroupI(EvolvedGroupIndex);\n if (CCTK_NumVarsInGroupI(RHSGroupIndex) != GroupNumVars)\n {\n char *groupname = CCTK_GroupName(EvolvedGroupIndex);\n char *rhsgroupname = CCTK_GroupName(RHSGroupIndex);\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"There are a different number of variables in \"\n \"evolved group %d ('%s') and RHS group %d ('%s').\", \n (int)EvolvedGroupIndex, groupname, (int)RHSGroupIndex,\n rhsgroupname);\n free(rhsgroupname);\n free(groupname);\n }\n \n retval = 0;\n \n for (EvolvedVar = EvolvedGroupFirstVar, RHSVar = RHSGroupFirstVar;\n EvolvedVar < EvolvedGroupFirstVar + GroupNumVars;\n EvolvedVar++, RHSVar++)\n {\n retval += MoL_RegisterEvolvedReal(EvolvedVar, RHSVar);\n }\n \n return retval;\n}\n\n\nCCTK_INT MoL_RegisterEvolvedRealGroupSlow(CCTK_INT EvolvedGroupIndex, \n CCTK_INT RHSGroupIndexSlow)\n{\n\n CCTK_INT EvolvedGroupFirstVar, RHSGroupFirstVar, GroupNumVars, retval;\n CCTK_INT EvolvedVar, RHSVar;\n \n EvolvedGroupFirstVar = CCTK_FirstVarIndexI(EvolvedGroupIndex);\n if (EvolvedGroupFirstVar < 0)\n {\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"Evolved group index %i is not a valid group index.\",\n (int)EvolvedGroupIndex);\n }\n \n RHSGroupFirstVar = CCTK_FirstVarIndexI(RHSGroupIndexSlow);\n if (RHSGroupFirstVar < 0)\n {\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"RHS group index %d is not a valid group index.\",\n (int)RHSGroupIndexSlow);\n }\n\n GroupNumVars = CCTK_NumVarsInGroupI(EvolvedGroupIndex);\n if (CCTK_NumVarsInGroupI(RHSGroupIndexSlow) != GroupNumVars)\n {\n char *groupname = CCTK_GroupName(EvolvedGroupIndex);\n char * rhsgroupname = CCTK_GroupName(RHSGroupIndexSlow);\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"There are a different number of variables in \"\n \"evolved group %d ('%s') and RHS group %d ('%s').\", \n (int)EvolvedGroupIndex,\n groupname, (int)RHSGroupIndexSlow, rhsgroupname);\n free(rhsgroupname);\n free(groupname);\n }\n \n retval = 0;\n \n for (EvolvedVar = EvolvedGroupFirstVar, RHSVar = RHSGroupFirstVar;\n EvolvedVar < EvolvedGroupFirstVar + GroupNumVars;\n EvolvedVar++, RHSVar++)\n {\n retval += MoL_RegisterEvolvedRealSlow(EvolvedVar, RHSVar);\n }\n \n return retval;\n}\n\n\nCCTK_INT MoL_RegisterConstrainedRealGroup(CCTK_INT ConstrainedGroupIndex)\n{\n \n CCTK_INT ConstrainedGroupFirstVar, GroupNumVars, retval;\n CCTK_INT ConstrainedVar;\n \n ConstrainedGroupFirstVar = CCTK_FirstVarIndexI(ConstrainedGroupIndex);\n if (ConstrainedGroupFirstVar < 0)\n {\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"Constrained group index %i is not a valid group index.\",\n (int)ConstrainedGroupIndex);\n }\n \n GroupNumVars = CCTK_NumVarsInGroupI(ConstrainedGroupIndex);\n \n retval = 0;\n \n for (ConstrainedVar = ConstrainedGroupFirstVar;\n ConstrainedVar < ConstrainedGroupFirstVar + GroupNumVars;\n ConstrainedVar++)\n {\n retval += MoL_RegisterConstrainedReal(ConstrainedVar);\n }\n \n return retval;\n}\n\nCCTK_INT MoL_RegisterSaveAndRestoreRealGroup(CCTK_INT SandRGroupIndex)\n{\n \n CCTK_INT SandRGroupFirstVar, GroupNumVars, retval;\n CCTK_INT SandRVar;\n \n SandRGroupFirstVar = CCTK_FirstVarIndexI(SandRGroupIndex);\n if (SandRGroupFirstVar < 0)\n {\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"Save and Restore group index %i is not a valid group index.\",\n (int)SandRGroupIndex);\n }\n \n GroupNumVars = CCTK_NumVarsInGroupI(SandRGroupIndex);\n \n retval = 0;\n \n for (SandRVar = SandRGroupFirstVar;\n SandRVar < SandRGroupFirstVar + GroupNumVars;\n SandRVar++)\n {\n retval += MoL_RegisterSaveAndRestoreReal(SandRVar);\n }\n \n return retval;\n}\n\nCCTK_INT MoL_RegisterEvolvedArray(CCTK_INT EvolvedIndex, CCTK_INT RHSIndex)\n{\n\n DECLARE_CCTK_PARAMETERS;\n\n CCTK_INT /* ierr, */ index, varused, numtimelevs1, numtimelevs2;\n \n#ifdef MOLDEBUG\n printf(\"Arrived in MoLRegisterEvolvedArray \\n\");\n printf(\"The indexes are %d and %d.\\n\",EvolvedIndex, RHSIndex);\n printf(\"These correspond to variables %s and %s.\\n\",\n CCTK_VarName(EvolvedIndex),CCTK_VarName(RHSIndex));\n printf(\"The pointer to EvolvedVariableIndex: %p\\n\",\n EvolvedArrayVariableIndex);\n#endif\n\n if (!(CCTK_GroupTypeFromVarI(EvolvedIndex)==CCTK_ARRAY ||\n CCTK_GroupTypeFromVarI(EvolvedIndex)==CCTK_SCALAR))\n {\n CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"The variable %s is not an array and so should \"\n \"not be registered with MoLRegisterEvolved.\", \n CCTK_VarName(EvolvedIndex)); \n }\n\n if (!(CCTK_GroupTypeFromVarI(RHSIndex)==CCTK_ARRAY ||\n CCTK_GroupTypeFromVarI(RHSIndex)==CCTK_SCALAR))\n {\n CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"The rhs variable %s is not an array and so \"\n \"should not be registered with MoLRegisterEvolved.\", \n CCTK_VarName(RHSIndex)); \n } \n\n if (!(CCTK_VarTypeI(EvolvedIndex)==CCTK_VARIABLE_REAL))\n {\n CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"The variable %s is not of type CCTK_REAL \"\n \"and so should not be registered with \"\n \"MoLRegisterEvolvedArray.\", \n CCTK_VarName(EvolvedIndex)); \n }\n\n if (!(CCTK_VarTypeI(RHSIndex)==CCTK_VARIABLE_REAL))\n {\n CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"The rhs variable %s is not of type CCTK_REAL \"\n \"and so should not be registered with \"\n \"MoLRegisterEvolvedArray.\", \n CCTK_VarName(RHSIndex)); \n }\n\n numtimelevs1 = CCTK_DeclaredTimeLevelsVI(EvolvedIndex);\n numtimelevs2 = CCTK_DeclaredTimeLevelsVI(RHSIndex);\n \n if ( (numtimelevs1 < 0) || (numtimelevs2 < 0) ) \n {\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"Warning for variable index %i name %s\", \n (int)EvolvedIndex, CCTK_VarName(EvolvedIndex)); \n CCTK_ERROR(\"The index passed does not correspond to an array.\");\n }\n\n if (numtimelevs1 < 2)\n {\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"Warning for variable index %i name %s\", \n (int)EvolvedIndex, CCTK_VarName(EvolvedIndex));\n CCTK_ERROR(\"The array passed only has one timelevel. \"\n \"It must have at least two.\");\n }\n\n varused = 0;\n\n for (index = 0; (index < MoLNumEvolvedArrayVariables)&&(!varused); index++)\n {\n varused = (EvolvedIndex == EvolvedArrayVariableIndex[index]);\n#ifdef MOLDEBUG\n printf(\"Registering %d. Checking index %d which is %d\\n\",EvolvedIndex,\n index,EvolvedArrayVariableIndex[index]);\n#endif\n }\n\n if (varused)\n {\n\n CCTK_VWarn(2,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"The array %s has already been registered \"\n \"as an array evolved variable with RHS array %s. \"\n \"The attempt to register with RHS array %s will be ignored\",\n CCTK_VarName(EvolvedIndex),\n CCTK_VarName(RHSArrayVariableIndex[index-1]),\n CCTK_VarName(RHSIndex));\n\n }\n else\n {\n \n if (MoLNumEvolvedArrayVariables+1 > MoLMaxNumRegisteredVariables)\n {\n const char *evolvedvarname = CCTK_VarName(EvolvedIndex);\n char *registeredvars = \n VarListToString(EvolvedArrayVariableIndex, MoLNumEvolvedArrayVariables);\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"You tried to register more than %d evolved array variables. \"\n \"Since this should be the total number of Cactus variables, \"\n \"this looks like a bug. You tried to register '%s'. The \"\n \"registered variables are: %s.\",\n (int)MoLMaxNumRegisteredVariables,\n evolvedvarname, registeredvars);\n free(registeredvars); /* NOTREACHED */\n }\n\n EvolvedArrayVariableIndex[MoLNumEvolvedArrayVariables] = EvolvedIndex;\n RHSArrayVariableIndex[MoLNumEvolvedArrayVariables] = RHSIndex;\n \n MoLNumEvolvedArrayVariables++;\n \n }\n\n varused = 0;\n\n for (index = 0; (index <\n MoLNumConstrainedArrayVariables)&&(!varused);\n index++) \n {\n varused = (EvolvedIndex == ConstrainedArrayVariableIndex[index]);\n }\n \n if (varused)\n {\n for (index = varused; index < MoLNumConstrainedArrayVariables-1; index++)\n {\n ConstrainedArrayVariableIndex[index] =\n ConstrainedArrayVariableIndex[index+1]; \n }\n MoLNumConstrainedArrayVariables--;\n }\n \n varused = 0;\n\n for (index = 0; (index < MoLNumSandRArrayVariables)&&(!varused); index++)\n {\n varused = (EvolvedIndex == SandRArrayVariableIndex[index]);\n }\n \n if (varused)\n {\n for (index = varused; index < MoLNumSandRArrayVariables-1; index++)\n {\n SandRArrayVariableIndex[index] = SandRArrayVariableIndex[index+1];\n }\n MoLNumSandRArrayVariables--;\n }\n\n return 0;\n\n}\n\nCCTK_INT MoL_RegisterConstrainedArray(CCTK_INT ConstrainedIndex)\n{\n\n DECLARE_CCTK_PARAMETERS;\n \n CCTK_INT numtimelevs, varused, evolved, index;\n \n if (!(CCTK_GroupTypeFromVarI(ConstrainedIndex)==CCTK_ARRAY ||\n CCTK_GroupTypeFromVarI(ConstrainedIndex)==CCTK_SCALAR))\n {\n CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"The variable %s is not an array and so \"\n \"should not be registered with MoLRegisterConstrained.\", \n CCTK_VarName(ConstrainedIndex)); \n }\n\n if (!(CCTK_VarTypeI(ConstrainedIndex)==CCTK_VARIABLE_REAL))\n {\n CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"The variable %s is not of type CCTK_REAL \"\n \"and so should not be registered with \"\n \"MoLRegisterConstrainedArray.\", \n CCTK_VarName(ConstrainedIndex)); \n }\n\n numtimelevs = CCTK_DeclaredTimeLevelsVI(ConstrainedIndex);\n\n if (numtimelevs < 1) {\n\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"Warning for constrained array variable index %i name %s\", \n (int)ConstrainedIndex, CCTK_VarName(ConstrainedIndex));\n CCTK_ERROR(\"The index passed does not correspond to an array.\");\n\n }\n else if (numtimelevs > 1) {\n \n varused = 0;\n \n for (evolved = 0; (evolved < MoLNumEvolvedArrayVariables)\n &&(!varused); evolved++)\n {\n varused = (EvolvedArrayVariableIndex[evolved] == ConstrainedIndex);\n }\n \n for (evolved = 0; (evolved <\n MoLNumConstrainedArrayVariables)&&(!varused);\n evolved++) \n {\n varused = (ConstrainedArrayVariableIndex[evolved] == ConstrainedIndex);\n }\n \n if (!varused)\n {\n\n if (MoLNumConstrainedArrayVariables+1 > MoLMaxNumRegisteredVariables)\n {\n const char *constrainedvarname = CCTK_VarName(ConstrainedIndex);\n char *registeredvars = \n VarListToString(ConstrainedArrayVariableIndex, MoLNumConstrainedArrayVariables);\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"You tried to register more than %d constrained array \"\n \"variables. Since \" \"this should be the total number of \"\n \"Cactus variables, this looks like a bug. You tried to \"\n \"register '%s'. The \" \"registered variables are: %s.\",\n (int)MoLMaxNumRegisteredVariables, constrainedvarname,\n registeredvars);\n free(registeredvars); /* NOTREACHED */\n }\n\n ConstrainedArrayVariableIndex[MoLNumConstrainedArrayVariables] = \n ConstrainedIndex;\n MoLNumConstrainedArrayVariables++;\n\n }\n \n varused = 0;\n \n for (evolved = 0; (evolved <\n MoLNumSandRArrayVariables)&&(!varused);\n evolved++) \n {\n varused = (SandRArrayVariableIndex[evolved] == ConstrainedIndex);\n }\n \n if (varused)\n {\n for (index = evolved; index < MoLNumSandRArrayVariables-1; index++)\n {\n SandRArrayVariableIndex[index] = SandRArrayVariableIndex[index+1];\n }\n MoLNumSandRArrayVariables--;\n }\n \n }\n else\n {\n \n CCTK_VInfo(CCTK_THORNSTRING,\n \"MoL will not treat variable %s as a constrained \"\n \"array variable as it has only one timelevel. \"\n \"This should not cause problems with the evolution.\", \n CCTK_VarName(ConstrainedIndex));\n\n } \n\n return 0;\n\n}\n\nCCTK_INT MoL_RegisterSaveAndRestoreArray(CCTK_INT SandRIndex)\n{\n\n DECLARE_CCTK_PARAMETERS;\n\n CCTK_INT numtimelevs, varused, evolved;\n \n if (!(CCTK_GroupTypeFromVarI(SandRIndex)==CCTK_ARRAY ||\n CCTK_GroupTypeFromVarI(SandRIndex)==CCTK_SCALAR))\n {\n CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"The variable %s is not an array and so should not \"\n \"be registered with MoLRegisterSaveAndRestore.\", \n CCTK_VarName(SandRIndex)); \n }\n\n if (!(CCTK_VarTypeI(SandRIndex)==CCTK_VARIABLE_REAL))\n {\n CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"The variable %s is not of type CCTK_REAL and \"\n \"so should not be registered with \"\n \"MoLRegisterSaveAndRestoreArray.\", \n CCTK_VarName(SandRIndex)); \n }\n\n numtimelevs = CCTK_DeclaredTimeLevelsVI(SandRIndex);\n\n if (numtimelevs < 1) {\n\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"Warning for save and restore array variable index %i\", \n (int)SandRIndex);\n CCTK_ERROR(\"The index passed does not correspond to a GF.\");\n\n }\n else if (numtimelevs > 1) {\n \n varused = 0;\n \n for (evolved = 0; (evolved < MoLNumEvolvedArrayVariables)\n &&(!varused); evolved++)\n {\n varused = (EvolvedArrayVariableIndex[evolved] == SandRIndex);\n }\n \n for (evolved = 0; (evolved <\n MoLNumConstrainedArrayVariables)&&(!varused);\n evolved++) \n {\n varused = (ConstrainedArrayVariableIndex[evolved] == SandRIndex);\n }\n \n for (evolved = 0; (evolved <\n MoLNumSandRArrayVariables)&&(!varused);\n evolved++) \n {\n varused = (SandRArrayVariableIndex[evolved] == SandRIndex);\n }\n\n if (!varused)\n {\n\n if (MoLNumSandRArrayVariables+1 > MoLMaxNumRegisteredVariables)\n {\n const char *saveandrestorevarname = CCTK_VarName(SandRIndex);\n char *registeredvars = \n VarListToString(SandRVariableIndex, MoLNumSandRArrayVariables);\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"You tried to register more than %d save and restore array \"\n \"variables. Since this should be the total number of \"\n \"Cactus variables, this looks like a bug. You tried to \"\n \"register '%s'. The registered variables are: %s.\",\n (int)MoLMaxNumRegisteredVariables, saveandrestorevarname,\n registeredvars);\n free(registeredvars); /* NOTREACHED */\n }\n\n SandRArrayVariableIndex[MoLNumSandRArrayVariables] = SandRIndex;\n MoLNumSandRArrayVariables++;\n\n }\n \n }\n else\n {\n \n CCTK_VInfo(CCTK_THORNSTRING,\n \"MoL will not treat variable %s as a save \"\n \"and restore array variable as it has only one \"\n \"timelevel. This should not cause problems \"\n \"with the evolution.\", \n CCTK_VarName(SandRIndex));\n\n } \n\n return 0;\n\n}\n\nCCTK_INT MoL_RegisterEvolvedArrayGroup(CCTK_INT EvolvedGroupIndex, \n CCTK_INT RHSGroupIndex)\n{\n\n CCTK_INT EvolvedGroupFirstVar, RHSGroupFirstVar, GroupNumVars, retval;\n CCTK_INT EvolvedVar, RHSVar;\n \n EvolvedGroupFirstVar = CCTK_FirstVarIndexI(EvolvedGroupIndex);\n if (EvolvedGroupFirstVar < 0)\n {\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"Evolved array group index %i is not a valid group index.\",\n (int)EvolvedGroupIndex);\n }\n \n RHSGroupFirstVar = CCTK_FirstVarIndexI(RHSGroupIndex);\n if (RHSGroupFirstVar < 0)\n {\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"RHS array group index %d is not a valid group index.\",\n (int)RHSGroupIndex);\n }\n\n GroupNumVars = CCTK_NumVarsInGroupI(EvolvedGroupIndex);\n if (CCTK_NumVarsInGroupI(RHSGroupIndex) != GroupNumVars)\n {\n char *groupname = CCTK_GroupName(EvolvedGroupIndex);\n char *rhsgroupname = CCTK_GroupName(RHSGroupIndex);\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"There are a different number of variables in \"\n \"evolved array group %d ('%s') and RHS group %d ('%s').\", \n (int)EvolvedGroupIndex, groupname, (int)RHSGroupIndex,\n rhsgroupname);\n free(rhsgroupname);\n free(groupname);\n }\n \n retval = 0;\n \n for (EvolvedVar = EvolvedGroupFirstVar, RHSVar = RHSGroupFirstVar;\n EvolvedVar < EvolvedGroupFirstVar + GroupNumVars;\n EvolvedVar++, RHSVar++)\n {\n retval += MoL_RegisterEvolvedArray(EvolvedVar, RHSVar);\n }\n\n return retval;\n\n}\n\nCCTK_INT MoL_RegisterConstrainedArrayGroup(CCTK_INT ConstrainedGroupIndex)\n{\n \n CCTK_INT ConstrainedGroupFirstVar, GroupNumVars, retval;\n CCTK_INT ConstrainedVar;\n \n ConstrainedGroupFirstVar = CCTK_FirstVarIndexI(ConstrainedGroupIndex);\n if (ConstrainedGroupFirstVar < 0)\n {\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"Constrained array group index %i is not a valid group index.\",\n (int)ConstrainedGroupIndex);\n }\n \n GroupNumVars = CCTK_NumVarsInGroupI(ConstrainedGroupIndex);\n \n retval = 0;\n \n for (ConstrainedVar = ConstrainedGroupFirstVar;\n ConstrainedVar < ConstrainedGroupFirstVar + GroupNumVars;\n ConstrainedVar++)\n {\n retval += MoL_RegisterConstrainedArray(ConstrainedVar);\n }\n \n return retval;\n\n}\n\nCCTK_INT MoL_RegisterSaveAndRestoreArrayGroup(CCTK_INT SandRGroupIndex)\n{\n \n CCTK_INT SandRGroupFirstVar, GroupNumVars, retval;\n CCTK_INT SandRVar;\n \n SandRGroupFirstVar = CCTK_FirstVarIndexI(SandRGroupIndex);\n if (SandRGroupFirstVar < 0)\n {\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"Save and Restore array group index %i is \"\n \"not a valid group index.\",\n (int)SandRGroupIndex);\n }\n \n GroupNumVars = CCTK_NumVarsInGroupI(SandRGroupIndex);\n \n retval = 0;\n \n for (SandRVar = SandRGroupFirstVar;\n SandRVar < SandRGroupFirstVar + GroupNumVars;\n SandRVar++)\n {\n retval += MoL_RegisterSaveAndRestoreArray(SandRVar);\n }\n \n return retval;\n\n}\n\n /*@@\n @routine MoL_QueryEvolvedRHS\n @date Thu Dec 25 2004\n @author Erik Schnetter\n @desc \n Given the index of a registered evolved GF,\n returns the corresponding RHS GF.\n Checks both regular and slow evolved variables.\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nCCTK_INT MoL_QueryEvolvedRHS(CCTK_INT EvolvedIndex)\n{\n CCTK_INT index;\n \n if (EvolvedIndex < 0)\n {\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"Evolved variables index %i is not a valid variable index.\",\n (int)EvolvedIndex);\n }\n \n for (index = 0; index < MoLNumEvolvedVariables; index++)\n {\n if (EvolvedVariableIndex[index] == EvolvedIndex)\n {\n return RHSVariableIndex[index];\n }\n }\n \n // If we haven't found any registered variable that matches,\n // we also try to check whether this has been registered with the slow multirate sector!\n \n for (index = 0; index < MoLNumEvolvedVariablesSlow; index++)\n {\n if (EvolvedVariableIndexSlow[index] == EvolvedIndex)\n {\n return RHSVariableIndexSlow[index];\n }\n }\n \n return -1;\n\n}\n\n\n\n /*@@\n @routine MoL_NumIntegratorSubsteps\n @date 2007-05-23\n @author Erik Schnetter\n @desc \n Return how many time integrator substeps there are.\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nCCTK_INT MoL_NumIntegratorSubsteps (void)\n{\n DECLARE_CCTK_PARAMETERS;\n\n return MoL_Intermediate_Steps;\n}\n\n\n\n/*\n Old function names. Just calls the new version. \n Included for compatibility\n Now removed.\n*/\n\n/*\nCCTK_INT MoL_RegisterVar(CCTK_INT molvarindex,CCTK_INT molrhsvarindex)\n{\n return MoL_RegisterEvolved(molvarindex, molrhsvarindex);\n}\n\nCCTK_INT MoL_RegisterPrimitive(CCTK_INT primitiveindex)\n{\n return MoL_RegisterConstrained(primitiveindex);\n}\n\nCCTK_INT MoL_RegisterDepends(CCTK_INT dependsindex)\n{\n return MoL_RegisterSaveAndRestore(dependsindex);\n}\n\nCCTK_INT MoL_RegisterVarGroup(CCTK_INT groupindex,CCTK_INT rhsgroupindex)\n{\n return MoL_RegisterEvolvedGroup(groupindex, rhsgroupindex);\n}\n\nCCTK_INT MoL_RegisterPrimitiveGroup(CCTK_INT groupindex)\n{\n return MoL_RegisterConstrainedGroup(groupindex);\n}\n\nCCTK_INT MoL_RegisterDependsGroup(CCTK_INT groupindex)\n{\n return MoL_RegisterConstrainedGroup(groupindex);\n}\n\nCCTK_INT MoL_ChangeVarToEvolved(CCTK_INT varindex, CCTK_INT rhsindex)\n{\n return MoL_ChangeToEvolved(varindex, rhsindex);\n}\n\nCCTK_INT MoL_ChangeVarToDependent(CCTK_INT dependsindex)\n{\n return MoL_ChangeToSaveAndRestore(dependsindex);\n}\n\nCCTK_INT MoL_ChangeVarToPrimitive(CCTK_INT primitiveindex)\n{\n return MoL_ChangeToConstrained(primitiveindex);\n}\n\nCCTK_INT MoL_ChangeVarToNone(CCTK_INT removeindex)\n{\n return MoL_ChangeToNone(removeindex);\n}\n*/\n\n/* \n Fortran wrappers for the above functions. \n Should be replaced by using function aliasing eventually.\n Now removed.\n*/\n\n/*\nvoid CCTK_FCALL CCTK_FNAME(MoL_RegisterEvolved)(int *ierr, \n CCTK_INT *EvolvedIndex,\n CCTK_INT *RHSIndex)\n{\n *ierr = MoL_RegisterEvolved(*EvolvedIndex, *RHSIndex);\n return;\n}\n\nvoid CCTK_FCALL CCTK_FNAME(MoL_RegisterConstrained)(int *ierr, \n CCTK_INT *EvolvedIndex)\n{\n *ierr = MoL_RegisterConstrained(*EvolvedIndex);\n return;\n}\n\nvoid CCTK_FCALL CCTK_FNAME(MoL_RegisterSaveAndRestore)(int *ierr, \n CCTK_INT *EvolvedIndex)\n{\n *ierr = MoL_RegisterSaveAndRestore(*EvolvedIndex);\n return;\n}\n*/\n\n/* And for MoL compatibility... */\n/* Now removed */\n\n/*\nvoid CCTK_FCALL CCTK_FNAME(MoL_RegisterVar)(int *ierr, \n CCTK_INT *molvarindex,\n CCTK_INT *molrhsvarindex)\n{\n *ierr = MoL_RegisterVar(*molvarindex, *molrhsvarindex);\n return;\n}\n\nvoid CCTK_FCALL CCTK_FNAME(MoL_RegisterDepends)(int *ierr, \n CCTK_INT *moldependsindex)\n{\n *ierr = MoL_RegisterDepends(*moldependsindex);\n return;\n}\n\nvoid CCTK_FCALL CCTK_FNAME(MoL_RegisterPrimitive)(int *ierr, \n CCTK_INT *molprimitiveindex)\n{\n *ierr = MoL_RegisterPrimitive(*molprimitiveindex);\n return;\n}\n\nvoid CCTK_FCALL CCTK_FNAME(MoL_RegisterVarGroup)(int *ierr, \n CCTK_INT *groupindex,\n CCTK_INT *rhsgroupindex)\n{\n *ierr = MoL_RegisterVarGroup(*groupindex, *rhsgroupindex);\n return;\n}\n\nvoid CCTK_FCALL CCTK_FNAME(MoL_RegisterPrimitiveGroup)(int *ierr, \n CCTK_INT *groupindex)\n{\n *ierr = MoL_RegisterPrimitiveGroup(*groupindex);\n return;\n}\n\nvoid CCTK_FCALL CCTK_FNAME(MoL_RegisterDependsGroup)(int *ierr, \n CCTK_INT *groupindex)\n{\n *ierr = MoL_RegisterDependsGroup(*groupindex);\n return;\n}\n\nvoid CCTK_FCALL CCTK_FNAME(MoL_ChangeVarToEvolved)(int *ierr, \n CCTK_INT *varindex,\n CCTK_INT *rhsindex)\n{\n *ierr = MoL_ChangeVarToEvolved(*varindex, *rhsindex);\n return;\n}\n\nvoid CCTK_FCALL CCTK_FNAME(MoL_ChangeVarToDependent)(int *ierr, \n CCTK_INT *dependsindex)\n{\n *ierr = MoL_ChangeVarToDependent(*dependsindex);\n return;\n}\n\nvoid CCTK_FCALL CCTK_FNAME(MoL_ChangeVarToPrimitive)(int *ierr, \n CCTK_INT *primitiveindex)\n{\n *ierr = MoL_ChangeVarToPrimitive(*primitiveindex);\n return;\n}\n\nvoid CCTK_FCALL CCTK_FNAME(MoL_ChangeVarToNone)(int *ierr, \n CCTK_INT *removeindex)\n{\n *ierr = MoL_ChangeVarToNone(*removeindex);\n return;\n}\n*/\n\n/********************************************************************\n ********************* Local Routines *************************\n ********************************************************************/\n\nstatic char *VarListToString(const CCTK_INT varindices[], const int nvars)\n{\n size_t off = 0, len = 1;\n char *vars = NULL;\n /* count how much room we need for the full output string */\n for(int index = 0 ; index < nvars ; index++)\n {\n char *varname = CCTK_FullName(varindices[index]);\n len += strlen(varname) + 1; /* ' ' or '\\0' as separator */\n free(varname);\n }\n vars = malloc(len);\n assert(vars != NULL);\n /* construct list in buffer */\n for(int index = 0 ; index < nvars ; index++)\n {\n char *varname = CCTK_FullName(varindices[index]);\n const size_t written =\n snprintf(vars+off, len-off, \"%s%s\", off>0?\" \":\"\", varname);\n assert(written < len-off);\n off = strlen(vars);\n free(varname);\n }\n vars[off] = '\\0'; /* close string in case we had no variables at all */\n return vars;\n}\n", |
| "SetTime.c": " /*@@\n @file SetTime.c\n @date Mon May 20 09:45:45 2002\n @author Ian Hawke\n @desc \n Sets the time and dt depending on the ODE method and \n position in the loop.\n @enddesc \n @version $Header$\n @@*/\n\n#include <stdlib.h>\n\n#include \"cctk.h\"\n#include \"cctk_Arguments.h\"\n#include \"cctk_Parameters.h\"\n\nstatic const char *rcsid = \"$Header$\";\n\nCCTK_FILEVERSION(CactusBase_MoL_SetTime_c);\n\n/* #define MOLDEBUG 1 */\n\n/********************************************************************\n ********************* Local Data Types ***********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Local Routine Prototypes *********************\n ********************************************************************/\n\n/********************************************************************\n ***************** Scheduled Routine Prototypes *********************\n ********************************************************************/\n\nvoid MoL_SetTime(CCTK_ARGUMENTS);\n\nvoid MoL_ResetTime(CCTK_ARGUMENTS);\n\nvoid MoL_ResetDeltaTime(CCTK_ARGUMENTS);\n\n/********************************************************************\n ********************* Other Routine Prototypes *********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Local Data *****************************\n ********************************************************************/\n\n/* RK45 Fehlberg coefficients */\nstatic const CCTK_REAL alpha_array_F[6] = {\n 0.0,\n 1.0/4.0,\n 3.0/8.0,\n 12.0/13.0,\n 1.0,\n 1.0/2.0,\n};\n\n/* RK45 Cash-Karp coefficients */\nstatic const CCTK_REAL alpha_array_CK[6] = {\n 0.0,\n 1.0/5.0,\n 3.0/10.0,\n 3.0/5.0,\n 1.0,\n 7.0/8.0,\n};\n\n/* RK65 coefficients */\nstatic const CCTK_REAL alpha_array65[8] = {\n 0.0,\n 1.0/10.0,\n 2.0/9.0,\n 3.0/7.0,\n 3.0/5.0,\n 4.0/5.0,\n 1.0,\n 1.0\n};\n\n/* RK87 coefficients */\n static const CCTK_REAL alpha_array87[13] = {\n 0.0,\n 1.0/18.0,\n 1.0/12.0,\n 1.0/8.0,\n 5.0/16.0,\n 3.0/8.0,\n 59.0/400.0,\n 93.0/200.0,\n 5490023248.0/9719169821.0,\n 13.0/20.0,\n 1201146811.0/1299019798.0,\n 1.0,\n 1.0\n};\n\n/********************************************************************\n ********************* External Routines **********************\n ********************************************************************/\n\n /*@@\n @routine MoL_SetTime\n @date Mon May 20 09:48:55 2002\n @author Ian Hawke\n @desc \n Sets the time and timestep before the MoL evolution loop starts.\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nvoid MoL_SetTime(CCTK_ARGUMENTS)\n{\n \n DECLARE_CCTK_ARGUMENTS_CHECKED(MoL_SetTime);\n DECLARE_CCTK_PARAMETERS;\n \n CCTK_REAL beta;\n\n if (adaptive_stepsize && ! CCTK_EQUALS(verbose, \"none\"))\n {\n CCTK_VInfo (CCTK_THORNSTRING, \"Integrating from %g to %g with step size %g\",\n (double)(cctkGH->cctk_time - cctkGH->cctk_delta_time),\n (double)cctkGH->cctk_time,\n (double)cctkGH->cctk_delta_time);\n }\n\n *Original_Time = cctkGH->cctk_time;\n *Original_Delta_Time = cctkGH->cctk_delta_time;\n cctkGH->cctk_time -= cctkGH->cctk_delta_time / cctkGH->cctk_timefac;\n\n if (CCTK_EQUALS(ODE_Method,\"ICN\"))\n {\n cctkGH->cctk_delta_time = 0.5*(*Original_Delta_Time);\n }\n else if (CCTK_EQUALS(ODE_Method,\"ICN-avg\"))\n {\n cctkGH->cctk_delta_time = *Original_Delta_Time;\n }\n else if (CCTK_EQUALS(ODE_Method,\"Generic\"))\n {\n beta = RKBetaCoefficients[0];\n\n cctkGH->cctk_delta_time = beta*(*Original_Delta_Time);\n }\n}\n\n /*@@\n @routine MoL_ResetTime\n @date Mon May 20 09:49:41 2002\n @author Ian Hawke\n @desc \n Sets the time during the MoL evolution loop.\n At the last time all methods should end up with the original\n values for time and timestep.\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nvoid MoL_ResetTime(CCTK_ARGUMENTS)\n{\n\n DECLARE_CCTK_ARGUMENTS_CHECKED(MoL_ResetTime);\n DECLARE_CCTK_PARAMETERS;\n\n CCTK_REAL *previous_times;\n CCTK_INT alphaindex, i, j;\n \n previous_times = (CCTK_REAL*)malloc(MoL_Intermediate_Steps*sizeof(CCTK_REAL));\n if (!previous_times)\n {\n CCTK_ERROR(\"Failed to allocate memory for very small array!\");\n }\n\n if (*MoL_Intermediate_Step == 0) \n {\n cctkGH->cctk_time = (*Original_Time);\n }\n else if (CCTK_EQUALS(ODE_Method,\"ICN\"))\n {\n cctkGH->cctk_time = (*Original_Time) - \n 0.5*(*Original_Delta_Time)/cctkGH->cctk_timefac;\n }\n else if (CCTK_EQUALS(ODE_Method,\"ICN-avg\"))\n {\n cctkGH->cctk_time = (*Original_Time);\n }\n else if (CCTK_EQUALS(ODE_Method,\"Generic\"))\n {\n previous_times[0] = (*Original_Time) -\n (*Original_Delta_Time)/cctkGH->cctk_timefac;\n for (i = MoL_Intermediate_Steps - 1; i > *MoL_Intermediate_Step - 1; i--)\n {\n previous_times[MoL_Intermediate_Steps - i] = \n RKBetaCoefficients[MoL_Intermediate_Steps - i - 1] * \n (*Original_Delta_Time)/cctkGH->cctk_timefac;\n for (j = MoL_Intermediate_Steps; j > i; j--)\n {\n alphaindex = (MoL_Intermediate_Steps - i - 1) * \n MoL_Intermediate_Steps + MoL_Intermediate_Steps - j;\n previous_times[MoL_Intermediate_Steps - i] += \n RKAlphaCoefficients[alphaindex] *\n previous_times[MoL_Intermediate_Steps - j];\n#ifdef MOLDEBUG\n printf(\"i %d j %d is %d index %d t %g dt %g alpha %g beta %g\\n\",\n i, j, MoL_Intermediate_Steps, alphaindex,\n previous_times[MoL_Intermediate_Steps - i], \n (*Original_Delta_Time)/cctkGH->cctk_timefac,\n RKAlphaCoefficients[alphaindex], \n RKBetaCoefficients[MoL_Intermediate_Steps - i - 1]);\n#endif\n }\n }\n#ifdef MOLDEBUG\n printf(\"MoL says the previous times are \");\n for (i = 0; i < MoL_Intermediate_Steps - *MoL_Intermediate_Step\n + 1; i++)\n {\n printf(\"%g \", previous_times[i]);\n }\n printf(\"\\n\");\n#endif\n cctkGH->cctk_time = previous_times[MoL_Intermediate_Steps - \n *MoL_Intermediate_Step];\n }\n else if (CCTK_EQUALS(ODE_Method,\"Euler\"))\n {\n if (*MoL_Intermediate_Step == 1)\n {\n cctkGH->cctk_time = (*Original_Time);\n }\n }\n else if (CCTK_EQUALS(ODE_Method,\"RK2\"))\n {\n if (*MoL_Intermediate_Step == 1)\n {\n cctkGH->cctk_time = (*Original_Time);\n }\n }\n else if (CCTK_EQUALS(ODE_Method,\"RK2-central\"))\n {\n if (*MoL_Intermediate_Step == 1)\n {\n cctkGH->cctk_time = (*Original_Time) - \n 0.5*(*Original_Delta_Time)/cctkGH->cctk_timefac;\n }\n }\n else if (CCTK_EQUALS(ODE_Method,\"RK3\"))\n {\n if (*MoL_Intermediate_Step == 2)\n {\n cctkGH->cctk_time = (*Original_Time);\n }\n else if (*MoL_Intermediate_Step == 1)\n {\n cctkGH->cctk_time = (*Original_Time) - \n 0.5*(*Original_Delta_Time)/cctkGH->cctk_timefac;\n }\n }\n else if (CCTK_EQUALS(ODE_Method,\"RK4\"))\n {\n const int substep = MoL_Intermediate_Steps - (* MoL_Intermediate_Step);\n\n CCTK_REAL dt = (*Original_Delta_Time)/cctkGH->cctk_timefac;\n switch (substep)\n {\n case 1:\n case 2:\n dt *= 0.5;\n break;\n default:\n dt = 0;\n }\n cctkGH->cctk_time = (*Original_Time) - dt;\n }\n else if (CCTK_EQUALS(ODE_Method,\"RK45\") || CCTK_EQUALS(ODE_Method,\"RK45CK\"))\n {\n const int substep = MoL_Intermediate_Steps - (* MoL_Intermediate_Step);\n const CCTK_REAL * alpha_array;\n if (CCTK_EQUALS(ODE_Method, \"RK45\"))\n {\n alpha_array = alpha_array_F;\n }\n else if (CCTK_EQUALS(ODE_Method, \"RK45CK\"))\n {\n alpha_array = alpha_array_CK;\n }\n else\n {\n CCTK_ERROR (\"internal error\");\n /* Avoid compiler warning */\n alpha_array = NULL;\n }\n cctkGH->cctk_time\n = ((* Original_Time)\n + ((alpha_array[substep] - 1)\n * (* Original_Delta_Time) / cctkGH->cctk_timefac));\n }\n else if (CCTK_EQUALS(ODE_Method,\"RK65\"))\n {\n const int substep = MoL_Intermediate_Steps - (* MoL_Intermediate_Step);\n cctkGH->cctk_time\n = ((* Original_Time)\n + ((alpha_array65[substep] - 1)\n * (* Original_Delta_Time) / cctkGH->cctk_timefac));\n }\n else if (CCTK_EQUALS(ODE_Method,\"RK87\"))\n {\n const int substep = MoL_Intermediate_Steps - (* MoL_Intermediate_Step);\n cctkGH->cctk_time\n = ((* Original_Time)\n + ((alpha_array87[substep] - 1)\n * (* Original_Delta_Time) / cctkGH->cctk_timefac));\n }\n else if (CCTK_EQUALS(ODE_Method,\"AB\"))\n {\n CCTK_ERROR (\"internal error\");\n }\n else if (CCTK_EQUALS(ODE_Method,\"RK2-MR-2:1\"))\n {\n const int substep = MoL_Intermediate_Steps - (* MoL_Intermediate_Step);\n\n CCTK_REAL dt = (*Original_Delta_Time)/cctkGH->cctk_timefac;\n switch (substep)\n {\n case 1:\n case 2:\n dt *= 0.5;\n break;\n default:\n dt = 0;\n }\n cctkGH->cctk_time = (*Original_Time) - dt;\n }\n else if (CCTK_EQUALS(ODE_Method,\"RK4-MR-2:1\"))\n {\n const int substep = MoL_Intermediate_Steps - (* MoL_Intermediate_Step);\n\n CCTK_REAL dt = (*Original_Delta_Time)/cctkGH->cctk_timefac;\n switch (substep)\n {\n case 1:\n case 2:\n dt *= 3.0/4.0;\n break;\n case 3:\n case 4:\n case 5:\n dt *= 1.0/2.0;\n break;\n case 6:\n case 7:\n dt *= 1.0/4.0;\n break;\n default:\n dt = 0;\n }\n cctkGH->cctk_time = (*Original_Time) - dt;\n }\n else if (CCTK_EQUALS(ODE_Method,\"RK4-RK2\"))\n {\n const int substep = MoL_Intermediate_Steps - (* MoL_Intermediate_Step);\n\n CCTK_REAL dt = (*Original_Delta_Time)/cctkGH->cctk_timefac;\n switch (substep)\n {\n case 1:\n case 2:\n dt *= 0.5;\n break;\n default:\n dt = 0;\n }\n cctkGH->cctk_time = (*Original_Time) - dt;\n }\n#ifdef MOLDEBUG\n printf(\"MoL has once more reset t (%d): %f.\\n\", \n *MoL_Intermediate_Step, cctkGH->cctk_time);\n fflush(stdout);\n#endif\n\n free(previous_times);\n previous_times = NULL;\n\n if (adaptive_stepsize && CCTK_EQUALS(verbose, \"extreme\"))\n {\n CCTK_VInfo (CCTK_THORNSTRING, \"Evaluating RHS at %g\",\n (double)cctkGH->cctk_time);\n }\n}\n\n /*@@\n @routine MoL_ResetDeltaTime\n @date Mon May 20 09:49:41 2002\n @author Ian Hawke\n @desc \n Sets the timestep during the MoL evolution loop.\n At the last time all methods should end up with the original\n values for time and timestep.\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nvoid MoL_ResetDeltaTime(CCTK_ARGUMENTS)\n{\n\n DECLARE_CCTK_ARGUMENTS_CHECKED(MoL_ResetDeltaTime);\n DECLARE_CCTK_PARAMETERS;\n\n if (*MoL_Intermediate_Step == 0) \n {\n cctkGH->cctk_delta_time = (*Original_Delta_Time);\n }\n else if (CCTK_EQUALS(ODE_Method,\"ICN\"))\n {\n if (*MoL_Intermediate_Step == 1)\n {\n cctkGH->cctk_delta_time = (*Original_Delta_Time);\n }\n else\n {\n cctkGH->cctk_delta_time = 0.5*(*Original_Delta_Time);\n }\n }\n else if (CCTK_EQUALS(ODE_Method,\"ICN-avg\"))\n {\n cctkGH->cctk_delta_time = (*Original_Delta_Time);\n }\n else if (CCTK_EQUALS(ODE_Method,\"Generic\"))\n {\n cctkGH->cctk_delta_time = RKBetaCoefficients[MoL_Intermediate_Steps - \n (*MoL_Intermediate_Step)] *\n (*Original_Delta_Time);\n }\n else if (CCTK_EQUALS(ODE_Method,\"Euler\"))\n {\n if (*MoL_Intermediate_Step == 1)\n {\n cctkGH->cctk_delta_time = (*Original_Delta_Time);\n }\n }\n else if (CCTK_EQUALS(ODE_Method,\"RK2\"))\n {\n if (*MoL_Intermediate_Step == 1)\n {\n cctkGH->cctk_delta_time = 0.5*(*Original_Delta_Time);\n }\n }\n else if (CCTK_EQUALS(ODE_Method,\"RK3\"))\n {\n if (*MoL_Intermediate_Step == 2)\n {\n cctkGH->cctk_delta_time = 0.25*(*Original_Delta_Time);\n }\n else if (*MoL_Intermediate_Step == 1)\n {\n cctkGH->cctk_delta_time = 2.0/3.0*(*Original_Delta_Time);\n }\n }\n else if (CCTK_EQUALS(ODE_Method,\"RK45\") || CCTK_EQUALS(ODE_Method,\"RK45CK\"))\n {\n const int substep = MoL_Intermediate_Steps - (* MoL_Intermediate_Step);\n const CCTK_REAL * alpha_array;\n if (CCTK_EQUALS(ODE_Method, \"RK45\"))\n {\n alpha_array = alpha_array_F;\n }\n else if (CCTK_EQUALS(ODE_Method, \"RK45CK\"))\n {\n alpha_array = alpha_array_CK;\n }\n else\n {\n CCTK_ERROR (\"internal error\"); \n /* Avoid compiler warning */\n alpha_array = NULL;\n }\n cctkGH->cctk_delta_time\n = ((alpha_array[substep + 1] - alpha_array[substep])\n * (* Original_Delta_Time));\n }\n else if (CCTK_EQUALS(ODE_Method,\"RK65\"))\n {\n const int substep = MoL_Intermediate_Steps - (* MoL_Intermediate_Step);\n cctkGH->cctk_delta_time\n = ((alpha_array65[substep + 1] - alpha_array65[substep])\n * (* Original_Delta_Time));\n }\n else if (CCTK_EQUALS(ODE_Method,\"RK87\"))\n {\n const int substep = MoL_Intermediate_Steps - (* MoL_Intermediate_Step);\n cctkGH->cctk_delta_time\n = ((alpha_array87[substep + 1] - alpha_array87[substep])\n * (* Original_Delta_Time));\n }\n#ifdef MOLDEBUG\n printf(\"MoL has once more reset dt (%d): %f.\\n\", \n *MoL_Intermediate_Step, \n cctkGH->cctk_delta_time/cctkGH->cctk_timefac);\n fflush(stdout);\n#endif\n\n if (adaptive_stepsize && CCTK_EQUALS(verbose, \"extreme\"))\n {\n CCTK_VInfo (CCTK_THORNSTRING, \"Evaluating RHS with a time step of %g\",\n (double)cctkGH->cctk_delta_time);\n }\n}\n\n/********************************************************************\n ********************* Local Routines *************************\n ********************************************************************/\n", |
| "GenericRK.c": "/*@@\n @file GenericRK.c\n @date Sun May 26 03:47:15 2002\n @author Ian Hawke\n @desc\n This routine performs a generic Runge-Kutta type integration\n given the set of coefficients defined in the RKAlphaCoefficients\n and RKBetaCoefficients arrays. See the article by Shu referenced\n in the documentation for more details.\n @enddesc\n @version $Header$\n@@*/\n\n#include \"ExternalVariables.h\"\n#include \"Operators.h\"\n\n#include <cctk.h>\n#include <cctk_Arguments.h>\n#include <cctk_Parameters.h>\n\n#include <stdio.h>\n\nstatic const char *rcsid = \"$Header$\";\n\nCCTK_FILEVERSION(CactusBase_MoL_GenericRK_c);\n\n/********************************************************************\n ********************* Local Data Types ***********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Local Routine Prototypes *********************\n ********************************************************************/\n\nstatic CCTK_INT AlphaIndex(CCTK_INT Step_Number, CCTK_INT Scratch_Level);\n\n/********************************************************************\n ***************** Scheduled Routine Prototypes *********************\n ********************************************************************/\n\nvoid MoL_GenericRKAdd(CCTK_ARGUMENTS);\n\n/********************************************************************\n ********************* Other Routine Prototypes *********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Local Data *****************************\n ********************************************************************/\n\n/********************************************************************\n ********************* External Routines **********************\n ********************************************************************/\n\n/*@@\n @routine MoL_GenericRKAdd\n @date Sun May 26 03:50:44 2002\n @author Ian Hawke\n @desc\n Performs a single step of a generic Runge-Kutta type time\n integration.\n @enddesc\n @calls\n @calledby\n @history\n\n @endhistory\n\n@@*/\n\nvoid MoL_GenericRKAdd(CCTK_ARGUMENTS) {\n DECLARE_CCTK_ARGUMENTS_CHECKED(MoL_GenericRKAdd);\n DECLARE_CCTK_PARAMETERS;\n\n CCTK_INT rl = 0;\n if (CCTK_IsFunctionAliased(\"GetRefinementLevel\")) {\n rl = GetRefinementLevel(cctkGH);\n }\n\n const int scratchspace_firstindex = CCTK_FirstVarIndex(\"MOL::SCRATCHSPACE\");\n\n const CCTK_REAL dt = *Original_Delta_Time / cctkGH->cctk_timefac;\n\n const int mol_step = MoL_Intermediate_Steps - *MoL_Intermediate_Step;\n const CCTK_REAL beta = RKBetaCoefficients[mol_step];\n\n /* Real GFs */\n\n for (int var = 0; var < MoLNumEvolvedVariables; var++) {\n {\n if (MoL_Intermediate_Steps > 90)\n CCTK_ERROR(\"Internal error\");\n CCTK_INT nsrcs = 0;\n CCTK_INT srcs[100];\n CCTK_INT tls[100];\n CCTK_REAL facts[100];\n srcs[nsrcs] = RHSVariableIndex[var];\n tls[nsrcs] = 0;\n facts[nsrcs] = beta * dt;\n ++nsrcs;\n for (int scratchstep = 0; scratchstep < mol_step + 1; scratchstep++) {\n CCTK_INT alphaindex = AlphaIndex(*MoL_Intermediate_Step, scratchstep);\n CCTK_REAL alpha = RKAlphaCoefficients[alphaindex];\n if (alpha != 0.0) {\n if (scratchstep == 0) {\n srcs[nsrcs] = EvolvedVariableIndex[var];\n tls[nsrcs] = 1;\n } else {\n CCTK_INT scratchindex = scratchstep - 1;\n srcs[nsrcs] = scratchspace_firstindex + scratchindex;\n tls[nsrcs] = var;\n }\n facts[nsrcs] = alpha;\n ++nsrcs;\n }\n }\n CCTK_INT dst = EvolvedVariableIndex[var];\n CCTK_INT tl = 0;\n MoL_LinearCombination(cctkGH, dst, rl, tl, 0.0, srcs, tls, facts, nsrcs);\n }\n\n if (*MoL_Intermediate_Step > 1) {\n const CCTK_INT nsrcs = 1;\n const CCTK_INT srcs[] = {EvolvedVariableIndex[var]};\n const CCTK_INT tls[] = {0};\n const CCTK_REAL facts[] = {1.0};\n const CCTK_INT dst = scratchspace_firstindex + mol_step;\n const CCTK_INT tl = var;\n MoL_LinearCombination(cctkGH, dst, rl, tl, 0.0, srcs, tls, facts, nsrcs);\n }\n }\n\n /* Real arrays */\n\n /* #define MOLDEBUGARRAYS 1 */\n\n CCTK_INT arrayscratchlocation = 0;\n\n#ifdef MOLDEBUGARRAYS\n CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"Array sizes are %d %d %d\\n\", MoL_Max_Evolved_Array_Size,\n arraytotalsize, singlearraysize);\n#endif\n\n for (int var = 0; var < MoLNumEvolvedArrayVariables; var++) {\n\n CCTK_REAL *restrict UpdateVar = (CCTK_REAL *)CCTK_VarDataPtrI(\n cctkGH, 0, EvolvedArrayVariableIndex[var]);\n CCTK_REAL const *restrict RHSVar = (CCTK_REAL const *)CCTK_VarDataPtrI(\n cctkGH, 0, RHSArrayVariableIndex[var]);\n\n CCTK_INT arraytotalsize = ArrayScratchSizes[var];\n\n#pragma omp /*parallel for*/ simd\n for (int index = 0; index < arraytotalsize; index++) {\n UpdateVar[index] =\n (*Original_Delta_Time) / cctkGH->cctk_timefac * beta * RHSVar[index];\n }\n\n for (int scratchstep = 0; scratchstep < mol_step + 1; scratchstep++) {\n\n const CCTK_INT alphaindex =\n AlphaIndex(*MoL_Intermediate_Step, scratchstep);\n const CCTK_INT scratchindex = scratchstep - 1;\n\n const CCTK_REAL alpha = RKAlphaCoefficients[alphaindex];\n\n CCTK_REAL *restrict ScratchVar;\n if (scratchstep) {\n ScratchVar = &ArrayScratchSpace[scratchindex * CurrentArrayScratchSize +\n arrayscratchlocation];\n } else {\n ScratchVar =\n CCTK_VarDataPtrI(cctkGH, 1, EvolvedArrayVariableIndex[var]);\n }\n\n if ((alpha > MoL_Tiny) || (alpha < -MoL_Tiny)) {\n#pragma omp /*parallel for*/ simd\n for (int index = 0; index < arraytotalsize; index++) {\n UpdateVar[index] += alpha * ScratchVar[index];\n#ifdef MOLDEBUGARRAYS\n if (CCTK_EQUALS(verbose, \"extreme\")) {\n CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"Variable: %d. Index: %d. step: %d. \"\n \"alpha: %f. Scratch: %f. q: %f.\\n\",\n var, index, *MoL_Intermediate_Step, alpha,\n ScratchVar[index], UpdateVar[index]);\n }\n#endif\n }\n }\n }\n\n arrayscratchlocation += arraytotalsize;\n }\n\n arrayscratchlocation = 0;\n\n if (*MoL_Intermediate_Step > 1) {\n for (int var = 0; var < MoLNumEvolvedArrayVariables; var++) {\n const CCTK_REAL *restrict const UpdateVar =\n CCTK_VarDataPtrI(cctkGH, 0, EvolvedArrayVariableIndex[var]);\n CCTK_REAL *restrict const ScratchVar =\n &ArrayScratchSpace[mol_step * CurrentArrayScratchSize +\n // singlearraysize +\n // (MoL_Max_Evolved_Array_Size+1) +\n arrayscratchlocation];\n\n CCTK_INT arraytotalsize = ArrayScratchSizes[var];\n\n#ifdef MOLDEBUGARRAYS\n CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"Writing to scratch space, initial address %ld, index %d \\n\",\n ScratchVar,\n mol_step * CurrentArrayScratchSize + arrayscratchlocation);\n#endif\n#pragma omp /*parallel for*/ simd\n for (int index = 0; index < arraytotalsize; index++) {\n ScratchVar[index] = UpdateVar[index];\n#ifdef MOLDEBUGARRAYS\n if (CCTK_EQUALS(verbose, \"extreme\")) {\n CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"Variable: %d. Index: %d. step: %d. Scratch: %f.\\n\", var,\n index, *MoL_Intermediate_Step, ScratchVar[index]);\n }\n#endif\n }\n arrayscratchlocation += arraytotalsize;\n }\n }\n\n return;\n}\n\n/********************************************************************\n ********************* Local Routines *************************\n ********************************************************************/\n\nstatic CCTK_INT AlphaIndex(CCTK_INT Step_Number, CCTK_INT Scratch_Level) {\n DECLARE_CCTK_PARAMETERS;\n\n return (MoL_Intermediate_Steps - Step_Number) * MoL_Intermediate_Steps +\n Scratch_Level;\n}\n", |
| "Operators.h": "#ifndef OPERATORS_H\n#define OPERATORS_H\n\n#include <cctk.h>\n\nCCTK_INT\nMoL_LinearCombination(cGH const *cctkGH,\n CCTK_INT var,\n CCTK_INT rl,\n CCTK_INT tl,\n CCTK_REAL scale,\n CCTK_INT const srcs[],\n CCTK_INT const tls[],\n CCTK_REAL const facts[],\n CCTK_INT nsrcs);\n\nCCTK_INT\nMoL_LinearCombination_REAL(cGH const *cctkGH,\n CCTK_REAL *restrict var,\n CCTK_INT size,\n CCTK_REAL scale,\n CCTK_REAL const *restrict const srcs[],\n CCTK_REAL const facts[],\n CCTK_INT nsrcs);\n\n#endif // #ifndef OPERATORS_H\n", |
| "RK2-MR-2_1.c": " /*@@\n @file RK2-MR-2_1.c\n @date 2012-03-25\n @author Christian Reisswig\n @desc \n A routine to perform RK2 2:1 MR evolution. Mostly copied from\n genericRK.c\n @enddesc \n @version $Header$\n @@*/\n\n#include \"cctk.h\"\n#include \"cctk_Arguments.h\"\n#include \"cctk_Parameters.h\"\n\n#include <stdio.h>\n#include \"ExternalVariables.h\"\n\n//#define MOLDEBUG\n\nstatic const char *rcsid = \"$Header$\";\n\nCCTK_FILEVERSION(CactusBase_MoL_RK2_MR_2_1_c);\n\n/********************************************************************\n ********************* Local Data Types ***********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Local Routine Prototypes *********************\n ********************************************************************/\n\n/********************************************************************\n ***************** Scheduled Routine Prototypes *********************\n ********************************************************************/\n\nvoid MoL_RK2_MR_2_1_Add(CCTK_ARGUMENTS);\n\n/********************************************************************\n ********************* Other Routine Prototypes *********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Local Data *****************************\n ********************************************************************/\n\n/********************************************************************\n ********************* External Routines **********************\n ********************************************************************/\n\n /*@@\n @routine MoL_RK2_MR_2_1_Add\n @date \n @author \n @desc \n Performs a single step of a RK2_MR_2_1 type time\n integration.\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nvoid MoL_RK2_MR_2_1_Add(CCTK_ARGUMENTS)\n{\n\n DECLARE_CCTK_ARGUMENTS_CHECKED(MoL_RK2_MR_2_1_Add);\n DECLARE_CCTK_PARAMETERS;\n \n CCTK_INT arraydim;\n\n static CCTK_INT scratchspace_firstindex = -99;\n static CCTK_INT scratchspace_firstindex_slow = -99;\n CCTK_INT index, var, scratchstep;\n CCTK_INT totalsize;\n CCTK_REAL alpha[4], beta[5];\n CCTK_REAL alpha_slow[4], beta_slow[5];\n CCTK_REAL * restrict UpdateVar;\n CCTK_REAL * restrict OldVar;\n CCTK_REAL const * restrict RHSVar;\n CCTK_REAL * restrict ScratchVar;\n\n totalsize = 1;\n for (arraydim = 0; arraydim < cctk_dim; arraydim++)\n {\n totalsize *= cctk_ash[arraydim];\n }\n\n if (scratchspace_firstindex == -99)\n {\n scratchspace_firstindex = CCTK_FirstVarIndex(\"MOL::SCRATCHSPACE\");\n }\n \n if (scratchspace_firstindex_slow == -99)\n {\n scratchspace_firstindex_slow = CCTK_FirstVarIndex(\"MOL::SCRATCHSPACESLOW\");\n }\n\n switch (MoL_Intermediate_Steps - (*MoL_Intermediate_Step))\n {\n case 0:\n alpha[0] = 1.0/2.0; \n alpha[1] = 0;\n alpha[2] = 0;\n alpha[3] = 0;\n alpha_slow[0] = 1.0/2.0; \n alpha_slow[1] = 0;\n alpha_slow[2] = 0;\n alpha_slow[3] = 0;\n break;\n case 1:\n alpha[0] = 1.0/4.0;\n alpha[1] = 1.0/4.0;\n alpha[2] = 0;\n alpha[3] = 0;\n alpha_slow[0] = 1.0/2.0; \n alpha_slow[1] = 0;\n alpha_slow[2] = 0;\n alpha_slow[3] = 0;\n break;\n case 2:\n alpha[0] = 1.0/4.0; \n alpha[1] = 1.0/4.0;\n alpha[2] = 1.0/2.0;\n alpha[3] = 0.0;\n alpha_slow[0] = 1.0; \n alpha_slow[1] = 0;\n alpha_slow[2] = 0;\n alpha_slow[3] = 0;\n break;\n case 3:\n alpha[0] = 1.0/4.0;\n alpha[1] = 1.0/4.0; \n alpha[2] = 1.0/4.0; \n alpha[3] = 1.0/4.0;\n alpha_slow[0] = 1.0; \n alpha_slow[1] = 0;\n alpha_slow[2] = 0;\n alpha_slow[3] = 0;\n break;\n case 4:\n /* alpha not used in this case */\n break;\n default:\n CCTK_VERROR(\"Internal error. Unexpected substep %d\", (int)*MoL_Intermediate_Step);\n break;\n }\n\n beta[0] = 1.0/4.0; \n beta[1] = 1.0/4.0; \n beta[2] = 1.0/4.0; \n beta[3] = 1.0/4.0;\n beta[4] = 0.0;\n\n beta_slow[0] = 1.0/2.0; \n beta_slow[1] = 0.0; \n beta_slow[2] = 0.0; \n beta_slow[3] = 0.0;\n beta_slow[4] = 1.0/2.0;\n\n\n /* FIXME */\n\n\n /* Real GFs, the \"fast\" part */\n\n for (var = 0; var < MoLNumEvolvedVariables; var++)\n {\n \n UpdateVar = (CCTK_REAL *)CCTK_VarDataPtrI(cctkGH, 0, \n EvolvedVariableIndex[var]);\n OldVar = (CCTK_REAL *)CCTK_VarDataPtrI(cctkGH, 1, \n EvolvedVariableIndex[var]);\n RHSVar = (CCTK_REAL const *)CCTK_VarDataPtrI(cctkGH, 0, \n RHSVariableIndex[var]);\n/* #define MOLDEBUG 1 */\n#ifdef MOLDEBUG\n printf(\"In multirate RK. Variable %d (%s). RHS %d (%s). beta %g.\\n\",\n EvolvedVariableIndex[var],\n CCTK_VarName(EvolvedVariableIndex[var]),\n RHSVariableIndex[var],\n CCTK_VarName(RHSVariableIndex[var]),\n beta[MoL_Intermediate_Steps - (*MoL_Intermediate_Step)]);\n#endif\n\n ScratchVar = CCTK_VarDataPtrI(cctkGH, var, \n scratchspace_firstindex\n + (MoL_Intermediate_Steps - (*MoL_Intermediate_Step)));\n\n#pragma omp /*parallel for*/ simd\n for (index = 0; index < totalsize; index++)\n {\n ScratchVar[index] = (*Original_Delta_Time) / cctkGH->cctk_timefac * RHSVar[index];\n \n#ifdef MOLDEBUG\n if (CCTK_EQUALS(verbose,\"extreme\"))\n {\n printf(\"Variable: %d. Index: %d. dt: %f. beta %f. RHS: %f. q: %f.\\n\",\n var, index, (*Original_Delta_Time) / cctkGH->cctk_timefac, beta, RHSVar[index], \n UpdateVar[index]);\n }\n#endif\n }\n \n \n#pragma omp /*parallel for*/ simd\n for (index = 0; index < totalsize; index++)\n {\n UpdateVar[index] = OldVar[index];\n }\n\n if ((*MoL_Intermediate_Step)>1)\n {\n //printf(\"Step %d \\n\", MoL_Intermediate_Steps - (*MoL_Intermediate_Step));\n for (scratchstep = 0; scratchstep <= MoL_Intermediate_Steps - (*MoL_Intermediate_Step); scratchstep++)\n {\n \n //printf(\"Scratch Step %d, alpha %g \\n\", scratchstep, alpha[scratchstep]);\n \n ScratchVar = CCTK_VarDataPtrI(cctkGH, var, \n scratchspace_firstindex\n + scratchstep);\n \n#pragma omp /*parallel for*/ simd\n for (index = 0; index < totalsize; index++)\n {\n UpdateVar[index] += alpha[scratchstep] * ScratchVar[index];\n }\n }\n }\n else\n {\n //printf(\"Final Step!\\n\");\n \n for (scratchstep = 0; scratchstep < MoL_Intermediate_Steps; scratchstep++)\n {\n \n //printf(\"Scratch Step %d, beta %g \\n\", scratchstep, beta[scratchstep]);\n \n ScratchVar = CCTK_VarDataPtrI(cctkGH, var, \n scratchspace_firstindex\n + scratchstep);\n \n#pragma omp /*parallel for*/ simd\n for (index = 0; index < totalsize; index++)\n {\n UpdateVar[index] += beta[scratchstep] * ScratchVar[index];\n }\n }\n }\n\n }\n\n\n for (var = 0; var < MoLNumEvolvedVariablesSlow; var++)\n {\n \n UpdateVar = (CCTK_REAL *)CCTK_VarDataPtrI(cctkGH, 0, \n EvolvedVariableIndexSlow[var]);\n OldVar = (CCTK_REAL *)CCTK_VarDataPtrI(cctkGH, 1, \n EvolvedVariableIndexSlow[var]);\n RHSVar = (CCTK_REAL const *)CCTK_VarDataPtrI(cctkGH, 0, \n RHSVariableIndexSlow[var]);\n/* #define MOLDEBUG 1 */\n#ifdef MOLDEBUG\n printf(\"In multirate RK. SLOW Variable %d (%s). RHS %d (%s). beta %g.\\n\",\n EvolvedVariableIndexSlow[var],\n CCTK_VarName(EvolvedVariableIndexSlow[var]),\n RHSVariableIndexSlow[var],\n CCTK_VarName(RHSVariableIndexSlow[var]),\n beta[MoL_Intermediate_Steps - (*MoL_Intermediate_Step)]);\n#endif\n\n ScratchVar = CCTK_VarDataPtrI(cctkGH, var, \n scratchspace_firstindex_slow\n + (MoL_Intermediate_Steps - (*MoL_Intermediate_Step)));\n\n#pragma omp /*parallel for*/ simd\n for (index = 0; index < totalsize; index++)\n {\n ScratchVar[index] = (*Original_Delta_Time) / cctkGH->cctk_timefac * RHSVar[index];\n \n#ifdef MOLDEBUG\n if (CCTK_EQUALS(verbose,\"extreme\"))\n {\n printf(\"SLOW Variable: %d. Index: %d. dt: %f. beta %f. RHS: %f. q: %f.\\n\",\n var, index, (*Original_Delta_Time) / cctkGH->cctk_timefac, beta, RHSVar[index], \n UpdateVar[index]);\n }\n#endif\n }\n \n \n#pragma omp /*parallel for*/ simd\n for (index = 0; index < totalsize; index++)\n {\n UpdateVar[index] = OldVar[index];\n }\n\n if ((*MoL_Intermediate_Step)>1)\n {\n //printf(\"Step %d \\n\", MoL_Intermediate_Steps - (*MoL_Intermediate_Step));\n for (scratchstep = 0; scratchstep <= /*MoL_Intermediate_Steps - (*MoL_Intermediate_Step)*/ 0; scratchstep++)\n {\n \n //printf(\"Scratch Step %d, alpha %g \\n\", scratchstep, alpha_slow[scratchstep]);\n \n ScratchVar = CCTK_VarDataPtrI(cctkGH, var, \n scratchspace_firstindex_slow\n + scratchstep);\n \n#pragma omp /*parallel for*/ simd\n for (index = 0; index < totalsize; index++)\n {\n UpdateVar[index] += alpha_slow[scratchstep] * ScratchVar[index];\n }\n }\n }\n else\n {\n //printf(\"Final Step!\\n\");\n \n for (scratchstep = 0; scratchstep < MoL_Intermediate_Steps; scratchstep+=4)\n {\n \n //printf(\"Scratch Step %d, beta %g \\n\", scratchstep, beta_slow[scratchstep]);\n \n ScratchVar = CCTK_VarDataPtrI(cctkGH, var, \n scratchspace_firstindex_slow\n + scratchstep);\n \n#pragma omp /*parallel for*/ simd\n for (index = 0; index < totalsize; index++)\n {\n UpdateVar[index] += beta_slow[scratchstep] * ScratchVar[index];\n }\n }\n }\n\n }\n\n return;\n}\n", |
| "ChangeType.c": " /*@@\n @file ChangeType.c\n @date Thu May 30 16:16:40 2002\n @author Ian Hawke\n @desc \n The external functions called (via function aliasing) by physics\n thorns to tell MoL that they want these GFs to be treated as a\n different type to the original declaration.\n @enddesc \n @version $Header$\n @@*/\n\n#include \"cctk.h\"\n#include \"cctk_Parameters.h\"\n\n#include \"ExternalVariables.h\"\n\nstatic const char *rcsid = \"$Header$\";\n\nCCTK_FILEVERSION(CactusBase_MoL_ChangeType_c);\n\n/********************************************************************\n ********************* Local Data Types ***********************\n ********************************************************************/\n\n#define MOL_UNKNOWN_VARTYPE 0\n#define MOL_EVOLVED_VARTYPE 1\n#define MOL_CONSTRAINED_VARTYPE 2\n#define MOL_SANDR_VARTYPE 3\n#define MOL_EVOLVEDSLOW_VARTYPE 4\n\n/********************************************************************\n ********************* Local Routine Prototypes *********************\n ********************************************************************/\n\n/* support old versions of the flesh */\n#ifndef HAVE_CCTK_DECLARED_TIMELEVELS\n#define CCTK_DeclaredTimeLevelsVI(vi) CCTK_MaxTimeLevelsVI(vi)\n#endif\n\n/********************************************************************\n ***************** Scheduled Routine Prototypes *********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Other Routine Prototypes *********************\n ********************************************************************/\n\nCCTK_INT MoL_ChangeToEvolved(CCTK_INT EvolvedIndex, CCTK_INT RHSIndex);\n\nCCTK_INT MoL_ChangeToEvolvedSlow(CCTK_INT EvolvedIndex, CCTK_INT RHSIndexSlow);\n\nCCTK_INT MoL_ChangeToConstrained(CCTK_INT ConstrainedIndex);\n\nCCTK_INT MoL_ChangeToSaveAndRestore(CCTK_INT SandRIndex);\n\nCCTK_INT MoL_ChangeToNone(CCTK_INT RemoveIndex);\n\n\n/********************************************************************\n ********************* Local Data *****************************\n ********************************************************************/\n\n/********************************************************************\n ********************* External Routines **********************\n ********************************************************************/\n\n /*@@\n @routine MoL_ChangeToEvolved\n @date Thu May 30 16:45:30 2002\n @author Ian Hawke\n @desc \n Changes a variable to evolved type. Checks to see which type it was\n before and does the bookkeeping on the index arrays.\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nCCTK_INT MoL_ChangeToEvolved(CCTK_INT EvolvedIndex, CCTK_INT RHSIndex)\n{\n\n DECLARE_CCTK_PARAMETERS;\n\n CCTK_INT index, usedindex;\n CCTK_INT vartype; /* See the defines at the top of file */\n CCTK_INT timelevs;\n \n vartype = 0;\n usedindex = -1;\n \n for (index = 0; (index < MoLNumEvolvedVariables)&&(!vartype); index++)\n {\n vartype = MOL_EVOLVED_VARTYPE * \n (EvolvedVariableIndex[index] == EvolvedIndex);\n if (vartype)\n {\n usedindex = index;\n }\n }\n \n for (index = 0; (index < MoLNumEvolvedVariablesSlow)&&(!vartype); index++)\n {\n vartype = MOL_EVOLVEDSLOW_VARTYPE * \n (EvolvedVariableIndexSlow[index] == EvolvedIndex);\n if (vartype)\n {\n usedindex = index;\n }\n }\n \n for (index = 0; (index < MoLNumConstrainedVariables)&&(!vartype); index++)\n {\n vartype = MOL_CONSTRAINED_VARTYPE * \n (ConstrainedVariableIndex[index] == EvolvedIndex);\n if (vartype)\n {\n usedindex = index;\n }\n }\n \n for (index = 0; (index < MoLNumSandRVariables)&&(!vartype); index++)\n {\n vartype = MOL_SANDR_VARTYPE * \n (SandRVariableIndex[index] == EvolvedIndex);\n if (vartype)\n {\n usedindex = index;\n }\n }\n\n switch (vartype)\n {\n \n case MOL_UNKNOWN_VARTYPE:\n\n {\n timelevs = CCTK_DeclaredTimeLevelsVI(EvolvedIndex);\n if (timelevs < 1)\n {\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"Warning whilst trying to change variable \"\n \"index %i to evolved.\", (int)EvolvedIndex);\n CCTK_ERROR(\"The index passed does not correspond to a GF.\");\n }\n else if (timelevs == 1) \n {\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"Warning whilst trying to change variable \"\n \"index %i to evolved.\", (int)EvolvedIndex);\n CCTK_ERROR(\"The index passed only has a single timelevel.\");\n }\n timelevs = CCTK_DeclaredTimeLevelsVI(RHSIndex);\n if (timelevs < 1) {\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"Warning whilst trying to change variable \"\n \"index %i to evolved (RHS GF).\", (int)RHSIndex);\n CCTK_ERROR(\"The index passed does not correspond to a GF.\");\n }\n\n if (!(MoLNumEvolvedVariables < MoLMaxNumRegisteredVariables))\n {\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"Warning whilst trying to change variable \"\n \"index %i (%s) to evolved.\", \n (int)EvolvedIndex, CCTK_VarName(EvolvedIndex));\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"When changing type there are more than %d variables. \"\n \" Since this should be the total number of Cactus \"\n \"variables, this looks like a bug.\",\n (int)MoLMaxNumRegisteredVariables);\n }\n\n EvolvedVariableIndex[MoLNumEvolvedVariables] = EvolvedIndex;\n RHSVariableIndex[MoLNumEvolvedVariables] = RHSIndex;\n MoLNumEvolvedVariables++;\n#ifdef MOLDEBUG\n printf(\"Changing (unknown): vars %d var %d (%s).\\n\",\n MoLNumEvolvedVariables, EvolvedIndex,\n CCTK_VarName(EvolvedIndex);\n#endif\n break;\n }\n \n case MOL_EVOLVED_VARTYPE:\n \n {\n RHSVariableIndex[usedindex] = RHSIndex;\n break;\n }\n\n case MOL_EVOLVEDSLOW_VARTYPE:\n \n {\n timelevs = CCTK_DeclaredTimeLevelsVI(RHSIndex);\n if (timelevs < 1) {\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"Warning whilst trying to change variable \"\n \"index %i to evolved type from constrained.\",\n (int)RHSIndex);\n CCTK_ERROR(\"The RHS index passed does not correspond to a GF.\");\n }\n\n if (!(MoLNumEvolvedVariables < MoL_Num_Evolved_Vars))\n {\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"Warning whilst trying to change variable \"\n \"index %i (%s) to evolved.\", \n (int)EvolvedIndex, CCTK_VarName(EvolvedIndex));\n CCTK_ERROR(\"When changing type there are more variables \"\n \"than the accumulator parameter \"\n \"MoL_Num_Evolved_Vars allows. Check that \"\n \"you are accumulating onto this parameter correctly\");\n }\n\n for (index = usedindex; index < MoLNumEvolvedVariablesSlow - 1; \n index++)\n {\n EvolvedVariableIndexSlow[index] = EvolvedVariableIndexSlow[index+1];\n }\n MoLNumEvolvedVariablesSlow--;\n EvolvedVariableIndex[MoLNumEvolvedVariables] = EvolvedIndex;\n RHSVariableIndex[MoLNumEvolvedVariables] = RHSIndex;\n MoLNumEvolvedVariables++;\n#ifdef MOLDEBUG\n printf(\"Changing (constrained): vars %d var %d (%s).\\n\",\n MoLNumEvolvedVariables, EvolvedIndex,\n CCTK_VarName(EvolvedIndex);\n#endif\n break;\n }\n \n case MOL_CONSTRAINED_VARTYPE:\n \n {\n timelevs = CCTK_DeclaredTimeLevelsVI(RHSIndex);\n if (timelevs < 1) {\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"Warning whilst trying to change variable \"\n \"index %i to evolved type from constrained.\",\n (int)RHSIndex);\n CCTK_ERROR(\"The RHS index passed does not correspond to a GF.\");\n }\n\n if (!(MoLNumEvolvedVariables < MoLMaxNumRegisteredVariables))\n {\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"Warning whilst trying to change variable \"\n \"index %i (%s) to evolved.\", \n (int)EvolvedIndex, CCTK_VarName(EvolvedIndex));\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"When changing type there are more than %d variables. \"\n \" Since this should be the total number of Cactus \"\n \"variables, this looks like a bug.\",\n (int)MoLMaxNumRegisteredVariables);\n }\n\n for (index = usedindex; index < MoLNumConstrainedVariables - 1; \n index++)\n {\n ConstrainedVariableIndex[index] = ConstrainedVariableIndex[index+1];\n }\n MoLNumConstrainedVariables--;\n EvolvedVariableIndex[MoLNumEvolvedVariables] = EvolvedIndex;\n RHSVariableIndex[MoLNumEvolvedVariables] = RHSIndex;\n MoLNumEvolvedVariables++;\n#ifdef MOLDEBUG\n printf(\"Changing (constrained): vars %d var %d (%s).\\n\",\n MoLNumEvolvedVariables, EvolvedIndex,\n CCTK_VarName(EvolvedIndex);\n#endif\n break;\n }\n \n case MOL_SANDR_VARTYPE:\n \n {\n timelevs = CCTK_DeclaredTimeLevelsVI(RHSIndex);\n if (timelevs < 1) {\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"Warning whilst trying to change variable \"\n \"index %i to evolved type from save and \"\n \"restore.\", (int)RHSIndex);\n CCTK_ERROR(\"The RHS index passed does not correspond to a GF.\");\n }\n\n if (!(MoLNumEvolvedVariables < MoLMaxNumRegisteredVariables))\n {\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"Warning whilst trying to change variable \"\n \"index %i (%s) to evolved.\", \n (int)EvolvedIndex, CCTK_VarName(EvolvedIndex));\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"When changing type there are more than %d variables. \"\n \" Since this should be the total number of Cactus \"\n \"variables, this looks like a bug.\",\n (int)MoLMaxNumRegisteredVariables);\n }\n\n for (index = usedindex; index < MoLNumSandRVariables - 1; index++)\n {\n SandRVariableIndex[index] = SandRVariableIndex[index+1];\n }\n MoLNumSandRVariables--;\n EvolvedVariableIndex[MoLNumEvolvedVariables] = EvolvedIndex;\n RHSVariableIndex[MoLNumEvolvedVariables] = RHSIndex;\n MoLNumEvolvedVariables++;\n#ifdef MOLDEBUG\n printf(\"Changing (SandR): vars %d var %d (%s).\\n\",\n MoLNumEvolvedVariables, EvolvedIndex,\n CCTK_VarName(EvolvedIndex);\n#endif\n break;\n }\n \n default:\n \n {\n CCTK_ERROR(\"Something is seriously wrong in ChangeType.c! \"\n \"Case out of range in switch statement.\");\n }\n \n }\n\n return 0;\n \n}\n\n /*@@\n @routine MoL_ChangeToEvolvedSlow\n @date Thu May 30 16:45:30 2002\n @author Ian Hawke, Roland Haas\n @desc \n Changes a variable to evolved slow type. Checks to see which type it was\n before and does the bookkeeping on the index arrays.\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nCCTK_INT MoL_ChangeToEvolvedSlow(CCTK_INT EvolvedIndex, CCTK_INT RHSIndex)\n{\n\n DECLARE_CCTK_PARAMETERS;\n\n CCTK_INT index, usedindex;\n CCTK_INT vartype; /* See the defines at the top of file */\n CCTK_INT timelevs;\n \n vartype = 0;\n usedindex = -1;\n \n for (index = 0; (index < MoLNumEvolvedVariables)&&(!vartype); index++)\n {\n vartype = MOL_EVOLVED_VARTYPE * \n (EvolvedVariableIndex[index] == EvolvedIndex);\n if (vartype)\n {\n usedindex = index;\n }\n }\n \n for (index = 0; (index < MoLNumEvolvedVariablesSlow)&&(!vartype); index++)\n {\n vartype = MOL_EVOLVEDSLOW_VARTYPE * \n (EvolvedVariableIndexSlow[index] == EvolvedIndex);\n if (vartype)\n {\n usedindex = index;\n }\n }\n \n for (index = 0; (index < MoLNumConstrainedVariables)&&(!vartype); index++)\n {\n vartype = MOL_CONSTRAINED_VARTYPE * \n (ConstrainedVariableIndex[index] == EvolvedIndex);\n if (vartype)\n {\n usedindex = index;\n }\n }\n \n for (index = 0; (index < MoLNumSandRVariables)&&(!vartype); index++)\n {\n vartype = MOL_SANDR_VARTYPE * \n (SandRVariableIndex[index] == EvolvedIndex);\n if (vartype)\n {\n usedindex = index;\n }\n }\n\n switch (vartype)\n {\n \n case MOL_UNKNOWN_VARTYPE:\n\n {\n timelevs = CCTK_DeclaredTimeLevelsVI(EvolvedIndex);\n if (timelevs < 1)\n {\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"Warning whilst trying to change variable \"\n \"index %i to slow evolved.\", (int)EvolvedIndex);\n CCTK_ERROR(\"The index passed does not correspond to a GF.\");\n }\n else if (timelevs == 1) \n {\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"Warning whilst trying to change variable \"\n \"index %i to slow evolved.\", (int)EvolvedIndex);\n CCTK_ERROR(\"The index passed only has a single timelevel.\");\n }\n timelevs = CCTK_DeclaredTimeLevelsVI(RHSIndex);\n if (timelevs < 1) {\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"Warning whilst trying to change variable \"\n \"index %i to slow evolved (RHS GF).\", (int)RHSIndex);\n CCTK_ERROR(\"The index passed does not correspond to a GF.\");\n }\n\n if (!(MoLNumEvolvedVariablesSlow < MoL_Num_Evolved_Vars_Slow))\n {\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"Warning whilst trying to change variable \"\n \"index %i (%s) to slow evolved.\", \n (int)EvolvedIndex, CCTK_VarName(EvolvedIndex));\n CCTK_ERROR(\"When changing type there are more variables \"\n \"than the accumulator parameter \"\n \"MoL_Num_Evolved_Vars_Slow allows. Check that \"\n \"you are accumulating onto this parameter correctly\");\n }\n\n EvolvedVariableIndexSlow[MoLNumEvolvedVariablesSlow] = EvolvedIndex;\n RHSVariableIndexSlow[MoLNumEvolvedVariablesSlow] = RHSIndex;\n MoLNumEvolvedVariablesSlow++;\n#ifdef MOLDEBUG\n printf(\"Changing (unknown): vars %d var %d (%s).\\n\",\n MoLNumEvolvedVariablesSlow, EvolvedIndex,\n CCTK_VarName(EvolvedIndex);\n#endif\n break;\n }\n \n case MOL_EVOLVED_VARTYPE:\n \n {\n timelevs = CCTK_DeclaredTimeLevelsVI(RHSIndex);\n if (timelevs < 1) {\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"Warning whilst trying to change variable \"\n \"index %i to slow evolved type from constrained.\",\n (int)RHSIndex);\n CCTK_ERROR(\"The RHS index passed does not correspond to a GF.\");\n }\n\n if (!(MoLNumEvolvedVariablesSlow < MoL_Num_Evolved_Vars_Slow))\n {\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"Warning whilst trying to change variable \"\n \"index %i (%s) to slow evolved.\", \n (int)EvolvedIndex, CCTK_VarName(EvolvedIndex));\n CCTK_ERROR(\"When changing type there are more variables \"\n \"than the accumulator parameter \"\n \"MoL_Num_Evolved_Vars_Slow allows. Check that \"\n \"you are accumulating onto this parameter correctly\");\n }\n\n for (index = usedindex; index < MoLNumEvolvedVariables - 1; \n index++)\n {\n EvolvedVariableIndex[index] = EvolvedVariableIndex[index+1];\n }\n MoLNumEvolvedVariables--;\n EvolvedVariableIndexSlow[MoLNumEvolvedVariablesSlow] = EvolvedIndex;\n RHSVariableIndexSlow[MoLNumEvolvedVariablesSlow] = RHSIndex;\n MoLNumEvolvedVariablesSlow++;\n#ifdef MOLDEBUG\n printf(\"Changing (constrained): vars %d var %d (%s).\\n\",\n MoLNumEvolvedVariablesSlow, EvolvedIndex,\n CCTK_VarName(EvolvedIndex);\n#endif\n break;\n }\n \n case MOL_EVOLVEDSLOW_VARTYPE:\n \n {\n RHSVariableIndex[usedindex] = RHSIndex;\n break;\n }\n\n case MOL_CONSTRAINED_VARTYPE:\n \n {\n timelevs = CCTK_DeclaredTimeLevelsVI(RHSIndex);\n if (timelevs < 1) {\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"Warning whilst trying to change variable \"\n \"index %i to slow evolved type from constrained.\",\n (int)RHSIndex);\n CCTK_ERROR(\"The RHS index passed does not correspond to a GF.\");\n }\n\n if (!(MoLNumEvolvedVariablesSlow < MoL_Num_Evolved_Vars_Slow))\n {\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"Warning whilst trying to change variable \"\n \"index %i (%s) to slow evolved.\", \n (int)EvolvedIndex, CCTK_VarName(EvolvedIndex));\n CCTK_ERROR(\"When changing type there are more variables \"\n \"than the accumulator parameter \"\n \"MoL_Num_Evolved_Vars_Slow allows. Check that \"\n \"you are accumulating onto this parameter correctly\");\n }\n\n for (index = usedindex; index < MoLNumConstrainedVariables - 1; \n index++)\n {\n ConstrainedVariableIndex[index] = ConstrainedVariableIndex[index+1];\n }\n MoLNumConstrainedVariables--;\n EvolvedVariableIndexSlow[MoLNumEvolvedVariablesSlow] = EvolvedIndex;\n RHSVariableIndexSlow[MoLNumEvolvedVariablesSlow] = RHSIndex;\n MoLNumEvolvedVariablesSlow++;\n#ifdef MOLDEBUG\n printf(\"Changing (constrained): vars %d var %d (%s).\\n\",\n MoLNumEvolvedVariables, EvolvedIndex,\n CCTK_VarName(EvolvedIndex);\n#endif\n break;\n }\n \n case MOL_SANDR_VARTYPE:\n \n {\n timelevs = CCTK_DeclaredTimeLevelsVI(RHSIndex);\n if (timelevs < 1) {\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"Warning whilst trying to change variable \"\n \"index %i to slow evolved type from save and \"\n \"restore.\", (int)RHSIndex);\n CCTK_ERROR(\"The RHS index passed does not correspond to a GF.\");\n }\n\n if (!(MoLNumEvolvedVariablesSlow < MoL_Num_Evolved_Vars_Slow))\n {\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"Warning whilst trying to change variable \"\n \"index %i (%s) to slow evolved.\", \n (int)EvolvedIndex, CCTK_VarName(EvolvedIndex));\n CCTK_ERROR(\"When changing type there are more variables \"\n \"than the accumulator parameter \"\n \"MoL_Num_Evolved_Vars_Slow allows. Check that \"\n \"you are accumulating onto this parameter correctly\");\n }\n\n for (index = usedindex; index < MoLNumSandRVariables - 1; index++)\n {\n SandRVariableIndex[index] = SandRVariableIndex[index+1];\n }\n MoLNumSandRVariables--;\n EvolvedVariableIndexSlow[MoLNumEvolvedVariablesSlow] = EvolvedIndex;\n RHSVariableIndexSlow[MoLNumEvolvedVariablesSlow] = RHSIndex;\n MoLNumEvolvedVariablesSlow++;\n#ifdef MOLDEBUG\n printf(\"Changing (SandR): vars %d var %d (%s).\\n\",\n MoLNumEvolvedVariablesSlow, EvolvedIndex,\n CCTK_VarName(EvolvedIndex);\n#endif\n break;\n }\n \n default:\n \n {\n CCTK_ERROR(\"Something is seriously wrong in ChangeType.c! \"\n \"Case out of range in switch statement.\");\n }\n \n }\n \n return 0;\n \n}\n\n /*@@\n @routine MoL_ChangeToConstrained\n @date Thu May 30 16:47:08 2002\n @author Ian Hawke\n @desc \n Changes a variable to be constrained.\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nCCTK_INT MoL_ChangeToConstrained(CCTK_INT ConstrainedIndex)\n{\n\n DECLARE_CCTK_PARAMETERS;\n\n CCTK_INT index, usedindex;\n CCTK_INT vartype; /* See the defines at the top of file */\n CCTK_INT timelevs;\n \n vartype = 0;\n usedindex = -1;\n\n timelevs = CCTK_DeclaredTimeLevelsVI(ConstrainedIndex);\n if (timelevs < 1)\n {\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"Warning whilst trying to change variable \"\n \"index %i to constrained.\", (int)ConstrainedIndex);\n CCTK_ERROR(\"The index passed does not correspond to a GF.\");\n }\n else if (timelevs == 1) \n {\n CCTK_VInfo(CCTK_THORNSTRING,\n \"MoL will not treat variable %s as a constrained \"\n \"variable as it has only one timelevel. This should \"\n \"not cause problems with the evolution.\", \n CCTK_VarName(ConstrainedIndex));\n }\n \n for (index = 0; (index < MoLNumEvolvedVariables)&&(!vartype); index++)\n {\n vartype = MOL_EVOLVED_VARTYPE * \n (EvolvedVariableIndex[index] == ConstrainedIndex);\n if (vartype)\n {\n usedindex = index;\n }\n }\n \n for (index = 0; (index < MoLNumEvolvedVariablesSlow)&&(!vartype); index++)\n {\n vartype = MOL_EVOLVEDSLOW_VARTYPE * \n (EvolvedVariableIndexSlow[index] == ConstrainedIndex);\n if (vartype)\n {\n usedindex = index;\n }\n }\n \n for (index = 0; (index < MoLNumConstrainedVariables)&&(!vartype); index++)\n {\n vartype = MOL_CONSTRAINED_VARTYPE * \n (ConstrainedVariableIndex[index] == ConstrainedIndex);\n if (vartype)\n {\n usedindex = index;\n }\n }\n \n for (index = 0; (index < MoLNumSandRVariables)&&(!vartype); index++)\n {\n vartype = MOL_SANDR_VARTYPE * \n (SandRVariableIndex[index] == ConstrainedIndex);\n if (vartype)\n {\n usedindex = index;\n }\n }\n\n switch (vartype)\n {\n \n case MOL_UNKNOWN_VARTYPE:\n\n {\n if (timelevs > 1)\n {\n\n if ( !(MoLNumConstrainedVariables < MoLMaxNumRegisteredVariables))\n {\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"Warning whilst trying to change variable \"\n \"index %i (%s) to constrained.\", \n (int)ConstrainedIndex, CCTK_VarName(ConstrainedIndex));\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"When changing type there are more than %d variables. \"\n \" Since this should be the total number of Cactus \"\n \"variables, this looks like a bug.\",\n (int)MoLMaxNumRegisteredVariables);\n }\n\n ConstrainedVariableIndex[MoLNumConstrainedVariables] = \n ConstrainedIndex;\n MoLNumConstrainedVariables++;\n }\n break;\n }\n \n case MOL_EVOLVED_VARTYPE:\n \n {\n for (index = usedindex; index < MoLNumEvolvedVariables - 1; index++)\n {\n EvolvedVariableIndex[index] = EvolvedVariableIndex[index+1];\n RHSVariableIndex[index] = RHSVariableIndex[index+1];\n }\n MoLNumEvolvedVariables--;\n if (timelevs > 1)\n {\n if ( !(MoLNumConstrainedVariables < MoLMaxNumRegisteredVariables))\n {\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"Warning whilst trying to change variable \"\n \"index %i (%s) to constrained.\", \n (int)ConstrainedIndex, CCTK_VarName(ConstrainedIndex));\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"When changing type there are more than %d variables. \"\n \" Since this should be the total number of Cactus \"\n \"variables, this looks like a bug.\",\n (int)MoLMaxNumRegisteredVariables);\n }\n ConstrainedVariableIndex[MoLNumConstrainedVariables] = ConstrainedIndex;\n MoLNumConstrainedVariables++;\n }\n break;\n }\n\n case MOL_EVOLVEDSLOW_VARTYPE:\n \n {\n for (index = usedindex; index < MoLNumEvolvedVariablesSlow - 1; index++)\n {\n EvolvedVariableIndex[index] = EvolvedVariableIndex[index+1];\n RHSVariableIndex[index] = RHSVariableIndex[index+1];\n }\n MoLNumEvolvedVariablesSlow--;\n if (timelevs > 1)\n {\n if ( !(MoLNumConstrainedVariables < MoL_Num_Constrained_Vars))\n {\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"Warning whilst trying to change variable \"\n \"index %i (%s) to constrained.\", \n (int)ConstrainedIndex, CCTK_VarName(ConstrainedIndex));\n CCTK_ERROR(\"When changing type there are more variables \"\n \"than the accumulator parameter \"\n \"MoL_Num_Constrained_Vars allows. Check that \"\n \"you are accumulating onto this parameter correctly\");\n }\n ConstrainedVariableIndex[MoLNumConstrainedVariables] = ConstrainedIndex;\n MoLNumConstrainedVariables++;\n }\n break;\n }\n\n case MOL_CONSTRAINED_VARTYPE:\n \n {\n break;\n }\n \n case MOL_SANDR_VARTYPE:\n \n {\n for (index = usedindex; index < MoLNumSandRVariables - 1; index++)\n {\n SandRVariableIndex[index] = SandRVariableIndex[index+1];\n }\n MoLNumSandRVariables--;\n if (timelevs > 1)\n {\n if ( !(MoLNumConstrainedVariables < MoLMaxNumRegisteredVariables))\n {\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"Warning whilst trying to change variable \"\n \"index %i (%s) to constrained.\", \n (int)ConstrainedIndex, CCTK_VarName(ConstrainedIndex));\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"When changing type there are more than %d variables. \"\n \" Since this should be the total number of Cactus \"\n \"variables, this looks like a bug.\",\n (int)MoLMaxNumRegisteredVariables);\n }\n ConstrainedVariableIndex[MoLNumConstrainedVariables] = ConstrainedIndex;\n MoLNumConstrainedVariables++;\n }\n break;\n }\n \n default:\n \n {\n CCTK_ERROR(\"Something is seriously wrong in ChangeType.c! \"\n \"Case out of range in switch statement.\");\n }\n \n }\n \n return 0;\n \n}\n\n /*@@\n @routine MoL_ChangeToSaveAndRestore\n @date Thu May 30 16:50:36 2002\n @author Ian Hawke\n @desc \n Changes the variable type to save and restore.\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nCCTK_INT MoL_ChangeToSaveAndRestore(CCTK_INT SandRIndex)\n{\n\n DECLARE_CCTK_PARAMETERS;\n\n CCTK_INT index, usedindex;\n CCTK_INT vartype; /* See the defines at the top of file */\n CCTK_INT timelevs;\n \n vartype = 0;\n usedindex = -1;\n\n timelevs = CCTK_DeclaredTimeLevelsVI(SandRIndex);\n if (timelevs < 1)\n {\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"Warning whilst trying to change variable \"\n \"index %i to save and restore.\", (int)SandRIndex);\n CCTK_ERROR(\"The index passed does not correspond to a GF.\");\n }\n \n for (index = 0; (index < MoLNumEvolvedVariables)&&(!vartype); index++)\n {\n vartype = MOL_EVOLVED_VARTYPE * \n (EvolvedVariableIndex[index] == SandRIndex);\n if (vartype)\n {\n usedindex = index;\n }\n }\n \n for (index = 0; (index < MoLNumEvolvedVariablesSlow)&&(!vartype); index++)\n {\n vartype = MOL_EVOLVEDSLOW_VARTYPE * \n (EvolvedVariableIndexSlow[index] == SandRIndex);\n if (vartype)\n {\n usedindex = index;\n }\n }\n \n for (index = 0; (index < MoLNumConstrainedVariables)&&(!vartype); index++)\n {\n vartype = MOL_CONSTRAINED_VARTYPE * \n (ConstrainedVariableIndex[index] == SandRIndex);\n if (vartype)\n {\n usedindex = index;\n }\n }\n \n for (index = 0; (index < MoLNumSandRVariables)&&(!vartype); index++)\n {\n vartype = MOL_SANDR_VARTYPE * \n (SandRVariableIndex[index] == SandRIndex);\n if (vartype)\n {\n usedindex = index;\n }\n }\n\n switch (vartype)\n {\n \n case MOL_UNKNOWN_VARTYPE:\n\n {\n\n if (!(MoLNumSandRVariables < MoLMaxNumRegisteredVariables))\n {\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"Warning whilst trying to change variable \"\n \"index %i (%s) to save and restore.\", \n (int)SandRIndex, CCTK_VarName(SandRIndex));\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"When changing type there are more than %d variables. \"\n \" Since this should be the total number of Cactus \"\n \"variables, this looks like a bug.\",\n (int)MoLMaxNumRegisteredVariables);\n }\n SandRVariableIndex[MoLNumSandRVariables] = SandRIndex;\n MoLNumSandRVariables++;\n break;\n }\n \n case MOL_EVOLVED_VARTYPE:\n \n {\n\n if (!(MoLNumSandRVariables < MoLMaxNumRegisteredVariables))\n {\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"Warning whilst trying to change variable \"\n \"index %i (%s) to save and restore.\", \n (int)SandRIndex, CCTK_VarName(SandRIndex));\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"When changing type there are more than %d variables. \"\n \" Since this should be the total number of Cactus \"\n \"variables, this looks like a bug.\",\n (int)MoLMaxNumRegisteredVariables);\n }\n for (index = usedindex; index < MoLNumEvolvedVariables - 1; index++)\n {\n EvolvedVariableIndex[index] = EvolvedVariableIndex[index+1];\n RHSVariableIndex[index] = RHSVariableIndex[index+1];\n }\n MoLNumEvolvedVariables--;\n SandRVariableIndex[MoLNumSandRVariables] = SandRIndex;\n MoLNumSandRVariables++;\n break;\n }\n\n case MOL_EVOLVEDSLOW_VARTYPE:\n \n {\n\n if (!(MoLNumSandRVariables < MoL_Num_SaveAndRestore_Vars))\n {\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"Warning whilst trying to change variable \"\n \"index %i (%s) to save and restore.\", \n (int)SandRIndex, CCTK_VarName(SandRIndex));\n CCTK_ERROR(\"When changing type there are more variables \"\n \"than the accumulator parameter \"\n \"MoL_Num_SaveAndRestore_Vars allows. Check that \"\n \"you are accumulating onto this parameter correctly\");\n }\n for (index = usedindex; index < MoLNumEvolvedVariablesSlow - 1; index++)\n {\n EvolvedVariableIndex[index] = EvolvedVariableIndex[index+1];\n RHSVariableIndex[index] = RHSVariableIndex[index+1];\n }\n MoLNumEvolvedVariablesSlow--;\n SandRVariableIndex[MoLNumSandRVariables] = SandRIndex;\n MoLNumSandRVariables++;\n break;\n }\n\n case MOL_CONSTRAINED_VARTYPE:\n \n {\n\n if (!(MoLNumSandRVariables < MoLMaxNumRegisteredVariables))\n {\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"Warning whilst trying to change variable \"\n \"index %i (%s) to save and restore.\", \n (int)SandRIndex, CCTK_VarName(SandRIndex));\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"When changing type there are more than %d variables. \"\n \" Since this should be the total number of Cactus \"\n \"variables, this looks like a bug.\",\n (int)MoLMaxNumRegisteredVariables);\n }\n for (index = usedindex; index < MoLNumConstrainedVariables -\n 1; \n index++)\n {\n ConstrainedVariableIndex[index] = ConstrainedVariableIndex[index+1];\n }\n MoLNumConstrainedVariables--;\n SandRVariableIndex[MoLNumSandRVariables] = SandRIndex;\n MoLNumSandRVariables++;\n break;\n }\n \n case MOL_SANDR_VARTYPE:\n \n {\n break;\n }\n \n default:\n \n {\n CCTK_ERROR(\"Something is seriously wrong in ChangeType.c! \"\n \"Case out of range in switch statement.\");\n }\n \n }\n \n return 0;\n \n}\n\n /*@@\n @routine MoL_ChangeToNone\n @date Thu May 30 16:53:46 2002\n @author Ian Hawke\n @desc \n Changes a variable type to none (i.e., MoL no longer considers it).\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nCCTK_INT MoL_ChangeToNone(CCTK_INT RemoveIndex)\n{\n\n CCTK_INT index, usedindex;\n CCTK_INT vartype; /* See the defines at the top of file */\n/* CCTK_INT timelevs; */\n \n vartype = 0;\n usedindex = -1;\n \n for (index = 0; (index < MoLNumEvolvedVariables)&&(!vartype); index++)\n {\n vartype = MOL_EVOLVED_VARTYPE * \n (EvolvedVariableIndex[index] == RemoveIndex);\n if (vartype)\n {\n usedindex = index;\n }\n }\n \n for (index = 0; (index < MoLNumEvolvedVariablesSlow)&&(!vartype); index++)\n {\n vartype = MOL_EVOLVEDSLOW_VARTYPE * \n (EvolvedVariableIndexSlow[index] == RemoveIndex);\n if (vartype)\n {\n usedindex = index;\n }\n }\n \n for (index = 0; (index < MoLNumConstrainedVariables)&&(!vartype); index++)\n {\n vartype = MOL_CONSTRAINED_VARTYPE * \n (ConstrainedVariableIndex[index] == RemoveIndex);\n if (vartype)\n {\n usedindex = index;\n }\n }\n \n for (index = 0; (index < MoLNumSandRVariables)&&(!vartype); index++)\n {\n vartype = MOL_SANDR_VARTYPE * \n (SandRVariableIndex[index] == RemoveIndex);\n if (vartype)\n {\n usedindex = index;\n }\n }\n\n switch (vartype)\n {\n \n case MOL_UNKNOWN_VARTYPE:\n\n {\n break;\n }\n \n case MOL_EVOLVED_VARTYPE:\n \n {\n for (index = usedindex; index < MoLNumEvolvedVariables - 1; index++)\n {\n EvolvedVariableIndex[index] = EvolvedVariableIndex[index+1];\n RHSVariableIndex[index] = RHSVariableIndex[index+1];\n }\n MoLNumEvolvedVariables--;\n break;\n }\n\n case MOL_EVOLVEDSLOW_VARTYPE:\n \n {\n for (index = usedindex; index < MoLNumEvolvedVariablesSlow - 1; index++)\n {\n EvolvedVariableIndex[index] = EvolvedVariableIndex[index+1];\n RHSVariableIndex[index] = RHSVariableIndex[index+1];\n }\n MoLNumEvolvedVariablesSlow--;\n break;\n }\n\n case MOL_CONSTRAINED_VARTYPE:\n \n {\n for (index = usedindex; index < MoLNumConstrainedVariables - 1; \n index++)\n {\n ConstrainedVariableIndex[index] = ConstrainedVariableIndex[index+1];\n }\n MoLNumConstrainedVariables--;\n break;\n }\n \n case MOL_SANDR_VARTYPE:\n \n {\n for (index = usedindex; index < MoLNumSandRVariables - 1; index++)\n {\n SandRVariableIndex[index] = SandRVariableIndex[index+1];\n }\n MoLNumSandRVariables--;\n break;\n }\n \n default:\n \n {\n CCTK_ERROR(\"Something is seriously wrong in ChangeType.c! \"\n \"Case out of range in switch statement.\");\n }\n \n }\n \n return 0;\n \n}\n\n/********************************************************************\n ********************* Local Routines *************************\n ********************************************************************/\n", |
| "RK2.c": " /*@@\n @file RK2.c\n @date Sun May 26 04:13:45 2002\n @author Ian Hawke\n @desc \n A specialized second order Runge-Kutta time integrator. This is\n the integrator that Shu refers to as the optimal TVD second \n order method (see reference in documentation). It is equivalent\n to Heun's predictor-corrector method, or the MacCormack method.\n @enddesc \n @version $Header$\n @@*/\n\n#include \"cctk.h\"\n#include \"cctk_Arguments.h\"\n#include \"cctk_Parameters.h\"\n\n#include \"ExternalVariables.h\"\n#include \"Operators.h\"\n\nstatic const char *rcsid = \"$Header$\";\n\nCCTK_FILEVERSION(CactusBase_MoL_RK2_c);\n\n/********************************************************************\n ********************* Local Data Types ***********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Local Routine Prototypes *********************\n ********************************************************************/\n\n/********************************************************************\n ***************** Scheduled Routine Prototypes *********************\n ********************************************************************/\n\nvoid MoL_RK2Add(CCTK_ARGUMENTS);\n\n/********************************************************************\n ********************* Other Routine Prototypes *********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Local Data *****************************\n ********************************************************************/\n\n/********************************************************************\n ********************* External Routines **********************\n ********************************************************************/\n\n /*@@\n @routine MoL_RK2Add\n @date Sun May 26 04:17:23 2002\n @author Ian Hawke\n @desc \n Performs second order Runge-Kutta time integration.\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nvoid MoL_RK2Add(CCTK_ARGUMENTS)\n{\n\n DECLARE_CCTK_ARGUMENTS_CHECKED(MoL_RK2Add)\n DECLARE_CCTK_PARAMETERS;\n\n CCTK_INT arraydim;\n \n CCTK_INT var;\n CCTK_INT totalsize;\n \n#ifdef MOLDEBUG\n printf(\"Inside RK2.\\nStep %d.\\nRefinement %d.\\nTimestep %g.\\n\"\n \"Spacestep %g.\\nTime %g\\n\",\n MoL_Intermediate_Steps - *MoL_Intermediate_Step + 1,\n *cctk_levfac,\n CCTK_DELTA_TIME,\n CCTK_DELTA_SPACE(0),\n cctk_time);\n#endif \n\n totalsize = 1;\n for (arraydim = 0; arraydim < cctk_dim; arraydim++)\n {\n totalsize *= cctk_ash[arraydim];\n }\n\n CCTK_INT rl = 0;\n if (CCTK_IsFunctionAliased(\"GetRefinementLevel\")) {\n rl = GetRefinementLevel(cctkGH);\n }\n CCTK_INT tl = 0;\n \n switch (*MoL_Intermediate_Step)\n {\n \n case 2:\n {\n for (var = 0; var < MoLNumEvolvedVariables; var++)\n {\n int const nsrcs = 1;\n CCTK_INT const srcs[] = {RHSVariableIndex[var]};\n CCTK_INT const tls[] = {0};\n CCTK_REAL const facts[] = {CCTK_DELTA_TIME};\n MoL_LinearCombination(cctkGH,\n EvolvedVariableIndex[var], rl, tl, 1.0,\n srcs, tls, facts, nsrcs);\n }\n\n for (var = 0; var < MoLNumEvolvedArrayVariables; var++)\n {\n int const nsrcs = 1;\n CCTK_INT const srcs[] = {RHSArrayVariableIndex[var]};\n CCTK_INT const tls[] = {0};\n CCTK_REAL const facts[] = {CCTK_DELTA_TIME};\n MoL_LinearCombination(cctkGH,\n EvolvedArrayVariableIndex[var], rl, tl, 1.0,\n srcs, tls, facts, nsrcs);\n }\n\n break;\n }\n case 1:\n {\n for (var = 0; var < MoLNumEvolvedVariables; var++)\n {\n int const nsrcs = 2;\n CCTK_INT const srcs[] =\n {EvolvedVariableIndex[var], RHSVariableIndex[var]};\n CCTK_INT const tls[] = {1, 0};\n CCTK_REAL const facts[] = {0.5, CCTK_DELTA_TIME};\n MoL_LinearCombination(cctkGH,\n EvolvedVariableIndex[var], rl, tl, 0.5,\n srcs, tls, facts, nsrcs);\n }\n\n for (var = 0; var < MoLNumEvolvedArrayVariables; var++)\n {\n int const nsrcs = 2;\n CCTK_INT const srcs[] =\n {EvolvedArrayVariableIndex[var], RHSArrayVariableIndex[var]};\n CCTK_INT const tls[] = {1, 0};\n CCTK_REAL const facts[] = {0.5, CCTK_DELTA_TIME};\n MoL_LinearCombination(cctkGH,\n EvolvedArrayVariableIndex[var], rl, tl, 0.5,\n srcs, tls, facts, nsrcs);\n }\n\n break;\n }\n default:\n {\n CCTK_ERROR(\"RK2 expects MoL_Intermediate_Step to be \"\n \"in [1,2]. This should be caught at ParamCheck - \"\n \"bug Ian!\");\n break;\n }\n \n }\n\n return;\n\n}\n\n/********************************************************************\n ********************* Local Routines *************************\n ********************************************************************/\n", |
| "ParamCheck.c": " /*@@\n @file ParamCheck.c\n @date Mon May 20 09:50:55 2002\n @author Ian Hawke\n @desc \n Basic parameter checking for thorn MoL.\n @enddesc \n @version $Header$\n @@*/\n\n#include \"cctk.h\"\n#include \"cctk_Arguments.h\"\n#include \"cctk_Parameters.h\"\n\n#include \"util_ErrorCodes.h\"\n#include \"util_Table.h\"\n\nstatic const char *rcsid = \"$Header$\";\n\nCCTK_FILEVERSION(CactusBase_MoL_ParamCheck_c);\n\n/********************************************************************\n ********************* Local Data Types ***********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Local Routine Prototypes *********************\n ********************************************************************/\n\n/********************************************************************\n ***************** Scheduled Routine Prototypes *********************\n ********************************************************************/\n\nvoid MoL_ParamCheck(CCTK_ARGUMENTS);\n\n/********************************************************************\n ********************* Other Routine Prototypes *********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Local Data *****************************\n ********************************************************************/\n\n/********************************************************************\n ********************* External Routines **********************\n ********************************************************************/\n\n /*@@\n @routine MoL_ParamCheck\n @date Mon May 20 09:56:05 2002\n @author Ian Hawke\n @desc \n Basic parameter checking.\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nvoid MoL_ParamCheck(CCTK_ARGUMENTS)\n{\n DECLARE_CCTK_PARAMETERS;\n\n CCTK_INT options_table, ierr, GenericIntermediateSteps;\n\n if (CCTK_Equals(ODE_Method, \"Generic\"))\n {\n if (MoL_Num_Scratch_Levels < MoL_Intermediate_Steps - 1)\n {\n CCTK_PARAMWARN(\"When using a generic solver the number \"\n \"of scratch levels must be at least the \"\n \"number of intermediate steps - 1\");\n }\n if ( (CCTK_Equals(Generic_Type, \"Classic RK3\"))&&\n ((!(MoL_Intermediate_Steps == 3))||(!(MoL_Num_Scratch_Levels > 1))) )\n {\n CCTK_PARAMWARN(\"When using the classic RK3 evolver the \"\n \"number of intermediate steps must be 3 \"\n \"and the number of scratch levels at least 2\");\n }\n if (CCTK_Equals(Generic_Type, \"Table\"))\n {\n options_table =\n Util_TableCreateFromString(Generic_Method_Descriptor);\n if (options_table < 0)\n {\n CCTK_ERROR(\"Failed to create table from \"\n \"Generic_Method_Descriptor!\");\n }\n ierr = Util_TableGetInt(options_table,\n &GenericIntermediateSteps,\n \"GenericIntermediateSteps\");\n if (ierr < 1)\n {\n if (ierr == UTIL_ERROR_TABLE_NO_SUCH_KEY)\n {\n CCTK_ERROR(\"When using the generic table options \"\n \"you must set \\\"GenericIntermediateSteps\\\" in \"\n \"the options table\");\n }\n else\n {\n CCTK_ERROR(\"Table error - check with Ian.\");\n }\n }\n if (MoL_Intermediate_Steps != GenericIntermediateSteps)\n {\n CCTK_PARAMWARN(\"The number of intermediate steps must \"\n \"equal the number specified in the table options!\");\n }\n ierr = Util_TableDestroy(options_table);\n }\n }\n\n if ( (CCTK_Equals(ODE_Method, \"Euler\"))&&(!(MoL_Intermediate_Steps == 1)) )\n {\n CCTK_PARAMWARN(\"When using the Euler evolver the \"\n \"number of intermediate steps must be 1\");\n }\n\n if ( (CCTK_Equals(ODE_Method, \"RK2\"))&&(!(MoL_Intermediate_Steps == 2)) )\n {\n CCTK_PARAMWARN(\"When using the efficient RK2 evolver the \"\n \"number of intermediate steps must be 2\");\n }\n\n if ( (CCTK_Equals(ODE_Method, \"RK2-central\"))&&(!(MoL_Intermediate_Steps == 2)) )\n {\n CCTK_PARAMWARN(\"When using the efficient RK2 evolver the \"\n \"number of intermediate steps must be 2\");\n }\n\n if ( (CCTK_Equals(ODE_Method, \"RK3\"))&&(!(MoL_Intermediate_Steps == 3)) )\n {\n CCTK_PARAMWARN(\"When using the efficient RK3 evolver the \"\n \"number of intermediate steps must be 3\");\n }\n\n if ( (CCTK_Equals(ODE_Method, \"RK4\")) && ( (!(MoL_Intermediate_Steps == 4))\n || (!(MoL_Num_Scratch_Levels > 0)) ) )\n {\n CCTK_PARAMWARN(\"When using the efficient RK4 evolver the \"\n \"number of intermediate steps must be 4, and\"\n \" the number of scratch levels at least 1\");\n }\n\n if ( (CCTK_Equals(ODE_Method, \"RK45\") || CCTK_Equals(ODE_Method, \"RK45CK\")) &&\n ( !((MoL_Intermediate_Steps == 6)&&(MoL_Num_Scratch_Levels > 5)) ) )\n {\n CCTK_PARAMWARN(\"When using the RK45 or RK45CK evolver, the \"\n \"number of intermediate steps must be 6 \" \n \"and the number of scratch levels at least 6.\");\n }\n\n if ( (CCTK_Equals(ODE_Method, \"RK65\")) &&\n ( !((MoL_Intermediate_Steps == 8)&&(MoL_Num_Scratch_Levels > 7)) ) )\n {\n CCTK_PARAMWARN(\"When using the RK65 evolver the \"\n \"number of intermediate steps must be 8 \" \n \"and the number of scratch levels at least 8.\");\n }\n\n if ( (CCTK_Equals(ODE_Method, \"RK87\")) &&\n ( !((MoL_Intermediate_Steps == 13)&&(MoL_Num_Scratch_Levels > 12)) ) )\n {\n CCTK_PARAMWARN(\"When using the RK87 evolver the \"\n \"number of intermediate steps must be 13 \" \n \"and the number of scratch levels at least 13.\");\n }\n \n if ( (CCTK_Equals(ODE_Method, \"AB\"))&&(!(MoL_Intermediate_Steps == 1)) )\n {\n CCTK_PARAMWARN(\"When using the Adams-Bashforth evolver the \"\n \"number of intermediate steps must be 1\");\n }\n\n if ( CCTK_Equals(ODE_Method, \"RK2-MR-2:1\") )\n {\n if ( !((MoL_Intermediate_Steps == 5) && (MoL_Num_Scratch_Levels > 4)) )\n {\n CCTK_PARAMWARN(\"When using the multirate 2-1 RK2 evolver the \"\n \"number of intermediate steps must be 5 and the number of scratch levels at least 5\");\n }\n if (init_RHS_zero)\n {\n CCTK_PARAMWARN(\"When using the multirate 2-1 RK2 evolver the \"\n \"parameter MoL::init_RHS_zero must be set to 'no'.\");\n }\n }\n\n if ( CCTK_Equals(ODE_Method, \"RK4-MR-2:1\") )\n {\n if ( !((MoL_Intermediate_Steps == 10) && (MoL_Num_Scratch_Levels > 9)) )\n {\n CCTK_PARAMWARN(\"When using the multirate 2-1 RK4 evolver the \"\n \"number of intermediate steps must be 10 and the number of scratch levels at least 10\");\n }\n if (init_RHS_zero)\n {\n CCTK_PARAMWARN(\"When using the multirate 2-1 RK4 evolver the \"\n \"parameter MoL::init_RHS_zero must be set to 'no'.\");\n }\n }\n\n if ( (CCTK_Equals(ODE_Method, \"RK4-RK2\"))&&\n ( !((MoL_Intermediate_Steps == 4) && (MoL_Num_Scratch_Levels > 0))) )\n {\n CCTK_PARAMWARN(\"When using the multirate RK4-RK2 evolver the \"\n \"number of intermediate steps must be 4 and the number of scratch levels at least 1\");\n }\n\n if (adaptive_stepsize)\n {\n if (CCTK_Equals(ODE_Method, \"RK45\")||CCTK_Equals(ODE_Method, \"RK45CK\")||CCTK_Equals(ODE_Method, \"RK65\")||CCTK_Equals(ODE_Method, \"RK87\"))\n {\n /* everything is fine, do nothing */\n }\n else\n {\n CCTK_PARAMWARN(\"Adaptive time step sizes are only possible with the RK45, RK45CK, RK65, and RK87 solvers\");\n }\n }\n}\n\n/********************************************************************\n ********************* Local Routines *************************\n ********************************************************************/\n", |
| "RK2-central.c": "/*@@\n @file RK2-central.c\n @date 2016-01-01\n @author Erik Schnetter\n @desc\n A specialized second order Runge-Kutta time integrator. This is the\n \"central\" RK2 method where the first step is taken to 1/2 the final\n step size.\n @enddesc\n @version $Header$\n@@*/\n\n#include \"cctk.h\"\n#include \"cctk_Arguments.h\"\n#include \"cctk_Parameters.h\"\n\n#include \"ExternalVariables.h\"\n#include \"Operators.h\"\n\nstatic const char *rcsid = \"$Header$\";\n\nCCTK_FILEVERSION(CactusBase_MoL_RK2_central_c);\n\n/********************************************************************\n ********************* Local Data Types ***********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Local Routine Prototypes *********************\n ********************************************************************/\n\n/********************************************************************\n ***************** Scheduled Routine Prototypes *********************\n ********************************************************************/\n\nvoid MoL_RK2CentralAdd(CCTK_ARGUMENTS);\n\n/********************************************************************\n ********************* Other Routine Prototypes *********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Local Data *****************************\n ********************************************************************/\n\n/********************************************************************\n ********************* External Routines **********************\n ********************************************************************/\n\n/*@@\n @routine MoL_RK2CentralAdd\n @date Fri Jan 1 00:00:00 2016\n @author Erik Schnetter\n @desc\n Performs second order Runge-Kutta time integration.\n @enddesc\n @calls\n @calledby\n @history\n\n @endhistory\n\n@@*/\n\nvoid MoL_RK2CentralAdd(CCTK_ARGUMENTS) {\n\n DECLARE_CCTK_ARGUMENTS_CHECKED(MoL_RK2CentralAdd)\n DECLARE_CCTK_PARAMETERS;\n\n CCTK_INT arraydim;\n\n CCTK_INT var;\n CCTK_INT totalsize;\n\n#ifdef MOLDEBUG\n printf(\"Inside RK2.\\nStep %d.\\nRefinement %d.\\nTimestep %g.\\n\"\n \"Spacestep %g.\\nTime %g\\n\",\n MoL_Intermediate_Steps - *MoL_Intermediate_Step + 1, *cctk_levfac,\n CCTK_DELTA_TIME, CCTK_DELTA_SPACE(0), cctk_time);\n#endif\n\n totalsize = 1;\n for (arraydim = 0; arraydim < cctk_dim; arraydim++) {\n totalsize *= cctk_ash[arraydim];\n }\n\n CCTK_INT rl = 0;\n if (CCTK_IsFunctionAliased(\"GetRefinementLevel\")) {\n rl = GetRefinementLevel(cctkGH);\n }\n CCTK_INT tl = 0;\n\n switch (*MoL_Intermediate_Step) {\n\n case 2: {\n for (var = 0; var < MoLNumEvolvedVariables; var++) {\n int const nsrcs = 1;\n CCTK_INT const srcs[] = {RHSVariableIndex[var]};\n CCTK_INT const tls[] = {0};\n CCTK_REAL const facts[] = {0.5 * (*Original_Delta_Time) /\n cctkGH->cctk_timefac};\n MoL_LinearCombination(cctkGH, EvolvedVariableIndex[var], rl, tl, 1.0,\n srcs, tls, facts, nsrcs);\n }\n\n for (var = 0; var < MoLNumEvolvedArrayVariables; var++) {\n int const nsrcs = 1;\n CCTK_INT const srcs[] = {RHSArrayVariableIndex[var]};\n CCTK_INT const tls[] = {0};\n CCTK_REAL const facts[] = {0.5 * (*Original_Delta_Time) /\n cctkGH->cctk_timefac};\n MoL_LinearCombination(cctkGH, EvolvedArrayVariableIndex[var], rl, tl, 1.0,\n srcs, tls, facts, nsrcs);\n }\n\n break;\n }\n case 1: {\n for (var = 0; var < MoLNumEvolvedVariables; var++) {\n int const nsrcs = 2;\n CCTK_INT const srcs[] = {EvolvedVariableIndex[var],\n RHSVariableIndex[var]};\n CCTK_INT const tls[] = {1, 0};\n CCTK_REAL const facts[] = {1.0,\n (*Original_Delta_Time) / cctkGH->cctk_timefac};\n MoL_LinearCombination(cctkGH, EvolvedVariableIndex[var], rl, tl, 0.0,\n srcs, tls, facts, nsrcs);\n }\n\n for (var = 0; var < MoLNumEvolvedArrayVariables; var++) {\n int const nsrcs = 2;\n CCTK_INT const srcs[] = {EvolvedArrayVariableIndex[var],\n RHSArrayVariableIndex[var]};\n CCTK_INT const tls[] = {1, 0};\n CCTK_REAL const facts[] = {1.0,\n (*Original_Delta_Time) / cctkGH->cctk_timefac};\n MoL_LinearCombination(cctkGH, EvolvedArrayVariableIndex[var], rl, tl, 0.0,\n srcs, tls, facts, nsrcs);\n }\n\n break;\n }\n default: {\n CCTK_ERROR(\"RK2-central expects MoL_Intermediate_Step to be in [1,2]\");\n break;\n }\n }\n\n return;\n}\n\n/********************************************************************\n ********************* Local Routines *************************\n ********************************************************************/\n", |
| "RK4.c": " /*@@\n @file RK4.c\n @date Fri July 14, 2006\n @author Yosef Zlochower\n @desc \n A routine to perform RK4 evolution. Mostly copied from\n genericRK.c\n @enddesc \n @version $Header$\n @@*/\n\n#include \"cctk.h\"\n#include \"cctk_Arguments.h\"\n#include \"cctk_Parameters.h\"\n\n#include \"ExternalVariables.h\"\n#include \"Operators.h\"\n\nstatic const char *rcsid = \"$Header$\";\n\nCCTK_FILEVERSION(CactusBase_MoL_RK4_c);\n\n/********************************************************************\n ********************* Local Data Types ***********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Local Routine Prototypes *********************\n ********************************************************************/\n\n/********************************************************************\n ***************** Scheduled Routine Prototypes *********************\n ********************************************************************/\n\nvoid MoL_RK4Add(CCTK_ARGUMENTS);\n\n/********************************************************************\n ********************* Other Routine Prototypes *********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Local Data *****************************\n ********************************************************************/\n\n/********************************************************************\n ********************* External Routines **********************\n ********************************************************************/\n\n /*@@\n @routine MoL_RK4Add\n @date \n @author \n @desc \n Performs a single step of a RK4 type time\n integration.\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nvoid MoL_RK4Add(CCTK_ARGUMENTS)\n{\n\n DECLARE_CCTK_ARGUMENTS_CHECKED(MoL_RK4Add);\n DECLARE_CCTK_PARAMETERS;\n \n cGroupDynamicData arraydata;\n CCTK_INT groupindex, ierr;\n CCTK_INT arraytotalsize, arraydim;\n\n static CCTK_INT scratchspace_firstindex = -99;\n CCTK_INT index, var;\n CCTK_INT totalsize;\n CCTK_REAL alpha, beta;\n CCTK_REAL * restrict UpdateVar;\n CCTK_REAL * restrict OldVar;\n CCTK_REAL const * restrict RHSVar;\n CCTK_REAL * restrict ScratchVar;\n\n CCTK_INT arrayscratchlocation;\n\n /* Keep a running total of alpha as we perform the substeps, so that\n we know the \"real\" alpha (including round-off errors) when we\n calculate the final result. */\n CCTK_REAL const time_rhs = 1.0;\n CCTK_REAL const old_time = 0.0;\n static CCTK_REAL time, scratch_time;\n \n totalsize = 1;\n for (arraydim = 0; arraydim < cctk_dim; arraydim++)\n {\n totalsize *= cctk_ash[arraydim];\n }\n\n if (scratchspace_firstindex == -99)\n {\n scratchspace_firstindex = CCTK_FirstVarIndex(\"MOL::SCRATCHSPACE\");\n }\n\n switch (MoL_Intermediate_Steps - (*MoL_Intermediate_Step))\n {\n case 0:\n alpha = 1.0 / 3.0;\n beta = 1.0 / 2.0;\n break;\n case 1:\n alpha = 2.0 / 3.0;\n beta = 1.0 / 2.0;\n break;\n case 2:\n alpha = 1.0 / 3.0;\n beta = 1.0;\n break;\n case 3:\n alpha = 1.0;\n beta = 1.0 / 6.0;\n break;\n default:\n CCTK_VERROR(\"Internal error. Unexpected substep %d\", (int)*MoL_Intermediate_Step);\n break;\n }\n\n if (MoL_Intermediate_Steps == (*MoL_Intermediate_Step))\n {\n time = 0.0;\n }\n \n /* Real GFs */\n\n CCTK_INT rl = 0;\n if (CCTK_IsFunctionAliased(\"GetRefinementLevel\")) {\n rl = GetRefinementLevel(cctkGH);\n }\n CCTK_INT tl = 0;\n \n for (var = 0; var < MoLNumEvolvedVariables; var++)\n {\n {\n int const nsrcs = 2;\n CCTK_INT const srcs[] =\n {EvolvedVariableIndex[var], RHSVariableIndex[var]};\n CCTK_INT const tls[] = {1, 0};\n CCTK_REAL const facts[] =\n {1.0, (*Original_Delta_Time) / cctkGH->cctk_timefac * beta};\n MoL_LinearCombination(cctkGH,\n EvolvedVariableIndex[var], rl, tl, 0.0,\n srcs, tls, facts, nsrcs);\n time = facts[0] * old_time + facts[1] * time_rhs;\n }\n\n /* scratch storage */\n if ((*MoL_Intermediate_Step) == MoL_Intermediate_Steps)\n {\n MoL_LinearCombination(cctkGH,\n scratchspace_firstindex, rl, var, 0.0,\n NULL, NULL, NULL, 0);\n scratch_time = 0.0;\n }\n\n if ((*MoL_Intermediate_Step)>1)\n {\n int const nsrcs = 1;\n CCTK_INT const srcs[] = {EvolvedVariableIndex[var]};\n CCTK_INT const tls[] = {0};\n CCTK_REAL const facts[] = {alpha};\n MoL_LinearCombination(cctkGH,\n scratchspace_firstindex, rl, var, 1.0,\n srcs, tls, facts, nsrcs);\n scratch_time += facts[0] * time;\n }\n else\n {\n int const nsrcs = 2;\n CCTK_INT const srcs[] =\n {scratchspace_firstindex, EvolvedVariableIndex[var]};\n CCTK_INT const tls[] = {var, 1};\n CCTK_REAL const facts[] = {1.0, -4.0/3.0};\n MoL_LinearCombination(cctkGH,\n EvolvedVariableIndex[var], rl, tl, 1.0,\n srcs, tls, facts, nsrcs);\n time += facts[0] * scratch_time + facts[1] * old_time;\n }\n }\n\n /* Real arrays */\n\n arrayscratchlocation = 0;\n\n for (var = 0; var < MoLNumEvolvedArrayVariables; var++)\n {\n \n UpdateVar = (CCTK_REAL *)CCTK_VarDataPtrI(cctkGH, 0, \n EvolvedArrayVariableIndex[var]);\n OldVar = (CCTK_REAL *)CCTK_VarDataPtrI(cctkGH, 1, \n EvolvedArrayVariableIndex[var]);\n RHSVar = (CCTK_REAL const *)CCTK_VarDataPtrI(cctkGH, 0, \n RHSArrayVariableIndex[var]);\n \n groupindex = CCTK_GroupIndexFromVarI(EvolvedArrayVariableIndex[var]);\n ierr = CCTK_GroupDynamicData(cctkGH, groupindex,\n &arraydata);\n if (ierr)\n {\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING, \n \"The driver does not return group information \"\n \"for group '%s'.\", \n CCTK_GroupName(groupindex));\n }\n arraytotalsize = 1;\n for (arraydim = 0; arraydim < arraydata.dim; arraydim++)\n {\n arraytotalsize *= arraydata.ash[arraydim];\n }\n\n ScratchVar = &ArrayScratchSpace[arrayscratchlocation];\n\n#pragma omp /*parallel for*/ simd\n for (index = 0; index < arraytotalsize; index++)\n {\n UpdateVar[index] = OldVar[index] +\n (*Original_Delta_Time) / cctkGH->cctk_timefac * beta * RHSVar[index];\n }\n\n if ((*MoL_Intermediate_Step) == MoL_Intermediate_Steps)\n {\n#pragma omp /*parallel for*/ simd\n for (index = 0; index < arraytotalsize; index++)\n {\n ScratchVar[index] = 0;\n }\n }\n \n if ((*MoL_Intermediate_Step)>1)\n {\n#pragma omp /*parallel for*/ simd\n for (index = 0; index < arraytotalsize; index++)\n {\n ScratchVar[index] += alpha * UpdateVar[index];\n }\n }\n else\n {\n#pragma omp /*parallel for*/ simd\n for (index = 0; index < arraytotalsize; index++)\n {\n UpdateVar[index] += ScratchVar[index] - 4.0 / 3.0 * OldVar[index];\n }\n }\n arrayscratchlocation += arraytotalsize;\n }\n\n return;\n}\n", |
| "StepSize.c": " /*@@\n @file StepSize.c\n @date Tue Sep 07 2004\n @author Erik Schnetter\n @desc \n Control the time step size.\n @enddesc \n @version $Header$\n @@*/\n\n#include <assert.h>\n#include <math.h>\n#include <stdio.h>\n#include <stdlib.h>\n\n#include \"cctk.h\"\n#include \"cctk_Arguments.h\"\n#include \"cctk_Parameters.h\"\n\n#include \"ExternalVariables.h\"\n\nstatic const char *rcsid = \"$Header$\";\n\nCCTK_FILEVERSION(CactusBase_MoL_StepSize_c);\n\n/********************************************************************\n ********************* Local Data Types ***********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Local Routine Prototypes *********************\n ********************************************************************/\n\n/********************************************************************\n ***************** Scheduled Routine Prototypes *********************\n ********************************************************************/\n\nvoid MoL_StartLoop(CCTK_ARGUMENTS);\n\nvoid MoL_InitAdaptiveError(CCTK_ARGUMENTS);\nvoid MoL_FindAdaptiveError(CCTK_ARGUMENTS);\nvoid MoL_ReduceAdaptiveError(CCTK_ARGUMENTS);\n\nvoid MoL_SetEstimatedDt(CCTK_ARGUMENTS);\n\nvoid MoL_FinishLoop(CCTK_ARGUMENTS);\n\n/********************************************************************\n ********************* Other Routine Prototypes *********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Local Data *****************************\n ********************************************************************/\n\n/********************************************************************\n ********************* External Routines **********************\n ********************************************************************/\n\n /*@@\n @routine MoL_StartLoop\n @date Tue Sep 07 2004\n @author Erik Schnetter\n @desc \n Start the step size control loop, so that at least one iteration is done.\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nvoid\nMoL_StartLoop(CCTK_ARGUMENTS)\n{\n DECLARE_CCTK_ARGUMENTS_CHECKED(MoL_StartLoop)\n DECLARE_CCTK_PARAMETERS;\n \n *MoL_Stepsize_Bad = 1;\n\n if (adaptive_stepsize)\n {\n *EstimatedDt = cctkGH->cctk_delta_time;\n }\n \n}\n\n /*@@\n @routine MoL_InitAdaptiveError\n @date Tue Sep 07 2004\n @author Erik Schnetter\n @desc \n Initialize error counters for adaptive stepsize control\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nstatic inline CCTK_REAL\nsquare (CCTK_REAL const x)\n{\n return x * x;\n}\n\nvoid MoL_InitAdaptiveError(CCTK_ARGUMENTS)\n{\n DECLARE_CCTK_ARGUMENTS_CHECKED(MoL_InitAdaptiveError);\n DECLARE_CCTK_PARAMETERS;\n\n /* Initialise global error */\n *Error = 0;\n *Count = 0;\n}\n\n /*@@\n @routine MoL_FindAdaptiveError\n @date Thu Jan 27 10:22:26 2005\n @author Erik Schnetter\n @desc \n Compute the error local to this component/patch/...\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nvoid MoL_FindAdaptiveError(CCTK_ARGUMENTS)\n{\n DECLARE_CCTK_ARGUMENTS_CHECKED(MoL_FindAdaptiveError);\n DECLARE_CCTK_PARAMETERS;\n\n /* TODO: exclude symmetry boundaries */\n assert (cctk_dim <= 3);\n int imin[3], imax[3];\n for (int d = 0; d < cctk_dim; d++)\n {\n imin[d] = cctk_bbox[2*d] ? 0 : cctk_nghostzones[d];\n imax[d] = cctk_lsh[d] - (cctk_bbox[2*d+1] ? 0 : cctk_nghostzones[d]);\n }\n\n /* Calculate absolute error */\n CCTK_REAL local_error = 0.0;\n for (int var = 0; var < MoLNumEvolvedVariables; var++)\n {\n\n CCTK_REAL const * restrict const\n UpdateVar = CCTK_VarDataPtrI(cctkGH, 0, EvolvedVariableIndex[var]);\n CCTK_REAL const * restrict const\n RHSVar = CCTK_VarDataPtrI(cctkGH, 0, RHSVariableIndex[var]);\n CCTK_REAL const * restrict const\n ErrorVar\n = CCTK_VarDataPtrI(cctkGH, var,\n CCTK_FirstVarIndex(\"MOL::ERRORESTIMATE\"));\n\n CCTK_REAL const rhs_relative_error\n = maximum_relative_error * RHS_error_weight * (*Original_Delta_Time);\n\n assert (cctk_dim == 3);\n#pragma omp /*parallel for*/ simd reduction(+: local_error)\n for (int k = imin[2]; k < imax[2]; k++)\n {\n for (int j = imin[1]; j < imax[1]; j++)\n {\n for (int i = imin[0]; i < imax[0]; i++)\n {\n int const index = CCTK_GFINDEX3D(cctkGH, i, j, k);\n CCTK_REAL const scale\n = (square(maximum_absolute_error)\n + square(maximum_relative_error * UpdateVar[index])\n + square(rhs_relative_error * RHSVar[index]));\n local_error += square(ErrorVar[index]) / scale;\n }\n }\n }\n\n } /* for var */\n\n *Error += local_error;\n *Count\n += (MoLNumEvolvedVariables\n * (imax[0] - imin[0]) * (imax[1] - imin[1]) * (imax[2] - imin[2]));\n}\n\n /*@@\n @routine MoL_ReduceAdaptiveError\n @date Thu Jan 27 10:23:14 2005\n @author Erik Schnetter\n @desc \n Find the global error estimate. \n Change the timestep based on the error estimate.\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nvoid MoL_ReduceAdaptiveError(CCTK_ARGUMENTS)\n{\n DECLARE_CCTK_ARGUMENTS_CHECKED(MoL_ReduceAdaptiveError);\n DECLARE_CCTK_PARAMETERS;\n\n int redop;\n\n CCTK_REAL red_local[2], red_global[2];\n int p1, p2;\n int ierr;\n\n /* Get global result over all processors */\n redop = CCTK_ReductionArrayHandle (\"sum\");\n assert (redop >= 0);\n\n red_local[0] = *Error;\n red_local[1] = *Count;\n ierr = CCTK_ReduceLocArrayToArray1D\n (cctkGH, -1, redop, red_local, red_global, 2, CCTK_VARIABLE_REAL);\n assert (ierr == 0);\n *Error = red_global[0];\n *Count = red_global[1];\n\n /* Calculate L2-norm */\n *Error = sqrt(*Error / *Count);\n if (! CCTK_EQUALS(verbose, \"none\"))\n {\n CCTK_VInfo (CCTK_THORNSTRING, \"Integration accuracy quotient is %g\", (double)*Error);\n }\n if (! isfinite(*Error))\n {\n CCTK_VWarn (CCTK_WARN_ALERT,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"Integration accuracy quotient is %g, which is not a finite number -- reducing the step size\", (double)*Error);\n }\n\n if ( CCTK_EQUALS(ODE_Method,\"RK45\") || CCTK_EQUALS(ODE_Method,\"RK45CK\") )\n {\n p1 = 5;\n p2 = 4;\n }\n else if ( CCTK_EQUALS(ODE_Method,\"RK65\") )\n {\n p1 = 6;\n p2 = 5;\n }\n else if ( CCTK_EQUALS(ODE_Method,\"RK87\") )\n {\n p1 = 8;\n p2 = 7;\n }\n else\n {\n CCTK_ERROR (\"unsupported ODE_Method in stepsize control\");\n /* Avoid compiler warnings */\n p1 = 0;\n p2 = 0;\n }\n\n /* Decide whether to accept this step */\n *MoL_Stepsize_Bad = ! isfinite(*Error) || *Error > 1;\n\n if (*MoL_Stepsize_Bad)\n {\n /* The error is too large; reject the time step and reduce the\n step size */\n cctkGH->cctk_time -= cctkGH->cctk_delta_time;\n if (! CCTK_EQUALS(verbose, \"none\"))\n {\n CCTK_VInfo (CCTK_THORNSTRING, \"*** REJECTING TIME STEP ***\");\n }\n\n if (isfinite(*Error))\n {\n cctkGH->cctk_delta_time\n = safety_factor * (*Original_Delta_Time) / pow(*Error, 1.0/p1);\n }\n else\n {\n cctkGH->cctk_delta_time = (*Original_Delta_Time) / maximum_decrease;\n }\n /* if (! CCTK_EQUALS(verbose, \"none\")) */\n /* { */\n /* CCTK_VInfo (CCTK_THORNSTRING, \"Setting time step to %g\", (double)cctkGH->cctk_delta_time); */\n /* } */\n\n if (cctkGH->cctk_delta_time < (*Original_Delta_Time) / maximum_decrease)\n {\n /* No more than a factor of 10 decrease */\n cctkGH->cctk_delta_time = (*Original_Delta_Time) / maximum_decrease;\n if (! CCTK_EQUALS(verbose, \"none\"))\n {\n CCTK_VInfo (CCTK_THORNSTRING, \" Time step reduction too large; clamping time step to %g\", (double)cctkGH->cctk_delta_time);\n }\n }\n if (cctkGH->cctk_delta_time == (CCTK_REAL)0.0)\n /* yes, we want to compare to zero exactly, to catch underflows */\n {\n CCTK_ERROR (\"New step size would be zero -- aborting\");\n }\n\n cctkGH->cctk_time += cctkGH->cctk_delta_time;\n }\n else\n {\n /* The error is acceptable; estimate the next step size */\n *EstimatedDt = \n safety_factor * (*Original_Delta_Time) / pow(*Error, 1.0/p2);\n\n if (*EstimatedDt > (*Original_Delta_Time) * maximum_increase)\n {\n /* No more than a factor of 5 increase */\n *EstimatedDt = (*Original_Delta_Time) * maximum_increase;\n if (! CCTK_EQUALS(verbose, \"none\"))\n {\n CCTK_VInfo (CCTK_THORNSTRING, \" Time step increase too large; clamping time step to %g\", (double)(*EstimatedDt));\n }\n }\n }\n}\n\n /*@@\n @routine MoL_SetEstimatedDt\n @date Thu Jan 27 14:05:08 2005\n @author Ian Hawke\n @desc \n Actually set the timestep in PostStep. \n This avoids problems when the timestep is changed in the middle of the\n evolution loop.\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nvoid MoL_SetEstimatedDt(CCTK_ARGUMENTS)\n{\n\n DECLARE_CCTK_ARGUMENTS_CHECKED(MoL_SetEstimatedDt);\n DECLARE_CCTK_PARAMETERS;\n\n cctkGH->cctk_delta_time = *EstimatedDt;\n\n if (! CCTK_EQUALS(verbose, \"none\"))\n {\n CCTK_VInfo (CCTK_THORNSTRING, \"Setting time step to %g\", \n (double)cctkGH->cctk_delta_time);\n }\n\n}\n\n /*@@\n @routine MoL_FinishLoop\n @date Thu Jan 27 10:24:19 2005\n @author Erik Schnetter\n @desc \n Loop control if adaptive timestepping is not used.\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nvoid MoL_FinishLoop(CCTK_ARGUMENTS)\n{\n DECLARE_CCTK_ARGUMENTS_CHECKED(MoL_FinishLoop);\n DECLARE_CCTK_PARAMETERS;\n\n /* Keep time step size unchanged */\n *MoL_Stepsize_Bad = 0;\n \n // Set these flags to ONE outside of MoL-loop!\n *MoL_SlowPostStep = 1;\n *MoL_SlowStep = 1;\n}\n\n/********************************************************************\n ********************* Local Routines *************************\n ********************************************************************/\n", |
| "Operators.c": "#include \"Operators.h\"\n\n#include <cctk.h>\n#include <cctk_Parameters.h>\n\n#include <assert.h>\n#include <complex.h>\n#include <stddef.h>\n#include <stdlib.h>\n\n/* These are MoL's low-level operators. If they are overloaded as\n aliased functions, these aliased functions are called; otherwise, a\n default implementation is used. */\n\n/* The aliased functions should never be called directly from MoL's\n time integrators, because they may not exist. Instead, the\n operators defined here (with the MoL_ prefix) should be used. */\n\nstatic\nvoid\nerror_wrong_type(int const var)\n{\n char *const fullname = CCTK_FullName(var);\n CCTK_VERROR(\"Variable %s has the wrong type\", fullname);\n free(fullname);\n}\n\nstatic\nvoid\nerror_no_storage(int const var, int const rl, int const tl)\n{\n char *const fullname = CCTK_FullName(var);\n CCTK_VERROR(\"Variable %s, refinement level %d, timelevel %d has no storage\",\n fullname, rl, tl);\n free(fullname);\n}\n\n\n\n/* Some common special cases to improve performance */\nstatic\nvoid\nop_real_set_0(CCTK_REAL *restrict const varptr,\n ptrdiff_t const npoints)\n{\n#pragma omp /*parallel for*/ simd\n for (ptrdiff_t i=0; i<npoints; ++i) {\n varptr[i] = 0.0;\n }\n}\n\nstatic\nvoid\nop_real_set_1(CCTK_REAL *restrict const varptr,\n CCTK_REAL const *restrict const srcptr0,\n CCTK_REAL const fact0,\n ptrdiff_t const npoints)\n{\n#pragma omp /*parallel for*/ simd\n for (ptrdiff_t i=0; i<npoints; ++i) {\n varptr[i] = fact0 * srcptr0[i];\n }\n}\n\nstatic\nvoid\nop_real_set_2(CCTK_REAL *restrict const varptr,\n CCTK_REAL const *restrict const srcptr0,\n CCTK_REAL const fact0,\n CCTK_REAL const *restrict const srcptr1,\n CCTK_REAL const fact1,\n ptrdiff_t const npoints)\n{\n#pragma omp /*parallel for*/ simd\n for (ptrdiff_t i=0; i<npoints; ++i) {\n varptr[i] = fact0 * srcptr0[i] + fact1 * srcptr1[i];\n }\n}\n\nstatic\nvoid\nop_real_set_3(CCTK_REAL *restrict const varptr,\n CCTK_REAL const *restrict const srcptr0,\n CCTK_REAL const fact0,\n CCTK_REAL const *restrict const srcptr1,\n CCTK_REAL const fact1,\n CCTK_REAL const *restrict const srcptr2,\n CCTK_REAL const fact2,\n ptrdiff_t const npoints)\n{\n#pragma omp /*parallel for*/ simd\n for (ptrdiff_t i=0; i<npoints; ++i) {\n varptr[i] = fact0 * srcptr0[i] + fact1 * srcptr1[i] + fact2 * srcptr2[i];\n }\n}\n\nstatic\nvoid\nop_real_set_4(CCTK_REAL *restrict const varptr,\n CCTK_REAL const *restrict const srcptr0,\n CCTK_REAL const fact0,\n CCTK_REAL const *restrict const srcptr1,\n CCTK_REAL const fact1,\n CCTK_REAL const *restrict const srcptr2,\n CCTK_REAL const fact2,\n CCTK_REAL const *restrict const srcptr3,\n CCTK_REAL const fact3,\n ptrdiff_t const npoints)\n{\n#pragma omp /*parallel for*/ simd\n for (ptrdiff_t i=0; i<npoints; ++i) {\n varptr[i] = fact0 * srcptr0[i] + fact1 * srcptr1[i] + fact2 * srcptr2[i] +\n fact3 * srcptr3[i];\n }\n}\n\nstatic\nvoid\nop_real_update_0(CCTK_REAL *restrict const varptr,\n CCTK_REAL const scale,\n ptrdiff_t const npoints)\n{\n#pragma omp /*parallel for*/ simd\n for (ptrdiff_t i=0; i<npoints; ++i) {\n varptr[i] = scale * varptr[i];\n }\n}\n\nstatic\nvoid\nop_real_update_1(CCTK_REAL *restrict const varptr,\n CCTK_REAL const scale,\n CCTK_REAL const *restrict const srcptr0,\n CCTK_REAL const fact0,\n ptrdiff_t const npoints)\n{\n#pragma omp /*parallel for*/ simd\n for (ptrdiff_t i=0; i<npoints; ++i) {\n varptr[i] = scale * varptr[i] + fact0 * srcptr0[i];\n }\n}\n\nstatic\nvoid\nop_real_update_2(CCTK_REAL *restrict const varptr,\n CCTK_REAL const scale,\n CCTK_REAL const *restrict const srcptr0,\n CCTK_REAL const fact0,\n CCTK_REAL const *restrict const srcptr1,\n CCTK_REAL const fact1,\n ptrdiff_t const npoints)\n{\n#pragma omp /*parallel for*/ simd\n for (ptrdiff_t i=0; i<npoints; ++i) {\n varptr[i] = scale * varptr[i] + fact0 * srcptr0[i] + fact1 * srcptr1[i];\n }\n}\n\nstatic\nvoid\nop_real_update_3(CCTK_REAL *restrict const varptr,\n CCTK_REAL const scale,\n CCTK_REAL const *restrict const srcptr0,\n CCTK_REAL const fact0,\n CCTK_REAL const *restrict const srcptr1,\n CCTK_REAL const fact1,\n CCTK_REAL const *restrict const srcptr2,\n CCTK_REAL const fact2,\n ptrdiff_t const npoints)\n{\n#pragma omp /*parallel for*/ simd\n for (ptrdiff_t i=0; i<npoints; ++i) {\n varptr[i] =\n scale * varptr[i] +\n fact0 * srcptr0[i] + fact1 * srcptr1[i] + fact2 * srcptr2[i];\n }\n}\n\nstatic\nvoid\nop_real_update_4(CCTK_REAL *restrict const varptr,\n CCTK_REAL const scale,\n CCTK_REAL const *restrict const srcptr0,\n CCTK_REAL const fact0,\n CCTK_REAL const *restrict const srcptr1,\n CCTK_REAL const fact1,\n CCTK_REAL const *restrict const srcptr2,\n CCTK_REAL const fact2,\n CCTK_REAL const *restrict const srcptr3,\n CCTK_REAL const fact3,\n ptrdiff_t const npoints)\n{\n#pragma omp /*parallel for*/ simd\n for (ptrdiff_t i=0; i<npoints; ++i) {\n varptr[i] =\n scale * varptr[i] +\n fact0 * srcptr0[i] + fact1 * srcptr1[i] + fact2 * srcptr2[i] +\n fact3 * srcptr3[i];\n }\n}\n\n\n\n /*@@\n @routine MoL_LinearCombination\n @date Tue Jan 22 16:00:28 EST 2013\n @author Erik Schnetter\n @desc \n MoL's low level operator. Computes linear combination of grid functions.\n Computes:\n var = scale * var + \\sum_i^nsrcs facts[i] * scrcs[i][tls[i]]\n @enddesc \n @var GH\n @vdesc Pointer to CCTK GH\n @vtype const cGH *\n @vio in\n @endvar\n @var var\n @vdesc global index of target variable\n @vtype int\n @vio in\n @endvar\n @var tl\n @vdesc timelevel of target variable\n @vtype int\n @vio in\n @endvar\n @var rl\n @vdesc refinement level of all variables\n @vtype int\n @vio in\n @endvar\n @var tl\n @vdesc time level of target variable\n @vtype int\n @vio in\n @endvar\n @var scale\n @vdesc scale target by this\n @vtype CCTK_REAL\n @vio in\n @endvar\n @var srcs\n @vdesc global index of variable\n @vtype int[]\n @vio in\n @endvar\n @var tls\n @vdesc time levels of srcs variables to use\n @vtype int[]\n @vio in\n @endvar\n @var facts\n @vdesc scale factors for srcs variables\n @vtype CCTK_REAL[]\n @vio in\n @endvar\n @var nsrcs\n @vdesc number of srcs variables\n @vtype int\n @vio in\n @endvar\n\n @returntype CCTK_INT\n @returndesc\n 0 for success, or<BR>\n @endreturndesc\n\n@@*/\n\nCCTK_INT\nMoL_LinearCombination(cGH const *const cctkGH,\n CCTK_INT const var,\n CCTK_INT const rl,\n CCTK_INT const tl,\n CCTK_REAL const scale,\n CCTK_INT const srcs[],\n CCTK_INT const tls[],\n CCTK_REAL const facts[],\n CCTK_INT const nsrcs)\n{\n DECLARE_CCTK_PARAMETERS;\n\n // MoL never triggers a SYNC thus can only set what was already valid in its\n // sources\n CCTK_INT mask = CCTK_VALID_EVERYWHERE;\n if(CCTK_IsFunctionAliased(\"Driver_GetValidRegion\")) {\n if(scale)\n mask &= Driver_GetValidRegion(cctkGH, var, tl);\n for(int src = 0; src < nsrcs; ++src) {\n if(facts[src])\n mask &= Driver_GetValidRegion(cctkGH, srcs[src], tls[src]);\n }\n Driver_SetValidRegion(cctkGH, var, tl, mask);\n }\n \n // Forward call to aliased function, if it is defined and if we are\n // using the device (accelerator)\n static int is_aliased = -1;\n if (is_aliased < 0) {\n int is_device = 0;\n if (CCTK_IsFunctionAliased(\"Device_GetDevice\")) {\n is_device = Device_GetDevice(cctkGH) >= 0;\n }\n is_aliased = 0;\n if (is_device) {\n is_aliased = CCTK_IsFunctionAliased(\"LinearCombination\");\n }\n }\n if (is_aliased) {\n return\n LinearCombination(cctkGH, var, rl, tl, scale, srcs, tls, facts, nsrcs);\n }\n \n // Determine grid variable size\n int const dim = CCTK_GroupDimFromVarI(var);\n int ash[dim];\n int const ierr = CCTK_GroupashVI(cctkGH, dim, ash, var);\n assert(!ierr);\n // TODO: check that all src variables have the same ash\n ptrdiff_t npoints = 1;\n for (int d=0; d<dim; ++d) {\n npoints *= ash[d];\n }\n \n switch (CCTK_VarTypeI(var)) {\n \n case CCTK_VARIABLE_REAL: {\n // Obtain pointer to variable data\n CCTK_REAL *restrict const varptr = CCTK_VarDataPtrI(cctkGH, tl, var);\n if (!varptr) error_no_storage(var, rl, tl);\n CCTK_REAL const *restrict srcptrs[nsrcs];\n for (int n=0; n<nsrcs; ++n) {\n if (CCTK_VarTypeI(srcs[n]) != CCTK_VARIABLE_REAL) error_wrong_type(var);\n // TODO: Check that this is the right refinement level rl\n srcptrs[n] = CCTK_VarDataPtrI(cctkGH, tls[n], srcs[n]);\n if (!srcptrs[n]) error_no_storage(srcs[n], rl, tls[n]);\n }\n \n if (scale == 0.0) {\n // Set (overwrite) target variable\n \n // Introduce special cases for some common cases to improve\n // performance\n switch (nsrcs) {\n case 0:\n op_real_set_0(varptr, npoints);\n break;\n case 1:\n op_real_set_1(varptr, srcptrs[0], facts[0], npoints);\n break;\n case 2:\n op_real_set_2(varptr,\n srcptrs[0], facts[0], srcptrs[1], facts[1], npoints);\n break;\n case 3:\n op_real_set_3(varptr,\n srcptrs[0], facts[0], srcptrs[1], facts[1],\n srcptrs[2], facts[2], npoints);\n break;\n case 4:\n op_real_set_4(varptr,\n srcptrs[0], facts[0], srcptrs[1], facts[1],\n srcptrs[2], facts[2], srcptrs[3], facts[3], npoints);\n break;\n default:\n // Loop over all grid points\n#pragma omp /*parallel for*/ simd\n for (ptrdiff_t i=0; i<npoints; ++i) {\n CCTK_REAL tmp = 0.0;\n for (int n=0; n<nsrcs; ++n) {\n tmp += facts[n] * srcptrs[n][i];\n }\n varptr[i] = tmp;\n }\n break;\n }\n \n } else {\n // Update (add to) target variable\n \n // Introduce special cases for some common cases to improve\n // performance\n switch (nsrcs) {\n case 0:\n op_real_update_0(varptr, scale, npoints);\n break;\n case 1:\n op_real_update_1(varptr, scale, srcptrs[0], facts[0], npoints);\n break;\n case 2:\n op_real_update_2(varptr, scale,\n srcptrs[0], facts[0], srcptrs[1], facts[1], npoints);\n break;\n case 3:\n op_real_update_3(varptr, scale,\n srcptrs[0], facts[0], srcptrs[1], facts[1],\n srcptrs[2], facts[2], npoints);\n break;\n case 4:\n op_real_update_4(varptr, scale,\n srcptrs[0], facts[0], srcptrs[1], facts[1],\n srcptrs[2], facts[2], srcptrs[3], facts[3], npoints);\n break;\n default:\n // Loop over all grid points\n#pragma omp /*parallel for*/ simd\n for (ptrdiff_t i=0; i<npoints; ++i) {\n CCTK_REAL tmp = scale * varptr[i];\n for (int n=0; n<nsrcs; ++n) {\n tmp += facts[n] * srcptrs[n][i];\n }\n varptr[i] = tmp;\n }\n break;\n }\n \n }\n break;\n }\n \n case CCTK_VARIABLE_COMPLEX: {\n // Obtain pointer to variable data\n CCTK_COMPLEX *restrict const varptr = CCTK_VarDataPtrI(cctkGH, tl, var);\n if (!varptr) error_no_storage(var, rl, tl);\n CCTK_COMPLEX const *restrict srcptrs[nsrcs];\n for (int n=0; n<nsrcs; ++n) {\n if (CCTK_VarTypeI(srcs[n]) != CCTK_VARIABLE_COMPLEX)\n error_wrong_type(var);\n // TODO: Check that this is the right refinement level rl\n srcptrs[n] = CCTK_VarDataPtrI(cctkGH, tls[n], srcs[n]);\n if (!srcptrs[n]) error_no_storage(srcs[n], rl, tls[n]);\n }\n \n if (scale == 0.0) {\n // Set (overwrite) target variable\n // Loop over all grid points\n#pragma omp /*parallel for*/ simd\n for (ptrdiff_t i=0; i<npoints; ++i) {\n CCTK_COMPLEX tmp = 0.0;\n for (int n=0; n<nsrcs; ++n) {\n tmp += facts[n] * srcptrs[n][i];\n }\n varptr[i] = tmp;\n }\n } else {\n // Update (add to) target variable\n#pragma omp /*parallel for*/ simd\n for (ptrdiff_t i=0; i<npoints; ++i) {\n CCTK_COMPLEX tmp = scale * varptr[i];\n for (int n=0; n<nsrcs; ++n) {\n tmp += facts[n] * srcptrs[n][i];\n }\n varptr[i] = tmp;\n }\n }\n break;\n }\n \n default:\n // Other types (e.g. CCTK_REAL4) could be supported as well\n CCTK_ERROR(\"Unsupported variable type\");\n }\n \n if (CCTK_IsFunctionAliased(\"Accelerator_NotifyDataModified\")) {\n Accelerator_NotifyDataModified(cctkGH, &var, &rl, &tl, 1, 0);\n }\n \n // Done\n return 0;\n}\n\nCCTK_INT\nMoL_LinearCombination_REAL(cGH const *const cctkGH,\n CCTK_REAL *restrict const var,\n CCTK_INT const size,\n CCTK_REAL const scale,\n CCTK_REAL const *restrict const srcs[],\n CCTK_REAL const facts[],\n CCTK_INT const nsrcs)\n{\n DECLARE_CCTK_PARAMETERS;\n \n if (scale == 0.0) {\n // Set (overwrite) target variable\n \n // Introduce special cases for some common cases to improve\n // performance\n switch (nsrcs) {\n case 0:\n op_real_set_0(var, size);\n break;\n case 1:\n op_real_set_1(var, srcs[0], facts[0], size);\n break;\n case 2:\n op_real_set_2(var, srcs[0], facts[0], srcs[1], facts[1], size);\n break;\n case 3:\n op_real_set_3(var,\n srcs[0], facts[0], srcs[1], facts[1], srcs[2], facts[2],\n size);\n break;\n case 4:\n op_real_set_4(var,\n srcs[0], facts[0], srcs[1], facts[1], srcs[2], facts[2],\n srcs[3], facts[3], size);\n break;\n default:\n // Loop over all grid points\n#pragma omp /*parallel for*/ simd\n for (ptrdiff_t i=0; i<size; ++i) {\n CCTK_REAL tmp = 0.0;\n for (int n=0; n<nsrcs; ++n) {\n tmp += facts[n] * srcs[n][i];\n }\n var[i] = tmp;\n }\n break;\n }\n \n } else {\n // Update (add to) target variable\n \n // Introduce special cases for some common cases to improve\n // performance\n switch (nsrcs) {\n case 0:\n op_real_update_0(var, scale, size);\n break;\n case 1:\n op_real_update_1(var, scale, srcs[0], facts[0], size);\n break;\n case 2:\n op_real_update_2(var, scale, srcs[0], facts[0], srcs[1], facts[1], size);\n break;\n case 3:\n op_real_update_3(var, scale,\n srcs[0], facts[0], srcs[1], facts[1], srcs[2], facts[2],\n size);\n break;\n case 4:\n op_real_update_4(var, scale,\n srcs[0], facts[0], srcs[1], facts[1], srcs[2], facts[2],\n srcs[3], facts[3], size);\n break;\n default:\n // Loop over all grid points\n#pragma omp /*parallel for*/ simd\n for (ptrdiff_t i=0; i<size; ++i) {\n CCTK_REAL tmp = scale * var[i];\n for (int n=0; n<nsrcs; ++n) {\n tmp += facts[n] * srcs[n][i];\n }\n var[i] = tmp;\n }\n break;\n }\n \n }\n \n // Done\n return 0;\n}\n", |
| "RHSNaNCheck.c": " /*@@\n @file RHSNaNCheck.c\n @date Mon May 20 09:52:33 2002\n @author Ian Hawke\n @desc \n Check the RHS GFs for NaNs.\n @enddesc \n @version $Header$\n @@*/\n\n#include <stdlib.h>\n\n#include \"cctk.h\"\n#include \"cctk_Arguments.h\"\n#include \"cctk_Parameters.h\"\n\n#include \"ExternalVariables.h\"\n\nstatic const char *rcsid = \"$Header$\";\n\nCCTK_FILEVERSION(CactusBase_MoL_RHSNaNCheck_c);\n\n/********************************************************************\n ********************* Local Data Types ***********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Local Routine Prototypes *********************\n ********************************************************************/\n\n/********************************************************************\n ***************** Scheduled Routine Prototypes *********************\n ********************************************************************/\n\nvoid MoL_NaNCheck(CCTK_ARGUMENTS);\n\n/********************************************************************\n ********************* Other Routine Prototypes *********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Local Data *****************************\n ********************************************************************/\n\n/********************************************************************\n ********************* External Routines **********************\n ********************************************************************/\n\n /*@@\n @routine MoL_NaNCheck\n @date Mon May 20 09:54:39 2002\n @author Ian Hawke\n @desc \n Check the RHS GFs for NaNs.\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nvoid MoL_NaNCheck(CCTK_ARGUMENTS)\n{\n\n DECLARE_CCTK_ARGUMENTS_CHECKED(MoL_NaNCheck);\n DECLARE_CCTK_PARAMETERS;\n\n CCTK_INT var;\n CCTK_INT num_nans;\n\n const char *check_for = \"both\";\n const char *action_if_found = \"just warn\";\n \n num_nans = 0;\n\n for (var = 0; var < MoLNumEvolvedVariables; var++)\n {\n char * const varname = CCTK_FullName(RHSVariableIndex[var]);\n num_nans += CheckVarsForNaN(cctkGH,\n -1,\n varname,\n check_for,\n action_if_found);\n free(varname);\n }\n\n if (num_nans)\n {\n CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"NaNs were found on iteration %d inside MoL\",\n (int)(MoL_Intermediate_Steps - *MoL_Intermediate_Step + 1));\n }\n}\n\n/********************************************************************\n ********************* Local Routines *************************\n ********************************************************************/\n", |
| "MoL.h": " /*@@\n @file MoL.h\n @date Thu Jun 13 22:17:32 2002\n @author Ian Hawke\n @desc \n A header file with the definitions of the functions to be \n called by other thorns. This will exist until the function\n aliasing is sorted out.\n @enddesc \n @@*/\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#ifndef MOL_ACTIVE\n#define MOL_ACTIVE\n#endif\n\n#ifdef CCODE\n\nCCTK_INT MoL_RegisterEvolved(CCTK_INT EvolvedIndex, CCTK_INT RHSIndex);\nCCTK_INT MoL_RegisterEvolvedSlow(CCTK_INT EvolvedIndex, CCTK_INT RHSIndexSlow);\nCCTK_INT MoL_RegisterConstrained(CCTK_INT ConstrainedIndex);\nCCTK_INT MoL_RegisterSaveAndRestore(CCTK_INT SandRIndex);\nCCTK_INT MoL_ChangeToEvolved(CCTK_INT EvolvedIndex, CCTK_INT RHSIndex);\nCCTK_INT MoL_ChangeToConstrained(CCTK_INT ConstrainedIndex);\nCCTK_INT MoL_ChangeToSaveAndRestore(CCTK_INT SandRIndex);\nCCTK_INT MoL_ChangeToNone(CCTK_INT RemoveIndex);\nCCTK_INT MoL_RegisterEvolvedGroup(CCTK_INT EvolvedGroupIndex, \n CCTK_INT RHSGroupIndex);\nCCTK_INT MoL_RegisterEvolvedGroupSlow(CCTK_INT EvolvedGroupIndexSlow,\n CCTK_INT RHSGroupIndexSlow);\nCCTK_INT MoL_RegisterConstrainedGroup(CCTK_INT ConstrainedGroupIndex);\nCCTK_INT MoL_RegisterSaveAndRestoreGroup(CCTK_INT SandRGroupIndex);\n\n/* Old functions from MoL1 for compatibility */\n\nCCTK_INT MoL_RegisterVar(CCTK_INT molvarindex,CCTK_INT molrhsvarindex);\nCCTK_INT MoL_RegisterPrimitive(CCTK_INT primitiveindex);\nCCTK_INT MoL_RegisterDepends(CCTK_INT dependsindex);\nCCTK_INT MoL_RegisterVarGroup(CCTK_INT groupindex,CCTK_INT rhsgroupindex);\nCCTK_INT MoL_RegisterPrimitiveGroup(CCTK_INT groupindex);\nCCTK_INT MoL_RegisterDependsGroup(CCTK_INT groupindex);\nCCTK_INT MoL_ChangeVarToEvolved(CCTK_INT varindex, CCTK_INT rhsindex);\nCCTK_INT MoL_ChangeVarToDependent(CCTK_INT dependsindex);\nCCTK_INT MoL_ChangeVarToPrimitive(CCTK_INT primitiveindex);\nCCTK_INT MoL_ChangeVarToNone(CCTK_INT removeindex);\n\n#endif\n\n#ifdef __cplusplus\n}\n#endif\n", |
| "Euler.c": " /*@@\n @file Euler.c\n @date 2012-12-05\n @author Erik Schnetter\n @desc \n An explicit Euler time integrator. This method is unstable in most\n cases, but is sometimes useful for debugging.\n @enddesc \n @version $Header$\n @@*/\n\n#include \"cctk.h\"\n#include \"cctk_Arguments.h\"\n#include \"cctk_Parameters.h\"\n\n#include \"ExternalVariables.h\"\n#include \"Operators.h\"\n\nstatic const char *rcsid = \"$Header$\";\n\nCCTK_FILEVERSION(CactusBase_MoL_Euler_c);\n\n/********************************************************************\n ********************* Local Data Types ***********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Local Routine Prototypes *********************\n ********************************************************************/\n\n/********************************************************************\n ***************** Scheduled Routine Prototypes *********************\n ********************************************************************/\n\nvoid MoL_EulerAdd(CCTK_ARGUMENTS);\n\n/********************************************************************\n ********************* Other Routine Prototypes *********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Local Data *****************************\n ********************************************************************/\n\n/********************************************************************\n ********************* External Routines **********************\n ********************************************************************/\n\n /*@@\n @routine MoL_EulerAdd\n @date 2012-12-05\n @author Erik Schnetter\n @desc \n Performs first order Euler time integration.\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nvoid MoL_EulerAdd(CCTK_ARGUMENTS)\n{\n DECLARE_CCTK_ARGUMENTS_CHECKED(MoL_EulerAdd);\n DECLARE_CCTK_PARAMETERS;\n \n int totalsize = 1;\n for (int arraydim = 0; arraydim < cctk_dim; arraydim++)\n {\n totalsize *= cctk_ash[arraydim];\n }\n \n CCTK_INT rl = 0;\n if (CCTK_IsFunctionAliased(\"GetRefinementLevel\")) {\n rl = GetRefinementLevel(cctkGH);\n }\n CCTK_INT tl = 0;\n \n switch (*MoL_Intermediate_Step)\n {\n case 1:\n {\n for (int var = 0; var < MoLNumEvolvedVariables; var++)\n {\n int const nsrcs = 2;\n CCTK_INT const srcs[] =\n {EvolvedVariableIndex[var], RHSVariableIndex[var]};\n CCTK_INT const tls[] = {1, 0};\n CCTK_REAL const facts[] = {1.0, CCTK_DELTA_TIME};\n MoL_LinearCombination(cctkGH,\n EvolvedVariableIndex[var], rl, tl, 0.0,\n srcs, tls, facts, nsrcs);\n }\n \n for (int var = 0; var < MoLNumEvolvedArrayVariables; var++)\n {\n int const nsrcs = 2;\n CCTK_INT const srcs[] =\n {EvolvedArrayVariableIndex[var], RHSArrayVariableIndex[var]};\n CCTK_INT const tls[] = {1, 0};\n CCTK_REAL const facts[] = {1.0, CCTK_DELTA_TIME};\n MoL_LinearCombination(cctkGH,\n EvolvedArrayVariableIndex[var], rl, tl, 0.0,\n srcs, tls, facts, nsrcs);\n }\n \n break;\n }\n default:\n {\n CCTK_ERROR(\"Euler expects MoL_Intermediate_Step to be in [1,1]. \"\n \"This should be caught at ParamCheck - bug Ian!\");\n }\n }\n}\n\n/********************************************************************\n ********************* Local Routines *************************\n ********************************************************************/\n", |
| "RK87.c": " /*@@\n @file RK87.c\n @date Sun May 26 03:47:15 2002\n @author Peter Diener (based on RK45.c by Ian Hawke)\n @desc \n RK87 following P. J. Prince and J. R. Dormand\n Journal of Computational and Applied Mathematics, volume 7, no 1, 1981\n @enddesc \n @version $Header$\n @@*/\n\n#include \"cctk.h\"\n#include \"cctk_Arguments.h\"\n#include \"cctk_Parameters.h\"\n\n#include \"ExternalVariables.h\"\n#include \"Operators.h\"\n\nstatic const char *rcsid = \"$Header$\";\n\nCCTK_FILEVERSION(CactusBase_MoL_RK87_c);\n\n/********************************************************************\n ********************* Local Data Types ***********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Local Routine Prototypes *********************\n ********************************************************************/\n\n/********************************************************************\n ***************** Scheduled Routine Prototypes *********************\n ********************************************************************/\n\nvoid MoL_RK87Add(CCTK_ARGUMENTS);\n\n/********************************************************************\n ********************* Other Routine Prototypes *********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Local Data *****************************\n ********************************************************************/\n\n/********************************************************************\n ********************* External Routines **********************\n ********************************************************************/\n\n /*@@\n @routine MoL_RK87Add\n @date Sun May 26 03:50:44 2002\n @author Peter Diener (based on MoL_RK45Add by Ian Hawke)\n @desc \n Performs a single step of a Runge-Kutta 87 type time\n integration, storing the error estimate.\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nvoid MoL_RK87Add(CCTK_ARGUMENTS)\n{\n\n DECLARE_CCTK_ARGUMENTS_CHECKED(MoL_RK87Add);\n DECLARE_CCTK_PARAMETERS;\n \n CCTK_INT arraydim;\n\n static CCTK_INT scratchspace_firstindex = -99;\n static CCTK_INT error_firstindex = -99;\n CCTK_INT var, scratchstep;\n CCTK_INT totalsize;\n\n static const CCTK_REAL beta_array[12][12] = {\n { 1.0/18.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 },\n { 1.0/48.0, 1.0/16.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 },\n { 1.0/32.0, 0.0, 3.0/32.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 },\n { 5.0/16.0, 0.0, -75.0/64.0, 75.0/64.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 },\n { 3.0/80.0, 0.0, 0.0, 3.0/16.0, 3.0/20.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 },\n { 29443841.0/614563906.0, 0.0, 0.0, 77736538.0/692538347.0, -28693883.0/1125000000.0, 23124283.0/1800000000.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 },\n { 16016141.0/946692911.0, 0.0, 0.0, 61564180.0/158732637.0, 22789713.0/633445777.0, 545815736.0/2771057229.0, -180193667.0/1043307555.0, 0.0, 0.0, 0.0, 0.0, 0.0 },\n { 39632708.0/573591083.0, 0.0, 0.0, -433636366.0/683701615.0, -421739975.0/2616292301.0, 100302831.0/723423059.0, 790204164.0/839813087.0, 800635310.0/3783071287.0, 0.0, 0.0, 0.0, 0.0 },\n { 246121993.0/1340847787.0, 0.0, 0.0, -37695042795.0/15268766246.0, -309121744.0/1061227803.0, -12992083.0/490766935.0, 6005943493.0/2108947869.0, 393006217.0/1396673457.0, 123872331.0/1001029789.0, 0.0, 0.0, 0.0 },\n { -1028468189.0/846180014.0, 0.0, 0.0, 8478235783.0/508512852.0, 1311729495.0/1432422823.0, -10304129995.0/1701304382.0, -48777925059.0/3047939560.0, 15336726248.0/1032824649.0, -45442868181.0/3398467696.0, 3065993473.0/597172653.0, 0.0, 0.0 },\n { 185892177.0/718116043.0, 0.0, 0.0, -3185094517.0/667107341.0, -477755414.0/1098053517.0, -703635378.0/230739211.0, 5731566787.0/1027545527.0, 5232866602.0/850066563.0, -4093664535.0/808688257.0, 3962137247.0/1805957418.0, 65686358.0/487910083.0, 0.0 },\n { 403863854.0/491063109.0, 0.0, 0.0, -5068492393.0/434740067.0, -411421997.0/543043805.0, 652783627.0/914296604.0, 11173962825.0/925320556.0, -13158990841.0/6184727034.0, 3936647629.0/1978049680.0, -160528059.0/685178525.0, 248638103.0/1413531060.0, 0.0 }\n };\n\n static const CCTK_REAL gamma_array[13] = \n { 14005451.0/335480064.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n -59238493.0/1068277825.0,\n 181606767.0/758867731.0,\n 561292985.0/797845732.0,\n -1041891430.0/1371343529.0,\n 760417239.0/1151165299.0,\n 118820643.0/751138087.0,\n -528747749.0/2220607170.0,\n 1.0/4.0\n };\n\n static const CCTK_REAL gammastar_array[13] = \n { 13451932.0/455176623.0,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n -808719846.0/976000145.0,\n 1757004468.0/5645159321.0,\n 656045339.0/265891186.0,\n -3867574721.0/1518517206.0,\n 465885868.0/322736535.0,\n 53011238.0/667516719.0,\n 2.0/45.0,\n 0.0\n };\n\n totalsize = 1;\n for (arraydim = 0; arraydim < cctk_dim; arraydim++)\n {\n totalsize *= cctk_ash[arraydim];\n } \n\n if (scratchspace_firstindex == -99)\n {\n scratchspace_firstindex = CCTK_FirstVarIndex(\"MOL::SCRATCHSPACE\");\n }\n if (error_firstindex == -99)\n {\n error_firstindex = CCTK_FirstVarIndex(\"MOL::ERRORESTIMATE\");\n }\n\n /* Real GFs */\n\n /* First store (dt times) the rhs in the scratch array. */\n\n CCTK_INT rl = 0;\n if (CCTK_IsFunctionAliased(\"GetRefinementLevel\")) {\n rl = GetRefinementLevel(cctkGH);\n }\n CCTK_INT tl = 0;\n \n for (var = 0; var < MoLNumEvolvedVariables; var++)\n {\n int const step = MoL_Intermediate_Steps - (*MoL_Intermediate_Step);\n int const scratchvarindex = scratchspace_firstindex + step;\n\n int const nsrcs = 1;\n CCTK_INT const srcs[] = {RHSVariableIndex[var]};\n CCTK_INT const tls[] = {0};\n CCTK_REAL const facts[] = {(*Original_Delta_Time) / cctkGH->cctk_timefac};\n MoL_LinearCombination(cctkGH,\n scratchvarindex, rl, var, 0.0,\n srcs, tls, facts, nsrcs);\n }\n\n for (var = 0; var < MoLNumEvolvedVariables; var++)\n {\n int const step = MoL_Intermediate_Steps - (*MoL_Intermediate_Step);\n\n if (*MoL_Intermediate_Step - 1)\n {\n int const nsrcs = step + 2;\n CCTK_INT srcs[nsrcs];\n CCTK_INT tls[nsrcs];\n CCTK_REAL facts[nsrcs];\n srcs[0] = EvolvedVariableIndex[var];\n tls[0] = 1;\n facts[0] = 1.0;\n\n for (scratchstep = 0; scratchstep < step + 1; scratchstep++)\n {\n int const scratchvarindex = scratchspace_firstindex + scratchstep;\n srcs [scratchstep+1] = scratchvarindex;\n tls [scratchstep+1] = var;\n facts[scratchstep+1] = beta_array[step][scratchstep];\n }\n\n MoL_LinearCombination(cctkGH,\n EvolvedVariableIndex[var], rl, tl, 0.0,\n srcs, tls, facts, nsrcs);\n }\n else\n {\n {\n int const nsrcs = 14;\n CCTK_INT srcs[nsrcs];\n CCTK_INT tls[nsrcs];\n CCTK_REAL facts[nsrcs];\n srcs[0] = EvolvedVariableIndex[var];\n tls[0] = 1;\n facts[0] = 1.0;\n \n for (scratchstep = 0; scratchstep < 13; scratchstep++)\n {\n int const scratchvarindex = scratchspace_firstindex + scratchstep;\n srcs [scratchstep+1] = scratchvarindex;\n tls [scratchstep+1] = var;\n facts[scratchstep+1] = gamma_array[scratchstep];\n }\n\n MoL_LinearCombination(cctkGH,\n EvolvedVariableIndex[var], rl, tl, 0.0,\n srcs, tls, facts, nsrcs);\n }\n\n {\n int const nsrcs = 13;\n CCTK_INT srcs[nsrcs];\n CCTK_INT tls[nsrcs];\n CCTK_REAL facts[nsrcs];\n \n for (scratchstep = 0; scratchstep < 13; scratchstep++)\n {\n int const scratchvarindex = scratchspace_firstindex + scratchstep;\n srcs [scratchstep] = scratchvarindex;\n tls [scratchstep] = var;\n facts[scratchstep] =\n gamma_array[scratchstep] - gammastar_array[scratchstep];\n }\n\n MoL_LinearCombination(cctkGH,\n error_firstindex, rl, var, 0.0,\n srcs, tls, facts, nsrcs);\n }\n\n }\n\n }\n\n /* Arrays */\n\n for (var = 0; var < MoLNumEvolvedArrayVariables; var++)\n {\n int const step = MoL_Intermediate_Steps - (*MoL_Intermediate_Step);\n\n if (*MoL_Intermediate_Step - 1)\n {\n int const nsrcs = step + 2;\n CCTK_INT srcs[nsrcs];\n CCTK_INT tls[nsrcs];\n CCTK_REAL facts[nsrcs];\n srcs[0] = EvolvedArrayVariableIndex[var];\n tls[0] = 1;\n facts[0] = 1.0;\n\n for (scratchstep = 0; scratchstep < step + 1; scratchstep++)\n {\n int const scratchvarindex = scratchspace_firstindex + scratchstep;\n srcs [scratchstep+1] = scratchvarindex;\n tls [scratchstep+1] = var;\n facts[scratchstep+1] = beta_array[step][scratchstep];\n }\n\n MoL_LinearCombination(cctkGH,\n EvolvedArrayVariableIndex[var], 0, tl, 0.0,\n srcs, tls, facts, nsrcs);\n }\n else\n {\n {\n int const nsrcs = 14;\n CCTK_INT srcs[nsrcs];\n CCTK_INT tls[nsrcs];\n CCTK_REAL facts[nsrcs];\n srcs[0] = EvolvedArrayVariableIndex[var];\n tls[0] = 1;\n facts[0] = 1.0;\n \n for (scratchstep = 0; scratchstep < 13; scratchstep++)\n {\n int const scratchvarindex = scratchspace_firstindex + scratchstep;\n srcs [scratchstep+1] = scratchvarindex;\n tls [scratchstep+1] = var;\n facts[scratchstep+1] = gamma_array[scratchstep];\n }\n\n MoL_LinearCombination(cctkGH,\n EvolvedArrayVariableIndex[var], 0, tl, 0.0,\n srcs, tls, facts, nsrcs);\n }\n\n {\n int const nsrcs = 13;\n CCTK_INT srcs[nsrcs];\n CCTK_INT tls[nsrcs];\n CCTK_REAL facts[nsrcs];\n \n for (scratchstep = 0; scratchstep < 13; scratchstep++)\n {\n int const scratchvarindex = scratchspace_firstindex + scratchstep;\n srcs [scratchstep] = scratchvarindex;\n tls [scratchstep] = var;\n facts[scratchstep] =\n gamma_array[scratchstep] - gammastar_array[scratchstep];\n }\n\n MoL_LinearCombination(cctkGH,\n error_firstindex, 0, var, 0.0,\n srcs, tls, facts, nsrcs);\n }\n\n }\n\n }\n}\n\n/********************************************************************\n ********************* Local Routines *************************\n ********************************************************************/\n", |
| "MoLPresync.cc": "#include <cctk.h>\n\n#include \"ExternalVariables.h\"\n\nvoid MoL_UpdateValidForInitialCopy(CCTK_ARGUMENTS)\n{\n DECLARE_CCTK_ARGUMENTS;\n if (!CCTK_IsFunctionAliased(\"Driver_GetValidRegion\"))\n return;\n for (int var = 0; var < MoLNumEvolvedVariables; var++)\n {\n int varindex = EvolvedVariableIndex[var];\n int mask1 = Driver_GetValidRegion(cctkGH,varindex,1);\n Driver_SetValidRegion(cctkGH,varindex,0,mask1);\n }\n}\n\nvoid MoL_UpdateValidForAdd(CCTK_ARGUMENTS)\n{\n if (!CCTK_IsFunctionAliased(\"Driver_GetValidRegion\"))\n return;\n DECLARE_CCTK_ARGUMENTS;\n for (int var = 0; var < MoLNumEvolvedVariables; var++)\n {\n int varindex = EvolvedVariableIndex[var];\n int rhsindex = RHSVariableIndex[var];\n int mask1 = Driver_GetValidRegion(cctkGH,varindex,0);\n int mask2 = Driver_GetValidRegion(cctkGH,varindex,1);\n int mask3 = Driver_GetValidRegion(cctkGH,rhsindex,0);\n int mask = mask1 & mask2 & mask3;\n Driver_SetValidRegion(cctkGH,varindex,0,mask);\n }\n}\n", |
| "RK4-MR-2_1.c": " /*@@\n @file RK4-MR-2_1.c\n @date 2012-03-25\n @author Christian Reisswig\n @desc \n A routine to perform 3rd order 2:1 multirate RK evolution. Mostly copied\n from genericRK.c\n @enddesc \n @version $Header$\n @@*/\n\n#include \"cctk.h\"\n#include \"cctk_Arguments.h\"\n#include \"cctk_Parameters.h\"\n\n#include <stdio.h>\n#include \"ExternalVariables.h\"\n\n//#define MOLDEBUG\n\nstatic const char *rcsid = \"$Header$\";\n\nCCTK_FILEVERSION(CactusBase_MoL_RK4_MR_2_1_c);\n\n/********************************************************************\n ********************* Local Data Types ***********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Local Routine Prototypes *********************\n ********************************************************************/\n\n/********************************************************************\n ***************** Scheduled Routine Prototypes *********************\n ********************************************************************/\n\nvoid MoL_RK4_MR_2_1_Add(CCTK_ARGUMENTS);\n\n/********************************************************************\n ********************* Other Routine Prototypes *********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Local Data *****************************\n ********************************************************************/\n\n/********************************************************************\n ********************* External Routines **********************\n ********************************************************************/\n\n /*@@\n @routine MoL_RK4_MR_2_1_Add\n @date \n @author \n @desc \n Performs a single step of a RK43 2:1 type time\n integration.\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nvoid MoL_RK4_MR_2_1_Add(CCTK_ARGUMENTS)\n{\n\n DECLARE_CCTK_ARGUMENTS_CHECKED(MoL_RK4_MR_2_1_Add)\n DECLARE_CCTK_PARAMETERS;\n \n CCTK_INT arraydim;\n\n static CCTK_INT scratchspace_firstindex = -99;\n static CCTK_INT scratchspace_firstindex_slow = -99;\n CCTK_INT index, var, scratchstep;\n CCTK_INT totalsize;\n CCTK_REAL alpha[9], beta[10];\n CCTK_REAL alpha_slow[9], beta_slow[10];\n CCTK_REAL * restrict UpdateVar;\n CCTK_REAL * restrict OldVar;\n CCTK_REAL const * restrict RHSVar;\n CCTK_REAL * restrict ScratchVar;\n\n totalsize = 1;\n for (arraydim = 0; arraydim < cctk_dim; arraydim++)\n {\n totalsize *= cctk_ash[arraydim];\n }\n\n if (scratchspace_firstindex == -99)\n {\n scratchspace_firstindex = CCTK_FirstVarIndex(\"MOL::SCRATCHSPACE\");\n }\n \n if (scratchspace_firstindex_slow == -99)\n {\n scratchspace_firstindex_slow = CCTK_FirstVarIndex(\"MOL::SCRATCHSPACESLOW\");\n }\n\n switch (MoL_Intermediate_Steps - (*MoL_Intermediate_Step))\n {\n case 0:\n alpha[0] = 1.0/4.0; \n alpha[1] = 0;\n alpha[2] = 0;\n alpha[3] = 0;\n alpha[4] = 0;\n alpha[5] = 0;\n alpha[6] = 0;\n alpha[7] = 0;\n alpha[8] = 0;\n alpha_slow[0] = 1.0/4.0; \n alpha_slow[1] = 0;\n alpha_slow[2] = 0;\n alpha_slow[3] = 0;\n alpha_slow[4] = 0.0; \n alpha_slow[5] = 0;\n alpha_slow[6] = 0;\n alpha_slow[7] = 0;\n alpha_slow[8] = 0;\n break;\n case 1:\n alpha[0] = -1.0/12.0;\n alpha[1] = 1.0/3.0;\n alpha[2] = 0;\n alpha[3] = 0;\n alpha[4] = 0.0;\n alpha[5] = 0.0;\n alpha[6] = 0;\n alpha[7] = 0;\n alpha[8] = 0;\n alpha_slow[0] = 1.0/4.0; \n alpha_slow[1] = 0;\n alpha_slow[2] = 0;\n alpha_slow[3] = 0;\n alpha_slow[4] = 0.0; \n alpha_slow[5] = 0;\n alpha_slow[6] = 0;\n alpha_slow[7] = 0;\n alpha_slow[8] = 0;\n break;\n case 2:\n alpha[0] = 1.0/6.0; \n alpha[1] = -1.0/6.0;\n alpha[2] = 1.0/2.0;\n alpha[3] = 0.0;\n alpha[4] = 0.0; \n alpha[5] = 0.0;\n alpha[6] = 0.0;\n alpha[7] = 0.0;\n alpha[8] = 0.0;\n alpha_slow[0] = 1.0/2.0; \n alpha_slow[1] = 0;\n alpha_slow[2] = 0;\n alpha_slow[3] = 0;\n alpha_slow[4] = 0.0; \n alpha_slow[5] = 0;\n alpha_slow[6] = 0;\n alpha_slow[7] = 0;\n alpha_slow[8] = 0;\n break;\n case 3:\n alpha[0] = 1.0/12.0;\n alpha[1] = 1.0/6.0; \n alpha[2] = 1.0/6.0; \n alpha[3] = 1.0/12.0;\n alpha[4] = 0.0; \n alpha[5] = 0.0;\n alpha[6] = 0.0;\n alpha[7] = 0.0;\n alpha[8] = 0.0;\n alpha_slow[0] = 1.0/2.0; \n alpha_slow[1] = 0;\n alpha_slow[2] = 0;\n alpha_slow[3] = 0;\n alpha_slow[4] = 0.0; \n alpha_slow[5] = 0;\n alpha_slow[6] = 0;\n alpha_slow[7] = 0;\n alpha_slow[8] = 0;\n break;\n case 4:\n alpha[0] = 1.0/12.0;\n alpha[1] = 1.0/6.0; \n alpha[2] = 1.0/6.0; \n alpha[3] = 1.0/6.0;\n alpha[4] = 1.0/12.0; \n alpha[5] = 0.0;\n alpha[6] = 0.0;\n alpha[7] = 0.0;\n alpha[8] = 0.0;\n alpha_slow[0] = -1.0/6.0; \n alpha_slow[1] = 0;\n alpha_slow[2] = 0;\n alpha_slow[3] = 0;\n alpha_slow[4] = 2.0/3.0; \n alpha_slow[5] = 0;\n alpha_slow[6] = 0;\n alpha_slow[7] = 0;\n alpha_slow[7] = 0;\n break;\n case 5:\n alpha[0] = 1.0/12.0;\n alpha[1] = 1.0/6.0; \n alpha[2] = 1.0/6.0; \n alpha[3] = 1.0/12.0;\n alpha[4] = 0.0; \n alpha[5] = 1.0/4.0;\n alpha[6] = 0.0;\n alpha[7] = 0.0;\n alpha[8] = 0.0;\n alpha_slow[0] = 1.0/12.0;\n alpha_slow[1] = 0;\n alpha_slow[2] = 0;\n alpha_slow[3] = 0;\n alpha_slow[4] = 1.0/6.0; \n alpha_slow[5] = 1.0/2.0;\n alpha_slow[6] = 0;\n alpha_slow[7] = 0;\n alpha_slow[7] = 0;\n break;\n case 6:\n alpha[0] = 1.0/12.0;\n alpha[1] = 1.0/6.0; \n alpha[2] = 1.0/6.0; \n alpha[3] = 1.0/12.0;\n alpha[4] = 0.0; \n alpha[5] = -1.0/12.0;\n alpha[6] = 1.0/3.0;\n alpha[7] = 0.0;\n alpha[8] = 0.0;\n alpha_slow[0] = 1.0/12.0; \n alpha_slow[1] = 0;\n alpha_slow[2] = 0;\n alpha_slow[3] = 0;\n alpha_slow[4] = 1.0/6.0; \n alpha_slow[5] = 1.0/2.0;\n alpha_slow[6] = 0;\n alpha_slow[7] = 0;\n alpha_slow[7] = 0;\n break;\n case 7:\n alpha[0] = 1.0/12.0;\n alpha[1] = 1.0/6.0; \n alpha[2] = 1.0/6.0; \n alpha[3] = 1.0/12.0;\n alpha[4] = 0.0; \n alpha[5] = 1.0/6.0;\n alpha[6] = -1.0/6.0;\n alpha[7] = 1.0/2.0;\n alpha[8] = 0.0;\n alpha_slow[0] = 1.0/3.0; \n alpha_slow[1] = 0;\n alpha_slow[2] = 0;\n alpha_slow[3] = 0;\n alpha_slow[4] = -1.0/3.0; \n alpha_slow[5] = 1.0;\n alpha_slow[6] = 0;\n alpha_slow[7] = 0;\n alpha_slow[7] = 0;\n break;\n case 8:\n alpha[0] = 1.0/12.0;\n alpha[1] = 1.0/6.0; \n alpha[2] = 1.0/6.0; \n alpha[3] = 1.0/12.0;\n alpha[4] = 0.0; \n alpha[5] = 1.0/12.0;\n alpha[6] = 1.0/6.0;\n alpha[7] = 1.0/6.0;\n alpha[8] = 1.0/12.0;\n alpha_slow[0] = 1.0/3.0; \n alpha_slow[1] = 0;\n alpha_slow[2] = 0;\n alpha_slow[3] = 0;\n alpha_slow[4] = -1.0/3.0; \n alpha_slow[5] = 1.0;\n alpha_slow[6] = 0;\n alpha_slow[7] = 0;\n alpha_slow[7] = 0;\n break;\n case 9:\n /* alpha is not used in this case */\n break;\n default:\n CCTK_VERROR(\"Internal error. Unexpected substep %d\", (int)*MoL_Intermediate_Step);\n break;\n }\n\n beta[0] = 1.0/12.0;\n beta[1] = 1.0/6.0; \n beta[2] = 1.0/6.0; \n beta[3] = 1.0/12.0;\n beta[4] = 0.0;\n beta[5] = 1.0/12.0;\n beta[6] = 1.0/6.0; \n beta[7] = 1.0/6.0; \n beta[8] = 1.0/12.0;\n beta[9] = 0.0;\n\n beta_slow[0] = 1.0/6.0; \n beta_slow[1] = 0.0; \n beta_slow[2] = 0.0; \n beta_slow[3] = 0.0;\n beta_slow[4] = 1.0/3.0;\n beta_slow[5] = 1.0/3.0; \n beta_slow[6] = 0.0; \n beta_slow[7] = 0.0; \n beta_slow[8] = 0.0;\n beta_slow[9] = 1.0/6.0;\n\n /* FIXME */\n\n\n /* Real GFs, the \"fast\" part */\n\n for (var = 0; var < MoLNumEvolvedVariables; var++)\n {\n \n UpdateVar = (CCTK_REAL *)CCTK_VarDataPtrI(cctkGH, 0, \n EvolvedVariableIndex[var]);\n OldVar = (CCTK_REAL *)CCTK_VarDataPtrI(cctkGH, 1, \n EvolvedVariableIndex[var]);\n RHSVar = (CCTK_REAL const *)CCTK_VarDataPtrI(cctkGH, 0, \n RHSVariableIndex[var]);\n/* #define MOLDEBUG 1 */\n#ifdef MOLDEBUG\n printf(\"In multirate RK. Variable %d (%s). RHS %d (%s). beta %g.\\n\",\n EvolvedVariableIndex[var],\n CCTK_VarName(EvolvedVariableIndex[var]),\n RHSVariableIndex[var],\n CCTK_VarName(RHSVariableIndex[var]),\n beta[MoL_Intermediate_Steps - (*MoL_Intermediate_Step)]);\n#endif\n\n ScratchVar = CCTK_VarDataPtrI(cctkGH, var, \n scratchspace_firstindex\n + (MoL_Intermediate_Steps - (*MoL_Intermediate_Step)));\n\n#pragma omp /*parallel for*/ simd\n for (index = 0; index < totalsize; index++)\n {\n ScratchVar[index] = (*Original_Delta_Time) / cctkGH->cctk_timefac * RHSVar[index];\n \n#ifdef MOLDEBUG\n if (CCTK_EQUALS(verbose,\"extreme\"))\n {\n printf(\"Variable: %d. Index: %d. dt: %f. beta %f. RHS: %f. q: %f.\\n\",\n var, index, (*Original_Delta_Time) / cctkGH->cctk_timefac, beta, RHSVar[index], \n UpdateVar[index]);\n }\n#endif\n }\n \n \n#pragma omp /*parallel for*/ simd\n for (index = 0; index < totalsize; index++)\n {\n UpdateVar[index] = OldVar[index];\n }\n\n if ((*MoL_Intermediate_Step)>1)\n {\n //printf(\"Step %d \\n\", MoL_Intermediate_Steps - (*MoL_Intermediate_Step));\n for (scratchstep = 0; scratchstep <= MoL_Intermediate_Steps - (*MoL_Intermediate_Step); scratchstep++)\n {\n \n //printf(\"Scratch Step %d, alpha %g \\n\", scratchstep, alpha[scratchstep]);\n \n ScratchVar = CCTK_VarDataPtrI(cctkGH, var, \n scratchspace_firstindex\n + scratchstep);\n \n#pragma omp /*parallel for*/ simd\n for (index = 0; index < totalsize; index++)\n {\n UpdateVar[index] += alpha[scratchstep] * ScratchVar[index];\n }\n }\n }\n else\n {\n //printf(\"Final Step!\\n\");\n \n for (scratchstep = 0; scratchstep < MoL_Intermediate_Steps; scratchstep++)\n {\n \n //printf(\"Scratch Step %d, beta %g \\n\", scratchstep, beta[scratchstep]);\n \n ScratchVar = CCTK_VarDataPtrI(cctkGH, var, \n scratchspace_firstindex\n + scratchstep);\n \n#pragma omp /*parallel for*/ simd\n for (index = 0; index < totalsize; index++)\n {\n UpdateVar[index] += beta[scratchstep] * ScratchVar[index];\n }\n }\n }\n\n }\n\n\n for (var = 0; var < MoLNumEvolvedVariablesSlow; var++)\n {\n \n UpdateVar = (CCTK_REAL *)CCTK_VarDataPtrI(cctkGH, 0, \n EvolvedVariableIndexSlow[var]);\n OldVar = (CCTK_REAL *)CCTK_VarDataPtrI(cctkGH, 1, \n EvolvedVariableIndexSlow[var]);\n RHSVar = (CCTK_REAL const *)CCTK_VarDataPtrI(cctkGH, 0, \n RHSVariableIndexSlow[var]);\n/* #define MOLDEBUG 1 */\n#ifdef MOLDEBUG\n printf(\"In multirate RK. SLOW Variable %d (%s). RHS %d (%s). beta %g.\\n\",\n EvolvedVariableIndexSlow[var],\n CCTK_VarName(EvolvedVariableIndexSlow[var]),\n RHSVariableIndexSlow[var],\n CCTK_VarName(RHSVariableIndexSlow[var]),\n beta[MoL_Intermediate_Steps - (*MoL_Intermediate_Step)]);\n#endif\n\n ScratchVar = CCTK_VarDataPtrI(cctkGH, var, \n scratchspace_firstindex_slow\n + (MoL_Intermediate_Steps - (*MoL_Intermediate_Step)));\n\n#pragma omp /*parallel for*/ simd\n for (index = 0; index < totalsize; index++)\n {\n ScratchVar[index] = (*Original_Delta_Time) / cctkGH->cctk_timefac * RHSVar[index];\n \n#ifdef MOLDEBUG\n if (CCTK_EQUALS(verbose,\"extreme\"))\n {\n printf(\"SLOW Variable: %d. Index: %d. dt: %f. beta %f. RHS: %f. q: %f.\\n\",\n var, index, (*Original_Delta_Time) / cctkGH->cctk_timefac, beta, RHSVar[index], \n UpdateVar[index]);\n }\n#endif\n }\n \n \n#pragma omp /*parallel for*/ simd\n for (index = 0; index < totalsize; index++)\n {\n UpdateVar[index] = OldVar[index];\n }\n\n if ((*MoL_Intermediate_Step)>1)\n {\n //printf(\"Step %d \\n\", MoL_Intermediate_Steps - (*MoL_Intermediate_Step));\n for (scratchstep = 0; scratchstep <= MoL_Intermediate_Steps - (*MoL_Intermediate_Step); scratchstep++)\n {\n \n //printf(\"Scratch Step %d, alpha %g \\n\", scratchstep, alpha[scratchstep]);\n \n ScratchVar = CCTK_VarDataPtrI(cctkGH, var, \n scratchspace_firstindex_slow\n + scratchstep);\n \n#pragma omp /*parallel for*/ simd\n for (index = 0; index < totalsize; index++)\n {\n UpdateVar[index] += alpha_slow[scratchstep] * ScratchVar[index];\n }\n }\n }\n else\n {\n //printf(\"Final Step!\\n\");\n \n for (scratchstep = 0; scratchstep < MoL_Intermediate_Steps; scratchstep++)\n {\n \n //printf(\"Scratch Step %d, beta %g \\n\", scratchstep, beta[scratchstep]);\n \n ScratchVar = CCTK_VarDataPtrI(cctkGH, var, \n scratchspace_firstindex_slow\n + scratchstep);\n \n#pragma omp /*parallel for*/ simd\n for (index = 0; index < totalsize; index++)\n {\n UpdateVar[index] += beta_slow[scratchstep] * ScratchVar[index];\n }\n }\n }\n\n }\n\n return;\n}\n", |
| "ICN.c": " /*@@\n @file ICN.c\n @date Sun May 26 04:29:07 2002\n @author Ian Hawke\n @desc \n This implements the more efficient Iterative Crank Nicholson integrator.\n This follows the implementation of ICN in all AEI codes and is \n equivalent to (but hopefully more efficient than) the generic ICN\n integrator also implemented by MoL.\n @enddesc \n @version $Header$\n @@*/\n\n#include \"cctk.h\"\n#include \"cctk_Arguments.h\"\n#include \"cctk_Parameters.h\"\n\n#include \"ExternalVariables.h\"\n\nstatic const char *rcsid = \"$Header$\";\n\nCCTK_FILEVERSION(CactusBase_MoL_ICN_c);\n\n/********************************************************************\n ********************* Local Data Types ***********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Local Routine Prototypes *********************\n ********************************************************************/\n\n/********************************************************************\n ***************** Scheduled Routine Prototypes *********************\n ********************************************************************/\n\nvoid MoL_ICNAdd(CCTK_ARGUMENTS);\nvoid MoL_ICNAverage(CCTK_ARGUMENTS);\n\n/********************************************************************\n ********************* Other Routine Prototypes *********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Local Data *****************************\n ********************************************************************/\n\n/********************************************************************\n ********************* External Routines **********************\n ********************************************************************/\n\n /*@@\n @routine MoL_ICNAdd\n @date Sun May 26 04:17:23 2002\n @author Ian Hawke\n @desc \n Performs Iterative Crank Nicholson time integration. The number of\n steps is arbitrary.\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nvoid MoL_ICNAdd(CCTK_ARGUMENTS)\n{\n\n DECLARE_CCTK_ARGUMENTS_CHECKED(MoL_ICNAdd)\n DECLARE_CCTK_PARAMETERS;\n \n cGroupDynamicData arraydata;\n CCTK_INT groupindex, ierr;\n CCTK_INT arraytotalsize, arraydim;\n\n CCTK_INT index, var;\n CCTK_INT totalsize;\n CCTK_REAL *OldVar;\n CCTK_REAL *UpdateVar;\n CCTK_REAL *RHSVar;\n \n#ifdef MOLDEBUG\n printf(\"Inside ICN.\\nProcessor %d.\\nStep %d.\\nRefinement %d.\\n\"\n \"Timestep %g.\\nSpacestep %g.\\nTime %g\\n\",\n CCTK_MyProc(cctkGH),\n MoL_Intermediate_Steps - *MoL_Intermediate_Step + 1,\n *cctk_levfac,\n CCTK_DELTA_TIME,\n CCTK_DELTA_SPACE(0),\n cctk_time);\n#endif \n\n totalsize = 1;\n for (arraydim = 0; arraydim < cctk_dim; arraydim++)\n {\n totalsize *= cctk_ash[arraydim];\n }\n\n#ifdef MOLDEBUG\n printf(\"MoL: the ICN routine says dt = %f.\\n\", CCTK_DELTA_TIME);\n#endif\n for (var = 0; var < MoLNumEvolvedVariables; var++)\n {\n OldVar = (CCTK_REAL*)CCTK_VarDataPtrI(cctkGH, 1,\n EvolvedVariableIndex[var]);\n UpdateVar = (CCTK_REAL*)CCTK_VarDataPtrI(cctkGH, 0,\n EvolvedVariableIndex[var]);\n RHSVar = (CCTK_REAL*)CCTK_VarDataPtrI(cctkGH, 0, \n RHSVariableIndex[var]);\n \n#pragma omp /*parallel for*/ simd\n for (index = 0; index < totalsize; index++)\n {\n UpdateVar[index] = OldVar[index] + CCTK_DELTA_TIME * RHSVar[index];\n }\n }\n \n for (var = 0; var < MoLNumEvolvedArrayVariables; var++)\n {\n OldVar = (CCTK_REAL*)CCTK_VarDataPtrI(cctkGH, 1,\n EvolvedArrayVariableIndex[var]);\n UpdateVar = (CCTK_REAL*)CCTK_VarDataPtrI(cctkGH, 0,\n EvolvedArrayVariableIndex[var]);\n RHSVar = (CCTK_REAL*)CCTK_VarDataPtrI(cctkGH, 0, \n RHSArrayVariableIndex[var]);\n \n groupindex = CCTK_GroupIndexFromVarI(EvolvedArrayVariableIndex[var]);\n ierr = CCTK_GroupDynamicData(cctkGH, groupindex,\n &arraydata);\n if (ierr)\n {\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING, \n \"The driver does not return group information \"\n \"for group '%s'.\", \n CCTK_GroupName(groupindex));\n }\n arraytotalsize = 1;\n for (arraydim = 0; arraydim < arraydata.dim; arraydim++)\n {\n arraytotalsize *= arraydata.ash[arraydim];\n }\n\n/* CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, */\n/* \"This proc array total size is %d.\", */\n/* arraytotalsize); */\n\n#pragma omp /*parallel for*/ simd\n for (index = 0; index < arraytotalsize; index++)\n {\n UpdateVar[index] = OldVar[index] + CCTK_DELTA_TIME * RHSVar[index];\n }\n }\n\n return;\n\n}\n\n /*@@\n @routine MoL_ICNAverage\n @date Fri Jul 18 14:02:00 2003\n @author Ian Hawke, Erik Schnetter\n @desc \n Averages between the current and the previous time level.\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nvoid MoL_ICNAverage(CCTK_ARGUMENTS)\n{\n\n DECLARE_CCTK_ARGUMENTS_CHECKED(MoL_ICNAverage);\n DECLARE_CCTK_PARAMETERS;\n \n cGroupDynamicData arraydata;\n CCTK_INT groupindex, ierr;\n CCTK_INT arraytotalsize, arraydim;\n\n CCTK_INT index, var;\n CCTK_INT totalsize;\n CCTK_REAL *OldVar;\n CCTK_REAL *UpdateVar;\n \n CCTK_REAL theta;\n\n theta = ICN_avg_theta;\n if (ICN_avg_swapped && (*MoL_Intermediate_Step%2))\n {\n theta = 1.0 - theta;\n }\n\n#ifdef MOLDEBUG\n printf(\"Inside ICN.\\nProcessor %d.\\nStep %d.\\nRefinement %d.\\n\"\n \"Timestep %g.\\nSpacestep %g.\\nTime %g Theta %g\\n\",\n CCTK_MyProc(cctkGH),\n MoL_Intermediate_Steps - *MoL_Intermediate_Step + 1,\n *cctk_levfac,\n CCTK_DELTA_TIME,\n CCTK_DELTA_SPACE(0),\n cctk_time,\n theta);\n#endif \n\n totalsize = 1;\n for (arraydim = 0; arraydim < cctk_dim; arraydim++)\n {\n totalsize *= cctk_ash[arraydim];\n }\n\n#ifdef MOLDEBUG\n printf(\"MoL: the ICN routine says dt = %f.\\n\", CCTK_DELTA_TIME);\n#endif\n for (var = 0; var < MoLNumEvolvedVariables; var++)\n {\n OldVar = (CCTK_REAL*)CCTK_VarDataPtrI(cctkGH, 1,\n EvolvedVariableIndex[var]);\n UpdateVar = (CCTK_REAL*)CCTK_VarDataPtrI(cctkGH, 0,\n EvolvedVariableIndex[var]);\n \n#pragma omp /*parallel for*/ simd\n for (index = 0; index < totalsize; index++)\n {\n/* UpdateVar[index] = 0.5 * (UpdateVar[index] + OldVar[index]); */\n UpdateVar[index] = (1.0 - theta) * UpdateVar[index] + \n theta * OldVar[index];\n }\n }\n \n for (var = 0; var < MoLNumEvolvedArrayVariables; var++)\n {\n OldVar = (CCTK_REAL*)CCTK_VarDataPtrI(cctkGH, 1,\n EvolvedArrayVariableIndex[var]);\n UpdateVar = (CCTK_REAL*)CCTK_VarDataPtrI(cctkGH, 0,\n EvolvedArrayVariableIndex[var]);\n \n groupindex = CCTK_GroupIndexFromVarI(EvolvedArrayVariableIndex[var]);\n ierr = CCTK_GroupDynamicData(cctkGH, groupindex,\n &arraydata);\n if (ierr)\n {\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING, \n \"The driver does not return group information \"\n \"for group '%s'.\", \n CCTK_GroupName(groupindex));\n }\n arraytotalsize = 1;\n for (arraydim = 0; arraydim < arraydata.dim; arraydim++)\n {\n arraytotalsize *= arraydata.ash[arraydim];\n }\n\n#pragma omp /*parallel for*/ simd\n for (index = 0; index < arraytotalsize; index++)\n {\n/* UpdateVar[index] = 0.5 * (UpdateVar[index] + OldVar[index]); */\n UpdateVar[index] = (1.0 - theta) * UpdateVar[index] + \n theta * OldVar[index];\n }\n }\n\n return;\n\n}\n\n/********************************************************************\n ********************* Local Routines *************************\n ********************************************************************/\n", |
| "Counter.c": " /*@@\n @file Counter.c\n @date Mon May 20 09:52:33 2002\n @author Ian Hawke\n @desc \n Routines setting and altering the loop counter.\n @enddesc \n @version $Header$\n @@*/\n\n#include \"cctk.h\"\n#include \"cctk_Arguments.h\"\n#include \"cctk_Parameters.h\"\n\n/* #include \"carpet.h\" */\n\nstatic const char *rcsid = \"$Header$\";\n\nCCTK_FILEVERSION(CactusBase_MoL_Counter_c);\n\n/********************************************************************\n ********************* Local Data Types ***********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Local Routine Prototypes *********************\n ********************************************************************/\n\n/********************************************************************\n ***************** Scheduled Routine Prototypes *********************\n ********************************************************************/\n\nvoid MoL_SetCounter(CCTK_ARGUMENTS);\n\nvoid MoL_DecrementCounter(CCTK_ARGUMENTS);\n\n/********************************************************************\n ********************* Other Routine Prototypes *********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Local Data *****************************\n ********************************************************************/\n\n/********************************************************************\n ********************* External Routines **********************\n ********************************************************************/\n\n /*@@\n @routine MoL_SetCounter\n @date Mon May 20 09:54:39 2002\n @author Ian Hawke\n @desc \n Initially set the counter to the number of intermediate steps.\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nvoid MoL_SetCounter(CCTK_ARGUMENTS)\n{\n\n DECLARE_CCTK_ARGUMENTS_CHECKED(MoL_SetCounter);\n DECLARE_CCTK_PARAMETERS;\n\n *MoL_Intermediate_Step = MoL_Intermediate_Steps;\n\n // Always indicate execution of slow steps.\n // If multirate methods are used, they are set to zero\n // for certain substeps.\n // In any case, outside the MoL loop, these scalars are guaranteed to be 1\n *MoL_SlowStep = 1;\n *MoL_SlowPostStep = 1;\n \n/* #ifdef HAVE_CARPET */\n if ((*MoL_Intermediate_Step))\n {\n /* Disable prolongating during the iterations */\n/* CarpetEnableProlongating (0); */\n if (disable_prolongation)\n {\n if (CCTK_IsFunctionAliased(\"EnableProlongating\"))\n {\n EnableProlongating(0);\n }\n else\n {\n CCTK_WARN(CCTK_WARN_DEBUG, \"Cannot disable prolongation as function\"\n \" \\\"EnableProlongating\\\" is not provided by any thorn!\");\n }\n }\n }\n/* #endif */\n}\n\n /*@@\n @routine MoL_DecrementCounter\n @date Mon May 20 09:55:13 2002\n @author Ian Hawke\n @desc \n During the loop decrement the counter\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nvoid MoL_DecrementCounter(CCTK_ARGUMENTS)\n{\n\n DECLARE_CCTK_ARGUMENTS_CHECKED(MoL_DecrementCounter);\n DECLARE_CCTK_PARAMETERS;\n \n (*MoL_Intermediate_Step) --;\n\n\n if (CCTK_EQUALS(ODE_Method, \"RK2-MR-2:1\"))\n {\n switch (MoL_Intermediate_Steps - *MoL_Intermediate_Step)\n {\n case 2:\n case 4:\n if (*MoL_SlowStep)\n *MoL_SlowPostStep = 1;\n else\n *MoL_SlowPostStep = 0;\n // don't do slow step\n *MoL_SlowStep = 0;\n break;\n default:\n if (!(*MoL_SlowStep))\n *MoL_SlowPostStep = 0;\n else\n *MoL_SlowPostStep = 1;\n // do a slow step!\n *MoL_SlowStep = 1;\n }\n }\n\n if (CCTK_EQUALS(ODE_Method, \"RK4-MR-2:1\"))\n {\n switch (MoL_Intermediate_Steps - *MoL_Intermediate_Step)\n {\n case 2:\n case 4:\n case 7:\n case 9:\n // don't do slow step\n *MoL_SlowStep = 0;\n break;\n default:\n // do a slow step!\n *MoL_SlowStep = 1;\n }\n }\n\n if (CCTK_EQUALS(ODE_Method, \"RK4-RK2\"))\n {\n switch (MoL_Intermediate_Steps - *MoL_Intermediate_Step)\n {\n case 0:\n // do a slow step!\n *MoL_SlowStep = 1;\n // don't sync!\n *MoL_SlowPostStep = 0;\n break;\n case 1:\n case 2:\n // don't do slow step\n *MoL_SlowStep = 0;\n *MoL_SlowPostStep = 0;\n break;\n case 3:\n // do a slow step!\n *MoL_SlowStep = 1;\n // sync!\n *MoL_SlowPostStep = 1;\n }\n }\n\n/* #ifdef HAVE_CARPET */\n if (! (*MoL_Intermediate_Step))\n {\n /* Re-enable prolongating before the final PostStep */\n/* CarpetEnableProlongating (1); */\n if (disable_prolongation)\n {\n if (CCTK_IsFunctionAliased(\"EnableProlongating\"))\n {\n EnableProlongating(1);\n }\n else\n {\n CCTK_WARN(CCTK_WARN_DEBUG, \"Cannot enable prolongation as function\"\n \" \\\"EnableProlongating\\\" is not provided by any thorn!\");\n }\n }\n }\n/* #endif */\n}\n\n/********************************************************************\n ********************* Local Routines *************************\n ********************************************************************/\n", |
| "IndexArrays.c": " /*@@\n @file IndexArrays.c\n @date Mon Jun 3 13:15:30 2002\n @author Ian Hawke\n @desc \n Routines for dealing with the index arrays in \n @seefile ExternalVariables.h\n @enddesc \n @version $Header$\n @@*/\n\n#include \"cctk.h\"\n#include \"cctk_Arguments.h\"\n#include \"cctk_Parameters.h\"\n#include \"util_String.h\"\n\n#include <stdlib.h>\n#include <stdio.h>\n#include <string.h>\n#include \"ExternalVariables.h\"\n\nstatic const char *rcsid = \"$Header$\";\n\nCCTK_FILEVERSION(CactusBase_MoL_IndexArrays_c);\n\n/********************************************************************\n ********************* Local Data Types ***********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Local Routine Prototypes *********************\n ********************************************************************/\n\n/********************************************************************\n ***************** Scheduled Routine Prototypes *********************\n ********************************************************************/\n\nvoid MoL_SetupIndexArrays(CCTK_ARGUMENTS);\n\nvoid MoL_FreeIndexArrays(CCTK_ARGUMENTS);\n\n/********************************************************************\n ********************* Other Routine Prototypes *********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Local Data *****************************\n ********************************************************************/\n\n/********************************************************************\n ********************* External Routines **********************\n ********************************************************************/\n\n /*@@\n @routine MoL_SetupIndexArrays\n @date Mon Jun 3 13:24:05 2002\n @author Ian Hawke\n @desc \n Allocates sufficient space for the index arrays.\n These arrays are defined in the external file\n @seefile ExternalVariables.h\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nvoid MoL_SetupIndexArrays(CCTK_ARGUMENTS) \n{\n\n DECLARE_CCTK_ARGUMENTS_CHECKED(MoL_SetupIndexArrays);\n DECLARE_CCTK_PARAMETERS;\n\n char *infoline;\n\n /* Initialize the time variables */\n\n *Original_Time = cctkGH->cctk_time;\n *Original_Delta_Time = cctkGH->cctk_delta_time;\n\n /* \n Presumably a user will not try to register more variables than the total\n number of Cactus variables\n */\n\n MoLMaxNumRegisteredVariables = CCTK_NumVars();\n\n /* \n We only want to set up the index arrays once.\n With mesh refinement this routine could be scheduled\n multiple times, leading to multiple copies of the\n index arrays used at different times!!!\n */\n\n if (EvolvedVariableIndex)\n {\n return;\n }\n\n\n if (MoLMaxNumRegisteredVariables)\n {\n EvolvedVariableIndex = (CCTK_INT *)malloc(MoLMaxNumRegisteredVariables * \n\t\t\t\t\t sizeof(CCTK_INT));\n if (!EvolvedVariableIndex)\n {\n\tCCTK_ERROR(\"Failed to allocate the evolved variable index array\");\n }\n\n RHSVariableIndex = (CCTK_INT *)malloc(MoLMaxNumRegisteredVariables * \n\t\t\t\t\t sizeof(CCTK_INT));\n if (!RHSVariableIndex)\n {\n\tCCTK_ERROR(\"Failed to allocate the RHS variable index array\");\n }\n }\n\n if (MoLMaxNumRegisteredVariables)\n {\n EvolvedVariableIndexSlow = (CCTK_INT *)malloc(MoLMaxNumRegisteredVariables * \n\t\t\t\t\t sizeof(CCTK_INT));\n if (!EvolvedVariableIndexSlow)\n {\n\tCCTK_ERROR(\"Failed to allocate the slow evolved variable index array\");\n }\n\n RHSVariableIndexSlow = (CCTK_INT *)malloc(MoLMaxNumRegisteredVariables * \n\t\t\t\t\t sizeof(CCTK_INT));\n if (!RHSVariableIndexSlow)\n {\n\tCCTK_ERROR(\"Failed to allocate the slow RHS variable index array\");\n }\n }\n\n if (MoLMaxNumRegisteredVariables)\n {\n ConstrainedVariableIndex = (CCTK_INT *)malloc(MoLMaxNumRegisteredVariables * \n\t\t\t\t\t\t sizeof(CCTK_INT));\n if (!ConstrainedVariableIndex)\n {\n\tCCTK_ERROR(\"Failed to allocate the constrained variable index array\");\n }\n }\n\n if (MoLMaxNumRegisteredVariables)\n {\n SandRVariableIndex = (CCTK_INT *)malloc(MoLMaxNumRegisteredVariables * \n\t\t\t\t\t sizeof(CCTK_INT));\n if (!SandRVariableIndex)\n {\n CCTK_ERROR(\"Failed to allocate the save and restore \"\n\t\t\"variable index array\");\n }\n }\n\n if (EvolvedArrayVariableIndex)\n {\n return;\n }\n\n if (MoLMaxNumRegisteredVariables)\n {\n EvolvedArrayVariableIndex = (CCTK_INT *)malloc(MoLMaxNumRegisteredVariables * \n\t\t\t\t\t\t sizeof(CCTK_INT));\n if (!EvolvedArrayVariableIndex)\n {\n CCTK_ERROR(\"Failed to allocate the evolved array variable index array\");\n }\n \n RHSArrayVariableIndex = (CCTK_INT *)malloc(MoLMaxNumRegisteredVariables * \n\t\t\t\t\t sizeof(CCTK_INT));\n if (!RHSArrayVariableIndex)\n {\n CCTK_ERROR(\"Failed to allocate the RHS array variable index array\");\n }\n }\n\n if (MoLMaxNumRegisteredVariables)\n {\n ConstrainedArrayVariableIndex = (CCTK_INT *)malloc(MoLMaxNumRegisteredVariables * \n\t\t\t\t\t\t sizeof(CCTK_INT));\n if (!ConstrainedArrayVariableIndex)\n {\n CCTK_ERROR(\"Failed to allocate the constrained array \"\n \"variable index array\");\n }\n }\n\n if (MoLMaxNumRegisteredVariables)\n {\n SandRArrayVariableIndex = (CCTK_INT *)malloc(MoLMaxNumRegisteredVariables * \n\t\t\t\t\t\t sizeof(CCTK_INT));\n if (!SandRArrayVariableIndex)\n {\n CCTK_ERROR(\"Failed to allocate the save and restore \"\n \"array variable index array\");\n }\n }\n\n infoline = (char *)malloc((strlen(Generic_Method_Descriptor)+100)*\n sizeof(char));\n if (!infoline) \n {\n CCTK_ERROR(\"Failed to malloc 100 characters!\");\n }\n if (CCTK_EQUALS(ODE_Method,\"Generic\")) \n {\n if (CCTK_EQUALS(Generic_Type,\"ICN\"))\n {\n sprintf(infoline,\"Generic Iterative Crank Nicholson with %i iterations\", \n (int)MoL_Intermediate_Steps);\n }\n else if (CCTK_EQUALS(Generic_Type,\"RK\"))\n {\n sprintf(infoline, \"Generic Runge-Kutta %i\",(int)MoL_Intermediate_Steps);\n }\n else if (CCTK_EQUALS(Generic_Type,\"Table\"))\n {\n sprintf(infoline, \"Generic method, options:\\n %s\\n\",\n Generic_Method_Descriptor);\n }\n else if (CCTK_EQUALS(Generic_Type,\"Classic RK3\")) \n {\n sprintf(infoline, \"Classic Runge-Kutta 3\");\n }\n else\n {\n CCTK_ERROR(\"Generic_Type not recognized!\");\n }\n }\n else if (CCTK_EQUALS(ODE_Method,\"Euler\")) \n {\n sprintf(infoline, \"Euler\");\n }\n else if (CCTK_EQUALS(ODE_Method,\"RK2\")) \n {\n sprintf(infoline, \"Runge-Kutta 2\");\n }\n else if (CCTK_EQUALS(ODE_Method,\"RK2-central\")) \n {\n sprintf(infoline, \"Runge-Kutta 2 (central)\");\n }\n else if (CCTK_EQUALS(ODE_Method,\"RK3\")) \n {\n sprintf(infoline, \"Runge-Kutta 3\");\n }\n else if (CCTK_EQUALS(ODE_Method,\"RK4\")) \n {\n sprintf(infoline, \"Runge-Kutta 4\");\n }\n else if (CCTK_EQUALS(ODE_Method,\"RK45\")) \n {\n sprintf(infoline, \"Runge-Kutta 45 (Fehlberg)\");\n }\n else if (CCTK_EQUALS(ODE_Method,\"RK45CK\")) \n {\n sprintf(infoline, \"Runge-Kutta 45 (Cash-Karp)\");\n }\n else if (CCTK_EQUALS(ODE_Method,\"RK65\")) \n {\n sprintf(infoline, \"Runge-Kutta 65\");\n }\n else if (CCTK_EQUALS(ODE_Method,\"RK87\")) \n {\n sprintf(infoline, \"Runge-Kutta 87\");\n }\n else if (CCTK_EQUALS(ODE_Method,\"ICN\"))\n {\n sprintf(infoline, \"Iterative Crank Nicholson with %i iterations\", \n (int)MoL_Intermediate_Steps);\n }\n else if (CCTK_EQUALS(ODE_Method,\"ICN-avg\"))\n {\n sprintf(infoline,\n \"Averaging iterative Crank Nicholson with %i iterations\", \n (int)MoL_Intermediate_Steps);\n }\n else if (CCTK_EQUALS(ODE_Method,\"AB\"))\n {\n if (CCTK_EQUALS(AB_Type,\"1\"))\n {\n sprintf(infoline, \"Adams-Bashforth of order 1\");\n }\n else if (CCTK_EQUALS(AB_Type,\"2\"))\n {\n sprintf(infoline, \"Adams-Bashforth of order 2\");\n }\n else if (CCTK_EQUALS(AB_Type,\"3\"))\n {\n sprintf(infoline, \"Adams-Bashforth of order 3\");\n }\n else if (CCTK_EQUALS(AB_Type,\"4\"))\n {\n sprintf(infoline, \"Adams-Bashforth of order 4\");\n }\n else if (CCTK_EQUALS(AB_Type,\"5\"))\n {\n sprintf(infoline, \"Adams-Bashforth of order 5\");\n }\n else\n {\n CCTK_ERROR(\"AB_Type not recognized!\");\n }\n }\n else if (CCTK_EQUALS(ODE_Method,\"RK2-MR-2:1\")) \n {\n sprintf(infoline, \"Multi-rate 2:1 Runge-Kutta 2\");\n }\n else if (CCTK_EQUALS(ODE_Method,\"RK4-MR-2:1\")) \n {\n sprintf(infoline, \"Multi-rate 2:1 Runge-Kutta 4\");\n }\n else if (CCTK_EQUALS(ODE_Method,\"RK4-RK2\")) \n {\n sprintf(infoline, \"Multi-rate 2:1 Runge-Kutta 4 and Runge-Kutta 2\");\n }\n else \n {\n CCTK_ERROR(\"ODE_Method not recognized!\");\n }\n \n CCTK_VInfo(CCTK_THORNSTRING, \"Using %s as the time integrator.\", infoline);\n \n free(infoline);\n infoline = NULL;\n\n // These scalars must be 1 oustide of the MoL loop.\n // They will only be zero for certain substeps when multirate methods are used.\n // Otherwise, they are guaranteed to always be ONE.\n *MoL_SlowPostStep = 1;\n *MoL_SlowStep = 1;\n\n return;\n\n}\n\n /*@@\n @routine MoL_FreeIndexArrays\n @date Mon Jun 3 13:26:15 2002\n @author Ian Hawke\n @desc \n Frees the external index arrays. \n These arrays are defined in the external file\n @seefile ExternalVariables.h\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nvoid MoL_FreeIndexArrays(CCTK_ARGUMENTS)\n{\n \n if (EvolvedVariableIndex)\n {\n free(EvolvedVariableIndex);\n EvolvedVariableIndex = NULL;\n }\n\n if (RHSVariableIndex)\n {\n free(RHSVariableIndex); \n RHSVariableIndex = NULL;\n }\n\n if (EvolvedVariableIndexSlow)\n {\n free(EvolvedVariableIndexSlow);\n EvolvedVariableIndexSlow = NULL;\n }\n\n if (RHSVariableIndexSlow)\n {\n free(RHSVariableIndexSlow); \n RHSVariableIndexSlow = NULL;\n }\n\n if (ConstrainedVariableIndex)\n {\n free(ConstrainedVariableIndex);\n ConstrainedVariableIndex = NULL;\n }\n\n if (SandRVariableIndex)\n {\n free(SandRVariableIndex);\n SandRVariableIndex = NULL;\n }\n \n if (EvolvedArrayVariableIndex)\n {\n free(EvolvedArrayVariableIndex);\n EvolvedArrayVariableIndex = NULL;\n }\n\n if (RHSArrayVariableIndex)\n {\n free(RHSArrayVariableIndex); \n RHSArrayVariableIndex = NULL;\n }\n\n if (ConstrainedArrayVariableIndex)\n {\n free(ConstrainedArrayVariableIndex);\n ConstrainedArrayVariableIndex = NULL;\n }\n\n if (SandRArrayVariableIndex)\n {\n free(SandRArrayVariableIndex);\n SandRArrayVariableIndex = NULL;\n }\n \n if (ArrayScratchSizes)\n {\n free(ArrayScratchSizes);\n ArrayScratchSizes = NULL;\n }\n \n if (ArrayScratchSpace)\n {\n free(ArrayScratchSpace);\n ArrayScratchSpace = NULL;\n }\n\n return;\n \n}\n\n/********************************************************************\n ********************* Local Routines *************************\n ********************************************************************/\n", |
| "SandR.c": " /*@@\n @file SandR.c\n @date Sun May 26 03:35:58 2002\n @author Ian Hawke\n @desc \n Restores the Save and Restore variables to their original positions.\n @enddesc \n @version $Header$\n @@*/\n\n#include <string.h>\n\n#include \"cctk.h\"\n#include \"cctk_Arguments.h\"\n#include \"cctk_Parameters.h\"\n\n#include \"ExternalVariables.h\"\n#include \"Operators.h\"\n\nstatic const char *rcsid = \"$Header$\";\n\nCCTK_FILEVERSION(CactusBase_MoL_SandR_c);\n\n/********************************************************************\n ********************* Local Data Types ***********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Local Routine Prototypes *********************\n ********************************************************************/\n\n/********************************************************************\n ***************** Scheduled Routine Prototypes *********************\n ********************************************************************/\n\nvoid MoL_RestoreSandR(CCTK_ARGUMENTS);\n\n/********************************************************************\n ********************* Other Routine Prototypes *********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Local Data *****************************\n ********************************************************************/\n\n/********************************************************************\n ********************* External Routines **********************\n ********************************************************************/\n\n /*@@\n @routine MoL_RestoreSandR\n @date Sun May 26 03:39:02 2002\n @author Ian Hawke\n @desc \n Save and Restore variables are those that the physics thorn may \n need to know to calculate the RHS, but which may be evolved by\n something other than MoL. In order to get the timelevels correct,\n the previous timelevel is copied to the current before the MoL step.\n As we do not know whether the variable will be evolved before or\n after MoL we must save the data that was in the current timelevel, \n and then restore it at the end of the MoL timestep. This routine\n restores the variables.\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nvoid MoL_RestoreSandR(CCTK_ARGUMENTS) \n{\n \n DECLARE_CCTK_PARAMETERS;\n \n int rl = 0;\n if (CCTK_IsFunctionAliased(\"GetRefinementLevel\")) {\n rl = GetRefinementLevel(cctkGH);\n }\n const int tl = 0;\n\n const int scratchvarindex = CCTK_FirstVarIndex(\"MOL::SANDRSCRATCHSPACE\");\n if (scratchvarindex < 0)\n {\n CCTK_ERROR(\"Internal error\");\n }\n\n for (CCTK_INT var = 0; var < MoLNumSandRVariables; var++) \n {\n const int nsrc = 1;\n const CCTK_INT srcs[1] = {scratchvarindex};\n const CCTK_INT tls[1] = {var};\n const CCTK_REAL facts[1] = {1.0};\n \n MoL_LinearCombination(cctkGH, SandRVariableIndex[var], rl, tl, 0.0,\n srcs, tls, facts, nsrc);\n }\n\n return;\n \n}\n\n/********************************************************************\n ********************* Local Routines *************************\n ********************************************************************/\n", |
| "Startup.c": " /*@@\n @file Startup.c\n @date Wed May 22 02:09:19 2002\n @author \n @desc \n Register the startup banner.\n The external variables are also declared here. These are \n the arrays containing the variable indexes and right hand sides, \n and the number of each type of variable currently in use (the \n parameters only give the maximum possible for each type).\n @enddesc \n @version $Header$\n @@*/\n\n#include <stddef.h>\n\n#include \"cctk.h\"\n#include \"ExternalVariables.h\"\n\nstatic const char *rcsid = \"$Header$\";\n\nCCTK_FILEVERSION(CactusBase_MoL_Startup_c);\n\n/********************************************************************\n ******************** External Variables **********************\n ********************************************************************/\n\nCCTK_INT *restrict EvolvedVariableIndex = NULL;\nCCTK_INT *restrict EvolvedVariableIndexSlow = NULL;\nCCTK_INT *restrict RHSVariableIndex = NULL;\nCCTK_INT *restrict RHSVariableIndexSlow = NULL;\nCCTK_INT *restrict ConstrainedVariableIndex = NULL;\nCCTK_INT *restrict SandRVariableIndex = NULL;\n\nCCTK_INT MoLNumEvolvedVariables = 0;\nCCTK_INT MoLNumEvolvedVariablesSlow = 0;\nCCTK_INT MoLNumConstrainedVariables = 0;\nCCTK_INT MoLNumSandRVariables = 0;\n\n\nCCTK_INT *restrict EvolvedArrayVariableIndex = NULL;\nCCTK_INT *restrict RHSArrayVariableIndex = NULL;\nCCTK_INT *restrict ConstrainedArrayVariableIndex = NULL;\nCCTK_INT *restrict SandRArrayVariableIndex = NULL;\n\nCCTK_INT MoLNumEvolvedArrayVariables = 0;\nCCTK_INT MoLNumConstrainedArrayVariables = 0;\nCCTK_INT MoLNumSandRArrayVariables = 0;\n\n\nCCTK_INT ScheduleStatus = 0;\n\nCCTK_REAL *restrict ArrayScratchSpace = NULL;\nCCTK_INT *restrict ArrayScratchSizes = NULL;\nCCTK_INT CurrentArrayScratchSize = 0;\n\nCCTK_REAL *restrict ArrayErrorSpace = NULL;\nCCTK_INT *restrict ArrayErrorSizes = NULL;\nCCTK_INT CurrentArrayErrorSize = 0;\n\nCCTK_INT MoLMaxNumRegisteredVariables = 0;\n\n/********************************************************************\n ********************* Local Data Types ***********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Local Routine Prototypes *********************\n ********************************************************************/\n\n/********************************************************************\n ***************** Scheduled Routine Prototypes *********************\n ********************************************************************/\n\nint MoL_Startup(void);\n\n/********************************************************************\n ********************* Other Routine Prototypes *********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Local Data *****************************\n ********************************************************************/\n\n/********************************************************************\n ********************* External Routines **********************\n ********************************************************************/\n\n /*@@\n @routine MoL_Startup\n @date Wed May 22 02:17:17 2002\n @author Ian Hawke\n @desc \n Register the startup banner with the flesh.\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nint MoL_Startup(void) \n{\n \n const char *banner = \"MoL: Generalized time integration.\";\n \n CCTK_RegisterBanner(banner);\n \n return 0;\n \n}\n\n/********************************************************************\n ********************* Local Routines *************************\n ********************************************************************/\n", |
| "RK3.c": " /*@@\n @file RK3.c\n @date Tue Jul 22 00:38:47 2003\n @author Ian Hawke\n @desc \n A specialized third order Runge-Kutta time integrator. This is\n the integrator that Shu refers to as the optimal TVD third \n order method (see reference in documentation).\n @enddesc \n @version $Header$\n @@*/\n\n#include \"cctk.h\"\n#include \"cctk_Arguments.h\"\n#include \"cctk_Parameters.h\"\n\n#include \"ExternalVariables.h\"\n#include \"Operators.h\"\n\nstatic const char *rcsid = \"$Header$\";\n\nCCTK_FILEVERSION(CactusBase_MoL_RK3_c);\n\n/********************************************************************\n ********************* Local Data Types ***********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Local Routine Prototypes *********************\n ********************************************************************/\n\n/********************************************************************\n ***************** Scheduled Routine Prototypes *********************\n ********************************************************************/\n\nvoid MoL_RK3Add(CCTK_ARGUMENTS);\n\n/********************************************************************\n ********************* Other Routine Prototypes *********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Local Data *****************************\n ********************************************************************/\n\n/********************************************************************\n ********************* External Routines **********************\n ********************************************************************/\n\n /*@@\n @routine MoL_RK3Add\n @date Tue Jul 22 00:39:55 2003\n @author Ian Hawke\n @desc \n Performs third order Runge-Kutta time integration.\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n @@*/\n\nvoid MoL_RK3Add(CCTK_ARGUMENTS)\n{\n\n DECLARE_CCTK_ARGUMENTS_CHECKED(MoL_RK3Add)\n DECLARE_CCTK_PARAMETERS;\n\n CCTK_INT arraydim;\n \n CCTK_INT var;\n CCTK_INT totalsize;\n \n#ifdef MOLDEBUG\n printf(\"Inside RK3.\\nStep %d.\\nRefinement %d.\\nTimestep %g.\\n\"\n \"Spacestep %g.\\nTime %g\\n\",\n MoL_Intermediate_Steps - *MoL_Intermediate_Step + 1,\n *cctk_levfac,\n CCTK_DELTA_TIME,\n CCTK_DELTA_SPACE(0),\n cctk_time);\n#endif \n\n totalsize = 1;\n for (arraydim = 0; arraydim < cctk_dim; arraydim++)\n {\n totalsize *= cctk_ash[arraydim];\n }\n\n CCTK_INT rl = 0;\n if (CCTK_IsFunctionAliased(\"GetRefinementLevel\")) {\n rl = GetRefinementLevel(cctkGH);\n }\n CCTK_INT tl = 0;\n \n switch (*MoL_Intermediate_Step)\n {\n\n case 3:\n {\n for (var = 0; var < MoLNumEvolvedVariables; var++)\n {\n int const nsrcs = 1;\n CCTK_INT const srcs[] = {RHSVariableIndex[var]};\n CCTK_INT const tls[] = {0};\n CCTK_REAL const facts[] = {CCTK_DELTA_TIME};\n MoL_LinearCombination(cctkGH,\n EvolvedVariableIndex[var], rl, tl, 1.0,\n srcs, tls, facts, nsrcs);\n }\n\n for (var = 0; var < MoLNumEvolvedArrayVariables; var++)\n {\n int const nsrcs = 1;\n CCTK_INT const srcs[] = {RHSArrayVariableIndex[var]};\n CCTK_INT const tls[] = {0};\n CCTK_REAL const facts[] = {CCTK_DELTA_TIME};\n MoL_LinearCombination(cctkGH,\n EvolvedArrayVariableIndex[var], rl, tl, 1.0,\n srcs, tls, facts, nsrcs);\n }\n\n break;\n }\n \n case 2:\n {\n for (var = 0; var < MoLNumEvolvedVariables; var++)\n {\n int const nsrcs = 2;\n CCTK_INT const srcs[] =\n {EvolvedVariableIndex[var], RHSVariableIndex[var]};\n CCTK_INT const tls[] = {1, 0};\n CCTK_REAL const facts[] = {0.75, CCTK_DELTA_TIME};\n MoL_LinearCombination(cctkGH,\n EvolvedVariableIndex[var], rl, tl, 0.25,\n srcs, tls, facts, nsrcs);\n }\n\n for (var = 0; var < MoLNumEvolvedArrayVariables; var++)\n {\n int const nsrcs = 2;\n CCTK_INT const srcs[] =\n {EvolvedArrayVariableIndex[var], RHSArrayVariableIndex[var]};\n CCTK_INT const tls[] = {1, 0};\n CCTK_REAL const facts[] = {0.75, CCTK_DELTA_TIME};\n MoL_LinearCombination(cctkGH,\n EvolvedArrayVariableIndex[var], rl, tl, 0.25,\n srcs, tls, facts, nsrcs);\n }\n break;\n }\n case 1:\n {\n for (var = 0; var < MoLNumEvolvedVariables; var++)\n {\n int const nsrcs = 2;\n CCTK_INT const srcs[] =\n {EvolvedVariableIndex[var], RHSVariableIndex[var]};\n CCTK_INT const tls[] = {1, 0};\n CCTK_REAL const facts[] = {1.0/3.0, CCTK_DELTA_TIME};\n MoL_LinearCombination(cctkGH,\n EvolvedVariableIndex[var], rl, tl, 2.0/3.0,\n srcs, tls, facts, nsrcs);\n }\n\n for (var = 0; var < MoLNumEvolvedArrayVariables; var++)\n {\n int const nsrcs = 2;\n CCTK_INT const srcs[] =\n {EvolvedArrayVariableIndex[var], RHSArrayVariableIndex[var]};\n CCTK_INT const tls[] = {1, 0};\n CCTK_REAL const facts[] = {1.0/3.0, CCTK_DELTA_TIME};\n MoL_LinearCombination(cctkGH,\n EvolvedArrayVariableIndex[var], rl, tl, 2.0/3.0,\n srcs, tls, facts, nsrcs);\n }\n break;\n }\n default:\n {\n CCTK_ERROR(\"RK3 expects MoL_Intermediate_Step to be \"\n \"in [1,3]. This should be caught at ParamCheck - bug Ian!\");\n break;\n }\n \n }\n\n return;\n\n}\n\n/********************************************************************\n ********************* Local Routines *************************\n ********************************************************************/\n", |
| "RK45.c": " /*@@\n @file RK45.c\n @date Sun May 26 03:47:15 2002\n @author Ian Hawke\n @desc \n RK45 following Forsythe, Malcolm and Moler\n (Computer Methods for Mathematical Computations).\n @enddesc \n @version $Header$\n @@*/\n\n#include \"ExternalVariables.h\"\n#include \"Operators.h\"\n\n#include <cctk.h>\n#include <cctk_Arguments.h>\n#include <cctk_Parameters.h>\n\n#include <assert.h>\n\nstatic const char *rcsid = \"$Header$\";\n\nCCTK_FILEVERSION(CactusNumerical_MoL_RK45_c);\n\n/********************************************************************\n ********************* Local Data Types ***********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Local Routine Prototypes *********************\n ********************************************************************/\n\n/********************************************************************\n ***************** Scheduled Routine Prototypes *********************\n ********************************************************************/\n\nvoid MoL_RK45Add(CCTK_ARGUMENTS);\n\n/********************************************************************\n ********************* Other Routine Prototypes *********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Local Data *****************************\n ********************************************************************/\n\n/********************************************************************\n ********************* External Routines **********************\n ********************************************************************/\n\n /*@@\n @routine MoL_RK45Add\n @date Sun May 26 03:50:44 2002\n @author Ian Hawke\n @desc \n Performs a single step of a Runge-Kutta 45 type time\n integration, storing the error estimate.\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nvoid MoL_RK45Add(CCTK_ARGUMENTS)\n{\n DECLARE_CCTK_ARGUMENTS_CHECKED(MoL_RK45Add);\n DECLARE_CCTK_PARAMETERS;\n \n /* Fehlberg coefficients\n <https://en.wikipedia.org/wiki/Runge-Kutta-Fehlberg_method> */\n static const CCTK_REAL beta_array_F[5][5] = {\n { 1.0/4.0, 0.0, 0.0, 0.0, 0.0 },\n { 3.0/32.0, 9.0/32.0, 0.0, 0.0, 0.0 },\n { 1932.0/2197.0, -7200.0/2197.0, 7296.0/2197.0, 0.0, 0.0 },\n { 439.0/216.0, -8.0, 3680.0/513.0, -845.0/4104.0, 0.0 },\n { -8.0/27.0, 2.0, -3544.0/2565.0, 1859.0/4104.0, -11.0/40.0 }\n };\n\n static const CCTK_REAL gamma_array_F[6] = \n { 16.0/135.0, 0.0, 6656.0/12825.0, 28561.0/56430.0, -9.0/50.0, 2.0/55.0 };\n\n static const CCTK_REAL gammastar_array_F[6] = \n { 25.0/216.0, 0.0, 1408.0/2565.0, 2197.0/4104.0, -1.0/5.0, 0.0 };\n \n /* Cash-Karp coefficients */\n static const CCTK_REAL beta_array_CK[5][5] = {\n { 1.0/5.0, 0.0, 0.0, 0.0, 0.0, },\n { 3.0/40.0, 9.0/40.0, 0.0, 0.0, 0.0, },\n { 3.0/10.0, -9.0/10.0, 6.0/5.0, 0.0, 0.0, },\n { -11.0/54.0, 5.0/2.0, -70.0/27.0, 35.0/27.0, 0.0, },\n { 1631.0/55296.0, 175.0/512.0, 575.0/13824.0, 44275.0/110592.0,\n 253.0/4096.0, },\n };\n\n static const CCTK_REAL gamma_array_CK[6] = {\n 37.0/378.0,\n 0.0,\n 250.0/621.0,\n 125.0/594.0,\n 0.0,\n 512.0/1771.0,\n };\n\n static const CCTK_REAL gammastar_array_CK[6] = {\n 2825.0/27648.0,\n 0.0,\n 18575.0/48384.0,\n 13525.0/55296.0,\n 277.0/14336.0,\n 1.0/4.0,\n };\n\n const CCTK_REAL (* restrict beta_array)[5];\n const CCTK_REAL * restrict gamma_array;\n const CCTK_REAL * restrict gammastar_array;\n\n if (CCTK_EQUALS(ODE_Method, \"RK45\"))\n {\n beta_array = beta_array_F;\n gamma_array = gamma_array_F;\n gammastar_array = gammastar_array_F;\n }\n else if (CCTK_EQUALS(ODE_Method, \"RK45CK\"))\n {\n beta_array = beta_array_CK;\n gamma_array = gamma_array_CK;\n gammastar_array = gammastar_array_CK;\n }\n else\n {\n CCTK_ERROR (\"internal error\");\n /* Avoid compiler warnings */\n beta_array = NULL; \n gammastar_array = NULL;\n gamma_array = NULL;\n }\n\n CCTK_INT rl = 0;\n if (CCTK_IsFunctionAliased(\"GetRefinementLevel\")) {\n rl = GetRefinementLevel(cctkGH);\n }\n\n const int scratchvarindex = CCTK_FirstVarIndex(\"MOL::SCRATCHSPACE\");\n if (scratchvarindex < 0)\n {\n CCTK_ERROR(\"Internal error\");\n }\n const int errorvarindex = CCTK_FirstVarIndex(\"MOL::ERRORESTIMATE\");\n if (errorvarindex < 0)\n {\n CCTK_ERROR(\"Internal error\");\n }\n\n const int mol_step = MoL_Intermediate_Steps - *MoL_Intermediate_Step;\n\n /* Real GFs */\n\n /* First store (dt times) the RHS in the scratch array. */\n for (int var = 0; var < MoLNumEvolvedVariables; var++)\n {\n const CCTK_INT nsrcs = 1;\n const CCTK_INT srcs[] = {RHSVariableIndex[var]};\n const CCTK_INT tls[] = {0};\n const CCTK_REAL facts[] = {*Original_Delta_Time / cctkGH->cctk_timefac};\n const CCTK_INT dst = scratchvarindex + mol_step;\n const CCTK_INT tl = var;\n MoL_LinearCombination(cctkGH, dst, rl, tl, 0.0, srcs, tls, facts, nsrcs);\n }\n\n if (mol_step < MoL_Intermediate_Steps - 1)\n { \n for (int var = 0; var < MoLNumEvolvedVariables; var++)\n {\n const int num_scratchsteps = mol_step + 1;\n CCTK_INT srcs[num_scratchsteps + 1];\n CCTK_INT tls[num_scratchsteps + 1];\n CCTK_REAL facts[num_scratchsteps + 1];\n CCTK_INT nsrcs = 0;\n srcs[nsrcs] = EvolvedVariableIndex[var];\n tls[nsrcs] = 1;\n facts[nsrcs] = 1.0;\n ++ nsrcs;\n for (int scratchstep = 0; scratchstep < num_scratchsteps; ++ scratchstep)\n {\n const CCTK_REAL beta = beta_array[mol_step][scratchstep];\n if (beta != 0.0)\n {\n srcs[nsrcs] = scratchvarindex + scratchstep;\n tls[nsrcs] = var;\n facts[nsrcs] = beta;\n ++ nsrcs;\n }\n }\n const CCTK_INT dst = EvolvedVariableIndex[var];\n const CCTK_INT tl = 0;\n MoL_LinearCombination(cctkGH, dst, rl, tl, 0.0, srcs, tls, facts, nsrcs);\n }\n }\n else\n {\n assert(mol_step == 5);\n for (int var = 0; var < MoLNumEvolvedVariables; var++)\n {\n const int num_scratchsteps = 6;\n CCTK_INT srcs[num_scratchsteps + 1];\n CCTK_INT tls[num_scratchsteps + 1];\n CCTK_REAL facts[num_scratchsteps + 1];\n CCTK_INT nsrcs = 0;\n srcs[nsrcs] = EvolvedVariableIndex[var];\n tls[nsrcs] = 1;\n facts[nsrcs] = 1.0;\n ++ nsrcs;\n for (int scratchstep = 0; scratchstep < num_scratchsteps; ++ scratchstep)\n {\n const CCTK_REAL gamma = gamma_array[scratchstep];\n if (gamma != 0.0)\n {\n srcs[nsrcs] = scratchvarindex + scratchstep;\n tls[nsrcs] = var;\n facts[nsrcs] = gamma;\n ++ nsrcs;\n }\n }\n const CCTK_INT dst = EvolvedVariableIndex[var];\n const CCTK_INT tl = 0;\n MoL_LinearCombination(cctkGH, dst, rl, tl, 0.0, srcs, tls, facts, nsrcs);\n }\n for (int var = 0; var < MoLNumEvolvedVariables; var++)\n {\n const int num_scratchsteps = 6;\n CCTK_INT srcs[num_scratchsteps];\n CCTK_INT tls[num_scratchsteps];\n CCTK_REAL facts[num_scratchsteps];\n CCTK_INT nsrcs = 0;\n for (int scratchstep = 0; scratchstep < num_scratchsteps; ++ scratchstep)\n {\n const CCTK_REAL gamma_error =\n gamma_array[scratchstep] - gammastar_array[scratchstep];\n if (gamma_error != 0.0)\n {\n srcs[nsrcs] = scratchvarindex + scratchstep;\n tls[nsrcs] = var;\n facts[nsrcs] = gamma_error;\n ++ nsrcs;\n }\n }\n const CCTK_INT dst = errorvarindex;\n const CCTK_INT tl = var;\n MoL_LinearCombination(cctkGH, dst, rl, tl, 0.0, srcs, tls, facts, nsrcs);\n }\n }\n\n /* Real arrays */\n\n /* First store (dt times) the RHS in the scratch array. */\n CCTK_INT arrayscratchlocation = 0;\n for (int var = 0; var < MoLNumEvolvedArrayVariables; var++)\n {\n int groupindex = CCTK_GroupIndexFromVarI(RHSArrayVariableIndex[var]);\n if (groupindex<0) CCTK_ERROR(\"internal error\");\n cGroupDynamicData arraydata;\n int ierr = CCTK_GroupDynamicData(cctkGH, groupindex, &arraydata);\n if (ierr) CCTK_ERROR(\"internal error\");\n CCTK_INT arraysize = 1;\n for (int d=0; d<arraydata.dim; ++d)\n arraysize *= arraydata.ash[d];\n\n {\n const CCTK_INT nsrcs = 1;\n const CCTK_REAL *restrict const srcs[] =\n {CCTK_VarDataPtrI(cctkGH, 0, RHSArrayVariableIndex[var])};\n const CCTK_REAL facts[] = {*Original_Delta_Time / cctkGH->cctk_timefac};\n CCTK_REAL *restrict const dst =\n &ArrayScratchSpace[mol_step * CurrentArrayScratchSize +\n arrayscratchlocation];\n const CCTK_INT size = arraysize;\n MoL_LinearCombination_REAL(cctkGH, dst, size, 0.0, srcs, facts, nsrcs);\n }\n\n if (mol_step < MoL_Intermediate_Steps - 1)\n { \n const int num_scratchsteps = mol_step + 1;\n const CCTK_REAL *restrict srcs[num_scratchsteps + 1];\n CCTK_REAL facts[num_scratchsteps + 1];\n CCTK_INT nsrcs = 0;\n srcs[nsrcs] = CCTK_VarDataPtrI(cctkGH, 1, EvolvedArrayVariableIndex[var]);\n facts[nsrcs] = 1.0;\n ++ nsrcs;\n for (int scratchstep = 0; scratchstep < num_scratchsteps; ++ scratchstep)\n {\n const CCTK_REAL beta = beta_array[mol_step][scratchstep];\n if (beta != 0.0)\n {\n srcs[nsrcs] =\n &ArrayScratchSpace[scratchstep * CurrentArrayScratchSize +\n arrayscratchlocation];\n facts[nsrcs] = beta;\n ++ nsrcs;\n }\n }\n CCTK_REAL *restrict const dst =\n CCTK_VarDataPtrI(cctkGH, 0, EvolvedArrayVariableIndex[var]);\n const CCTK_INT size = arraysize;\n MoL_LinearCombination_REAL(cctkGH, dst, size, 0.0, srcs, facts, nsrcs);\n }\n else\n {\n assert(mol_step == 5);\n\n {\n const int num_scratchsteps = 6;\n const CCTK_REAL *restrict srcs[num_scratchsteps + 1];\n CCTK_REAL facts[num_scratchsteps + 1];\n CCTK_INT nsrcs = 0;\n srcs[nsrcs] =\n CCTK_VarDataPtrI(cctkGH, 1, EvolvedArrayVariableIndex[var]);\n facts[nsrcs] = 1.0;\n ++ nsrcs;\n for (int scratchstep = 0; scratchstep < num_scratchsteps;\n ++ scratchstep)\n {\n const CCTK_REAL gamma = gamma_array[scratchstep];\n if (gamma != 0.0)\n {\n srcs[nsrcs] =\n &ArrayScratchSpace[scratchstep * CurrentArrayScratchSize +\n arrayscratchlocation];\n facts[nsrcs] = gamma;\n ++ nsrcs;\n }\n }\n CCTK_REAL *restrict const dst =\n CCTK_VarDataPtrI(cctkGH, 0, EvolvedArrayVariableIndex[var]);\n const CCTK_INT size = arraysize;\n MoL_LinearCombination_REAL(cctkGH, dst, size, 0.0, srcs, facts, nsrcs);\n }\n\n {\n const int num_scratchsteps = 6;\n const CCTK_REAL *restrict srcs[num_scratchsteps];\n CCTK_REAL facts[num_scratchsteps];\n CCTK_INT nsrcs = 0;\n for (int scratchstep = 0; scratchstep < num_scratchsteps;\n ++ scratchstep)\n {\n const CCTK_REAL gamma_error =\n gamma_array[scratchstep] - gammastar_array[scratchstep];\n if (gamma_error != 0.0)\n {\n srcs[nsrcs] =\n &ArrayScratchSpace[scratchstep * CurrentArrayScratchSize +\n arrayscratchlocation];\n facts[nsrcs] = gamma_error;\n ++ nsrcs;\n }\n }\n CCTK_REAL *restrict const dst = &ArrayErrorSpace[arrayscratchlocation];\n const CCTK_INT size = arraysize;\n MoL_LinearCombination_REAL(cctkGH, dst, size, 0.0, srcs, facts, nsrcs);\n }\n }\n }\n}\n\n/********************************************************************\n ********************* Local Routines *************************\n ********************************************************************/\n", |
| "InitialCopy.c": " /*@@\n @file InitialCopy.c\n @date Sun May 26 04:43:06 2002\n @author Ian Hawke\n @desc \n Performs the initial copy from the previous timelevel to the\n current. This is required because the driver has rotated the \n timelevels, but the physics thorns are expecting data in the\n current.\n @enddesc \n @version $Header$\n @@*/\n\n#include <stdlib.h>\n#include <stdio.h>\n#include <string.h>\n\n#include \"cctk.h\"\n#include \"cctk_Arguments.h\"\n#include \"cctk_Parameters.h\"\n\n#include \"ExternalVariables.h\"\n#include \"Operators.h\"\n\nstatic const char *rcsid = \"$Header$\";\n\nCCTK_FILEVERSION(CactusBase_MoL_InitialCopy_c);\n\n/********************************************************************\n ********************* Local Data Types ***********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Local Routine Prototypes *********************\n ********************************************************************/\n\n/********************************************************************\n ***************** Scheduled Routine Prototypes *********************\n ********************************************************************/\n\nvoid MoL_AllocateArrayScratch(CCTK_ARGUMENTS);\n\nvoid MoL_InitialCopy(CCTK_ARGUMENTS);\n\nvoid MoL_InitRHS(CCTK_ARGUMENTS);\n\nvoid MoL_FillAllLevels(CCTK_ARGUMENTS);\n\nvoid MoL_ReportNumberVariables(CCTK_ARGUMENTS);\n\n/********************************************************************\n ********************* Other Routine Prototypes *********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Local Data *****************************\n ********************************************************************/\n\n/********************************************************************\n ********************* External Routines **********************\n ********************************************************************/\n\n /*@@\n @routine MoL_AllocateArrayScratch\n @date ???\n @author Erik Schnetter\n @desc \n Allocate sufficient space for array scratch variables\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nvoid MoL_AllocateScratch(CCTK_ARGUMENTS)\n{\n DECLARE_CCTK_PARAMETERS;\n \n cGroupDynamicData arraydata;\n CCTK_INT groupindex, ierr;\n CCTK_INT arraytotalsize, arraydim;\n CCTK_INT totalarrayscratchsize;\n\n CCTK_INT var;\n \n /* Set up the array sizes */\n\n if (MoLNumEvolvedArrayVariables)\n {\n if (!ArrayScratchSizes)\n {\n ArrayScratchSizes =\n malloc(MoLNumEvolvedArrayVariables * sizeof *ArrayScratchSizes);\n if (!ArrayScratchSizes)\n {\n CCTK_ERROR(\"Failed to allocate the array scratch sizes array.\");\n }\n for (var = 0; var < MoLNumEvolvedArrayVariables; var++)\n {\n ArrayScratchSizes[var] = -1;\n }\n }\n }\n \n totalarrayscratchsize = 0;\n\n for (var = 0; var < MoLNumEvolvedArrayVariables; var++)\n {\n groupindex = CCTK_GroupIndexFromVarI(EvolvedArrayVariableIndex[var]);\n ierr = CCTK_GroupDynamicData(cctkGH, groupindex,\n &arraydata);\n if (ierr)\n {\n CCTK_VERROR(\"The driver does not return group information \"\n \"for group '%s'.\", \n CCTK_GroupName(groupindex));\n }\n arraytotalsize = 1;\n for (arraydim = 0; arraydim < arraydata.dim; arraydim++)\n {\n arraytotalsize *= arraydata.ash[arraydim];\n }\n\n ArrayScratchSizes[var] = arraytotalsize;\n totalarrayscratchsize += arraytotalsize;\n }\n\n if (totalarrayscratchsize > CurrentArrayScratchSize)\n {\n if (ArrayScratchSpace)\n {\n free(ArrayScratchSpace);\n ArrayScratchSpace = NULL;\n }\n ArrayScratchSpace = \n (CCTK_REAL*)malloc(totalarrayscratchsize * \n MoL_Num_Scratch_Levels * \n sizeof(CCTK_REAL));\n for (var = 0; var < totalarrayscratchsize * MoL_Num_Scratch_Levels; var++)\n {\n ArrayScratchSpace[var] = 0.0;\n }\n CurrentArrayScratchSize = totalarrayscratchsize;\n }\n}\n\n /*@@\n @routine MoL_InitialCopy\n @date ???\n @author Ian Hawke\n @desc \n Copy the previous time level to the current time level.\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nvoid MoL_InitialCopy(CCTK_ARGUMENTS)\n{\n\n DECLARE_CCTK_ARGUMENTS_CHECKED(MoL_InitialCopy);\n DECLARE_CCTK_PARAMETERS;\n \n cGroupDynamicData arraydata;\n CCTK_INT groupindex, ierr;\n CCTK_INT arraytotalsize, arraydim;\n CCTK_INT totalarrayscratchsize;\n\n CCTK_INT var;\n CCTK_INT totalsize;\n\n CCTK_REAL * restrict CurrentVar;\n CCTK_REAL const * restrict PreviousVar;\n CCTK_INT StorageOn;\n\n totalsize = 1;\n for (arraydim = 0; arraydim < cctk_dim; arraydim++)\n {\n totalsize *= cctk_ash[arraydim];\n }\n\n int rl = 0;\n if (CCTK_IsFunctionAliased(\"GetRefinementLevel\")) {\n rl = GetRefinementLevel(cctkGH);\n }\n const int tl = 0;\n\n for (var = 0; var < MoLNumEvolvedVariables; var++)\n {\n const int nsrc = 1;\n const CCTK_INT srcs[1] = {EvolvedVariableIndex[var]};\n const CCTK_INT tls[1] = {1};\n const CCTK_REAL facts[1] = {1.0};\n \n StorageOn = CCTK_QueryGroupStorageI\n (cctkGH, CCTK_GroupIndexFromVarI(EvolvedVariableIndex[var]));\n \n if (StorageOn < 0)\n {\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\"Warning for index %i\", \n (int)EvolvedVariableIndex[var]);\n CCTK_ERROR(\"The index passed does not correspond to a GF.\");\n }\n else if (StorageOn == 0) {\n#ifdef MOLDEBUG\n printf(\"Aargh! Vars %d var %d index %d name %s\\n\",\n MoLNumEvolvedVariables, var, EvolvedVariableIndex[var], \n CCTK_VarName(EvolvedVariableIndex[var]));\n#endif\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\"Warning for GF %s\", \n CCTK_VarName(EvolvedVariableIndex[var]));\n CCTK_ERROR(\"The grid function does not have storage assigned.\");\n }\n \n MoL_LinearCombination(cctkGH, EvolvedVariableIndex[var], rl, tl, 0.0,\n srcs, tls, facts, nsrc);\n }\n\n for (var = 0; var < MoLNumEvolvedVariablesSlow; var++)\n {\n const CCTK_INT nsrc = 1;\n const CCTK_INT srcs[1] = {EvolvedVariableIndexSlow[var]};\n const CCTK_INT tls[1] = {1};\n const CCTK_REAL facts[1] = {1.0};\n \n StorageOn = CCTK_QueryGroupStorageI\n (cctkGH,\n CCTK_GroupIndexFromVarI(EvolvedVariableIndexSlow[var]));\n \n if (StorageOn < 0)\n {\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\"Warning for index %i\", \n (int)EvolvedVariableIndexSlow[var]);\n CCTK_ERROR(\"The index passed does not correspond to a GF.\");\n }\n else if (StorageOn == 0) {\n#ifdef MOLDEBUG\n printf(\"Aargh! Vars %d var %d index %d name %s\\n\",\n MoLNumEvolvedVariablesSlow, var, EvolvedVariableIndexSlow[var], \n CCTK_VarName(EvolvedVariableIndexSlow[var]));\n#endif\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\"Warning for GF %s\", \n CCTK_VarName(EvolvedVariableIndexSlow[var]));\n CCTK_ERROR(\"The grid function does not have storage assigned.\");\n }\n \n MoL_LinearCombination(cctkGH, EvolvedVariableIndexSlow[var], rl, tl, 0.0,\n srcs, tls, facts, nsrc);\n }\n \n /* Set up the array sizes */\n \n totalarrayscratchsize = 0;\n\n for (var = 0; var < MoLNumEvolvedArrayVariables; var++)\n {\n PreviousVar = (CCTK_REAL const*)CCTK_VarDataPtrI(cctkGH, 1,\n EvolvedArrayVariableIndex[var]);\n CurrentVar = (CCTK_REAL*)CCTK_VarDataPtrI(cctkGH, 0,\n EvolvedArrayVariableIndex[var]);\n \n groupindex = CCTK_GroupIndexFromVarI(EvolvedArrayVariableIndex[var]);\n ierr = CCTK_GroupDynamicData(cctkGH, groupindex,\n &arraydata);\n if (ierr)\n {\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING, \n \"The driver does not return group information \"\n \"for group '%s'.\", \n CCTK_GroupName(groupindex));\n }\n arraytotalsize = 1;\n for (arraydim = 0; arraydim < arraydata.dim; arraydim++)\n {\n arraytotalsize *= arraydata.ash[arraydim];\n }\n\n ArrayScratchSizes[var] = arraytotalsize;\n totalarrayscratchsize += arraytotalsize;\n\n if (arraytotalsize)\n { \n if (PreviousVar && CurrentVar)\n { \n memcpy(CurrentVar, PreviousVar, arraytotalsize * sizeof(CCTK_REAL));\n }\n else\n {\n printf(\"The pointers are %p (prev) and %p (curr)\\n.\",\n PreviousVar, CurrentVar);\n CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,\"Null pointer for variable %s\", \n CCTK_VarName(EvolvedArrayVariableIndex[var]));\n }\n }\n }\n \n\n /* \n Now the Save and Restore variables. Shift the data in the \n current level to the scratch space, then do the copy \n */\n\n const int scratchvarindex = CCTK_FirstVarIndex(\"MOL::SANDRSCRATCHSPACE\");\n if (scratchvarindex < 0)\n {\n CCTK_ERROR(\"Internal error\");\n }\n\n for (var = 0; var < MoLNumSandRVariables; var++)\n {\n const int nsrc_save = 1;\n const CCTK_INT srcs_save[1] = {SandRVariableIndex[var]};\n const CCTK_INT tls_save[1] = {0};\n const CCTK_REAL facts_save[1] = {1.0};\n const int nsrc = 1;\n const CCTK_INT srcs[1] = {SandRVariableIndex[var]};\n const CCTK_INT tls[1] = {1};\n const CCTK_REAL facts[1] = {1.0};\n \n StorageOn = CCTK_QueryGroupStorageI\n (cctkGH,\n CCTK_GroupIndexFromVarI(SandRVariableIndex[var]));\n \n if (StorageOn < 0)\n {\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\"Warning for index %i\", \n (int)SandRVariableIndex[var]);\n CCTK_ERROR(\"The index passed does not correspond to a GF.\");\n }\n else if (StorageOn == 0) {\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\"Warning for GF %s\", \n CCTK_VarName(SandRVariableIndex[var]));\n CCTK_ERROR(\"The grid function does not have storage assigned.\");\n }\n\n MoL_LinearCombination(cctkGH, scratchvarindex, rl, var, 0.0,\n srcs_save, tls_save, facts_save, nsrc_save);\n MoL_LinearCombination(cctkGH, SandRVariableIndex[var], rl, tl, 0.0,\n srcs, tls, facts, nsrc);\n } \n\n /*\n Now do the constrained variables.\n */\n\n for (var = 0; var < MoLNumConstrainedVariables; var++)\n {\n const int nsrc = 1;\n const CCTK_INT srcs[1] = {ConstrainedVariableIndex[var]};\n const CCTK_INT tls[1] = {1};\n const CCTK_REAL facts[1] = {1.0};\n \n StorageOn = CCTK_QueryGroupStorageI\n (cctkGH,\n CCTK_GroupIndexFromVarI(ConstrainedVariableIndex[var]));\n \n if (StorageOn < 0)\n {\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\"Warning for index %i\", \n (int)ConstrainedVariableIndex[var]);\n CCTK_ERROR(\"The index passed does not correspond to a GF.\");\n }\n else if (StorageOn == 0) {\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\"Warning for GF %s\", \n CCTK_VarName(ConstrainedVariableIndex[var]));\n CCTK_ERROR(\"The grid function does not have storage assigned.\");\n }\n\n /* \n Check that there is more than one timelevel.\n If not, copying is unnecessary.\n */\n\n StorageOn = CCTK_ActiveTimeLevelsVI(cctkGH,\n ConstrainedVariableIndex[var]);\n \n if (StorageOn > 1)\n {\n MoL_LinearCombination(cctkGH, ConstrainedVariableIndex[var], rl, tl, 0.0,\n srcs, tls, facts, nsrc);\n }\n \n }\n\n return;\n}\n\n /*@@\n @routine MoL_InitRHS\n @date Tue Mar 23 2004\n @author Erik Schnetter\n @desc \n Initialise all RHS variables with zero.\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nvoid MoL_InitRHS(CCTK_ARGUMENTS)\n{\n\n DECLARE_CCTK_ARGUMENTS_CHECKED(MoL_InitRHS);\n DECLARE_CCTK_PARAMETERS;\n \n cGroupDynamicData arraydata;\n CCTK_INT groupindex, ierr;\n CCTK_INT arraytotalsize, arraydim;\n\n CCTK_INT var;\n CCTK_INT index;\n/* CCTK_INT i,j,k; */\n CCTK_INT totalsize;\n\n CCTK_REAL * restrict RHSVar;\n CCTK_INT StorageOn;\n\n totalsize = 1;\n for (arraydim = 0; arraydim < cctk_dim; arraydim++)\n {\n totalsize *= cctk_ash[arraydim];\n }\n\n CCTK_INT rl = 0;\n if (CCTK_IsFunctionAliased(\"GetRefinementLevel\")) {\n rl = GetRefinementLevel(cctkGH);\n }\n CCTK_INT tl = 0;\n \n for (var = 0; var < MoLNumEvolvedVariables; var++)\n {\n StorageOn = CCTK_QueryGroupStorageI(cctkGH,\n CCTK_GroupIndexFromVarI(RHSVariableIndex[var]));\n \n if (StorageOn < 0)\n {\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\"Warning for index %i\", \n (int)RHSVariableIndex[var]);\n CCTK_ERROR(\"The index passed does not correspond to a GF.\");\n }\n else if (StorageOn == 0) {\n#ifdef MOLDEBUG\n printf(\"Aargh! Vars %d var %d index %d name %s\\n\",\n MoLNumEvolvedVariables, var, RHSVariableIndex[var], \n CCTK_VarName(RHSVariableIndex[var]));\n#endif\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\"Warning for GF %s\", \n CCTK_VarName(RHSVariableIndex[var]));\n CCTK_ERROR(\"The grid function does not have storage assigned.\");\n }\n \n MoL_LinearCombination(cctkGH, RHSVariableIndex[var], rl, tl, 0.0,\n NULL, NULL, NULL, 0);\n }\n \n for (var = 0; var < MoLNumEvolvedVariablesSlow; var++)\n {\n StorageOn = CCTK_QueryGroupStorageI(cctkGH,\n CCTK_GroupIndexFromVarI(RHSVariableIndexSlow[var]));\n \n if (StorageOn < 0)\n {\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\"Warning for index %i\", \n (int)RHSVariableIndexSlow[var]);\n CCTK_ERROR(\"The index passed does not correspond to a GF.\");\n }\n else if (StorageOn == 0) {\n#ifdef MOLDEBUG\n printf(\"Aargh! Vars %d var %d index %d name %s\\n\",\n MoLNumEvolvedVariablesSlow, var, RHSVariableIndexSlow[var], \n CCTK_VarName(RHSVariableIndexSlow[var]));\n#endif\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\"Warning for GF %s\", \n CCTK_VarName(RHSVariableIndexSlow[var]));\n CCTK_ERROR(\"The grid function does not have storage assigned.\");\n }\n \n MoL_LinearCombination(cctkGH, RHSVariableIndexSlow[var], rl, tl, 0.0,\n NULL, NULL, NULL, 0);\n }\n \n for (var = 0; var < MoLNumEvolvedArrayVariables; var++)\n {\n RHSVar = (CCTK_REAL*)CCTK_VarDataPtrI(cctkGH, 0,\n RHSArrayVariableIndex[var]);\n \n groupindex = CCTK_GroupIndexFromVarI(RHSArrayVariableIndex[var]);\n ierr = CCTK_GroupDynamicData(cctkGH, groupindex,\n &arraydata);\n if (ierr)\n {\n CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING, \n \"The driver does not return group information \"\n \"for group '%s'.\", \n CCTK_GroupName(groupindex));\n }\n arraytotalsize = 1;\n for (arraydim = 0; arraydim < arraydata.dim; arraydim++)\n {\n arraytotalsize *= arraydata.ash[arraydim];\n }\n\n if (arraytotalsize)\n {\n if (RHSVar)\n {\n#pragma omp /*parallel for*/ simd\n for (index = 0; index < arraytotalsize; index++)\n {\n RHSVar[index] = 0;\n }\n }\n else\n {\n printf(\"The pointer is %p (rhs)\\n.\",\n RHSVar);\n CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,\"Null pointer for variable %s\", \n CCTK_VarName(RHSArrayVariableIndex[var]));\n }\n }\n \n }\n\n return;\n}\n\n /*@@\n @routine MoL_FillAllLevels\n @date Fri Apr 25 16:11:18 2003\n @author Ian Hawke\n @desc \n This routine is a bit of a hack, and I'm still not convinced \n it is really necessary. It fills the previous timelevels by \n copying the data from the current timelevels, which should have\n been set up during the CCTK_INITIAL timebin.\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nvoid MoL_FillAllLevels(CCTK_ARGUMENTS)\n{\n\n DECLARE_CCTK_ARGUMENTS_CHECKED(MoL_FillAllLevels);\n DECLARE_CCTK_PARAMETERS;\n\n CCTK_INT var, level;\n CCTK_INT totalsize, arraydim;\n\n CCTK_REAL const * restrict CurrentVar;\n CCTK_REAL * restrict PreviousVar;\n\n totalsize = 1;\n for (arraydim = 0; arraydim < cctk_dim; arraydim++)\n {\n totalsize *= cctk_ash[arraydim];\n }\n\n for (var = 0; var < MoLNumEvolvedVariables; var++)\n {\n CurrentVar = (CCTK_REAL const*)CCTK_VarDataPtrI(cctkGH, 0, \n EvolvedVariableIndex[var]);\n for (level = 1; \n level < CCTK_ActiveTimeLevelsVI(cctkGH,\n EvolvedVariableIndex[var]); \n level++)\n {\n PreviousVar = (CCTK_REAL*)CCTK_VarDataPtrI(cctkGH, level, \n EvolvedVariableIndex[var]);\n if (PreviousVar)\n { \n memcpy(PreviousVar, CurrentVar, totalsize * sizeof(CCTK_REAL));\n }\n }\n }\n \n\n for (var = 0; var < MoLNumEvolvedVariablesSlow; var++)\n {\n CurrentVar = (CCTK_REAL const*)CCTK_VarDataPtrI(cctkGH, 0, \n EvolvedVariableIndexSlow[var]);\n for (level = 1; \n level < CCTK_ActiveTimeLevelsVI(cctkGH,\n EvolvedVariableIndexSlow[var]); \n level++)\n {\n PreviousVar = (CCTK_REAL*)CCTK_VarDataPtrI(cctkGH, level, \n EvolvedVariableIndexSlow[var]);\n if (PreviousVar)\n { \n memcpy(PreviousVar, CurrentVar, totalsize * sizeof(CCTK_REAL));\n }\n }\n }\n \n\n for (var = 0; var < MoLNumConstrainedVariables; var++)\n {\n CurrentVar = (CCTK_REAL const*)CCTK_VarDataPtrI(cctkGH, 0, \n ConstrainedVariableIndex[var]);\n for (level = 1; level < CCTK_ActiveTimeLevelsVI(cctkGH,\n ConstrainedVariableIndex[var]); level++)\n {\n PreviousVar = (CCTK_REAL*)CCTK_VarDataPtrI(cctkGH, level, \n ConstrainedVariableIndex[var]);\n if (PreviousVar)\n { \n memcpy(PreviousVar, CurrentVar, totalsize * sizeof(CCTK_REAL));\n }\n }\n }\n \n\n for (var = 0; var < MoLNumSandRVariables; var++)\n {\n CurrentVar = (CCTK_REAL const*)CCTK_VarDataPtrI(cctkGH, 0, \n SandRVariableIndex[var]);\n for (level = 1; level < CCTK_ActiveTimeLevelsVI(cctkGH,\n SandRVariableIndex[var]); \n level++)\n {\n PreviousVar = (CCTK_REAL*)CCTK_VarDataPtrI(cctkGH, level, \n SandRVariableIndex[var]);\n if (PreviousVar)\n { \n memcpy(PreviousVar, CurrentVar, totalsize * sizeof(CCTK_REAL));\n }\n }\n }\n\n return;\n}\n\n /*@@\n @routine MoL_ReportNumberVariables\n @date Thu Jul 17 18:35:54 2003\n @author Ian Hawke\n @desc \n Prints some useful information about the number of\n registered functions.\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nvoid MoL_ReportNumberVariables(CCTK_ARGUMENTS)\n{\n\n DECLARE_CCTK_PARAMETERS;\n\n CCTK_INT var;\n\n CCTK_VInfo(CCTK_THORNSTRING,\n \"The maximum number of evolved variables is %d. \"\n \"%d are registered.\",\n (int)MoLMaxNumRegisteredVariables,(int)MoLNumEvolvedVariables);\n\n CCTK_VInfo(CCTK_THORNSTRING,\n \"The maximum number of slow evolved variables is %d. \"\n \"%d are registered.\",\n (int)MoLMaxNumRegisteredVariables,(int)MoLNumEvolvedVariablesSlow);\n\n CCTK_VInfo(CCTK_THORNSTRING,\n \"The maximum number of constrained variables is %d. \"\n \"%d are registered.\",\n (int)MoLMaxNumRegisteredVariables,(int)MoLNumConstrainedVariables);\n \n CCTK_VInfo(CCTK_THORNSTRING,\n \"The maximum number of SandR variables is %d. \"\n \"%d are registered.\",\n (int)MoLMaxNumRegisteredVariables,(int)MoLNumSandRVariables);\n \n\n CCTK_VInfo(CCTK_THORNSTRING,\n \"The maximum number of evolved array variables is %d. \"\n \"%d are registered.\",\n (int)MoLMaxNumRegisteredVariables,\n (int)MoLNumEvolvedArrayVariables);\n \n CCTK_VInfo(CCTK_THORNSTRING,\n \"The maximum number of constrained array variables is %d. \"\n \"%d are registered.\",\n (int)MoLMaxNumRegisteredVariables,\n (int)MoLNumConstrainedArrayVariables);\n \n CCTK_VInfo(CCTK_THORNSTRING,\n \"The maximum number of SandR array variables is %d. \"\n \"%d are registered.\",\n (int)MoLMaxNumRegisteredVariables,\n (int)MoLNumSandRArrayVariables);\n \n\n CCTK_VInfo(CCTK_THORNSTRING,\n \"The maximum size of any array variables is %d.\",\n (int)MoL_Max_Evolved_Array_Size);\n\n if (CCTK_Equals(verbose, \"register\"))\n {\n\n if (MoLNumEvolvedVariables)\n {\n CCTK_INFO(\"The evolved variables are:\");\n for (var = 0; var < MoLNumEvolvedVariables; var++)\n {\n CCTK_VInfo(CCTK_THORNSTRING,\" %d : %s\",\n (int)var, CCTK_VarName(EvolvedVariableIndex[var]));\n }\n }\n\n if (MoLNumConstrainedVariables)\n { \n CCTK_INFO(\"The constrained variables are:\");\n for (var = 0; var < MoLNumConstrainedVariables; var++)\n {\n CCTK_VInfo(CCTK_THORNSTRING,\" %d : %s\",\n (int)var, CCTK_VarName(ConstrainedVariableIndex[var]));\n }\n }\n \n if (MoLNumSandRVariables)\n {\n CCTK_INFO(\"The save and restore variables are:\");\n for (var = 0; var < MoLNumSandRVariables; var++)\n {\n CCTK_VInfo(CCTK_THORNSTRING,\" %d : %s\",\n (int)var, CCTK_VarName(SandRVariableIndex[var]));\n }\n }\n \n if (MoLNumEvolvedArrayVariables)\n {\n CCTK_INFO(\"The evolved array variables are:\");\n for (var = 0; var < MoLNumEvolvedArrayVariables; var++)\n {\n CCTK_VInfo(CCTK_THORNSTRING,\" %d : %s\",\n (int)var, CCTK_VarName(EvolvedArrayVariableIndex[var]));\n }\n }\n\n if (MoLNumConstrainedArrayVariables)\n { \n CCTK_INFO(\"The constrained array variables are:\");\n for (var = 0; var < MoLNumConstrainedArrayVariables; var++)\n {\n CCTK_VInfo(CCTK_THORNSTRING,\" %d : %s\",\n (int)var, CCTK_VarName(ConstrainedArrayVariableIndex[var]));\n }\n }\n \n if (MoLNumSandRArrayVariables)\n {\n CCTK_INFO(\"The save and restore array variables are:\");\n for (var = 0; var < MoLNumSandRArrayVariables; var++)\n {\n CCTK_VInfo(CCTK_THORNSTRING,\" %d : %s\",\n (int)var, CCTK_VarName(SandRArrayVariableIndex[var]));\n }\n }\n \n }\n\n return;\n}\n", |
| "RK4-RK2.c": " /*@@\n @file RK4-RK2.c\n @date 2012-03-25\n @author Christian Reisswig\n @desc \n A routine to perform homegrown RK4RK2 evolution. Mostly copied from\n genericRK.c\n @enddesc \n @version $Header$\n @@*/\n\n#include \"cctk.h\"\n#include \"cctk_Arguments.h\"\n#include \"cctk_Parameters.h\"\n\n#include <stdio.h>\n\n#include \"ExternalVariables.h\"\n\n/* #define MOLDEBUG */\n\n /*@@\n @routine MoL_RK4_RK2_Add\n @date \n @author \n @desc \n Performs a single step of a RK4_RK2 type time\n integration.\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n @@*/ \n\n\nvoid MoL_RK4_RK2_Add(CCTK_ARGUMENTS)\n{\n DECLARE_CCTK_ARGUMENTS_CHECKED(MoL_RK4_RK2_Add);\n DECLARE_CCTK_PARAMETERS;\n \n static int scratchspace_firstindex = -1;\n static int scratchspace_firstindex_slow = -1;\n if (scratchspace_firstindex < 0) {\n scratchspace_firstindex = CCTK_FirstVarIndex(\"MOL::SCRATCHSPACE\");\n scratchspace_firstindex_slow = CCTK_FirstVarIndex(\"MOL::SCRATCHSPACESLOW\");\n }\n \n int const step = MoL_Intermediate_Steps - *MoL_Intermediate_Step;\n \n int totalsize = 1;\n for (int d=0; d<cctk_dim; ++d) totalsize *= cctk_ash[d];\n \n CCTK_REAL const dt = *Original_Delta_Time / cctkGH->cctk_timefac;\n \n \n \n int const allvar1 = MoLNumEvolvedVariables + MoLNumEvolvedVariablesSlow;\n for (int var1=0; var1<allvar1; ++var1) {\n \n if (var1 < MoLNumEvolvedVariables) {\n /* a fast variable */\n int const var = var1;\n \n CCTK_REAL *restrict const UpdateVar =\n CCTK_VarDataPtrI(cctkGH, 0, EvolvedVariableIndex[var]);\n CCTK_REAL const *restrict const OldVar =\n CCTK_VarDataPtrI(cctkGH, 1, EvolvedVariableIndex[var]);\n CCTK_REAL const *restrict const RHSVar =\n CCTK_VarDataPtrI(cctkGH, 0, RHSVariableIndex[var]);\n \n#define SCRATCHINDEX(step) \\\n (scratchspace_firstindex + (step))\n CCTK_REAL *restrict const ScratchVar =\n CCTK_VarDataPtrI(cctkGH, var, SCRATCHINDEX(0));\n \n switch (step) {\n \n case 0:\n#pragma omp simd\n for (int i=0; i<totalsize; ++i) {\n CCTK_REAL const scaled_rhs = dt * RHSVar[i];\n ScratchVar[i] = OldVar[i] + 1.0/6.0 * scaled_rhs;\n UpdateVar[i] = OldVar[i] + 0.5 * scaled_rhs;\n }\n break;\n \n case 1:\n#pragma omp simd\n for (int i=0; i<totalsize; ++i) {\n CCTK_REAL const scaled_rhs = dt * RHSVar[i];\n ScratchVar[i] += 1.0/3.0 * scaled_rhs;\n UpdateVar[i] = OldVar[i] + 0.5 * scaled_rhs;\n }\n break;\n \n case 2:\n#pragma omp simd\n for (int i=0; i<totalsize; ++i) {\n CCTK_REAL const scaled_rhs = dt * RHSVar[i];\n ScratchVar[i] += 1.0/3.0 * scaled_rhs;\n UpdateVar[i] = OldVar[i] + scaled_rhs;\n }\n break;\n \n case 3:\n#pragma omp simd\n for (int i=0; i<totalsize; ++i) {\n CCTK_REAL const scaled_rhs = dt * RHSVar[i];\n /* ScratchVar contains OldVar */\n UpdateVar[i] = ScratchVar[i] + 1.0/6.0 * scaled_rhs;\n }\n break;\n \n default:\n CCTK_VERROR(\"Internal error. Unexpected substep %d\", (int)*MoL_Intermediate_Step);\n break;\n }\n#undef SCRATCHINDEX\n \n } else {\n /* a slow variable */\n int const var = var1 - MoLNumEvolvedVariables;\n \n CCTK_REAL *restrict const UpdateVar =\n CCTK_VarDataPtrI(cctkGH, 0, EvolvedVariableIndexSlow[var]);\n CCTK_REAL const *restrict const OldVar =\n CCTK_VarDataPtrI(cctkGH, 1, EvolvedVariableIndexSlow[var]);\n CCTK_REAL const *restrict const RHSVar =\n CCTK_VarDataPtrI(cctkGH, 0, RHSVariableIndexSlow[var]);\n \n#define SCRATCHINDEX(step) \\\n (scratchspace_firstindex_slow + (step))\n CCTK_REAL *restrict const ScratchVar =\n CCTK_VarDataPtrI(cctkGH, var, SCRATCHINDEX(0));\n \n switch (step) {\n \n case 0:\n#pragma omp simd\n for (int i=0; i<totalsize; ++i) {\n CCTK_REAL const scaled_rhs = dt * RHSVar[i];\n CCTK_REAL const scratchval = OldVar[i] + scaled_rhs;\n ScratchVar[i] = scratchval;\n UpdateVar[i] = scratchval;\n }\n break;\n \n case 1:\n case 2:\n#pragma omp simd\n for (int i=0; i<totalsize; ++i) {\n /* This is the same value as for the previous MoL step.\n However, MoL_PostStep may have modified it (e.g. enforced\n a constraint), so we need to recreate the original value\n here for consistency. */\n /* ScratchVar contains OldVar */\n UpdateVar[i] = ScratchVar[i];\n }\n break;\n \n case 3:\n#pragma omp simd\n for (int i=0; i<totalsize; ++i) {\n CCTK_REAL const scaled_rhs = dt * RHSVar[i];\n /* ScratchVar contains OldVar */\n UpdateVar[i] =\n 0.5 * OldVar[i] + 0.5 * ScratchVar[i] + 0.5 * scaled_rhs;\n }\n break;\n \n default:\n CCTK_VERROR(\"Internal error. Unexpected substep %d\", (int)*MoL_Intermediate_Step);\n break;\n }\n#undef SCRATCHINDEX\n \n } /* if fast or slow */\n } /* for var */\n \n}\n" |
| }, |
| "test": {}, |
| "doc": { |
| "MoLdia1.eps": "%!PS-Adobe-2.0 EPSF-2.0\n%%Title: MoLdia1\n%%Creator: Dia v0.84\n%%CreationDate: Fri Feb 1 17:42:34 2002\n%%For: admin\n%%Magnification: 1.0000\n%%Orientation: Portrait\n%%BoundingBox: 0 0 357 332\n%%Pages: 1\n%%BeginSetup\n%%EndSetup\n%%EndComments\n[ /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n/.notdef /.notdef /space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quoteright\n/parenleft /parenright /asterisk /plus /comma /hyphen /period /slash /zero /one\n/two /three /four /five /six /seven /eight /nine /colon /semicolon\n/less /equal /greater /question /at /A /B /C /D /E\n/F /G /H /I /J /K /L /M /N /O\n/P /Q /R /S /T /U /V /W /X /Y\n/Z /bracketleft /backslash /bracketright /asciicircum /underscore /quoteleft /a /b /c\n/d /e /f /g /h /i /j /k /l /m\n/n /o /p /q /r /s /t /u /v /w\n/x /y /z /braceleft /bar /braceright /asciitilde /.notdef /.notdef /.notdef\n/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n/space /exclamdown /cent /sterling /currency /yen /brokenbar /section /dieresis /copyright\n/ordfeminine /guillemotleft /logicalnot /hyphen /registered /macron /degree /plusminus /twosuperior /threesuperior\n/acute /mu /paragraph /periodcentered /cedilla /onesuperior /ordmasculine /guillemotright /onequarter /onehalf\n/threequarters /questiondown /Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla\n/Egrave /Eacute /Ecircumflex /Edieresis /Igrave /Iacute /Icircumflex /Idieresis /Eth /Ntilde\n/Ograve /Oacute /Ocircumflex /Otilde /Odieresis /multiply /Oslash /Ugrave /Uacute /Ucircumflex\n/Udieresis /Yacute /Thorn /germandbls /agrave /aacute /acircumflex /atilde /adieresis /aring\n/ae /ccedilla /egrave /eacute /ecircumflex /edieresis /igrave /iacute /icircumflex /idieresis\n/eth /ntilde /ograve /oacute /ocircumflex /otilde /odieresis /divide /oslash /ugrave\n/uacute /ucircumflex /udieresis /yacute /thorn /ydieresis] /isolatin1encoding exch def\n/Times-Roman-latin1\n /Times-Roman findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Times-Italic-latin1\n /Times-Italic findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Times-Bold-latin1\n /Times-Bold findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Times-BoldItalic-latin1\n /Times-BoldItalic findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/AvantGarde-Book-latin1\n /AvantGarde-Book findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/AvantGarde-BookOblique-latin1\n /AvantGarde-BookOblique findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/AvantGarde-Demi-latin1\n /AvantGarde-Demi findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/AvantGarde-DemiOblique-latin1\n /AvantGarde-DemiOblique findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Bookman-Light-latin1\n /Bookman-Light findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Bookman-LightItalic-latin1\n /Bookman-LightItalic findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Bookman-Demi-latin1\n /Bookman-Demi findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Bookman-DemiItalic-latin1\n /Bookman-DemiItalic findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Courier-latin1\n /Courier findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Courier-Oblique-latin1\n /Courier-Oblique findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Courier-Bold-latin1\n /Courier-Bold findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Courier-BoldOblique-latin1\n /Courier-BoldOblique findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Helvetica-latin1\n /Helvetica findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Helvetica-Oblique-latin1\n /Helvetica-Oblique findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Helvetica-Bold-latin1\n /Helvetica-Bold findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Helvetica-BoldOblique-latin1\n /Helvetica-BoldOblique findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Helvetica-Narrow-latin1\n /Helvetica-Narrow findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Helvetica-Narrow-Oblique-latin1\n /Helvetica-Narrow-Oblique findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Helvetica-Narrow-Bold-latin1\n /Helvetica-Narrow-Bold findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Helvetica-Narrow-BoldOblique-latin1\n /Helvetica-Narrow-BoldOblique findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/NewCenturySchoolbook-Roman-latin1\n /NewCenturySchoolbook-Roman findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/NewCenturySchoolbook-Italic-latin1\n /NewCenturySchoolbook-Italic findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/NewCenturySchoolbook-Bold-latin1\n /NewCenturySchoolbook-Bold findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/NewCenturySchoolbook-BoldItalic-latin1\n /NewCenturySchoolbook-BoldItalic findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Palatino-Roman-latin1\n /Palatino-Roman findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Palatino-Italic-latin1\n /Palatino-Italic findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Palatino-Bold-latin1\n /Palatino-Bold findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Palatino-BoldItalic-latin1\n /Palatino-BoldItalic findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Symbol-latin1\n /Symbol findfont\ndefinefont pop\n/ZapfChancery-MediumItalic-latin1\n /ZapfChancery-MediumItalic findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/ZapfDingbats-latin1\n /ZapfDingbats findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/cp {closepath} bind def\n/c {curveto} bind def\n/f {fill} bind def\n/a {arc} bind def\n/ef {eofill} bind def\n/ex {exch} bind def\n/gr {grestore} bind def\n/gs {gsave} bind def\n/sa {save} bind def\n/rs {restore} bind def\n/l {lineto} bind def\n/m {moveto} bind def\n/rm {rmoveto} bind def\n/n {newpath} bind def\n/s {stroke} bind def\n/sh {show} bind def\n/slc {setlinecap} bind def\n/slj {setlinejoin} bind def\n/slw {setlinewidth} bind def\n/srgb {setrgbcolor} bind def\n/rot {rotate} bind def\n/sc {scale} bind def\n/sd {setdash} bind def\n/ff {findfont} bind def\n/sf {setfont} bind def\n/scf {scalefont} bind def\n/sw {stringwidth pop} bind def\n/tr {translate} bind def\n\n/ellipsedict 8 dict def\nellipsedict /mtrx matrix put\n/ellipse\n{ ellipsedict begin\n /endangle exch def\n /startangle exch def\n /yrad exch def\n /xrad exch def\n /y exch def\n /x exch def /savematrix mtrx currentmatrix def\n x y tr xrad yrad sc\n 0 0 1 startangle endangle arc\n savematrix setmatrix\n end\n} def\n\n/colortogray {\n/rgbdata exch store\nrgbdata length 3 idiv\n/npixls exch store\n/rgbindx 0 store\n0 1 npixls 1 sub {\ngrays exch\nrgbdata rgbindx get 20 mul\nrgbdata rgbindx 1 add get 32 mul\nrgbdata rgbindx 2 add get 12 mul\nadd add 64 idiv\nput\n/rgbindx rgbindx 3 add store\n} for\ngrays 0 npixls getinterval\n} bind def\n/mergeprocs {\ndup length\n3 -1 roll\ndup\nlength\ndup\n5 1 roll\n3 -1 roll\nadd\narray cvx\ndup\n3 -1 roll\n0 exch\nputinterval\ndup\n4 2 roll\nputinterval\n} bind def\n/colorimage {\npop pop\n{colortogray} mergeprocs\nimage\n} bind def\n\n28.346000 -28.346000 scale\n-2.950000 -16.256637 translate\n%%EndProlog\n\n\n0.100000 slw\n[] 0 sd\n[] 0 sd\n0 slc\n0.000000 0.000000 0.000000 srgb\nn 3.000000 5.000000 m 15.000000 5.000000 l s\n0.100000 slw\n[] 0 sd\n[] 0 sd\n0 slc\n0.000000 0.000000 0.000000 srgb\nn 3.000000 15.000000 m 15.000000 15.000000 l s\n0.000000 slw\n[] 0 sd\n[] 0 sd\n0 slc\n0.000000 0.000000 0.000000 srgb\nn 5.000000 14.000000 m 5.000000 6.000000 l s\n0 slj\n0.000000 0.000000 0.000000 srgb\nn 5.400000 6.800000 m 5.000000 6.000000 l 4.600000 6.800000 l f\n/Courier-latin1 ff 1.000000 scf sf\n0.000000 0.000000 0.000000 srgb\n(\\(1\\)) dup sw 2 div 4.000000 ex sub 10.000000 m gs 1 -1 sc sh gr\n0.000000 slw\n[] 0 sd\n[] 0 sd\n0 slc\n0.000000 0.000000 0.000000 srgb\nn 8.000000 10.000000 m 13.000000 10.000000 l s\n0.000000 slw\n[] 0 sd\n[] 0 sd\n0 slc\n0.000000 0.000000 0.000000 srgb\nn 8.000000 8.000000 m 13.000000 8.000000 l s\n0.000000 slw\n[] 0 sd\n[] 0 sd\n0 slc\n0.000000 0.000000 0.000000 srgb\nn 8.500000 5.450000 m 8.500000 7.600000 l s\n0 slj\n0.000000 0.000000 0.000000 srgb\nn 8.300000 7.200000 m 8.500000 7.600000 l 8.700000 7.200000 l f\n0.000000 slw\n[] 0 sd\n[] 0 sd\n0 slc\n0.000000 0.000000 0.000000 srgb\nn 11.385510 7.606116 3.090625 3.090625 314.454329 49.322047 ellipse s\n0 slj\n0.000000 0.000000 0.000000 srgb\nn 13.869194 5.503031 m 13.550000 5.400000 l 13.659092 5.717173 l f\n0.000000 slw\n[] 0 sd\n[] 0 sd\n0 slc\n0.000000 0.000000 0.000000 srgb\nn 12.317472 6.527110 1.151250 1.151250 306.360077 111.261511 ellipse s\n0 slj\n0.000000 0.000000 0.000000 srgb\nn 13.330521 5.657061 m 13.000000 5.600000 l 13.152663 5.898653 l f\n0.000000 slw\n[] 0 sd\n[] 0 sd\n0 slc\n0.000000 0.000000 0.000000 srgb\nn 3.203094 8.124876 11.535625 11.535625 346.081090 34.146814 ellipse s\n0 slj\n0.000000 0.000000 0.000000 srgb\nn 14.617760 5.605109 m 14.400000 5.350000 l 14.326569 5.677273 l f\n/Courier-latin1 ff 1.000000 scf sf\n0.000000 0.000000 0.000000 srgb\n(\\(3\\)) dup sw 2 div 7.500000 ex sub 6.650000 m gs 1 -1 sc sh gr\n/Courier-latin1 ff 1.000000 scf sf\n0.000000 0.000000 0.000000 srgb\n(\\(2\\)) dup sw 2 div 12.150000 ex sub 6.750000 m gs 1 -1 sc sh gr\n/Courier-latin1 ff 1.000000 scf sf\n0.000000 0.000000 0.000000 srgb\n(\\(a\\)) dup sw 2 div 9.000000 ex sub 16.000000 m gs 1 -1 sc sh gr\nshowpage\n", |
| "MoLdia2.eps": "%!PS-Adobe-2.0 EPSF-2.0\n%%Title: /home/admin/Cactus/Cactus/arrangements/CactusMoL/MoL/doc/MoLdia2\n%%Creator: Dia v0.84\n%%CreationDate: Fri Feb 1 17:37:34 2002\n%%For: admin\n%%Magnification: 1.0000\n%%Orientation: Portrait\n%%BoundingBox: 0 0 343 321\n%%Pages: 1\n%%BeginSetup\n%%EndSetup\n%%EndComments\n[ /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n/.notdef /.notdef /space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quoteright\n/parenleft /parenright /asterisk /plus /comma /hyphen /period /slash /zero /one\n/two /three /four /five /six /seven /eight /nine /colon /semicolon\n/less /equal /greater /question /at /A /B /C /D /E\n/F /G /H /I /J /K /L /M /N /O\n/P /Q /R /S /T /U /V /W /X /Y\n/Z /bracketleft /backslash /bracketright /asciicircum /underscore /quoteleft /a /b /c\n/d /e /f /g /h /i /j /k /l /m\n/n /o /p /q /r /s /t /u /v /w\n/x /y /z /braceleft /bar /braceright /asciitilde /.notdef /.notdef /.notdef\n/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n/space /exclamdown /cent /sterling /currency /yen /brokenbar /section /dieresis /copyright\n/ordfeminine /guillemotleft /logicalnot /hyphen /registered /macron /degree /plusminus /twosuperior /threesuperior\n/acute /mu /paragraph /periodcentered /cedilla /onesuperior /ordmasculine /guillemotright /onequarter /onehalf\n/threequarters /questiondown /Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla\n/Egrave /Eacute /Ecircumflex /Edieresis /Igrave /Iacute /Icircumflex /Idieresis /Eth /Ntilde\n/Ograve /Oacute /Ocircumflex /Otilde /Odieresis /multiply /Oslash /Ugrave /Uacute /Ucircumflex\n/Udieresis /Yacute /Thorn /germandbls /agrave /aacute /acircumflex /atilde /adieresis /aring\n/ae /ccedilla /egrave /eacute /ecircumflex /edieresis /igrave /iacute /icircumflex /idieresis\n/eth /ntilde /ograve /oacute /ocircumflex /otilde /odieresis /divide /oslash /ugrave\n/uacute /ucircumflex /udieresis /yacute /thorn /ydieresis] /isolatin1encoding exch def\n/Times-Roman-latin1\n /Times-Roman findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Times-Italic-latin1\n /Times-Italic findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Times-Bold-latin1\n /Times-Bold findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Times-BoldItalic-latin1\n /Times-BoldItalic findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/AvantGarde-Book-latin1\n /AvantGarde-Book findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/AvantGarde-BookOblique-latin1\n /AvantGarde-BookOblique findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/AvantGarde-Demi-latin1\n /AvantGarde-Demi findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/AvantGarde-DemiOblique-latin1\n /AvantGarde-DemiOblique findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Bookman-Light-latin1\n /Bookman-Light findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Bookman-LightItalic-latin1\n /Bookman-LightItalic findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Bookman-Demi-latin1\n /Bookman-Demi findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Bookman-DemiItalic-latin1\n /Bookman-DemiItalic findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Courier-latin1\n /Courier findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Courier-Oblique-latin1\n /Courier-Oblique findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Courier-Bold-latin1\n /Courier-Bold findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Courier-BoldOblique-latin1\n /Courier-BoldOblique findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Helvetica-latin1\n /Helvetica findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Helvetica-Oblique-latin1\n /Helvetica-Oblique findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Helvetica-Bold-latin1\n /Helvetica-Bold findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Helvetica-BoldOblique-latin1\n /Helvetica-BoldOblique findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Helvetica-Narrow-latin1\n /Helvetica-Narrow findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Helvetica-Narrow-Oblique-latin1\n /Helvetica-Narrow-Oblique findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Helvetica-Narrow-Bold-latin1\n /Helvetica-Narrow-Bold findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Helvetica-Narrow-BoldOblique-latin1\n /Helvetica-Narrow-BoldOblique findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/NewCenturySchoolbook-Roman-latin1\n /NewCenturySchoolbook-Roman findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/NewCenturySchoolbook-Italic-latin1\n /NewCenturySchoolbook-Italic findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/NewCenturySchoolbook-Bold-latin1\n /NewCenturySchoolbook-Bold findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/NewCenturySchoolbook-BoldItalic-latin1\n /NewCenturySchoolbook-BoldItalic findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Palatino-Roman-latin1\n /Palatino-Roman findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Palatino-Italic-latin1\n /Palatino-Italic findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Palatino-Bold-latin1\n /Palatino-Bold findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Palatino-BoldItalic-latin1\n /Palatino-BoldItalic findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Symbol-latin1\n /Symbol findfont\ndefinefont pop\n/ZapfChancery-MediumItalic-latin1\n /ZapfChancery-MediumItalic findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/ZapfDingbats-latin1\n /ZapfDingbats findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/cp {closepath} bind def\n/c {curveto} bind def\n/f {fill} bind def\n/a {arc} bind def\n/ef {eofill} bind def\n/ex {exch} bind def\n/gr {grestore} bind def\n/gs {gsave} bind def\n/sa {save} bind def\n/rs {restore} bind def\n/l {lineto} bind def\n/m {moveto} bind def\n/rm {rmoveto} bind def\n/n {newpath} bind def\n/s {stroke} bind def\n/sh {show} bind def\n/slc {setlinecap} bind def\n/slj {setlinejoin} bind def\n/slw {setlinewidth} bind def\n/srgb {setrgbcolor} bind def\n/rot {rotate} bind def\n/sc {scale} bind def\n/sd {setdash} bind def\n/ff {findfont} bind def\n/sf {setfont} bind def\n/scf {scalefont} bind def\n/sw {stringwidth pop} bind def\n/tr {translate} bind def\n\n/ellipsedict 8 dict def\nellipsedict /mtrx matrix put\n/ellipse\n{ ellipsedict begin\n /endangle exch def\n /startangle exch def\n /yrad exch def\n /xrad exch def\n /y exch def\n /x exch def /savematrix mtrx currentmatrix def\n x y tr xrad yrad sc\n 0 0 1 startangle endangle arc\n savematrix setmatrix\n end\n} def\n\n/colortogray {\n/rgbdata exch store\nrgbdata length 3 idiv\n/npixls exch store\n/rgbindx 0 store\n0 1 npixls 1 sub {\ngrays exch\nrgbdata rgbindx get 20 mul\nrgbdata rgbindx 1 add get 32 mul\nrgbdata rgbindx 2 add get 12 mul\nadd add 64 idiv\nput\n/rgbindx rgbindx 3 add store\n} for\ngrays 0 npixls getinterval\n} bind def\n/mergeprocs {\ndup length\n3 -1 roll\ndup\nlength\ndup\n5 1 roll\n3 -1 roll\nadd\narray cvx\ndup\n3 -1 roll\n0 exch\nputinterval\ndup\n4 2 roll\nputinterval\n} bind def\n/colorimage {\npop pop\n{colortogray} mergeprocs\nimage\n} bind def\n\n28.346000 -28.346000 scale\n-2.950000 -16.256637 translate\n%%EndProlog\n\n\n0.100000 slw\n[] 0 sd\n[] 0 sd\n0 slc\n0.000000 0.000000 0.000000 srgb\nn 3.000000 5.000000 m 15.000000 5.000000 l s\n0.100000 slw\n[] 0 sd\n[] 0 sd\n0 slc\n0.000000 0.000000 0.000000 srgb\nn 3.000000 15.000000 m 15.000000 15.000000 l s\n0.000000 slw\n[] 0 sd\n[] 0 sd\n0 slc\n0.000000 0.000000 0.000000 srgb\nn 5.000000 14.000000 m 5.000000 6.000000 l s\n0 slj\n0.000000 0.000000 0.000000 srgb\nn 5.400000 6.800000 m 5.000000 6.000000 l 4.600000 6.800000 l f\n/Courier-latin1 ff 1.000000 scf sf\n0.000000 0.000000 0.000000 srgb\n(\\(1\\)) dup sw 2 div 4.000000 ex sub 10.000000 m gs 1 -1 sc sh gr\n/Courier-latin1 ff 1.000000 scf sf\n0.000000 0.000000 0.000000 srgb\n(\\(b\\)) dup sw 2 div 9.000000 ex sub 16.000000 m gs 1 -1 sc sh gr\nshowpage\n", |
| "documentation.tex": "% *======================================================================*\n% Cactus Thorn template for ThornGuide documentation\n% Author: Ian Kelley\n% Date: Sun Jun 02, 2002\n% $Header$ \n%\n% Thorn documentation in the latex file doc/documentation.tex \n% will be included in ThornGuides built with the Cactus make system.\n% The scripts employed by the make system automatically include \n% pages about variables, parameters and scheduling parsed from the \n% relevent thorn CCL files.\n% \n% This template contains guidelines which help to assure that your \n% documentation will be correctly added to ThornGuides. More \n% information is available in the Cactus UsersGuide.\n% \n% Guidelines:\n% - Do not change anything before the line\n% % START CACTUS THORNGUIDE\",\n% except for filling in the title, author, date etc. fields.\n% - Each of these fields should only be on ONE line.\n% - Author names should be sparated with a \\\\ or a comma\n% - You can define your own macros, but they must appear after\n% the START CACTUS THORNGUIDE line, and must not redefine standard \n% latex commands.\n% - To avoid name clashes with other thorns, 'labels', 'citations', \n% 'references', and 'image' names should conform to the following \n% convention: \n% ARRANGEMENT_THORN_LABEL\n% For example, an image wave.eps in the arrangement CactusWave and \n% thorn WaveToyC should be renamed to CactusWave_WaveToyC_wave.eps\n% - Graphics should only be included using the graphix package. \n% More specifically, with the \"includegraphics\" command. Do\n% not specify any graphic file extensions in your .tex file. This \n% will allow us (later) to create a PDF version of the ThornGuide\n% via pdflatex. |\n% - References should be included with the latex \"bibitem\" command. \n% - Use \\begin{abstract}...\\end{abstract} instead of \\abstract{...}\n% - Do not use \\appendix, instead include any appendices you need as \n% standard sections. \n% - For the benefit of our Perl scripts, and for future extensions, \n% please use simple latex. \n%\n% *======================================================================* \n% \n% Example of including a graphic image:\n% \\begin{figure}[ht]\n% \\begin{center}\n% \\includegraphics[width=6cm]{MyArrangement_MyThorn_MyFigure}\n% \\end{center}\n% \\caption{Illustration of this and that}\n% \\label{MyArrangement_MyThorn_MyLabel}\n% \\end{figure}\n%\n% Example of using a label:\n% \\label{MyArrangement_MyThorn_MyLabel}\n%\n% Example of a citation:\n% \\cite{MyArrangement_MyThorn_Author99}\n%\n% Example of including a reference\n% \\bibitem{MyArrangement_MyThorn_Author99}\n% {J. Author, {\\em The Title of the Book, Journal, or periodical}, 1 (1999), \n% 1--16. {\\tt http://www.nowhere.com/}}\n%\n% *======================================================================* \n\n% If you are using CVS use this line to give version information\n% $Header$\n\n\\documentclass{article}\n\n% Use the Cactus ThornGuide style file\n% (Automatically used from Cactus distribution, if you have a \n% thorn without the Cactus Flesh download this from the Cactus\n% homepage at www.cactuscode.org)\n\\usepackage{../../../../doc/latex/cactus}\n\n\\begin{document}\n\n% The author of the documentation\n\\author{Ian Hawke} \n\n% The title of the document (not necessarily the name of the Thorn)\n\\title{Method of Lines}\n\n% the date your document was last changed, if your document is in CVS, \n% please use:\n\\date{$ $Date$ $}\n\n\\maketitle\n\n% Do not delete next line\n% START CACTUS THORNGUIDE\n\n% Add all definitions used in this documentation here \n% \\def\\mydef etc\n\n% Add an abstract for this thorn's documentation\n\\begin{abstract}\n The Method of Lines is a way of separating the time integration from\n the rest of an evolution scheme. This thorn is intended to take care\n of all the bookwork and provide some basic time integration methods,\n allowing for easy coupling of different thorns.\n\\end{abstract}\n\n% The following sections are suggestive only.\n% Remove them or add your own.\n\n% \\section{Introduction}\n\n% \\section{Physical System}\n\n% \\section{Numerical Implementation}\n\n% \\section{Using This Thorn}\n\n% \\subsection{Obtaining This Thorn}\n\n% \\subsection{Basic Usage}\n\n% \\subsection{Special Behaviour}\n\n% \\subsection{Interaction With Other Thorns}\n\n% \\subsection{Examples}\n\n% \\subsection{Support and Feedback}\n\n% \\section{History}\n\n% \\subsection{Thorn Source Code}\n\n% \\subsection{Thorn Documentation}\n\n% \\subsection{Acknowledgements}\n\n\\section{Purpose}\n\\label{CactusBase_MoL_sec:purpose}\n\nThe Method of Lines (MoL) converts a (system of) partial differential\nequation(s) into an ordinary differential equation containing some\nspatial differential operator. As an example, consider writing the\nhyperbolic system of PDE's\n\\begin{equation}\n \\label{CactusBase_MoL_eq:mol1}\n \\partial_t {\\bf q} + {\\bf A}^i({\\bf q}) \\partial_i {\\bf B}({\\bf q})\n = {\\bf s}({\\bf q})\n\\end{equation}\nin the alternative form\n\\begin{equation}\n \\label{CactusBase_MoL_eq:mol2}\n \\partial_t {\\bf q} = {\\bf L}({\\bf q}),\n\\end{equation}\nwhich (assuming a given discretization of space) is an ODE.\n\nGiven this separation of the time and space discretizations, well\nknown stable ODE integrators such as Runge-Kutta can be used to do the\ntime integration. This is more modular (allowing for simple extensions\nto higher order methods), more stable (as instabilities can now only\narise from the spatial discretization or the equations themselves) and\nalso avoids the problems of retaining high orders of convergence when\ncoupling different physical models.\n\nMoL can be used for hyperbolic, parabolic and even elliptic problems\n(although I definitely don't recommend the latter). As it currently\nstands it is set up for systems of equations in the first order type\nform of equation~(\\ref{CactusBase_MoL_eq:mol2}). If you want to implement a\nmultilevel scheme such as leapfrog it is not obvious to me that MoL is\nthe thing to use. However if you have lots of thorns that you want to\ninteract, for example ADM\\_BSSN and a hydro code plus maybe EM or a\nscalar field, and they can easily be written in this sort of form,\nthen you probably want to use MoL.\n\nThis thorn is meant to provide a simple interface that will implement\nthe MoL inside Cactus as transparently as possible. It will initially\nimplement only the optimal Runge-Kutta time integrators (which are TVD\nup to RK3, so suitable for hydro) up to fourth order and iterated\nCrank Nicholson. All of the interaction with the MoL thorn should\noccur directly through the scheduler. For example, all synchronization\nsteps should now be possible at the schedule level. This is essential\nfor interacting cleanly with different drivers, especially to make\nMesh Refinement work.\n\nFor more information on the Method of Lines the most comprehensive\nreferences are the works of Jonathan\nThornburg~\\cite{CactusBase_MoL_Thornburg93,CactusBase_MoL_Thornburg99}\n- see especially section 7.3 of the thesis. From the CFD viewpoint the\nreview of ENO methods by Shu,~\\cite{CactusBase_MoL_Shu99}, has some\ninformation. For relativistic fluids the paper of Neilsen and\nChoptuik~\\cite{CactusBase_MoL_Neilsen00} is also quite good.\n\n\\section{How to use}\n\\label{CactusBase_MoL_sec:use}\n\n\n\\subsection{Thorn users}\n\\label{CactusBase_MoL_sec:useruse}\n\nFor those who used the old version of MoL, this version is\nunfortunately slightly more effort to use. That is, for most methods\nyou'll now have to set 4 parameters instead of just one. \n\nIf you already have a thorn that uses the method of lines, then there\nare four main parameters that are relevant to change the integration\nmethod. The keyword {\\tt MoL\\_ODE\\_Method} chooses between the\ndifferent methods. Currently supported are {\\tt RK2}, {\\tt RK3}, {\\tt\n ICN}, {\\tt ICN-Avg} and {\\tt Generic}. These are second order\nRunge-Kutta, third order Runge-Kutta, Iterative Crank Nicholson,\nIterative Crank Nicholson with averaging, and the generic Shu-Osher\ntype Runge-Kutta methods. To switch between the different types of\ngeneric methods there is also the keyword {\\tt Generic\\_Type} which is\ncurrently restricted to {\\tt RK} for the standard TVD Runge-Kutta\nmethods (first to fourth order) and {\\tt ICN} for the implementation\nof the Iterative Crank Nicholson method in generic form.\n\nFull descriptions of the currently implemented methods are given in\nsection~\\ref{CactusBase_MoL_sec:methods}. \n\nThe parameter {\\tt MoL\\_Intermediate\\_Steps} controls the number of\nintermediate steps for the ODE solver. For the generic Runge-Kutta\nsolvers it controls the order of accuracy of the method. For the {\\tt\n ICN} methods this parameter controls the number of iterations taken,\nwhich {\\bf does not check for stability}. This parameter defaults to\n3.\n\nThe parameter {\\tt MoL\\_Num\\_Scratch\\_Levels} controls the amount of\nscratch space used. If this is insufficient for the method selected\nthere will be an error at parameter checking time. This parameter\ndefaults to 0, as no scratch space is required for the efficient ICN\nand Runge-Kutta 2 and 3 solvers. For the generic solvers this must be\nat least {\\tt MoL\\_Intermediate\\_Steps - 1}.\n\nAnother parameter is {\\tt MoL\\_Memory\\_Always\\_On} which switches on\nmemory for the scratch space always if true and only during evolution\nif false. This defaults to true for speed reasons; the memory gains\nare likely to be limited unless you're doing something very memory\nintensive at initialization or analysis.\n\nThere is also a parameter {\\tt MoL\\_NaN\\_Check} that will check your\nRHS grid functions for NaNs using the {\\tt NaNChecker} thorn from\nCactusUtils. This will make certain that you find the exact grid\nfunction computing the first NaN; of course, this may not be the real\nsource of your problem.\n\nThe parameter {\\tt disable\\_prolongation} only does anything if you\nare using mesh refinement, and in particular {\\tt Carpet}. With mesh\nrefinement it may be necessary to disable prolongation in intermediate\nsteps of MoL. This occurs when evolving systems containing second\nspatial derivatives. This is done by default in MoL. If your system is\npurely first order in space and time you may wish to set this to {\\tt \"no\"}.\n\nIdeally, initial data thorns should always set initial data at all time\nlevels. However, sometimes initial data thorns fail to do this. In\nthis case you can do one of three things:\n\\begin{itemize}\n\\item\tFix the initial data thorn. This is the best solution.\n\\item\tIf you're using Carpet, it has some facilities to take\n\tforward/backward time steps to initialize multiple time\n\tlevels. See the Carpet parameters\n\t\\verb|init_each_timelevel| and\n\t\\verb|init_3_timelevels| for details.\n\\item\tFinally, if you set (the MoL parameter) \\verb|initial_data_is_crap|,\n\tMoL will copy the current time level of all variables it\n\tknows about (more precisely, using the terminology of\n\tsection~\\ref{CactusBase_MoL_sec:writeruse}, all evolved,\n\tsave-and-restore, and constrained variables which have\n\tmultiple time levels) to all the past time levels.\n\t\\textbf{Note that this copies the \\underline{same} data\n\tto each past time level; this will be wrong if your\n\tspacetime is time-dependent!}\n\n\tIf enabled, the copy happens in the \\verb|CCTK_POSTINITIAL|\n\tschedule bin. By default this happens \\emph{before}\n\tthe \\verb|MoL_PostStep| schedule group; the parameter\n\t\\verb|copy_ID_after_MoL_PostStep| can be used to change\n\tthis to \\emph{after} \\verb|MoL_PostStep|.\n\\end{itemize}\n\n\n\\subsection{Thorn writers}\n\\label{CactusBase_MoL_sec:writeruse}\n\nTo port an existing thorn using the method of lines, or to write a new\nthorn using it, should hopefully be relatively simple. As an example,\nwithin the MoL arrangement is WaveMoL which duplicates the WaveToy\nthorn given by CactusWave in a form suitable for use by MoL. In this\nsection, ``the thorn'' will mean the user thorn doing the physics.\n\nWe start with some terminology. Grid functions are split into four\ncateogories.\n\\begin{enumerate}\n\\item The first are those that are evolved using a MoL form. That is,\n a right hand side is calculated and the variable updated using\n it. These we call {\\it evolved} variables.\n\\item The second category are those variables that are set by a thorn\n at every intermediate step of the evolution, usually to respect the\n constraints. Examples of these include the primitive variables in a\n hydrodynamics code. Another example would be the gauge variables if\n these were set by constraints at every intermediate step (which is\n slightly artificial; the usual example would be the use of maximal\n slicing, which is only applied once every $N$ complete steps). These\n are known as {\\it constrained} variables.\n\\item The third category are those variables that a thorn depends on\n but does not set or evolve. An example would include the metric\n terms considered from a thorn evolving matter. Due to the way that\n MoL deals with these, they are known as {\\it Save and Restore}\n variables.\n\\item The final category are those variables that do not interact with\n MoL. These would include temporary variables for analysis or setting\n up the initial data. These can safely be ignored.\n\\end{enumerate}\nAs a generic rule of thumb, variables for which you have a time\nevolution equation are {\\it evolved} (obviously), variables which your\nthorn sets but does not evolve are {\\it constrained}, and any other\nvariables which your thorn reads during evolution is a {\\it Save and\n Restore} variable.\n\nMoL needs to know every GF that falls in one of the first three\ngroups. If a GF is evolved by one thorn but is a constrained variable\nin another (for example, the metric in full GR Hydro) then each thorn\nshould register the function as they see it. For example, the hydro\nthorn will register the metric as a Save and Restore variable and the\nspacetime thorn will register the metric as an evolved variable. The\ndifferent variable categories are given the priority evolved,\nconstrained, Save and Restore. So if a variable is registered as\nbelonging in two different categories, it is always considered by MoL\nto belong to the category with the highest priority.\n\nMoL needs to know the total number of GFs in each category \\textit{at\n parameter time}. To do this, your thorn needs to use some\naccumulator parameters from MoL. As an example, here are the\nparamaters from WaveMoL:\n\\begin{verbatim}\nshares: MethodOfLines\n\nUSES CCTK_INT MoL_Num_Evolved_Vars\nUSES CCTK_INT MoL_Num_Constrained_Vars\nUSES CCTK_INT MoL_Num_SaveAndRestore_Vars\n\nrestricted:\n\nCCTK_INT WaveMoL_MaxNumEvolvedVars \\\n \"The maximum number of evolved variables used by WaveMoL\" \\\n ACCUMULATOR-BASE=MethodofLines::MoL_Num_Evolved_Vars\n{\n 5:5 :: \"Just 5: phi and the four derivatives\"\n} 5\n\nCCTK_INT WaveMoL_MaxNumConstrainedVars \\\n \"The maximum number of constrained variables used by WaveMoL\" \\\n ACCUMULATOR-BASE=MethodofLines::MoL_Num_Constrained_Vars\n{\n 0:1 :: \"A small range, depending on testing or not\"\n} 1\n\nCCTK_INT WaveMoL_MaxNumSandRVars \\\n \"The maximum number of save and restore variables used by WaveMoL\" \\\n ACCUMULATOR-BASE=MethodofLines::MoL_Num_SaveAndRestore_Vars\n{\n 0:1 :: \"A small range, depending on testing or not\"\n} 1\n\\end{verbatim}\nThis should give the \\textit{maximum} number of variables that your\nthorn will register.\n\nEvery thorn should register every grid function that it uses even if\nyou expect it to be registered again by a different thorn. For\nexample, a hydro thorn would register the metric variables as Save and\nRestore, whilst the spacetime evolution thorn would register them as\nevolved (in ADM) or constrained (in ADM\\_BSSN), both of which have\nprecedence. To register your GFs with MoL schedule a routine in the\nbin {\\tt MoL\\_Register} which just contains the relevant function\ncalls. For an evolved variable the GF corresponding to the update\nterm (${\\bf L}({\\bf q})$ in equation~(\\ref{CactusBase_MoL_eq:mol2}))\nshould be registered at the same time. The appropriate functions are\ngiven in section~\\ref{CactusBase_MoL_sec:molfns}.\n\nThese functions are provided using function aliasing. For details on\nusing function aliasing, see sections B10.5 and F2.2.3 of the\nUsersGuide. For the case of real GFs, you simply add the following\nlines to your \\texttt{interface.ccl}:\n\\begin{verbatim}\n##########################################\n### PROTOTYPES - DELETE AS APPLICABLE! ###\n##########################################\n\nCCTK_INT FUNCTION MoLRegisterEvolved(CCTK_INT EvolvedIndex, CCTK_INT RHSIndex)\nCCTK_INT FUNCTION MoLRegisterEvolvedSlow(CCTK_INT EvolvedIndex, CCTK_INT RHSIndex)\nCCTK_INT FUNCTION MoLRegisterConstrained(CCTK_INT ConstrainedIndex)\nCCTK_INT FUNCTION MoLRegisterSaveAndRestore(CCTK_INT SandRIndex)\nCCTK_INT FUNCTION MoLRegisterEvolvedGroup(CCTK_INT EvolvedIndex, \\\n CCTK_INT RHSIndex)\nCCTK_INT FUNCTION MoLRegisterConstrainedGroup(CCTK_INT ConstrainedIndex)\nCCTK_INT FUNCTION MoLRegisterSaveAndRestoreGroup(CCTK_INT SandRIndex)\nCCTK_INT FUNCTION MoLChangeToEvolved(CCTK_INT EvolvedIndex, CCTK_INT RHSIndex)\nCCTK_INT FUNCTION MoLChangeToEvolvedSlow(CCTK_INT EvolvedIndex, CCTK_INT RHSIndex)\nCCTK_INT FUNCTION MoLChangeToConstrained(CCTK_INT ConstrainedIndex)\nCCTK_INT FUNCTION MoLChangeToSaveAndRestore(CCTK_INT SandRIndex)\nCCTK_INT FUNCTION MoLChangeToNone(CCTK_INT RemoveIndex)\n\n#############################################\n### USE STATEMENT - DELETE AS APPLICABLE! ###\n#############################################\n\nUSES FUNCTION MoLRegisterEvolved\nUSES FUNCTION MoLRegisterEvolvedSlow\nUSES FUNCTION MoLRegisterConstrained\nUSES FUNCTION MoLRegisterSaveAndRestore\nUSES FUNCTION MoLRegisterEvolvedGroup\nUSES FUNCTION MoLRegisterConstrainedGroup\nUSES FUNCTION MoLRegisterSaveAndRestoreGroup\nUSES FUNCTION MoLChangeToEvolved\nUSES FUNCTION MoLChangeToConstrained\nUSES FUNCTION MoLChangeToSaveAndRestore\nUSES FUNCTION MoLChangeToNone\n\\end{verbatim}\n\nNote that the list of parameters not complete; see the section on\nparameters for the use of arrays. However, the\nlist of functions is, and is expanded on in\nsection~\\ref{CactusBase_MoL_sec:molfns}. MoL will check whether a\ngroup or variable is a GF or an array and whether it is real.\n\nHaving done that, one routine (or group of routines) which we'll here\ncall {\\tt Thorn\\_CalcRHS} must be defined. This does all the finite\ndifferencing that you'd usually do, applied to ${\\bf q}$, and finds\nthe right hand sides which are stored in ${\\bf L}$. This routine\nshould be scheduled in {\\tt MoL\\_CalcRHS}. The precise order that\nthese are scheduled should not matter, because no updating of any of\nthe user thorns ${\\bf q}$ will be done until after all the RHSs are\ncalculated. {\\bf Important note:} all the finite differencing must be\napplied to the most recent time level ${\\bf q}$ and not to the\nprevious time level ${\\bf q}_p$ as you would normally do. Don't worry\nabout setting up the data before the calculation, as MoL will do that\nautomatically.\n\nFinally, if you have some things that have to be done after each\nupdate to an intermediate level, these should be scheduled in {\\tt\n MoL\\_PostStep}. Examples of things that need to go here include the\nrecalculation of primitive variables for hydro codes, the application\nof boundary conditions\\footnote{It is possible to alter the\n calculation of {\\bf L} so that boundary conditions are automatically\n updated and do not need setting. This is slightly tricksy. For an\n example of how this would work see the new radiative boundary\n condition in ADM\\_BSSN. For more on this see section 7.3.4\n of~\\cite{CactusBase_MoL_Thornburg93}.}, the solution of elliptic\nequations (although this would be a very expensive place to solve\nthem, some sets of equations might require the updating of some\nvariables by constraints in this fashion). When applying boundary\nconditions the cleanest thing to do is to write a routine applying the\nsymmetries to the appropriate GFs and, when calling it from the\nscheduler, adding the {\\tt SYNC} statement to the appropriate groups.\nAn example is given by the routine {\\tt WaveToyMoL\\_Boundaries} in\nthorn WaveMoL.\n\nPoints to note. The thorn routine {\\tt Thorn\\_CalcRHS} does not need\nto know and in fact should definitely not know where precisely in the\nMoL step it is. It just needs to know that it is receiving {\\it some}\nintermediate data stored in the GFs ${\\bf q}$ and that it should\nreturn the RHS ${\\bf L}({\\bf q})$. All the book-keeping to ensure that\nit is passed the correct intermediate state at that the GFs contain\nthe correct data at the end of the MoL step will be dealt with by the\nMoL thorn and the flesh.\n\nWhen using a multirate scheme the thorn routine {\\tt Thorn\\_CalcRHS} must\ncheck the MoL grid scalars {\\tt MoL::MoL\\_SlowStep} and {\\tt\nMoL::MoL\\_SlowPostStep} which MoL sets to true (non-zero) if it is time for\nthe slow sector to compute its RHS or to apply its poststep routine. {\\tt\nMoL::MoL\\_SlowPostStep} is always true outside of the RHS loop, eg. in {\\tt\nCCTK\\_POST\\_RESTRICT}.\n\n\\subsection{Evolution method writers}\n\\label{CactusBase_MoL_sec:evol-meth-writ}\n\nIf you want to try adding a new evolution method to MoL the simplest\nway is to use the generic table option to specify it completely in the\nparameter file - no coding is required at all.\n\nAll the generic methods evolve the equation\n\\begin{equation}\n \\label{CactusBase_MoL_eq:mol3}\n \\partial_t {\\bf q} = {\\bf L}({\\bf q})\n\\end{equation}\nusing the following algorithm for an $N$-step method:\n\\begin{eqnarray}\n \\label{CactusBase_MoL_eq:genrk1-scheme}\n {\\bf q}^{(0)} & = & {\\bf q}^n, \\nonumber \\\\\n {\\bf q}^{(i)} & = & \\sum_{k=0}^{i-1} \\left( \\alpha_{ik} {\\bf\n q}^{(k)} \\right) + \\Delta t \\beta_{i-1} {\\bf L} ( {\\bf q}^{(i-1)} ),\n \\qquad i = 1, \\dots, N, \\\\\n {\\bf q}^{n+1} & = & {\\bf q}^{(N)}. \\nonumber\n\\end{eqnarray}\nThis method is completely specified by $N$ ({\\tt\n GenericIntermediateSteps}) and the $\\alpha$ ({\\tt\n GenericAlphaCoeffs}) and $\\beta$ ({\\tt GenericBetaCoeffs})\narrays. The names in parentheses give the keys in a table that MoL\nwill use. This table is created from the string parameter {\\tt\n Generic\\_Method\\_Descriptor}. \n\nAs an example, the standard TVD RK2 method that is implemented both in\noptimized and generic form is written as\n\\begin{eqnarray}\n \\label{CactusBase_MoL_eq:rk2-scheme}\n {\\bf q}^{(1)} & = & {\\bf q}^n + \\Delta t {\\bf L} ({\\bf q}^n), \\\\\n {\\bf q}^{n+1} & = & \\frac{1}{2} \\left( {\\bf q}^n + {\\bf q}^{(1)} +\n \\Delta t {\\bf L} ({\\bf q}^{(1)}) \\right). \n\\end{eqnarray}\nTo implement this using the generic table options, use\n\\begin{verbatim}\nmethodoflines::MoL_Intermediate_Steps = 2\nmethodoflines::MoL_Num_Scratch_Levels = 1\nmethodoflines::Generic_Method_Descriptor = \\\n \"GenericIntermediateSteps = 2 \\\n GenericAlphaCoeffs = { 1.0 0.0 0.5 0.5 } \\\n GenericBetaCoeffs = { 1.0 0.5 }\"\n\\end{verbatim}\nThe number of steps specified in the table must be the same as {\\tt\n MoL\\_Intermediate\\_Steps}, and the number of scratch levels should\nbe at least {\\tt MoL\\_Intermediate\\_Steps - 1}.\n\nThe generic methods are somewhat inefficient for use in production\nruns, so it is frequently better to write an optimized version once\nyou are happy with the method. To do this you should\n\\begin{itemize}\n\\item write your code into a new file, called from the scheduler under\n the alias {\\tt MoL\\_Add},\n\\item make certain that at each intermediate step the correct values\n of {\\tt cctk\\_time} and {\\tt cctk\\_delta\\_time} are set in {\\tt\n SetTime.c} for mesh refinement, boundary conditions and so on,\n\\item make certain that you check for the number of intermediate steps\n in {\\tt ParamCheck.c}.\n\\end{itemize}\n\n\\section{Example}\n\\label{CactusBase_MoL_sec:example}\n\nAs a fairly extended example of how to use MoL I'll outline how\nADM\\_BSSN works in this context. The actual implementation of this is\ngiven in the thorn {\\tt AEIThorns/BSSN\\_MoL}.\n\nAs normal the required variables are defined in the {\\tt\n interface.ccl} file, together with the associated source terms. For\nexample, the conformal factor and source are defined by\n\n\\begin{verbatim}\nreal ADM_BSSN_phi type=GF timelevels=2\n{\n ADM_BS_phi\n} \"ADM_BSSN_phi\"\n\nreal ADM_BSSN_sources type=GF\n{\n...,\n adm_bs_sphi,\n...\n}\n\\end{verbatim}\nAlso in this file we write the function aliasing prototypes.\n\nOnce the sources are defined the registration with MoL is required,\nfor which the essential file is {\\tt MoLRegister.c}. In the ADM\\_BSSN\nsystem the standard metric coefficients $g_{ij}$ are not evolved, and\nneither are the standard extrinsic curvature components $K_{ij}$.\nHowever these are used by ADM\\_BSSN in a number of places, and are\ncalculated from evolved quantities at the appropriate points. In the\nMoL terminology these variables are {\\it constrained}. As the\nappropriate storage is defined in thorn ADMBase, the actual calls have\nthe form\n\n\\begin{verbatim}\n ierr += MoLRegisterConstrained(CCTK_VarIndex(\"ADMBase::kxx\"));\n\\end{verbatim}\n\n\\noindent The actual evolved variables include things such as the\nconformal factor. This, and the appropriate source term, is defined in\nthorn ADM\\_BSSN, and so the call has the form\n\n\\begin{verbatim} \n ierr += MoLRegisterEvolved(CCTK_VarIndex(\"adm_bssn::ADM_BS_phi\"),\n CCTK_VarIndex(\"adm_bssn::adm_bs_sphi\")); \n\\end{verbatim}\n\n\nAs well as the evolved variables, and those constrained variables such\nas the metric, there are the gauge variables. Precisely what status\nthese have depends on how they are set. If harmonic or 1+log slicing\nis used then the lapse is evolved:\n\n\\begin{verbatim}\n ierr += MoLRegisterEvolved(CCTK_VarIndex(\"ADMBase::alp\"),\n CCTK_VarIndex(\"adm_bssn::adm_bs_salp\")); \n\\end{verbatim}\n\n\\noindent A matter density $\\rho$ might not require such a high order scheme\nand can be evolved using a multi-rate scheme\n\n\\begin{verbatim}\n ierr += MoLRegisterEvolvedSlow(CCTK_VarIndex(\"GRHydro::dens\"),\n CCTK_VarIndex(\"GRHydro::dendsrhs\")); \n\\end{verbatim}\n\n\\noindent If maximal or static slicing is used then the lapse is a\nconstrained variable\\footnote{Note that this is actually a bit of a\n hack. The rational for {\\it Save and Restore} variables was to deal\n with maximal slicing. However it turned out that I hadn't thought it\n through correctly and that the treatment for constrained variables\n was required.}:\n\n\\begin{verbatim}\n ierr += MoLRegisterConstrained(CCTK_VarIndex(\"ADMBase::alp\"));\n\\end{verbatim}\n\n\\noindent Finally, if none of the above apply we assume that the lapse\nis evolved in some unknown fashion, and so it must be registered as a\nSave and Restore variable:\n\n\\begin{verbatim}\n ierr += MoLRegisterSaveAndRestore(CCTK_VarIndex(\"ADMBase::alp\"));\n\\end{verbatim}\n\nHowever, it is perfectly possible that we may wish to change how we\ndeal with the gauge during the evolution. This is dealt with in the\nfile {\\tt PreLoop.F}. If the slicing changes then the appropriate\nroutine is called. For example, if we want to use 1+log evolution then\nwe call \n\n\\begin{verbatim}\n call CCTK_VarIndex(lapseindex,\"ADMBase::alp\")\n call CCTK_VarIndex(lapserhsindex,\"adm_bssn::adm_bs_salp\")\n ierr = ierr + MoLChangeToEvolved(lapseindex, lapserhsindex)\n\\end{verbatim}\n\n\\noindent It is not required to tell MoL what the lapse is changing\n{\\it from}, or indeed if it is changing at all; MoL will work this out\nfor itself.\n\nFinally there are the routines that we wish to apply after every\nintermediate step. These are {\\tt ADM\\_BSSN\\_removetrA} which enforces\nvarious constraints (such as the tracefree conformal extrinsic\ncurvature remaining trace free), {\\tt ADM\\_BSSN\\_Boundaries} which\napplies symmetry boundary conditions as well as various others (such\nas some of the radiative boundary conditions). Note all the calls to\n{\\tt SYNC} at this point. We also convert from the updated BSSN\nvariables back to the standard ADM variables in {\\tt\n ADM\\_BSSN\\_StandardVariables}, and also update the time derivative\nof the lapse in {\\tt ADM\\_BSSN\\_LapseChange}.\n\n\\section{Time evolution methods provided by MoL}\n\\label{CactusBase_MoL_sec:methods}\n\nThe default method is Iterative Crank-Nicholson. There are many ways\nof implementing this. The standard {\\tt \"ICN\"} and {\\tt\n \"Generic\"}/{\\tt\"ICN\"} methods both implement the following, assuming\nan $N$ iteration method:\n\\begin{eqnarray}\n \\label{CactusBase_MoL_eq:icn}\n {\\bf q}^{(0)} & = & {\\bf q}^{n}, \\\\\n {\\bf q}^{(i)} & = & {\\bf q}^{(0)} + \\frac{\\Delta t}{2} {\\bf L}({\\bf\n q}^{(i-1)}), \\quad i = 1,\\dots,N-1, \\\\\n {\\bf q}^{(N)} & = & {\\bf q}^{(N-1)} + \\Delta t {\\bf L}({\\bf\n q}^{(N-1)}), \\\\\n {\\bf q}^{n+1} & = & {\\bf q}^{(N)}\n\\end{eqnarray}\n\nThe ``averaging'' ICN method {\\tt \"ICN-avg\"} instead calculates\nintermediate steps before averaging:\n\\begin{eqnarray}\n \\label{CactusBase_MoL_eq:icn-avg}\n {\\bf q}^{(0)} & = & {\\bf q}^{n}, \\\\\n \\tilde{{\\bf q}}^{(i)} & = & \\frac{1}{2}\\left( {\\bf q}^{(i)} + {\\bf\n q}^{n} \\right), \\quad i = 0,\\dots,N-1 \\\\\n {\\bf q}^{(i)} & = & {\\bf q}^{(0)} + \\Delta t {\\bf L}(\\tilde{{\\bf\n q}}^{(N-1)}), \\\\\n {\\bf q}^{n+1} & = & {\\bf q}^{(N)}\n\\end{eqnarray}\n\nThe Runge-Kutta methods are those typically used in hydrodynamics by,\ne.g., Shu and others --- see~\\cite{CactusBase_MoL_Shu99} for\nexample. Explicitly the first order method is the Euler method:\n\\begin{eqnarray}\n \\label{CactusBase_MoL_eq:rk1}\n {\\bf q}^{(0)} & = & {\\bf q}^{n}, \\\\\n {\\bf q}^{(1)} & = & {\\bf q}^{(0)} + \\Delta t {\\bf L}(\\tilde{{\\bf\n q}}^{(0)}), \\\\\n {\\bf q}^{n+1} & = & {\\bf q}^{(1)}.\n\\end{eqnarray}\nThe second order method is:\n\\begin{eqnarray}\n \\label{CactusBase_MoL_eq:rk2}\n {\\bf q}^{(0)} & = & {\\bf q}^{n}, \\\\\n {\\bf q}^{(1)} & = & {\\bf q}^{(0)} + \\Delta t {\\bf L} ({\\bf q}^{(0)}), \\\\\n {\\bf q}^{(2)} & = & \\frac{1}{2} \\left( {\\bf q}^{(0)} + {\\bf q}^{(1)}\n + \\Delta t {\\bf L} ({\\bf q}^{(1)}) \\right), \\\\\n {\\bf q}^{n+1} & = & {\\bf q}^{(2)}.\n\\end{eqnarray}\nThe third order method is:\n\\begin{eqnarray}\n \\label{CactusBase_MoL_eq:rk3}\n {\\bf q}^{(0)} & = & {\\bf q}^{n}, \\\\\n {\\bf q}^{(1)} & = & {\\bf q}^{(0)} + \\Delta t {\\bf L} ({\\bf q}^{(0)}), \\\\\n {\\bf q}^{(2)} & = & \\frac{1}{4} \\left( 3 {\\bf q}^{(0)} + {\\bf q}^{(1)} +\n \\Delta t {\\bf L} ({\\bf q}^{(1)}) \\right), \\\\\n {\\bf q}^{(3)} & = & \\frac{1}{3} \\left( {\\bf q}^{(0)} + 2 {\\bf\n q}^{(2)} + 2 \\Delta t {\\bf L} ({\\bf q}^{(2)}) \\right), \\\\\n {\\bf q}^{n+1} & = & {\\bf q}^{(3)}.\n\\end{eqnarray}\nThe fourth order method, which is not strictly TVD, is:\n\\begin{eqnarray}\n \\label{CactusBase_MoL_eq:rk4}\n {\\bf q}^{(0)} & = & {\\bf q}^{n}, \\\\\n {\\bf q}^{(1)} & = & {\\bf q}^{(0)} + \\frac{1}{2} \\Delta t {\\bf L}\n ({\\bf q}^{(0)}), \\\\ \n {\\bf q}^{(2)} & = & {\\bf q}^{(0)} + \\frac{1}{2} \\Delta t {\\bf L}\n ({\\bf q}^{(1)}), \\\\ \n {\\bf q}^{(3)} & = & {\\bf q}^{(0)} + \\Delta t {\\bf L} ({\\bf\n q}^{(2)}), \\\\ \n {\\bf q}^{(4)} & = & \\frac{1}{6} \\left( - 2 {\\bf q}^{(0)} + 2 {\\bf\n q}^{(1)} + 4 {\\bf q}^{(2)} + 2 {\\bf q}^{(3)} + \\Delta t{\\bf L}\n ({\\bf q}^{(3)}) \\right), \\\\\n {\\bf q}^{n+1} & = & {\\bf q}^{(4)}.\n\\end{eqnarray}\n\n\\subsection{Multirate methods}\n\\label{CactusBase_MoL_sec:multiratemol}\n% text originally by Christian Reisswig for the GRHydroMP paper\nA scheme for coupling different parts of a system of equations\n\\begin{eqnarray}\n\\partial_t \\mathbf{g} &=& \\mathbf{F}(\\mathbf{g},\\mathbf{q}) \\label{eq:CactusBase_MoL_intmetric}, \\\\\n\\partial_t \\mathbf{q} &=& \\mathbf{G}(\\mathbf{g},\\mathbf{q}) \\label{eq:CactusBase_MoL_intmatter},\n\\end{eqnarray}\nrepresenting eg. spacetime and matter variables, respectively, with different RK integrators is \ngiven by \\emph{multirate} RK schemes (e.g.~\\cite{CactusBase_MoL_schlegel:09, CactusBase_MoL_constantinescu:07}).\nHere, we pursuit the simple Ansatz of performing one RK2 intermediate RHS evaluation for two RK4 intermediate RHS evaluations.\nThat is, the additional RK4 intermediate RHS evaluations simple use the results from the last intermediate RK2 step.\n\nTo be more explicit, given the equation\n\\begin{equation}\n\\partial_t y = f(t,y)\\,,\n\\end{equation}\nwhere $f$ corresponds to the RHS possibly including spatial derivatives,\nwe write a generic RK scheme according to\n\\begin{eqnarray}\ny_{n+1} &=& y_n + \\Delta t \\sum_{i=1}^s b_i\\, k_i\\,, \\\\\nk_i &=& f(t_n + c_i \\Delta t\\,, y_n + \\Delta t \\sum_{j=1}^s a_{ij} k_j)\\,.\n\\end{eqnarray}\nThe coefficients $b_i$, $c_i$, and $a_{ij}$ can be written in the standard Butcher\nnotation.\n\nIn our multirate scheme, we use two different sets of coefficients. \nOne set of coefficients determines the RK4 scheme used for integrating the spacetime variables \\eqref{eq:CactusBase_MoL_intmetric}, the other set determines the RK2 scheme for the\nhydro variables \\eqref{eq:CactusBase_MoL_intmatter}. The coefficients for the RK2 scheme are arranged such that RHS evaluations coincide with\nRK4 RHS evaluations.\nWe list the corresponding multirate Butcher tableau in Table~\\ref{tab:CactusBase_MoL_Multirate_butcher}.\n\n\\begin{table}[th]\n\\caption{Butcher tableau for an explicit multirate RK4/RK2 scheme. The right table (separated by the double vertical line) shows\nthe coefficients $b_i$ (bottom line), $c_i$ (first vertical column), and $a_{ij}$ for the classical RK4 scheme.\nThe left table shows the corresponding RK2 coefficients evaluated at timesteps that coincide with RK4 timesteps.}\n\\label{tab:CactusBase_MoL_Multirate_butcher}\n\\begin{tabular}{l|llll||l|llll}\n0 & & & & & 0 & & \\\\ \n0 & 0 & & & & 1/2 & 1/2\\\\\n0 & 0 & 0 & & & 1/2 & 0 & 1/2 & & \\\\\n1 & 1 & 0 & 0 & & 1 & 0 & 0 & 1/2 & \\\\\n\\hline\n & 1/2 & 0 & 0 & 1/2 & & 1/3 & 1/6 & 1/6 & 1/3\\\\\n\\end{tabular}\n\\end{table}\n\n\n\\section{Functions provided by MoL}\n\\label{CactusBase_MoL_sec:molfns}\n\nAll the functions listed below return error codes in theory. However\nat this current point in time they always return 0 (success). Any\nfailure to register or change a GF is assumed fatal and MoL will\nissue a level 0 warning stopping the code. This may change in future,\nin which case negative return values will indicate errors.\n\nThese are all \\textit{aliased} functions. You can get the functions\ndirectly through header files, but this feature may be phased\nout. Using function aliasing is the recommended method.\n\n\\begin{FunctionDescription}{MoLRegisterEvolved}\n \\label{CactusBase_MoL_MoLRegisterEvolved}\n \n Tells MoL that the given GF is in the evolved category with the\n associated update GF.\n\n \\begin{SynopsisSection}\n \\begin{Synopsis}{C}\n\\begin{verbatim}\nCCTK_INT ierr = MoLRegisterEvolved(CCTK_INT EvolvedIndex, \n CCTK_INT RHSIndex)\nCCTK_INT ierr = MoLRegisterEvolvedSlow(CCTK_INT EvolvedIndex, \n CCTK_INT RHSIndex)\n\\end{verbatim}\n \\end{Synopsis}\n \\begin{Synopsis}{Fortran}\n\\begin{verbatim}\nCCTK_INT ierr = MoLRegisterEvolved(CCTK_INT EvolvedIndex,\n CCTK_INT RHSIndex)\nCCTK_INT ierr = MoLRegisterEvolvedSlow(CCTK_INT EvolvedIndex,\n CCTK_INT RHSIndex)\n\\end{verbatim}\n \\end{Synopsis}\n \\end{SynopsisSection}\n\n \\begin{ResultSection}\n \\begin{ResultNote}\n Currently if there is an error, MoL will issue a level 0\n warning. No sensible return codes exist.\n \\end{ResultNote}\n \\begin{Result}{\\rm 0}\n success\n \\end{Result}\n \\end{ResultSection}\n\n \\begin{ParameterSection}\n \\begin{Parameter}{EvolvedIndex}\n Index of the GF to be evolved.\n \\end{Parameter}\n \\begin{Parameter}{RHSIndex}\n Index of the associated update GF.\n \\end{Parameter}\n \\end{ParameterSection}\n\n \\begin{Discussion}\n Should be called in a function scheduled in {\\tt MoL\\_Register}. Use the\n {\\tt Slow} variant to register the slow sector of a multirate scheme.\n \\end{Discussion}\n\n \\begin{SeeAlsoSection}\n \\begin{SeeAlso}{CCTK\\_VarIndex()}\n Get the variable index.\n \\end{SeeAlso}\n \\begin{SeeAlso}{MoLRegisterSaveAndRestore()}\n Register Save and Restore variables.\n \\end{SeeAlso}\n \\begin{SeeAlso}{MoLRegisterConstrained()}\n Register constrained variables.\n \\end{SeeAlso}\n \\begin{SeeAlso}{MoLChangeToEvolved()}\n Change a variable at runtime to be evolved.\n \\end{SeeAlso}\n \\begin{SeeAlso}{MoLChangeToEvolvedSlow()}\n Change a variable at runtime to be evolved in the slow sector.\n \\end{SeeAlso}\n \\end{SeeAlsoSection}\n\n \\begin{ExampleSection}\n \\begin{Example}{C}\n\\begin{verbatim}\nierr = MoLRegisterEvolved(CCTK_VarIndex(\"wavetoymol::phi\"),\n CCTK_VarIndex(\"wavetoymol::phirhs\"));\n\\end{verbatim}\n \\end{Example}\n \\begin{Example}{Fortran}\n\\begin{verbatim}\ncall CCTK_VarIndex(EvolvedIndex, \"wavetoymol::phi\")\ncall CCTK_VarIndex(RHSIndex, \"wavetoymol::phirhs\")\nierr = MoLRegisterEvolved(EvolvedIndex, RHSIndex)\n\\end{verbatim}\n \\end{Example}\n \\end{ExampleSection}\n\n\\end{FunctionDescription}\n\n\n\n\\begin{FunctionDescription}{MoLRegisterConstrained}\n \\label{CactusBase_MoL_MoLRegisterConstrained}\n \n Tells MoL that the given GF is in the constrained category.\n\n \\begin{SynopsisSection}\n \\begin{Synopsis}{C}\n\\begin{verbatim}\nCCTK_INT ierr = MoLRegisterConstrained(CCTK_INT ConstrainedIndex)\n\\end{verbatim}\n \\end{Synopsis}\n \\begin{Synopsis}{Fortran}\n\\begin{verbatim}\nCCTK_INT ierr = MoLRegisterConstrained(CCTK_INT ConstrainedIndex)\n\\end{verbatim}\n \\end{Synopsis}\n \\end{SynopsisSection}\n\n \\begin{ResultSection}\n \\begin{ResultNote}\n Currently if there is an error, MoL will issue a level 0\n warning. No sensible return codes exist.\n \\end{ResultNote}\n \\begin{Result}{\\rm 0}\n success\n \\end{Result}\n \\end{ResultSection}\n\n \\begin{ParameterSection}\n \\begin{Parameter}{ConstrainedIndex}\n Index of the constrained GF.\n \\end{Parameter}\n \\end{ParameterSection}\n\n \\begin{Discussion}\n Should be called in a function scheduled in {\\tt MoL\\_Register}.\n \\end{Discussion}\n\n \\begin{SeeAlsoSection}\n \\begin{SeeAlso}{CCTK\\_VarIndex()}\n Get the variable index.\n \\end{SeeAlso}\n \\begin{SeeAlso}{MoLRegisterEvolved()}\n Register evolved variables.\n \\end{SeeAlso}\n \\begin{SeeAlso}{MoLRegisterSaveAndRestore()}\n Register Save and Restore variables.\n \\end{SeeAlso}\n \\begin{SeeAlso}{MoLChangeToConstrained()}\n Change a variable at runtime to be constrained.\n \\end{SeeAlso}\n \\end{SeeAlsoSection}\n\n \\begin{ExampleSection}\n \\begin{Example}{C}\n\\begin{verbatim}\nierr = MoLRegisterConstrained(CCTK_VarIndex(\"ADMBase::alp\"));\n\\end{verbatim}\n \\end{Example}\n \\begin{Example}{Fortran}\n\\begin{verbatim}\ncall CCTK_VarIndex(ConstrainedIndex, \"ADMBase::alp\")\nierr = MoLRegisterConstrained(ConstrainedIndex)\n\\end{verbatim}\n \\end{Example}\n \\end{ExampleSection}\n\n\\end{FunctionDescription}\n\n\n\n\\begin{FunctionDescription}{MoLRegisterSaveAndRestore}\n \\label{CactusBase_MoL_MoLRegisterSaveAndRestore}\n \n Tells MoL that the given GF is in the Save and Restore category.\n\n \\begin{SynopsisSection}\n \\begin{Synopsis}{C}\n\\begin{verbatim}\nCCTK_INT ierr = MoLRegisterSaveAndRestore(CCTK_INT SandRIndex)\n\\end{verbatim}\n \\end{Synopsis}\n \\begin{Synopsis}{Fortran}\n\\begin{verbatim}\nCCTK_INT ierr = MoLRegisterSaveAndRestore(CCTK_INT SandRIndex)\n\\end{verbatim}\n \\end{Synopsis}\n \\end{SynopsisSection}\n\n \\begin{ResultSection}\n \\begin{ResultNote}\n Currently if there is an error, MoL will issue a level 0\n warning. No sensible return codes exist.\n \\end{ResultNote}\n \\begin{Result}{\\rm 0}\n success\n \\end{Result}\n \\end{ResultSection}\n\n \\begin{ParameterSection}\n \\begin{Parameter}{SandRIndex}\n Index of the Save and Restore GF.\n \\end{Parameter}\n \\end{ParameterSection}\n\n \\begin{Discussion}\n Should be called in a function scheduled in {\\tt MoL\\_Register}.\n \\end{Discussion}\n\n \\begin{SeeAlsoSection}\n \\begin{SeeAlso}{CCTK\\_VarIndex()}\n Get the variable index.\n \\end{SeeAlso}\n \\begin{SeeAlso}{MoLRegisterEvolved()}\n Register evolved variables.\n \\end{SeeAlso}\n \\begin{SeeAlso}{MoLRegisterConstrained()}\n Register constrained variables.\n \\end{SeeAlso}\n \\begin{SeeAlso}{MoLChangeToSaveAndRestore()}\n Change a variable at runtime to be Save and Restore.\n \\end{SeeAlso}\n \\end{SeeAlsoSection}\n\n \\begin{ExampleSection}\n \\begin{Example}{C}\n\\begin{verbatim}\nierr = MoLRegisterSaveAndRestore(CCTK_VarIndex(\"ADMBase::alp\"));\n\\end{verbatim}\n \\end{Example}\n \\begin{Example}{Fortran}\n\\begin{verbatim}\ncall CCTK_VarIndex(SandRIndex, \"ADMBase::alp\")\nierr = MoLRegisterSaveAndRestore(SandRIndex)\n\\end{verbatim}\n \\end{Example}\n \\end{ExampleSection}\n\n\\end{FunctionDescription}\n\n\n\n\\begin{FunctionDescription}{MoLRegisterEvolvedGroup}\n \\label{CactusBase_MoL_MoLRegisterEvolvedGroup}\n \n Tells MoL that the given group is in the evolved category with the\n associated update group.\n\n \\begin{SynopsisSection}\n \\begin{Synopsis}{C}\n\\begin{verbatim}\nCCTK_INT ierr = MoLRegisterEvolvedGroup(CCTK_INT EvolvedIndex, \n CCTK_INT RHSIndex)\nCCTK_INT ierr = MoLRegisterEvolvedGroupSlow(CCTK_INT EvolvedIndex, \n CCTK_INT RHSIndex)\n\\end{verbatim}\n \\end{Synopsis}\n \\begin{Synopsis}{Fortran}\n\\begin{verbatim}\nCCTK_INT ierr = MoLRegisterEvolvedGroup(CCTK_INT EvolvedIndex, \n CCTK_INT RHSIndex)\nCCTK_INT ierr = MoLRegisterEvolvedGroupSlow(CCTK_INT EvolvedIndex, \n CCTK_INT RHSIndex)\n\\end{verbatim}\n \\end{Synopsis}\n \\end{SynopsisSection}\n\n \\begin{ResultSection}\n \\begin{ResultNote}\n Currently if there is an error, MoL will issue a level 0\n warning. No sensible return codes exist.\n \\end{ResultNote}\n \\begin{Result}{\\rm 0}\n success\n \\end{Result}\n \\end{ResultSection}\n\n \\begin{ParameterSection}\n \\begin{Parameter}{EvolvedIndex}\n Index of the group to be evolved.\n \\end{Parameter}\n \\begin{Parameter}{RHSIndex}\n Index of the associated update group.\n \\end{Parameter}\n \\end{ParameterSection}\n\n \\begin{Discussion}\n Should be called in a function scheduled in {\\tt MoL\\_Register}. Use the\n {\\tt Slow} variant to register the slow sector of a multirate scheme.\n \\end{Discussion}\n\n \\begin{SeeAlsoSection}\n \\begin{SeeAlso}{CCTK\\_GroupIndex()}\n Get the group index.\n \\end{SeeAlso}\n \\begin{SeeAlso}{MoLRegisterSaveAndRestoreGroup()}\n Register Save and Restore variables.\n \\end{SeeAlso}\n \\begin{SeeAlso}{MoLRegisterConstrainedGroup()}\n Register constrained variables.\n \\end{SeeAlso}\n \\end{SeeAlsoSection}\n\n \\begin{ExampleSection}\n \\begin{Example}{C}\n\\begin{verbatim}\nierr = MoLRegisterEvolvedGroup(CCTK_GroupIndex(\"wavetoymol::scalarevolvemol\"),\n CCTK_GroupIndex(\"wavetoymol::scalarevolvemolrhs\"));\n\\end{verbatim}\n \\end{Example}\n \\begin{Example}{Fortran}\n\\begin{verbatim}\ncall CCTK_GroupIndex(EvolvedIndex, \"wavetoymol::scalarevolvemol\")\ncall CCTK_GroupIndex(RHSIndex, \"wavetoymol::scalarevolvemolrhs\")\nierr = MoLRegisterEvolvedGroup(EvolvedIndex, RHSIndex)\n\\end{verbatim}\n \\end{Example}\n \\end{ExampleSection}\n\n\\end{FunctionDescription}\n\n\n\n\\begin{FunctionDescription}{MoLRegisterConstrainedGroup}\n \\label{CactusBase_MoL_MoLRegisterConstrainedGroup}\n \n Tells MoL that the given group is in the constrained category.\n\n \\begin{SynopsisSection}\n \\begin{Synopsis}{C}\n\\begin{verbatim}\nCCTK_INT ierr = MoLRegisterConstrainedGroup(CCTK_INT ConstrainedIndex)\n\\end{verbatim}\n \\end{Synopsis}\n \\begin{Synopsis}{Fortran}\n\\begin{verbatim}\nCCTK_INT ierr = MoLRegisterConstrainedGroup(CCTK_INT ConstrainedIndex)\n\\end{verbatim}\n \\end{Synopsis}\n \\end{SynopsisSection}\n\n \\begin{ResultSection}\n \\begin{ResultNote}\n Currently if there is an error, MoL will issue a level 0\n warning. No sensible return codes exist.\n \\end{ResultNote}\n \\begin{Result}{\\rm 0}\n success\n \\end{Result}\n \\end{ResultSection}\n\n \\begin{ParameterSection}\n \\begin{Parameter}{ConstrainedIndex}\n Index of the constrained group.\n \\end{Parameter}\n \\end{ParameterSection}\n\n \\begin{Discussion}\n Should be called in a function scheduled in {\\tt MoL\\_Register}.\n \\end{Discussion}\n\n \\begin{SeeAlsoSection}\n \\begin{SeeAlso}{CCTK\\_GroupIndex()}\n Get the group index.\n \\end{SeeAlso}\n \\begin{SeeAlso}{MoLRegisterEvolvedGroup()}\n Register evolved variables.\n \\end{SeeAlso}\n \\begin{SeeAlso}{MoLRegisterSaveAndRestoreGroup()}\n Register Save and Restore variables.\n \\end{SeeAlso}\n \\begin{SeeAlso}{MoLChangeToConstrained()}\n Change a variable at runtime to be constrained.\n \\end{SeeAlso}\n \\end{SeeAlsoSection}\n\n \\begin{ExampleSection}\n \\begin{Example}{C}\n\\begin{verbatim}\nierr = MoLRegisterConstrainedGroup(CCTK_GroupIndex(\"ADMBase::lapse\"));\n\\end{verbatim}\n \\end{Example}\n \\begin{Example}{Fortran}\n\\begin{verbatim}\ncall CCTK_GroupIndex(ConstrainedIndex, \"ADMBase::lapse\")\nierr = MoLRegisterConstrainedGroup(ConstrainedIndex)\n\\end{verbatim}\n \\end{Example}\n \\end{ExampleSection}\n\n\\end{FunctionDescription}\n\n\n\n\\begin{FunctionDescription}{MoLRegisterSaveAndRestoreGroup}\n \\label{CactusBase_MoL_MoLRegisterSaveAndRestoreGroup}\n \n Tells MoL that the given group is in the Save and Restore category.\n\n \\begin{SynopsisSection}\n \\begin{Synopsis}{C}\n\\begin{verbatim}\nCCTK_INT ierr = MoLRegisterSaveAndRestoreGroup(CCTK_INT SandRIndex)\n\\end{verbatim}\n \\end{Synopsis}\n \\begin{Synopsis}{Fortran}\n\\begin{verbatim}\nCCTK_INT ierr = MoLRegisterSaveAndRestoreGroup(CCTK_INT SandRIndex)\n\\end{verbatim}\n \\end{Synopsis}\n \\end{SynopsisSection}\n\n \\begin{ResultSection}\n \\begin{ResultNote}\n Currently if there is an error, MoL will issue a level 0\n warning. No sensible return codes exist.\n \\end{ResultNote}\n \\begin{Result}{\\rm 0}\n success\n \\end{Result}\n \\end{ResultSection}\n\n \\begin{ParameterSection}\n \\begin{Parameter}{SandRIndex}\n Index of the save and restore group.\n \\end{Parameter}\n \\end{ParameterSection}\n\n \\begin{Discussion}\n Should be called in a function scheduled in {\\tt MoL\\_Register}.\n \\end{Discussion}\n\n \\begin{SeeAlsoSection}\n \\begin{SeeAlso}{CCTK\\_GroupIndex()}\n Get the group index.\n \\end{SeeAlso}\n \\begin{SeeAlso}{MoLRegisterEvolvedGroup()}\n Register evolved variables.\n \\end{SeeAlso}\n \\begin{SeeAlso}{MoLRegisterConstrainedGroup()}\n Register constrained variables.\n \\end{SeeAlso}\n \\end{SeeAlsoSection}\n\n \\begin{ExampleSection}\n \\begin{Example}{C}\n\\begin{verbatim}\nierr = MoLRegisterSaveAndRestoreGroup(CCTK_GroupIndex(\"ADMBase::shift\"));\n\\end{verbatim}\n \\end{Example}\n \\begin{Example}{Fortran}\n\\begin{verbatim}\ncall CCTK_GroupIndex(SandRIndex, \"ADMBase::shift\")\nierr = MoLRegisterSaveAndRestoreGroup(SandRIndex)\n\\end{verbatim}\n \\end{Example}\n \\end{ExampleSection}\n\n\\end{FunctionDescription}\n\n\n\n\\begin{FunctionDescription}{MoLChangeToEvolved}\n \\label{CactusBase_MoL_MoLChangeToEvolved}\n\n Sets a GF to belong to the evolved category, with the associated\n update GF. Not used for the initial setting.\n\n \\begin{SynopsisSection}\n \\begin{Synopsis}{C}\n\\begin{verbatim}\nCCTK_INT ierr = MoLChangeToEvolved(CCTK_INT EvolvedIndex, \n CCTK_INT RHSIndex)\nCCTK_INT ierr = MoLChangeToEvolvedSlow(CCTK_INT EvolvedIndex, \n CCTK_INT RHSIndex)\n\\end{verbatim}\n \\end{Synopsis}\n \\begin{Synopsis}{Fortran}\n\\begin{verbatim}\nCCTK_INT ierr = MoLChangeToEvolvedSlow(CCTK_INT EvolvedIndex, \n CCTK_INT RHSIndex)\n\\end{verbatim}\n \\end{Synopsis}\n \\end{SynopsisSection}\n\n \\begin{ResultSection}\n \\begin{ResultNote}\n Currently if there is an error, MoL will issue a level 0\n warning. No sensible return codes exist.\n \\end{ResultNote}\n \\begin{Result}{\\rm 0}\n success\n \\end{Result}\n \\end{ResultSection}\n\n \\begin{ParameterSection}\n \\begin{Parameter}{EvolvedIndex}\n Index of the evolved GF.\n \\end{Parameter}\n \\begin{Parameter}{RHSIndex}\n Index of the associated update GF.\n \\end{Parameter}\n \\end{ParameterSection}\n\n \\begin{Discussion}\n Should be called in a function scheduled in {\\tt MoL\\_PreStep}.\n Note that this function was designed to allow mixed slicings for\n thorn ADMBase. This set of functions is largely untested and\n should be used with great care.\n \\end{Discussion}\n\n \\begin{SeeAlsoSection}\n \\begin{SeeAlso}{CCTK\\_VarIndex()}\n Get the variable index.\n \\end{SeeAlso}\n \\begin{SeeAlso}{MoLRegisterEvolved()}\n Register evolved variables.\n \\end{SeeAlso}\n \\begin{SeeAlso}{MoLChangeToSaveAndRestore()}\n Change a variable at runtime to be Save and Restore.\n \\end{SeeAlso}\n \\begin{SeeAlso}{MoLChangeToConstrained()}\n Change a variable at runtime to be constrained.\n \\end{SeeAlso}\n \\end{SeeAlsoSection}\n\n \\begin{ExampleSection}\n \\begin{Example}{C}\n\\begin{verbatim}\nierr = MoLChangeToEvolved(CCTK_VarIndex(\"ADMBase::alp\"),\n CCTK_VarIndex(\"adm_bssn::adm_bs_salp\"));\n\\end{verbatim}\n \\end{Example}\n \\begin{Example}{Fortran}\n\\begin{verbatim}\ncall CCTK_VarIndex(EvolvedIndex, \"ADMBase::alp\")\ncall CCTK_VarIndex(RHSIndex,\"adm_bssn::adm_bs_salp\")\nierr = MoLChangeToEvolved(EvolvedIndex, RHSIndex)\n\\end{verbatim}\n \\end{Example}\n \\end{ExampleSection}\n\n\\end{FunctionDescription}\n\n\n\n\\begin{FunctionDescription}{MoLChangeToConstrained}\n \\label{CactusBase_MoL_MoLChangeToConstrained}\n \n Sets a GF to belong to the constrained category. Not used for the\n initial setting.\n\n \\begin{SynopsisSection}\n \\begin{Synopsis}{C}\n\\begin{verbatim}\nCCTK_INT ierr = MoLChangeToConstrained(CCTK_INT EvolvedIndex)\n\\end{verbatim}\n \\end{Synopsis}\n \\begin{Synopsis}{Fortran}\n\\begin{verbatim}\nCCTK_INT ierr = MoLChangeToConstrained(CCTK_INT EvolvedIndex)\n\\end{verbatim}\n \\end{Synopsis}\n \\end{SynopsisSection}\n\n \\begin{ResultSection}\n \\begin{ResultNote}\n Currently if there is an error, MoL will issue a level 0\n warning. No sensible return codes exist.\n \\end{ResultNote}\n \\begin{Result}{\\rm 0}\n success\n \\end{Result}\n \\end{ResultSection}\n\n \\begin{ParameterSection}\n \\begin{Parameter}{ConstrainedIndex}\n Index of the constrained GF.\n \\end{Parameter}\n \\end{ParameterSection}\n\n \\begin{Discussion}\n Should be called in a function scheduled in {\\tt MoL\\_PreStep}.\n Note that this function was designed to allow mixed slicings for\n thorn ADMBase. This set of functions is largely untested and\n should be used with great care.\n \\end{Discussion}\n\n \\begin{SeeAlsoSection}\n \\begin{SeeAlso}{CCTK\\_VarIndex()}\n Get the variable index.\n \\end{SeeAlso}\n \\begin{SeeAlso}{MoLRegisterConstrained()}\n Register constrained variables.\n \\end{SeeAlso}\n \\begin{SeeAlso}{MoLChangeToSaveAndRestore()}\n Change a variable at runtime to be Save and Restore.\n \\end{SeeAlso}\n \\begin{SeeAlso}{MoLChangeToEvolved()}\n Change a variable at runtime to be evolved.\n \\end{SeeAlso}\n \\end{SeeAlsoSection}\n\n \\begin{ExampleSection}\n \\begin{Example}{C}\n\\begin{verbatim}\nierr = MoLChangeToConstrained(CCTK_VarIndex(\"ADMBase::alp\"));\n\\end{verbatim}\n \\end{Example}\n \\begin{Example}{Fortran}\n\\begin{verbatim}\ncall CCTK_VarIndex(EvolvedIndex, \"ADMBase::alp\")\nierr = MoLChangeToConstrained(EvolvedIndex)\n\\end{verbatim}\n \\end{Example}\n \\end{ExampleSection}\n\n\\end{FunctionDescription}\n\n\n\n\\begin{FunctionDescription}{MoLChangeToSaveAndRestore}\n \\label{CactusBase_MoL_MoLChangeToSaveAndRestore}\n \n Sets a GF to belong to the Save and Restore category. Not used for the\n initial setting.\n\n \\begin{SynopsisSection}\n \\begin{Synopsis}{C}\n\\begin{verbatim}\nCCTK_INT ierr = MoLChangeToSaveAndRestore(CCTK_INT SandRIndex) \n\\end{verbatim}\n \\end{Synopsis}\n \\begin{Synopsis}{Fortran}\n\\begin{verbatim}\nCCTK_INT ierr = MoLChangeToSaveAndRestore(CCTK_INT SandRIndex) \n\\end{verbatim}\n \\end{Synopsis}\n \\end{SynopsisSection}\n\n \\begin{ResultSection}\n \\begin{ResultNote}\n Currently if there is an error, MoL will issue a level 0\n warning. No sensible return codes exist.\n \\end{ResultNote}\n \\begin{Result}{\\rm 0}\n success\n \\end{Result}\n \\end{ResultSection}\n\n \\begin{ParameterSection}\n \\begin{Parameter}{SandRIndex}\n Index of the Save and Restore GF.\n \\end{Parameter}\n \\end{ParameterSection}\n\n \\begin{Discussion}\n Should be called in a function scheduled in {\\tt MoL\\_PreStep}.\n Note that this function was designed to allow mixed slicings for\n thorn ADMBase. This set of functions is largely untested and\n should be used with great care.\n \\end{Discussion}\n\n \\begin{SeeAlsoSection}\n \\begin{SeeAlso}{CCTK\\_VarIndex()}\n Get the variable index.\n \\end{SeeAlso}\n \\begin{SeeAlso}{MoLRegisterSaveAndRestore()}\n Register Save and Restore variables.\n \\end{SeeAlso}\n \\begin{SeeAlso}{MoLChangeToEvolved()}\n Change a variable at runtime to be evolved.\n \\end{SeeAlso}\n \\begin{SeeAlso}{MoLChangeToConstrained()}\n Change a variable at runtime to be constrained.\n \\end{SeeAlso}\n \\end{SeeAlsoSection}\n\n \\begin{ExampleSection}\n \\begin{Example}{C}\n\\begin{verbatim}\nierr = MoLChangeToSaveAndRestore(CCTK_VarIndex(\"ADMBase::alp\"));\n\\end{verbatim}\n \\end{Example}\n \\begin{Example}{Fortran}\n\\begin{verbatim}\ncall CCTK_VarIndex(SandRIndex, \"ADMBase::alp\")\nierr = MoLChangeToSaveAndRestore(SandRIndex)\n\\end{verbatim}\n \\end{Example}\n \\end{ExampleSection}\n\n\\end{FunctionDescription}\n\n\n\n\\begin{FunctionDescription}{MoLChangeToNone}\n \\label{CactusBase_MoL_MoLChangeToNone}\n \n Sets a GF to belong to the ``unknown'' category. Not used for the\n initial setting.\n\n \\begin{SynopsisSection}\n \\begin{Synopsis}{C}\n\\begin{verbatim}\nCCTK_INT ierr = MoLChangeToNone(CCTK_INT RemoveIndex)\n\\end{verbatim}\n \\end{Synopsis}\n \\begin{Synopsis}{Fortran}\n\\begin{verbatim}\nCCTK_INT ierr = MoLChangeToNone(CCTK_INT RemoveIndex)\n\\end{verbatim}\n \\end{Synopsis}\n \\end{SynopsisSection}\n\n \\begin{ResultSection}\n \\begin{ResultNote}\n Currently if there is an error, MoL will issue a level 0\n warning. No sensible return codes exist.\n \\end{ResultNote}\n \\begin{Result}{\\rm 0}\n success\n \\end{Result}\n \\end{ResultSection}\n\n \\begin{ParameterSection}\n \\begin{Parameter}{RemoveIndex}\n Index of the ``unknown'' GF.\n \\end{Parameter}\n \\end{ParameterSection}\n\n \\begin{Discussion}\n Should be called in a function scheduled in {\\tt MoL\\_PreStep}.\n Note that this function was designed to allow mixed slicings for\n thorn ADMBase. This set of functions is largely untested and\n should be used with great care.\n \\end{Discussion}\n\n \\begin{SeeAlsoSection}\n \\begin{SeeAlso}{CCTK\\_VarIndex()}\n Get the variable index.\n \\end{SeeAlso}\n \\begin{SeeAlso}{MoLChangeToEvolved()}\n Change a variable at runtime to be evolved.\n \\end{SeeAlso}\n \\begin{SeeAlso}{MoLChangeToSaveAndRestore()}\n Change a variable at runtime to be Save and Restore.\n \\end{SeeAlso}\n \\begin{SeeAlso}{MoLChangeToConstrained()}\n Change a variable at runtime to be constrained.\n \\end{SeeAlso}\n \\end{SeeAlsoSection}\n\n \\begin{ExampleSection}\n \\begin{Example}{C}\n\\begin{verbatim}\nierr = MoLChangeToNone(CCTK_VarIndex(\"ADMBase::alp\"));\n\\end{verbatim}\n \\end{Example}\n \\begin{Example}{Fortran}\n\\begin{verbatim}\ncall CCTK_VarIndex(RemoveIndex, \"ADMBase::alp\")\nierr = MoLChangeToNone(RemoveIndex)\n\\end{verbatim}\n \\end{Example}\n \\end{ExampleSection}\n\n\\end{FunctionDescription}\n\n\n\n\\begin{FunctionDescription}{MoLQueryEvolvedRHS}\n \\label{CactusBase_MoL_MoLQueryEvolvedRHS}\n \n Queries MoL for the index of the update variable for given GF in the\n evolved category.\n\n \\begin{SynopsisSection}\n \\begin{Synopsis}{C}\n\\begin{verbatim}\nCCTK_INT RHSindex = MoLQueryEvolvedRHS(CCTK_INT EvolvedIndex)\n\\end{verbatim}\n \\end{Synopsis}\n \\begin{Synopsis}{Fortran}\n\\begin{verbatim}\nCCTK_INT RHSindex = MoLQueryEvolvedRHS(CCTK_INT EvolvedIndex)\n\\end{verbatim}\n \\end{Synopsis}\n \\end{SynopsisSection}\n\n \\begin{ResultSection}\n \\begin{ResultNote}\n If the grid function passed does not exists, MoL will issue a level 0\n warning. If the grid function is not of an evolved type (fast or slow\n sector) $-1$ will be returned. Otherwise the variable\n index of the update GF is returned.\n \\end{ResultNote}\n \\begin{Result}{$> 0$}\n variable index of update GF\n \\end{Result}\n \\end{ResultSection}\n\n \\begin{ParameterSection}\n \\begin{Parameter}{EvolvedIndex}\n Index of the GF whose update GF is to be returned.\n \\end{Parameter}\n \\end{ParameterSection}\n\n \\begin{Discussion}\n Both slow and fast evolved variables can be queried.\n \\end{Discussion}\n\n \\begin{SeeAlsoSection}\n \\begin{SeeAlso}{CCTK\\_VarIndex()}\n Get the variable index.\n \\end{SeeAlso}\n \\begin{SeeAlso}{MoLRegisterEvolved()}\n Register evolved variables.\n \\end{SeeAlso}\n \\begin{SeeAlso}{MoLChangeToEvolvedSlow()}\n Change a variable at runtime to be evolved in the slow sector.\n \\end{SeeAlso}\n \\end{SeeAlsoSection}\n\n \\begin{ExampleSection}\n \\begin{Example}{C}\n\\begin{verbatim}\nrhsindex = MoLQueryEvolvedRHS(CCTK_VarIndex(\"wavetoymol::phi\"));\n\\end{verbatim}\n \\end{Example}\n \\begin{Example}{Fortran}\n\\begin{verbatim}\ncall CCTK_VarIndex(EvolvedIndex, \"wavetoymol::phi\")\nrhsindex = MoLQueryEvolvedRHS(EvolvedIndex)\n\\end{verbatim}\n \\end{Example}\n \\end{ExampleSection}\n\n\\end{FunctionDescription}\n\n\n\n\\begin{thebibliography}{9}\n\n\\bibitem{CactusBase_MoL_Thornburg93}\nJ. Thornburg.\n\\newblock {N}umerical {R}elativity in {B}lack {H}ole {S}pacetimes. \n\\newblock Unpublished thesis, University of British Columbia.\n\\newblock 1993.\n\\newblock Available from \\mbox{\\tt\n http://www.aei.mpg.de/\\~{}jthorn/phd/html/phd.html}. \n\n\\bibitem{CactusBase_MoL_Thornburg99}\nJ. Thornburg.\n\\newblock A {3+1} {C}omputational {S}cheme for {D}ynamic {S}pherically\n{S}ymmetric {B}lack {H}ole {S}pacetimes -- {II}: {T}ime {E}volution.\n\\newblock Preprint {\\tt gr-qc/9906022}, submitted to {\\em Phys. Rev.}\n{\\bf D}. \n\n\\bibitem{CactusBase_MoL_Shu99}\nC. Shu.\n\\newblock {H}igh {O}rder {ENO} and {WENO} {S}chemes for\n{C}omputational {F}luid {D}ynamics.\n\\newblock In T.~J. Barth and H. Deconinck, editors {\\em High-Order\n Methods for Computational Physics}. Springer, 1999.\n\\newblock A related online version can be found under {\\em Essentially\n {N}on-{O}scillatory and {W}eighted {E}ssentially {N}on-{O}scillatory\n {S}chemes for {H}yperbolic {C}onservation {L}aws} at {\\tt\n http://www.icase.edu/library/reports/rdp/97/97-65RDP.tex.refer.html}. \n\n\\bibitem{CactusBase_MoL_Neilsen00}\nD.~W. Neilsen and M.~W. Choptuik.\n\\newblock Ultrarelativistic fluid dynamics.\n\\newblock {\\em Class. Quantum Grav.}, {\\bf 17}:\\penalty0 733--759, 2000.\n\n\\bibitem{CactusBase_MoL_schlegel:09}\nM. Schlegel, O. Knoth, M. Arnold, and R. Wolke\n\\newblock {\\em Journal of Computational and Applied Mathematics}, {\\bf 226}, 345, 2009.\n\n\\bibitem{CactusBase_MoL_constantinescu:07}\nE. Constantinescu and A. Sandu\n\\newblock {\\em SIAM J. Sci.\\ Comput.}, {\\bf 33}, 239, 2007.\n\n\\end{thebibliography}\n\n% Do not delete next line\n% END CACTUS THORNGUIDE\n\n\\end{document}\n", |
| "MoLdia3.eps": "%!PS-Adobe-2.0 EPSF-2.0\n%%Title: /home/admin/Cactus/Cactus/arrangements/CactusMoL/MoL/doc/MoLdia3\n%%Creator: Dia v0.84\n%%CreationDate: Fri Feb 1 17:39:33 2002\n%%For: admin\n%%Magnification: 1.0000\n%%Orientation: Portrait\n%%BoundingBox: 0 0 343 321\n%%Pages: 1\n%%BeginSetup\n%%EndSetup\n%%EndComments\n[ /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n/.notdef /.notdef /space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quoteright\n/parenleft /parenright /asterisk /plus /comma /hyphen /period /slash /zero /one\n/two /three /four /five /six /seven /eight /nine /colon /semicolon\n/less /equal /greater /question /at /A /B /C /D /E\n/F /G /H /I /J /K /L /M /N /O\n/P /Q /R /S /T /U /V /W /X /Y\n/Z /bracketleft /backslash /bracketright /asciicircum /underscore /quoteleft /a /b /c\n/d /e /f /g /h /i /j /k /l /m\n/n /o /p /q /r /s /t /u /v /w\n/x /y /z /braceleft /bar /braceright /asciitilde /.notdef /.notdef /.notdef\n/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n/space /exclamdown /cent /sterling /currency /yen /brokenbar /section /dieresis /copyright\n/ordfeminine /guillemotleft /logicalnot /hyphen /registered /macron /degree /plusminus /twosuperior /threesuperior\n/acute /mu /paragraph /periodcentered /cedilla /onesuperior /ordmasculine /guillemotright /onequarter /onehalf\n/threequarters /questiondown /Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla\n/Egrave /Eacute /Ecircumflex /Edieresis /Igrave /Iacute /Icircumflex /Idieresis /Eth /Ntilde\n/Ograve /Oacute /Ocircumflex /Otilde /Odieresis /multiply /Oslash /Ugrave /Uacute /Ucircumflex\n/Udieresis /Yacute /Thorn /germandbls /agrave /aacute /acircumflex /atilde /adieresis /aring\n/ae /ccedilla /egrave /eacute /ecircumflex /edieresis /igrave /iacute /icircumflex /idieresis\n/eth /ntilde /ograve /oacute /ocircumflex /otilde /odieresis /divide /oslash /ugrave\n/uacute /ucircumflex /udieresis /yacute /thorn /ydieresis] /isolatin1encoding exch def\n/Times-Roman-latin1\n /Times-Roman findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Times-Italic-latin1\n /Times-Italic findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Times-Bold-latin1\n /Times-Bold findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Times-BoldItalic-latin1\n /Times-BoldItalic findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/AvantGarde-Book-latin1\n /AvantGarde-Book findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/AvantGarde-BookOblique-latin1\n /AvantGarde-BookOblique findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/AvantGarde-Demi-latin1\n /AvantGarde-Demi findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/AvantGarde-DemiOblique-latin1\n /AvantGarde-DemiOblique findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Bookman-Light-latin1\n /Bookman-Light findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Bookman-LightItalic-latin1\n /Bookman-LightItalic findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Bookman-Demi-latin1\n /Bookman-Demi findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Bookman-DemiItalic-latin1\n /Bookman-DemiItalic findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Courier-latin1\n /Courier findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Courier-Oblique-latin1\n /Courier-Oblique findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Courier-Bold-latin1\n /Courier-Bold findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Courier-BoldOblique-latin1\n /Courier-BoldOblique findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Helvetica-latin1\n /Helvetica findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Helvetica-Oblique-latin1\n /Helvetica-Oblique findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Helvetica-Bold-latin1\n /Helvetica-Bold findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Helvetica-BoldOblique-latin1\n /Helvetica-BoldOblique findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Helvetica-Narrow-latin1\n /Helvetica-Narrow findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Helvetica-Narrow-Oblique-latin1\n /Helvetica-Narrow-Oblique findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Helvetica-Narrow-Bold-latin1\n /Helvetica-Narrow-Bold findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Helvetica-Narrow-BoldOblique-latin1\n /Helvetica-Narrow-BoldOblique findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/NewCenturySchoolbook-Roman-latin1\n /NewCenturySchoolbook-Roman findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/NewCenturySchoolbook-Italic-latin1\n /NewCenturySchoolbook-Italic findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/NewCenturySchoolbook-Bold-latin1\n /NewCenturySchoolbook-Bold findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/NewCenturySchoolbook-BoldItalic-latin1\n /NewCenturySchoolbook-BoldItalic findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Palatino-Roman-latin1\n /Palatino-Roman findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Palatino-Italic-latin1\n /Palatino-Italic findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Palatino-Bold-latin1\n /Palatino-Bold findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Palatino-BoldItalic-latin1\n /Palatino-BoldItalic findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/Symbol-latin1\n /Symbol findfont\ndefinefont pop\n/ZapfChancery-MediumItalic-latin1\n /ZapfChancery-MediumItalic findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/ZapfDingbats-latin1\n /ZapfDingbats findfont\n dup length dict begin\n\t{1 index /FID ne {def} {pop pop} ifelse} forall\n\t/Encoding isolatin1encoding def\n currentdict end\ndefinefont pop\n/cp {closepath} bind def\n/c {curveto} bind def\n/f {fill} bind def\n/a {arc} bind def\n/ef {eofill} bind def\n/ex {exch} bind def\n/gr {grestore} bind def\n/gs {gsave} bind def\n/sa {save} bind def\n/rs {restore} bind def\n/l {lineto} bind def\n/m {moveto} bind def\n/rm {rmoveto} bind def\n/n {newpath} bind def\n/s {stroke} bind def\n/sh {show} bind def\n/slc {setlinecap} bind def\n/slj {setlinejoin} bind def\n/slw {setlinewidth} bind def\n/srgb {setrgbcolor} bind def\n/rot {rotate} bind def\n/sc {scale} bind def\n/sd {setdash} bind def\n/ff {findfont} bind def\n/sf {setfont} bind def\n/scf {scalefont} bind def\n/sw {stringwidth pop} bind def\n/tr {translate} bind def\n\n/ellipsedict 8 dict def\nellipsedict /mtrx matrix put\n/ellipse\n{ ellipsedict begin\n /endangle exch def\n /startangle exch def\n /yrad exch def\n /xrad exch def\n /y exch def\n /x exch def /savematrix mtrx currentmatrix def\n x y tr xrad yrad sc\n 0 0 1 startangle endangle arc\n savematrix setmatrix\n end\n} def\n\n/colortogray {\n/rgbdata exch store\nrgbdata length 3 idiv\n/npixls exch store\n/rgbindx 0 store\n0 1 npixls 1 sub {\ngrays exch\nrgbdata rgbindx get 20 mul\nrgbdata rgbindx 1 add get 32 mul\nrgbdata rgbindx 2 add get 12 mul\nadd add 64 idiv\nput\n/rgbindx rgbindx 3 add store\n} for\ngrays 0 npixls getinterval\n} bind def\n/mergeprocs {\ndup length\n3 -1 roll\ndup\nlength\ndup\n5 1 roll\n3 -1 roll\nadd\narray cvx\ndup\n3 -1 roll\n0 exch\nputinterval\ndup\n4 2 roll\nputinterval\n} bind def\n/colorimage {\npop pop\n{colortogray} mergeprocs\nimage\n} bind def\n\n28.346000 -28.346000 scale\n-2.950000 -16.256637 translate\n%%EndProlog\n\n\n0.100000 slw\n[] 0 sd\n[] 0 sd\n0 slc\n0.000000 0.000000 0.000000 srgb\nn 3.000000 5.000000 m 15.000000 5.000000 l s\n0.100000 slw\n[] 0 sd\n[] 0 sd\n0 slc\n0.000000 0.000000 0.000000 srgb\nn 3.000000 15.000000 m 15.000000 15.000000 l s\n0.000000 slw\n[] 0 sd\n[] 0 sd\n0 slc\n0.000000 0.000000 0.000000 srgb\nn 5.000000 14.000000 m 5.000000 6.000000 l s\n0 slj\n0.000000 0.000000 0.000000 srgb\nn 5.400000 6.800000 m 5.000000 6.000000 l 4.600000 6.800000 l f\n/Courier-latin1 ff 1.000000 scf sf\n0.000000 0.000000 0.000000 srgb\n(\\(1\\)) dup sw 2 div 4.000000 ex sub 10.000000 m gs 1 -1 sc sh gr\n0.000000 slw\n[] 0 sd\n[] 0 sd\n0 slc\n0.000000 0.000000 0.000000 srgb\nn 13.000000 6.000000 m 13.000000 14.000000 l s\n0 slj\n0.000000 0.000000 0.000000 srgb\nn 12.600000 13.200000 m 13.000000 14.000000 l 13.400000 13.200000 l f\n/Courier-latin1 ff 1.000000 scf sf\n0.000000 0.000000 0.000000 srgb\n(\\(2\\)) dup sw 2 div 12.000000 ex sub 10.000000 m gs 1 -1 sc sh gr\n/Courier-latin1 ff 1.000000 scf sf\n0.000000 0.000000 0.000000 srgb\n(\\(c\\)) dup sw 2 div 9.000000 ex sub 16.000000 m gs 1 -1 sc sh gr\nshowpage\n" |
| } |
| } |