-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathelastic.cpp
67 lines (57 loc) · 1.48 KB
/
elastic.cpp
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
// elastic.cpp
//
#include "elastic.hpp"
namespace Elastic {
// Helper Functions:
inline Real Q::HelperL(Velocity vpvs) {
Real L;
L = vpvs.Vs()/vpvs.Vp(); // beta/alpha
L *= L; // (beta/alpha)^2
L *= (4./3.); // (4/3)(beta/alpha)^2
return (L);
}
Real Q::Qp(Velocity vpvs) const {
Real Qval;
if (mUnknown==QUNK_QP) {
Real L = HelperL(vpvs);
Real L1 = 1. - L;
if (L==0.) { // Prevent a NaN if Vs = 0 and Qs = 0.
Qval = 0; // (Assumes Vs->0 dominates in the limit.)
} else { // This allows reasonable Qp values if user
Qval = L/mQs; // sets Qs=0 for water.
} //
Qval += L1/mQk;
Qval = 1./Qval;
} else {
Qval = mQp;
}
return (Qval);
}
Real Q::Qs(Velocity vpvs) const {
Real Qval;
if (mUnknown==QUNK_QS) {
Real L = HelperL(vpvs);
Real L1 = 1. - L;
Qval = 1./mQp; // Can return nan if mQp
Qval -= L1/mQk; // and mQk are both infinite
Qval = L/Qval; // and S velocity is zero.
} else {
Qval = mQs;
}
return (Qval);
}
Real Q::Qk(Velocity vpvs) const {
Real Qval;
if (mUnknown==QUNK_QK) {
Real L = HelperL(vpvs);
Real L1 = 1. - L;
Qval = 1./mQp; // Can return nan if mQp and
Qval -= L/mQs; // mQs are both infinite and
Qval = L1/Qval; // if vs = sqrt(3/4) * vp,
} else { // (or about 0.866 vp).
Qval = mQk;
}
return (Qval);
}
} // End namespace Elastic
///