begin_html [use: doc/doc.css] [use: jsMath]

Clawpack Sample Code

Example [book/chap3/acousimple] to accompany Figure 3.1 of the book
   [www.clawpack.org/book.html Finite Volume Methods for Hyperbolic Problems] by R. J. LeVeque. Converted to [www.clawpack.org Clawpack 4.4] form by RJL in 2009.

Description:

1d acoustics in a constant medium. \[ q_t + A q_x = 0 \] where \[ q(x,t) = \vector{ p(x,t)\\ u(x,t)} \] and the coefficient matrix is \[ A = \begin{matrix} 0 & K\\ 1/\rho & 0 \end{matrix}. \]

Plots of results

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

Fortran files

[code: Makefile]
Determines which version of fortran files are used when compiling the code with make. Also provides options for running the code and plotting results. See the documentation at [claw: doc/?]

[code: setprob.f95]
A routine by this name is called by the library routine [clawcode: clawpack/1d/lib/main.f95] and is generally used to set any values needed for the specific problem being solved. In this example, values specifying the material and the intitial conditions are read from the file [code: setprob.data].

[code: rp1.f]
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.

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

Python files

[code: setrun.py]
This file contains a function that specifies the run-time parameters to be used. "python setrun.py" creates data files *.data needed by the Fortran codes.

Some parameters that you might want to modify are described in the [http://www.clawpack.org/users documentation].

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

Data files

Note: The files *.data are generated when [code: setrun.py] is executed.

[code: claw.data]
This file contains a number of parameter values that are used by CLAWPACK. The values in this file are read by the library routine [clawcode: clawpack/1d/lib/main.f].

[code: setprob.data]
This file contains the advection velocity $u$ and various other parameters used in setting the initial conditions. Values in this file are read in by the subroutine [code: setprob.f95].

Library routines

In addition to the Fortran routines in this library, several library routines from [claw:clawpack/1d/lib] are used. See the [code: Makefile] to determine which ones are used. end_html