aboutsummaryrefslogtreecommitdiff
path: root/interface.ccl
blob: 94a4bb75c0ef6cee0b06855e92d5ad7d0440cb6d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
# Interface definition for thorn MoL
# $Header$

implements: MethodOfLines

#INCLUDE HEADER: MoLFunctions.h IN MoLFunctions.h
#INCLUDE HEADER: MoL.h IN MoL.h

#USES INCLUDE: carpet.h

##################################################
### Functions from NaNChecker that may be used ###
##################################################

CCTK_INT FUNCTION CheckVarsForNaN              \
    (CCTK_POINTER_TO_CONST IN cctkGH,          \
     CCTK_INT              IN report_max,      \
     CCTK_STRING           IN vars,            \
     CCTK_STRING           IN check_for,       \
     CCTK_STRING           IN action_if_found)
USES FUNCTION CheckVarsForNaN

##############################################
### Functions from Carpet that may be used ###
##############################################

CCTK_INT FUNCTION EnableProlongating(CCTK_INT IN Status)
USES FUNCTION EnableProlongating

################################################################
### Aliased registration and type changing functions for the ###
### standard (i.e., real) GFs.                               ###
################################################################

CCTK_INT FUNCTION MoLRegisterEvolved(CCTK_INT IN EvolvedIndex, \
                                     CCTK_INT IN RHSIndex)
CCTK_INT FUNCTION MoLRegisterEvolvedSlow(CCTK_INT IN EvolvedIndex, \
                                         CCTK_INT IN RHSIndexSlow)

CCTK_INT FUNCTION MoLRegisterConstrained(CCTK_INT IN ConstrainedIndex)
CCTK_INT FUNCTION MoLRegisterSaveAndRestore(CCTK_INT IN SandRIndex)
CCTK_INT FUNCTION MoLRegisterEvolvedGroup(CCTK_INT IN EvolvedIndex, \
                                          CCTK_INT IN RHSIndex)
CCTK_INT FUNCTION MoLRegisterEvolvedGroupSlow(CCTK_INT IN EvolvedIndex, \
                                              CCTK_INT IN RHSIndexSlow)
CCTK_INT FUNCTION MoLRegisterConstrainedGroup(CCTK_INT IN ConstrainedIndex)
CCTK_INT FUNCTION MoLRegisterSaveAndRestoreGroup(CCTK_INT IN SandRIndex)
CCTK_INT FUNCTION MoLChangeToEvolved(CCTK_INT IN EvolvedIndex, \
                                     CCTK_INT IN RHSIndex)
CCTK_INT FUNCTION MoLChangeToEvolvedSlow(CCTK_INT IN EvolvedIndex, \
                                         CCTK_INT IN RHSIndexSlow)
CCTK_INT FUNCTION MoLChangeToConstrained(CCTK_INT IN ConstrainedIndex)
CCTK_INT FUNCTION MoLChangeToSaveAndRestore(CCTK_INT IN SandRIndex)
CCTK_INT FUNCTION MoLChangeToNone(CCTK_INT IN RemoveIndex)
CCTK_INT FUNCTION MoLQueryEvolvedRHS(CCTK_INT IN EvolvedIndex)
CCTK_INT FUNCTION MoLNumIntegratorSubsteps()

PROVIDES FUNCTION MoLRegisterEvolved WITH MoL_RegisterEvolved LANGUAGE C
PROVIDES FUNCTION MoLRegisterEvolvedSlow WITH MoL_RegisterEvolvedSlow LANGUAGE C
PROVIDES FUNCTION MoLRegisterConstrained WITH MoL_RegisterConstrained \
                  LANGUAGE C
PROVIDES FUNCTION MoLRegisterSaveAndRestore WITH MoL_RegisterSaveAndRestore \
                  LANGUAGE C
PROVIDES FUNCTION MoLRegisterEvolvedGroup WITH MoL_RegisterEvolvedGroup \
                  LANGUAGE C
PROVIDES FUNCTION MoLRegisterEvolvedGroupSlow WITH MoL_RegisterEvolvedGroupSlow \
                  LANGUAGE C
