Skip to content

Commit

Permalink
minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoalopez committed Oct 27, 2023
1 parent 5902eaa commit 713ecc6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 68 deletions.
67 changes: 5 additions & 62 deletions src/layered_media.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ def snell(vp1, vp2, vs1, vs2, theta1):
Parameters
----------
vp1 : float or array-like
Compressional velocity of upper layer.
vp2 : float or array-like
Compressional velocity of lower layer.
P-wave velocity of upper layer.
vs1 : float or array-like
Shear velocity of upper layer.
S-wave velocity of upper layer.
vp2 : float or array-like
P-wave velocity of lower layer.
vs2 : float or array-like
Shear velocity of lower layer.
S-wave velocity of lower layer.
theta1 : float or array-like
Angle of incidence of P-wave in upper layer in degrees.
Expand Down Expand Up @@ -77,61 +77,4 @@ def snell(vp1, vp2, vs1, vs2, theta1):
return theta2, phi1, phi2, p


def zoeppritz(vp1, vs1, rho1, vp2, vs2, rho2, theta1):
"""
The Zoeppritz equations describe seismic wave energy partitioning
at an interface, for example the boundary between two different
rocks. The equations relate the amplitude of incident P-waves to
reflected and refracted P- and S-waves at a plane interface for
a given angle of incidence.
Parameters
----------
vp1 : float or array-like
Compressional velocity of upper layer.
vs1 : float or array-like
Shear velocity of upper layer.
rho1 : float or array-like
Density of upper layer.
vp2 : float or array-like
Compressional velocity of lower layer.
vs2 : float or array-like
Shear velocity of lower layer.
rho2 : float or array-like
Density of lower layer.
theta1 : float or array-like
Angle of incidence for P wave in upper layer in degrees.
Returns
-------
Rpp : float or array-like
Amplitude coefficients for reflected P-waves.
"""

# Convert angles to radians for numpy functions
theta1 = np.deg2rad(theta1)

# Calculate reflection and refraction angles using Snell's law
theta2, phi1, phi2, _ = snell(vp1, vp2, vs1, vs2, theta1)

# Define matrices M and N based on Zoeppritz equations
M = np.array([
[-np.sin(theta1), -np.cos(phi1), np.sin(theta2), np.cos(phi2)],
[np.cos(theta1), -np.sin(phi1), np.cos(theta2), -np.sin(phi2)],
[2*rho1*vs1*np.sin(phi1)*np.cos(theta1), rho2*vs1*(1-2*np.sin(phi2)**2),
2*rho2*vs2*np.sin(phi2)*np.cos(theta2), rho2*vs2*(1-2*np.sin(phi2)**2)],
[-rho1*vp1*(1-2*np.sin(phi1)**2), rho1*vs1*np.sin(2*phi1),
rho2*vp2*(1-2*np.sin(phi2)**2), -rho2*vs2*np.sin(2*phi2)]
])

# TODO
N = None

# Solve system of equations to find amplitude coefficients
Z = np.linalg.solve(M, N)

return Z[0]


# End of file
9 changes: 5 additions & 4 deletions src/orthotropic_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ def Tsvankin_params(cij: np.ndarray, density: float):
Parameters
----------
cij : numpy.ndarray
The elastic stiffness tensor of the material.
The elastic stiffness tensor of the material
in GPa.
density : float
The density of the material.
The density of the material in g/cm3.
Returns
-------
Expand Down Expand Up @@ -86,13 +87,13 @@ def orthotropic_azimuthal_anisotropy(elastic, wavevectors):
-------
pandas.DataFrame
Tabular data object containing the propagation directions
and calculated Vp, Vs1, and Vs2 speeds using the weak polar
and calculated Vp, Vs1, and Vs2 speeds using the orthorhombic
anisotropy model.
"""
# extract azimuths and polar angles
azimuths, polar = wavevectors

# get Thomsen parameters
# get Tsvankin parameters
Vp0, Vs0, *params = Tsvankin_params(elastic.Cij, elastic.density)
epsilon1, delta1, gamma1, epsilon2, delta2, gamma2, delta3 = params

Expand Down
5 changes: 3 additions & 2 deletions src/polar_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ def Thomsen_params(cij: np.ndarray, density: float):
Parameters
----------
cij : numpy.ndarray
The elastic stiffness tensor of the material.
The elastic stiffness tensor of the material
in GPa.
density : float
The density of the material.
The density of the material in g/cm3.
Returns
-------
Expand Down

0 comments on commit 713ecc6

Please sign in to comment.