Skip to content

Conversation

@ggorman
Copy link
Contributor

@ggorman ggorman commented Jan 31, 2026

No description provided.

- 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
Copy link

codecov bot commented Jan 31, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 48.18%. Comparing base (baf2253) to head (4a3641d).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           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           
Flag Coverage Δ
derivations 48.18% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants