Skip to content

Conversation

@ggorman
Copy link
Contributor

@ggorman ggorman commented Jan 28, 2026

No description provided.

Phase 0 and 0.5 of the Devito book refactoring:

- src/symbols.py: Common SymPy symbols for variables, parameters
- src/operators.py: Finite difference operators with Taylor series analysis
- src/display.py: LaTeX rendering utilities for Quarto documents
- src/verification.py: Tools for verifying mathematical derivations
- src/plotting.py: Reproducible plotting with fixed seed (42)
- src/wave/wave1D_devito.py: 1D wave equation solver using Devito DSL

Testing infrastructure:
- tests/test_operators.py: 37 tests for FD operators
- tests/test_derivations.py: 22 tests for heat, wave, advection equations
- tests/test_wave_devito.py: 13 tests for Devito wave solver
- tests/conftest.py: Shared pytest fixtures

CI/CD:
- .github/workflows/ci.yml: GitHub Actions workflow
- codecov.yml: Coverage reporting configuration
- pytest.ini: Pytest configuration

Dependencies:
- Add optional devito and devito-petsc dependencies from GitHub
- Add progress summary table to devito-plan.md with phase status
- Document recent completions (Phase 0, 0.5, 7)
- Update README for Quarto-based build system
- Add CI and Codecov badges to README
- Add Devito installation instructions (pip install -e ".[devito]")
- Update directory structure to reflect new src/ package layout
- Add pre-commit hooks and code style documentation
- Add ignores to .markdownlint-cli2.yaml for devito_repo/, venv/, etc.
- Disable MD018 (shebang false positives) and MD036 (exercise labels)
Phase 2 Wave Equations progress:
- src/wave/wave2D_devito.py: 2D wave solver using Devito .laplace
- src/wave/sources.py: Ricker wavelet, Gaussian pulse, spectrum analysis
- Updated src/wave/__init__.py with new exports
- Added 16 new tests (29 total wave tests, 88 total)

Also includes typo fixes in legacy files from pre-commit hooks.
Phase 2 chapter content for wave equations using Devito DSL:

- wave1D_devito.qmd: Core 1D solver with Grid, TimeFunction, Operator
  - Symbolic derivatives (.dt2, .dx2)
  - Boundary conditions using Eq
  - Verification with standing wave solution

- wave1D_features.qmd: Source terms and variable coefficients
  - Ricker and Gaussian source wavelets
  - Point sources with SparseTimeFunction
  - Variable velocity fields
  - Absorbing boundary conditions

- wave2D_devito.qmd: 2D extension using .laplace
  - Dimension-agnostic Laplacian
  - 2D CFL stability condition
  - Visualization with surface/contour plots

- wave_exercises.qmd: 10 Devito-based exercises with solutions
  - Standing waves, convergence rates, guitar string
  - Source wavelets, 2D propagation, interface reflections
  - Manufactured solutions, energy conservation, dispersion

Updated index.qmd to include new sections.
Python Solvers:
- src/diffu/diffu1D_devito.py: 1D diffusion solver (Forward Euler explicit)
  with DiffusionResult dataclass, exact solution, convergence testing
- src/diffu/diffu2D_devito.py: 2D diffusion solver using .laplace
- src/diffu/__init__.py: Module exports for new Devito solvers

Quarto Chapters:
- chapters/diffu/diffu1D_devito.qmd: Forward Euler with Devito covering
  time_order=1, .dt derivative, Fourier number F <= 0.5 stability
- chapters/diffu/diffu2D_devito.qmd: 2D extension with .laplace and
  F <= 0.25 stability for equal spacing
- chapters/diffu/diffu_devito_exercises.qmd: 10 exercises with solutions
  covering stability, convergence, Gaussian/plug initial conditions,
  2D heat diffusion, variable coefficients, manufactured solutions

Tests:
- tests/test_diffu_devito.py: 23 tests covering 1D/2D solvers, exact
  solutions, convergence rates, boundary conditions, initial conditions

All 111 tests pass.
Phase 4 implements 1D advection solvers using Devito DSL:

Solvers (src/advec/advec1D_devito.py):
- Upwind scheme: first-order, uses .subs() for shifted indexing
- Lax-Wendroff scheme: second-order accurate
- Lax-Friedrichs scheme: first-order, very stable
- Helper functions for exact solutions and convergence testing

