Path to the directory where the Clawpack output is that is to be
plotted.
-
-
-plotdir:str
+
+
+plotdir : str
Path to the directory where hardcopy files of plots are to be put.
-
-
-overwrite:bool
+
+
+overwrite : bool
Ok to overwrite old plotdir? Default is True
-
-
-afterframe:strorfunction
+
+
+afterframe : str or function
Function or string to be executed after producing all plots for each
frame. If a string, this string is executed using exec. If a
function, it should be defined to have a single argument
@@ -130,9 +127,9 @@
Clear all plot parameters. Useful as the first command in a setplot
function to make sure previous parameters are cleared if the file is
changed and the function is re-executed in an interactive session.
Return ClawPlotAxes object with the specified name.
If figname==None then search over all figures and return None if
it is not found or the name is not unique.
Return ClawPlotItem object with the specified name.
If axesname==None and/or figname==None
then search over all figures and/or axes and return None if
it is not found or the name is not unique.
Figure number, by default the next unused number will be used (starting
at 1001).
This is usually set as an argument to the new_plotfigure function
of a ClawPlotData object
-
-
-kwargs:dictionary
+
+
+kwargs : dictionary
A dictionary of keyword arguments for the figure command.
For example:
Special attributes for plot_type = ‘1d_from_2d_data’¶
+
+
+map_2d_to_1d : function
Example: In a 2d computation where the solution q[:,:,0] should be
radially symmetric about (x,y)=(0,0), the following will result in a
scatter plot of the cell values q[i,j,0] vs. the radius r(i,j):
@@ -293,62 +290,62 @@
Special attributes for plot_type = ‘1d_fill_between’current_data for a description of the current_data argument.
-
-
-
Special attributes for all 2d plots, plot_type = ‘2d…’¶
-
-
-celledges_show:bool
+
+
+
Special attributes for all 2d plots, plot_type = ‘2d…’¶
+
+
+celledges_show : bool
If True, draw the cell edges on the plot.
The attribute ‘amr_celledges_show’ should be used for AMR computations
to specify that cell edges should be shown on some levels and not
others. See AMR Attributes.
-
-
-patchedges_show:bool
+
+
+patchedges_show : bool
If True, draw the edges of patches, mostly useful in AMR computations.
In general you should specify pcolor_cmin and pcolor_cmax to
specify the range of q values over which the colormap applies. If they
are not specified they will be chosen automatically and may vary from
@@ -407,16 +404,16 @@
Many attributes listed above also have a second related attribute with the
same name pre-pended with amr_. If this attribute is set, it should be a
list whose elements are of the type specified by the original name, and the
@@ -445,28 +442,27 @@
Clawpack stands for “Conservation Laws Package” and was initially developed
for linear and nonlinear hyperbolic systems of conservation laws, with a
focus on implementing high-resolution Godunov type methods using limiters in
@@ -112,14 +109,14 @@
Navigation
and resulting plots.
See the Bibliography for some pointers to papers describing Clawpack and
the algorithms used in more detail.
A new approach to flagging cells for refinement was introduced in Clawpack
5.6.0 – using the solution to an adjoint problem to determine what cells in
the forward solution should be refined because these cells may have an impact
@@ -223,8 +219,8 @@
Navigation
simply inner products of the forward and adjoint solutions that are computed
and a cell is flagged for refinement in cells where the magnitude of the
inner project is greater than amrdata.flag2refine_tol.
-
-
in non-conservation form and is solved using the q-wave formulation in which
jumps in the the solution vector are split into eigenvectors, rather than
jumps in the flux. See the comments in the rpn2 solver for more details.
-
-
+
The basic adaptive refinment strategy used in AMRClaw Description and Detailed Contents is
to refine on logically rectangular patches. A single Level 1 grid covers
the entire domain (usually — if it is too large it may be split into
@@ -134,8 +131,8 @@
Navigation
originally written by Marsha Berger for gas dynamics, and merged in Clawpack
in the early days of Clawpack development by MJB and RJL. The algorithms
used in AMRClaw are described more fully in [BergerLeVeque98].
-
-
Consider a Level k > 1 grid for which we need ghost cells all around the
boundary at the start of each time step on this level. The same procedure
is used at other levels.
@@ -178,9 +175,9 @@
Navigation
the same refinement level at the opposite side of the domain to copy ghost
cell values from, and if so which grid and what index corresponds to the
desired location.
-
-
-
Every few time steps on the coarsest level it is generally necessary to
revise modify the regions of refinement at all levels, for example to follow
a propagating shock wave. This is done by
@@ -221,24 +218,23 @@
Navigation
interpolation is performed based on the Level k grids.
The AMRClaw version of Clawpack provides Adaptive Mesh Refinement (AMR)
capabilities in 2 and 3 space dimensions. (The two-dimensional code can
also be used for 1-dimensional problems, see AMRClaw for 1d problems.)
AMRClaw has been extended to support one-dimensional AMR directly.
The setrun.py file has the same form as for 2d AMRClaw, with the obvious
changes to eliminate the y-direction. See Sample setrun.py module for AMRClaw.
For some examples, see the 1d examples in $CLAW/amrclaw/examples/ and in
gallery_classic_amrclaw.
The two-dimensional code can also be used for 1-dimensional problems, by
setting num_cells[1] = 1 so there is only one cell in the y direction.
Also set refinement_ratios_y = [1,1,1, …] so that refinement is not done
@@ -106,11 +103,10 @@
In Fortran versions of Clawpack-5, the main documentation page
for an application is often found
in a file named README.rst, which can be written using the markup language
@@ -105,18 +102,17 @@
Navigation
which also converts code files into html files for easy browsing.
A list of code files in the directory is automatically generated by
convert_readme.py and links inserted in README.html.
The directory apps/notebooks contains a number of notebooks that illustrate
various aspects of Clawpack. Many of these are also visible in rendered html
form in the
Gallery of Notebooks.
Select the Clawpack image and then
click on the Launch button on this page to start launching an instance
based on this AMI. This means a virtual machine will be started for you,
@@ -140,9 +137,9 @@
Click Close on the next page to
go back to the Management Console. Click on Instances on the left menu
and you should see a list of instance you
@@ -168,9 +165,9 @@
If you run Clawpack on your instance then you will probably want to view the
results. There are at least three possible approaches (see Plotting with Visclaw
for general information about plotting in Clawpack):
Once you are done computing for the day, you will probably want to stop your
instance so you won’t be charged while it’s sitting idle. You can do this
by selecting the instance from the Management Console / Instances, and then
select Stop from the Instance Actions menu.
You can restart it later and it will be in the same state you left it in.
But note that it will probably have a new Public DNS!
If you add additional software and want to save a disk image of your
improved virtual machine (e.g. in order to launch additional images in the
future to run multiple jobs at once), simply click on Create Image (EBS
AMI) from the Instance Actions menu.
first checked and if there is no such file in this directory then
the environment variable B4RUN is checked, which can be set to
the full path of a b4run.py file that you wish to use globally, for example.
-
+
Below are linkes to the default b4step library routines for Classic and AMRClaw.
By default these do nothing. If you wish to specify aux arrays you will
need to copy one of these files to your application directory and modify it
@@ -89,8 +86,8 @@
Navigation
(Note: these links are for the version checked in to the master branch.
You can select a different branch or tag from the GitHub page.)
In GeoClaw, there is a library routine that sets aux(1,i,j) to the cell
average of the bathymetry, aux(2,i,j) to the ratio of the true cell area
to dx*dy (the capacity function), and aux(3,i,j) to the length ratio of
@@ -99,11 +96,10 @@
Boundary conditions are imposed each time step by filling ghost cells
adjacent to the edge of each grid patch. See Chapter 4 of [LeVeque-FVMHP]
for more details.
@@ -139,8 +136,8 @@
Navigation
best to put the modified version of bcN.f in the application directory and
modify the Makefile to point to the modified version.
See User-defined boundary conditions below.
-
-
When AMR is used, any interior patch edges (not at a domain boundary) are
filled automatically each time step, either by copying from adjacent
patches at the same level or by interpolating (in both space and
@@ -159,9 +156,9 @@
Navigation
within the domain (in which case ghost cell values are automatically set by
the AMR code and the user bcNamr routine should leave these values
alone.
-
-
-
For tsunami modeling or other geophysical flows over topography the
computational domain has artificial boundaries that are placed sufficiently
far from the region of interest that any flow or waves leaving the domain
@@ -175,9 +172,9 @@
Navigation
The library routine $CLAW/geoclaw/src/2d/shallow/bc2amr.f is modified from
the amrclaw version only by extrapolating the depth at the boundaries
into ghost cells.
-
-
-
Boundary conditions for clamshell grids on the sphere¶
+
+
+
Boundary conditions for clamshell grids on the sphere¶
In 2D AMRClaw and GeoClaw, an additional option is available for bc_lower
and bc_upper that is implemented in the library routines:
@@ -192,9 +189,9 @@
Navigation
See also [BergerCalhounHelzelLeVeque] for further examples.
If none of the boundary conditions described above is suitable at one or
more boundaries of the domain, then you will have to modify the library
routine to implement the desired boundary condition.
@@ -216,11 +213,10 @@
Navigation
cells extend outside the physical domain and which are filled automatically
from adjacent grid patches or by interpolation from coarser patches if they
are interior to the domain.
-
-
+
Papers describing the Clawpack software and algorithmsYear ={2002}}
-
-
-[BergerColella89]
-
M. J. Berger and P Colella. 1989. Local adaptive mesh refinement for
+
+
BergerColella89
+
M. J. Berger and P Colella. 1989. Local adaptive mesh refinement for
shock hydrodynamics. J. Comput. Phys. 82, 64–84.
-
-
-[BergerGeorgeLeVequeMandli11]
-
M. J. Berger, D. L. George, R. J. LeVeque and K. M. Mandli,
+
+
BergerGeorgeLeVequeMandli11
+
M. J. Berger, D. L. George, R. J. LeVeque and K. M. Mandli,
The GeoClaw software for depth-averaged flows with adaptive refinement,
Advances in Water Resources 34 (2011), pp. 1195-1206.
Papers describing the Clawpack software and algorithmsYear ={1998}}
-
-
-[BergerOliger84]
-
M. J. Berger and J. Oliger. 1984. Adaptive mesh refinement for
+
+
BergerOliger84
+
M. J. Berger and J. Oliger. 1984. Adaptive mesh refinement for
hyperbolic partial differential equations. J. Comput. Phys. 53,
484–512.
-
-
-[BergerRigoutsis91]
-
M. J. Berger and I. Rigoutsos. 1991. An Algorithm for Point Clustering
+
+
BergerRigoutsis91
+
M. J. Berger and I. Rigoutsos. 1991. An Algorithm for Point Clustering
and Grid Generation. IEEE Trans. Sys. Man & Cyber. 21, 1278–1286.
-
-
-[Davis2018]
-
B. N. Davis, 2018. Adjoint-Guided Adaptive Mesh Refinement for
+
+
Davis2018
+
B. N. Davis, 2018. Adjoint-Guided Adaptive Mesh Refinement for
Hyperbolic Systems of Equations,
PhD Thesis, University of Washington.
link
-
-
-[DavisLeVeque2016]
-
B. N. Davis and R. J. LeVeque. 2016. Adjoint Methods for Guiding
+
+
DavisLeVeque2016
+
B. N. Davis and R. J. LeVeque. 2016. Adjoint Methods for Guiding
Adaptive Mesh Refinement in Tsunami Modeling, 2016.
Pure Appl. Geophys. 173 (2016), pp. 4055-4074.
More info
-
-
-[DavisLeVeque2018]
-
B. N. Davis and R. J. LeVeque. 2018. Analysis and Performance Evaluation of
+
+
DavisLeVeque2018
+
B. N. Davis and R. J. LeVeque. 2018. Analysis and Performance Evaluation of
Adjoint-Guided Adaptive Mesh Refinement for Linear Hyperbolic PDEs
Using Clawpack, Preprint,
More info
Papers describing the Clawpack software and algorithmsYear ={2011}}
-
-
-[KetParLev13]
-
D. I. Ketcheson, Matteo Parsani, and R J LeVeque, 2013,
+
+
KetParLev13
+
D. I. Ketcheson, Matteo Parsani, and R J LeVeque, 2013,
High-order Wave Propagation Algorithms for Hyperbolic Systems,
SIAM Journal on Scientific Computing, 35(1):A351-A377 (2013)
@article{KetParLev13,
@@ -269,10 +251,9 @@
Papers describing the Clawpack software and algorithmsYear ={2013}}
-
-
-[KetchesonMandliEtAl]
-
David I. Ketcheson, Kyle T. Mandli, Aron J. Ahmadia, Amal Alghamdi, Manuel
+
+
KetchesonMandliEtAl
+
David I. Ketcheson, Kyle T. Mandli, Aron J. Ahmadia, Amal Alghamdi, Manuel
Quezada de Luna, Matteo Parsani, Matthew G. Knepley, and Matthew Emmett, 2012,
PyClaw: Accessible, Extensible, Scalable Tools for Wave Propagation Problems,
SIAM Journal on Scientific Computing, 34(4):C210-C231
@@ -289,10 +270,9 @@
Papers describing the Clawpack software and algorithmsYear ={2012}}
-
-
-[MandliEtAl2016]
-
Kyle T. Mandli, Aron J. Ahmadia, Marsha Berger, Donna Calhoun, David L.
+
+
MandliEtAl2016
+
Kyle T. Mandli, Aron J. Ahmadia, Marsha Berger, Donna Calhoun, David L.
George, Yiannis Hadjimichael, David I. Ketcheson, Grady I. Lemoine, Randall J. LeVeque,
Clawpack: building an open source ecosystem for solving hyperbolic PDEs
PeerJ Computer Science 2 (2016), e68:
Follow the links to see changes that have been made to the master branch of
each repository since the last release (v5.9.0) on August 26, 2022.
These changes should appear in the next release. If you need them now,
@@ -86,43 +83,43 @@
Navigation
To see documentation that has already been developed to accompany any new
features listed below, click on the “dev” branch of the documentation, in
the menu on the left hand side of this page.
For users who want to migrate code from 4.3 to 5.0, this may be a useful
intermediate step, followed by migration from 4.6 to 5.0 using the script
described at Converting from Clawpack 4.6 to 5.0.
@@ -106,10 +103,9 @@
Navigation
This migration script from 4.3 to 4.6 only works for classic
(single grid) codes in 1d and 2d, not AMRClaw codes.
The rest of this page concerns the Fortran components of Clawpack.
There is no complete list of changes since it has evolved to be very
different from the 4.x version of Clawpack in organization, but some of
@@ -191,11 +188,11 @@
Path to the directory where the Clawpack output is that is to be
plotted.
-
-
-plotdir:str
+
+
+plotdir : str
Path to the directory where hardcopy files of plots are to be put.
-
-
-overwrite:bool
+
+
+overwrite : bool
Ok to overwrite old plotdir? Default is True
-
-
-afterframe:strorfunction
+
+
+afterframe : str or function
Function or string to be executed after producing all plots for each
frame. If a string, this string is executed using exec. If a
function, it should be defined to have a single argument
@@ -130,9 +127,9 @@
Clear all plot parameters. Useful as the first command in a setplot
function to make sure previous parameters are cleared if the file is
changed and the function is re-executed in an interactive session.
Return ClawPlotAxes object with the specified name.
If figname==None then search over all figures and return None if
it is not found or the name is not unique.
Return ClawPlotItem object with the specified name.
If axesname==None and/or figname==None
then search over all figures and/or axes and return None if
it is not found or the name is not unique.
Figure number, by default the next unused number will be used (starting
at 1001).
This is usually set as an argument to the new_plotfigure function
of a ClawPlotData object
-
-
-kwargs:dictionary
+
+
+kwargs : dictionary
A dictionary of keyword arguments for the figure command.
For example:
Special attributes for plot_type = ‘1d_from_2d_data’¶
+
+
+map_2d_to_1d : function
Example: In a 2d computation where the solution q[:,:,0] should be
radially symmetric about (x,y)=(0,0), the following will result in a
scatter plot of the cell values q[i,j,0] vs. the radius r(i,j):
@@ -293,62 +290,62 @@
Special attributes for plot_type = ‘1d_fill_between’current_data for a description of the current_data argument.
-
-
-
Special attributes for all 2d plots, plot_type = ‘2d…’¶
-
-
-celledges_show:bool
+
+
+
Special attributes for all 2d plots, plot_type = ‘2d…’¶
+
+
+celledges_show : bool
If True, draw the cell edges on the plot.
The attribute ‘amr_celledges_show’ should be used for AMR computations
to specify that cell edges should be shown on some levels and not
others. See AMR Attributes.
-
-
-patchedges_show:bool
+
+
+patchedges_show : bool
If True, draw the edges of patches, mostly useful in AMR computations.
In general you should specify pcolor_cmin and pcolor_cmax to
specify the range of q values over which the colormap applies. If they
are not specified they will be chosen automatically and may vary from
@@ -407,16 +404,16 @@
Many attributes listed above also have a second related attribute with the
same name pre-pended with amr_. If this attribute is set, it should be a
list whose elements are of the type specified by the original name, and the
@@ -445,28 +442,27 @@
Clawpack stands for “Conservation Laws Package” and was initially developed
for linear and nonlinear hyperbolic systems of conservation laws, with a
focus on implementing high-resolution Godunov type methods using limiters in
@@ -112,14 +109,14 @@
Navigation
and resulting plots.
See the Bibliography for some pointers to papers describing Clawpack and
the algorithms used in more detail.
A new approach to flagging cells for refinement was introduced in Clawpack
5.6.0 – using the solution to an adjoint problem to determine what cells in
the forward solution should be refined because these cells may have an impact
@@ -223,8 +219,8 @@
Navigation
simply inner products of the forward and adjoint solutions that are computed
and a cell is flagged for refinement in cells where the magnitude of the
inner project is greater than amrdata.flag2refine_tol.
-
-
in non-conservation form and is solved using the q-wave formulation in which
jumps in the the solution vector are split into eigenvectors, rather than
jumps in the flux. See the comments in the rpn2 solver for more details.
-
-
+
The basic adaptive refinment strategy used in AMRClaw Description and Detailed Contents is
to refine on logically rectangular patches. A single Level 1 grid covers
the entire domain (usually — if it is too large it may be split into
@@ -134,8 +131,8 @@
Navigation
originally written by Marsha Berger for gas dynamics, and merged in Clawpack
in the early days of Clawpack development by MJB and RJL. The algorithms
used in AMRClaw are described more fully in [BergerLeVeque98].
-
-
Consider a Level k > 1 grid for which we need ghost cells all around the
boundary at the start of each time step on this level. The same procedure
is used at other levels.
@@ -178,9 +175,9 @@
Navigation
the same refinement level at the opposite side of the domain to copy ghost
cell values from, and if so which grid and what index corresponds to the
desired location.
-
-
-
Every few time steps on the coarsest level it is generally necessary to
revise modify the regions of refinement at all levels, for example to follow
a propagating shock wave. This is done by
@@ -221,24 +218,23 @@
Navigation
interpolation is performed based on the Level k grids.
The AMRClaw version of Clawpack provides Adaptive Mesh Refinement (AMR)
capabilities in 2 and 3 space dimensions. (The two-dimensional code can
also be used for 1-dimensional problems, see AMRClaw for 1d problems.)
AMRClaw has been extended to support one-dimensional AMR directly.
The setrun.py file has the same form as for 2d AMRClaw, with the obvious
changes to eliminate the y-direction. See Sample setrun.py module for AMRClaw.
For some examples, see the 1d examples in $CLAW/amrclaw/examples/ and in
gallery_classic_amrclaw.
The two-dimensional code can also be used for 1-dimensional problems, by
setting num_cells[1] = 1 so there is only one cell in the y direction.
Also set refinement_ratios_y = [1,1,1, …] so that refinement is not done
@@ -106,11 +103,10 @@
In Fortran versions of Clawpack-5, the main documentation page
for an application is often found
in a file named README.rst, which can be written using the markup language
@@ -105,18 +102,17 @@
Navigation
which also converts code files into html files for easy browsing.
A list of code files in the directory is automatically generated by
convert_readme.py and links inserted in README.html.
The directory apps/notebooks contains a number of notebooks that illustrate
various aspects of Clawpack. Many of these are also visible in rendered html
form in the
Gallery of Notebooks.
Select the Clawpack image and then
click on the Launch button on this page to start launching an instance
based on this AMI. This means a virtual machine will be started for you,
@@ -140,9 +137,9 @@
Click Close on the next page to
go back to the Management Console. Click on Instances on the left menu
and you should see a list of instance you
@@ -168,9 +165,9 @@
If you run Clawpack on your instance then you will probably want to view the
results. There are at least three possible approaches (see Plotting with Visclaw
for general information about plotting in Clawpack):
Once you are done computing for the day, you will probably want to stop your
instance so you won’t be charged while it’s sitting idle. You can do this
by selecting the instance from the Management Console / Instances, and then
select Stop from the Instance Actions menu.
You can restart it later and it will be in the same state you left it in.
But note that it will probably have a new Public DNS!
If you add additional software and want to save a disk image of your
improved virtual machine (e.g. in order to launch additional images in the
future to run multiple jobs at once), simply click on Create Image (EBS
AMI) from the Instance Actions menu.
first checked and if there is no such file in this directory then
the environment variable B4RUN is checked, which can be set to
the full path of a b4run.py file that you wish to use globally, for example.
-
+
Below are linkes to the default b4step library routines for Classic and AMRClaw.
By default these do nothing. If you wish to specify aux arrays you will
need to copy one of these files to your application directory and modify it
@@ -89,8 +86,8 @@
Navigation
(Note: these links are for the version checked in to the master branch.
You can select a different branch or tag from the GitHub page.)
In GeoClaw, there is a library routine that sets aux(1,i,j) to the cell
average of the bathymetry, aux(2,i,j) to the ratio of the true cell area
to dx*dy (the capacity function), and aux(3,i,j) to the length ratio of
@@ -99,11 +96,10 @@
Boundary conditions are imposed each time step by filling ghost cells
adjacent to the edge of each grid patch. See Chapter 4 of [LeVeque-FVMHP]
for more details.
@@ -139,8 +136,8 @@
Navigation
best to put the modified version of bcN.f in the application directory and
modify the Makefile to point to the modified version.
See User-defined boundary conditions below.
-
-
When AMR is used, any interior patch edges (not at a domain boundary) are
filled automatically each time step, either by copying from adjacent
patches at the same level or by interpolating (in both space and
@@ -159,9 +156,9 @@
Navigation
within the domain (in which case ghost cell values are automatically set by
the AMR code and the user bcNamr routine should leave these values
alone.
-
-
-
For tsunami modeling or other geophysical flows over topography the
computational domain has artificial boundaries that are placed sufficiently
far from the region of interest that any flow or waves leaving the domain
@@ -175,9 +172,9 @@
Navigation
The library routine $CLAW/geoclaw/src/2d/shallow/bc2amr.f is modified from
the amrclaw version only by extrapolating the depth at the boundaries
into ghost cells.
-
-
-
Boundary conditions for clamshell grids on the sphere¶
+
+
+
Boundary conditions for clamshell grids on the sphere¶
In 2D AMRClaw and GeoClaw, an additional option is available for bc_lower
and bc_upper that is implemented in the library routines:
@@ -192,9 +189,9 @@
Navigation
See also [BergerCalhounHelzelLeVeque] for further examples.
If none of the boundary conditions described above is suitable at one or
more boundaries of the domain, then you will have to modify the library
routine to implement the desired boundary condition.
@@ -216,11 +213,10 @@
Navigation
cells extend outside the physical domain and which are filled automatically
from adjacent grid patches or by interpolation from coarser patches if they
are interior to the domain.
-
-
+
Papers describing the Clawpack software and algorithmsYear ={2002}}
-
-
-[BergerColella89]
-
M. J. Berger and P Colella. 1989. Local adaptive mesh refinement for
+
+
BergerColella89
+
M. J. Berger and P Colella. 1989. Local adaptive mesh refinement for
shock hydrodynamics. J. Comput. Phys. 82, 64–84.
-
-
-[BergerGeorgeLeVequeMandli11]
-
M. J. Berger, D. L. George, R. J. LeVeque and K. M. Mandli,
+
+
BergerGeorgeLeVequeMandli11
+
M. J. Berger, D. L. George, R. J. LeVeque and K. M. Mandli,
The GeoClaw software for depth-averaged flows with adaptive refinement,
Advances in Water Resources 34 (2011), pp. 1195-1206.
Papers describing the Clawpack software and algorithmsYear ={1998}}
-
-
-[BergerOliger84]
-
M. J. Berger and J. Oliger. 1984. Adaptive mesh refinement for
+
+
BergerOliger84
+
M. J. Berger and J. Oliger. 1984. Adaptive mesh refinement for
hyperbolic partial differential equations. J. Comput. Phys. 53,
484–512.
-
-
-[BergerRigoutsis91]
-
M. J. Berger and I. Rigoutsos. 1991. An Algorithm for Point Clustering
+
+
BergerRigoutsis91
+
M. J. Berger and I. Rigoutsos. 1991. An Algorithm for Point Clustering
and Grid Generation. IEEE Trans. Sys. Man & Cyber. 21, 1278–1286.
-
-
-[Davis2018]
-
B. N. Davis, 2018. Adjoint-Guided Adaptive Mesh Refinement for
+
+
Davis2018
+
B. N. Davis, 2018. Adjoint-Guided Adaptive Mesh Refinement for
Hyperbolic Systems of Equations,
PhD Thesis, University of Washington.
link
-
-
-[DavisLeVeque2016]
-
B. N. Davis and R. J. LeVeque. 2016. Adjoint Methods for Guiding
+
+
DavisLeVeque2016
+
B. N. Davis and R. J. LeVeque. 2016. Adjoint Methods for Guiding
Adaptive Mesh Refinement in Tsunami Modeling, 2016.
Pure Appl. Geophys. 173 (2016), pp. 4055-4074.
More info
-
-
-[DavisLeVeque2018]
-
B. N. Davis and R. J. LeVeque. 2018. Analysis and Performance Evaluation of
+
+
DavisLeVeque2018
+
B. N. Davis and R. J. LeVeque. 2018. Analysis and Performance Evaluation of
Adjoint-Guided Adaptive Mesh Refinement for Linear Hyperbolic PDEs
Using Clawpack, Preprint,
More info
Papers describing the Clawpack software and algorithmsYear ={2011}}
-
-
-[KetParLev13]
-
D. I. Ketcheson, Matteo Parsani, and R J LeVeque, 2013,
+
+
KetParLev13
+
D. I. Ketcheson, Matteo Parsani, and R J LeVeque, 2013,
High-order Wave Propagation Algorithms for Hyperbolic Systems,
SIAM Journal on Scientific Computing, 35(1):A351-A377 (2013)
@article{KetParLev13,
@@ -269,10 +251,9 @@
Papers describing the Clawpack software and algorithmsYear ={2013}}
-
-
-[KetchesonMandliEtAl]
-
David I. Ketcheson, Kyle T. Mandli, Aron J. Ahmadia, Amal Alghamdi, Manuel
+
+
KetchesonMandliEtAl
+
David I. Ketcheson, Kyle T. Mandli, Aron J. Ahmadia, Amal Alghamdi, Manuel
Quezada de Luna, Matteo Parsani, Matthew G. Knepley, and Matthew Emmett, 2012,
PyClaw: Accessible, Extensible, Scalable Tools for Wave Propagation Problems,
SIAM Journal on Scientific Computing, 34(4):C210-C231
@@ -289,10 +270,9 @@
Papers describing the Clawpack software and algorithmsYear ={2012}}
-
-
-[MandliEtAl2016]
-
Kyle T. Mandli, Aron J. Ahmadia, Marsha Berger, Donna Calhoun, David L.
+
+
MandliEtAl2016
+
Kyle T. Mandli, Aron J. Ahmadia, Marsha Berger, Donna Calhoun, David L.
George, Yiannis Hadjimichael, David I. Ketcheson, Grady I. Lemoine, Randall J. LeVeque,
Clawpack: building an open source ecosystem for solving hyperbolic PDEs
PeerJ Computer Science 2 (2016), e68:
Follow the links to see changes that have been made to the master branch of
each repository since the last release (v5.9.0) on August 26, 2022.
These changes should appear in the next release. If you need them now,
@@ -86,43 +83,43 @@
Navigation
To see documentation that has already been developed to accompany any new
features listed below, click on the “dev” branch of the documentation, in
the menu on the left hand side of this page.
For users who want to migrate code from 4.3 to 5.0, this may be a useful
intermediate step, followed by migration from 4.6 to 5.0 using the script
described at Converting from Clawpack 4.6 to 5.0.
@@ -106,10 +103,9 @@
Navigation
This migration script from 4.3 to 4.6 only works for classic
(single grid) codes in 1d and 2d, not AMRClaw codes.
The rest of this page concerns the Fortran components of Clawpack.
There is no complete list of changes since it has evolved to be very
different from the 4.x version of Clawpack in organization, but some of
@@ -191,11 +188,11 @@
frequent times than the standard AMR output has been introduced in v5.9.0,
and these are now called fgout grids to complement the fgmax grids.
These fgout grids are described further below.
-
-
The GeoClaw Fortran code reads in one or more files that specify fgout grids
grid(s) for writing out the solution on a fixed grid throughout
the computation.
@@ -160,9 +157,9 @@
Navigation
to each fgout grid using the fgno attribute, described below.
If you do not assign numbers, they will be numbered sequentially (1,2, etc.)
based on the order they are specified in the setrun.py file.
-
-
-
Since the files have the same format as the usual fort.t, fort.q, and
fort.b files for Clawpack output, it is possible to use a setplot.py
file to set up plotting this sequence of fgout frames in exactly the same
@@ -236,9 +233,9 @@
Alternatively, since every output frame consists of only a single uniform
grid of data, it is much easier to manipulate or plot this data directly than
for general AMR data. The fgout_tools.py module described at
@@ -278,9 +275,9 @@
Note above that fgout points are specified by setting e.g. fgout.x1,
fgout.x2 and fgout.nx in setrun.py. For consistency with the way the
finite volume computational grid is specified in setrun.py
@@ -292,9 +289,9 @@
The fgout grid need not be aligned with any computational grid, and in general
it may overlap several grids at different AMR resolutions. At each fgout time
requested, the solution is interpolated from the finest available AMR grid
@@ -321,11 +318,10 @@
Class to hold a single frame of fgout data at one output time.
Several attributes are defined as properties that can be evaluated
and stored only when needed by the user.
Read input info for fgout grid number fgno from the data file
fgout_grids.data, which should have been created by setrun.py.
This file now contains info about all fgout grids.
Read a netCDF file and return a list of FGoutFrame instances.
This will only be possible if the netCDF file contains at least
the qoi’s ‘h’,’hu’,’hv’,’eta’ required to reconstruct the q array
as output by GeoClaw.
Write a list of fgout frames (at different times on the same rectangular
grid) to a single netCDF file, with some metadata and the topography,
if desired.
@@ -375,11 +372,10 @@
Navigation
time the file was created and the path to the directory where it was made.
In addition to simple rectangles, more general ruled rectangles can also be
used as flagregions. These are a restricted set of polygons for which it is
easy to test if a point is inside or outside, as described in more detail in
@@ -171,11 +167,10 @@
The array force_dry_init can now be saved in the same format as topo
files, using topo_type=3 and specifying Z_format=’%1i’ so that
the data values from the array, which are all either 0 or 1, are printed
@@ -349,9 +346,9 @@
To use a force_dry_init.data file of the sort created above, when
setting up a GeoClaw run the setrun.py file must be modified to
indicate the name of this file along with a time tend. The array is
@@ -367,8 +364,8 @@
Users should set the environment variable FC to point to the correct
compiler, e.g. in bash via:
$ export FC=gfortran
@@ -105,9 +102,9 @@
Navigation
f77 and if so resets it to gfortran since much of Clawpack is not f77
compliant. However, it is best to set the FC environment variable
yourself, e.g. in your .bashrc file.
-
-
-
The LFLAGS environment variable is used to provide flags that are needed when
linking the final binary. The most likely use for this flag would be to link a
particular library with the binary (such as a NetCDF library) or provide a path
to a compiled module. If this variable is not set in the environment then
LFLAGS defaults to the relevant flags in FFLAGS.
-
-
-
Pre-Processor and the PPFLAGS environment variable¶
+
+
+
Pre-Processor and the PPFLAGS environment variable¶
Compilers often provide a pre-processor that can scan source code before
compilation providing some ability to define variables at compile time or
transform the code. Currently the pre-processor is always called before
Clawpack compilation to support optional dependencies, such as NetCDF support,
and some testing abilities. The PPFLAGS environment variable is meant to
provide further control of the pre-processor.
With AMRClaw in two space dimensions and GeoClaw
it is possible to specify gauge locations as points (x,y) where the values of all
components of q should be output every time step during the computation over some
@@ -116,8 +112,8 @@
Navigation
can be spatially interpolated from the fgout grid(s) captured in the run).
The temporal resolution will be that specified for the fgout grids.
See Fixed grid output for more details.
-
-
Setting up, running, and plotting a GeoClaw application follows the same pattern
as other AMRClaw applications, which in turn use many of the same
conventions as the classic single grid Clawpack code, in particular:
To simulate flow over topography it is of course necessary to specify
the topography. This is usually done by providing one or more files of
surface elevation (relative to some reference, e.g. sea level) at a set of
@@ -119,25 +116,24 @@
Navigation
Several file formats are recognized by GeoClaw. See Topography data for more
information on how to specify topography and some on-line resources for
obtaining topography.
Fetch water levels and tide predictions at given NOAA tide station.
The data is returned in 6 minute intervals between the specified begin and
end dates/times. A complete specification of the NOAA CO-OPS API for Data
@@ -183,14 +180,14 @@
Navigation
$CLAW/geoclaw/scratch
-
Required Arguments:
+
Required Arguments
station (string): 7 character station ID
begin_date (datetime): start of date/time range of retrieval
end_date (datetime): end of date/time range of retrieval
-
Optional Arguments:
+
Optional Arguments
time_zone (string): see NOAA API documentation for possible values
datum (string): see NOAA API documentation for possible values
@@ -199,7 +196,7 @@
Navigation
verbose (bool): whether to output informational messages
-
Returns:
+
Returns
date_time (numpy.ndarray): times corresponding to retrieved data
water_level (numpy.ndarray): preliminary or verified water levels
x0,y0 is assumed to be a point (or an array with the same shapes as x1,y1)
x1,y1 is a point or two arrays of points (of the same dimension)
returns array with same shape as x1 and y1 containing distance of each point
@@ -220,20 +217,19 @@
Navigation
two points, but this is not suggested since the notation is not consistent.
Invert the Haversine function to find dx given a distance and point.
Invert the haversine function to find dx given distance d and (x1,y1) and y2.
The corresponding x2 can be x1+dx or x1-dx.
May return NaN if no solution.
As with all of Clawpack, the GeoClaw code is provided as a research
and teaching tool with no guarantee of suitability for any particular
purpose, and no liability on the part of the authors. See the
@@ -95,8 +92,8 @@
Navigation
geophysical hazards, but it is the responsibility of the user to fully
understand the model and its limitations and validate it for the intended
purpose.
-
-
GeoClaw is currently in use for tsunami hazard assessment
by several research groups. Version 4.6.1 of the code was approved in 2012
by the US National Tsunami Hazard
@@ -170,11 +167,10 @@
Navigation
seafloor leads to the propagation of acoustic waves that result in a
surface displacement
-
-
+
With the default style, matplotlib axis labels are often hard to read when
plotting in latitude and longitude. It may help to disable offset labeling
and to rotate the longitude labels:
The Google Earth browser is a powerful visualization tool for
viewing georeferenced data and images. The VisClaw visualization suite includes
tools that will produce georeferenced plots and associated KMZ files needed for
@@ -100,8 +97,8 @@
Navigation
critical decisions on conclusions drawn from the Google Earth
visualization alone. Nevertheless, these realistic visualizations are
useful for setting up simulations and communicating your results.
-
-
To get started, you will need to install the Python packages lxml and
pykml. These libraries can be easily installed through Python
package managers PIP and conda:
To create a pyramid of images for faster loading in Google Earth, you
will also want to install the Geospatial Data Abstraction Library
(GDAL). The GDAL library (and associated Python bindings)
@@ -153,16 +150,16 @@
This test will create an image pyramid in the directory frame0005fig1 and an associated
doc.kml file which you can open in Google Earth.
NOTE (8/1/16) The latest release of the Anaconda GDAL library is not fully version compatible with
its dependencies. If you receive an error that ends with:
The Chile 2010 tsunami is included as an example in the GeoClaw module
of Clawpack. Once you have run this simulation, you can create the
KMZ file needed for visualizing your data in Google Earth by using the
@@ -188,14 +185,12 @@
The plotting parameters needed to instruct VisClaw to create plots
suitable for visualization in Google Earth are all set as attributes
of instances of the VisClaw classes ClawPlotData and ClawPlotFigure.
@@ -203,9 +198,9 @@
The following plotdata attributes apply to all VisClaw figures to be
visualized in Google Earth. These attributes are all optional and
have reasonable default values.
Name used in the Google Earth sidebar to identify the simulation. Default : “GeoClaw”
-
-
-kml_starttime:[Y,M,D,H,M,S]
+
+
+kml_starttime : [Y,M,D,H,M,S]
Start date and time, in UTC, of the event. The format is [year,month,day,hour, minute, second].
By default, local time will be used.
-
-
-kml_timezone:integer
+
+
+kml_timezone : integer
Time zone offset, in hours, of the event from UTC. For example, the offset for Chile is +3 hours,
whereas the offset for Japan is -9 hours. Default : no time zone offset.
-
-
-kml_index_fname:string
+
+
+kml_index_fname : string
The name given to the KMZ file created in the plot directory. Default : “_GoogleEarth”
-
-
-kml_publish:string
+
+
+kml_publish : string
A URL address and path to a remote site hosting a
KMZ file you wish to make available on-line. Default : None
A function that maps computational coordinates (in meters, for
example) to latitude/longitude coordinates. This will be called to
position PNG overlays, gauges, patch boundaries, and regions boundaries to the
@@ -273,18 +268,18 @@
The following attributes apply to an individual figure created for visualization in Google Earth.
The first three attributes are required. The remaining attributes
are optional.
Indicates to VisClaw that the PNG files created for this figure should be suitable for
visualization in Google Earth. With this set to True, all titles, axes labels, colorbars
and tick marks will be suppressed. Default : False.
-
-
-kml_xlimits:[longitude_min,longitude_max]
+
+
+kml_xlimits : [longitude_min, longitude_max]
Longitude range used to place PNG images on Google Earth. This setting will override
any limits set as plotaxes attributes. Required
-
-
-kml_ylimits:[latitude_min,latitude_max]
+
+
+kml_ylimits : [latitude_min, latitude_max]
Latitude range used to place the PNG images on Google Earth.
This setting will override any limits set as plotaxes attributes. Required
-
-
-kml_use_for_initial_view:boolean
+
+
+kml_use_for_initial_view : boolean
Set to True if this figure should be used to determine the initial
camera position in Google Earth. The initial camera position will
be centered over this figure at an elevation equal to approximately
@@ -360,17 +355,17 @@
plotfigure attributes
-
-
-kml_figsize:[size_x_inches,size_y_inches]
+
+
+kml_figsize : [size_x_inches,size_y_inches]
The figure size, in inches, for the PNG file. See Removing
aliasing artifacts for tips on how to set the figure size and dpi
for best results. Default : 8 x 6 (chosen by Matplotlib).
-
-
-kml_dpi:integer
+
+
+kml_dpi : integer
Number of pixels per inch used in rendering PNG figures. For best
results, figure size and dpi should be set to respect the numerical
resolution of the the simulation. See Removing aliasing
@@ -378,18 +373,18 @@
Set to True if you want to create a pyramid of images at different
resolutions for faster loading in Google Earth. Image tiling
requires the GDAL library. See Optional GDAL library, above,
for installation instructions. Default : False.
All figures created for Google Earth are rendered as PNG files using
the Matplotlib backend. So in this sense, the resulting PNG files are
created in a manner that is no different from other VisClaw output
@@ -417,8 +412,8 @@
The plotaxes attributes
colorbar, xlimits, ylimits and title will all be ignored by the KML plotting.
For best results, the attribute scaled should be set to its default value False. The
@@ -426,9 +421,9 @@
The most useful plotitem type will probably be the 2d_pcolor type, although other
types including the filled contour contourf can also be used to good effect.
Colormaps that are designed to work well with Google Earth are
A colorbar can be associated with each figure in the Google Earth
browser by setting the figure attribute kml_colorbar to point to a function
that creates the colorbar:
There are no particular attributes for gauge plots and so they
can be created in the usual way. In the Google Earth browser, gauge locations
will be displayed as Placemarks. Clicking on gauge Placemarks will bring
up the individual gauge plots. The screenshot below shows the gauge plot
that appears when either the gauge Placemark or the gauge label in the sidebar is
clicked.
VisClaw has additional plotdata attributes indicating which figures and frames
to plot and which output style to create. When plotting for Google
Earth, one additional output parameter is necessary.
KML files are very similar to HTML files in that they contan
<tags>…</tags> describing data to be rendered by a suitable
rendering engine. Whereas as standard web browsers can render content
@@ -543,9 +536,9 @@
If you create several frames with relatively high dpi, you may find
that the resulting KMZ file is slow to load in Google Earth. In
extreme cases, large PNG files will not load at all. You can improve
@@ -559,9 +552,9 @@
You may find that the transparent colormap leads to unappealing visual
artifacts. This can happen when the resolution of the PNG file does
not match the resolution of the data used to create the image. In the
@@ -573,12 +566,10 @@
Aliasing effects resulting from default kml_dpi and kml_figsize settings¶
-
-
+
Aliasing effects resulting from default kml_dpi and kml_figsize settings¶
+
We can remove these aliasing effects by making the resolution of the
PNG file a multiple of 30*2*6 = 360. This can be done by setting the
figure size and dpi appropriately:
Aliasing effects removed by properly setting kml_dpi and kml_figsize¶
-
-
+
Aliasing effects removed by properly setting kml_dpi and kml_figsize¶
+
This baseline dpi=12 is the minimum resolution that will remove
striped artifacts from your images. However, you may find that this
resolution is unacceptable, especially for close-up views of
@@ -621,9 +610,9 @@
Creating multiple figures at different resolutions¶
You can create several figures for visualization in Google Earth.
Each figure you create will show up as a separate named folder in the Google
Earth sidebar. The name will match that given to the VisClaw plotfigure.
@@ -662,9 +651,9 @@
Creating multiple figures at different resolutions
Mapping topography data to latitude/longitude coordinates¶
+
+
+
Mapping topography data to latitude/longitude coordinates¶
In many situations, your computational domain may not be conveniently
described in latitude/longitude coordinates. When simulating overland
flooding events, for example, topographic data may more easily be
@@ -728,9 +717,9 @@
Creating multiple figures at different resolutions
You can easily share your results with collaborators
by providing links to your archive KMZ file in HTML webpages. Collaborators can
download the KMZ file and open it in a Google Earth browser.
For netCDF files the
data points are generally interpreted as pointwise values at the points
specified in the lat and lon arrays included in the file (or as
cell-averaged values with these points as the cell centers).
Older versions of the documentation used to be tagged for each minor
release, e.g. v5.6.1. Starting with v5.7.0, these are now only tagged
with the major release, e.g. v5.7.x.
When updating a minor version, e.g. from v5.7.0 to v5.7.1, we will continue
to use the same branch v5.7.x. You should just make sure the v5.7.x and dev
are up to date with each other at the time of release.
Any files placed in $CLAW/doc/doc/extra_files will be copied verbatim
(recursively for subdirectories) to the directory
$CLAW/doc/doc/_build/html when Sphinx is used to build the documentation.
@@ -343,9 +340,9 @@
Some webpages are created within other clawpack repositories.
For example, the page http://www.clawpack.org/geoclawdev-2020/
is modified by pushing changes to the master branch of the repository
@@ -357,11 +354,10 @@
Make sure all your subrepositories are up to date and clean:
cd $CLAW
git co master
@@ -105,16 +102,16 @@
PreparationCLAW/doc/gallery/README.md
as required for building the galleries, and check all the resulting plots to
make sure everything looks correct.
-
-
-
Make sure all repositories are checked out to the master branch and are up to
date with the main Clawpack repositories and clean, as described in the
preparation step above.
We generally do this step for a release candidate first, and then
do the same for the final release. For release candidates, modify the
version number to include 5.4.1rc-alpha, for example.
After the release has been finalized, tag all repositories. In the commands
below, it is assumed the remote upstream points to the main Github repos
(not your fork) and that you have push permission. Change 5.x.x to the
@@ -187,9 +184,9 @@
Final releaseChanges to master since v5.9.0 which generate diffs between the latest version and
the current master branch of each repository.
-
-
-
To release on the pypi server (for installation via pip) we have to do a bit
of trickery. We can’t just follow the directions at https://packaging.python.org/tutorials/packaging-projects/
because we have a very non-Pythonic directory structure; in particular,
@@ -239,9 +236,9 @@
See Guide for updating this documentation for general instructions on building the documentation
and galleries using Sphinx, and for how to push changes to Github so they
show up on the web.
Ideally all the apps in the Clawpack Applications repository should be rerun with the new release
and any issues fixed. If old apps are modified, add a note to the
README.rst file in the directory that indicates when it was last updated
@@ -305,14 +302,14 @@
Note that unlike the tar file for a new release, the docker image includes
a clone of the apps repository, so it would be best to first update that
@@ -327,11 +324,10 @@
This page describes ways to download and “install” Clawpack in a way that
the Fortran versions of the PDE solvers (Classic, AMRClaw, and GeoClaw)
can be used, along with Python codes that support these solvers, including
@@ -93,8 +90,8 @@
You can download the most recent (or certain previous versions) of Clawpack
as a tar file. After untarring this, you can set environment variables
to point to this version.
You can clone the git repositories from https://github.com/clawpack.
This is particularly useful if you
want the latest development version or a branch that is not in a release yet,
@@ -126,7 +123,7 @@
gitclonehttps://github.com/clawpack/clawpack.gitcdclawpack
-gitcheckoutv5.9.0# or an older version; `git tag -l` to list options
+gitcheckoutv5.9.0# or an older version; `git tag -l` to list optionsgitsubmoduleinit# for repositories pyclaw, clawutil, visclaw, etc.gitsubmoduleupdate# clones all the submodule repositoriesexportCLAW=/full/path/to/clawpack# in bash
@@ -141,19 +138,18 @@
Navigation
See Clawpack components for a list of what is generally included
under the top level clawpack directory when using any of these approaches.
(And what is not included, e.g. the Clawpack Applications repository.)
-
-
Please see Which Clawpack solver should I use? before installing, particularly
if you are not sure whether you will
be using the Fortran versions of the PDE solvers
@@ -104,7 +101,7 @@
Navigation
or, more specifically,
-
pipinstall--userclawpack==v5.9.0
+
pipinstall--userclawpack==v5.9.0
or you can choose a previous version from the PyPi history.
@@ -113,9 +110,9 @@
Navigation
If you think you might want to use the Fortran packages as well
(Classic, AMRClaw, GeoClaw) and/or want easier access to the Python source
code, it is recommended that you follow the pip instructions below.
The recommended way to install the latest release of Clawpack, for
using both PyClaw and the Fortran packages, is to use pip, e.g. with the
following command
@@ -170,8 +167,8 @@
Using pip to download and install actually clones Git repositories from
https://github.com/clawpack/clawpack. If you are comfortable with
Git you can use the same top repository to update Clawpack or switch
@@ -208,9 +205,9 @@
Next steps:Python path if you are having problems with the wrong version
being imported.
-
-
-
Experimenting with code in the examples directories¶
+
+
+
Experimenting with code in the examples directories¶
We suggest that if you want to experiment extensively with examples or
modify an example to solve your own problem, you first copy a directory out
of the source code tree to a different location, in order to minimize
@@ -218,9 +215,9 @@
Convert float to string in fixed point notation with at most
num_digits digits of precision and trailing zeros removed,
for printing nicely in kml description boxes.
Produce kml files for the computational domain, all gauges and regions
specified, and all topo and dtopo files specified in rundata.
This can be used, e.g. by adding the lines
@@ -331,9 +328,9 @@
Navigation
from the setrun.py file in the current directory.
-
-
-clawpack.geoclaw.kmltools.pcolorcells_for_kml(X, Y, Z, png_filename=None, dpc=2, max_inches=15.0, verbose=True, **kwargs)¶
+
+
+clawpack.geoclaw.kmltools.pcolorcells_for_kml(X, Y, Z, png_filename=None, dpc=2, max_inches=15.0, verbose=True, **kwargs)¶
Wraps pcolormesh in a way that a png file is created that can be viewed
on Google Earth with proper alignment and with sharp grid cell edges.
Works if X,Y are cell centers or edges, and X,Y can be 2d or 1d arrays.
@@ -361,43 +358,43 @@
Navigation
png file, as described below.
Internally the value dpi (dots per inch) for the png file is
determined so that it is at least 16 and so that:
Create kmz file showing onshore and offshore topography as separate layers.
Currently not very flexible but is useful in quickly creating kmz files
to open on Google Earth showing the onshore topography and offshore
@@ -508,7 +505,7 @@
Navigation
cells should be properly rendered to ease exploration of DEMs.
A colorbar png file is also created and included in the kmz file.
-
Input:
+
Input
topo should be a topotools.Topography object,
zlim is the elevation z limits for choosing the color map
@@ -519,23 +516,22 @@
Navigation
close_figs to close the pyplot figures after making png files
One can also use the Fixed grid output capabilities added to
GeoClaw in Version 5.9.0 in order to capture the solution over a specified
fixed grid at frequent output times. If this output is frequent enough,
@@ -154,11 +150,10 @@
An alternative using fgout gridsFixed grid output for more details.
-
-
+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Makefiles for the Fortran code in many repositories
use the common Makefile found in $CLAW/clawutil/src/Makefile.common,
so you must have the clawutil repository.
A number of variables are defined in the Makefiles of application
directories. For example, output is directed to the subdirectory specified
by the variable OUTDIR. To change this, simply modify the Makefile before
@@ -173,9 +170,9 @@
Compiler flags can be changed by modifying the FFLAGS variable in the
Makefile. If you change compiler flags you will generally need to recompile
all the Fortran files and the Makefile dependencies will not detect this.
@@ -185,9 +182,9 @@
Compiler flagsFortran Compilers for more about compiler flags.
-
-
-
Fortran source files with the same base name but different suffixes can cause
unexpected source files to be compiled. This occurs as the Makefiles are
structured to use the free-format Fortran source files .f90* before the
@@ -200,12 +197,11 @@
See Clawpack Makefiles for general information on using the Makefile found
in application directories for the Fortran codes.
New in 5.4.0. The Makefile also typically refers to a common list of
@@ -152,8 +149,8 @@
Navigation
For the classic 1d code there are no modules, only subroutines.
-
-
Replacing files with the same name as library files¶
+
+
Replacing files with the same name as library files¶
Note that the list of default library routines above contains both
qinit.f90 and setprob.f90. The default versions of these files contain
subroutines that have the correct calling sequence but return without doing
@@ -172,9 +169,9 @@
Navigation
(See Fortran 77 vs. Fortran 90 files for an important cautionary note on what
might go wrong if you have both a .f file and a .f90 file with
the same base name in the same directory.)
-
-
-
Using a modified library routine with a different name¶
+
+
+
Using a modified library routine with a different name¶
Suppose we want to use a local version of bc1.f in order to
implement some new boundary condition not included in the default version.
If we call the local file bc1.f then we can simply add it to the list
@@ -204,11 +201,10 @@
Using a modified library routine with a different name
(It doesn’t matter what order the files are listed in each section.)
-
-
+
+
-
@@ -219,17 +215,15 @@
Using a modified library routine with a different name
When using GeoClaw to model inundation, it is important to include an
appropriate bottom friction term in the equations. This takes the form of a
source term added to the right hand side of
@@ -134,10 +130,9 @@
Navigation
everywhere, the effect of this bug on the resulting accuracy was probably
small, but users may want to test this.
The array pt_chosen can be used to create a file that is read in by
GeoClaw to identify points where Ztopo is below MHW but where there
is dry land because of protection by dikes or levies. This is done by
@@ -203,23 +199,23 @@
The output array could also be used to define an AMR flag region as a
ruled rectangle, using the function
region_tools.ruledrectangle_covering_selected_points described in
Ruled Rectangles. This would give a
minimal ruled rectangle covering all the chosen points. An example is
given below.
This argument is useful if you want to apply a sequence of different
criteria to choose points. For example, suppose you first want to choose
all grid points within 5 points of the coast (as can be done using
@@ -240,9 +236,9 @@
First we choose all points with elevation below 15 m and that are
connected to the coast over this topography extent. Note the latter
requirement will eliminate the low lying area at the bottom of the
@@ -326,9 +322,9 @@
Write out the masked array indicating fgmax points¶
+
+
+
+
Write out the masked array indicating fgmax points¶
One we have selected the desired fgmax points, these can be output in
the style of a topo_type=3 topography file, with a header followed
point values at all points on a uniform grid. The values are simply the
@@ -434,9 +430,9 @@
Note the blue region in the above plot that is inland from the coast and
behind a green barrier. Examining Google Earth shows that this is
wetland area that probably should not be initialized as a lake. We can
@@ -505,11 +501,10 @@
Before version 4.3, Clawpack used Matlab (Mathworks, Inc.) for plotting and visualizing
results of simulations. For this purpose, an extensive set of plotting
tools were developed. These are still available in
@@ -105,8 +102,8 @@
Navigation
visualization assumes finite volume data, and individual plot
“patches” use cell-averaged values to color mesh cells directly. No
graphical interpolation is done when mapping to the colormap.
-
-
To use the Matlab plotting tools with Clawpack, the user will need to
first be sure that the necessary Matlab routines are on the Matlab
search path. This can be done by explicitly setting the MATLABPATH
@@ -119,9 +116,9 @@
Once output files, e.g. ‘fort.q0000’, ‘fort.q0001’, and so on, and
corresponding fort.t0000’ or ‘fort.t0001’ files have been created, the
user can plot them in Matlab by entering one of
@@ -192,9 +189,9 @@
Navigation
is returned to the plot prompt, a file afterframe is called. This
file contains user commands to set various plot properties. See below
for more details on what the user might wish to include in this file.
-
-
-
The properties of the Matlab plot are controlled through two main
user-defined files located, typically, in the current working
directory. The first of these files, the ‘setplot’ file (e.g. setplot1.m, setplot2.m or
@@ -240,9 +237,9 @@
Navigation
Each of the examples in Clawpack include a ‘setplot’ file which you
can browse to get an idea as to what can be put in the file.
The ‘afterframe.m’ script is the second file which control aspects of the
plot and is called after the plot has been created. The following are
commonly set in the afterframe file:
@@ -296,21 +293,21 @@
Navigation
The user is encouraged to browse the ‘afterframe.m’ file available
with each Clawpack example to get a better idea as to what one might
include in this file.
The graphics are controlled to a large extent using variables that are
set in the Matlab base workspace. This can lead to unpredictable results
when switching between Clawpack examples.
The interested user is encouraged to browse the Matlab Gallery for
examples of the types of plots that can be created with the Clawpack Matlab
plotting routines.
Several Fortran routines in GeoClaw interpolate from the computational grids
to other specified points where output is desired
(typically using the finest AMR resolution available nearby at each desired
@@ -138,10 +134,9 @@
Navigation
Since the point is apparently wet (h > 0), one might conclude that the sea
surface at this point is 27 meters above the initial sea level, whereas in
fact the sea level is never more than 6 meters above sea level.
-
+
Earthquake sources: Fault slip and the Okada model¶
+
+
Earthquake sources: Fault slip and the Okada model¶
To initiate a tsunami from an earthquake, it is necessary to generate a model of
how the seafloor moves, which is generally specified in a dtopo file as
described in Topography displacement files. This is often done by starting with a
@@ -108,8 +105,8 @@
Navigation
the results together (valid by linear superposition of the solutions to the
linear elastic halfspace problems).
See dtopotools module for moving topography for more documentation and illustrations.
-
-
For historic earthquakes, it is generally possible to find many different
models for the distribution of slip on one or more fault planes,
see for example the pointers at Earthquake source models.
@@ -211,9 +208,9 @@
Navigation
See dtopotools module for moving topography for more details, and the Jupyter notebook
$CLAW/apps/notebooks/geoclaw/dtopotools_examples.ipynb for more examples.
The slip on the fault plane(s) must be translated into seafloor deformation.
This is often done using the “Okada model”, which is derived from
a Green’s function solution to the elastic half space problem, following
@@ -231,9 +228,9 @@
Navigation
modeling of the resulting seafloor deformation may not be justified.
In addition to the parameters above, the Okada model also requires an elastic
parameter, the Poisson ratio, which is usually taken to be 0.25.
It is also possible to set a rupture_time and a rise_time for each
subfault in order to model a time-dependent rupture process. This is called
a “kinematic rupture” since the these values are specified.
The Clawpack Fortran Classic 3d code, AMRClaw 2d and 3d code,
and GeoClaw codes include
OpenMP directives for making use of multicore shared memory machines.
The code in AMRClaw and GeoClaw is parallelized by splitting the list of
patches that must be advanced in time between threads, and then each grid
patch is handled by a single thread. For this reason good performance will
@@ -148,18 +145,17 @@
In Specifying classic run-time parameters in setrun.py, the style of specifying output times can be
specified by setting the parameter output_style. This can be illustrated
by a typical example from a setrun.py file:
In AMRClaw and GeoClaw, the format for the output data (solutions) can be
specified by setting the parameter output_format to ‘ascii’,
‘binary64’, or ‘binary32’. (The single-grid
@@ -137,14 +134,14 @@
Two output files are created at each output time (each frame). The frames
are generally numbered 0, 1, 2, etc. The two files, at frame 2, for
example, are called fort.t0002 and fort.q0002.
New in v5.9.0: Previously the user could specify output_format=’binary’
for binary format. Starting in v5.9.0, the user can specify either
output_format=’binary64’ or output_format=’binary32’. For backward
@@ -217,14 +214,14 @@
The contents of aux arrays can also be output along with each time frame.
Which components are output is controlled by the setrun variable
clawdata.output_aux_components, which can be ‘none’ (default) or ‘all’
@@ -233,11 +230,10 @@
Clawpack includes a number of related hyperbolic PDE solvers:
@@ -99,8 +96,8 @@
Navigation
ideas, make use of the same set of Riemann solvers, and can be used with VisClaw
for visualization. If you’re not sure which solver to use, here you will find
the main differences between them.
-
-
The Classic, AMRClaw, and GeoClaw solvers are Fortran-based
packages and rely on Makefiles and environment variables. Problems are
specified partially through Python scripts at run time (setrun.py) and partially
@@ -118,9 +115,9 @@
Installation and user interfacef2py, a step
that sometimes causes problems and is not required if you are only using
Fortran versions of the solvers.
-
-
-
All of the Clawpack solvers include the classic algorithms described in
[LeVeque-FVMHP]; if you only require those, it’s easiest to use Classic or
PyClaw. Most of the packages contain additional algorithms:
Running a Fortran version of Clawpack produces output files that can then be
read in to a graphics package as a post-processing step. If you understand
the format of the output files, you can write custom graphics routines using
@@ -184,15 +181,14 @@
Navigation
plots. We are developing tools to simplify this process.
The default Makefile configuration in Version 4.5.1 was changed to allow two
different targets .plots and plots. The former creates a
hidden file .plots whose modification time is used to check dependencies.
@@ -125,9 +121,9 @@
Objects of class ClawPlotItem have an attribute plot_var. If
this is set to an integer than the corresponding component of q is plotted
(remembering that Python indexing starts at 0, so plot_var=0 will
@@ -140,9 +136,9 @@
The afteraxes attribute of a ClawPlotAxes` object can be specified as
either a string or a function. The string is executed (using exec(...)) or
the function is called after performing
@@ -161,9 +157,9 @@
This is normally determined by the outdir attribute of
the ClawPlotData object directing the plotting. But see the next FAQ
for the option of using different directories for some plot items (e.g. to
@@ -221,9 +217,9 @@
If you want one plot item on an axis to use the default plotdata.outdir
while another to take data from a different directory (in order to compare
two computations, for example), you can set the outdir
@@ -250,9 +246,9 @@
By default, a figure is created of the default matplotlib size, with a tan
background. Any desired
keyword arguments to the matplotlib figure command can
@@ -287,12 +283,12 @@
See Plotting with Visclaw for general information about plotting Clawpack results.
GeoClaw results can be viewed using these same tools. Some addition
functions and useful colormaps are available in the visclaw module
@@ -100,10 +97,9 @@
Clawpack includes utilities for plotting using Python. Most of these
are defined in the clawpack.visclaw module.
In order to use these you will need to insure that you have the required
modules installed (see python-install).
See Python Hints for more information on Python and pointers to many tutorials.
Typically each applications directory contains a file setplot.py, see for
example Plotting examples.
This file should define a function setplot(plotdata) that sets various
@@ -117,9 +114,9 @@
If you are viewing plots in using Iplotclaw and want to explore the data for
some frame or make plots directly in your Python shell, the data that is
being plotted is available to you in attributes of the Iplotclaw instance.
@@ -226,10 +223,10 @@
The first step in specifying how to plot is to create a ClawPlotData
object to hold all the data required for plotting. This is generally done
by creating a file setplot.py (see below).
If you are installing via pip using the command in
Quick Installation of all packages with pip, or via git clone, then you need Git.
You may already have it; in particular the Xcode tools on
Mac OSX contains Git. If you need to install it, see the Git book.
Many people have contributed to PyClaw, some of them very substantial parts of
the package. Their work is greatly appreciated: no open source project can
survive without a community. The following people contributed major parts of
@@ -116,9 +113,9 @@
The basic idea of a pyclaw simulation is to construct a
Solution object, hand it to a
Solver object, and request a solution at a new
@@ -116,9 +112,9 @@
A Pyclaw Solver can represent many different
types of solvers; here we will use a 1D, classic Clawpack type of
solver. This solver is defined in the solver module.
First we import the particular solver we want and create it with the default
configuration.
Creation of a Pyclaw
Riemann Solver Package. We can always
check what Riemann solvers are available to use via the riemann
module. Once we have picked one out, we pass it to the solver via:
-
The Controller coordinates the output and setup of
a run with the same parameters as the classic Clawpack. In order to have it
control a run, we need only to create the controller, assign it a solver and
initial condition, and call the run()
method.
If your simulation includes aux variables, you will need to either recompute them or
output the aux values at every step, following the instructions below.
It is sometimes desirable to output quantities other than those
in the vector q. To do so, just add a function compute_p to
the controller that accepts the state and sets the derived quantities
in state.p
The script pyclaw/development/clawdata2pyclaw.py is intended to aid
in converting a Clawpack 4.6 problem setup to PyClaw. However,
some manual conversion is necessary, especially if the problem
@@ -220,10 +217,9 @@
Navigation
rules to create the targets required by the new Fortran routine.
Similar changes to the problem-specific Makefile can be used to replace other
low-level Fortran routines.
PyClaw can be quickly installed and run for free using SageMathCloud.
After you’ve followed the instructions below, you may want to try some of the notebooks.
To run on Sage Math Cloud, simply create an account and a project at http://cloud.sagemath.org/.
Clawpack is pre-installed, so you can use it immediately from a terminal or IPython notebook.
Since matplotlib plots generated from the terminal will not work in the cloud, we
@@ -91,11 +88,10 @@
The pyclaw controller object is a convenience class for running simulations
based on the classic clawpack formats and output specifications. It allows
for a variety of output time specifications, output styles and other ways to
@@ -99,7 +96,7 @@
Navigation
details on what those are). Then simply call
run() in order to run the desired
simulation.
-
>>> importpyclaw.controllerascontroller
+
>>> importpyclaw.controllerascontroller>>> claw=controller.Controller()# Instantiate a new controller>>> claw.solver=my_solver# Assign a solver >>> claw.solution=my_initial_solution# Assign an initial condition
@@ -110,22 +107,22 @@
Navigation
output_format to specify a format other than ascii or no output files
if we are going to use keep_copy=True. After we are all set up we just
need to call the controller’s run() method and off we go.
-
Convenience routine that will evolve solution based on the
traditional clawpack output and run parameters.
This function uses the run parameters and solver parameters to evolve
the solution to the end time specified in run_data, outputting at the
appropriate times.
-
Input:
+
Input
None
-
Output:
+
Output
(dict) - Return a dictionary of the status of the solver.
(list of strings) - Format or list of formats to output the data,
if this is None, no output is performed. See _pyclaw_io for more info
on available formats. default='ascii'
Function that limits the given waves using the methods contained
in limiter. This is the vectorized version of the function acting on a
row of waves at a time.
-
Input:
+
Input
wave - (ndarray(:,num_eqn,num_waves)) The waves at each interface
s - (ndarray(:,num_waves)) Speeds for each wave
@@ -112,19 +108,19 @@
Navigation
-
Output:
+
Output
(ndarray(:,num_eqn,num_waves)) - Returns the limited waves
Library of limiter functions to be applied to waves
This module contains all of the standard limiters found in clawpack. To
use any of the limiters, use the function limit to limit the appropriate
@@ -133,8 +129,8 @@
Navigation
note that some of the limiters actually correspond to a more general function
which can be controlled more directly. Refer to the limiter function and its
corresponding documentation for details.
-
-
PyClaw comes with many example problem scripts that can be
accessed from the module clawpack.pyclaw.examples.
If you have downloaded the PyClaw source, you can find them
in the directory clawpack/pyclaw/examples/.
These examples demonstrate the kinds of things that can be done
with PyClaw and are a great way to learn how to use PyClaw.
The PyClaw geometry package contains the classes used to define the
geometry of a Solution object. The base container
for all other geometry is the Domain object. It
@@ -115,13 +112,13 @@
Navigation
In the most complex case with multiple patches and a parallel run we may
have the following:
Each dimension has an associated name with it that can be accessed via
that name such as grid.x.num_cells which would access the x dimension’s
number of cells.
-
Properties:
+
Properties
If the requested property has multiple values, a list will be returned
with the corresponding property belonging to the dimensions in order.
-
Initialization:
+
Initialization
Input:
dimensions - (list of Dimension) Dimensions that are to
@@ -372,12 +369,12 @@
(string) - Name of the output directory for gauges. If the
Controller class is used to run the application, this directory by
default will be created under the Controller outdir directory.
If True, use dimensional splitting (Godunov splitting).
Dimensional splitting with Strang splitting is not supported
at present but could easily be enabled if necessary.
@@ -644,9 +641,9 @@
Limiter(s) to be used. Specified either as one value or a list.
If one value, the specified limiter is used for all wave families.
If a list, the specified values indicate which limiter to apply to
@@ -672,76 +669,75 @@
In this section of the documentation, PyClaw refers
a Python version of the hyperbolic PDE solvers that allows solving the
problem in Python (e.g. in a Jupyter notebook) without explicitly using
@@ -109,13 +106,13 @@
The Riemann solvers now comprise a separate package. For convenience,
documentation of the available pure python Riemann solvers is included
here. Many other Fortran-based Riemann solvers are available.
If you use PyClaw in work that will be published, please cite the Clawpack software
(see Citing this work) and also mention specifically that you used PyClaw, and cite the paper:
Read in a frame of ascii formatted files, and enter the data into the
solution object.
This routine reads the ascii formatted files corresponding to the classic
clawpack format ‘fort.txxxx’, ‘fort.qxxxx’, and ‘fort.axxxx’ or ‘fort.aux’
Note that the fort prefix can be changed.
-
Input:
+
Input
solution - (Solution) Solution object to
read the data into.
Write out an ascii file formatted identical to the fortran clawpack files
including writing out fort.t, fort.q, and fort.aux if necessary. Note
@@ -264,7 +261,7 @@
Navigation
the appropriate values of num_dim, num_eqn, num_aux, and t. Only supports
up to 3 dimensions.
Routines for reading a raw binary output file from AMRClaw.
Note that there is no corresponding output option in PyClaw,
which is why there is no “write” function here (the code that
writes these files is in AMRClaw, in Fortran).
The result of a PyClaw simulation is a set of snapshots, or frames
of the solution. By default these are written to disk in a subdirectory
named _outdir. Writing of output files can be turned off by setting
@@ -121,9 +117,9 @@
It is sometimes desirable to output quantities other than those
in the vector q. To do so, just add a function p_function to
the controller that accepts the state and sets the derived quantities
in state.p
A gauge in PyClaw is a single grid location for which output is written at
every time step. This can be very useful in some applications, like comparing
with data from tidal gauges (from whence the name is derived) in tsunami modeling.
The gauges are managed by the grid object, and a grid at location \((x,y)\)
may be added simply by calling grid.add_gauges((x,y)). Multiple gauges
can be set at once by providing a list of coordinate tuples
By default, the solution values are written out at each gauge location.
To write some other quantity, simply provide a function
\(f(q,aux)\) and point the solver to it
By default, PyClaw prints a message to the screen each time it writes
an output file. This message is also writing to the file pyclaw.log
in the working directory. There are additional warning or error messages
@@ -266,6 +262,10 @@
PyClaw can be run in parallel on your desktop or on large supercomputers using the
PETSc library.
Running your PyClaw script in parallel is usually very easy; it mainly consists of
@@ -102,8 +99,8 @@
Navigation
Also, most of the provided scripts in pyclaw/examples are set up to run in parallel
simply by passing the command-line option use_petsc=True (of course, you will need
to launch them with mpirun.
Tips for making your application run correctly in parallel¶
+
+
+
Tips for making your application run correctly in parallel¶
Generally serial PyClaw code should “just work” in parallel, but if you are not
reasonably careful it is certainly possible to write serial code that will fail
in parallel.
@@ -246,7 +243,7 @@
Tips for making your application run correctly in parallel
The built-in applications (see Working with PyClaw’s built-in examples) are set up to automatically pass
-command-line options starting with a dash (“-”) to PETSc.
-
-
+command-line options starting with a dash (“-“) to PETSc.
+
PyClaw relies on the
VisClaw package for easy plotting, although
it is of course possible to load the output into other visualization packages.
@@ -96,8 +93,8 @@
Navigation
for now.
This page gives some very basic information; for more detail, see Plotting with Visclaw
in VisClaw’s documentation.
VisClaw includes routines for creating HTML and LaTex plot pages or plotting interactively.
These require a setplot.py file that defines the plotting parameters;
see Plotting options in Python.
@@ -105,34 +102,33 @@
By default, when running in parallel, PyClaw outputs data in a binary format.
In order to plot from such files, just replace pyclaw with petclaw in the
commands above; e.g.
Once you have initialized a Solution object, it contains a member state.q
whose first dimension is num_eqn and whose remaining dimensions are those
of the grid. Now you must set the initial condition. For instance
If the problem involves coefficients that vary in space or a mapped grid,
the required fields are stored in state.aux. In order to use such fields,
you must pass the num_aux argument to the State initialization
The number of fields in state.aux (i.e., the length of its first dimension)
is set equal to num_aux. The values of state.aux are set in the same way
as those of state.q.
The boundary conditions are specified through solver.bc_lower and
solver.bc_upper, each of which is a list of length solver.num_dim. The
ordering of the boundary conditions in each list is the same as the ordering of
@@ -173,7 +169,7 @@
The Riemann package has solvers for many hyperbolic systems. If your problem
involves a new system, you will need to write your own Riemann solver.
A nice example of how to compile and import your own Riemann solver can be seen
@@ -229,9 +225,9 @@
Generally you can just copy the Makefile from an example in pyclaw/examples and
replace the value of RP_SOURCES. Make sure the example you choose has the
same dimensionality. Also be sure to use the f-wave targets if your Riemann
solver is an f-wave solver.
This package contains all of the Python-based Riemann solvers. Each
module solves the Riemann solver for a particular system of hyperbolic
equations. The solvers all have a common function signature:
@@ -97,7 +93,7 @@
Navigation
with <name> replaced with the appropriate solver name and <dim> with
the appropriate dimension.
-
Input:
+
Input
q_l - (ndarray(…,num_eqn)) Contains the left states of the Riemann problem
q_r - (ndarray(…,num_eqn)) Contains the right states of the Riemann problem
@@ -110,7 +106,7 @@
Navigation
-
Output:
+
Output
wave - (ndarray(…,num_eqn,num_waves)) Contains the resulting waves from the cell
PyClaw Solution objects are containers for
State and Domain objects
that define an entire solution.
@@ -95,18 +92,20 @@
Navigation
The Domain is responsible for containing
the geometry of the Solution. The structure of a
solution may look something like the figure.
-
+
-
-
Pyclaw solution structure including a Domain,
+
Pyclaw solution structure including a Domain,
a set of Patch objects and corresponding
Dimension objects defining the solution’s
geometry and three State objects pointing to
the appropriate Patch with varying fields.¶
-
-
+
List of serial and parallel objects in a Solution class:
Input and output of solution objects is handle via the io package.
Solution contains the generic methods write(), read() and
plot() which then figure out the correct method to call. Please
see the io package for the particulars of each format and method and
the methods in this class for general input and output information.
-
Properties:
+
Properties
If there is only one state and patch belonging to this solution,
the solution will appear to have many of the attributes assigned to its
one state and patch. Some parameters that have in the past been
@@ -157,7 +156,7 @@
Navigation
-
Initialization:
+
Initialization
The initialization of a Solution can happen one of these ways
The Solution checks to make sure it is valid by checking each of its
states. If an invalid state is found, a message is logged what
specifically made this solution invalid.
Writes out a suitable representation of this solution object based on
the format requested. The path is built from the optional path and
file_prefix arguments. Will raise an IOError if unsuccessful.
-
Input:
+
Input
frame - (int) Frame number to append to the file output
path - (string) Root path, will try and create the path if it
@@ -293,32 +292,31 @@
The SharpClaw solvers are a collection of solvers that contain the
functionality of the Fortran code SharpClaw, developed in David Ketcheson’s
thesis. The 1D SharpClaw solver contains a pure Python implementation as
@@ -170,30 +166,30 @@
Navigation
about the methods and attributes they provide each class.
.. The inheritance structure is:
-
Example:
+
Example
This is a simple example of how to instantiate and evolve a solution to a
later time \(\text{t_end}\) using the 1D acoustics Riemann solver.
-
>>> fromclawpackimportpyclaw
+
>>> fromclawpackimportpyclaw>>> solver=pyclaw.SharpClawSolver1D()# Instantiate a default, 1d solver>>> solver.evolve_to_time(solution,t_end)# Evolve the solution to t_end
Implements Runge-Kutta time stepping and the basic form of a
semi-discrete step (the dq() function). If another method-of-lines
solver is implemented in the future, it should be based on this class,
which then ought to be renamed to something like “MOLSolver”.
Decide whether to accept or not the current step.
For Runge-Kutta methods the step is accepted if cfl <= cfl_max.
For SSPLMM32 the choice of step-size guarantees the cfl condition is satisfied for the steps the LMM
is used. Hence, we need to check the cfl condition only for the starting steps.
This routine checks the additional conditions for the 3rd-order SSPLMMs.
This is a posteriori check after a step is accepted.
In particular, there is a condition on the step size for the starting values and
@@ -351,42 +347,42 @@
Updates lists of saved function evaluations, solution values, dt and dtFE for LMMs.
For 3rd-order SSPLMM additional conditions are checked if self.check_lmm_cond is set to True.
If these conditions are violated, the step is rejected.
The pyclaw classic clawpack solvers are a collection of solvers that represent
the functionality of the older versions of clawpack. It comes in two forms, a
pure python version and a python wrapping of the fortran libraries. All of the
@@ -408,31 +404,31 @@
Limiter(s) to be used. Specified either as one value or a list.
If one value, the specified limiter is used for all wave families.
If a list, the specified values indicate which limiter to apply to
@@ -440,62 +436,62 @@
To allow better access to aux array data in the boundary condition functions
both the qbc and auxbc arrays are now passed to the custom boundary
condition functions. The new signature is
The fastest way to install the latest release of PyClaw is:
pipinstallclawpack
@@ -112,8 +109,8 @@
Navigation
To view the simulation output frames in sequence, simply press ‘enter’
repeatedly. To exit the shell, type ‘q’. For help, type ‘?’ or see
Plotting PyClaw results.
-
-
Dependencies: Python, gfortran, numpy, and matplotlib¶
+
+
Dependencies: Python, gfortran, numpy, and matplotlib¶
PyClaw requires Python 2.7 or greater and a modern Fortran 95
compiler. PyClaw is known to work with GNU gfortran 4.2 and higher and the IBM
XLF compiler.
@@ -131,25 +128,25 @@
Dependencies: Python, gfortran, numpy, and matplotlib
PyClaw is part of Clawpack, which includes several other
packages; see Clawpack components. Note that the
installation instructions above will install PyClaw,
Riemann and VisClaw. If you also wish to use AMRClaw or
GeoClaw, you should follow the more general Clawpack
Installing Clawpack.
The State object records the fields that exist on a given
Patch. These fields include q and aux. The
State also includes references to the
@@ -97,17 +94,17 @@
Navigation
are interested in the geometry of the local state you can find it through the
Patch object’s reference to its own
Grid.
-
-
A PyClaw State object contains the current state on a particular patch,
including the unknowns q, the time t, and the auxiliary coefficients aux.
The variables num_eqn and num_aux determine the length of the first
dimension of the q and aux arrays.
-
State Data:
+
State Data
The arrays q, and aux have variable
extents based on the patch dimensions and the values of
num_eqn and num_aux.
@@ -147,33 +144,33 @@
Navigation
Note that state.q and state.aux are initialized as empty arrays (not zeroed).
Additional parameters, such as scalar values that are used in the Riemann solver,
can be set using the dictionary state.problem_data.
Set the variables in fortran_module.cparam to the corresponding values in
patch.problem_data. This is the mechanism for passing scalar variables to the
Fortran Riemann solvers; cparam must be defined as a common block in the
@@ -213,124 +210,124 @@
We never communicate aux values; every processor should set its own ghost cell
values for the aux array. The global aux vector is used only for outputting
the aux values to file; everywhere else we use the local vector.
This page lists some of the most common difficulties encountered in
installing and running PyClaw. If you do not find a solution for your
problem here, please e-mail the
claw-users Google group.
You may also wish to consult the list of known issues.
By default, Numpy arrays use C-ordering. But the arrays that store the solution
and coefficients in PyClaw (i.e., q and aux) must be initialized using Fortran
ordering, for compatibility with the Fortran routines and PETSc. Ordinarily,
this is handled automatically when you create a State or Solution object.
If you are manually creating arrays, be sure to pass the flag ‘F’ to specify
Fortran ordering.
When installing Clawpack, if you get an error message saying that
lblas or llapack is not found, please update your installation of Numpy
to at least version 1.8. You can do this via:
Next we set the boundary conditions. We’ll use a wall (wall)
condition at the left boundary and a non-wall (zero-order extrapolation)
condition at the right boundary
Next we need to set up the grid. We do so by defining the
physical domain and the computational resolution. We’ll
use the interval \((-1,1)\) and 200 grid cells:
-
>>> domain=pyclaw.Domain([-1.0],[1.0],[200])
+
>>> domain=pyclaw.Domain([-1.0],[1.0],[200])
Notice that the calling sequence is similar to numpy’s linspace command.
Finally, we set up a Solution
object, which will hold the solution values:
The acoustics equations above have some coefficients – namely, the
bulk modulus \(K\) and density \(\rho\) – that must be defined.
Furthermore, checking the code for the Riemann solver we’ve chosen
reveals that it expects us to provide values for the impedance \(Z\)
and sound speed \(c\). These values are stored in a Python dictionary
called problem_data that is a member of the State
The most convenient way to run a PyClaw simulation is by using a
Controller object. The controller
directs the solver in advancing the solution and handles output.
At last everything is set up! Now run the simulation
-
>>> status=controller.run()
+
>>> status=controller.run()
This should print out a few lines indicating the output times. It also prints
the minimum and maximum tipe-step used, the number of steps required for the
computation and the maximum CFL number. The simplest way to plot the solution
is
Simple frame counter to keep track of current frame number. This can
also be used to keep multiple runs frames separated by having multiple
counters at once.
Compiles and wraps fortran source into a callable module in python.
This function uses f2py to create an interface from python to the fortran
sources in source_list. The source_list can either be a list of names
@@ -168,7 +165,7 @@
source_list - (list of strings) List of source files, if these are
just names of the source files, i.e. ‘bc1.f’ then they will be searched
@@ -198,14 +195,14 @@
Generator of runnable variants of a test application given a verifier
Given an application, a script for verifying its output, and a
list of kernel languages to try, generates all possible variants of the
@@ -246,9 +243,9 @@
Navigation
All unrecognized keyword arguments are passed through to the application.
Runs an application from pyclaw/examples/, automatically parsing command line keyword
arguments (key=value) as parameters to the application, with positional
arguments being passed to PETSc (if it is enabled).
Decorates a function to only run serially, even if called in parallel.
In a parallel communicator, the first process will run while the remaining processes
block on a barrier. In a serial run, the function will be called directly.
As of Clawpack v5.7.0 we are no longer supporting Python 2.7, and
Python 3.x is expected, see v5.7.0 release notes. At this point we
believe v5.7.0 still works with Python 2.7, but we are phasing out
@@ -106,9 +103,9 @@
Navigation
functions, but there are a few other changes. See e.g.,
https://docs.python.org/3/howto/pyporting.html
and other online resources discussing the differences between Python 2 and 3.
-
-
-
For use with Clawpack, you will need the Numpy module (Numerical Python)
that allows working with arrays in much the same way as in Matlab.
This is distributed as part of
@@ -127,18 +124,17 @@
When using PyClaw or other Python tools from Clawpack (e.g. the
visualization tools in VisClaw or Python tools for working with topo and dtopo from GeoClaw), you need
to be able to import various modules.
@@ -86,8 +83,8 @@
Navigation
Below are some hints in case you run into problems with import statements
with modules not being found, or being imported from the wrong version of
Clawpack (if you have more than one on your computer).
The script $CLAW/clawutil/src/python/clawutil/whichclaw.py may be useful in
debugging paths. It prints out information on how various paths and environment
variables are set. (Available starting in Version 5.4.0.)
@@ -113,9 +110,9 @@
Navigation
Beware if there seems to be a conflict (e.g. between where the CLAW
environment variable points and where Python imports from).
See below for more about sys.path and easy-install.pth files.
If you used pip to install Clawpack (following pip install instructions),
then the path to the installed version will may be added to the file
easy-install.pth located in the site-packages directory. If you want
@@ -217,9 +214,9 @@
In GeoClaw, there is a library routine that
sets the surface elevation to sea level by default, and also has the option
of adding a perturbation as specified in the setrun file, see
@@ -98,11 +95,10 @@
Several parameters controlling refinement can be set in the setrun
function. See Specifying AMRClaw run-time parameters in setrun.py for further description of these.
Many of the parameters discussed below are attributes of rundata.amrdata
@@ -120,16 +116,16 @@
Navigation
tradeoff. At least this fraction of the fine grid cells should result from
coarse cells that were flagged as needing refinement. The value
clustering_cutoff = 0.7 is usually reasonable.
-
-
Two possible approaches to flagging individual
cells for refinement (based on the behavior of the solution) are built into
AMRClaw. (A different default approach is used in GeoClaw, see
Flagging criteria in GeoClaw).
One approach to flagging cells for refinement (the default used in
most examples) is to set flag2refine == True and specify
a tolerance flag2refine_tol. This indicates that the
@@ -146,9 +142,9 @@
Navigation
modifying this routine – best done by copying the library routine to your
application directory and modifying the Makefile to point to the modified
version.
-
-
-
The second approach to flagging individual cells is based on using Richardson
extrapolation to estimate the error in each cell. This is used if
flag_richardson == True. In this case a cell is flagged if the error
@@ -165,10 +161,10 @@
Navigation
flag2refine == True and flag_richardson == True
then a cell will be flagged if either of the corresponding specified
tolerances is exceeded.
-
-
-
-
New in Version 5.7.0: Although the regions described here are still
supported in v5.7.0, a more general form of Specifying flagregions for adaptive refinement
are also now supported and are recommended in general rather than
@@ -228,9 +224,9 @@
Navigation
Points that are not covered by either region are not constrained by the
regions at all. With amr_levels_max = 6 then they might
be refined to any level from 1 to 6 depending on the error flagging criteria.
It is perhaps easiest to understand how this works by summarizing
the implementation. Note the order in which different flagging
criteria are checked was modified in Version 5.5.0 in order to avoid
@@ -278,9 +274,9 @@
In GeoClaw, a special flag2refine subroutine is defined.
A standard approach for modeling tsunamis propagating across the ocean
is to refine anywhere that the surface elevation of the ocean \(\eta =
@@ -298,11 +294,10 @@
Clawpack includes a number of tests that can be used to check for a working
installation or to see whether new changes to the code have broken anything.
If you use multiple git branches, before running the tests you should check that
you have checked out appropriate branches of all relevant repositories; see Keeping track of repository versions with Git.
A few quick tests can be perfomed of the classic, amrclaw, or geoclaw
codes by running make tests in the corresponding tests subdirectory, e.g.:
cd $CLAW/classic/tests
@@ -136,9 +133,9 @@
Fortran codesClawpack Gallery. An attempt at automating this
can be found in the $CLAW/amrclaw/examples directory, which uses the
imagediff tool described below. This is still under development.
-
-
-
Most Clawpack git repositories now contain a file .travis.yml at the top
level so that every time a pull request is issued on Github, a basic set of
tests is run. This uses the Travis continuous integration platform. Shortly after a PR is issued, Travis
@@ -146,12 +143,12 @@
chardiff tool for line-by-line comparison of output files¶
If _output_old and _output_new are two sets of output files from old and
new versions of a code, then it is often useful to do a line by line
comparison of all of the files in each directory and display any
@@ -166,9 +163,9 @@
chardiff tool for line-by-line comparison of output files
-
If _plots_old and _plots_new contain two sets of plots that we hope are
identical, the Python script
$CLAW/clawutil/src/python/clawutil/imagediff.py can be used to compare
@@ -182,12 +179,12 @@
The PyClaw test suite is built around nosetests for automatic test discovery, with
supplementary functionality from the pyclaw.util module. To run the
complete test suite with helpful output, issue the following command at the
@@ -204,9 +201,9 @@
The PyClaw tests are associated with particular applications in the examples/ sub-
directory of the primary repository directory. If you want to run tests for a
specific application, simply specify the directory containing the application
@@ -227,9 +224,9 @@
Running a specific test
You can also specify a single file to run the tests it contains.
If you contribute new functionality to PyClaw, it is expected that you will also
write at least one or two new tests that exercise your contribution, so that
further changes to other parts of PyClaw or your code don’t break your feature.
Clawpack 5.0 is a major reorganization of the Clawpack code base that has
been going on for several years. See Changes in Clawpack 5.0 for an overview of
many of the major changes.
-
-
Changes to classic, riemann, amrclaw, geoclaw, visclaw¶
+
+
Changes to classic, riemann, amrclaw, geoclaw, visclaw¶
Fixed problem when a single time is specified in dtopo file and dtdtopo(m) = 0.
The example in $CLAW/geoclaw/apps/tsunami/chile2010 was modified in 5.2.1
@@ -126,16 +123,15 @@
Bug in 3d dimensional splitting fixed — the CFL was computed incorrectly,
causing the code to use timesteps that are too large and go
unstable in some cases.
Python 3 compatibility. Python code in all repositories has been updated so
that it should work with either Python 2 or Python 3. In particular the
statements:
@@ -147,15 +144,15 @@
Navigation
Updated regression testing framework for Fortran.
The Fortran code uses an updated framework and so the regression data has
changed.
Parallel Plotting in setplot.py.
A new capability has been added to plot multiple frames at once on
a multicore machine when doing make plots (i.e. not interactive).
@@ -196,9 +193,9 @@
Changes to Riemann solver. The default Riemann solver used
for single-layer shallow water equations was modified, causing potential
changes to computed results. See the discussion above, under
@@ -267,18 +264,17 @@
The documentation repository https://github.com/clawpack/doc has been refactored so that versioning is now supported. On the menu to the left of the Clawpack documentation pages, at the bottom you should see links to select previous versions of the documentation, in particular v5.4.0 and some earlier versions. The master version points to the current master branch of the doc repository used to build the documentation.
If you switch to different version of a page, use the back button to return to the version for the current release, or click on the Clawpack logo to get back to this version. If you click on the master version most things will work but links to gallery pages will not (due to the way relative paths are specified since inter-sphinx is now used for different projects in the main docs and the gallery). Old versions of the gallery are not available.
The major new addition is 1d amrclaw code in the src/1d directory and
some examples in the examples directory. (Also regression tests in tests).
These examples have also been added to the gallery at www.clawpack.org.
@@ -133,9 +130,9 @@
For developers: There is no longer a master branch in the
clawpack/doc repository.
Use branch v5.5.0 for updates to current documentation and the dev branch
for developing documentation for changes or new features that are in the
master branch of the code repositories but are not yet in an official
release.
A gpu branch has been added to many git repositories, and checking this out
gives a GPU version of two-dimensional AmrClaw and GeoClaw, as described at
Using the GPU version of Clawpack. This version does not have equivalent capabilities to v5.6.1,
however, and is not included as part of the tar file for this release.
Improvements to plot_timing_stats.py to create plots of CPU time and wall
time used in a simulation, and number of cells updated.
For some examples of the output, see http://staff.washington.edu/rjl/misc/timing_plots/
As of v5.7.0 we are no longer supporting Python 2.7, and Python 3.x is
expected. At this point we believe v5.7.0 still works with Python 2.7, but
we are phasing out testing this in the future.
Support for particle tracking via “Lagrangian gauges” has been added to
amrclaw, but this capability itself has so far only been added to geoclaw,
@@ -124,14 +121,14 @@
For AMRClaw and GeoClaw, the data file amr.data now created from
setrun.py now includes an additional line with the parameter memsize
@@ -108,31 +105,31 @@
ClawPlotAxes.skip_patches_outside_xylimits does not work properly if there
is a mapc2p function defining a grid mapping, so it is now ignored in
this case.
An additional short array is saved in a checkpoint file for use in a
restart. Due to this change, a checkpoint file created using a previous
@@ -165,9 +162,9 @@
Several changes were made to fix long-standing bugs. These fixes lead to
slightly different results than those obtained with previous versions of
GeoClaw. In all the tests performed so far the changes are minor and it is
@@ -234,15 +231,15 @@
Changes relative to Clawpack 5.8.2 (December 14, 2021) are shown below.
@@ -91,11 +88,11 @@
Navigation
To see documentation that has already been developed to accompany any new
features listed below, click on the “dev” branch of the documentation, in
the menu on the left hand side of this page.
Gauge output in amrclaw and geoclaw can also now be specified as
-‘ascii’, ‘binary64’, or ‘binary32’,
-see http://www.clawpack.org/gauges.html for instructions.
+‘ascii’, ‘binary64’, or ‘binary32’; see Gauges for instructions.
Adding support for ‘binary32’ required changes in the pyclaw, clawutil
and visclaw repositories as well.
A new fgout capability was added to geoclaw (see below and Fixed grid output),
which also required additional changes to other repositories.
pcolor plots are now rasterized by default, which greatly reduces the
file size in some cases. When e.g. savefig(‘filename.svg’) is used
the labels are still vector graphics but the flow field is rasterized.
Passing the option pcolor_kwargs = {“rasterized”:False} in setplot
-turns this off. See <https://github.com/clawpack/visclaw/pull/286>.
Support for reading fgout frames added, by passing the parameter
file_prefix more consistently (which can be e.g. fgout rather than
@@ -199,10 +195,10 @@
Before downloading a tar file, please click on the Install tab or visit
Installing Clawpack for installation instructions. You may want to use
pip install or some other mechanism rather than the tar file.
In this section clawdata refers to the rundata.clawdata attribute
of an object of class ClawRunData, as is generally set at the top
of a setrun.py file.
@@ -104,9 +101,9 @@
Navigation
fort.chkNNNNN (a large binary file) where NNNNN is the
step number on the coarsest level. These files containt all the information
needed to restart the computation at this point.
-
-
-
New in 5.4.0. It is no longer necessary to set the Makefile variable
RESTART to True or False. Instead you can set it to None (or omit
setting it at all, since this is the default), in which case the setrun.py
file will be used to determine if this is a restart run (in which case
the previous output directory should be added to, rather than replaced).
After running the restarted computation,
the original set of output files should still be in the output directory
along with a new set from the second run. Note that one output time may
@@ -163,11 +160,10 @@
Navigation
for this. If multiple restarts are performed from the same checkpoint
file then gauge data will accumulate in an undesirable fashion, but
for most purposes this does the right thing.
-
-
+
The Riemann solver defines the hyperbolic equation that is being solved and
does the bulk of the computational work – it is called at every cell
interface at every time step and returns the information about waves and speeds
@@ -97,8 +93,8 @@
Navigation
See also the new book Riemann Problems and Jupyter Solutions (SIAM, 2020),
which consists of a set of Jupyter notebooks illustrating
the basic concepts of Riemann problems and approximate solvers.
Understanding the 1-dimensional solver is a critical first step since in 2
or 3 dimensions the bulk of the work is done by a “normal solver” that
solves a 1-dimensional Riemann problem normal to each cell edge. In multiple
@@ -174,9 +170,9 @@
Most of the solvers available are written (as described above) in vectorized
form, meaning that there is a loop over a 1-dimensional slice of the grid
inside the Riemann solver itself. This used to be necessary in order to get
@@ -214,9 +210,9 @@
As described in f-wave formulation, for spatially-varying flux functions it is
often best to use the f-wave formulation of the wave-propagation algorithms.
This can be implemented in Clawpack by providing a
@@ -234,9 +230,9 @@
In two dimensions, all Clawpack algorithms require a normal Riemann
solver, that solves a one-dimensional (planar) Riemann problem in the
direction normal to a cell interface. Some Clawpack algorithms also
@@ -262,9 +258,9 @@
Navigation
parameter ixy is used to indicate whether the solver is sweeping in the
x direction (ixy=1) or the y direction (ixy=2).
If you have developed a new Riemann solver, please let us know!
We’d love to include it in the Clawpack Riemann repository so that
others can make use of it. You can simply send us a note on the
@@ -294,11 +290,10 @@
A wide range of shallow water (SW) solvers are available in
clawpack.riemann. Here’s a brief description of each. For each one,
we have indicated (after “Fortran:”) the files you should compile to use
@@ -94,8 +90,8 @@
Navigation
from to use it in Python. If a pure-Python implementation is available,
we also indicate that. Finally, we include links to examples that use
each solver.
-
-
In past versions of AMRClaw and GeoClaw, one could specify “refinement
@@ -140,8 +136,8 @@
Navigation
edges. Also for some applications we want the Ruled Rectangle to exactly
cover a contiguous set of finite volume grid cells, which has the shape
of a set of stacked boxes.
-
-
Note that the polygons above are not convex, but clearly some Ruled
Rectangles would be convex. Conversely, any convex polygon can be
expressed as a Ruled Rectangle — simply order the vertices so that the
@@ -227,11 +223,11 @@
If the points s[k] are equally spaced then ds is the spacing
between them. This makes it quicker to determine what two points an
arbitrary value of \(s\) lies between when determining whether a
@@ -245,9 +241,9 @@
Rather than specifying s, lower, and upper separately, you
can specify an array slu with three columns in defining a
RuledRectangle, and such an array is returned by the slu method:
If X,Y are 2D numpy arrays defining (x,y) coordinates on a grid,
then rr.mask_outside(X,Y) returns a mask array M of the same
shape as X,Y that is True at points outside the Ruled Rectangle.
rr.write(fname) writes out the slu array and other attributes to
file fname, and rr.read(fname) can be used to read in such a
file. You can also specify fname when instantiating a new Ruled
@@ -358,17 +354,17 @@
rr.make_kml() can be used to create a kml file that can be opened on
Google Earth to show the polygon defined by rr. This assumes that
x corresponds to longitude and y to latitude and is designed for
GeoClaw applications. Several optional arguments can be specified:
fname, name, color, width, verbose.
The figure below shows a Ruled Rectangle designed to cover Admiralty
Inlet, the water way between the Kitsap Peninsula and Whidbey Island
connecting the Strait of Juan de Fuca to lower Puget Sound. For some
@@ -403,10 +399,10 @@
Defining a Ruled Rectangle covering selected cells¶
+
+
+
Defining a Ruled Rectangle covering selected cells¶
The module function
region_tools.ruledrectangle_covering_selected_points can be used to
generate a Ruled Rectangle that covers a specified set of points as
@@ -451,7 +447,7 @@
The figure below shows a Ruled Rectangle that roughly covers the
continental shelf offshore of Vancouver Island and Washington state. The
region may need to be refined to a higher level than the deeper ocean in
@@ -545,12 +541,11 @@
Set Eta Init – spatially varying initial surface elevation¶
+
+
Set Eta Init – spatially varying initial surface elevation¶
Prior to Version 5.7.0,
GeoClaw had a single scalar parameter sea_level and the water
surface is initialized to this value in every cell where the GeoClaw
@@ -102,8 +99,8 @@
Navigation
rundata.qinit_data.variable_eta_init=True
-
-
Default behavior, adjusting sea level by seismic deformation¶
+
+
Default behavior, adjusting sea level by seismic deformation¶
The default library routine
$CLAW/geoclaw/src/2d/shallow/set_eta_init.f90
is set up for the use case in which a region subsides or is uplifted by a
@@ -154,9 +151,9 @@
Default behavior, adjusting sea level by seismic deformation
-
For other uses one can copy the library routine
$CLAW/geoclaw/src/2d/shallow/set_eta_init.f90
to the application directory and modify it as desired (and change the
@@ -174,11 +171,10 @@
Below are links to the default setaux library routines for Classic and AMRClaw.
By default these do nothing. If you wish to specify aux arrays you will
need to copy one of these files to your application directory and modify it
@@ -89,8 +86,8 @@
Navigation
(Note: these links are for the version checked in to the master branch.
You can select a different branch or tag from the GitHub page.)
In GeoClaw, there is a library routine that sets aux(1,i,j) to the cell
average of the bathymetry, aux(2,i,j) to the ratio of the true cell area
to dx*dy (the capacity function), and aux(3,i,j) to the length ratio of
@@ -99,11 +96,10 @@
To use the Fortran versions of Clawpack you will need to set the
environment variable CLAW to point to the top level of clawpack tree
(there is no need to perform this step if you will only use PyClaw).
@@ -97,9 +94,9 @@
If you used pip to install Clawpack then you should not set this
environment variable. But if you installed without pip, e.g. following
Options for installing Clawpack Fortran codes, then you need to set PYTHONPATH to include
@@ -131,11 +128,10 @@
The desired plots are specified by creating an object
of class ClawPlotData that contains specifications of what figures should be
created, and within each figure what sets of axes should be drawn, and
within each axes what items should be plotted (lines, contour plots,
etc.).
The approach outlined below may seem more complicated than necessary, and it
would be if all you ever want to do is plot one set of data at each output
time. However, when adaptive mesh refinement is used each frame of data may
@@ -202,11 +195,10 @@
The parameters needed in 1 space dimension (ndim=1) are described. In 2d
and 3d there are analogous parameters in y and z required, as mentioned
below.
-
-
-num_dim:integerfrom[1,2,3]
+
+
+num_dim : integer from [1,2,3]
number of space dimensions.
-
-
-lower:listoffloats
+
+
+lower : list of floats
lower limits in the x, [y,z] directions.
-
-
-upper:listoffloats
+
+
+upper : list of floats
upper limits in the x, [y ,z] directions.
-
-
-num_cells:listofintegers
+
+
+num_cells : list of integers
The number of grid cells in the x, [y, ,z] directions.
Note that when AMR is used, num_cells determines the number of cells in
each dimension on the coarsest Level 1 grid. Additional parameters
described below determine refinement ratios to finer levels.
-
-
-num_eqn:integer
+
+
+num_eqn : integer
Number of equations in the system (e.g. num_eqn=1 for a scalar problem).
-
-
-num_aux:integer
+
+
+num_aux : integer
Number of auxiliary variables in the aux array (initialized in setaux.f)
-
-
-capa_index:integer
+
+
+capa_index : integer
Index of aux array corresponding to capacity function, if there is one.
-
-
-t0:float
+
+
+t0 : float
Initial time, often t0 = 0.
-
-
-restart:boolean
+
+
+restart : boolean
Currently only available in amrclaw and geoclaw.
Set True to restart a previous computation. To use this option,
see Checkpointing and restarting. Note that a change in the Makefile is also
required.
-
-
-restart_file:str
+
+
+restart_file : str
If restart == True then this should be the name of the checkpoint
file containing all the information needed to do a restart. This will
generally be of the form fort.chkNNNNN where NNNNN is the (coarse
@@ -192,9 +189,9 @@
There are three possible ways to specify the output
times. This parameter selects the desired manner to specify the times,
and affects what other attributes are required.
If True, the Riemann solvers should return f-waves (a decomposition of
the the flux difference) rather than the usual waves (which give
a decomposition of the jump in Q between adjacent states).
@@ -408,9 +405,9 @@
+source_split : list of int or str, of length num_waves
Determines form of fractional step algorithm used to apply source terms
(if any). Source terms must be implemented by providing a subroutine
srcN.f (in N space dimensions) that is called each time step
@@ -431,16 +428,16 @@
Example: If num_cells[0] = 10 and refinement_ratios_x = [2,4]
then the Level 1 grid will have 10 cells in the x-direction,
@@ -136,15 +133,15 @@
Special AMR parameters
-
-
-refinement_ratios_y:listofint
+
+
+refinement_ratios_y : list of int
Refinement ratios to use in the y direction.
-
-
-refinement_ratios_t:listofint
+
+
+refinement_ratios_t : list of int
Refinement ratios to use in time. For an explicit method, maintaining
the Courant number usually requires refining in time by the same factor as
in space (or the maximum of the refinement ratio in the different space
@@ -154,9 +151,9 @@
Special AMR parameters
-
-
-aux_type:listofstr,oflengthnum_aux
+
+
+aux_type : list of str, of length num_aux
Specifies the type of variable stored in each aux variable.
These are used when coarsening aux arrays. Each
element can be one of the following (but at most one can be ‘capacity’):
@@ -170,9 +167,9 @@
Special AMR parameters
-
-
-flag_richardson:boolean
+
+
+flag_richardson : boolean
Determines whether Richardson extrapolation will be used as an error
estimator. If True, patches will be coarsened by a factor of 2 each
time regridding is done and the result from a single step on the
@@ -180,24 +177,24 @@
Special AMR parameters
-
-
-flag_richardson_tol:float
+
+
+flag_richardson_tol : float
When flag_richardson == True, cells will be flagged for refinement
if the absolute value of the estimated error exceeds this value.
When flag_richardson == False, this value is not used.
-
-
-flag2refine:boolean
+
+
+flag2refine : boolean
Determines whether the subroutine flag2refine is used to flag cells
for refinement.
-
-
-flag2refine_tol:float
+
+
+flag2refine_tol : float
When flag2refine == True, the default library version flag2refine.f
checks the maximum absolute value of the difference between any component
of q in this cell with the corresponding component in any of the
@@ -205,16 +202,16 @@
Special AMR parameters
-
-
-regrid_interval:int
+
+
+regrid_interval : int
The number of time steps to take on each level between regridding to the
next finer level.
-
-
-regrid_buffer_width:int
+
+
+regrid_buffer_width : int
The number of points to flag for refining around any point flagged by
error estimation or flag2refine. This buffer zone is to insure that
waves do not leave the refined region before the next regridding and so
@@ -223,9 +220,9 @@
Special AMR parameters
-
-
-clustering_cutoff:floatbetween0and1
+
+
+clustering_cutoff : float between 0 and 1
Cut-off used in clustering flagged points into rectangular patches for
refinement. Clusters are chosen to minimize the number of patches
subject to the constraint:
Additional information is printed to the terminal each time regridding is
done at this level or coarser. Set to 0 to suppress regridding output.
-
-
-regions:list
+
+
+regions : list
List of lists of the form
[minlevel,maxlevel,t1,t2,x1,x2,y1,y2].
See Specifying AMR regions.
@@ -254,9 +251,9 @@
Special AMR parameters
-
-
-flagregions:list
+
+
+flagregions : list
(Introduced in v5.7.0)
List of objects of class clawpack.amrclaw.data.FlagRegion that specify
regions where further adaptive refinement is either forced or forbiddne.
@@ -264,9 +261,9 @@
The maximum size (in each spatial dimension) of any grid patch. If
a larger region must be refined then it it split into multiple patches.
This can be tuned if desired based on cache size and OMP efficiency
@@ -275,9 +272,9 @@
Special AMR parameters
-
-
-memsize:int
+
+
+memsize : int
The initial length of the alloc array used internally in AMRClaw for
dynamic allocation of grid patch data. The default values depend on
the number of space dimensions and may be large enough. If the
@@ -297,76 +294,75 @@
In addition to the standard AMRClaw parameters described in
Specifying AMRClaw run-time parameters in setrun.py, some additional parameters governing how refinement
is done should be specified for GeoClaw applications:
rundata.geo_data has the following additional attributes:
-
-
-rundata.geo_data.gravity:float
+
+
+rundata.geo_data.gravity : float
gravitational constant in m/s**2, e.g. gravity = 9.81.
-
-
-rundata.geo_data.coordinate_system:integer
+
+
+rundata.geo_data.coordinate_system : integer
coordinate_system = 1 for Cartesian x-y in meters,
coordinate_system = 2 for latitude-longitude on the sphere.
-
-
-rundata.geo_data.earth_radius:float
+
+
+rundata.geo_data.earth_radius : float
radius of the earth in meters, e.g. earth_radius = 6367.5e3.
-
-
-rundata.geo_data.coriolis_forcing:bool
+
+
+rundata.geo_data.coriolis_forcing : bool
coriolis_forcing = True to include Coriolis terms in momentum equations
coriolis_forcing = False to omit Coriolis terms (usually fine for tsunami modeling)
-
-
-rundata.geo_data.sea_level:float
+
+
+rundata.geo_data.sea_level : float
sea level (often sea_level = 0.)
This is relative to the 0 vertical datum of the topography files used.
It is important to set this properly for tsunami applications, see
Setting sea_level.
-
-
-rundata.geo_data.friction_forcing:bool
+
+
+rundata.geo_data.friction_forcing : bool
Whether to apply friction source terms in momentum equations.
See Manning friction term for more discussion of the next three parameters.
-
-
-rundata.geo_data.friction_depth:float
+
+
+rundata.geo_data.friction_depth : float
Friction source terms are only applied in water shallower than this,
i.e. if h < friction_depth,
assuming they have negligible effect in deeper water.
+rundata.geo_data.manning_coefficient : float or list of floats
For friction source terms, the Manning coefficient. If a single value
is given, this value will be used where ever h < friction_depth.
If a list of values is given, then the next parameter delineates the
regions where each is used based on values of the topography B.
-
-
-rundata.geo_data.manning_break:listoffloats
+
+
+rundata.geo_data.manning_break : list of floats
If manning_coefficient is a list of length N, then this should be a
monotonically increasing list
of length N-1 giving break points in the topo B used to determine where
@@ -225,14 +222,14 @@
+rundata.fgmax_grids : list of clawpack.geoclaw.fgmax_tools.FGoutGrid
+
+objects.
This can be used to specify a set of grids on which to monitor the
maximum flow depth (or other quantities) observed over the course of
the computation, and/or the arrival time of the flow or wave.
Includes the wind forcing term if True. The drag coefficient is specified
by rundata.surge_data.drag_law.
-
-
-rundata.surge_data.drag_law:integer
+
+
+rundata.surge_data.drag_law : integer
This specifies how to deterimine the wind drag coefficient. Valid options
include include 0 implying use no wind drag (effectively eliminates the
wind source term but still computes the wind), 1 uses the Garret wind
drag law, and 2 uses the Powell (2006) wind drag law.
-
-
-rundata.surge_data.pressure_forcing:bool
+
+
+rundata.surge_data.pressure_forcing : bool
Includes the pressure forcing term if True.
-
-
-rundata.surge_data.wind_index:int
+
+
+rundata.surge_data.wind_index : int
Specifies at what index into the aux array the wind velocities are stored.
Note that this is Python indexed in the setrun but will be corrected in the
FORTRAN code (1 is added to the index).
-
-
-rundata.surge_data.pressure_index:int
+
+
+rundata.surge_data.pressure_index : int
Specifies at what index into the aux array the wind velocities are stored.
Note that this is Python indexed in the setrun but will be corrected in the
FORTRAN code (1 is added to the index).
-
-
-rundata.surge_data.display_landfall_time:bool
+
+
+rundata.surge_data.display_landfall_time : bool
Sets whether the console output displays time relative to land fall in days.
In GeoClaw versions past 5.5 this only deterimines whether the time is
displayed in seconds or days.
-
-
-rundata.surge_data.wind_refine:list
+
+
+rundata.surge_data.wind_refine : list
Similar to the speed_tolerance data, cells are flagged for refinement at
a level if the magnitude of the wind velocity in m/s is greater than the
corresponding value in the list. For
@@ -533,17 +530,17 @@
Clawpack now includes some tools to help facilitate archiving and sharing
results that you have obtained with this software.
These make it relatively easy to generate
@@ -94,33 +91,32 @@
Navigation
These webpages can easily be posted on your own website to be viewed by
others if you wish, for example to share on-going work with collaborators or
to supplement a journal article.
The “make .plots” option available via the standard Makefiles will create a
set of webpages illustrating the plots and allowing easy navigation between
frames. These webpages also allow viewing all frames of a plot as an
animation (via javascript within the browser).
See Plotting with Visclaw for more details on how to specify what plots will
appear on these webpages.
To make it easy for others to view your code and the resulting plots, you
can simply copy the example directory (containing the code
and the _plots subdirectory) to your publicly visible web pages.
You should also consider creating an Jupyter notebook to explain your
problem, illustrate your workflow, and present plots and animations all in
one. See the
Gallery of Notebooks
for some examples.
For most users, the best way to view the documentation is
online.
The source files that create this documentation are included in the
repository
clawpack/doc repository in $CLAW/doc/doc.
See Guide for updating this documentation if you want to create and view them locally.
In GeoClaw, there is a library routine to impose source terms for bottom
friction (via a Manning term) and Coriolis terms. The topography source term
is built into the Riemann solver in a manner that achieves well balancing
@@ -99,11 +96,10 @@
Below are links to the default src library routines for Classic and AMRClaw.
By default these do nothing. If you wish to specify source terms, you
@@ -92,8 +89,8 @@
Navigation
(Note: these links are for the version checked in to the master branch.
You can select a different branch or tag from the GitHub page.)
In GeoClaw, there is a library routine to impose source terms for bottom
friction (via a Manning term) and Coriolis terms. The topography source term
is built into the Riemann solver in a manner that achieves well balancing
@@ -101,11 +98,10 @@
This object contains a time series of time data that describe a particular
storm. This includes the attributes below and the ability to read from
@@ -136,7 +133,7 @@
Navigation
surge simulations.
TODO: Add description of unit handling
-
Attributes:
+
Attributes
t (list(datetime.datetiem)) Contains the time at which each entry of
the other arrays are at. These are expected to be datetime objects.
@@ -159,14 +156,14 @@
Navigation
and meters.
-
Initialization:
+
Initialization
Read in existing file at path.
Construct an empty storm and supply the fields needed. Note that these
fields must be converted to the appropriate units.
-
Input:
+
Input
path (string) Path to file to be read in if requested.
file_format (string) Format of file at path. Default is “hurdat”
This is the current version of HURDAT data available (HURDAT 2). Note
that this assumes there is only one storm in the file (includes the
@@ -300,13 +297,13 @@
Navigation
For more details on the HURDAT format and getting data see
This reads in the netcdf-formatted IBTrACS v4 data. You must either pass
the sid of the storm (a unique identifier supplied by IBTrACS) OR
@@ -329,7 +326,7 @@
Navigation
still missing, the other agencies are checked in order of agency_pref to
see if any more non-missing values are available.
-
Input:
+
Input
path (string) Path to the file to be read.
@@ -362,7 +359,7 @@
Navigation
-
Raises:
+
Raises
ValueError If the method cannot find the matching storm then a
Construct a string suitable for listing available storm models.
-
-
-clawpack.geoclaw.surge.storm.fill_rad_w_other_source(t, storm_targ, storm_fill, var, interp_kwargs={})¶
+
+
+clawpack.geoclaw.surge.storm.fill_rad_w_other_source(t, storm_targ, storm_fill, var, interp_kwargs={})¶
Fill in storm radius variable (max_wind_radius or storm_radius) with values from another source. i.e.
if you have missing radii in IBTrACS, you can fill with ATCF.
This function will assume storm_fill has more non-missing
@@ -585,13 +582,13 @@
Navigation
with (t, storm) arguments to max_wind_radius_fill or
storm_radius_fill when calling write_geoclaw.
For storm surge computations the input data is very similar to tsunamis save
for the specification of the forcing storm (as opposed to an earthquake). There
are multiple ways to specify a storm forcing in GeoClaw which include
@@ -118,10 +115,9 @@
Navigation
Note that not all these formats are currently fully supported and may require some work
to be readable.
The amrclaw and geoclaw Fortran codes provide some timing information at the
end of a run (and also stored at the end of the file fort.amr in the output
directory).
@@ -130,10 +127,9 @@
Navigation
Regridding and output are done in serial mode, however, so the wall time for
these portions agree with the CPU time.
modeling), it is generally assumed that sea_level = 0 has been set in
Specifying GeoClaw parameters in setrun.py and that z<0 corresponds to subsurface bathymetry
and z>0 to topograpy above sea level.
-
-
Topofiles can be read in netCDF format, either from local .nc files or
from some online databases that provide netCDF servers, e.g. the
NOAA THREDDS server.
@@ -307,10 +304,10 @@
Navigation
data points are generally interpreted as pointwise values at the points
specified in the lat and lon arrays included in the file (or as
cell-averaged values with these points as the cell centers).
-
-
-
-
For tsunami generation a file dtopo is generally used to specify the
displacement of the topography relative to that specified in the topo files.
Currently two formats are supported for this file:
@@ -336,9 +333,9 @@
Navigation
there is a new parameter that can be specified in setrun.py
to limit the size time step used during the time when topography is moving.
See Topography data file parameters.
-
-
-
Instead of (or in addition to) specifying a displacement of the topography
it is possible to specify a perturbation to the depth, momentum, or surface
elevation of the initial data. This is generally useful only for tsunami
@@ -356,11 +353,10 @@
Navigation
qinit data file parameters). If qinit_type = 4, the value dq is instead the
surface elevation desired for the initial data and the depth h (first
component of q) is set accordingly.
-
-
+
topotools module for working with topography data¶
+
+
topotools module for working with topography data¶
See also
@@ -101,18 +98,18 @@
Navigation
The file $CLAW/geoclaw/tests/test_topotools.py contains some tests of these
tools. Looking at these test routines may also give some ideas on
how to use them.
-
-
Documentation auto-generated from the module docstrings¶
+
+
Documentation auto-generated from the module docstrings¶
Mask points (x,y) that are not in the specified polygon.
Uses simple ray casting algorithm for speed so beware of corner cases!
-
Input:
+
Input
polygon (list) List of points that comprise the polygon. Note that
order of the points will effect if this works (positive versus negative
winding order). Points should be in counter-clockwise arrangement.
-
Returns:
+
Returns
X_mask (numpy.ma.MaskedArray) Masked array of X coordinates where those
points outside of the polygon have been masked.
Function to interpolate the unstructured data in the topo object onto a
structured grid. Utilizes a bounding box plus a buffer of size
@@ -265,7 +262,7 @@
Navigation
masks so a call to numpy.ma.MaskedArray.compressed() must be made to
remove the masked data.
-
Input:
+
Input
fill_topo (list) - List of Topography objects to use as fill data
in the projection.
@@ -294,9 +291,9 @@
Navigation
Sets this object’s unstructured attribute to False if successful.
Returns an array shoreline_xy with 2 columns containing x and y values
for all segements of the shoreline (defined to be the contour
where self.z = sea_level) separated by [nan,nan] pairs.
@@ -315,12 +312,12 @@
Write out a topography file to path of type topo_type.
Writes out a topography file of topo type specified with topo_type or
inferred from the output file’s extension, defaulting to 3, to path
from data in Z. The rest of the arguments are used to write the header
data.
-
Input:
+
Input
path (str) - file to write
topo_type (int) - GeoClaw format topo_type
@@ -510,40 +507,40 @@
Given a 1-dimensional topography profile specfied by a set of (x,z)
values, create a lambda function that when evaluated will give the
topgraphy at the point (x,y). (The resulting function is constant in y.)
-
Example:
+
Example
>>> f=create_topo_func(loc)>>> b=f(x,y)
-
Input:
+
Input
loc (list) - Create a topography file with the profile denoted by the
tuples inside of loc. A sample set of points are shown below. Note
@@ -571,12 +568,12 @@
Trouble compiling Fortran code at the command line¶
The packages Classic, AMRClaw, and GeoClaw all require compiling Fortran
code in the process of running an example. This is typically done with the
make .exe command in an example or application directory that contains a
Clawpack Makefiles. Even if you don’t do this explicitly, due to dependency
checking in the Makefile the code will be compiled if necessary if you do
make .output, or make .plots (or make all).
If there are errors in the setrun function (usually defined in
setrun.py) then the these may show up when you try to “make .data”
since this function must be executed.
An earthquake source is typically specified by giving the slip along the
fault on a set of fault planes or on subfaults making up a single plane.
This data must then be converted into seafloor deformation to create the
@@ -130,16 +126,16 @@
The Makefile in an application directory shows the set of Fortran source
code files that are being used. Most of these files are typically in one of
the libraries, but a few subroutines must be provided by the user in order to
@@ -107,8 +103,8 @@
Navigation
You can also browse from the Clawpack Gallery to the README file for an
example and then to the source code for the application-specific codes.
For adaptive mesh refinement codes, the qinit subroutine will be called
for each grid patch at the initial time, so it is always necessary to
compute the cell centers based on the information passed in.
The Riemann solver defines the hyperbolic equation that is being solved and
does the bulk of the computational work – it is called at every cell
interface every time step and returns the information about waves and speeds
@@ -152,9 +148,9 @@
Navigation
The directory $CLAW/riemann/src contains Riemann solvers for many
applications, including advection, acoustics, shallow water equations, Euler
equations, traffic flow, Burgers’ equation, etc.
Boundary conditions are set by the library routines:
$CLAW/classic/src/Nd/bcN.f for the classic code (N = 1, 2, 3).
@@ -166,9 +162,9 @@
Navigation
library routines, the library routine can be copied to the application
directory and changes made as described at User-defined boundary conditions.
The Makefile should then be modified to point to the local version.
-
-
-
Often an application problem has data or parameters that is most
conveniently specified in a user-supplied routine named setprob. There is
a library version that does nothing in case one is not specified in the
@@ -191,9 +187,9 @@
Navigation
values in setrun.py so that this input data is specified in the same file
as other input parameters. For a sample, see
$CLAW/classic/examples/acoustics_1d_heterogeneous, for example.
-
-
-
Some problems require specifying spatially varying data, for example the
density and bulk modulus for acoustics in a heterogenous medium might vary
in space and in principle could be different in each grid cell. The best
@@ -214,9 +210,9 @@
Navigation
$CLAW/classic/examples/acoustics_1d_heterogeneous, for example.
If the aux arrays need to be time-dependent, the easiest way to adjust
them each time step is in the routine b4step described below.
-
-
-
Using b4step for work to be done before each time step¶
+
+
+
Using b4step for work to be done before each time step¶
The routine b4stepN is called in N space dimensions (N=1,2,3) just
before a time step is taken (and after ghost cells have been filled by the
boundary conditions). The library version of this routine does
@@ -231,9 +227,9 @@
Navigation
equation is solved with an advection velocity that varies in time as well as
space. This is initialized for each grid patch in setaux, but is adjusted
each time step in b4step2.
-
-
-
Problems of the form
\(q_t(x,t) + f(q(x,t))_x = \psi(q,x,t)\)
can be solved using a fractional step approach, as described in Chapter 17
@@ -262,9 +258,9 @@
Navigation
acoustic equation with a geometric source term is solved in order to provide
a reference solution for the two-dimensional radially symmetric problem
solved in $CLAW/classic/examples/acoustics_2d_radial.
-
-
-
When the AMRClaw code is used for a problem in 2 or 3 dimensions with source
terms, then a subroutine srcN must be provided as described above. In
addition, for the AMR procedure to work properly it is also necessary to
@@ -293,11 +289,10 @@
Navigation
The code may work fine without applying source terms in this
context, so using the dummy library routine src1d might be
successful even when source terms are present.
The waves and speeds must also
be returned by the Riemann solver in order to use the high-resolution
methods described in [LeVeque-FVMHP], which reduce to a second-order
@@ -164,9 +160,9 @@
If the equation has a source term,
a routine src1 must also be supplied that
solves the source term equation \(q_t=\psi\) over a time step.
A fractional step method is used to couple this with the homogeneous
solution, as described in Using src for source terms.
If you find a bug, post an issue with as much explanation as possible on the
appropriate issue tracker (for instance, the PyClaw issue tracker is at
https://github.com/clawpack/pyclaw/issues. If you’re looking
for something useful to do, try tackling one of the issues listed there.
Following the instructions above gives you a top level $CLAW directory
that is checked out to the tip of the master branch, and each subrepository
will be checked out to a particular commit as specified by this master
@@ -225,9 +222,9 @@
The script pull_all.sh can be used at any time to check out all
subrepositories to master and do a git pull. This is handy if you want to
make sure your version of master is up to date in every repository.
You should never commit to master, only to a feature branch, so
the master branch should always reflect what’s in the master branch on
the primary Github repositories.
You can update master to reflect any changes via the above approach (for
all subrepositories at once), or do git checkout master and then git
pull within any of the subrepositories separately.
To test out someone else’s pull request, follow these instructions:
For
example, if you want to try out a pull request coming from a branch named
@@ -406,9 +403,9 @@
Rather than installing Clawpack and all its dependencies on your computer, if
you have Docker installed then you can now use a
docker image from the DockerHub Clawpack repositories.
A new docker image has been created for v5.9.x. This image includes
Clawpack v5.9.0 and a number of packages of primary interest to GeoClaw users.
It also now includes the packages and files needed to execute the
Jupyter notebooks from the book
Riemann Problems and Jupyter Solutions.
These notebooks can be found in the riemann_book directory.
The form of run command suggested above also allows you to run Jupyter
notebooks from port 8889 on your own computer (or whatever port you
specified when creating the container).
To start the sever, in the docker container (at the jovyan $ prompt)
run this command:
Moving files between the docker container and the host machine¶
Often you want to run the code on Docker and then transfer the resulting output
files, and/or the plots generated, back to the host machine (e.g. some
directory on your laptop). You can use the –volume flag when running a
@@ -186,9 +183,9 @@
Moving files between the docker container and the host machine
-
If you want to create a new docker image that includes other software in
addition to Clawpack, you can find the Dockerile used to create the docker
image on dockerhub in the repository
@@ -214,7 +211,7 @@
The username jovyan was chosen so that you can use this docker image also for
starting up a Jupyter notebook server on binder. You can do this by
including a simple Dockerfile at the top level of your repository that
@@ -234,11 +231,10 @@
See also Earthquake sources: Fault slip and the Okada model for a discussion of the subfault parameters required
for the Okada model of seafloor deformation resulting from slip on a
specified fault plane.
@@ -109,14 +106,14 @@
Navigation
The file $CLAW/geoclaw/tests/test_dtopotools.py contains some tests of these
tools. Looking at these test routines may also give some ideas on
how to use them.
-
-
Documentation auto-generated from the module docstrings¶
+
+
Documentation auto-generated from the module docstrings¶
Module provides several functions for dealing with changes to topography
(usually due to earthquakes) including reading sub-fault specifications,
writing out dtopo files, and calculating Okada based deformations.
Write subfault format file with one line for each subfault.
Can either specify a style that determines the columns,
or a column_list. Must specify one but not both. See below for
@@ -407,7 +404,7 @@
Navigation
output_units (dict) specifies units to convert to before writing.
Defaults to “standard units”.
delimiter (str) specifies delimiter between columns, e.g.
-“,” to create a csv file. Defaults to “ “.
Define a fault by starting with a single fault plane (specified as
base_subfault of class SubFault) and subdividing the fault plane
into a rectangular array of nstrike by ndip equally sized subfaults.
@@ -752,17 +749,17 @@
Navigation
be rescaled at the end so the total seismic moment is Mo. In this case
the slip_distribution function only indicates the relative slip
between subfaults.
-
Define a fault by starting with a single fault plane (specified as
fault_plane of class SubFault) and subdividing the fault plane
into a rectangular array of nstrike by ndip equally sized subfaults.
This feature has been modified and this documentation describes
@@ -133,8 +129,8 @@
Navigation
The earlier version can still be used for outputing results at intermediate
times on a fixed grid (see Fixed grid output), but is not recommended for the purpose
of monitoring maxima or arrival times.
-
-
The values to be monitored are specified by the subroutine fgmax_values.
The default subroutine found in the library
$CLAW/geoclaw/src/2d/shallow/fgmax_values.f90
@@ -319,9 +315,9 @@
Before v5.7.0, the choice of interpolation procedure was governed by use of
the library routine geoclaw/src/2d/shallow/fgmax_interpolate.f90 (for
bilinear interpolation) or geoclaw/src/2d/shallow/fgmax_interpolate0.f90 (for
@@ -333,9 +329,9 @@
Compute approximate values of deformation dz on X,Y grid using
a specified dtopo file.
Also calculates B0 = B - dz, attempting to recover the pre-event
topography from the GeoClaw run topography stored in B.
for point_style==4, convert lists of fgmax values into masked arrays
based on the topo_style==3 file self.xy_fname that was used to specify
the fgmax points in the GeoClaw run.
Read input info for fgmax grid number fgno from the data file
fgmax_grids.data, which should have been created by setrun.py.
This file now contains info about all fgmax grids.
Adjust the upper and lower limits of a grid so that equally spaced
grid points with spacing dx lie exactly at cell centers, so that
no interpolation is needed for fgmax values. Note that parameter
names refer to x limits, but works equally well for y values.
-
Input:
+
Input
x1_desired, x2_desired: approximate desired limits of fgmax grid
x1_domain: lower edge of computational domain
dx: Mesh spacing on fine grid that fgmax grid should conform to
-
Output:
+
Output
x1_new, x2_new: limits to set so (x2-x1) is integer multiple
of dx and points are at cell centers of computational grid
frequent times than the standard AMR output has been introduced in v5.9.0,
and these are now called fgout grids to complement the fgmax grids.
These fgout grids are described further below.
-
-
The GeoClaw Fortran code reads in one or more files that specify fgout grids
grid(s) for writing out the solution on a fixed grid throughout
the computation.
@@ -160,9 +157,9 @@
Navigation
to each fgout grid using the fgno attribute, described below.
If you do not assign numbers, they will be numbered sequentially (1,2, etc.)
based on the order they are specified in the setrun.py file.
-
-
-
Since the files have the same format as the usual fort.t, fort.q, and
fort.b files for Clawpack output, it is possible to use a setplot.py
file to set up plotting this sequence of fgout frames in exactly the same
@@ -236,9 +233,9 @@
Alternatively, since every output frame consists of only a single uniform
grid of data, it is much easier to manipulate or plot this data directly than
for general AMR data. The fgout_tools.py module described at
@@ -278,9 +275,9 @@
Note above that fgout points are specified by setting e.g. fgout.x1,
fgout.x2 and fgout.nx in setrun.py. For consistency with the way the
finite volume computational grid is specified in setrun.py
@@ -292,9 +289,9 @@
The fgout grid need not be aligned with any computational grid, and in general
it may overlap several grids at different AMR resolutions. At each fgout time
requested, the solution is interpolated from the finest available AMR grid
@@ -321,11 +318,10 @@
Class to hold a single frame of fgout data at one output time.
Several attributes are defined as properties that can be evaluated
and stored only when needed by the user.
Read input info for fgout grid number fgno from the data file
fgout_grids.data, which should have been created by setrun.py.
This file now contains info about all fgout grids.
Read a netCDF file and return a list of FGoutFrame instances.
This will only be possible if the netCDF file contains at least
the qoi’s ‘h’,’hu’,’hv’,’eta’ required to reconstruct the q array
as output by GeoClaw.
Write a list of fgout frames (at different times on the same rectangular
grid) to a single netCDF file, with some metadata and the topography,
if desired.
@@ -375,11 +372,10 @@
Navigation
time the file was created and the path to the directory where it was made.
In addition to simple rectangles, more general ruled rectangles can also be
used as flagregions. These are a restricted set of polygons for which it is
easy to test if a point is inside or outside, as described in more detail in
@@ -171,11 +167,10 @@
The array force_dry_init can now be saved in the same format as topo
files, using topo_type=3 and specifying Z_format=’%1i’ so that
the data values from the array, which are all either 0 or 1, are printed
@@ -349,9 +346,9 @@
To use a force_dry_init.data file of the sort created above, when
setting up a GeoClaw run the setrun.py file must be modified to
indicate the name of this file along with a time tend. The array is
@@ -367,8 +364,8 @@
Users should set the environment variable FC to point to the correct
compiler, e.g. in bash via:
$ export FC=gfortran
@@ -105,9 +102,9 @@
Navigation
f77 and if so resets it to gfortran since much of Clawpack is not f77
compliant. However, it is best to set the FC environment variable
yourself, e.g. in your .bashrc file.
-
-
-
The LFLAGS environment variable is used to provide flags that are needed when
linking the final binary. The most likely use for this flag would be to link a
particular library with the binary (such as a NetCDF library) or provide a path
to a compiled module. If this variable is not set in the environment then
LFLAGS defaults to the relevant flags in FFLAGS.
-
-
-
Pre-Processor and the PPFLAGS environment variable¶
+
+
+
Pre-Processor and the PPFLAGS environment variable¶
Compilers often provide a pre-processor that can scan source code before
compilation providing some ability to define variables at compile time or
transform the code. Currently the pre-processor is always called before
Clawpack compilation to support optional dependencies, such as NetCDF support,
and some testing abilities. The PPFLAGS environment variable is meant to
provide further control of the pre-processor.
With AMRClaw in two space dimensions and GeoClaw
it is possible to specify gauge locations as points (x,y) where the values of all
components of q should be output every time step during the computation over some
@@ -116,8 +112,8 @@
Navigation
can be spatially interpolated from the fgout grid(s) captured in the run).
The temporal resolution will be that specified for the fgout grids.
See Fixed grid output for more details.
-
-
Setting up, running, and plotting a GeoClaw application follows the same pattern
as other AMRClaw applications, which in turn use many of the same
conventions as the classic single grid Clawpack code, in particular:
To simulate flow over topography it is of course necessary to specify
the topography. This is usually done by providing one or more files of
surface elevation (relative to some reference, e.g. sea level) at a set of
@@ -119,25 +116,24 @@
Navigation
Several file formats are recognized by GeoClaw. See Topography data for more
information on how to specify topography and some on-line resources for
obtaining topography.
Fetch water levels and tide predictions at given NOAA tide station.
The data is returned in 6 minute intervals between the specified begin and
end dates/times. A complete specification of the NOAA CO-OPS API for Data
@@ -183,14 +180,14 @@
Navigation
$CLAW/geoclaw/scratch
-
Required Arguments:
+
Required Arguments
station (string): 7 character station ID
begin_date (datetime): start of date/time range of retrieval
end_date (datetime): end of date/time range of retrieval
-
Optional Arguments:
+
Optional Arguments
time_zone (string): see NOAA API documentation for possible values
datum (string): see NOAA API documentation for possible values
@@ -199,7 +196,7 @@
Navigation
verbose (bool): whether to output informational messages
-
Returns:
+
Returns
date_time (numpy.ndarray): times corresponding to retrieved data
water_level (numpy.ndarray): preliminary or verified water levels
x0,y0 is assumed to be a point (or an array with the same shapes as x1,y1)
x1,y1 is a point or two arrays of points (of the same dimension)
returns array with same shape as x1 and y1 containing distance of each point
@@ -220,20 +217,19 @@
Navigation
two points, but this is not suggested since the notation is not consistent.
Invert the Haversine function to find dx given a distance and point.
Invert the haversine function to find dx given distance d and (x1,y1) and y2.
The corresponding x2 can be x1+dx or x1-dx.
May return NaN if no solution.
As with all of Clawpack, the GeoClaw code is provided as a research
and teaching tool with no guarantee of suitability for any particular
purpose, and no liability on the part of the authors. See the
@@ -95,8 +92,8 @@
Navigation
geophysical hazards, but it is the responsibility of the user to fully
understand the model and its limitations and validate it for the intended
purpose.
-
-
GeoClaw is currently in use for tsunami hazard assessment
by several research groups. Version 4.6.1 of the code was approved in 2012
by the US National Tsunami Hazard
@@ -170,11 +167,10 @@
Navigation
seafloor leads to the propagation of acoustic waves that result in a
surface displacement
-
-
+
With the default style, matplotlib axis labels are often hard to read when
plotting in latitude and longitude. It may help to disable offset labeling
and to rotate the longitude labels:
The Google Earth browser is a powerful visualization tool for
viewing georeferenced data and images. The VisClaw visualization suite includes
tools that will produce georeferenced plots and associated KMZ files needed for
@@ -100,8 +97,8 @@
Navigation
critical decisions on conclusions drawn from the Google Earth
visualization alone. Nevertheless, these realistic visualizations are
useful for setting up simulations and communicating your results.
-
-
To get started, you will need to install the Python packages lxml and
pykml. These libraries can be easily installed through Python
package managers PIP and conda:
To create a pyramid of images for faster loading in Google Earth, you
will also want to install the Geospatial Data Abstraction Library
(GDAL). The GDAL library (and associated Python bindings)
@@ -153,16 +150,16 @@
This test will create an image pyramid in the directory frame0005fig1 and an associated
doc.kml file which you can open in Google Earth.
NOTE (8/1/16) The latest release of the Anaconda GDAL library is not fully version compatible with
its dependencies. If you receive an error that ends with:
The Chile 2010 tsunami is included as an example in the GeoClaw module
of Clawpack. Once you have run this simulation, you can create the
KMZ file needed for visualizing your data in Google Earth by using the
@@ -188,14 +185,12 @@
The plotting parameters needed to instruct VisClaw to create plots
suitable for visualization in Google Earth are all set as attributes
of instances of the VisClaw classes ClawPlotData and ClawPlotFigure.
@@ -203,9 +198,9 @@
The following plotdata attributes apply to all VisClaw figures to be
visualized in Google Earth. These attributes are all optional and
have reasonable default values.
Name used in the Google Earth sidebar to identify the simulation. Default : “GeoClaw”
-
-
-kml_starttime:[Y,M,D,H,M,S]
+
+
+kml_starttime : [Y,M,D,H,M,S]
Start date and time, in UTC, of the event. The format is [year,month,day,hour, minute, second].
By default, local time will be used.
-
-
-kml_timezone:integer
+
+
+kml_timezone : integer
Time zone offset, in hours, of the event from UTC. For example, the offset for Chile is +3 hours,
whereas the offset for Japan is -9 hours. Default : no time zone offset.
-
-
-kml_index_fname:string
+
+
+kml_index_fname : string
The name given to the KMZ file created in the plot directory. Default : “_GoogleEarth”
-
-
-kml_publish:string
+
+
+kml_publish : string
A URL address and path to a remote site hosting a
KMZ file you wish to make available on-line. Default : None
A function that maps computational coordinates (in meters, for
example) to latitude/longitude coordinates. This will be called to
position PNG overlays, gauges, patch boundaries, and regions boundaries to the
@@ -273,18 +268,18 @@
The following attributes apply to an individual figure created for visualization in Google Earth.
The first three attributes are required. The remaining attributes
are optional.
Indicates to VisClaw that the PNG files created for this figure should be suitable for
visualization in Google Earth. With this set to True, all titles, axes labels, colorbars
and tick marks will be suppressed. Default : False.
-
-
-kml_xlimits:[longitude_min,longitude_max]
+
+
+kml_xlimits : [longitude_min, longitude_max]
Longitude range used to place PNG images on Google Earth. This setting will override
any limits set as plotaxes attributes. Required
-
-
-kml_ylimits:[latitude_min,latitude_max]
+
+
+kml_ylimits : [latitude_min, latitude_max]
Latitude range used to place the PNG images on Google Earth.
This setting will override any limits set as plotaxes attributes. Required
-
-
-kml_use_for_initial_view:boolean
+
+
+kml_use_for_initial_view : boolean
Set to True if this figure should be used to determine the initial
camera position in Google Earth. The initial camera position will
be centered over this figure at an elevation equal to approximately
@@ -360,17 +355,17 @@
plotfigure attributes
-
-
-kml_figsize:[size_x_inches,size_y_inches]
+
+
+kml_figsize : [size_x_inches,size_y_inches]
The figure size, in inches, for the PNG file. See Removing
aliasing artifacts for tips on how to set the figure size and dpi
for best results. Default : 8 x 6 (chosen by Matplotlib).
-
-
-kml_dpi:integer
+
+
+kml_dpi : integer
Number of pixels per inch used in rendering PNG figures. For best
results, figure size and dpi should be set to respect the numerical
resolution of the the simulation. See Removing aliasing
@@ -378,18 +373,18 @@
Set to True if you want to create a pyramid of images at different
resolutions for faster loading in Google Earth. Image tiling
requires the GDAL library. See Optional GDAL library, above,
for installation instructions. Default : False.
All figures created for Google Earth are rendered as PNG files using
the Matplotlib backend. So in this sense, the resulting PNG files are
created in a manner that is no different from other VisClaw output
@@ -417,8 +412,8 @@
The plotaxes attributes
colorbar, xlimits, ylimits and title will all be ignored by the KML plotting.
For best results, the attribute scaled should be set to its default value False. The
@@ -426,9 +421,9 @@
The most useful plotitem type will probably be the 2d_pcolor type, although other
types including the filled contour contourf can also be used to good effect.
Colormaps that are designed to work well with Google Earth are
A colorbar can be associated with each figure in the Google Earth
browser by setting the figure attribute kml_colorbar to point to a function
that creates the colorbar:
There are no particular attributes for gauge plots and so they
can be created in the usual way. In the Google Earth browser, gauge locations
will be displayed as Placemarks. Clicking on gauge Placemarks will bring
up the individual gauge plots. The screenshot below shows the gauge plot
that appears when either the gauge Placemark or the gauge label in the sidebar is
clicked.
VisClaw has additional plotdata attributes indicating which figures and frames
to plot and which output style to create. When plotting for Google
Earth, one additional output parameter is necessary.
KML files are very similar to HTML files in that they contan
<tags>…</tags> describing data to be rendered by a suitable
rendering engine. Whereas as standard web browsers can render content
@@ -543,9 +536,9 @@
If you create several frames with relatively high dpi, you may find
that the resulting KMZ file is slow to load in Google Earth. In
extreme cases, large PNG files will not load at all. You can improve
@@ -559,9 +552,9 @@
You may find that the transparent colormap leads to unappealing visual
artifacts. This can happen when the resolution of the PNG file does
not match the resolution of the data used to create the image. In the
@@ -573,12 +566,10 @@
Aliasing effects resulting from default kml_dpi and kml_figsize settings¶
-
-
+
Aliasing effects resulting from default kml_dpi and kml_figsize settings¶
+
We can remove these aliasing effects by making the resolution of the
PNG file a multiple of 30*2*6 = 360. This can be done by setting the
figure size and dpi appropriately:
Aliasing effects removed by properly setting kml_dpi and kml_figsize¶
-
-
+
Aliasing effects removed by properly setting kml_dpi and kml_figsize¶
+
This baseline dpi=12 is the minimum resolution that will remove
striped artifacts from your images. However, you may find that this
resolution is unacceptable, especially for close-up views of
@@ -621,9 +610,9 @@
Creating multiple figures at different resolutions¶
You can create several figures for visualization in Google Earth.
Each figure you create will show up as a separate named folder in the Google
Earth sidebar. The name will match that given to the VisClaw plotfigure.
@@ -662,9 +651,9 @@
Creating multiple figures at different resolutions
Mapping topography data to latitude/longitude coordinates¶
+
+
+
Mapping topography data to latitude/longitude coordinates¶
In many situations, your computational domain may not be conveniently
described in latitude/longitude coordinates. When simulating overland
flooding events, for example, topographic data may more easily be
@@ -728,9 +717,9 @@
Creating multiple figures at different resolutions
You can easily share your results with collaborators
by providing links to your archive KMZ file in HTML webpages. Collaborators can
download the KMZ file and open it in a Google Earth browser.
For netCDF files the
data points are generally interpreted as pointwise values at the points
specified in the lat and lon arrays included in the file (or as
cell-averaged values with these points as the cell centers).
Older versions of the documentation used to be tagged for each minor
release, e.g. v5.6.1. Starting with v5.7.0, these are now only tagged
with the major release, e.g. v5.7.x.
When updating a minor version, e.g. from v5.7.0 to v5.7.1, we will continue
to use the same branch v5.7.x. You should just make sure the v5.7.x and dev
are up to date with each other at the time of release.
Any files placed in $CLAW/doc/doc/extra_files will be copied verbatim
(recursively for subdirectories) to the directory
$CLAW/doc/doc/_build/html when Sphinx is used to build the documentation.
@@ -343,9 +340,9 @@
Some webpages are created within other clawpack repositories.
For example, the page http://www.clawpack.org/geoclawdev-2020/
is modified by pushing changes to the master branch of the repository
@@ -357,11 +354,10 @@
Make sure all your subrepositories are up to date and clean:
cd $CLAW
git co master
@@ -105,16 +102,16 @@
PreparationCLAW/doc/gallery/README.md
as required for building the galleries, and check all the resulting plots to
make sure everything looks correct.
-
-
-
Make sure all repositories are checked out to the master branch and are up to
date with the main Clawpack repositories and clean, as described in the
preparation step above.
We generally do this step for a release candidate first, and then
do the same for the final release. For release candidates, modify the
version number to include 5.4.1rc-alpha, for example.
After the release has been finalized, tag all repositories. In the commands
below, it is assumed the remote upstream points to the main Github repos
(not your fork) and that you have push permission. Change 5.x.x to the
@@ -187,9 +184,9 @@
Final releaseChanges to master since v5.9.0 which generate diffs between the latest version and
the current master branch of each repository.
-
-
-
To release on the pypi server (for installation via pip) we have to do a bit
of trickery. We can’t just follow the directions at https://packaging.python.org/tutorials/packaging-projects/
because we have a very non-Pythonic directory structure; in particular,
@@ -239,9 +236,9 @@
See Guide for updating this documentation for general instructions on building the documentation
and galleries using Sphinx, and for how to push changes to Github so they
show up on the web.
Ideally all the apps in the Clawpack Applications repository should be rerun with the new release
and any issues fixed. If old apps are modified, add a note to the
README.rst file in the directory that indicates when it was last updated
@@ -305,14 +302,14 @@
Note that unlike the tar file for a new release, the docker image includes
a clone of the apps repository, so it would be best to first update that
@@ -327,11 +324,10 @@
This page describes ways to download and “install” Clawpack in a way that
the Fortran versions of the PDE solvers (Classic, AMRClaw, and GeoClaw)
can be used, along with Python codes that support these solvers, including
@@ -93,8 +90,8 @@
You can download the most recent (or certain previous versions) of Clawpack
as a tar file. After untarring this, you can set environment variables
to point to this version.
You can clone the git repositories from https://github.com/clawpack.
This is particularly useful if you
want the latest development version or a branch that is not in a release yet,
@@ -126,7 +123,7 @@
gitclonehttps://github.com/clawpack/clawpack.gitcdclawpack
-gitcheckoutv5.9.0# or an older version; `git tag -l` to list options
+gitcheckoutv5.9.0# or an older version; `git tag -l` to list optionsgitsubmoduleinit# for repositories pyclaw, clawutil, visclaw, etc.gitsubmoduleupdate# clones all the submodule repositoriesexportCLAW=/full/path/to/clawpack# in bash
@@ -141,19 +138,18 @@
Navigation
See Clawpack components for a list of what is generally included
under the top level clawpack directory when using any of these approaches.
(And what is not included, e.g. the Clawpack Applications repository.)
-
-
Please see Which Clawpack solver should I use? before installing, particularly
if you are not sure whether you will
be using the Fortran versions of the PDE solvers
@@ -104,7 +101,7 @@
Navigation
or, more specifically,
-
pipinstall--userclawpack==v5.9.0
+
pipinstall--userclawpack==v5.9.0
or you can choose a previous version from the PyPi history.
@@ -113,9 +110,9 @@
Navigation
If you think you might want to use the Fortran packages as well
(Classic, AMRClaw, GeoClaw) and/or want easier access to the Python source
code, it is recommended that you follow the pip instructions below.
The recommended way to install the latest release of Clawpack, for
using both PyClaw and the Fortran packages, is to use pip, e.g. with the
following command
@@ -170,8 +167,8 @@
Using pip to download and install actually clones Git repositories from
https://github.com/clawpack/clawpack. If you are comfortable with
Git you can use the same top repository to update Clawpack or switch
@@ -208,9 +205,9 @@
Next steps:Python path if you are having problems with the wrong version
being imported.
-
-
-
Experimenting with code in the examples directories¶
+
+
+
Experimenting with code in the examples directories¶
We suggest that if you want to experiment extensively with examples or
modify an example to solve your own problem, you first copy a directory out
of the source code tree to a different location, in order to minimize
@@ -218,9 +215,9 @@
Convert float to string in fixed point notation with at most
num_digits digits of precision and trailing zeros removed,
for printing nicely in kml description boxes.