aboutsummaryrefslogtreecommitdiff
path: root/schedule.ccl
blob: f3b73e37255b9020950bc127aff21e23cabb6e83 (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
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
# Schedule definitions for thorn EHFinder
# $Header$

STORAGE: level_set[2]
STORAGE: slevel_set
STORAGE: dlevel_set
STORAGE: eh_mask_all
STORAGE: rep_mask
STORAGE: ftmp_set
STORAGE: level_bak
STORAGE: mask_bak

# Check for metric_state

schedule EHFinder_ParamCheck at CCTK_PARAMCHECK
{
  LANG: Fortran
} "Check parameters"


if (CCTK_Equals(initial_data,"read from file"))
{
  schedule EHFinder_Read_Metric at CCTK_INITIAL
  {
    LANG: Fortran
  } "Read in metric from file"
}

if (CCTK_Equals(initial_lapse,"read from file"))
{
  schedule EHFinder_Read_Lapse at CCTK_INITIAL
  {
    LANG: Fortran
  } "Read in lapse from file"
}

if (CCTK_Equals(initial_shift,"read from file"))
{
  schedule EHFinder_Read_Shift at CCTK_INITIAL
  {
    LANG: Fortran
  } "Read in shift from file"
}

if (CCTK_Equals(metric_type,"static conformal") && CCTK_Equals(eh_metric_type,"numerical"))
{
  schedule EHFinder_Read_Conformal at CCTK_INITIAL
  {
    LANG: Fortran
  } "Read in conformal factor from file"
}

# Set up the initial level set function

schedule EHFinder_Init at CCTK_POSTINITIAL
{
  LANG: Fortran
  SYNC: level_set
} "Setup the initial surface"

schedule EHFinder_Integrate at CCTK_ANALYSIS
{
  LANG: Fortran
  STORAGE: eh_area
  TRIGGER: eh_area
} "Calculate integrals"

# Read in the data used in reconstructing the 4-metric if necessary

if (CCTK_Equals(eh_metric_type,"numerical"))
{
  schedule EHFinder_Read_Metric at CCTK_PRESTEP
  {
    LANG: Fortran
  } "Read in metric from file"
}

if (CCTK_Equals(eh_lapse_type,"numerical"))
{
  schedule EHFinder_Read_Lapse at CCTK_PRESTEP
  {
    LANG: Fortran
  } "Read in lapse from file"
}

if (CCTK_Equals(eh_shift_type,"numerical"))
{
  schedule EHFinder_Read_Shift at CCTK_PRESTEP
  {
    LANG: Fortran
  } "Read in shift from file"
}

if (CCTK_Equals(metric_type,"static conformal") && CCTK_Equals(eh_metric_type,"numerical"))
{
  schedule EHFinder_Read_Conformal at CCTK_PRESTEP
  {
    LANG: Fortran
  } "Read in conformal factor from file"
}

#schedule EHFinder_ReadData at CCTK_PRESTEP
#{
#  LANG: Fortran
#} "Read in metric, lapse and shift and conformal factor"

# Register the level_set function and its right hand side source with MoL

schedule EHFinder_MoLRegister in MoL_Register
{
  LANG: Fortran
} "Register evolution variables"


# Register the symmetries for the level set function

schedule EHFinder_SetSym at CCTK_BASEGRID
{
  LANG: Fortran
} "Register the symmetries for the level set function"


# Set the initial eh_mask to at the physical outer boundaries.

schedule EHFinder_MaskInit at CCTK_POSTINITIAL after EHFinder_Init
{
  LANG: Fortran
} "Setup the initial mask"


# Schedule the normal mode of operation

if (CCTK_Equals(mode,"normal"))
{

  # Schedule the calculation of the source terms

  schedule EHFinder_Sources in MoL_CalcRHS
  {
    LANG: Fortran
  } "Calculate the source terms"

  schedule GROUP EHFinder_PostStep in MoL_PostStep
  {
  } "Schedule group for symmetry boundaries and syncing"


  schedule EHFinder_ApplySymF in EHFinder_PostStep
  {
    LANG: Fortran
    SYNC: level_set
  } "Apply symmetry boundaries"


  # Set up the schedule group for re-parametrization

  schedule GROUP EHFinder_ReParametrize at CCTK_POSTSTEP
  {
  } "Re-parametrize the level set function"

  if (CCTK_Equals(re_param_method,"pde") || CCTK_Equals(re_param_method,"approx") || CCTK_Equals(re_param_method,"mixed"))
  {
    # Schedule the control routine, that initialises re_param_control_approx
    # and re_param_control_pde if it is time for re-parametrization

    schedule EHFinder_ReParametrizeControl in EHFinder_ReParametrize
    {
      LANG: Fortran
    } "Initializes the re-parametrization control"
  }

  if (CCTK_Equals(re_param_method,"pde") ||  CCTK_Equals(re_param_method,"mixed"))
  {
    if (CCTK_Equals(re_param_int_method,"euler"))
    {

      # Set up the schedule group for euler re-parametrization using 
      # re_param_control_pde to control the exit from the while loop.

      schedule GROUP Euler_ReParametrize in EHFinder_ReParametrize AFTER EHFinder_ReParametrizeControl WHILE ehfinder::re_param_control_pde
      {
      } "Schedule group for Euler re-parametrization"

      # Schedule the routine that does one Euler step 

      schedule EHFinder_ReParametrizeEuler in Euler_ReParametrize 
      {
        LANG: Fortran
#        SYNC: level_set
      } "Euler scheme"

      # Then synchronize the level set and apply symmetry boundary conditions.
     
      schedule  EHFinder_ApplySymF in Euler_ReParametrize after EHFinder_ReParametrizeEuler
      {
        LANG: Fortran
        SYNC: level_set
      } "Apply symmetry boundaries and sync"

      schedule EHFinder_ReParametrize_Check in EHFinder_ReParametrize AFTER Euler_ReParametrize
      {
        LANG: Fortran
      } "Check to see if re-parametrization has to be undone"
    }

    if (CCTK_Equals(re_param_int_method,"rk2"))
    {

      # Set up the schedule group for rk2 re-parametrization using 
      # re_param_control_pde to control the exit from the while loop.

      schedule GROUP RK2_ReParametrize in EHFinder_ReParametrize AFTER EHFinder_ReParametrize1 WHILE ehfinder::re_param_control_pde
      {
      } "Schedule group for RK2 re-parametrization"

      # Schedule the routine that does the first RK2 step

      schedule EHFinder_ReParametrizeRK2_1 in RK2_ReParametrize 
      {
        LANG: Fortran
      } "Euler scheme"

      # Then synchronize the level set and apply symmetry boundary conditions.
     
      schedule  EHFinder_ApplySymF in RK2_ReParametrize after EHFinder_ReParametrizeRK2_1
      {
        LANG: Fortran
        SYNC: level_set
      } "Apply symmetry boundaries and sync"

      # Schedule the routine that does the second RK2 step

      schedule EHFinder_ReParametrizeRK2_2 in RK2_ReParametrize after EHFinder_ApplySymF
      {
        LANG: Fortran
      } "Euler scheme"

      # Then synchronize the level set and apply symmetry boundary conditions.
     
      schedule  EHFinder_ApplySymF in RK2_ReParametrize after EHFinder_ReParametrizeRK2_2
      {
        LANG: Fortran
        SYNC: level_set
      } "Apply symmetry boundaries and sync"
    }
  }

  if (CCTK_Equals(re_param_method,"approx") || CCTK_Equals(re_param_method,"mixed"))
  {

    # Schedule a routine to update the points closest to the zero-level surface.

    schedule EHFinder_ReParametrize5 in EHFinder_ReParametrize after EHFinder_ReParametrizeControl
    {
      LANG: Fortran
    } "Update the points closest to the surface"

   schedule EHFinder_ApplySymFRep in EHFinder_ReParametrize after EHFinder_ReParametrize5
    {
      LANG: Fortran
      SYNC: level_set
      SYNC: rep_mask
    } "Apply symmetry boundaries and sync"

    # Set up the schedule group for approx re-parametrization using 
    # re_param_control_approx to control the exit from the while loop.

    schedule GROUP Approx_ReParametrize in EHFinder_ReParametrize AFTER EHFinder_ReParametrizeControl WHILE ehfinder::re_param_control_approx
    {
    } "Schedule group for Approximate re-parametrization"

    schedule EHFinder_ReParametrize6 in Approx_ReParametrize                   
    {
      LANG: Fortran
    } "Update cells with neighbours that have already been updated"

    schedule EHFinder_ReParametrize7 in Approx_ReParametrize after ReParametrize6
    {
      LANG: Fortran
    } "Update rep_mask"

    schedule EHFinder_ApplySymFRep in Approx_ReParametrize after EHFinder_ReParametrize7
    {
      LANG: Fortran
      SYNC: level_set
      SYNC: rep_mask
    } "Apply symmetry boundaries and sync"
  }


  # Schedule modifications of the mask in group EHFinder_SetMask

  schedule GROUP EHFinder_SetMask at CCTK_POSTSTEP after EHFinder_ReParametrize
  {
  } "Set the mask"

  # First schedule the routine that adds or removes cells from the mask

  schedule EHFinder_SetMask1 in EHFinder_SetMask
  {
    LANG: Fortran
    SYNC: level_set
    SYNC: eh_mask_all
  } "Start modifying the mask"

  # Then apply the symmetry boundary conditions.

  schedule  EHFinder_ApplySymAll in EHFinder_SetMask after EHFinder_SetMask1
  {
    LANG: Fortran
  } "Apply symmetry boundaries"
 
  # Finally locate the mask boundary and add values to distinguish different
  # directions.

  schedule EHFinder_SetMask2 in EHFinder_SetMask after EHFinder_ApplySymAll
  {
    LANG: Fortran
    SYNC: eh_mask_all
  } "Finish modifying the mask"

  schedule  EHFinder_ApplySymMask in EHFinder_SetMask after EHFinder_SetMask2
  {
    LANG: Fortran
  } "Apply symmetry boundaries"
 

}



#schedule  EHFinder_ApplySym at CCTK_POSTINITIAL after EHFinder_MaskInit
#{
#  LANG: Fortran
#  SYNC: level_set
#} "apply symmetry boundaries"
#
#schedule GROUP EHFinder_ReParamInit at CCTK_POSTINITIAL after EHFinder_MaskInit
#{
#  LANG: Fortran
#} "Initial re-parametrization and setting of the mask"
#
#if (CCTK_Equals(re_param_method,"approx"))
#{
#  schedule GROUP Init_ReParametrize in EHFinder_ReParamInit
#  {
#    LANG: Fortran
#    STORAGE: rep_mask
#  } "Approximation re-parametrization"
#
#  schedule EHFinder_ReParametrize5 in Init_ReParametrize
#  {
#    LANG: Fortran
#    SYNC: level_set
#    SYNC: rep_mask
#  } "First step in approximation re-parametrization"
#
# schedule EHFinder_ReParametrize6 in Init_ReParametrize AFTER EHFinder_ReParametrize5 WHILE ehfinder::re_param_control
#  {
#    LANG: Fortran
#    SYNC: level_set
#    SYNC: rep_mask
#  } "Second step in approximation re-parametrization"
#}
#
#schedule EHFinder_SetMask in EHFinder_ReParamInit after EHFinder_ReParametrize6
#{
#  LANG: Fortran
#} "Set the mask"
#
#if (CCTK_Equals(mode,"normal"))
#{
#  schedule EHFinder_Sources in MoL_CalcRHS
#  {
#    LANG: Fortran
#  } "Calculate the source terms"
#}
#
#if (CCTK_Equals(mode,"test_reparam"))
#{
#  schedule EHFinder_Sources3 in MoL_CalcRHS
#  {
#    LANG: Fortran
#  } "Calculate the source terms for reparam test"
#}
#
#if (!CCTK_Equals(mode,"test_reparam"))
#{
#  schedule GROUP EHFinder_ReParametrize at CCTK_POSTSTEP
#  {
#    LANG: Fortran
#  } "Re-parametrize the level set function"
#
#  if (CCTK_Equals(re_param_method,"pde"))
#  {
#    schedule EHFinder_ReParametrize1 in EHFinder_ReParametrize
#    {
#      LANG: Fortran
#    } "Initializes the re-parametrization control"
#
#    if (CCTK_Equals(re_param_int_method,"euler"))
#    {
#      schedule GROUP Euler_ReParametrize in EHFinder_ReParametrize AFTER EHFinder_ReParametrize1 WHILE ehfinder::re_param_control
#      {
#      } "Schedule group for Euler re-parametrization"
#
#      schedule EHFinder_ReParametrize4 in Euler_ReParametrize 
#      {
#        LANG: Fortran
#        SYNC: level_set
#      } "Euler scheme"
#
#      schedule  EHFinder_ApplySym in Euler_ReParametrize after EHFinder_ReParametrize4
#      {
#        LANG: Fortran
#        SYNC: level_set
#      } "apply symmetry boundaries"
#    }
#
#    if (CCTK_Equals(re_param_int_method,"rk2"))
#    {
#      schedule GROUP RK2_ReParametrize in EHFinder_ReParametrize AFTER EHFinder_ReParametrize1 WHILE ehfinder::re_param_control
#      {
#        LANG: Fortran
#      } "rk2 evolution for re-parametrization"
#
#      schedule EHFinder_ReParametrize2 in RK2_ReParametrize
#      {
#        LANG: Fortran
#        SYNC: ftmp
#      } "First step of the RK2 scheme"
#
#      schedule EHFinder_ReParametrize3 in RK2_ReParametrize
#      {
#        LANG: Fortran
#        SYNC: level_set
#      } "Second step of the RK2 scheme"
#    }
#  }
#
#  if (CCTK_Equals(re_param_method,"approx"))
#  {
#    schedule GROUP Approx_ReParametrize in EHFinder_ReParametrize
#    {
#      LANG: Fortran
#    } "Approximation re-parametrization"
#
#    schedule EHFinder_ReParametrize5 in Approx_ReParametrize
#    {
#      LANG: Fortran
#      SYNC: level_set
#      SYNC: dlevel_set
#      SYNC: rep_mask
#    } "First step in approximation re-parametrization"
#
#    schedule EHFinder_ApplySym in Approx_ReParametrize AFTER EHFinder_ReParametrize5
#    {
#      LANG: Fortran
#      SYNC: level_set
#      SYNC: rep_mask
#    } "Apply symmetry boundaries"
#
#    schedule GROUP EHFinder_Loop in Approx_ReParametrize AFTER EHFinder_ApplySym WHILE ehfinder::re_param_control
#    {
#      LANG: Fortran
#      SYNC: eh_mask_all
#    } "Loop for second step in approximation re-parametrization"
#
#    schedule EHFinder_ReParametrize6 in EHFinder_Loop
#    { 
#      LANG: Fortran
#    } "Second step in approximation re-parametrization"
#
#    schedule EHFinder_ReParametrize7 in EHFinder_Loop AFTER  EHFinder_ReParametrize6
#    { 
#      LANG: Fortran
#    } "Update the re-parametrization mask"
#
#    schedule EHFinder_ApplySym in EHFinder_Loop AFTER EHFinder_ReParametrize7
#    {
#      LANG: Fortran
#      SYNC: level_set
#      SYNC: rep_mask
#    } "Apply symmetry boundaries"
#
#    schedule EHFinder_SetMask in EHFinder_ReParametrize after Approx_ReParametrize
#    {
#      LANG: Fortran
#      SYNC: level_set
#    } "Set the mask"
#
#    schedule  EHFinder_ApplySym in EHFinder_ReParametrize after EHFinder_SetMask
#    {
#      LANG: Fortran
#      SYNC: level_set
#    } "apply symmetry boundaries"
#   
#  }
#}