4 Structure of a Multiblock Framework Program

A Multiblock framework program consists of several subroutines: init, driver,finalize, and external boundary condition subroutines.

init and finalize are called by the Multiblock framework only on the first processor - these routines typically do specialized I/O, startup and shutdown tasks.

A separate driver subroutine runs for each block, and does the main work of the program. Because there may be several blocks per processor, several driver routines may be executing as threads simultaniously.

The boundary condition subroutines are called by the framework after a request from driver.

     subroutine init
          read configuration data
     end subroutine

     subroutine bc1
          apply first type of boundary condition
     end subroutine bc1

     subroutine bc2
          apply second type of boundary condition
     end subroutine bc2

     subroutine driver
          allocate and initialize the grid
          register boundary condition subroutines bc1 and bc2
          time loop
               apply external boundary conditions
               apply internal boundary conditions
               perform serial internal computation
          end time loop
     end subroutine

     subroutine finalize
           write results
     end subroutine

February 12, 2012
MBlock Homepage
Charm Homepage