Skip to content

Commit de05347

Browse files
committed
updated version of constant stressing by explicitly modeling spring-slider model. works but likes decaying slip or crashes except for very narrow range of params
1 parent 9087998 commit de05347

1 file changed

Lines changed: 148 additions & 0 deletions

File tree

‎snippets/RSF/0D_hooke2.jl‎

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
# assume constant stressing rate
2+
using Plots
3+
include("calcyield_rsf.jl")
4+
include("calcvpvisc.jl")
5+
include("calc_sliprate_after.jl")
6+
include("calc_dt.jl")
7+
8+
# numerical paramters
9+
dx = 500
10+
dy = 500
11+
12+
# material parameters
13+
a = 0.011 # rate parameter
14+
b = 0.015 # state paramter
15+
L = 0.0045 # characteristic slip distance [m]
16+
mu0 = 0.5 # reference friction
17+
V0 = 4e-9 # reference slip rate [m/s]
18+
lambda = 0 # fluid pressure ratio
19+
cohesion = 0 # cohesion [Pa]
20+
poisson = 0.25 # poisson ratio
21+
G = 20e9 # shear modulus [Pa]
22+
23+
# constant variables
24+
#Vp = 1e-8
25+
P = 50e6 # pressure [Pa]
26+
etav = 1e24 # ductile viscosity [Pa]
27+
vy = 0
28+
29+
# stressing rate in 0D
30+
# simplified hookes law: stress rate = 2*G*strainrate
31+
# stress = 2*G*strain
32+
# strain = displacement/(2*dx)
33+
platerate = 4e-9
34+
35+
# initial velocity and state
36+
Vp = V0 / 10
37+
state = 0
38+
# initial viscoplastic viscosity
39+
etavp = etav
40+
# initial stress
41+
tau = 0e6
42+
43+
# initial displacement
44+
x = 0.5
45+
46+
function timestep(oldstate, Vp, etavp, tau, x)
47+
vx = Vp / 2 # update vx for dt calculation (assume all slip is on x-axis)
48+
dt = calc_dt(P, lambda, G, etavp, L, V0, poisson, dx, dy, vx, vy, Vp, oldstate)
49+
if dt < 1e-4
50+
dt = 1e-4
51+
elseif dt > 1e7
52+
dt = 1e7
53+
end
54+
# predefine variables
55+
newstate = nothing
56+
mud = nothing
57+
syield = nothing
58+
negative = false
59+
60+
while true
61+
# move block
62+
x = x + platerate * dt
63+
# compute stess
64+
tau = 2 * G * x / (2 * dx)
65+
if tau < 0
66+
println("negative")
67+
tau = abs(tau)
68+
negative = true
69+
end
70+
#println(tau)
71+
newstate, mud, syield = calcyield(a, b, L, mu0, V0, Vp, dt, oldstate, P, lambda, cohesion)
72+
etavp = calcvpvisc(syield, Vp, etav, dx, dy)
73+
# NAVIER STOKES WOULD BE SOLVED HERE
74+
Vp = calc_sliprate_RSF(a, b, mu0, V0, newstate, P, tau, lambda, cohesion)
75+
dtnew = calc_dt(P, lambda, G, etavp, L, V0, poisson, dx, dy, vx, vy, Vp, oldstate)
76+
# println(dt - dtnew)
77+
#if dtnew * 1.1 < dt
78+
# println("reset")
79+
# # reset displacement
80+
# x = x - platerate * dt
81+
# dt = dt * 0.5
82+
#if abs(Vp*dt)>0.4
83+
84+
#else
85+
break
86+
#end
87+
end
88+
89+
#println(x)
90+
# update position
91+
if negative == true
92+
x = x + Vp * dt
93+
else
94+
x = x - Vp * dt
95+
end
96+
# recompute stress
97+
#tau = 2 * G * x / (2 * dx)
98+
#println(x)
99+
#println(Vp)
100+
return dt, newstate, mud, etavp, Vp, tau, x
101+
end
102+
103+
# time step count
104+
niter = 5000
105+
106+
# initialize arrays
107+
Vps = zeros(niter)
108+
states = zeros(niter)
109+
muds = zeros(niter)
110+
dts = zeros(niter)
111+
taus = zeros(niter)
112+
xs = zeros(niter)
113+
114+
for i = 1:niter
115+
global state, Vp, etavp, tau, x
116+
dt, state, mud, etavp, Vp, tau, x = timestep(state, Vp, etavp, tau, x)
117+
#println(tau)
118+
Vps[i] = Vp
119+
states[i] = state
120+
muds[i] = mud
121+
dts[i] = dt
122+
taus[i] = tau
123+
xs[i] = x
124+
end
125+
126+
times = cumsum(dts)
127+
128+
# interface strength
129+
istrength = P .* (mu0 .+ b * states)
130+
131+
#plot(times, states)
132+
p = plot(times[1:end] / 3600 / 24 / 365.25, Vps[1:end], yscale=:log10)
133+
xlabel!("Time in years")
134+
ylabel!("Vp in m/s")
135+
display(p)
136+
p = plot(times[1:end] / 3600 / 24 / 365.25, taus[1:end] / 1e6, label="stress")
137+
#p = plot!(times[1:end] / 3600 / 24 / 365.25, istrength[1:end] / 1e6, label="interface strength")
138+
xlabel!("Time in years")
139+
ylabel!("stress in MPa")
140+
display(p)
141+
p = plot(dts, yscale=:log10)
142+
xlabel!("Time step no.")
143+
ylabel!("dt in s")
144+
display(p)
145+
p = plot(times / 3600 / 24 / 365.25, xs)
146+
xlabel!("Time step no.")
147+
ylabel!("displacement in m")
148+
display(p)

0 commit comments

Comments
 (0)