SW4 version:2.01 date:: 2017-11-20


sw4-v2.01.tgz [2017-11-20]

Primary Developers

Anders Petersson
Lawrence Livermore National Laboratory
Bjorn Sjögreen
Lawrence Livermore National Laboratory


SW4 implements substantial capabilities for 3-D seismic modeling, with a free surface condition on the top boundary, absorbing super-grid conditions on the far-fi eld boundaries, and an arbitrary number of point force and/or point moment tensor source terms. Each source time function can have one of many predefined analytical time dependencies, or interpolate a user de fined discrete time series.

SW4 supports a fully 3-D heterogeneous material model that can be specified in several formats. It uses a curvilinear mesh near the free surface to honor the free surface boundary condition on a realistic topography. The curvilinear mesh is automatically generated from the description of the topography. To make SW4 more computationally efficient, the seismic wave equations are discretized on a Cartesian mesh below the curvilinear grid. The Cartesian mesh, which extends to the bottom of the computational domain, is also generated automatically.

SW4 solves the seismic wave equations in Cartesian coordinates. It is therefore appropriate for local and regional simulations, where the curvature of the earth can be neglected. Locations can be specified directly in Cartesian coordinates, or through geographic (latitude, longitude) coordinates. SW4 can be built to use the Proj.4 library for calculating the mapping between geographic and Cartesian coordinates, or use an approximate spheroidal mapping. SW4 can output synthetic seismograms in an ASCII text format, or in the SAC format [7]. It can also present simulation information as GMT scripts, which can be used to create annotated maps. SW4 can output the solution, derived quantities of the solution, as well as the material model along 2-D grid planes. Furthermore, SW4 can output the 3-D volumetric solution, or material model, in a binary file format.

Visco-elastic behavior can be important when modeling the dissipative nature of realistic materials, especially for higher frequencies. SW4 uses the rheological model of standard linear solid (SLS) elements, coupled in parallel. The coefficients in each SLS are determined such that the resulting quality factors Qp and Qs, for the attenuation of P- and S-waves, become approximately constant as function of frequency. These quality factors can vary from grid point to grid point over the computational domain and are read in the same way as the elastic properties of the material model.

While most of the SW4 code is written in C++, almost all numerical computations are implemented in Fortan-77. SW4 uses a distributed memory programming model, implemented with the C-bindings of the MPI library. Compatible versions of the C++ and Fortran-77 compilers as well as the MPI library must be available to build the code. We have built and tested SW4 on a variety of machines, ranging from single processor laptops to large super-computers with O(100,000) cores.

Cite as

Petersson, N.A.; Sjogreen, B. (2017), SW4, version 2.01 [software], Computational Infrastructure of Geodynamics, Available from:, doi: 10.5281/zenodo.1063644, url:

Primary References

Sjögreen, B.; Petersson, N.A. (2012), A Fourth Order Accurate Finite Difference Scheme for the Elastic Wave Equation in Second Order Formulation, Journal of Scientific Computing, 52 (1) , 17-48, doi: 10.1007/s10915-011-9531-1, url:

Petersson, N.A.; Sjögreen, B. (2012), Stable and efficient modeling of anelastic attenuation in seismic wave propagation, Communications in Computational Physics, 12 (01) , 193-225

Petersson, N.A.; Sjögreen, B. (2017), User's guide to SW4, version 2.0, LLNL-SM-741439 (LLNL-SM-741439)

Petersson, N.A.; Sjögreen, B. (2015), Wave propagation in anisotropic elastic materials and curvilinear coordinates using a summation-by-parts finite difference method, Journal of Computational Physics, 299, 820-841, doi: 10.1016/, url:


Primary Developer
Anders Petersson
Primary Developer
Bjorn Sjögreen
Primary Manual
Anders Petersson
Primary Manual
Bjorn Sjögreen
DOE Lawrence Livermore National Laboratory DE-AC52-07NA27344
Other Acknowledgement
The SW4 code was developed under financial support from Lawrence Livermore National Laboratory. The underlying numerical method was developed under financial support from the Office of Science at the U.S. Department of Energy.

If you see errors or have further questions, please email

Sign In