Skip to content

Commit 0ebc2a1

Browse files
Merge pull request #811 from baagaard-usgs/fix-eqinfo-docs
Improve documentation for pylith_eqinfo and illustrate its use in examples.
2 parents 415df6a + 67d3d4b commit 0ebc2a1

File tree

12 files changed

+242
-5
lines changed

12 files changed

+242
-5
lines changed

applications/pylith_eqinfo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ NOTE: Works with HDF5 files, not VTK files.
2828
if __name__ == "__main__":
2929

3030
from pylith.apps.EqInfoApp import EqInfoApp
31-
from pyre.applications import start
31+
from pythia.pyre.applications import start
3232
start(applicationClass=EqInfoApp)
3333

3434
# End of file

docs/references.bib

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,18 @@ @article{Brune:1970
8282
pages = {4997--5009},
8383
}
8484

85+
@article{Wu:Chen:2003,
86+
author = {Wu, Z.~L. and Chen, Y.~T.},
87+
title = {Definition of seismic moment at a discontinuity interface},
88+
journal = {Bulleting of the Seismological Society of America},
89+
volume = {93},
90+
number = {4},
91+
year = 2003,
92+
month = aug,
93+
pages = {1832--1834},
94+
doi = {10.1785/0120020234}
95+
}
96+
8597
@article{Courant:etal:1967,
8698
author = {Courant, R. and Friedrichs, K. and Lewy, H.},
8799
title = {On the Partial Difference Equations of Mathematical Physics},

docs/user/examples/crustal-strikeslip-2d/step01-slip.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,61 @@ At the end of the output written to the terminal, we see that the solver advance
142142
The linear solve converged after 19 iterations and the norm of the residual met the absolute convergence tolerance (`ksp_atol`) .
143143
The nonlinear solve converged in 1 iteration, which we expect because this is a linear problem, and the residual met the absolute convergence tolerance (`snes_atol`).
144144

145+
### Earthquake rupture parameters
146+
147+
We use the `pylith_eqinfo` utility to compute rupture information, such as earthquake magnitude, seismic moment, seismic potency, and average slip.
148+
For 2D simulations, the average slip provides the most useful information.
149+
[`pylith_eqinfo`](../../run-pylith/utilities.md) is a Pyre application and you specify parameters using `cfg` files and the command line.
150+
It writes results to a Python script for use in post-processing of simulation results.
151+
152+
The file `eqinfoapp.cfg` holds the parameters for `pylith_eqinfo` in this example.
153+
By default, `pylith_eqinfo` extracts information for the final time step in the output file.
154+
In order to compute the seismic moment and moment magnitude, we need the shear modulus, which in this case is uniform over the domain.
155+
Consquently, we specify the density and shear wave speed using a `UniformDB` in `eqinfoapp.cfg`.
156+
157+
```{code-block} console
158+
---
159+
caption: Run `pylith_eqinfo` for the Step 1 simulation.
160+
---
161+
$ pylith_eqinfo
162+
```
163+
164+
```{code-block} python
165+
---
166+
caption: Contents of `output/step01_slip-eqinfo.py` generated by `pylith_eqinfo`. The `all` object includes earthquake rupture information combined from the three the individual faults. The average slip matches the uniform slip prescribed on each fault.
167+
---
168+
class RuptureStats(object):
169+
pass
170+
all = RuptureStats()
171+
all.timestamp = [ 3.155760e+07]
172+
all.ruparea = [ 5.387992e+04]
173+
all.potency = [ 1.733080e+05]
174+
all.moment = [ 3.899430e+15]
175+
all.avgslip = [ 3.216560e+00]
176+
all.mommag = [ 4.360667e+00]
177+
main_fault = RuptureStats()
178+
main_fault.timestamp = [ 3.155760e+07]
179+
main_fault.ruparea = [ 3.577375e+04]
180+
main_fault.potency = [ 1.430950e+05]
181+
main_fault.moment = [ 3.219637e+15]
182+
main_fault.avgslip = [ 4.000000e+00]
183+
main_fault.mommag = [ 4.305205e+00]
184+
east_branch = RuptureStats()
185+
east_branch.timestamp = [ 3.155760e+07]
186+
east_branch.ruparea = [ 5.999357e+03]
187+
east_branch.potency = [ 5.999357e+03]
188+
east_branch.moment = [ 1.349855e+14]
189+
east_branch.avgslip = [ 1.000000e+00]
190+
east_branch.mommag = [ 3.386858e+00]
191+
west_branch = RuptureStats()
192+
west_branch.timestamp = [ 3.155760e+07]
193+
west_branch.ruparea = [ 1.210682e+04]
194+
west_branch.potency = [ 2.421364e+04]
195+
west_branch.moment = [ 5.448068e+14]
196+
west_branch.avgslip = [ 2.000000e+00]
197+
west_branch.mommag = [ 3.790828e+00]
198+
```
199+
145200
## Visualizing the results
146201

147202
The `output` directory contains the simulation output.

docs/user/examples/crustal-strikeslip-3d/step01-slip.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,58 @@ At the end of the output written to the terminal, we see that the solver advance
111111
The linear solve converged after 88 iterations and the norm of the residual met the absolute convergence tolerance (`ksp_atol`) .
112112
The nonlinear solve converged in 1 iteration, which we expect because this is a linear problem, and the residual met the absolute convergence tolerance (`snes_atol`).
113113

114+
### Earthquake rupture parameters
115+
116+
We use the `pylith_eqinfo` utility to compute rupture information, such as earthquake magnitude, seismic moment, seismic potency, and average slip.
117+
The file `eqinfoapp.cfg` holds the parameters for `pylith_eqinfo` in this example.
118+
By default, `pylith_eqinfo` extracts information for the final time step in the output file.
119+
In order to compute the seismic moment and moment magnitude, we need the shear modulus, which in this case is uniform over the domain.
120+
Consquently, we specify the density and shear wave speed using a `UniformDB` in `eqinfoapp.cfg`.
121+
The average slip, rupture area, seismic moment, and seismic potency are all given in SI units.
122+
123+
```{code-block} console
124+
---
125+
caption: Run `pylith_eqinfo` for the Step 1 simulation.
126+
---
127+
$ pylith_eqinfo
128+
```
129+
130+
```{code-block} python
131+
---
132+
caption: Contents of `output/step01_slip-eqinfo.py` generated by `pylith_eqinfo`. The `all` object includes earthquake rupture information combined from the three the individual faults. The average slip matches the uniform slip prescribed on each fault.
133+
---
134+
class RuptureStats(object):
135+
pass
136+
all = RuptureStats()
137+
all.timestamp = [ 3.155760e+07]
138+
all.ruparea = [ 8.140700e+08]
139+
all.potency = [ 2.623065e+09]
140+
all.moment = [ 5.901897e+19]
141+
all.avgslip = [ 3.222162e+00]
142+
all.mommag = [ 7.147328e+00]
143+
main_fault = RuptureStats()
144+
main_fault.timestamp = [ 3.155760e+07]
145+
main_fault.ruparea = [ 5.424291e+08]
146+
main_fault.potency = [ 2.169716e+09]
147+
main_fault.moment = [ 4.881862e+19]
148+
main_fault.avgslip = [ 4.000000e+00]
149+
main_fault.mommag = [ 7.092390e+00]
150+
east_branch = RuptureStats()
151+
east_branch.timestamp = [ 3.155760e+07]
152+
east_branch.ruparea = [ 8.993288e+07]
153+
east_branch.potency = [ 8.993288e+07]
154+
east_branch.moment = [ 2.023490e+18]
155+
east_branch.avgslip = [ 1.000000e+00]
156+
east_branch.mommag = [ 6.170734e+00]
157+
west_branch = RuptureStats()
158+
west_branch.timestamp = [ 3.155760e+07]
159+
west_branch.ruparea = [ 1.817081e+08]
160+
west_branch.potency = [ 3.634162e+08]
161+
west_branch.moment = [ 8.176864e+18]
162+
west_branch.avgslip = [ 2.000000e+00]
163+
west_branch.mommag = [ 6.575058e+00]
164+
```
165+
114166
## Visualizing the results
115167

116168
The `output` directory contains the simulation output.

docs/user/examples/strikeslip-2d/step04-varslip.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,48 @@ At the end of the output written to the terminal, we see that the solver advance
151151
The linear solve converged after 27 iterations and the norm of the residual met the absolute convergence tolerance (`ksp_atol`).
152152
The nonlinear solve converged in 1 iteration, which we expect because this is a linear problem, and the residual met the absolute convergence tolerance (`snes_atol`).
153153

154+
## Earthquake rupture parameters
155+
156+
We use the `pylith_eqinfo` utility to compute rupture information, such as earthquake magnitude, seismic moment, seismic potency, and average slip.
157+
For 2D simulations, the average slip provides the most useful information.
158+
[`pylith_eqinfo`](../../run-pylith/utilities.md) is a Pyre application and you specify parameters using `cfg` files and the command line.
159+
It writes results to a Python script for use in post-processing of simulation results.
160+
161+
The file `eqinfoapp.cfg` holds the parameters for `pylith_eqinfo` in this example.
162+
By default, `pylith_eqinfo` extracts information for the final time step in the output file.
163+
In order to compute the seismic moment and moment magnitude, we need the shear modulus for the fault.
164+
We account for the contrast in rigidity across the fault by using the effective shear modulus from {cite:t}`Wu:Chen:2003` and set the shear wave speed to 3.46 km/s.
165+
166+
167+
```{code-block} console
168+
---
169+
caption: Run `pylith_eqinfo` for the Step 4 simulation.
170+
---
171+
$ pylith_eqinfo
172+
```
173+
174+
```{code-block} python
175+
---
176+
caption: Contents of `output/step04_varslip-eqinfo.py` generated by `pylith_eqinfo`. The `all` object includes earthquake rupture information combined from all of the individual faults.
177+
---
178+
class RuptureStats(object):
179+
pass
180+
all = RuptureStats()
181+
all.timestamp = [ 3.155760e+07]
182+
all.ruparea = [ 6.300870e+04]
183+
all.potency = [ 1.306180e+04]
184+
all.moment = [ 3.909267e+14]
185+
all.avgslip = [ 2.073016e-01]
186+
all.mommag = [ 3.694730e+00]
187+
fault = RuptureStats()
188+
fault.timestamp = [ 3.155760e+07]
189+
fault.ruparea = [ 6.300870e+04]
190+
fault.potency = [ 1.306180e+04]
191+
fault.moment = [ 3.909267e+14]
192+
fault.avgslip = [ 2.073016e-01]
193+
fault.mommag = [ 3.694730e+00]
194+
```
195+
154196
## Visualizing the results
155197

156198
In {numref}`fig:example:strikeslip:2d:step04:solution` we use the `pylith_viz` utility to visualize the y displacement field.

docs/user/run-pylith/utilities.md

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -337,19 +337,56 @@ pylith_dumpparameters [--quiet] [--format=ascii|json] [--filnemame=FILENAME]
337337
## pylith_eqinfo
338338

339339
This utility computes the moment magnitude, seismic moment, seismic potency, and average slip at user-specified time snapshots from PyLith fault HDF5 output.
340-
The utility works with output from simulations with either prescribed slip and/or spontaneous rupture.
341-
Currently, we compute the shear modulus from a user-specified spatial database at the centroid of the fault cells. In the future we plan to account for lateral variations in shear modulus across the fault when calculating the seismic moment.
342-
The Python script is a Pyre application, so its parameters can be specified using `cfg` and command line arguments just like PyLith.
340+
The utility works with output from simulations with either prescribed slip or spontaneous rupture.
341+
The moment magnitudes, seismic moment, and seismic potentency for 2D simulation have limited value, because they use on a 1D fault.
342+
Currently, we compute the shear modulus from a user-specified spatial database at the centroid of the fault cells.
343+
In the future we plan to automatically account for lateral variations in shear modulus across the fault when calculating the seismic moment.
344+
The average slip, rupture area, seismic moment, and seismic potency are all given in SI units.
345+
346+
```{tip}
347+
From {cite:t}`Wu:Chen:2003` the seismic moment, $M_0$, when considering a laterial variation in the shear modulus across the fault is
348+
349+
\begin{equation}
350+
M_0 = \mu_\mathit{eff} A D
351+
\end{equation}
352+
353+
where $A$ is the rupture area, $D$ is the average slip, and $\mu_\mathit{eff}$ is the effective shear modulus given by
354+
355+
\begin{equation}
356+
\mu_\mathit{eff} = \frac{1}{2} \left( \mu^+ + \mu^- \right) \left(1 - \left(\frac{\mu^+ - \mu^-}{\mu^+ + \mu^-} \right)^2 \right)
357+
\end{equation}
358+
359+
where $\mu^+$ and $\mu^-$ are the shear modulus on each side of the fault.
360+
```
361+
362+
The Python script is a Pyre application, so its parameters can be specified using `cfg` files (`eqinfoapp.cfg` will be read if it exists) or command line arguments just like PyLith.
343363

344364
The Pyre properties and facilities include:
345365

346366
:output_filename: Filename for output of slip information.
367+
:coordsys: Coordinate system associated with mesh in simulation.
347368
:faults: Array of fault names.
348369
:filename_pattern: Filename pattern in C/Python format for creating filename for each fault. Default is `output/fault_\%s.h5`.
349370
:snapshots: Array of timestamps for slip snapshosts ([-1] means use last time step in file, which is the default).
350371
:snapshot_units: Units for timestamps in array of snapshots.
351372
:db_properties: Spatial database for elastic properties.
352-
:coordsys: Coordinate system associated with mesh in simulation.
373+
```{code-block} cfg
374+
---
375+
caption: Example `cfg` file for running `pylith_eqinfo` in `examples/strikeslip-2d` to compute the earthquake magnitude, seismic moment, and average slip for step04_varslip.
376+
---
377+
[eqinfoapp]
378+
output_filename = output/step04_varslip-eqinfo.py
379+
380+
coordsys.space_dim = 2
381+
382+
faults = [fault]
383+
filename_pattern = output/step04_varslip-%s.h5
384+
385+
db_properties = spatialdata.spatialdb.UniformDB
386+
db_properties.description = Fault properties
387+
db_properties.values = [density, Vs]
388+
db_properties.data = [2500.0*kg/m**3, 3.46*km/s]
389+
```
353390

354391
(sec-user-run-pylith-pylith-genxdmf)=
355392
## pylith_genxdmf

examples/crustal-strikeslip-2d/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ dist_noinst_DATA = \
1717
mesh_tri.msh \
1818
mesh_tri.exo \
1919
pylithapp.cfg \
20+
eqinfoapp.cfg \
2021
step01_slip.cfg \
2122
step01_slip_cubit.cfg \
2223
step02_varslip.cfg \
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[eqinfoapp]
2+
output_filename = output/step01_slip-eqinfo.py
3+
4+
coordsys.space_dim = 3
5+
6+
faults = [main_fault, east_branch, west_branch]
7+
filename_pattern = output/step01_slip-%s.h5
8+
9+
db_properties = spatialdata.spatialdb.UniformDB
10+
db_properties.description = Fault properties
11+
db_properties.values = [density, Vs]
12+
db_properties.data = [2500.0*kg/m**3, 3.00*km/s]

examples/crustal-strikeslip-3d/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ dist_noinst_DATA = \
1616
README.md \
1717
mesh_tet.msh \
1818
pylithapp.cfg \
19+
eqinfoapp.cfg \
1920
step01_slip.cfg \
2021
step01_slip_cubit.cfg \
2122
step02_varslip.cfg \
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[eqinfoapp]
2+
output_filename = output/step01_slip-eqinfo.py
3+
4+
coordsys.space_dim = 3
5+
6+
faults = [main_fault, east_branch, west_branch]
7+
filename_pattern = output/step01_slip-%s.h5
8+
9+
db_properties = spatialdata.spatialdb.UniformDB
10+
db_properties.description = Fault properties
11+
db_properties.values = [density, Vs]
12+
db_properties.data = [2500.0*kg/m**3, 3.00*km/s]

0 commit comments

Comments
 (0)