Run example D-Claw simulations¶
In order to provide examples of using digger.analyze
and digger.compare
, we need some D-Claw output. This section describes how to set up and run two example simulations used to describe typical usage.
As an alternative to running the example simulations, precomputed output is provided within the digger/data
directory. The file associated with each example is named <example-name>_output.zip
. For example, the file associated with the example digger/examples/post-run/barry_arm
is in digger/data/barry_arm_output.zip
. Place the required zip file into the experiment directory and unzip it before running any example code.
Install D-Claw¶
Installing D-Claw requires getting the source code for Clawpack and D-Claw, having a fortran compiler, and setting environment variables. To run the examples, you will also need to install digger.
D-Claw will not work on Windows. It should work on Mac, Linux, and WSL.
Clone repositories¶
First, clone the source code. You likely want to do this outside of the digger directory and in a place you store source code.
git clone https://github.com/clawpack/clawpack.git
cd clawpack
git submodule init
git submodule update
source pull_all.sh
git clone https://github.com/geoflows/dclaw.git
Set environment variables¶
Running D-Claw, or any Clawpack application requires that the following two environment variables be set.
CLAW=/path/to/top/level/clawpack/directory
PYTHONPATH=/path/to/top/level/clawpack/directory
If you typically have other elements of your python path, the CLAW
variable may be appended.
Note
These environment variables must be set in every terminal window you use D-Claw from.
Get a fortran compiler that works on your machine¶
You need a fortran compiler that works on your machine. On Mac OSX, we recommend using Homebrew.
brew install gcc
On WSL this may be accomplished using apt-get or similar package management tools.
apt-get gcc
Create an environment and install digger¶
The general installation instructions for digger
are located here. Here we briefly summarize one approach that will work for both digger
and D-Claw.
First, create a python 3.11 environment. We have found this version to be compatible with all other dependencies. You may find other python versions also work. We also install ffpmeg here rather than with pip because we have found that the conda-forge distribution works better than those distributed by pip. ffmpeg is used by D-Claw to make animations.
conda create -n myenv -c conda-forge python=3.11 ffmpeg
cd \path\to\digger\directory
pip install -e .
Compile D-Claw¶
Navigate to one of the digger example directories (digger/examples/post-run/<example-name>
) and compile D-Claw by executing the following:
make new
To see all of the options defined in the D-Claw makefile execute:
make help
Run the simulation¶
Assuming that compilation has executed successfully, you should have a file called xgeoclaw
in the example directory. To run the example, you will run five commands.
make input
The first command executes a file setinput.py
. This file contains digger commands that generate D-Claw format input files generated using digger.make
functions.
make input
make .data
The second command uses the setrun.py
file to generate required D-Claw input files that end in ‘.data’. This file is a standard Clawpack input file and more information about its contents may be found here.
This step includes checking that any topography or material thickness files needed to run the simulation exist.
make .data
make .output
The third command uses the .data
files and conducts the D-Claw simulation, generating output (located in the _output
directory).
make .output
make .plots
The fourth command uses the setplot.py
file to generate plots based on D-Claw output. Similar to the setrun.py
file, the setplot.py
file is a standard Clawpack file. It specifies how to plot using the visclaw tools.
make .plots
This command will make a large number of plots in the _plots
directory and also generate some *mp4 animations.
make postprocess
The final command executes the file setpostprocess.py
and conducts postprocessing analysis with digger.analyze
and digger.compare
functions.
make postprocess
Description of two example simulations¶
Two examples are provided.
Barry Arm¶
The first example is from Prince William Sound, Alaska, and simulates the Barry Arm landslide. It is similar to simulations presented in Barnhart et al. (2021).
This example is used to highlight digger.analyze
functions.
Mt. Tahn¶
The second example is for a synthetic landscape. It has topography that slopes down from left to right based on a hyperbolic tangent function. A 1-m deep slab of debris-flow material is placed between X=100 and X=300, and Y=200, and Y=400.
This example is used to highlight digger.compare
functions.
References
Barnhart, K.R., Jones, R.P., George, D.L., Coe, J.A., and Staley, D.M., 2021, Preliminary assessment of the wave generating potential from landslides at Barry Arm, Prince William Sound, Alaska: U.S. Geological Survey Open-File Report, no. 2021–1071, https://doi.org/10.3133/ofr20211071.