-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathphysical_params.jl
247 lines (204 loc) · 4.93 KB
/
physical_params.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
using PGFPlotsX
function μ(x, y, B_p)
c = B_p.c
μ_in = B_p.μ_in
μ_out = B_p.μ_out
r̄ = B_p.r̄
r_w = B_p.r_w
on = B_p.on
if on == false
if ndims(x) == 2
return repeat([μ_out], outer=size(x))
else
return repeat([μ_out], outer=length(x))
end
else
return (μ_out - μ_in)/2 *
(tanh.((x .^ 2 .+ c^2 * y .^ 2 .- r̄) ./ r_w) .+ 1) .+ μ_in
end
end
function plot_basin(x, y, B_p)
x = collect(x)
y = collect(y)
nx = length(x)
ny = length(y)
xm = kron(x, ones(ny)')
ym = kron(y', ones(nx))
μ_vals = μ(xm, ym, B_p)
@pgf basin_plot = TikzPicture(
Axis(
{
height = "6cm",
width = "6cm",
view=(0, 90),
colorbar_horizontal,
"colormap/blackwhite",
colorbar_style={
xlabel=raw"$\mu$ (GPa)",
xtick=[B_p.μ_out, B_p.μ_in],
xticklabels=[raw"$\mu_{out}$", raw"$\mu_{in}$"]
},
y_dir="reverse",
ticks="none",
},
Plot3(
{
surf,
shader="flat",
},
Coordinates(x,y, μ_vals)
)
),
Axis(
{
height = "6cm",
width = "6cm",
axis_lines="box",
ticks="none",
}
),
Axis(
{
height = "6cm",
width = "6cm",
ymin=y[1],
ymax=y[end],
xmin=x[1],
xmax=x[end],
y_dir="reverse",
ytick=[4, 8],
axis_y_line="middle",
yticklabels=["D", "H"],
xtick=[-40, 40],
xticklabels=["-L", "L"],
xticklabel_pos="top",
}
)
)
pgfsave("../Basin_paper/figures/basin_plot.tex", basin_plot)
end
function ρ(x, y, B_p)
c = B_p.c
ρ_in = B_p.ρ_in
ρ_out = B_p.ρ_out
r̄ = B_p.r̄
r_w = B_p.r_w
on = B_p.on
if on == false
if ndims(x) == 2
return repeat([ρ_out], outer=size(x))
else
return repeat([ρ_out], outer=length(x))
end
else
return (ρ_out - ρ_in)/2 *
(tanh.((x .^ 2 .+ c^2 * y .^ 2 .- r̄) ./ r_w) .+ 1) .+ ρ_in
end
end
function μ_x(x, y, B_p)
c = B_p.c
μ_in = B_p.μ_in
μ_out = B_p.μ_out
r̄ = B_p.r̄
r_w = B_p.r_w
on = B_p.on
if on == false
if ndims(x) == 2
return zeros(size(x))
else
return zeros(length(x))
end
else
return ((μ_out - μ_in) .* x .*
sech.((x .^ 2 .+ c^2 * y .^ 2 .- r̄) ./ r_w) .^ 2) ./ r_w
end
end
function μ_y(x, y, B_p)
c = B_p.c
μ_in = B_p.μ_in
μ_out = B_p.μ_out
r̄ = B_p.r̄
r_w = B_p.r_w
on = B_p.on
if on == false
if ndims(x) == 2
return zeros(size(x))
else
return zeros(length(x))
end
else
return ((μ_out - μ_in) .* (c^2 * y) .*
sech.((x .^ 2 + c^2 * y .^ 2 .- r̄) ./ r_w) .^ 2) ./ r_w
end
end
function η(y, B_p)
μf = μ(0, y, B_p)
return μf ./ (2 .* sqrt.(μf ./ ρ(0, y, B_p)))
end
function fault_params(fc, Dc, Wf)
Hvw = 12
Ht = 6
δNp = findmin(abs.(Wf .- fc))[2]
gNp = findmin(abs.(16 .- fc))[2]
VWp = findmin(abs.((Hvw + Ht) .- fc))[2]
a = .015
b0 = .02
bmin = 0.0
function b_fun(y)
if 0 <= y < Hvw
return b0
end
if Hvw <= y < Hvw + Ht
return b0 + (bmin - b0)*(y-Hvw)/Ht
end
if Hvw + Ht <= y < Wf
return bmin
end
return bmin
end
RS = (σn = 50.0,
a = a,
b = b_fun.(fc),
Dc = Dc,
f0 = .6,
V0 = 1e-6,
τ_inf = 24.82,
Vp = 1e-9)
return δNp, gNp, VWp, RS
end
function plot_ab(a, b, fc)
a = repeat([a], length(fc))
@pgf ab_plot = Axis(
{
height = "6cm",
width = "5cm",
xmin = -0.01,
xmax = .02,
xlabel = raw"$a-b$ and $a$",
ylabel = "Depth (Km)",
xticklabel_style = ["/pgf/number format/fixed",
"/pgf/number format/precision=2",
"/pgf/number format/fixed zerofill"],
scaled_x_ticks = "false",
legend_entries = [raw"$(a-b)$", raw"$a$"],
legend_pos = "south west",
y_dir = "reverse",
}
)
@pgf push!(ab_plot, Plot(
{
color = "blue"
},
Table(a .- b, fc)
)
)
@pgf push!(ab_plot, Plot(
{
color = "red",
dashed
},
Table(a, fc)
)
)
pgfsave("../Basin_paper/figures/ab_plot.tex", ab_plot)
end