PROVIDES FUNCTION MoLRegisterConstrainedGroup WITH \
                  MoL_RegisterConstrainedGroup LANGUAGE C
PROVIDES FUNCTION MoLRegisterSaveAndRestoreGroup WITH \
                  MoL_RegisterSaveAndRestoreGroup LANGUAGE C
PROVIDES FUNCTION MoLChangeToEvolved WITH MoL_ChangeToEvolved LANGUAGE C
PROVIDES FUNCTION MoLChangeToEvolvedSlow WITH MoL_ChangeToEvolvedSlow LANGUAGE C
PROVIDES FUNCTION MoLChangeToConstrained WITH MoL_ChangeToConstrained \
                  LANGUAGE C
PROVIDES FUNCTION MoLChangeToSaveAndRestore WITH MoL_ChangeToSaveAndRestore \
                  LANGUAGE C
PROVIDES FUNCTION MoLChangeToNone WITH MoL_ChangeToNone LANGUAGE C
PROVIDES FUNCTION MoLQueryEvolvedRHS WITH MoL_QueryEvolvedRHS LANGUAGE C
PROVIDES FUNCTION MoLNumIntegratorSubsteps WITH MoL_NumIntegratorSubsteps \
                  LANGUAGE C

################################################################
### Aliased registration and type changing functions for the ###
### complex GFs.                                             ###
################################################################

# CCTK_INT FUNCTION MoLRegisterEvolvedComplex(CCTK_INT IN EvolvedIndex, \
#                                             CCTK_INT IN RHSIndex)
# CCTK_INT FUNCTION MoLRegisterConstrainedComplex(CCTK_INT IN ConstrainedIndex)
# CCTK_INT FUNCTION MoLRegisterSaveAndRestoreComplex(CCTK_INT IN SandRIndex)
# CCTK_INT FUNCTION MoLRegisterEvolvedComplexGroup(CCTK_INT IN EvolvedIndex, \
#                                                  CCTK_INT IN RHSIndex)
# CCTK_INT FUNCTION MoLRegisterConstrainedComplexGroup(CCTK_INT IN \
#                                                      ConstrainedIndex)
# CCTK_INT FUNCTION MoLRegisterSaveAndRestoreComplexGroup(CCTK_INT IN SandRIndex)
# CCTK_INT FUNCTION MoLChangeToEvolvedComplex(CCTK_INT IN EvolvedIndex, \
#                                             CCTK_INT IN RHSIndex)
# CCTK_INT FUNCTION MoLChangeToConstrainedComplex(CCTK_INT IN ConstrainedIndex)
# CCTK_INT FUNCTION MoLChangeToSaveAndRestoreComplex(CCTK_INT IN SandRIndex)
# CCTK_INT FUNCTION MoLChangeToNoneComplex(CCTK_INT IN RemoveIndex)
#
# PROVIDES FUNCTION MoLRegisterEvolvedComplex WITH MoL_RegisterEvolvedComplex \
#                   LANGUAGE C
# PROVIDES FUNCTION MoLRegisterConstrainedComplex WITH \
#                   MoL_RegisterConstrainedComplex LANGUAGE C
# PROVIDES FUNCTION MoLRegisterSaveAndRestoreComplex WITH \
#                   MoL_RegisterSaveAndRestoreComplex LANGUAGE C
# PROVIDES FUNCTION MoLRegisterEvolvedComplexGroup WITH \
#                   MoL_RegisterEvolvedComplexGroup LANGUAGE C
# PROVIDES FUNCTION MoLRegisterConstrainedComplexGroup WITH \
#                   MoL_RegisterConstrainedComplexGroup LANGUAGE C
# PROVIDES FUNCTION MoLRegisterSaveAndRestoreComplexGroup WITH \
#                   MoL_RegisterSaveAndRestoreComplexGroup LANGUAGE C
# PROVIDES FUNCTION MoLChangeToEvolvedComplex WITH \
#                   MoL_ChangeToEvolvedComplex LANGUAGE C
# PROVIDES FUNCTION MoLChangeToConstrainedComplex WITH \
#                   MoL_ChangeToConstrainedComplex LANGUAGE C
# PROVIDES FUNCTION MoLChangeToSaveAndRestoreComplex WITH \
#                   MoL_ChangeToSaveAndRestoreComplex LANGUAGE C
# PROVIDES FUNCTION MoLChangeToNoneComplex WITH MoL_ChangeToNoneComplex \
#                   LANGUAGE C

