The Okada model is a widely used analytical solution for displacements and strains caused by a point or rectangular dislocation source in a 3D elastic half-space. We present OkadaTorch, a PyTorch implementation of the Okada model, where the entire code is differentiable; gradients with respect to input can be easily computed using automatic differentiation (AD). Our work consists of two components: a direct translation of the original Okada model into PyTorch, and a convenient wrapper interface for efficiently computing gradients and Hessians with respect to either observation station coordinates or fault parameters. This differentiable framework is well suited for fault parameter inversion, including gradient-based optimization, Bayesian inference, and integration with scientific machine learning (SciML) models. Our code is available here: https://github.com/msomeya1/OkadaTorch
The Okada model [1, 2] provides an analytical solution for displacements and strains (spatial derivatives of displacement) caused by a point or rectangular dislocation source in a 3D elastic half-space. It has become a standard tool in seismology and geodesy for modeling coseismic deformation, and has been widely used to estimate fault slip distributions from GNSS/InSAR data [3, 4, 5, 6, 7] and tsunami data [8, 9, 10].
The core of our implementation is a direct translation of the original FORTRAN subroutines into PyTorch functions:
import numpy as np
import torch
from OkadaTorch import DC3D
ALPHA = 2.0 / 3.0
x = np.linspace(-1, 1, 101)
y = np.linspace(-1, 1, 101)
z = np.linspace(-1, 0, 51)
X, Y, Z = np.meshgrid(x, y, z)
X = torch.from_numpy(X)
Y = torch.from_numpy(Y)
Z = torch.from_numpy(Z)
DEPTH = 2.0
DIP = torch.tensor(45.0)
AL1, AL2 = -0.2, 0.2
AW1, AW2 = -0.1, 0.1
DISL1, DISL2, DISL3 = 4.0, 3.0, 0.0
out, IRET = DC3D
(ALPHA,
X, Y, Z,
DEPTH,
DIP,
AL1, AL2,
AW1, AW2,
DISL1, DISL2, DISL3,
compute_strain=False,
is_degree=True)
Fig. 1
To simplify the use of functions and to easily calculate gradients and Hessians, we provide a high-level wrapper class, OkadaWrapper. This class abstracts the low-level subroutines (SPOINT, SRECTF, DC3D0, DC3D) and offers a unified interface for forward modeling and derivative computation.
The compute method performs the forward calculation; given the fault parameters, the displacements and/or strains are calculated.
from OkadaTorch import OkadaWrapper
coords = {
"x": x, # torch.Tensor representing x-coordinate of the station
"y": y # torch.Tensor representing y-coordinate of the station
}
params = { # All values are torch.Tensor (each is a scalar)
"x_fault": x_fault,
"y_fault": y_fault,
"depth": depth,
"length": length,
"width": width,
"strike": strike,
"dip": dip,
"rake": rake,
"slip": slip
}
okada = OkadaWrapper()
out = okada.compute(coords, params)
Fig. 1
Fig. 2The gradient method computes the derivative of the model output with respect to a single input variable. PyTorch’s function jacfwd is used internally.
out = okada.gradient(coords, params, arg="x")
out = okada.gradient(coords, params, arg="depth")
If compute_strain is True, out is a list of 3
displacement components and 9 strain components
differentiated by arg:
Fig. 3The hessian method computes the second-order derivatives of the model output with respect to two variables. PyTorch’s function jacfwd is used internally.
out = okada.hessian(coords, params, arg1="x", arg2="y")
out = okada.hessian(coords, params, arg1="depth", arg2="depth")
If compute_strain is True, out is a list of 3
displacement components and 9 strain components
differentiated by arg1 and arg2:
Fig. 4In this subsection, we demonstrate how fault parameters can be estimated from observed displacement data using gradient-based optimization. Rather than using real geodetic observations, we generate synthetic data by adding random noise to surface displacements obtained from forward modeling.
import torch
from OkadaTorch import OkadaWrapper
okada = OkadaWrapper()
params = { # initialization
"x_fault": torch.tensor(
0.0,
requires_grad=True
),
"y_fault": torch.tensor(
10.0,
requires_grad=True
),
"depth": torch.tensor(
1.0,
requires_grad=True
),
"length": torch.tensor(
150.0,
requires_grad=True
),
"width": torch.tensor(
60.0,
requires_grad=True
),
"strike": torch.tensor(
200.0,
requires_grad=True
),
"dip": torch.tensor(
45.0,
requires_grad=True
),
"rake": torch.tensor(
300.0,
requires_grad=True
),
"slip": torch.tensor(
10.0,
requires_grad=True
)
}
optimizer = torch.optim.Adam(
[
p
for p in params.values()
if p.requires_grad
],
)
for iter in range(2000):
optimizer.zero_grad()
ux, uy, uz = okada.compute(
coords,
params,
compute_strain=False,
is_degree=True,
fault_origin="topleft"
)
loss = 0.5 * (
(ux - ux_obs) ** 2 +
(uy - uy_obs) ** 2 +
(uz - uz_obs) ** 2
).sum()
loss.backward()
optimizer.step()
Fig. 5
Fig. 6
Fig. 7
Fig. 8
Table 1We have presented a PyTorch-based implementation of the Okada model for computing displacements and strains due to a point or rectangular dislocation source in a 3D elastic half-space. The implementation is differentiable, vectorized, and easily extensible.
Fig. 4
Fig. 10
In the study of preinstrumental earthquakes, historical seismology and palaeoseismology are well-established branches of seismological sciences. Techniques to evaluate ground motions and parameters of causing earthquakes that have left their mark in written documents and in the near-surface geology were developed. Ever since man-made structures have been erected, earthquakes have also left their marks on these constructions. However, damages in archaeologically excavated buildings or continuously preserved monuments are often hard to unravel in terms of the causative effects. The new branch of seismological sciences, archaeoseismology, is defined as “the detailed study of preinstrumental earthquakes that, by affecting locations of human occupation and their environments, have left their mark in the archaeological record” (Buck and Stewart, 2000). Following this definition, the detailed study of earthquakes is the focus, and compilation, modeling, and interpretation of damage data is a means to an end.
In his famous work about the Neapolitan earthquake in 1857, Robert Mallet (1862) not only prepared the ground for evaluating earthquake strength with macroseismic methods, he also tried to infer the earthquake location from directional damage features. Without a scientific basis, still being actively sought (Ambraseys, 2006; Marco, 2008), the practice suggested by Mallet (1862) should not be applied. While Mallet used fresh traces of directional damage, in archaeoseismology such features have gone through altering processes, making it more difficult to deduce accurate directions toward the earthquake source.
Long before a strong-motion instrumentation was available, Milne (1881, 1885), Perry (1881), and others used the theory of dynamic block structures to deduce earthquake ground accelerations from toppled monumental columns and tombstones. A fundamental article on the theory of rigid block movements by Housner (1963) helped to explain observations made during the large Chilean earthquake of May 1960. Augusti and Sinopoli (1992) presented a comprehensive summary on the dynamic modeling of large block structures and Sinopoli (1995) reviewed studies of large block structure dynamics. Brune and Whitney (1992), Brune (1996), Anooshehpoor et al. (1999, 2004), and Zhang and Makris (2000) applied rigid block movement models to interpret precariously balanced rocks and a steam engine, the latter overturned during the great San Francisco earthquake of 1906.
Fig. 1
The program code Universal Mechanism (Pogorelov, 1995, 1997) was used for all numeric models in this study. After defining the physical parameters of the bodies, the types and degrees of freedom of the joints between blocks and the types and parameters of the contact forces, the code generates the equations of motion of the mechanical system. An implicit second order method with variable step size was used to solve the equations of motion. Error tolerance was usually set to 10−6. First, a solution for the static model was calculated and the resulting coordinates were used as initial conditions for the dynamic tests.
Fig. 2
Fig. 3
Fig. 2
Fig. 5
Fig. 6
Fig. 7
Fig. 8
Fig. 9In a second series of numeric experiments, the influence of coefficients of static and dynamic friction on potential toppling directions was tested. For the two ground motions GM23 and GM20 (Fig. 8), the static coefficient of friction was varied between μs = 0.1 and 0.9 in steps of 0.1, while the coefficient of kinematic friction μk was always set to 84% of μs. Friction coefficients less than 0.5 are unrealistic for classical columns of marble or similar material. However, the numeric experiments allow an exploration of the limits where reduced friction is influential. Geometry of the test columns was kept constant with an h/d ratio of 6.0 and a column height of 3.5 m.
All 29 ground-motion records listed in Table 1 were used to search for correlations between the toppling behavior of the column model and ground-motion parameters (PGA, PGV, and peak ground displacement [PGD]), the direction of largest horizontal acceleration, velocity and displacement impulse in the record, and the back azimuth toward the source.
Fig. 11
Fig. 12The last experiment uses synthetic strong-motion seismograms. These were calculated for a simple crustal structure with a Conrad discontinuity at 20 km, where P- and S-wave velocities increase from 5.8 to 6.5 km/sec and 3.4 to 3.8 km/sec, respectively, and a Moho at 35 km with upper mantle velocities of 8.0 and 4.5 km/sec for P and S, respectively. The QScmp code by Wang (1999) was used to calculate the Green’s functions for 25 surface stations. In order to avoid possible influence from a regular observation grid, stations were distributed randomly in a square region of 40 × 40 km centered at the epicenter (Fig. 13). The seismograms were calculated for two point source models both located at 10 km depth with a seismic moment of 4 × 1019 N m, roughly expressing magnitude 7 earthquakes. Point sources were chosen to produce a pronounced radiation effect and simple seismogram structures. It is evident that a point source is not a realistic scenario; however, if, for this simple source mechanism, downfall directions of the test columns do not allow a successful prediction of the epicenter, it is questionable that this works for complex extended sources. On the other hand, dynamic rupture models show that strong polarizations may occur, especially for high rupture velocities, which might produce clearer toppling patterns of columns than point sources. However, it should be noted that in archaeoseismological field cases most, if not all, rupture parameters are a priori unknown.
Fig. 13Depending on the perspective (i.e., archeological versus seismological), different expectations from archeoseismological studies usually result. Archaeology seeks explanations for damage horizons in excavations, interprets the impact of the potential earthquake on cultural development, and recovers as much history as possible from a certain place or region. Seismology focuses on the causing earthquake itself and the mechanisms that produced the excavated damage pattern. In order to make archaeoseismic data useful for seismic hazard analysis, the questions of when, where, and how strong the causative earthquake was, are the most important ones to be answered. While the "when" is usually beyond the predictive capacity of seismological techniques, the "where" and "how strong" are challenging but appropriate tasks for seismologists.
Rupture directivity effects cause spatial variations in ground motion amplitude and duration around faults and cause differences between the strike-normal and strike-parallel components of horizontal ground motion amplitudes, which also have spatial variation around the fault. These variations become significant at a period of 0.6 second and generally grow in size with increasing period. We have developed modifications to empirical strong ground motion attenuation relations to account for the effects of rupture directivity on strong motion amplitudes and durations. The modifications are based on an empirical analysis of near-fault data. The ground motion parameters that are modified include the average horizontal response spectral acceleration, the duration of the acceleration time history, and the ratio of strike-normal to strike-parallel spectral acceleration. The parameters upon which the adjustments to average horizontal amplitude and duration depend are the fraction of the fault rupture that occurs on the part of the fault that lies between the hypocenter and the site, and the angle between the fault plane and the path from the hypocenter to the site. Since both of these parameters can be derived from the hypocenter location and the fault geometry, the model of rupture directivity effects on ground motions that we have developed can be directly included in probabilistic seismic hazard calculations. The spectral acceleration is larger for periods longer than 0.6 second, and the duration is smaller, when rupture propagates toward a site. For sites located close to faults, the strike-normal spectral acceleration is larger than the strike-parallel spectral acceleration at periods longer than 0.6 second in a manner that depends on magnitude, distance, and angle. To facilitate the selection of time histories that represent near-fault ground motion conditions in an appropriate manner, we provide a list of near-fault records indicating the rupture directivity parameters that each contains.
Fig. 1
Fig. 2
Fig. 3
Fig. 4
The ground motion parameters that are modified for directivity effects include the average horizontal response spectral acceleration; the average duration of the two horizontal acceleration time histories; and the ratio of strike-normal to strike-parallel spectral acceleration. Strike-normal refers to the horizontal component of motion normal to the strike of the fault. Strike-parallel refers to the horizontal component of motion parallel to the strike of the fault. Following the method of Husid (1969), duration is defined as the time between 5% and 75% of the cumulative squared acceleration, following the convention of Abrahamson and Silva (1997b). The three ground motion parameters that we analyze, and the model parameters that control them, are listed in Table 1.
Table 1
Table 2
Fig. 5
Fig. 2Our quantification of rupture directivity effects is based on regression analysis of a data set of strong motion records. The earthquakes selected for this study include all California crustal earthquakes with magnitudes of 6 or larger for which digital strong motion data and faulting mechanism are available (including the 1994 Northridge earthquake), together with selected crustal earthquakes from other regions (including the 1995 Kobe earthquake) to augment the data set for larger magnitudes. In order to include the strongest available recordings of crustal earthquakes, we have used some recordings from unconventional instruments (Iwan and Chen, 1994) and from earthquakes in Asia Minor. The 1992 Cape Mendocino earthquake was assumed to be a subduction earthquake and was not included in this study. The data set provides a fairly uniform sampling of the magnitude range of 6.0 to 7.5 and the distance range of 0 to 50 km, as shown in Figure 6. A list of the earthquakes selected for the study is given in Table 3. This table describes the mechanism of the earthquake (strike-slip, oblique, reverse or thrust) and the strike and dip angles used for measuring the azimuth angle θ and the zenith angle φ. The strike of the fault was also used in rotating the horizontal motions into strike-normal and strike-parallel components.
Fig. 6The directivity model was developed by measuring differences between pairs of parameter values and by using a regression analysis to quantify the dependence of these differences on the fault parameters. The regression analysis used the random effects method (Abrahamson and Youngs, 1992). This method provides a means of partitioning random variability in ground motion amplitudes into inter-event and intra-event terms, and ensures that the results of the regression are not unduly influenced by events having large numbers of recordings. The form of the period dependence of variations in ground motion amplitudes was established by preliminary analyses of each coefficient in turn, and then fixing them in the final regressions after the application of smoothing. This was done starting with the most sensitive coefficient and progressing through to the least sensitive coefficient and finally to the constant term.
Directivity depends on two geometrical parameters: the angle between the direction of rupture propagation and the direction of waves travelling from the fault to the site, and the fraction of the fault rupture surface that lies between the hypocenter and the site. Residuals between the recorded average horizontal spectral acceleration and that calculated by the empirical model of Abrahamson and Silva (1997a), shown in Figure 7, were used as inputs into a regression analysis. For the directivity function, these residuals have a larger trend for strike-slip than for dip-slip earthquakes. The effects of differences between rock and soil sites were taken into account by classifying the recorded data into rock and soil categories and by using the corresponding site category in the Abrahamson and Silva (1997a) model.
Fig. 7
Fig. 8
Fig. 9The same directivity conditions that give rise to the systematic variations in strong-motion amplitudes that have just been described also give rise to systematic variations in strong-motion duration. Our model assumes that duration variations due to rupture directivity depend on two geometrical parameters: the angle between the direction of rupture propagation and the direction of waves travelling from the fault to the site, and the fraction of the fault rupture surface that lies between the hypocenter and the site. Residuals between the recorded duration and that calculated by the empirical model of Abrahamson and Silva (1997b), shown in Figure 10, were used as inputs into a regression analysis. For the directivity function, these residuals have similar trends for strike-slip and dip-slip earthquakes. The effects of differences between rock and soil sites were taken into account by classifying the recorded data into rock and soil categories and by using the corresponding site category in the Abrahamson and Silva (1997b) model. The Abrahamson and Silva (1997b) model does not distinguish between strike-slip and dip-slip faulting. The results of our analysis indicate that there may be differences in duration between them, with dip-slip having longer duration under neutral or backward directivity conditions, but these results are constrained by few dip-slip data for backward directivity conditions.
Fig. 10In an earlier study (Somerville et al., 1995a) we examined the dependence of the strike-normal to strike-parallel ratio on magnitude, fault distance, style of faulting, and site category by means of a regression analysis of the data. The dependence of the ratio on faulting mechanism was found to be marginally significant and was not very large in practical terms, and so was dropped from the engineering model. The dependence of the ratio on site category was found to be not significant and was set to zero.
Fig. 12
Fig. 13
Fig. 14
Fig. 15
Fig. 16The ranges of applicability of the models are summarized in Table 2. For magnitudes below which the models are defined (below 6.0 for strike-normal to average response spectrum; and below 6.5 for absolute amplitudes and durations), we suggest that no modification be made for rupture directivity effects. Although the largest earthquakes on which the models are based have magnitudes of 7.4, we suggest that the models be extrapolated to larger magnitudes if required for a seismic hazard analysis. For distances larger than those for which the models were developed (50 km for amplitudes and 20 km for duration), we suggest that no modification be made for rupture directivity effects.
To date, rupture directivity effects have rarely been incorporated in ground motion attenuation relations. Campbell (1987) incorporated the amplitude effects of rupture directivity into attenuation relations for peak acceleration and peak velocity. His amplification factors for rupture directivity toward the site are about 1.7 and 2.6 for peak acceleration and peak velocity respectively. Our study does not indicate any amplitude effects for peak acceleration. More recent attenuation relations for peak acceleration developed by Campbell (e.g., Campbell and Bozorgnia, 1994) do not contain rupture directivity effects. Our study indicates that the maximum amplitude effects at periods of a few seconds (corresponding roughly to peak velocity) are on the order of a factor of 1.5, considerably less than the effect on peak velocity found by Campbell (1987).
The model that we have developed for the effects of rupture directivity on the amplitudes and durations of ground motions near faults can be readily applied to estimate ground motion levels and durations. The modifications for duration and response spectral accelerations are made with respect to the empirical attenuation relations of Abrahamson and Silva (1997a,b). To account for these effects, ground motions are calculated by first using the Abrahamson and Silva (1997a,b) models and then applying the modification factors prescribed by the relations that we have developed. While these modifications are specific to the Abrahamson and Silva (1997a,b) relations, they may provide approximate adjustment factors for other attenuation relations that use similar definitions of parameters such as rupture distance and that have similar functional forms. The modifications to account for the difference between strike-normal and strike-parallel response spectral acceleration are independent of any particular attenuation model and can be applied to the average horizontal response spectral acceleration calculated by any model.
Fig. 17Rupture directivity causes spatial variations in the amplitude and duration of ground motions around faults. The propagation of rupture toward a site causes larger ground-motion amplitudes at periods longer than 0.6 second and shorter strong motion durations than for average directivity conditions. The variations in amplitude and duration depend on the product of the length or width ratio X or Y and the cosine of the angle θ or φ between the fault plane and the path to the site. We have developed modifications to the empirical attenuation relations of Abrahamson and Silva (1997a, b) to account for these spatial variations in ground-motion amplitudes and durations around faults. These modifications should also be applicable to other attenuation relations.
Hinzen, K.-G. (2009). Simulation of Toppling Columns in Archaeoseismology
. Bulletin of the Seismological Society
of America, 99(5), 2855–2875.
Hinzen, K.-G. (2009). Simulation of Toppling Columns in Archaeoseismology
. Bulletin of the Seismological Society
of America, 99(5), 2855–2875. Supplemental
Okada, Y. (1985). Surface deformation due to shear
and tensile faults in a half-space. Bulletin of the
Seismological Society of America, 75(4),
1135–1154.
Okada, Y. (1992). Internal deformation due to shear
and tensile faults in a half-space. Bulletin of the
Seismological Society of America, 82(2),
1018–1040.
Someya, M., Yamada, T., & Okazaki, T. (2025).
OkadaTorch: A Differentiable Programming of Okada
Model to Calculate Displacements and Strains from
Fault Parameters. arXiv preprint,
arXiv:2507.17126.
Somerville, P. G., Smith, N. F., Graves, R. W., &
Abrahamson, N. A. (1997). Modification of Empirical
Strong Ground Motion Attenuation Relations to
Include the Amplitude and Duration Effects of
Rupture Directivity. Seismological Research Letters
68(1): 199-222.