[Carpet] when does Carpet call scheduled routines?

Erik Schnetter schnetter at cct.lsu.edu
Mon May 1 01:50:01 CEST 2006


On Apr 30, 2006, at 09:20:34, Jonathan Thornburg wrote:

> Hi, Erik,
>
> I'm confused about when Carpet scheduled routines which are scheduled
> in other than local mode.  I had thought that within a single schedule
> bin, Carpet's basic algorithm was this:

No, this is not the algorithm.  The basic algorithm in Carpet is the  
Berger-Oliger time evolution scheme, which recursively evolves the  
coarse levels before taking multiple steps on the finer levels.   
There is a figure in CQG 21 1465 (gr-qc 0310042) which explains this  
graphically.  There is also a latex document Carpet/Carpet/doc/ 
schedule.tex which details which schedule bins are executed in what  
order in that recursive scheme.  Note the difference between initial  
data and the time evolution loop.

This basic algorithm is exactly what happens to routines scheduled in  
level mode.  Routines in singlemap mode and local mode are wrapped in  
additional loops, in the same way as you assumed.  That is,

loop over all models
    walk over all levels using the Berger-Oliger scheme
       foreach scheduled routine S encountered as we walk the  
schedule tree
          select case (S.schedule_options)
          case (LEVEL)
             call S on model M, level L, in LEVEL mode
          case (SINGLEMAP)
             foreach patch P in model M, level L
                call S on model M, level L, patch P, in SINGLEMAP mode
          case (LOCAL)
             foreach patch P in model M, level L
                foreach component C in model M, level L, patch P
                   call S on model M, level L, patch P, component C  
in LOCAL mode

This was the easy part.  Level mode is the "natural" mode for the  
Berger-Oliger scheme, because this scheme evolves refinement levels  
recursively, i.e., it uses refinement levels as the unit over which  
it recurses.

Global mode and meta mode work differently.  Routines scheduled in  
global mode and meta mode should be called less often than the  
recursive scheme dictates.  There are global "flags" which indicate  
e.g. whether "this is the first level which is encountered on this  
iteration", aka "do-global-mode".  Global mode and meta mode routines  
are executed only when their corresponding flags are true.  Thus the  
complete algorithm is

do-meta-mode = true
loop over all models
    do-global-mode = true
    walk over all levels using the Berger-Oliger scheme
       foreach scheduled routine S encountered as we walk the  
schedule tree
          select case (S.schedule_options)
          case (META)
             if (do-meta-mode)
                call S in META mode
          case (GLOBAL)
             if (do-global-mode)
                call S on model M in GLOBAL mode
          case (LEVEL)
             call S on model M, level L, in LEVEL mode
          case (SINGLEMAP)
             foreach patch P in model M, level L
                call S on model M, level L, patch P, in SINGLEMAP mode
          case (LOCAL)
             foreach patch P in model M, level L
                foreach component C in model M, level L, patch P
                   call S on model M, level L, patch P, component C  
in LOCAL mode
       do-global-mode = false
    do-meta-mode = false



This does not yet take the LOOP-* modes into account.  They are  
straightforward; I don't give the full algorithm because it would  
take too much space and not be enlightening.  You can generate the  
full algorithm according to:

If there is a LOOP-Y mode in addition to an X mode, then replace

    call S in X mode

by

    foreach ...
       foreach ...
          call S in Y mode

with the appropriate number and kind of foreach statements to get  
from X mode to Y mode.



The actual algorithm is slightly more complicated since the flags do- 
X-mode have to be defined slightly differently depending on whether  
the schedule bin is executed before or after the recursion.  There  
are also bins that have to do with regridding and which are also  
special, since they are not executed on all levels.

Also, there are no "models" in Carpet, these are "convergence  
levels", in case you want to run the same simulation with different  
resolutions at the same time.  (Actually, models do exist, but they  
are completely unrelated to this.)

-erik

-- 
Erik Schnetter <schnetter at cct.lsu.edu>

My email is as private as my paper mail.  I therefore support encrypting
and signing email messages.  Get my PGP key from www.keyserver.net.



-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
Url : /archives/developers/attachments/20060430/23ab9e27/attachment.pgp 


More information about the developers mailing list