Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions quakeworx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
The files in this directory have been adjusted compared to the "standard" SeisSol training repository to be readily used for a science gateway for seismic simulations: [Quakeworx Kick-off: Advancing Earthquake Science and Cybertraining in Seismology](https://quakeworx.org/events/quakeworx-kick-off-workshop)

The simplest way to access the input files for the Gateway is by running ``git clone https://github.com/SeisSol/Training.git`` from your terminal locally. Make sure to navigate into the folder _quakeworx_ when uploading the input files to the SeisSol App from the Gateway.

For more information about the Quakeworx science gateway, please see [Quakeworx overview](https://qwx1.2.onescienceway.com/overview).
60 changes: 16 additions & 44 deletions quakeworx/cdb_tpv23/cdb_tpv23.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -117,37 +117,7 @@
"id": "9c1ccdeb-8036-42b3-b919-6be58215d5c3",
"metadata": {},
"source": [
"We start from finding the location of our output files. "
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "e48ebace-664e-4547-82f5-c75a3dc29340",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"/opt/notebooks/cdb_tpv23\n"
]
}
],
"source": [
"!pwd # ! in the front keeps the command running in the terminal, instead of the notebook"
]
},
{
"cell_type": "markdown",
"id": "a2881c6a-e640-475d-882d-b1901a917fb9",
"metadata": {},
"source": [
"You will see you are at `/opt/notebooks/Training/quakeworx/cdb_tpv23`.\n",
"\n",
"`/opt/notebooks` is the system directory where all your jobs are stored and `Training/quakeworx/cdb_tpv23` is the structure of the Github repository you just cloned.\n",
"\n",
"You can check all the job names `{YOUR_JOB_NAME}` you have submitted:"
"We start from checking all the job names `{YOUR_JOB_NAME}` you have submitted:"
]
},
{
Expand All @@ -157,7 +127,8 @@
"metadata": {},
"outputs": [],
"source": [
"!ls /opt/notebooks # list all job names"
"# ! in the front keeps the command running in the terminal, instead of the notebook\n",
"!ls /jobs # list all job names"
]
},
{
Expand All @@ -176,8 +147,8 @@
"outputs": [],
"source": [
"# Replace {YOUR_JOB_NAME} with the job name you used to run your cdb_tpv23 job.\n",
"# result_dir = '/opt/notebooks/{YOUR_JOB_NAME}/'\n",
"result_dir = '/opt/notebooks/SeisSol_cdb_tpv23/'"
"# result_dir = '/jobs/{YOUR_JOB_NAME}/'\n",
"result_dir = '/jobs/SeisSol_cdb_tpv23/'"
]
},
{
Expand All @@ -204,11 +175,16 @@
"from matplotlib import pyplot as plt\n",
"from mpl_toolkits.mplot3d.art3d import Poly3DCollection\n",
"import matplotlib.colors as mcolors\n",
"%matplotlib inline\n",
"\n",
"plt.rcParams['font.size'] = 18\n",
"\n",
"# Dedicated library for post-processing HDF5 format SeisSol output\n",
"import seissolxdmf as seisx"
"import seissolxdmf as seisx\n",
"\n",
"# Additional standard python library to access file names inside a folder\n",
"import os\n",
"import re"
]
},
{
Expand All @@ -227,7 +203,7 @@
"outputs": [],
"source": [
"# Load data\n",
"xdmfFilename = result_dir + \"outputs/cdb_tpv23-fault.xdmf\"\n",
"xdmfFilename = os.path.join(result_dir,\"outputs/cdb_tpv23-fault.xdmf\")\n",
"sx = seisx.seissolxdmf(xdmfFilename)\n",
"ndt = sx.ReadNdt() - 1 #sx.ReadNdt() provides the total number of time steps that have been written out\n",
"xyz = sx.ReadGeometry()\n",
Expand Down Expand Up @@ -358,7 +334,7 @@
"ax2.view_init(elev=15, azim=250)\n",
"\n",
"#plt.tight_layout()\n",
"plt.show()\n"
"plt.show();"
]
},
{
Expand Down Expand Up @@ -520,10 +496,6 @@
"metadata": {},
"outputs": [],
"source": [
"## Additional standard python library to access file names inside a folder\n",
"import os\n",
"import re\n",
"\n",
"import pandas as pd"
]
},
Expand Down Expand Up @@ -636,8 +608,8 @@
"plt.grid(False)\n",
"\n",
"plt.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0)\n",
"\n",
"#plt.savefig(\"p_shearTrac.pdf\")"
"#plt.savefig(\"p_shearTrac.pdf\")\n",
"plt.show();"
]
},
{
Expand Down Expand Up @@ -672,7 +644,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.7"
"version": "3.11.11"
}
},
"nbformat": 4,
Expand Down
95 changes: 49 additions & 46 deletions quakeworx/earthquake-tsunami/ttpv_qwx.ipynb

