enzo Analysis Functions

This page describes design ideas for building analysis tools from the enzo source code.

Design Goals

  • Clean separation from the physics routines.
  • Extensive reuse of grid member functions.
  • Usable during runtime (simulation), or
  • compiled as a standalone executable.
  • Analysis output not necessarily linked to data output.
  • Fast and scalable, or give the user a lot of warning.
  • No modification of the "state" of the simulation.

Simulation Analysis Checkpoints

Currently, all analysis routines are called based on dtAnalysis. See EnzoAnalysisParameters, and look for dtAnalysis.

Scalability

Ideally, the additional function would not add significantly to the runtime or memory burden. When there's an obvious deficiency, perhaps in communications or I/O, some type of heads-up should be provided to the user.

Perhaps an interactive prompt that can wait for input until all of the SUs are gone?

!!!!! WARNING !!!!! You have enabled VolumeRendering every time step.
!!!!! WARNING !!!!! This may seriously slow down the simulation.
!!!!! WARNING !!!!! Do you wish to continue? 
!!!!! WARNING !!!!! [y/N] > 

Current Design

This work is an rewrite of work done before, using a library style API, rather than classes. The toolkit is still alive but has changed implementation with my knowledge of C++. Instead of a library type approach, I've gone to a base class to include all common functionality (read data, count grids, etc.), and subclasses for specific uses.

I did this when I switched over to the new repository, and had to rebuild the structure function stuff for Alexei. That has been a great first project, since it's fairly simple, but had to scale up to 4096 processors for Bigben. I've used it build the guidelines for future tools. Here's a break down:

Base Class

This is the class where all the common functionality gets dumped. All of the specific analysis tools inherit from this class.

Parameters

Each tool or subclass gets its parameters from a struct. All of the structs are defined in the header file, AnalysisParameters.h. Functions returning the default values for each struct are defined the corresponding source file, AnalysisParameters.C .

The purpose of using structs for parameters is to allow these tools to be using both inline and standalone. For each tool enabled, there is a pointer on the TopGridData struct. When this is NULL, the tool is off during simulation, otherwise, the tool is on, with the parameters specified by the struct pointed to. For standalone use, the "frontend" is just enough to read the data and capture the options from the user to built the struct.

The EnzoAnalysisParameters page has a summary of what is currently implemented.

Reference Implementation

The structure function tool is the reference implementation:

SFGenerator
Subclass for the structure function generator.
sfgen
Standalone frontend: reads parameters; loads data; does analysis.
ReadParameterFile.C
This version shows how the inline analysis parameters are set.
CheckForOutput.C
Analysis routines are called when dtAnalysis is tripped. DoAllAnalysis.C This is where pointers are checked to see what tools are "on", and the routines are called.

Compiling

Sadly, the standalone frontends require the source to compiled with a -DENZO_ANLYSIS. This is done to make reuse of the existing data reading routines. Just to be safe, I recompile everything when building the standalones tools instead of the simulation executable.

Unit Testing

The analysis code makes heavy use of unit testing. This allows things to be tested in isolation. This is all done using a brain-dead header file, enzo_unit_tests.h. An example of a set of tests can be seen in the grid functions needed for analysis, gridtests.C.

Here's the quick-n-dirty way to give the unit tests a go:

cable:~/Projects/Enzo/amr_mpi/src rpwagner$ make unit-tests-yes

   MACHINE: Rick's Laptop (Make.mach.rpwagner-cable)

   CONFIG_PRECISION:         64
   CONFIG_PARTICLES:         64
   CONFIG_INTEGERS:          32
   CONFIG_INITS:             64
   CONFIG_IO:                32
   CONFIG_USE_MPI:           yes
   CONFIG_HDF5_ENDIAN:       big
   CONFIG_SRB:               no
   CONFIG_MPICH:             yes
   CONFIG_OBJECT_MODE:       64
   CONFIG_TASKMAP:           no
   CONFIG_PACKED_AMR:        no
   CONFIG_ISO_GRAV:          no
   CONFIG_RAD_HYDRO:         no
   CONFIG_JBPERF:            no
   CONFIG_PAPI:              no
   CONFIG_UNIGRID_TRANSPOSE: yes
   CONFIG_OOC_BOUNDARY:      no
   CONFIG_PNG:               no
   CONFIG_UNIT_TESTS:        yes
   CONFIG_OPT:               warn

cable:~/Projects/Enzo/amr_mpi/src rpwagner$ make clean
cable:~/Projects/Enzo/amr_mpi/src rpwagner$ make tests
  .
  .
  .
cable:~/Projects/Enzo/amr_mpi/src rpwagner$ make mpi-tests