https://github.com/tgautam03/earthquake.cpp
3D earthquake wave simulation
https://github.com/tgautam03/earthquake.cpp
cpp earthquake-simulation earthquake-visualization finite-difference-method partial-differential-equations wave-simulation
Last synced: 2 months ago
JSON representation
3D earthquake wave simulation
- Host: GitHub
- URL: https://github.com/tgautam03/earthquake.cpp
- Owner: tgautam03
- License: mit
- Created: 2025-03-24T22:16:03.000Z (2 months ago)
- Default Branch: master
- Last Pushed: 2025-03-31T05:46:03.000Z (2 months ago)
- Last Synced: 2025-03-31T06:28:19.729Z (2 months ago)
- Topics: cpp, earthquake-simulation, earthquake-visualization, finite-difference-method, partial-differential-equations, wave-simulation
- Language: C++
- Homepage:
- Size: 19.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# earthquake.cpp

3D earthquake wave simulation in C++. Python required for visualization only (use requirements.txt to install dependencies).
> Tested on Ubuntu 22.04.2 LTS using g++ compiler. I'm not using any fancy C++ features (only used classes), so it should work fine on other systems as well (but, don't blame me if it doesn't)
**YouTube Video:** https://www.youtube.com/watch?v=6kHhLTdwOR4
**Blog Post:** https://0mean1sigma.com/mi3d-earthquake-simulation/
## Drivers
1. **1D simulation:** Execute `make 1d_sim` in the terminal. This will generate the executable file in `bin`, which can be called as follows: `./bin/sim_1d.out`.
2. **3D simulation on a simpler velocity model (saving full 4D solution):** Execute `make 3d_sim` in the terminal. This will generate the executable file in `bin`, which can be called as follows: `./bin/sim_3d.out`.
3. **3D simulation on a simpler velocity model (saving a couple of 3D slices only):** Execute `make 3d_sim_slices` in the terminal. This will generate the executable file in `bin`, which can be called as follows: `./bin/sim_3d_slices.out`.
4. **3D simulation on a complex velocity model (saving a couple of 3D slices only):** Execute `make 3d_sim_slices_comples` in the terminal. This will generate the executable file in `bin`, which can be called as follows: `./bin/sim_3d_slices_complex.out`.## Visualization
Visualization code in `viz` uses matplotlib and pyplot.
1. `view_viz_1d.py`: Visualizing 1D simulation using matplotlib.
2. `view_viz_3d.py`: Visualizing 3D simulation (full) using matplotlib.
3. `view_viz_3d_slices.py`: Visualizing 3D simulation (slices) using matplotlib.
4. `animGen_viz_3d.py`: Generates 3D simulation (full) using pyplot and saves it as mp4.