-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simple python script to compute stress tensor for nucleation #1095
base: master
Are you sure you want to change the base?
Conversation
A simple Python script to compute stress tensor (potentially useful for nucleation stress) given fault geometry and stress level
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #1095 +/- ##
=======================================
Coverage 13.79% 13.79%
=======================================
Files 268 268
Lines 15011 15011
=======================================
Hits 2071 2071
Misses 12940 12940 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this PR (and for noticing what was the problem with the nucleation stress in the Kaikoura and Palu setups).
But is it not simpler to use Tnuc_s and Tnuc_d?
!Switch
[Tnuc_n,Tnuc_s,Tnuc_d]: !LuaMap
returns: [Tnuc_n,Tnuc_s,Tnuc_d]
function: |
function f (x)
ShapeNucleation = 0.0
xh = -3581
yh = -29146
zh = -10000
-- rake in SeisSol convention
rake = 30 * math.pi/180
r_crit = 1500.0
r = math.sqrt((x["x"]-xh)^2 + (x["y"]-yh)^2 + (x["z"]-zh)^2 )
if (r < r_crit) then
peakNucleationStress = math.exp(r^2/(r^2-r_crit^2))*20*math.pow(10,6)
end
return {
Tnuc_n = 0.0,
Tnuc_d = peakNucleationStress*sin(rake),
Tnuc_s = peakNucleationStress*cos(rake)
}
end
(or you can replace 20 by R_nuc*(fs - fd)Pn0 + fdPn0)
import argparse | ||
from argparse import RawTextHelpFormatter | ||
|
||
def fnomral(dip,strike): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo
@@ -0,0 +1,118 @@ | |||
### compute nucleation stress tensor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add
#!/usr/bin/env python3
and chmod +x on the script
|
||
parser = argparse.ArgumentParser( | ||
description="Compute nucleation stress tensor given fault geometry and stress level", | ||
epilog="Examples: \npython get_nuc_stresstensor.py --geometry 9.58 202.27 90 --Traction -18.82 --yaml \npython get_nuc_stresstensor.py --geometry 9.58 202.27 90 --R_nuc 1.1 0.7 0.1 33.6", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove python (if you agree making the file executable)
dip, strike, rake = args.geometry | ||
|
||
### compute traction if needed | ||
if args.R_nuc is None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if not args.R_nuc
(try flake8 on your script)
T0 = R_nuc*(fs - fd)*Pn0 + fd*Pn0 | ||
|
||
Td0 = T0 * np.sin(np.deg2rad(rake)) | ||
Ts0 = T0 * np.cos(np.deg2rad(rake)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that rake must be in seissol convention.
(e.g. adapted from Slipnear: "rake" (degrees) is the slip angle (not Aki's convention, e.g. rake=+45 means right-lateral-reverse movement).
T0 = args.Traction | ||
else: | ||
R_nuc, fs, fd, Pn0 = args.R_nuc | ||
T0 = R_nuc*(fs - fd)*Pn0 + fd*Pn0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pn0 should be positive?
returns: [nuc_xx, nuc_yy, nuc_zz, nuc_xy, nuc_yz, nuc_xz] | ||
function: | | ||
function f (x) | ||
xc = -18440.7 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe leave empty?
same for xc, yc, r_crit?
end | ||
|
||
return {{ | ||
nuc_xx = ShapeNucleation * {S_cartesian[0,0]:.3f} * 1000000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
put the 1000000 in ShapeNucleation?
@AliceGabriel
A simple Python script to compute stress tensor (potentially useful for nucleation stress) given fault geometry and stress level