Skip to content

Commit ab9b38c

Browse files
committed
Add Phase 1 content: Elliptic PDEs, Burgers, and Shallow Water Equations
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
1 parent 97312c8 commit ab9b38c

19 files changed

Lines changed: 6139 additions & 0 deletions

.typos.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ ue = "ue"
66
# Strang splitting (named after mathematician Gilbert Strang)
77
strang = "strang"
88
Strang = "Strang"
9+
# Variable name for "p at iteration n" in Jacobi iteration
10+
pn = "pn"

Makefile

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Makefile for Finite Difference Computing with PDEs book
2+
3+
.PHONY: pdf html all preview clean test test-devito test-no-devito lint format check help
4+
5+
# Default target
6+
all: pdf
7+
8+
# Build targets
9+
pdf:
10+
quarto render --to pdf
11+
12+
html:
13+
quarto render --to html
14+
15+
# Build both PDF and HTML
16+
book:
17+
quarto render
18+
19+
# Live preview with hot reload
20+
preview:
21+
quarto preview
22+
23+
# Clean build artifacts
24+
clean:
25+
rm -rf _book/
26+
rm -rf .quarto/
27+
find . -name "*.aux" -delete
28+
find . -name "*.log" -delete
29+
find . -name "*.out" -delete
30+
31+
# Test targets
32+
test:
33+
pytest tests/ -v
34+
35+
test-devito:
36+
pytest tests/ -v -m devito
37+
38+
test-no-devito:
39+
pytest tests/ -v -m "not devito"
40+
41+
test-phase1:
42+
pytest tests/test_elliptic_devito.py tests/test_burgers_devito.py tests/test_swe_devito.py -v
43+
44+
# Linting and formatting
45+
lint:
46+
ruff check src/
47+
48+
format:
49+
ruff check --fix src/
50+
isort src/
51+
52+
check:
53+
pre-commit run --all-files
54+
55+
# Help
56+
help:
57+
@echo "Available targets:"
58+
@echo " pdf - Build PDF (default)"
59+
@echo " html - Build HTML"
60+
@echo " book - Build all formats (PDF + HTML)"
61+
@echo " preview - Live preview with hot reload"
62+
@echo " clean - Remove build artifacts"
63+
@echo " test - Run all tests"
64+
@echo " test-devito - Run only Devito tests"
65+
@echo " test-no-devito - Run tests without Devito"
66+
@echo " test-phase1 - Run Phase 1 tests (elliptic, burgers, swe)"
67+
@echo " lint - Check code with ruff"
68+
@echo " format - Auto-format code with ruff and isort"
69+
@echo " check - Run all pre-commit hooks"
70+
@echo " help - Show this help message"

_quarto.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ book:
1919
- chapters/diffu/index.qmd
2020
- chapters/advec/index.qmd
2121
- chapters/nonlin/index.qmd
22+
- chapters/elliptic/index.qmd
23+
- chapters/systems/index.qmd
2224
- part: "Appendices"
2325
chapters:
2426
- chapters/appendices/formulas/index.qmd
@@ -169,6 +171,8 @@ src_diffu: "https://github.com/devitocodes/devito_book/tree/devito/src/diffu"
169171
src_nonlin: "https://github.com/devitocodes/devito_book/tree/devito/src/nonlin"
170172
src_trunc: "https://github.com/devitocodes/devito_book/tree/devito/src/trunc"
171173
src_advec: "https://github.com/devitocodes/devito_book/tree/devito/src/advec"
174+
src_elliptic: "https://github.com/devitocodes/devito_book/tree/devito/src/elliptic"
175+
src_systems: "https://github.com/devitocodes/devito_book/tree/devito/src/systems"
172176
src_formulas: "https://github.com/devitocodes/devito_book/tree/devito/src/formulas"
173177
src_softeng2: "https://github.com/devitocodes/devito_book/tree/devito/src/softeng2"
174178

0 commit comments

Comments
 (0)