Skip to main content

P-SV wave propagation in 2D for FWI

Project description

forward-virieux

Main GitHub Language Build Status License

Parallel numerical FD simulation for P-SV wave, using the velocity-stress formulation on a staggered grid from Virieux 1986. Requires only OpenMP and the git subrepos (header-only). Used as a PDE-simulation code for this publication.

Compilation for C++

mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make forward_test # or other targets

Python interface

Compiling the CMake target psvWave creates a Python module for the current environments Python version. However, to find the right requirements, we first need to do two things:

  1. Install PyBind, to interface Python to C++, using your favourite package manager;
  2. Set relevant environment variables.

Before you continue, make sure you are in your desired Python environment, e.g. Conda or PyEnv. Python 3.6 or higher is recommended. Also, the python3-dev package is needed for compilation.

Installing PyBind11

Using your relevant package manager, install pybind11, e.g.:

pip3 install pybind11

Setting needed environment variables

The compiler needs three things to work correctly:

  1. the relevant PyBind files (headers);
  2. the relevant Python files (headers);
  3. the appropriate extension for the compiled file.

The CMakeLists.txt file loads these variables from the environment. If you know what you are doing, you can set these yourself. If not, run the following commands in the terminal in which you have activated your relevant Python environment:

export PYBIND_INCLUDES=`python3 -c'import pybind11;print(pybind11.get_include())'`
export PYTHON_INCLUDES=`python3 -c"from sysconfig import get_paths as gp; print(gp()[\"include\"])"`
export SUFFIX=`python3-config --extension-suffix`

Compiling the Python linked C++ code

Compiling the Python interface is done by running CMake:

mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make psvWave

Using the Python interface

This interface can be used by having the resulting psvWave.*.so file in your working directory, and importing it, e.g.:

import psvWave

model = psvWave.fdModel(
    "../tests/test_configurations/forward_configuration.ini")

model.forward_shot(0, verbose=True, store_fields=True)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

psvWave-0.1.6.tar.gz (2.2 MB view details)

Uploaded Source

File details

Details for the file psvWave-0.1.6.tar.gz.

File metadata

  • Download URL: psvWave-0.1.6.tar.gz
  • Upload date:
  • Size: 2.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1.post20200616 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

File hashes

Hashes for psvWave-0.1.6.tar.gz
Algorithm Hash digest
SHA256 fd85b059178609e865ed1df69fd5bf9d362c5175746f4efc90aad7bb04566f03
MD5 5fe48de7f2b57be6f6ab729748244ad4
BLAKE2b-256 0a4df306357f3aec32ea3aa107b1a8c3c09b469ec6754542383ac319e0d8921d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page