Large diffs are not rendered by default.

Binary file added quakeworx/kaikoura/figures/Kaikoura_Fig1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added quakeworx/kaikoura/figures/Kaikoura_Fig2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added quakeworx/kaikoura/figures/Kaikoura_Fig3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added quakeworx/kaikoura/figures/Kaikoura_Fig4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 12 additions & 6 deletions quakeworx/kaikoura/kaikoura_qwx.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
"All files to reproduce the published high-resolution model are openly available at [zenodo](https://zenodo.org/record/2538024#.Yu948S8RphA).\n",
"\n",
"The dynamic rupture earthquake scenario, reproduces key characteristics of the earthquake and constraints puzzling features inferred from high-quality observations including a large gap separating surface rupture traces, the possibility of significant slip on the subduction interface, the non-rupture of the Hope fault, and slow apparent rupture speed. This model shows that the observed rupture cascade is dynamically consistent with regional stress estimates and a crustal fault network geometry inferred from seismic and geodetic data. Our model proposes that the complex fault system operates at low apparent friction thanks to the combined effects of overpressurized fluids, low dynamic friction and stress concentrations induced by deep fault creep.\n",
"![](../../kaikoura/Kaikoura_Fig1.png)\n",
"*Fault network geometry prescribed for dynamic earthquake rupture modeling. Colors on fault surfaces indicate dipping angle (dip), highlighting the flattening with depth of the Jordan Thrust, Kekerengu, and Needles faults. All segments dip westwards, except for the Humps Fault Zone. The Hope, Culverden, and Leonard Mound faults, dipping, respectively, 70° toward NorthWest, 70° toward South, and 50° toward SouthEast, are displayed in yellow. These faults do not rupture in our dynamic rupture model. Also shown are the high-resolution topography and bathymetry (Mitchell et al., 2012), and S-wave speeds (Vs) on four cross-sections of the 3D subsurface structure (Eberhart-Phillips et al., 2010) incorporated in the model.*\n"
"\n",
"![Figure01](figures/Kaikoura_Fig1.png)\n",
"\n",
"*Fault network geometry prescribed for dynamic earthquake rupture modeling. Colors on fault surfaces indicate dipping angle (dip), highlighting the flattening with depth of the Jordan Thrust, Kekerengu, and Needles faults. All segments dip westwards, except for the Humps Fault Zone. The Hope, Culverden, and Leonard Mound faults, dipping, respectively, 70° toward NorthWest, 70° toward South, and 50° toward SouthEast, are displayed in yellow. These faults do not rupture in our dynamic rupture model. Also shown are the high-resolution topography and bathymetry (Mitchell et al., 2012), and S-wave speeds (Vs) on four cross-sections of the 3D subsurface structure (Eberhart-Phillips et al., 2010) incorporated in the model.*"
]
},
{
Expand All @@ -29,7 +31,8 @@
"2. CAD 2: Creating the complex fault network constrained by fault traces and varying fault dip and intersect all faults with each other and with topo-bathymetry in a manifold manner;\n",
"3. Mesh: Automatic volumetric meshing using unstructured tetrahedral elements. Keep in mind our two differing resolution criteria: the CFL criterion determines the required resolution for seismic wave propagation, and the dynamic rupture process zone/cohesive zone size, the region behind the rupture front where the fault strength drops from its static to dynamic level ([Day et al., 2005](https://agupubs.onlinelibrary.wiley.com/doi/abs/10.1029/2005jb003813); for SeisSol: [Wollherr et al., 2018](https://academic.oup.com/gji/article/214/3/1556/5017447?login=true)).\n",
"\n",
"![](../../kaikoura/Kaikoura_Fig3.png)\n",
"![Figure03](figures/Kaikoura_Fig3.png)\n",
"\n",
"*Snapshot of the wavefield (absolute particle velocity in m/s) across the fault network at a rupture time of 55 s. The high-resolution model is discretized by an unstructured mesh accounting for three-dimensional (3D) subsurface structure and high-resolution topography and featuring refined resolution in the vicinity of the faults. It incorporates the nonlinear interaction between frictional on-fault failure, off-fault plasticity, and seismic wave propagation.*\n",
"\n",
"For this training, we provide a pre-prepared smaller mesh file (approx. 280,000 elements). The prescribed resolution here is 1500 m element edge length everywhere on the faults, and static mesh-coarsening away from the fault system. The published high-resolution mesh, for comparison, consists of 29 million elements, decreasing the shortest element edge lengths to 300 m close to faults, and at most 1000 m close to topography and bathymetry resolving the seismic wavefield at frequencies up to 3 Hz in the source region. The mesh is visible in the figures above. You can also visualize the training mesh either using (1) ParaView on your local laptop or (2) use the code snippet below on your local laptop (because rendering with pyvista is currently not well supported in the Quakeworx Gateway).\n",
Expand Down Expand Up @@ -81,10 +84,13 @@
"We now visualize what we call the fault output generated by SeisSol. These are the modeled fields across the complex fault surfaces. Note that generating this output includes interpolation, since SeisSol is solving the governing PDEs in their weak form. We can visualise all processes occurring across the fault surface during dynamic rupture, e.g. slip rates, slip, shear and normal stresses, effective friction etc.\n",
"\n",
"This is how the published high-resolution rupture looks like:\n",
"![](../../kaikoura/Kaikoura_Fig2.png)\n",
"\n",
"![Figure02](figures/Kaikoura_Fig2.png)\n",
"\n",
"*Overview of the simulated rupture propagation. Snapshots of the absolute slip rate are shown every 5 s. The figure focuses on four different portions of the fault system, following the rupture front as it propagates from South to North. Labels indicate remarkable dynamic features of the rupture.*\n",
"\n",
"![](../../kaikoura/Kaikoura_Fig4.png)\n",
"![Figure04](figures/Kaikoura_Fig4.png)\n",
"\n",
"*Source properties of the published dynamic rupture model and comparison to observational inferences. Final slip magnitude a) modeled here and b) inferred by Xu et al., 2018. Final rake angle c) modeled and d) inferred by Xu et al., 2018, e) Modeled rupture velocity. f) Modeled moment rate function compared with those inferred by Bai et al., 2017, from teleseismic and tsunami data, by Zhang et al., 2017, from seismic waveform inversion and from teleseismic data by the SCARDEC method, Vallee et al., 2011.*\n",
"\n",
"Check out the [documentation](https://seissol.readthedocs.io/en/latest/fault-output.html#outputmask) for an explanation of the variable names and change 'SRs' to other quantities of interest."
Expand Down Expand Up @@ -391,7 +397,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.2"
"version": "3.11.11"
}
},
"nbformat": 4,
Expand Down
Binary file added quakeworx/tpv13/figures/paraview.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added quakeworx/tpv13/figures/tpv13.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion quakeworx/tpv13/paraview.jpg

