Skip to content

Open-Systems-Innovation/3D_seismic_wave_propagation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

3D Seismic Wave Propagation

This repo contains the source code for a Finite Difference Method (FDM) simulation for calculating the propagation of seismic waves. Inlcuded is a Nix development environment via flake.nix suitable for running and developing the program.

How to Compile the simulation

Included in this directory is a makefile. This make file is about as simple as possible for a PETSc document and is reproduced in its entirety below:

include ${PETSC_DIR}/lib/petsc/conf/variables
include ${PETSC_DIR}/lib/petsc/conf/rules

This uses the users installation of PETSC_DIR to include some standard variables and build targets for a PETSC application. Alternatively we could specify each included library in our makefile.

To compile all we need to do is:

make main

Which will compile the main.c file and link the appropriate PETSc libraries

How to run the simulation

This is a multi-processor example. In general we could run a PETSc progam as follows:

mpiexec -n 8 ./petsc_program_name petsc_options

Therefore, the simplest way of running the main.c file in this repository is:

mpiexec -n 2 ./main

In this simulation, on line 85-88 we have checked if the user has provided the value of dim , dt, nsteps, and dump_output, where:

  • dim is the dimension of the problem
  • dt is the size of the time-steps
  • nsteps is the number of time-steps
  • dump_output is a boolean operator which specifies if the program should dump the output to stdout.

That means we can supply this value at runtime as follows:

mpiexec -n 1 ./main -n 100

This will override the default value of n = 10 and run the simulation with n = 100

How to visualize the solution

To visualize the solution we can use the PETSc capability to output to a VTK file. We can then use Paraview to create a 3D plot of each timestep.

Understanding the math

This program is based on the 1986 paper called P-SV Wave Propagation in Heterogeneous Media: Velocity-Stress Finite-Difference Method by Jean Virieux. This paper presents a FDM algorithm for modeling P-SV (Primary waves - Shear Waves) wave propagation in heterogenous media.

This particular method includes velocity and stress in the equations of motion.

Since we are using a FDM aproach, were going to need a structured grid. We will use the DMSTAG object from PETSc.

About

A finite element simulation for 3D seismic wave propogation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published