clawtestsubset.py.html clawcode2html   
 Source file:   clawtestsubset.py
 Directory:   /home/rjl/www/pubs/cise08/cise08levequeV2
 Converted:   Wed Jul 2 2008 at 13:40:44
 This documentation file will not reflect any later changes in the source file.

import clawtools
from clawtest import *

# special data structure for Clawpack parameters:
data = clawtools.ClawData()
data.tfinal = 0.75               # final time
data.nout = 1                    # output solution only at final time

# List parameters for tests to be performed:
grids = [1,3]                    # set of grids to test
limiters = [0,3]                 # set of limiters (mthlim values) to test
mxvals = array([30,60,120])      # mx values
myvals = array([30,60,120])      # my values
area = pi

table = {}  # dictionary of data and results for each test

for mthlim in limiters:
    data.mthlim = mthlim
    for igrid in grids:
        # Write the value igrid into data file setprob.data:
        data.igrid = igrid;
        data.write('setprob.data')

        # create a dictionary to hold the data and results for this test:
        table[(mthlim,igrid)] = {}

        this_table = table[(mthlim,igrid)]  # short name
        this_table['mxvals'] = mxvals       # grid resolutions to test
        this_table['myvals'] = myvals
        this_table['ave_cell_area'] = area / (mxvals*myvals)
        this_table['errors'] = empty(len(mxvals))  # filled with results below

        for itest in range(len(mxvals)):
            data.mx = mxvals[itest];    mx = data.mx   # short form
            data.my = myvals[itest];    my = data.my   # short form
            data.write('claw2ez.data')                 # writes data values

            # run Fortran code:
            clawtools.runclaw()

            # compute errors:
            errors = compute_errors(frame=data.nout)
            # approx 1-norm of error:
            errorsum = abs(errors).sum() 
            error1 = errorsum * this_table['ave_cell_area'][itest]
            this_table['errors'][itest] = error1

make_text_table(table, limiters, grids, fname='errortables.txt')
make_latex_table(table, limiters, grids, fname='errortables.tex')
make_error_plots(table, limiters, grids, fname='errors.png')