The Chombo compare code is designed to assist convergence studies of AMR
codes. In its simplest usage, the code takes two HDF5 plotfiles, one
single-level fine "exact" solution, and one coarser "computed" solution,
which may contain local refinement. The "exact" solution is averaged down
to the same resolution as the computed solution using 3rd-order averaging
(to ensure that second-order convergence may be accurately verified -- if a
user is expecting better than 2nd order convergence, the accuracy of the
averaging should be increased). If the computed solution is an AMR
solution, then the exact solution must be at least as fine as the finest
level of the AMR solution.  The computed solution is then subtracted from
the averaged exact solution to compute an estimate of the solution error in
the computed solution.  AMR-aware L1, L2, and Max norms of the error are
then computed and reported (AMR-aware norms only take into account values
on valid (uncovered by finer levels) regions of the solution on each AMR
level).  If desired, plotfiles of the error are written out.


COMPILATION:

The compare code is compiled in the same way as other Chombo executables:
in the ChomboCompare directory, gmake compare [DIM=<spacedim>,
DEBUG=<TRUE,FALSE>, etc] where the brackets contain optional compilation
flags.  The result of compilation is an executable

compare[DIM]d.<compilation-specific string>.ex


EXECUTION:

Execution is driven by an inputs file.  Usage is:

        compare<>.ex <inputsFile>

Sample inputs files provided with the code are "inputs.compare",
"inputs.compare.timeDep", and "inputs.compare.sameSize", which compare a
single set of files, a series of files, and a single set of files which
have the same grids.


INPUT FILE FORMAT:

The inputs file format uses the same inputs file format as other Chombo
codes.  In this case, inputs to the compare code require the prefix
"compare." to be recognized by the inputs file parser.


REQUIRED INPUTS:
Required inputs for the compare code are as follows:

compare.exactRoot = <filename> -- filename root for "exact" solution
  (single-level fine solution). 

compare.computedRoot = <filename> -- filename root for "computed" solution

If "isTimeDep" is 0 (the default) then the filename roots are taken to be
the filenames to be used, without modification. In time-dependent mode, the
filename roots are used as roots to construct the relevant filenames, as
described below in the section on time-dependent mode.


OPTIONAL ARGUMENTS:
Also, there are a number of optional arguments, including:

compare.errorVars = <list of plotfile components> -- names of variables
    for which to compute the error.  If the argument isn't present
    then the intersection of the variables in the two files being
    compared is used for "compare.errorVars".  It is an error for the
    argument to be present but have no component names.

compare.doPlots = <integer> -- if this is 1, then the compare code
    will write out plotfiles with the computed error.  If the doPlots
    option is suggested, then an "errorRoot" input must also be
    provided.

compare.errorRoot = <filename> -- if doPlots is 1, this is the filename
    for the plotfile into which the error is written (which may then be
    viewed with ChomboVis)

compare.no_average_var <list of variable names> -- There are also some
    variable that users may want to treat specially by just computing
    the (AMR-aware) norms of the computed solution, without comparing
    against averaged "exact" values (the implicit assumption is that
    the "Exact" values of these is zero).  These variables may be
    specified using the "no_average_var" inputs variable.

compare.sameSize = <integer> -- if sameSize is 1, then the mode of
    operation is altered somewhat. Instead  of one single-level fine
    "exact" solution and one coarser (possibly AMR) computed
    solution, the sameSize mode takes two (possibly AMR) plotfiles
    and simply subtracts one from the other and reports L1, L2, and
    MaxNorm of the difference (writing out plotfiles of the
    difference if doPlots is selected).  The two plotfiles need not
    have the same grid hierarchies (DisjointBoxLayouts on each
    level); if they are different, the error is reported using the
    grid hierarchy of the "computed" solution.  The sameSize option
    is useful when evaluating the effects of code and algorithm
    changes on the same problem.  If this option is selected, the
    no_average_var list has no meaning.

compare.doGhostCells = <integer> -- Only has an effect if (sameSize == 1).
    In most cases, all we care about is the difference in the valid
    cells; the default case (doGhostCells == false) uses an approach
    which ensures that the errors in valid cells are correct,
    regardless of whether the exact and computed solutions have the
    same grids.  However, if doGhostCells is 1, then errors are
    computed on a grid-by-grid basis.  This treats the ghost cells
    properly (to expose differences in ghost cell values between the
    two solutions), but requires that both exact and computed
    solutions have the same grid boxes to work correctly.

compare.computeRelativeError = <1,0> -- if true (1), compute relative
    error (exact - computed)/exact instead of absolute errors.
    Default is absolute error.

compare.bogus_value = <Real> -- value to which error is initialized
    before error computation.  Setting this to a large number can
    make it easier to see where the exact solution does not overlie
    the computed solution.  Default value is 0.

compare.removeMean = <1,0> -- if true (1), compute the mean of the
    differences, remove it before the norms are computed, and report
    the mean with the norms.  Default is false (0).

TIME-DEPENDENT MODE:

The compare code can also be used to evaluate a series of plotfiles in a
time-dependent sense.  L1, L2, and MaxNorms are generated for each
comparable time step, as well as error plotfiles if the "doPlots"
input is set to 1.

compare.isTimeDep = <integer> -- if isTimeDep is 1, then the compare code
    will look for and compare a (time) series of HDF5 plotfiles.

compare.numCrseStart = <integer> -- the time step of the first "computed"
    solution.  See below for an example.

compare.numCrseFinish = <integer> -- the time step of the last "computed"
    solution.  See below for an example.

compare.crseStep = <integer> -- the number of time steps between successive 
    "computed" solutions.  See below for an example.

compare.mult = <integer> -- The number of "exact" timesteps which take
    place during a "computed" solution timestep -- (so, for example,
    if the mult variable is set to 4, then the code will assume that
    there are 4 "exact" solution timesteps for every "computed"
    solution timestep.  In this case, computed solutions at step
    0,1,2,3 correspond to exact solutions at steps 0,4,8,12.  See
    below for a complete example.

compare.intFieldWidth = <integer> the width of the integer plotfile
    number in the plotfile names.  This is used along with the
    filename roots to construct the sequence of filenames used for
    the error computation.  The default value for intFieldWidth is 4.

Currently, in the time-dependent mode plotfile names are constructed
starting with the "roots" given above.  Then the "time step" is appended to
this as a <intFieldWidth> digit field with leading zeros.  Finally
"2d.hdf5" or "3d.hdf5" is appended (depending on the dimension of the code
being run).

For example, if the "computedRoot" is "approxTimeSoln.", "isTimeDep" is 1,
"numCrseStart" is 0, "numCrseFinish" is 10, "crseStep" is 2,
"intFieldWidth" is 4, and the compare code being run is 2d then the
computed solution filenames generated and used for the series are:

        approxTimeSoln.0000.2d.hdf5
        approxTimeSoln.0002.2d.hdf5
        approxTimeSoln.0004.2d.hdf5
        approxTimeSoln.0006.2d.hdf5
        approxTimeSoln.0008.2d.hdf5
        approxTimeSoln.0010.2d.hdf5

Further if "exactRoot" is "exactTimeSoln." and "mult" is 16, then the above
files are compared to the following files (first to first, second to
second, etc.):

        exactTimeSoln.0000.2d.hdf5
        exactTimeSoln.0032.2d.hdf5
        exactTimeSoln.0064.2d.hdf5
        exactTimeSoln.0096.2d.hdf5
        exactTimeSoln.0128.2d.hdf5
        exactTimeSoln.0160.2d.hdf5
