-
Notifications
You must be signed in to change notification settings - Fork 6
Devito phase 8 [experimental - do not merge] #101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ggorman
wants to merge
9
commits into
main
Choose a base branch
from
devito-phase-8
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Change author from Langtangen & Linge to Gerard J. Gorman - Add personal acknowledgment of Langtangen's influence - Add Use of Generative AI section for transparency - Update "About this Edition" to reflect authorship
New chapters and sections: - Chapter 6: Elliptic PDEs and Iterative Solvers (Laplace, Poisson) - Chapter 7: Systems of PDEs (Shallow Water Equations) - New section in Chapter 5: Burgers Equation Key Devito patterns introduced: - Dual-buffer Function pattern for steady-state problems - Buffer swapping via argument substitution - TimeFunction pseudo-timestepping for elliptic PDEs - first_derivative() with explicit fd_order and side parameters - Multiple coupled TimeFunction objects for PDE systems - ConditionalDimension for efficient snapshot saving - Function for static fields (bathymetry) New solvers: laplace_devito.py, poisson_devito.py, burgers_devito.py, swe_devito.py New tests: 62 tests (18 elliptic, 21 burgers, 23 swe) Added Makefile for common build commands
New chapter: - Chapter 8: High-Order Methods - Dispersion Analysis (numerical dispersion, phase/group velocity) - Fornberg Algorithm (computing FD weights for arbitrary order) - Dispersion-Relation-Preserving (DRP) Schemes (Tam-Webb optimization) - Custom weights in Devito: u.dx2(weights=weights) New section in Chapter 7: - 7.3 Elastic Wave Equations - Velocity-stress formulation - VectorTimeFunction and TensorTimeFunction - Vector operators: div, grad, diag - Staggered grid discretization - Varying Lame parameters for heterogeneous media Key Devito patterns introduced: - Custom FD weights for optimized dispersion - VectorTimeFunction for velocity fields - TensorTimeFunction for stress tensors (symmetric=True) - Vector calculus operators (div, grad, diag) - Staggered grid handling for first-order systems New solvers: dispersion.py, drp_devito.py, elastic_devito.py New tests: 73 tests (39 highorder, 34 elastic) Added references for Fornberg, Tam-Webb DRP schemes
Chapter 8 additions: - Section 8.4: ADER finite difference schemes (Taylor expansion in time) - Section 8.5: Staggered grid formulations (velocity-pressure systems) Chapter 7 additions: - Section 7.4: Viscoacoustic waves with three rheological models (SLS, Kelvin-Voigt, Maxwell) - Section 7.5: 3D Viscoelastic waves with Qp/Qs attenuation New solvers: - ader_devito.py: ADER acoustic solver with high-order time stepping - staggered_devito.py: Staggered grid acoustic solver - viscoacoustic_devito.py: Three viscoacoustic models - viscoelastic_devito.py: Full 3D viscoelastic with TensorTimeFunction 91 new tests (411 total)
Chapter 9: Inverse Problems and Adjoint-State Methods - Introduction to inverse problems in seismic imaging - Adjoint-state method for gradient computation - Forward modeling with explicit SparseTimeFunction API - Reverse Time Migration (RTM) imaging condition - Full Waveform Inversion (FWI) with gradient descent - Regularization techniques (Tikhonov, Total Variation) - Least-Squares RTM with Barzilai-Borwein step length All implementations use explicit Devito API without convenience classes. New files: - chapters/adjoint/adjoint.qmd (main chapter content) - src/adjoint/forward_devito.py (explicit forward modeling) - src/adjoint/rtm_devito.py (RTM implementation) - src/adjoint/fwi_devito.py (FWI gradient computation) - src/adjoint/lsrtm_devito.py (LSRTM with Born modeling) - src/adjoint/gradient.py (gradient utilities) - tests/test_adjoint_forward.py (18 tests) - tests/test_rtm_devito.py (12 tests) - tests/test_fwi_devito.py (32 tests) - tests/test_lsrtm_devito.py (28 tests) Total tests: 501 (90 new tests for Phase 4) PDF builds successfully.
Chapter 10: Performance Optimization - Introduction to performance metrics (FLOPS, bandwidth, roofline) - Devito optimization architecture (loop blocking, SIMD, OpenMP) - GPU computing with Devito (platforms, memory management) - Performance analysis and profiling Chapter 11: Memory Management and Wavefield Storage - Memory challenges in wave propagation - Snapshotting with ConditionalDimension - Checkpointing strategies (Revolve algorithm, pyrevolve) - I/O strategies (disk, compression, HDF5) Chapter 12: Distributed Computing and Scalability - Embarrassingly parallel problems and shot-parallel workflows - Domain decomposition with MPI - Task-based parallelism with Dask - Hybrid approaches (MPI + threading, cloud) All implementations use explicit Devito API without convenience classes. New files: - chapters/performance/performance.qmd - chapters/memory/memory.qmd - chapters/distributed/distributed.qmd - src/performance/benchmark.py (benchmarking utilities) - src/memory/snapshotting.py (ConditionalDimension patterns) - src/distributed/dask_utils.py (shot-parallel workflows) - tests/test_performance.py (20 tests) - tests/test_memory.py (22 tests, 2 skip without h5py) - tests/test_distributed.py (26 tests, skip without dask) Total tests: 541 (40 new tests for Phase 5) PDF builds successfully.
New Chapters: - Chapter 13: Computational Finance (Black-Scholes PDE) - Custom SpaceDimension for asset price grid - Greeks computation (Delta, Gamma, Theta, Vega, Rho) - Analytical Black-Scholes verification - Chapter 14: Porous Media Flow (Darcy's law) - Heterogeneous permeability fields (Gaussian random, layered) - Dual-buffer Jacobi iteration with SOR - Well source terms and transient flow - Chapter 15: CFD/Navier-Stokes (Lid-driven cavity) - Fractional step/projection method - Ghia et al. (1982) benchmark data for verification - Streamfunction and vorticity computation New Source Modules: - src/finance/black_scholes_devito.py (533 lines) - src/darcy/darcy_devito.py (1003 lines) - src/cfd/navier_stokes_devito.py (739 lines) Tests: 116 new tests (657 total)
- Add Appendix D covering Lax equivalence theorem, Von Neumann stability analysis, and on-the-fly Fourier mode analysis for memory-efficient gradient computation in seismic inversion - Create src/theory/ with stability_analysis.py (CFL utilities, amplification factors) and fourier_dft.py (Devito OTF DFT implementation) - Add 38 tests for stability analysis and Fourier DFT functionality - Update _quarto.yml with new appendix and src_theory variable - Add @Witte2019 reference for OTF Fourier transform paper
Chapter 16 implementing FDTD Maxwell's equations solver: Source code (src/maxwell/): - maxwell_devito.py: 1D and 2D FDTD solvers using Devito - pml.py: Convolutional PML (CPML) absorbing boundaries - sources.py: Gaussian, sinusoidal, Ricker wavelet sources - analytical.py: Plane wave, cavity modes for verification Chapter content (chapters/maxwell/): - Maxwell's equations and curl form - Yee grid staggered field placement - Leapfrog time stepping and CFL stability - Devito implementation patterns - PEC, PMC, and ABC boundary conditions - PML theory and implementation - Examples: plane wave, resonant cavity, waveguide - 10 exercises Tests (55 new tests): - Source functions and PML coefficients - 1D/2D FDTD solver verification - Energy conservation and CFL stability - Boundary condition enforcement References: Yee1966, Taflove2005, Berenger1994, Roden2000, Mur1981
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #101 +/- ##
=======================================
Coverage 48.18% 48.18%
=======================================
Files 4 4
Lines 330 330
Branches 48 48
=======================================
Hits 159 159
Misses 158 158
Partials 13 13
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.