Chapter content:
- chapters/advec/advec1D_devito.qmd: scheme comparison and implementation
- chapters/advec/advec_devito_exercises.qmd: 10 exercises with solutions
- Updated chapters/advec/index.qmd with new includes

Testing:
- 25 tests for advection solvers (convergence, boundary conditions, accuracy)
Python Solvers (src/nonlin/nonlin1D_devito.py):
- solve_nonlinear_diffusion_explicit: Explicit scheme with lagged coefficient
- solve_reaction_diffusion_splitting: Lie and Strang operator splitting
- solve_burgers_equation: Viscous Burgers' equation with conservative form
- solve_nonlinear_diffusion_picard: Picard iteration for implicit schemes
- Helper functions: constant_diffusion, linear_diffusion, porous_medium_diffusion
- Reaction terms: logistic_reaction, fisher_reaction, allen_cahn_reaction

Quarto Chapters:
- chapters/nonlin/nonlin1D_devito.qmd: Nonlinear diffusion, reaction-diffusion
  splitting, Burgers' equation implementation with Devito
- chapters/nonlin/nonlin_devito_exercises.qmd: 10 exercises with solutions

Tests:
- tests/test_nonlin_devito.py: 29 tests for all nonlinear solvers

Also added "Strang" to typos exclusion (mathematician Gilbert Strang).
- Add "Devito and Truncation Errors" section to truncation appendix
  covering space_order parameter, stencil viewing, and accuracy tradeoffs
- Add "Software Engineering with Devito" section to softeng appendix
  covering project structure, pytest fixtures, convergence testing,
  and performance profiling
- Fix Strang splitting typo in tests (strange -> strang)
- Update devito-plan.md to mark Phase 6 complete
- Add ipython to test-derivations dependencies (required by src/display.py)
- Ignore E741/E743 in ruff check (I is standard notation for initial condition)
- Limit ruff check to new Devito code paths (skip legacy code with pre-existing issues)
- Ignore F841 (unused variables), E722 (bare except), E731 (lambda), E402 (import order)
- Create chapters/devito_intro/ with five QMD files covering:
  - What is Devito (motivation, traditional vs DSL approach)
  - First PDE (1D wave equation complete example)
  - Core abstractions (Grid, Function, TimeFunction, Eq, Operator)
  - Boundary conditions (Dirichlet, Neumann, absorbing, periodic)
  - Verification (convergence testing, MMS)
- Update _quarto.yml to use devito_intro as first main chapter
- Update devito-plan.md to mark Phase 1 complete
- Add Devito references to bibliography (4 entries)
- Fix Unicode characters causing pdflatex errors (lambda, pi, nu, approx)
- Replace box-drawing characters with ASCII in directory tree
- Update cross-references from removed vib chapter to devito_intro
- Add section label for absorbing boundary conditions
- Fix preface chapter reference from @sec-ch-vib to @sec-ch-devito-intro
- Remove obsolete vib animation references from wave chapter
- PDF builds cleanly (4.9MB), all 165 tests pass
- Delete all .do.txt files and conversion scripts
- Remove doconce, mako, and related dependencies from pyproject.toml and requirements.txt
- Replace doconce combine_images with ImageMagick montage in source files
- Clean up .gitignore, config files, and documentation references
- Remove legacy doc/ build directory
- Rewrite README.md to highlight Devito DSL and modern tooling
- Update index.qmd with Devito introduction and code example
- Update CLAUDE.md with Devito patterns and project structure
- Update _quarto.yml source URLs to point to devitocodes repo
- Remove devito-plan.md (completed development roadmap)
- Remove issues.md (conversion tracking no longer needed)
- Change subtitle from "A Modern Software Approach" to "A Devito Approach"
- Add "About This Adaptation" section to preface with CC BY 4.0 attribution
- Fix license from CC BY-NC 4.0 to CC BY 4.0 (matching original work)
- Add adapter credit (Gerard J. Gorman, Imperial College London)
- Create LICENSE file with full attribution requirements
- Add license badge and DOI link to README and index
@ggorman ggorman merged commit e4d16e1 into main Jan 28, 2026
9 checks passed
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.

2 participants