This file was deleted.

1 change: 0 additions & 1 deletion quakeworx/tpv13/tpv13.jpg

This file was deleted.

68 changes: 30 additions & 38 deletions quakeworx/tpv13/tpv13_qwx.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"* prescribed nucleation zone, square, 3 x 3 km in size, locally lower static coefficient of friction\n",
"* strongly supershear rupture conditions\n",
"\n",
"![](tpv13.jpg)\n",
"![Figure01](figures/tpv13.jpg)\n",
"\n",
"[Detailed benchmark description (SCEC)](https://strike.scec.org/cvws/tpv12_13docs.html).\n",
"\n",
Expand Down Expand Up @@ -147,7 +147,7 @@
}
],
"source": [
"!gmsh -3 ../../tpv13/tpv13_training.geo -setnumber dip 60"
"!gmsh -3 tpv13/tpv13_training.geo -setnumber dip 60"
]
},
{
Expand All @@ -156,9 +156,9 @@
"metadata": {},
"source": [
"You should now have a file called `tpv13_training.msh`.\n",
"In the next step, we translate this file into the efficient HDF5 format, which is going to be read in by SeisSol. HDF5 stands for the Hierarchical Data Format version 5, and is an open-source file format that supports large, complex, heterogeneous data. HDF5 uses a \"file directory\" like structure that allows you to organize data within the file in many different structured ways, as you might do with files on your computer, and is built for fast I/O processing and storage.\n",
"In the next step, we would translate this file into the efficient HDF5 format, which is going to be read in by SeisSol. HDF5 stands for the Hierarchical Data Format version 5, and is an open-source file format that supports large, complex, heterogeneous data. HDF5 uses a \"file directory\" like structure that allows you to organize data within the file in many different structured ways, as you might do with files on your computer, and is built for fast I/O processing and storage.\n",
"\n",
"We use our tool pumgen for mesh generation for SeisSol, which is [open-source software]( https://github.com/SeisSol/PUMGen), see also [SeisSol's documentation]( https://seissol.readthedocs.io/en/latest/meshing-with-pumgen.html). However, here **we already created the final mesh file based on the `tpv13_training.msh` for you** sepcifically the file `tpv13_training.puml.h5`.\n",
"We use our tool pumgen for mesh generation for SeisSol, which is [open-source software](https://github.com/SeisSol/PUMGen), see also [SeisSol's documentation](https://seissol.readthedocs.io/en/latest/meshing-with-pumgen.html). However, here **we already created the final mesh file based on the `tpv13_training.msh` for you** sepcifically the file `tpv13_training.puml.h5`.\n",
"While the .h5 file is read by SeisSol, another file `tpv13_training.xdmf` could be used to visualize the mesh, as in the following.\n",
"\n",
"On you local machine (not the Gateway) you could either load the .xdmf mesh file into Paraview (see [Visualization with Paraview](#Visualization-with-Paraview) below) or after installing the python modules `vtk` and `pyvista`, visualize the mesh locally using the code snippet below. You would see that the mesh is refined close to the fault.\n",
Expand Down Expand Up @@ -253,33 +253,6 @@
"The above code snippet for visualization is based on ```pyvista``` and ```ipywidgets```, whose rendoring is not well supported inside the container. We show a simpler way of quick visualization of the results. It also comes with fewer non-standard python3 dependencies."
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "7299f639-f486-46b6-90ae-c26d1ba27bd1",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Defaulting to user installation because normal site-packages is not writeable\n",
"Collecting seissolxdmf\n",
" Downloading seissolxdmf-0.1.3-py3-none-any.whl.metadata (1.6 kB)\n",
"Requirement already satisfied: numpy in /opt/conda/lib/python3.12/site-packages (from seissolxdmf) (1.26.4)\n",
"Requirement already satisfied: h5py in /opt/conda/lib/python3.12/site-packages (from seissolxdmf) (3.11.0)\n",
"Downloading seissolxdmf-0.1.3-py3-none-any.whl (5.9 kB)\n",
"Installing collected packages: seissolxdmf\n",
"Successfully installed seissolxdmf-0.1.3\n"
]
}
],
"source": [
"!pip install seissolxdmf\n",
"import sys\n",
"sys.path.append(\"/home/qwxdev/.local/lib/python3.12/site-packages\")"
]
},
{
"cell_type": "code",
"execution_count": 3,
Expand Down Expand Up @@ -320,6 +293,18 @@
"path = \"SeisSol_TPV13\""
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f8bc9b15-2dce-440c-9456-745e6b168b22",
"metadata": {},
"outputs": [],
"source": [
"# Load data\n",
"xdmfFilename = f\"/jobs/{job_name}/outputs/tpv13-fault.xdmf\"\n",
"print(\"Using the following SeisSol output:\", xdmfFilename)"
]
},
{
"cell_type": "code",
"execution_count": 5,
Expand All @@ -338,8 +323,6 @@
}
],
"source": [
"# Load data\n",
"xdmfFilename = \"../../../{}/outputs/tpv13-fault.xdmf\".format(path)\n",
"sx = seisx.seissolxdmf(xdmfFilename)\n",
"ndt = sx.ReadNdt() - 1\n",
"xyz = sx.ReadGeometry()\n",
Expand Down Expand Up @@ -473,6 +456,18 @@
" cbar = plt.colorbar(orientation=\"horizontal\", label=\"Displacement [m]\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "67f7ed53-75f0-4cfa-ac79-fffeecc2074c",
"metadata": {},
"outputs": [],
"source": [
"# Load data\n",
"xdmfFilename = f\"/jobs/{job_name}/outputs/tpv13-surface.xdmf\"\n",
"print(\"Using the following SeisSol output:\", xdmfFilename)"
]
},
{
"cell_type": "code",
"execution_count": 7,
Expand All @@ -498,8 +493,6 @@
}
],
"source": [
"xdmfFilename = \"../../../{}/outputs/tpv13-surface.xdmf\".format(path)\n",
"\n",
"fig = plt.figure()\n",
"fig.set_size_inches(10, 5)\n",
"ax1 = plt.gca()\n",
Expand Down Expand Up @@ -550,7 +543,6 @@
],
"source": [
"import sympy as sp\n",
"import numpy as np\n",
"\n",
"# Define symbolic variables\n",
"s3_to_s1, sigma_max, dip, mu_s, mu_d = sp.symbols(\"s3_to_s1 sigma_max dip mu_s mu_d\")\n",
Expand Down Expand Up @@ -609,7 +601,7 @@
"* 5) adjusts the colorscale automatically to the data range. \n",
"* With 6) you can change the properties of your color scale (i.e. color, range, log scale). \n",
"\n",
"![](paraview.jpg)\n"
"![Figure02](figures/paraview.jpg)"
]
},
{
Expand Down Expand Up @@ -655,7 +647,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.2"
"version": "3.11.11"
}
},
"nbformat": 4,
Expand Down
Loading
Loading