################################################################
### Aliased registration and type changing function for real ###
### grid arrays of all dimensions.                           ###
################################################################

# CCTK_INT FUNCTION MoLRegisterEvolvedArray(CCTK_INT IN EvolvedIndex, \
#                                           CCTK_INT IN RHSIndex)
# CCTK_INT FUNCTION MoLRegisterConstrainedArray(CCTK_INT IN ConstrainedIndex)
# CCTK_INT FUNCTION MoLRegisterSaveAndRestoreArray(CCTK_INT IN SandRIndex)
# CCTK_INT FUNCTION MoLRegisterEvolvedArrayGroup(CCTK_INT IN EvolvedIndex, \
#                                                CCTK_INT IN RHSIndex)
# CCTK_INT FUNCTION MoLRegisterConstrainedArrayGroup(CCTK_INT IN \
#                                                    ConstrainedIndex)
# CCTK_INT FUNCTION MoLRegisterSaveAndRestoreArrayGroup(CCTK_INT IN SandRIndex)
# CCTK_INT FUNCTION MoLChangeToEvolvedArray(CCTK_INT IN EvolvedIndex, \
#                                           CCTK_INT IN RHSIndex)
# CCTK_INT FUNCTION MoLChangeToConstrainedArray(CCTK_INT IN ConstrainedIndex)
# CCTK_INT FUNCTION MoLChangeToSaveAndRestoreArray(CCTK_INT IN SandRIndex)
# CCTK_INT FUNCTION MoLChangeToNoneArray(CCTK_INT IN RemoveIndex)
#
# PROVIDES FUNCTION MoLRegisterEvolvedArray WITH MoL_RegisterEvolvedArray \
#                   LANGUAGE C
# PROVIDES FUNCTION MoLRegisterConstrainedArray WITH \
#                   MoL_RegisterConstrainedArray LANGUAGE C
# PROVIDES FUNCTION MoLRegisterSaveAndRestoreArray WITH \
#                   MoL_RegisterSaveAndRestoreArray LANGUAGE C
# PROVIDES FUNCTION MoLRegisterEvolvedArrayGroup WITH \
#                   MoL_RegisterEvolvedArrayGroup LANGUAGE C
# PROVIDES FUNCTION MoLRegisterConstrainedArrayGroup WITH \
#                   MoL_RegisterConstrainedArrayGroup LANGUAGE C
# PROVIDES FUNCTION MoLRegisterSaveAndRestoreArrayGroup WITH \
#                   MoL_RegisterSaveAndRestoreArrayGroup LANGUAGE C
# PROVIDES FUNCTION MoLChangeToEvolvedArray WITH MoL_ChangeToEvolvedArray \
#                   LANGUAGE C
# PROVIDES FUNCTION MoLChangeToConstrainedArray WITH \
#                   MoL_ChangeToConstrainedArray LANGUAGE C
# PROVIDES FUNCTION MoLChangeToSaveAndRestoreArray WITH \
#                   MoL_ChangeToSaveAndRestoreArray LANGUAGE C
# PROVIDES FUNCTION MoLChangeToNoneArray WITH MoL_ChangeToNoneArray LANGUAGE C

###################################################################
### Aliased registration and type changing function for complex ###
### grid arrays of all dimensions.                              ###
###################################################################

