README.html clawcode2html   
 Source file:   README.txt
 Directory:   /Users/rjl/rjlsvn/papers/pathconwb10/code
 Converted:   Mon Jan 18 2010 at 10:38:58
 This documentation file will not reflect any later changes in the source file.

$\phantom{******** If you see this on the webpage then the browser could not locate *********}$
$\phantom{******** the jsMath file load.js *********}$

$\newcommand{\vector}[1]{\left[\begin{array}{c} #1 \end{array}\right]}$ $\newenvironment{matrix}{\left[\begin{array}{cccccccccc}} {\end{array}\right]}$ $\newcommand{\A}{{\cal A}}$ $\newcommand{\W}{{\cal W}}$

 

CLAWPACK Code to accompany this paper:

R.J. LeVeque, A Well-Balanced Path-Integral f-wave Method for 
Hyperbolic Problems with Source Terms, 
link to paper  
Submitted to a Special Issue of the Journal of Scientific Computing 
for the proceedings of a workshop on Numerical approximations of hyperbolic 
systems with source terms and applications, Castro-Urdiales, Spain, 2009
NumHyp2009  

Advection equation with a source term, $q_t + uq_x= -q\sigma_x(x)$.

Test 4 different methods for handling the source term, depending on the parameter mthsrc defined in setrun.py [.html].

  • mthsrc = 1: Fractional step method,
  • mthsrc = 2: f-wave splitting with source based on average of $Q$ on either side of discontinuity (times jump in $\sigma$).
  • mthsrc = 3: Approach suggested in paper, averaging over two paths.
  • mthsrc = 4: Approach suggested in paper, using path corresponding to true Riemann solution.

See instructions at the bottom of this page for how to run the code and make figures.

Plots of results

After running this code and creating plots via "make .plots", you should be able to view the plots in _plots/_PlotIndex.html .

If you want to change parameters and run all 4 methods automatically to compare results, you can use run_tests.py [.html]. After running that code via "python run_tests.py", you should be able to view all the plots at these links:

Fortran files

Makefile [.html]
Determines which version of fortran files are used when compiling the code with make and specifies where output and plots should be directed. Type "make .help" at the Unix prompt for options.

setprob.f [.html]
A routine by this name is called by the library routine clawpack/1d/lib/claw1ez.f [.html] and is generally used to set any values needed for the specific problem being solved.

rp1.f [.html]
This is the Riemann solver, which takes the $q$ values stored in the arrays ql and qr and returns the waves in the array wave and speeds in the array s that result in solving the Riemann problem at each cell interface, and the fluctuations amdq and apdq. See $CLAW/doc/rp1.html for more information about 1d Riemann solvers.

fcns.f [.html]
Othe functions needed for the initial conditions and equilibrium solution. The functions are also needed in the plotting routines, you should do "make .f2py" to convert to a Python module.

qinit.f [.html]
This subroutine sets the initial data $q(x,0)$ at time $t=0$.

src1.f [.html]
Applies source term if mthsrc==1 (set in setprob.f [.html]). Otherwise source terms are incorporated into the Riemann solver.

Python files

setrun.py [.html]
This file contains a function that specifies what run-time parameters will be used.

setplot.py [.html]
This file contains a function that specifies what plots will be done and sets various plotting parameters.

run_tests.py [.html]
Run tests for all four approaches.

make_figs_for_paper.py [.html]
Run tests and make figures used in paper.

setrun_for_paper.py [.html]
Used by make_figs_for_paper.py [.html] to set parameters as in paper.

setplot_for_paper.py [.html]
Used by make_figs_for_paper.py [.html] to set parameters as in paper.

Data files

These files are generated automatically by "make .setdata" from the data in setrun.py [.html].

claw.data [.html]
Clawpack runtime parameters. The values in this file are read by the library routine clawpack/1d/lib/claw1ez.f [.html]. Each line contains one or more values to be read in, followed by comments that are ignored by the Fortran code but may be used by Pythons scripts.

setprob.data [.html]
This file is read in by setprob.f [.html].

Library routines

In addition to the Fortran routines in this library, several library routines from $CLAW/clawpack/1d/lib are used. See the Makefile [.html] to determine which ones are used.

Instructions

First do:

    $ f2py -c fcns.f -m fcns
to create some Python modules needed for plotting to make sure functions are consistent with what is specified in fcns.f [.html]. Note that this requires f2py.

To run one particular test case, modify setrun.py [.html] as desired and then:

    $ make .plots

To run all four methods on the same example:

    $ python run_tests.py

To run all examples and create figures used in the paper:

    $ python make_figs_for_paper.py
    $ pdflatex show_figs_for_paper   # to view resulting plots

This uses make_figs_for_paper.py [.html].

The figures that appear in the paper were produced by make_figs_for_paper.py [.html] using svn revision 345 of Clawpack 4.0 available via:

svn checkout http://kingkong.amath.washington.edu/svn/claw4/trunk@344 claw4

See www.clawpack.org/doc for installation instructions and documentation on running and plotting options.