Skip to main content

dyncfs

Documentation · Quickstart · 中文入门 · Examples

This Python package serves as the frontend for computing static and dynamic Coulomb Failure Stress changes in layered media. The current backend dispatch uses EDGRN2/EDCMP2 for static stress, QSEIS2025 for layered dynamic stress, and QSSP2020 for spherical dynamic stress, based on programs developed by Rongjiang Wang and modified by Jiangcheng Zhou. The generation and retrieval of Green's function libraries are handled by the pygrnwang package, while travel-time calculations and geographic coordinate transformations are implemented using obspy.

The Wenchuan and Ludian examples give case parameters and results with figures.

Installation

  1. For user mode
pip install dyncfs
  1. For developer mode.
conda create -n cfs python=3.13
conda activate cfs
conda install gfortran obspy tqdm -c conda-forge
conda install geographiclib mpi4py -c conda-forge # optional
git clone https://github.com/Zhou-Jiangcheng/pygrnwang
cd pygrnwang
pip install -e .
cd ..
git clone https://github.com/Zhou-Jiangcheng/dyncfs.git
cd dyncfs
pip install -e .

Usage

Start with the small executable tutorial, or adapt examples/wenchuan/wenchuan.ini / examples/ludian/ludian.ini. Prepare source_plane[m].csv, obs_plane[n].csv and model.nd in the input directory, and set absolute input/output paths. The full schema is in Input files.

  1. Command-line usage
dyncfs --help
usage: dyncfs [-h] --config CONFIG [--create-static-lib] [--compute-static-cfs] [--compute-static-cfs-fix-depth] [--run-static] [--create-dynamic-lib] [--compute-dynamic-cfs] [--compute-dynamic-cfs-fix-depth] [--run-dynamic] [--run-all]

dyncfs command line tool

options:
  -h, --help            show this help message and exit
  --config CONFIG       Path to the configuration file
  --create-static-lib   Create static stress library
  --compute-static-cfs  Compute static dCFS on obs faults
  --compute-static-cfs-fix-depth
                        Compute static dCFS at fixed depth
  --run-static          Create static stress library and Compute static dCFS on obs faults and Compute static dCFS at fixed depth
  --create-dynamic-lib  Create dynamic stress library
  --compute-dynamic-cfs
                        Compute dynamic dCFS on obs faults
  --compute-dynamic-cfs-fix-depth
                        Compute dynamic dCFS at fixed depth
  --run-dynamic         Create dynamic stress library and Compute dynamic dCFS on obs faults and Compute dynamic dCFS at fixed depth
  --run-all             Create static and dynamic stress library and Compute static and dynamic dCFS
  1. Import and use classes and functions in .py files

Replace case.ini below with your prepared configuration file.

from dyncfs.cfs_static import *

if __name__ == "__main__":
    config = CfsConfig()
    config.read_config("case.ini")
    create_static_lib(config)
    compute_static_cfs(config)
from dyncfs.cfs_dynamic import *

if __name__ == "__main__":
    config = CfsConfig()
    config.read_config("case.ini")
    create_dynamic_lib(config)
    compute_dynamic_cfs_parallel(config)

Note on parallel computing (compute_dynamic_cfs_parallel, compute_dynamic_cfs_fix_depth_parallel, run_all_dynamic, and processes_num > 1 in the command-line tool):

  • Worker processes are started with the spawn method on all platforms (Windows, Linux and macOS), so the calling script must put its code under if __name__ == "__main__": as in the examples above. Otherwise the workers re-run the script and fail with RuntimeError: An attempt has been made to start a new process before the current process has finished its bootstrapping phase.
  • Each worker process is limited to one BLAS/OpenMP thread (OMP_NUM_THREADS, MKL_NUM_THREADS, OPENBLAS_NUM_THREADS and VECLIB_MAXIMUM_THREADS are set to 1 only for the workers) to avoid oversubscription. Use processes_num to control the CPU usage, e.g. not more than the number of cores allocated by the job scheduler on a cluster.

References:

Wang, R. (1999). A simple orthonormalization method for stable and efficient computation of Green’s functions. Bulletin of the Seismological Society of America , 89 (3), 733–741. https://doi.org/10.1785/BSSA0890030733

Wang, R. (2003). Computation of deformation induced by earthquakes in a multi-layered elastic crust—FORTRAN programs EDGRN/EDCMP. Computers & Geosciences, 29(2), 195–207. https://doi.org/10.1016/S0098-3004(02)00111-5

Wang, R., & Wang, H. (2007). A fast converging and anti-aliasing algorithm for green’s functions in terms of spherical or cylindrical harmonics. Geophysical Journal International, 170(1), 239–248. https://doi.org/10.1111/j.1365-246X.2007.03385.x

Wang, R., Heimann, S., Zhang, Y., Wang, H., & Dahm, T. (2017). Complete synthetic seismograms based on a spherical self-gravitating earth model with an atmosphere–ocean–mantle–core structure. Geophysical Journal International, 210(3), 1739–1764. https://doi.org/10.1093/gji/ggx259

Zhou, J., Wang, R., & Zhang, Y. (2026). DynCFS: a program for modeling dynamic coulomb failure stress changes in layered elastic media. Geophysical Journal International, ggaf534. https://doi.org/10.1093/gji/ggaf534

Acknowledgment

Thanks to Haitao Qin from Tongji University for reporting a bug, which has been fixed in the latest version.

Release files for dyncfs 3.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dyncfs 3.0.2
File Size Uploaded
dyncfs-3.0.2.tar.gz 46.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dyncfs 3.0.2
File Interpreter ABI Platform
dyncfs-3.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 100.5 kB

Release files / dyncfs-3.0.2.tar.gz

Download URL dyncfs-3.0.2.tar.gz
Size 46.5 kB
Tags Source
SHA-256 checksum
How to use checksums
d05340b9a8bf5f5b28fe398480b6702f17f10295c21c625cb441700821d0a411
BLAKE2b-256 checksum
How to use checksums
02618be87ea0c7d800a1b8910531e3c3afdc9eac1dd2325ffa2b770daa8935db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 26, 2026.

Transparency log

Release files / dyncfs-3.0.2-py3-none-any.whl

Download URL dyncfs-3.0.2-py3-none-any.whl
Size 54.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cdf51c5384f879c32e0d7c93612f2ef362fff1bb1f34645705a86d5ef8b76fcb
BLAKE2b-256 checksum
How to use checksums
57f4900ec13520ac9b40c26c20430b17c23d78218e94a85e664d430ae49f417f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 26, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

3.0.2 This release

2 release files

3.0.0

2 release files

2.1.5

2 release files

2.1.4

2 release files

2.1.3

2 release files

2.1.1

2 release files

2.1.0

2 release files

2.0.3

1 release file

2.0.2

1 release file

2.0.1

1 release file

2.0.0

1 release file

1.1.1

1 release file

1.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page