# CCTK_INT FUNCTION MoLRegisterEvolvedComplexArray(CCTK_INT IN EvolvedIndex, \
#                                                  CCTK_INT IN RHSIndex)
# CCTK_INT FUNCTION MoLRegisterConstrainedComplexArray(CCTK_INT IN \
#                                                      ConstrainedIndex)
# CCTK_INT FUNCTION MoLRegisterSaveAndRestoreComplexArray(CCTK_INT IN SandRIndex)
# CCTK_INT FUNCTION MoLRegisterEvolvedComplexArrayGroup(CCTK_INT IN \
#                                                       EvolvedIndex, \
#                                                       CCTK_INT IN RHSIndex)
# CCTK_INT FUNCTION MoLRegisterConstrainedComplexArrayGroup(CCTK_INT IN \
#                                                           ConstrainedIndex)
# CCTK_INT FUNCTION MoLRegisterSaveAndRestoreComplexArrayGroup(CCTK_INT IN \
#                                                              SandRIndex)
# CCTK_INT FUNCTION MoLChangeToEvolvedComplexArray(CCTK_INT IN EvolvedIndex, \
#                                                  CCTK_INT IN RHSIndex)
# CCTK_INT FUNCTION MoLChangeToConstrainedComplexArray(CCTK_INT IN \
#                                                      ConstrainedIndex)
# CCTK_INT FUNCTION MoLChangeToSaveAndRestoreComplexArray(CCTK_INT IN SandRIndex)
# CCTK_INT FUNCTION MoLChangeToNoneComplexArray(CCTK_INT IN RemoveIndex)
#
# PROVIDES FUNCTION MoLRegisterEvolvedComplexArray WITH \
#                   MoL_RegisterEvolvedComplexArray LANGUAGE C
# PROVIDES FUNCTION MoLRegisterConstrainedComplexArray WITH \
#                   MoL_RegisterConstrainedComplexArray LANGUAGE C
# PROVIDES FUNCTION MoLRegisterSaveAndRestoreComplexArray WITH \
#                   MoL_RegisterSaveAndRestoreComplexArray LANGUAGE C
# PROVIDES FUNCTION MoLRegisterEvolvedComplexArrayGroup WITH \
#                   MoL_RegisterEvolvedComplexArrayGroup LANGUAGE C
# PROVIDES FUNCTION MoLRegisterConstrainedComplexArrayGroup WITH \
#                   MoL_RegisterConstrainedComplexArrayGroup LANGUAGE C
# PROVIDES FUNCTION MoLRegisterSaveAndRestoreComplexArrayGroup WITH \
#                   MoL_RegisterSaveAndRestoreComplexArrayGroup LANGUAGE C
# PROVIDES FUNCTION MoLChangeToEvolvedComplexArray WITH \
#                   MoL_ChangeToEvolvedComplexArray LANGUAGE C
# PROVIDES FUNCTION MoLChangeToConstrainedComplexArray WITH \
#                   MoL_ChangeToConstrainedComplexArray LANGUAGE C
# PROVIDES FUNCTION MoLChangeToSaveAndRestoreComplexArray WITH \
#                   MoL_ChangeToSaveAndRestoreComplexArray LANGUAGE C
# PROVIDES FUNCTION MoLChangeToNoneComplexArray WITH \
#                   MoL_ChangeToNoneComplexArray LANGUAGE C

##############################################################
### Aliased functions that can be provided by other thorns ###
### to override low-level grid variable operations.        ###
##############################################################

CCTK_INT FUNCTION LinearCombination             \
    (CCTK_POINTER_TO_CONST IN cctkGH,           \
     CCTK_INT              IN var,              \
     CCTK_REAL             IN scale,            \
     CCTK_INT  ARRAY       IN srcs,             \
     CCTK_INT  ARRAY       IN tls,              \
     CCTK_REAL ARRAY       IN facts,            \
     CCTK_INT              IN nsrcs)
USES FUNCTION LinearCombination

CCTK_INT FUNCTION Accelerator_NotifyDataModified \
  (CCTK_POINTER_TO_CONST IN cctkGH,              \
   CCTK_INT ARRAY        IN variables,           \
   CCTK_INT ARRAY        IN tls,                 \
   CCTK_INT              IN nvariables,          \
   CCTK_INT              IN on_device)
USES FUNCTION Accelerator_NotifyDataModified

private:

CCTK_REAL RKAlphaCoefficients \
            TYPE    = ARRAY \
            DIM     = 2 \
            SIZE    = MoL_Intermediate_Steps,MoL_Num_Scratch_Levels+1 \
            DISTRIB = CONSTANT \
            TAGS    = 'Checkpoint="no"'
#{
#} "The alpha coefficients used by the generic Runge-Kutta integrators"

