New Features: ============= I Checkpoint/Restart II UCD Information Generation III Handling External/Adaptive Boundary IV User Defined Flags I Checkpoint/Restart ==================== GrACE allows you checkpoint at any point in the application. The checkpoint file contains the current state of the Grid Hierarchy and associated GridFunction data. Each GridFunction has a checkpoint flag which determines whether it is checkpointed or not. By default all GridFunctions are checkpointed. The checkpoint file can be used to restart the computation in two ways: 1) Rollback to a previous state :- This is done by calling RecomposeHierarchy with the checkpoint file as an argument. This can be done at any point in the application program. This resets the state of the GridHierarchy to that in the checkpoint file and initializes the data accordingly. 2) Restart from stored state :- This is done by calling ComposeGridHierarchy with the checkpoint file. GrACE sets the initial state of the GridHierachy to that in the checkpoint file. For each GridFunction declared in the application, GrACE checks to see if any data information is available in the checkpoint file and if so reads it to initialize the GridFunction. If no information is present in the checkpoint file (i.e. if the GF was not checkpointed or did not exist in the previous calculation) it is the applications responsibility to initialize it. Note that GrACE indexes into the checkpoint file using the GridFunction name. This restart can be used to restart the computation on a different number of processors and also with a more/fewer GridFunctions. The syntax is as follows: -> Set the checkpoint flag for a GridFunction GF: SetCheckpointFlag(GF, flag); where flag = ACETrue or ACEFalse. The default value of flag is ACETrue. -> Checkpoint and GridHierarchy GH: Checkpoint(GridHierarchy& GH, const char* name); where name (e.g. name == "/home/parashar/checkpoints/step10") is the leading part of the checkpoint file name. GrACE will add extensions to this filename. The filename can be a path. (Note that GrACE will write one checkpoint file per processor). -> Rollback to a previous checkpoint: RecomposeHierarchy(GridHierarchy& GH, const char* name); where name is the checkpoint file name i.e. the name that was used in the call to Checkpoint. -> Restart computation from Checkpoint file: ComposeHierarchy(GridHierarchy& GH, const char* name); II UCD Information Generation ============================= GrACE can generate Unstructured Cell Data (UCD) information for the current GridHierarchy. To generate UCD information: a) Create a ACEUCD(DIM) object (where DIM = 1,2,or 3) ACEUCD(DIM) ucd(const int minlevel, const int maxlevel, GridHierarchy& GridHierarchy, const int Ident); where minlevel/maxlevel define the range of levels for which the UCD information is required. Ident == ACE_Main or ACE_Shadow. b) Extract UCD geometry information from the ACEUCD object ucd.GetUCDInfo(int& numnodes, double**& nodesx, int& numcells, int**& cells, const int coordtype); This will return: numnodes: number of unique nodes in the composite grid structure from minlevel to maxlevel. nodes[DIM][numnodes]: array of coordinates for each node. numcells: number of unique cells in the composite grid structure from minlevel to maxlevel. cells[numcells][nodes_per_cell]: array of uniques node numbers per cell. The number of nodes per cell depends on the type of cell and is fixed as 2 for 1D, 4 for 2D and 8 for 3D. The input parameter coordtype can be ACELocalCoords or ACEWorldCoords depending is GrACE internal coordinates or applications defiend world coordinates are required. c) Get associated data for each node from a GridFunction GF GetUCDData(GridFunction(DIM) &GF, const ACEUCD(DIM)& ucd, const int t, Type*& ucddata, const int ucdserver) where: ucd: the ucd object instantiated above t: time at which ucd data is required. ucddata: output array of size numnodes that contains the GF value at each node. ucdserver: Number of the compute processor on this this information is to be collected. III Handling External/Adaptive Boundary ======================================= External and Adaptive boundaries are updated in dagh my making a call to BoundaryUpdate(GridFunction(DIM) &GF, const int t, const int l, const int ident) BoundaryUpdate(GridFunction(DIM) &GF, const int t, const int l, const int mgl, const int ident) where t = time, l = level, ident = ACE_Main ro ACE_Shadow mgl = multigrid level How the 2 boundaries are handled is defined below: A) Adaptive Boundaries: The handling of adaptive boundaries is controlled by 2 parameters: an adaptive boundary update flag which defines whether the adaptive boundary will be updated or not; and an adaptive boundary type which defines the type of the adaptive boundary. These can be defined as follows: ** Update Flag: SetAdaptBndryUpdateFlag(GridFunction(DIM)& GF, const int flag) where flag is ACETrue or ACEFalse. Default value is ACETrue. ** Adaptive boundary type: SetAdaptBoundaryType(GridFunction(DIM)& GF, const int adaptbndry_type) adaptbndry_type is one of: ACENoAdaptBoundary : No adaptive boundary - do nothing ACEAdaptBoundaryInterp : Use space-time interpolation to update the adaptive boundaries. (Space prolongation uses the user defined prolong function that has to be defined. ACEAdaptBoundaryUserDef : Call a user function top update the adaptive boundary. ACEAdaptBoundaryBoth : First do a space-time interpolation and and then call the user defined function. The user defined adaptive boundary update function is set using the following function: SetAdaptiveBndryUpdateFunction(GridFunction(DIM)& GF, void* abuf) The adaptive boundary update function is typedefed as follows: typedef void (*AdptBndryUpdateFunc) ( Type*, int*, int*, int*, Type*, int*, int*, int*, double*, Type*, int*, int*, int*, double*, int*, int*, int* Type*, const int *); The functions gets the following informations a) GF at the current time and level Type* data, int* lb, int* ub, int* shape b) GF on the parent grid at ta_parent Type* data, int* lb, int* ub, int* shape, double* weight c) GF on the parent grid at tp_parent Type* data, int* lb, int* ub, int* shape, double* 1.0-weight d) region to be updated int* lb, int* ub, int* shape e) other arguments Type* args, const int arg_cnt ta_parent, tp_parent and weight are defined as: * * * * * -> ta_parent o o o o o o o o o -> (t) current time and level * * * * * -> tp_parent weight = (t - tp_parent)/(ta_parent-tp_parent); B) External Boudaries: The handling of external boundaries is controlled by the following parameters: ** Update Flag: Defines whether the external boundary is updated or not: SetBndryUpdateFlag(GridFunction(DIM)& GF, const int f) where f = ACETrue or ACEFalse. The default value is ACETrue. ** Boundary Type: Defines how the boundary is updated: SetBoundaryType(GridFunction(DIM)& GFV, const int b) where b is one of: ACENoBoundary : No external boundary - do nothing. ACEBoundaryConst : Set to a constant value (see below) ACEBoundaryRegular : Same as above ACEBoundaryShift : Shift value from the inner zones to the boundaries. ACEBoundaryPeriodic : Periodic - not define at present ACEBoundaryUserDef : Call user defined function ** Boundary width: This defines the number of zones that make up the boundary. The default value is that set for the GridHierarchy using the call SetBoundaryWidth. SetBoundaryWidth(GridFunction(DIM)& GF, const int bw) ** Boundary value: This defines the constant value used to update the boundary is the boundary type is set to ACEBoundaryConst or ACEBoundaryRegular. SetBoundaryValue(GridFunction(3)& GF, const Type v) The default value for v is (Type)0. The user defined external boundary update function is set using the following function: SetBndryUpdateFunction(GridFunction(DIM)& GF, void* buf) The external boundary update function is typedefed as follows: typedef void (*BndryUpdateFunc) ( Type*, int*, int*, int*, int*, int*, int* Type*, const int *); The functions gets the following informations a) GF at the current time and level Type* data, int* lb, int* ub, int* shape b) region to be updated int* lb, int* ub, int* shape c) other arguments Type* args, const int arg_cnt IV User Defined Flags ===================== Each GrACE GridFunction has a set of (current 10) flags (type short) that can be set/queried by users. The access interface is: SetUserFlag(GridFunction(DIM)& GF, const int n, const short& f) This sets the nth flag to f. short GetUserFlag(GridFunction(DIM)& GF, const int n) This returns the value of the nth flag.