Skip to content

Commit

Permalink
QDYN release 2.0.0
Browse files Browse the repository at this point in the history
User features:
- Microphysically-based friction model: Chen-Niemeijer-Spiers (CNS) model
- Thermal pressurization
- Faults surrounded by damaged zone
- Runge-Kutta solver
- Free surface in 2D simulations
- Python wrapper
- Windows 10 compatibility

Developer features:
- Testing suite
- SCEC2018 benchmark results
- Code clean-up and re-structuring
- Versioning and version control policy
  • Loading branch information
martijnende committed Dec 11, 2018
2 parents 275e9af + 4dd3fcf commit 8142cfd
Show file tree
Hide file tree
Showing 50 changed files with 2,028 additions and 516 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

## News

*11 December 2018* | QDYN version 2.0 has been released!

*6 December 2018* | Results of QDYN earthquake cycle simulations on faults surrounded by damaged zones were presented at:
* the AGU Fall Meeting 2017 (San Francisco, 11-15 December 2017): B. Idini and J. P. Ampuero, *Rupture complexity promoted by damaged fault zones in earthquake cycle models* (doi:10.1002/essoar.10500080.1, [poster](https://www.essoar.org/doi/abs/10.1002/essoar.10500080.1))
* the [10th ACES International Workshop](http://quaketm.bosai.go.jp/~shiqing/ACES2018/index_aces.html) (Japan, September 25-28, 2018), J. P. Ampuero et al., *Rupture complexity promoted by damaged fault zones in earthquake cycle models* ([slides](http://quaketm.bosai.go.jp/~shiqing/ACES2018/abstracts/aces_abstract_ampuero.pdf))
Expand Down Expand Up @@ -109,18 +111,17 @@ Questions, feedback or suggestions can be submitted via our [issue tracking syst
------------------------
## Developers

[Yingdi Luo](https://science.jpl.nasa.gov/people/YLuo/) (NASA JPL, USA)
[Yingdi Luo](https://science.jpl.nasa.gov/people/YLuo/) (UCLA / NASA JPL, USA)

[Jean-Paul Ampuero](http://www.seismolab.caltech.edu/ampuero_jp.html) (Caltech Seismolab, USA and IRD / UCA, Geoazur, France)
[Jean-Paul Ampuero](http://www.seismolab.caltech.edu/ampuero_jp.html) (Caltech Seismolab, USA and IRD / UCA, Géoazur, France)

[Percy Galvez](https://smi.kaust.edu.sa/Pages/People-Galvez.aspx) (KAUT, Saudi Arabia)
[Percy Galvez](https://smi.kaust.edu.sa/Pages/People-Galvez.aspx) (KAUST, Saudi Arabia; AECOM, Switzerland)

[Martijn van den Ende](https://www.linkedin.com/in/martijnvandenende) (Universite Cote d'Azur, Geoazur, France)
[Martijn van den Ende](https://www.linkedin.com/in/martijnvandenende) (Université Côte d'Azur, Géoazur, France)

[Benjamin Idini](http://www.seismolab.caltech.edu/idini_b.html) (Caltech Seismolab, USA)



-------------------------

## Suggested References
Expand Down
Binary file modified doc/QDYN_man_GIT.pdf
Binary file not shown.
Binary file added examples/CNS/stick-slip/benchmark.tar.gz
Binary file not shown.
97 changes: 97 additions & 0 deletions examples/CNS/stick-slip/stick-slip.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Importing some required modules
import gzip
import os
import pickle
import sys

import matplotlib.pyplot as plt

# Go up in the directory tree
upup = [os.pardir]*4
qdyn_dir = os.path.join(*upup)
# Get QDYN src directory
src_dir = os.path.abspath(
os.path.join(
os.path.join(__file__, qdyn_dir), "src")
)
# Append src directory to Python path
sys.path.append(src_dir)
# Import QDYN wrapper
from pyqdyn import qdyn
from numpy.testing import assert_allclose

# QDYN class object
p = qdyn()

# Python dictionary with general settings
set_dict = {
"FRICTION_MODEL": "CNS",
"ACC": 1e-10,
"SOLVER": 2,
"MU": 2e10,
"TMAX": 1e4,
"DTTRY": 1e-6,
"MESHDIM": 0,
"NTOUT": 10000,
"SIGMA": 5e6,
"V_PL": 1e-6,
"L": 1e1,
}

# Python dictionary with CNS parameters
set_dict_CNS = {
"A": [1e-10],
"N": [1],
"M": [1],
"A_TILDE": 0.02,
"MU_TILDE_STAR": 0.4,
"Y_GR_STAR": 1e-6,
"PHI_INI": 0.25,
"THICKNESS": 1e-4,
"TAU": 3e6,
}

# Add CNS dictionary to QDYN dictionary
set_dict["SET_DICT_CNS"] = set_dict_CNS

p.settings(set_dict)
p.render_mesh()

# Write input file
p.write_input()

# Run simulation
p.run()

# Get our results
p.read_output()

# Plot results
plt.subplot(211)
plt.plot(p.ot["t"], p.ot["tau"] / p.set_dict["SIGMA"])
plt.ylabel("friction [-]")
plt.subplot(212)
plt.plot(p.ot["t"], p.ot["theta"] * 100)
plt.ylabel("porosity [%]")
plt.xlabel("time [s]")
plt.tight_layout()
plt.show()

with gzip.GzipFile("benchmark.tar.gz", "r") as f:
benchmark = pickle.load(f)

print("Performing benchmark comparison")

plt.figure(2)
plt.plot(p.ot["t"], p.ot["tau"]*1e-6, label="Current")
plt.plot(benchmark["t"], benchmark["tau"]*1e-6, "k--", label="Benchmark")
plt.xlabel("time [s]")
plt.ylabel("shear stress [MPa]")
plt.legend(loc=4, ncol=2)
plt.tight_layout()
plt.show()

assert_allclose(benchmark["t"], p.ot["t"], rtol=1e-4)
assert_allclose(benchmark["tau"], p.ot["tau"], rtol=1e-4)
assert_allclose(benchmark["phi"], p.ot["theta"], rtol=1e-4)
print("Benchmark comparison OK")
Binary file added examples/CNS/velocity-step/benchmark.tar.gz
Binary file not shown.
66 changes: 47 additions & 19 deletions examples/CNS/velocity-step/v-step.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
# Path where QDYN executable and wrapper are located
qdyn_path = "/home/martijn/QDyn/src"

# Importing some required modules
import numpy as np
import matplotlib.pyplot as plt
import gzip
import os
import pickle
import sys
sys.path.append(qdyn_path)
from pyqdyn import qdyn

# CNS kinetic parameters
import matplotlib.pyplot as plt
import numpy as np

d = 10e-6 # Nominal grain size
O = 2.69e-5 # Molar volume
R = 8.3144 # Universal gas constant
T = 293 # Absolute temperature
DCS0 = 2.79e-15 # Kinetic pre-factor
dH = 2.45e4 # Activation energy
DCS = DCS0*np.exp(-dH/(R*T)) # Kinetic parameter at T
Z_ps = (24/np.pi)*DCS*O/(R*T*d**3) # Combined (lumped) kinetic constant
# Go up in the directory tree
upup = [os.pardir]*4
qdyn_dir = os.path.join(*upup)
# Get QDYN src directory
src_dir = os.path.abspath(
os.path.join(
os.path.join(__file__, qdyn_dir), "src")
)
# Append src directory to Python path
sys.path.append(src_dir)
# Import QDYN wrapper
from pyqdyn import qdyn
from numpy.testing import assert_allclose

# QDYN class object
p = qdyn()

# Define where the QDYN executable is located
p.qdyn_path = qdyn_path
Z_ps = 1e-10

# Python dictionary with general settings
set_dict = {
Expand All @@ -41,7 +42,9 @@

# Python dictionary with CNS parameters
set_dict_CNS = {
"IPS_CONST_DIFF": Z_ps,
"A": [0.5*Z_ps, 0.5*Z_ps, 0.0*Z_ps],
"N": [1, 1, 1],
"M": [1, 1, 1],
"A_TILDE": 0.02,
"MU_TILDE_STAR": 0.4,
"Y_GR_STAR": 1e-6,
Expand All @@ -64,6 +67,10 @@
# Total slip distance per simulation
x_ss = 500e-6

t_all = np.array([])
tau_all = np.array([])
phi_all = np.array([])

# Loop over all velocity steps
for i, V in enumerate(Vs):
# Set load-point velocity
Expand Down Expand Up @@ -93,6 +100,10 @@
plt.subplot(212)
plt.plot(p.ot["t"]-p.ot["t"].iloc[0]+t_final, p.ot["theta"]*100)

t_all = np.hstack([t_all, p.ot["t"]-p.ot["t"].iloc[0]+t_final])
tau_all = np.hstack([tau_all, p.ot["tau"]])
phi_all = np.hstack([phi_all, p.ot["theta"]])

# Set starting point for next simulation
tau_final = p.ot["tau"].values[-1]
phi_final = p.ot["theta"].values[-1]
Expand All @@ -106,3 +117,20 @@
plt.tight_layout()
plt.show()

with gzip.GzipFile("benchmark.tar.gz", "r") as f:
benchmark = pickle.load(f)

plt.figure(2)
plt.plot(t_all, tau_all*1e-6, label="Current")
plt.plot(benchmark["t"], benchmark["tau"]*1e-6, "k--", label="Benchmark")
plt.xlabel("time [s]")
plt.ylabel("shear stress [MPa]")
plt.legend(loc=4, ncol=2)
plt.tight_layout()
plt.show()

print("Performing benchmark comparison")
assert_allclose(benchmark["t"], t_all, rtol=1e-6)
assert_allclose(benchmark["tau"], tau_all, rtol=1e-6)
assert_allclose(benchmark["phi"], phi_all, rtol=1e-6)
print("Benchmark comparison OK")
26 changes: 15 additions & 11 deletions examples/PyQDYN/Tse+Rice/tse_rice.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,29 @@
# Omit the run argument to execute script file without
# re-running the simulation (e.g. for plotting data)

# Path where QDYN executable and wrapper are located
from __future__ import print_function

qdyn_path = "/home/martijn/QDyn/src"

# Importing some required modules
import os
import sys
import numpy as np
sys.path.append(qdyn_path)
from pyqdyn import qdyn

import matplotlib.pyplot as plt
import numpy as np

# Go up in the directory tree
upup = [os.pardir]*4
qdyn_dir = os.path.join(*upup)
# Get QDYN src directory
src_dir = os.path.abspath(
os.path.join(
os.path.join(__file__, qdyn_dir), "src")
)
# Append src directory to Python path
sys.path.append(src_dir)
# Import QDYN wrapper
from pyqdyn import qdyn

# QDYN class object
p = qdyn()

# Define where the QDYN executable is located
p.qdyn_path = qdyn_path

# Number of fault segments
N = np.power(2, 11)

Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions examples/single_asperity/single_asperity.m
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
%p.V_0 = 1.01*p.V_SS ;
p.V_0 = ( 1.+0.01*exp( -(p.X/Lasp*2).^6 ) )*p.V_SS ;
p.V_0 = p.V_0/mean(p.V_0)*p.V_SS;

[p,ot1,ox1] = qdyn('run',p) ;


Expand Down
8 changes: 4 additions & 4 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ OPT = -O3 -Wall
#OPT = -O3 -Wall -fopenmp
#OPT = -O2 -w
#-- Intel Fortran --
#F90 = ifort
#OPT = -O3 -ip -ipo
# F90 = ifort
# OPT = -O3 -ip -ipo
# For parallel runs with OpenMP:
#OPT = -O3 -ip -ipo -parallel -openmp -par-threshold:50
#-no-inline-factor
Expand All @@ -43,11 +43,11 @@ OPT = -O3 -Wall

# 3. Set the compiler option that enables preprocessing in your compiler
# ifort
#PREPROC = -fpp
# PREPROC = -fpp
# gfortran
PREPROC = -cpp
#PG, KAUST server
CFLAGS = -B/usr/lib/x86_64-linux-gnu
# CFLAGS = -B/usr/lib/x86_64-linux-gnu
#CFLAGS = ''

#== END USER SETTINGS =============================================
Expand Down
15 changes: 11 additions & 4 deletions src/Makefile.depend
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
derivs_all.o: diffusion_solver.o fault_stress.o friction.o friction_cns.o \
problem_class.o
problem_class.o utils.o
diffusion_solver.o: constants.o mesh.o problem_class.o
fault_stress.o: constants.o fftsg.o mesh.o okada.o parallel.o utils.o
fault_stress.o: constants.o fftsg.o mesh.o okada.o parallel.o
friction.o: friction_cns.o problem_class.o
friction_cns.o: constants.o problem_class.o
initialize.o: constants.o diffusion_solver.o fault_stress.o friction.o mesh.o \
output.o parallel.o problem_class.o solver.o
input.o: constants.o mesh.o output.o parallel.o problem_class.o
main.o: derivs_all.o initialize.o input.o parallel.o problem_class.o solver.o
main.o: derivs_all.o initialize.o input.o parallel.o problem_class.o solver.o \
unittests.o
mesh.o: constants.o parallel.o
ode_bs.o: derivs_all.o parallel.o problem_class.o
ode_rk45.o: derivs_all.o
Expand All @@ -17,4 +18,10 @@ parallel.o: constants.o
problem_class.o: fault_stress.o mesh.o
solver.o: constants.o derivs_all.o diffusion_solver.o friction.o \
friction_cns.o ode_bs.o ode_rk45.o output.o parallel.o \
problem_class.o
problem_class.o utils.o
unittests.o: constants.o fault_stress.o friction.o mesh.o problem_class.o \
solver.o unittests_rsf.o
unittests_aux.o: constants.o problem_class.o solver.o
unittests_rsf.o: constants.o fault_stress.o friction.o mesh.o problem_class.o \
solver.o unittests_aux.o
utils.o: problem_class.o
2 changes: 1 addition & 1 deletion src/constants.f90
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@ module constants
! Which ODE solver to use:
! 1 : Bulirsch-Stoer
! 2 : Runge-Kutta-Fehlberg
integer :: SOLVER = 0
integer :: SOLVER_TYPE = 0

end module constants
Loading

0 comments on commit 8142cfd

Please sign in to comment.