Skip to content

Devito em#103

Merged
ggorman merged 13 commits intomainfrom
devito-em
Feb 23, 2026
Merged

Devito em#103
ggorman merged 13 commits intomainfrom
devito-em

Conversation

@ggorman
Copy link
Contributor

@ggorman ggorman commented Feb 23, 2026

No description provided.

ggorman and others added 13 commits January 29, 2026 13:03
- 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
- Fix broken LaTeX subscripts (**{ → _{) in wave and diffu chapters
- Fix Python syntax errors (missing * operators) in wave1D_fd1.qmd
- Fix broken cross-references (@sec- → @eq-) in wave_app_exer.qmd
- Remove NumPy implementation files from chapters and src directories
- Update all file references to point to Devito implementations
- Add Neumann BC, verification, and convergence sections to wave1D_devito.qmd
- Update exercise solutions to use Devito solvers

Deleted files:
- chapters/wave/wave1D_prog.qmd, wave2D_prog.qmd
- chapters/wave/exer-wave/ (exercise solutions)
- chapters/diffu/exer-diffu/ (exercise solutions)
- src/wave/wave1D/, wave2D/, wave2D_u0/ (NumPy solvers)
- src/diffu/diffu*_u0.py, diffu1D_vc.py, etc. (NumPy solvers)

All 247 tests pass, PDF builds without errors.
- Fix broken LaTeX subscripts (**{ → _{) in advec.qmd (13 occurrences)
- Remove NumPy implementation src/advec/advec1D.py
- Update file references to point to advec1D_devito.py

All 247 tests pass, PDF builds without errors.
- Fix broken LaTeX subscripts (**{ → _{) in:
  - nonlin_pde1D.qmd (12 occurrences)
  - nonlin_split.qmd (3 occurrences)
  - vib_undamped.qmd (2 occurrences)
  - trunc.qmd (4 occurrences)
- Remove NumPy files from src/nonlin/ (keep Devito implementations)
- Delete chapters/nonlin/exer-nonlin/ exercise directory

Vibrations chapter (ODE-focused) retains NumPy implementations.

All 247 tests pass, PDF builds without errors.
… fixes

- Add MathJax macro definitions for HTML output in _quarto.yml
- Regenerate stencil figures with legend explaining known/unknown values
- Update figure captions to be more descriptive
- Fix gendered pronoun in softeng2 appendix
- Fix malformed figure captions in diffu_exer.qmd
- Remove orphaned LaTeX label{} in diffu_app.qmd
- Improve verbose phrasing in wave_app.qmd and nonlin_pde1D.qmd
- Add callout notes to chapters pointing to tested source implementations
- Extract inline Python code to src/book_snippets/ with RESULT variables for testing
- Create snippet wrapper .qmd files in chapters/*/snippets/ directories
- Add comprehensive test suite in tests/test_book_snippets.py (21 tests)
- Create src/nonlin/split_logistic.py and split_diffu_react.py modules

Chapters updated with callout notes:
- elliptic/elliptic.qmd -> src/elliptic/
- vib/vib_undamped.qmd -> src/vib/
- wave/wave1D_fd1.qmd, wave1D_fd2.qmd -> src/wave/
- diffu/diffu_fd1.qmd, diffu_fd3.qmd, diffu_rw.qmd -> src/diffu/
- appendices/softeng2/softeng2.qmd -> src/softeng2/

Chapters refactored to use includes:
- devito_intro/ (what_is_devito, first_pde, boundary_conditions, verification)
- nonlin/ (burgers, nonlin_ode, nonlin_split)
- advec/advec1D_devito.qmd
Fix README Devito snippet; align first PDE narrative; correct elliptic L1 criterion; make Picard solver implicit via Jacobi iteration with regression+NumPy reference tests; add Pint-based unit checks for book snippets and include pint in dev extras.
Address 6 findings from review-2.md:
- Fix incorrect L1 convergence norm (|a|-|b| to |a-b|) in elliptic chapter and source
- Fix brittle test pattern in test_docs_consistency.py using regex
- Fix exact solution/BC mismatch in Laplace convergence test (x*y/Lx to x/Lx)
- Fix PDF download link in index.qmd
- Remove ghost bibliography entry (devito-compiler)

Add EM module source and comprehensive test suite (502 tests total):
- src/em/ modules: materials, waveguide, GPR, Maxwell 1D/2D, units, verification
- test_elliptic_src.py: 41 tests for all elliptic solver functions
- test_em_materials.py: 42 tests for material models and soil functions
- test_em_waveguide.py: 24 tests for slab waveguide mode analysis
- test_em_gpr.py: 22 tests for GPR wavelets, travel time, and simulation
- test_maxwell1D_devito.py: 32 tests including lossy, dispersive, ABC, PMC, source
- test_maxwell2D_devito.py: 23 tests for 2D FDTD with PML, lossy, dispersive media

Fix SparseTimeFunction broadcast bug in maxwell1D source injection.
- Fix incorrect DOIs: dolci2022 and liu_sen2017→liu_sen2018
- Fix np.where divide-by-zero RuntimeWarning in maxwell2D_devito.py
- Add citations to under-referenced chapters (devito-api, devito-seismic, etc.)
- Document vib chapter exclusion in _quarto.yml
- Add regression tests: include directives, citation keys, DOI resolution
- Add smoke tests for untested modules: twopt_BVP, random_walk, flow_layers, verification, dispersion_maxwell
Explain why all solvers default to dtype=np.float64: the round-off
error floor of FP32 limits convergence studies to 2-3 refinement
levels, while FP64 provides 5-7 levels needed to robustly establish
asymptotic convergence rates. Add Roy (2005) and Oberkampf & Roy
(2010) references.
Major additions:
- Implement split-field PML (Grote-Sim), second-order Higdon ABC (P=2),
  and Hybrid ABC with weighted absorption layer in abc_methods.py
- Add electromagnetics chapter (Maxwell equations, Yee scheme,
  verification, GPR and waveguide applications)
- Add tested book snippets for all ABC methods

Fixes and improvements:
- Fix sigma_max default to theory-derived 3c/W instead of hardcoded 50
- Replace linear damping ramp with polynomial d^3 in wave1D_features
- Add dtype parameter to all Devito solvers for FP64 support
- Standardize LaTeX notation (\hbox→\text, font-size removal)
- Tighten test tolerances to match O(dx^2) theory
- Add elliptic spatial convergence test and Pint unit checks
- Update .gitignore for TeX artifacts and review documents

All 579 tests pass.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ggorman ggorman merged commit 34acdb4 into main Feb 23, 2026
@ggorman ggorman deleted the devito-em branch February 23, 2026 17:14
@codecov
Copy link

codecov bot commented Feb 23, 2026

Codecov Report

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

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #103   +/-   ##
=======================================
  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.

1 participant