CCTK_REAL RKBetaCoefficients \
            TYPE    = ARRAY \
            DIM     = 1 \
            SIZE    = MoL_Intermediate_Steps \
            DISTRIB = CONSTANT \
            TAGS    = 'Checkpoint="no"'
#{
#} "The beta coefficients used by the generic Runge-Kutta integrators"

CCTK_INT MoL_Counters \
            TYPE    = SCALAR \
            TAGS    = 'Checkpoint="no"'
{
  MoL_Intermediate_Step
  MoL_Stepsize_Bad
  
  # A flag indicating whether it is time for slow RHS evaluation. 
  # Oustide the MoL loop, it is guaranteed to be 1.
  # It is only zero for certain MoL substeps when multirate methods are used.
  MoL_SlowStep
  
  # A flag indicating whether it is time for slow post step computations (e.g. applying BCs)
  # Oustide the MoL loop, it is guaranteed to be 1.
  # It is only zero for certain MoL substeps when multirate methods are used.
  MoL_SlowPostStep
  
} "The counter for the time integration method"

CCTK_REAL MoL_Original_Time \
            TYPE    = SCALAR \
            TAGS    = 'Checkpoint="no"'
{
  Original_Time
  Original_Delta_Time
} "The original time and delta time which are reset by MoL during evolution"

CCTK_REAL ScratchSpace[MoL_Num_Evolved_Vars*MoL_Num_Scratch_Levels] \
            TYPE       = GF \
            Timelevels = 1 \
            TAGS       = 'Prolongation="None" Checkpoint="no"'

CCTK_REAL ScratchSpaceSlow[MoL_Num_Evolved_Vars_Slow*MoL_Num_Scratch_Levels] \
            TYPE       = GF \
            Timelevels = 1 \
            TAGS       = 'Prolongation="None" Checkpoint="no"'

CCTK_REAL SandRScratchSpace[MoL_Num_SaveAndRestore_Vars] \
            TYPE       = GF \
            Timelevels = 1 \
            TAGS       = 'Prolongation="None" Checkpoint="no"'

#CCTK_COMPLEX ComplexScratchSpace[MoL_Num_ComplexEvolved_Vars*MoL_Num_Scratch_Levels] \
#            TYPE       = GF \
#            Timelevels = 1 \
#            TAGS       = 'Checkpoint="no"'

#CCTK_COMPLEX ComplexSandRScratchSpace[MoL_Num_ComplexSaveAndRestore_Vars] \
#            TYPE       = GF \
#            Timelevels = 1 \
#            TAGS       = 'Checkpoint="no"'

# CCTK_REAL ArrayScratchSpace[MoL_Num_Scratch_Levels] \
#             TYPE       = ARRAY \
#             DIM        = 1 \
#             SIZE       = MoL_Max_Evolved_Array_Size \
#             Timelevels = 1 \
#             TAGS       = 'Checkpoint="no"'
# 
# CCTK_REAL ArraySandRScratchSpace \
#             TYPE       = ARRAY \
#             DIM        = 1 \
#             SIZE       = MoL_Max_Evolved_Array_Size \
#             Timelevels = 1 \
#             TAGS       = 'Checkpoint="no"'

#CCTK_COMPLEX ComplexArrayScratchSpace[MoL_Num_Scratch_Levels] \
#            TYPE       = ARRAY \
#            DIM        = 1 \
#            SIZE       = MoL_Max_Evolved_ComplexArray_Size \
#            Timelevels = 1 \
#            TAGS       = 'Checkpoint="no"'

#CCTK_COMPLEX ComplexArraySandRScratchSpace \
#            TYPE       = ARRAY \
#            DIM        = 1 \
#            SIZE       = MoL_Max_Evolved_ComplexArray_Size \
#            Timelevels = 1 \
#            TAGS       = 'Checkpoint="no"'

#Error vector and scalars for RK45

CCTK_REAL ErrorEstimate[MoL_Num_Evolved_Vars] \
            TYPE       = GF \
            Timelevels = 1 \
            TAGS       = 'Prolongation="None" Checkpoint="no"'

CCTK_REAL ErrorScalars \
            TYPE       = SCALAR
{
  Error
  Count
  EstimatedDt
} "Global error estimate"