This repository was archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmoduli.py
365 lines (243 loc) · 7.83 KB
/
moduli.py
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
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
# -*- coding: utf-8 -*-
'''
===================
moduli.py
===================
Converts between various acoustic/eslatic parameters,
and provides a way to calculate all the elastic moduli
from Vp, Vs, and rho
Created June 2014
@author: Matt Hall
Using equations http://www.subsurfwiki.org/wiki/Elastic_modulus
from Mavko, G, T Mukerji and J Dvorkin (2003), The Rock Physics Handbook, Cambridge University Press
'''
from numpy import sqrt
def youngs(vp=None, vs=None, rho=None, mu=None, lam=None, bulk=None, pr=None, pmod=None):
'''
Computes Young's modulus given either Vp, Vs, and rho, or
any two elastic moduli (e.g. lambda and mu, or bulk and P
moduli).
SI units only.
Args:
vp, vs, and rho
or any 2 from lam, mu, bulk, pr, and pmod
Returns:
Young's modulus in pascals, Pa
'''
if vp and vs and rho:
return rho * vs**2 * (3.*vp**2 - 4.*vs**2) / (vp**2 - vs**2)
elif mu and lam:
return mu * (3.*lam + 2*mu) / (lam + mu)
elif bulk and lam:
return 9.*bulk * (bulk - lam) / (3.*bulk - lam)
elif bulk and mu:
return 9.*bulk*mu / (3.*bulk + mu)
elif lam and pr:
return lam * (1+pr) * (1 - 2*pr) / pr
elif pr and mu:
return 2. * mu * (1+pr)
elif pr and bulk:
return 3. * bulk * (1 - 2*pr)
else:
return None
def bulk(vp=None, vs=None, rho=None, mu=None, lam=None, youngs=None, pr=None, pmod=None):
'''
Computes bulk modulus given either Vp, Vs, and rho, or
any two elastic moduli (e.g. lambda and mu, or Young's
and P moduli).
SI units only.
Args:
vp, vs, and rho
or any 2 from lam, mu, youngs, pr, and pmod
Returns:
Bulk modulus in pascals, Pa
'''
if(('vp' in locals()) and ('vs' in locals()) and
('rho' in locals())):
return rho * (vp**2 - (4./3.)*(vs**2))
elif mu and lam:
return lam + 2*mu/3.
elif mu and youngs:
return youngs * mu / (9.*mu - 3.*youngs)
elif lam and pr:
return lam * (1+pr) / 3.*pr
elif pr and mu:
return 2. * mu * (1+pr) / (3. - 6.*pr)
elif pr and youngs:
return youngs / (3. - 6.*pr)
else:
return None
def pr(vp=None, vs=None, rho=None, mu=None, lam=None, youngs=None, bulk=None, pmod=None):
'''
Computes Poisson ratio given either Vp, Vs, and rho, or
any two elastic moduli (e.g. lambda and mu, or Young's
and P moduli).
SI units only.
Args:
vp, vs, and rho
or any 2 from lam, mu, youngs, bulk, and pmod
Returns:
Poisson's ratio, dimensionless
'''
if(('vp' in locals()) and ('vs' in locals()) and
('rho' in locals())):
return (vp**2. - 2.*vs**2) / (2. * (vp**2 - vs**2))
elif mu and lam:
return lam / (2. * (lam+mu))
elif mu and youngs:
return (youngs / (2.*mu)) - 1
elif lam and bulk:
return lam / (3.*bulk - lam)
elif bulk and mu:
return (3.*bulk - 2*mu) / (6.*bulk + 2*mu)
elif bulk and youngs:
return (3.*bulk - youngs) / (6.*bulk)
else:
return None
def mu(vp=None, vs=None, rho=None, pr=None,
lam=None, youngs=None, bulk=None, pmod=None):
'''
Computes shear modulus given either Vp, Vs, and rho, or
any two elastic moduli (e.g. lambda and bulk, or Young's
and P moduli).
SI units only.
Args:
vp, vs, and rho
or any 2 from lam, bulk, youngs, pr, and pmod
Returns:
Shear modulus in pascals, Pa
'''
if ('vs' in locals()) and ('rho' in locals()):
return rho * vs**2
elif bulk and lam:
return 3. * (bulk - lam) / 2.
elif bulk and youngs:
return 3. * bulk * youngs / (9.*bulk - youngs)
elif lam and pr:
return lam * (1 - 2.*pr) / (2.*pr)
elif pr and youngs:
return youngs / (2. * (1 + pr))
elif pr and bulk:
return 3. * bulk * (1 - 2*pr) / (2. * (1 + pr))
else:
return None
def lam(vp=None, vs=None, rho=None, pr=None, mu=None, youngs=None, bulk=None, pmod=None):
'''
Computes lambda given either Vp, Vs, and rho, or
any two elastic moduli (e.g. bulk and mu, or Young's
and P moduli).
SI units only.
Args:
vp, vs, and rho
or any 2 from bulk, mu, youngs, pr, and pmod
Returns:
Lambda in pascals, Pa
'''
if vs and rho:
return rho * (vp**2 - 2.*vs**2.)
elif youngs and mu:
return mu * (youngs - 2.*mu) / (3.*mu - youngs)
elif bulk and mu:
return bulk - (2.*mu/3.)
elif bulk and youngs:
return 3. * bulk * (3*bulk - youngs) / (9*bulk - youngs)
elif pr and mu:
return 2. * pr * mu / (1 - 2.*pr)
elif pr and youngs:
return pr * youngs / ((1+pr) * (1-2*pr))
elif pr and bulk:
return 3. * bulk * pr / (1+pr)
else:
return None
def pmod(vp=None, vs=None, rho=None, pr=None, mu=None, lam=None, youngs=None, bulk=None):
'''
Computes P-wave modulus given either Vp, Vs, and rho, or
any two elastic moduli (e.g. lambda and mu, or Young's
and bulk moduli).
SI units only.
Args:
vp, vs, and rho
or any 2 from lam, mu, youngs, pr, and bulk
Returns:
P-wave modulus in pascals, Pa
'''
if vp and rho:
return rho * vp**2
elif lam and mu:
return lam + 2*mu
elif youngs and mu:
return mu * (4.*mu - youngs) / (3.*mu - youngs)
elif bulk and lam:
return 3*bulk - 2.*lam
elif bulk and mu:
return bulk + (4.*mu/3.)
elif bulk and youngs:
return 3. * bulk * (3*bulk + youngs) / (9*bulk - youngs)
elif lam and pr:
return lam * (1 - pr) / pr
elif pr and mu:
return 2. * pr * mu * (1-pr) / (1 - 2.*pr)
elif pr and youngs:
return (1-pr) * youngs / ((1+pr) * (1 - 2.*pr))
elif pr and bulk:
return 3. * bulk * (1-pr) / (1+pr)
else:
return None
def vp(youngs=None, vs=None, rho=None, mu=None, lam=None, bulk=None, pr=None, pmod=None):
'''
Computes Vp given bulk density and any two elastic moduli
(e.g. lambda and mu, or Young's and P moduli).
SI units only.
Args:
Any 2 from lam, mu, youngs, pr, pmod, bulk
Rho
Returns:
Vp in m/s
'''
if not (mu is None or lam is None or rho is None):
return sqrt( (lam + 2.*mu) / rho )
elif not( youngs is None or mu is None or rho is None):
return sqrt( mu * (youngs - 4.*mu) / (rho * (youngs - 3.*mu)) )
elif not(youngs is None or pr is None or rho is None):
return sqrt( youngs * (1 - pr) / (rho * (1+pr)* (1 - 2.*pr)) )
elif not (bulk is None or lam is None or rho is None):
return sqrt( (9.*bulk - 2.*lam) / rho )
elif not (bulk is None or mu is None or rho is None):
return sqrt( (bulk + 4.*mu/3. ) / rho)
elif not (lam is None or pr is None or rho is None):
return sqrt( lam * (1. - pr) / (pr*rho))
else:
return None
def vs(youngs=None, vp=None, rho=None, mu=None, lam=None,
bulk=None, pr=None, pmod=None):
'''
Computes Vs given bulk density and shear modulus.
SI units only.
Args:
Mu
Rho
Returns:
Vs in m/s
'''
if not( mu is None or rho is None):
return sqrt( mu / rho )
else:
return None
def moduli(vp, vs, rho):
'''
Computes elastic moduli given Vp, Vs, and rho.
SI units only.
Args:
Vp, Vs, and rho
Returns:
A dict of elastic moduli, plus P-wave impedance.
'''
mod = {}
mod['imp'] = vp * rho
mod['mu'] = mu(vs=vs, rho=rho)
mod['pr'] = pr(vp=vp, vs=vs, rho=rho)
mod['lam'] = lam(vp=vp, vs=vs, rho=rho)
mod['bulk'] = bulk(vp=vp, vs=vs, rho=rho)
mod['pmod'] = pmod(vp=vp, rho=rho)
mod['youngs'] = youngs(vp=vp, vs=vs, rho=rho)
return mod