You are here: Home / Resources / Software: Download / SW4 / About


By N. Anders Petersson1, Bjorn Sjögreen1, Houjun Tang2, Ramesh Pankajakshan1

1. Lawrence Livermore National Laboratory 2. Lawrence Berkeley National Laboratory

Published on


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-field 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 defined 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.

Release Notes

v3.0 [2023-08-30]

Various bug fixes and new features:

  • Curvilinear mesh refinement.
  • Read material properties in the sfile and GeoModelGrids (HDF5) formats.
  • Output material properties data in the sfile format.
  • Output cross-section image files in the HDF5 format.
  • Output time-history data at different locations in the HDF5 format.
  • Output near-surface sub-volume data (optionally with ZFP compression) in the HDF5 format.
  • Some support for full-waveform inversion of the material model

Sponsored by

This work performed under the auspices of the U.S. Department of Energy by Lawrence Livermore National Laboratory under contract DE-AC52-07NA27344.