begin_html [use: jsMath] [use: doc/doc.css]
CLAWPACK Sample Code
2-d acoustics with variable coefficients.
Two materials with a single interface, specified in [code: fdisc.f]
(which is called from [code: cellave.f] to compute the fraction of
each grid cell lying in the left and right states).
Figure created by [code: makegridfig.py]
The sound speed and impedance are stored in the aux array, specified in
[code: setaux.f].
For cells cut by the interface, the arithmetic average of rho and harmonic
average of the bulk modulus are used to determine these parameters for this
cell.
Example [book/chap21/corner]
to accompany the book
[www.clawpack.org/book.html Finite Volume Methods for Hyperbolic Problems]
by R. J. LeVeque.
Converted to [www.clawpack.org Clawpack 4.5] form in 2011.
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 and specifies where output and
plots should be directed. Type "make .help" at the Unix prompt for options.
- [code: driver.f]
-
The driver routine allocates storage and then calls the main Clawpack
routine.
- [code: setprob.f]
-
A routine by this name is called by the library routine
[clawcode: clawpack/2d/lib/claw2ez.f]
and is generally used to set any values needed for the specific problem
being solved.
- [code: rpn2acv.f]
- Normal Riemann solver (normal to cell interface).
- [code: rpt2acv.f]
- Transverse Riemann solver.
- [code: qinit.f]
-
This subroutine sets the initial data at time $t=0$.
- [code: setaux.f]
-
Sets the aux arrays.
- [code: fdisc.f]
-
Determines the interface in material properties.
Python files
- [code: setrun.py]
- This file contains a function that
specifies what run-time parameters will be used.
Some parameters that you might want to modify are described in the
[www.clawpack.org/doc.html documentation].
- [code: setplot.py]
- This file contains a function that
specifies what plots will be done and
sets various plotting parameters.
Data files
Warning: These files are generally changed
when setting up a run, usually in [code: setrun.py].
- [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/2d/lib/claw2ez.f].
- [code: setprob.data]
- This file may contain various
parameters used in setting the initial conditions or otherwise setting up
the problem.
Library routines
In addition to the Fortran routines in this library, several library
routines from [claw:clawpack/2d/lib] are used. See the [code: Makefile]
to determine which ones are used.
end_html