Skip to content

Commit b8c83de

Browse files
committed
Update documentation and add progress tracking
- 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
1 parent 9bf5d5c commit b8c83de

2 files changed

Lines changed: 138 additions & 50 deletions

File tree

README.md

Lines changed: 96 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Finite Difference Computing with PDEs
22

33
[![Build Book PDF](https://github.com/devitocodes/devito_book/actions/workflows/build.yml/badge.svg)](https://github.com/devitocodes/devito_book/actions/workflows/build.yml)
4+
[![CI](https://github.com/devitocodes/devito_book/actions/workflows/ci.yml/badge.svg)](https://github.com/devitocodes/devito_book/actions/workflows/ci.yml)
5+
[![codecov](https://codecov.io/gh/devitocodes/devito_book/branch/devito/graph/badge.svg)](https://codecov.io/gh/devitocodes/devito_book)
46

57
Resources for the book *Finite Difference Computing with Partial Differential Equations - A Modern Software Approach* by Hans Petter Langtangen and Svein Linge.
68

@@ -23,16 +25,32 @@ python -m venv venv
2325
source venv/bin/activate # On Windows: venv\Scripts\activate
2426
pip install -e .
2527

26-
# Build the book PDF
27-
cd doc/.src/book
28-
bash make.sh nospell
28+
# Build the book (using Quarto)
29+
quarto render --to pdf
30+
```
31+
32+
### With Devito (for PDE solvers)
33+
34+
```bash
35+
# Install with Devito support (explicit schemes)
36+
pip install -e ".[devito]"
37+
38+
# Or with PETSc branch for implicit schemes
39+
pip install -e ".[devito-petsc]"
40+
```
41+
42+
### Run Tests
43+
44+
```bash
45+
pytest tests/ -v # Run all tests
46+
pytest tests/ -v -m "not devito" # Skip Devito tests
2947
```
3048

3149
## Prerequisites
3250

3351
### Python (3.10+)
3452

35-
The book uses [DocOnce](https://github.com/doconce/doconce) for document generation. Install Python dependencies with:
53+
The book uses [Quarto](https://quarto.org/) for document generation. Install Python dependencies with:
3654

3755
```bash
3856
# Create and activate virtual environment (recommended)
@@ -46,6 +64,19 @@ pip install -e .
4664
pip install -r requirements.txt
4765
```
4866

67+
### Quarto
68+
69+
Install [Quarto](https://quarto.org/docs/get-started/) for document generation:
70+
71+
```bash
72+
# macOS (Homebrew)
73+
brew install quarto
74+
75+
# Ubuntu/Debian
76+
wget https://github.com/quarto-dev/quarto-cli/releases/latest/download/quarto-linux-amd64.deb
77+
sudo dpkg -i quarto-linux-amd64.deb
78+
```
79+
4980
### LaTeX (TeX Live)
5081

5182
A full TeX Live installation is recommended. The book requires many LaTeX packages.
@@ -111,61 +142,55 @@ Install [MiKTeX](https://miktex.org/download) or [TeX Live for Windows](https://
111142
### Full Book PDF
112143

113144
```bash
114-
cd doc/.src/book
115-
bash make.sh nospell # Skip spellcheck for faster builds
145+
quarto render --to pdf
116146
```
117147

118-
The PDF will be generated as `doc/.src/book/book.pdf`.
148+
The PDF will be generated as `_book/Finite-Difference-Computing-with-PDEs.pdf`.
119149

120-
### With Spellcheck
150+
### All Formats (HTML + PDF)
121151

122152
```bash
123-
cd doc/.src/book
124-
bash make.sh # Runs spellcheck before building
153+
quarto render
125154
```
126155

127-
### Individual Chapters
128-
129-
Each chapter can be built independently:
156+
### Live Preview
130157

131158
```bash
132-
cd doc/.src/chapters/vib # or wave, diffu, etc.
133-
bash make.sh
159+
quarto preview # Opens browser with hot reload
134160
```
135161

136162
## Directory Structure
137163

138164
```text
139165
devito_book/
140-
├── src/ # Source code for book examples
141-
│ └── X/ # Source code from chapter X
142-
├── doc/
143-
│ ├── pub/ # Published documents
144-
│ │ ├── book/ # Complete published book
145-
│ │ └── X/ # Published chapter X
146-
│ └── .src/ # DocOnce source
147-
│ ├── book/ # Source for complete book
148-
│ │ ├── make.sh # Build script
149-
│ │ ├── book.do.txt # Main DocOnce file
150-
│ │ └── preface.do.txt
151-
│ └── chapters/
152-
│ └── X/ # Source for chapter X
166+
├── src/ # Python package for book examples
167+
│ ├── __init__.py # Package exports
168+
│ ├── symbols.py # Canonical SymPy symbols
169+
│ ├── operators.py # Finite difference operators
170+
│ ├── display.py # LaTeX equation display utilities
171+
│ ├── verification.py # Symbolic verification utilities
172+
│ ├── plotting.py # Reproducible plotting
173+
│ ├── common/ # Shared utilities
174+
│ └── wave/ # Wave equation solvers
175+
│ └── wave1D_devito.py # 1D wave solver using Devito
176+
├── tests/ # Pytest test suite
177+
│ ├── conftest.py # Test fixtures
178+
│ ├── test_operators.py # FD operator tests
179+
│ ├── test_derivations.py # Mathematical derivation tests
180+
│ └── test_wave_devito.py # Devito wave solver tests
181+
├── chapters/ # Quarto book chapters
182+
│ ├── vib/ # Vibration ODEs
183+
│ ├── wave/ # Wave equations
184+
│ ├── diffu/ # Diffusion equations
185+
│ ├── advec/ # Advection equations
186+
│ └── nonlin/ # Nonlinear problems
187+
├── _quarto.yml # Quarto book configuration
153188
├── pyproject.toml # Python package configuration
154-
├── requirements.txt # Python dependencies (alternative)
155-
└── README.md # This file
189+
└── README.md # This file
156190
```
157191

158192
## Troubleshooting
159193

160-
### DocOnce Configuration Errors
161-
162-
If you see permission errors related to DocOnce config:
163-
164-
```bash
165-
export HOME=$(mktemp -d) # Use temporary home directory
166-
bash make.sh nospell
167-
```
168-
169194
### Missing LaTeX Packages
170195

171196
If pdflatex fails with "File not found" errors:
@@ -178,26 +203,47 @@ tlmgr search --global --file "missing-file.sty"
178203
sudo tlmgr install package-name
179204
```
180205

181-
### Encoding Errors
206+
### Quarto Errors
182207

183-
The build script automatically fixes encoding issues by converting from `utf8x` to standard `utf8`. If you see encoding errors, ensure you're using the latest `make.sh`.
208+
Check the Quarto log output for details. For more verbose output:
184209

185-
### Build Logs
210+
```bash
211+
quarto render --log-level debug
212+
```
213+
214+
### Devito Installation Issues
186215

187-
Check these files for detailed error information:
216+
If Devito installation fails, ensure you have a C compiler and dependencies:
188217

189-
- `book.log` - LaTeX compilation log
190-
- `book.dlog` - DocOnce processing log
218+
```bash
219+
# macOS
220+
xcode-select --install
221+
222+
# Ubuntu/Debian
223+
sudo apt-get install build-essential python3-dev
224+
```
191225

192226
## Contributing
193227

194228
1. Fork the repository
195229
2. Create a feature branch (`git checkout -b feature/improvement`)
196-
3. Make your changes
197-
4. Run the build to verify (`bash make.sh nospell`)
198-
5. Commit your changes (`git commit -am 'Add improvement'`)
199-
6. Push to the branch (`git push origin feature/improvement`)
200-
7. Create a Pull Request
230+
3. Install development dependencies: `pip install -e ".[dev]"`
231+
4. Install pre-commit hooks: `pre-commit install`
232+
5. Make your changes
233+
6. Run tests: `pytest tests/ -v`
234+
7. Verify the build: `quarto render`
235+
8. Commit your changes (pre-commit hooks run automatically)
236+
9. Push to the branch and create a Pull Request
237+
238+
### Code Style
239+
240+
The project uses:
241+
- **ruff** for linting
242+
- **isort** for import sorting
243+
- **typos** for spell checking
244+
- **markdownlint** for markdown files
245+
246+
Pre-commit hooks enforce these automatically.
201247

202248
## License
203249

devito-plan.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,47 @@
11
# Devito Book Refactoring: Development Roadmap
22

3+
## Progress Summary
4+
5+
| Phase | Status | Description |
6+
|-------|--------|-------------|
7+
| 0 | ✅ Complete | Infrastructure Setup |
8+
| 0.5 | ✅ Complete | SymPy Integration for Reproducible Mathematics |
9+
| 1 | ⬜ Not Started | Restructure Book Organization |
10+
| 2 | 🚧 In Progress | Wave Equations Chapter |
11+
| 3 | ⬜ Not Started | Diffusion Equations Chapter |
12+
| 4 | ⬜ Not Started | Advection Equations Chapter |
13+
| 5 | ⬜ Not Started | Nonlinear Problems Chapter |
14+
| 6 | ⬜ Not Started | Appendices |
15+
| 7 | ✅ Complete | Testing & CI Infrastructure |
16+
| 8 | ⬜ Not Started | Final Integration & Review |
17+
18+
### Recent Completions (2025-01-27)
19+
20+
**Phase 0 - Infrastructure:**
21+
- Created `src/` package structure with `__init__.py` exports
22+
- Added `pyproject.toml` with optional `devito` and `devito-petsc` dependencies
23+
- Set up pre-commit hooks (ruff, isort, typos, markdownlint)
24+
- Created `.gitignore` and `.markdownlintignore` configurations
25+
26+
**Phase 0.5 - SymPy Integration:**
27+
- `src/symbols.py` - Canonical SymPy symbols (x, t, dx, dt, etc.)
28+
- `src/operators.py` - FD operators with truncation error analysis
29+
- `src/display.py` - LaTeX equation display utilities
30+
- `src/verification.py` - Symbolic identity and PDE verification
31+
- `src/plotting.py` - Reproducible matplotlib/plotly plots
32+
33+
**Phase 7 - Testing & CI:**
34+
- `tests/conftest.py` - Pytest fixtures including `devito_available`
35+
- `tests/test_operators.py` - 37 tests for FD operators
36+
- `tests/test_derivations.py` - 22 tests for mathematical derivations
37+
- `tests/test_wave_devito.py` - Devito wave solver tests (skipped if Devito not installed)
38+
- `.github/workflows/ci.yml` - GitHub Actions CI with Codecov integration
39+
40+
**Phase 2 - Wave Equations (Started):**
41+
- `src/wave/wave1D_devito.py` - 1D wave equation solver using Devito DSL
42+
43+
---
44+
345
## Executive Summary
446

547
This document outlines the comprehensive plan to refactor *Finite Difference Computing with PDEs - A Modern Software Approach* to use the Devito DSL instead of NumPy-based implementations. The refactored book will teach finite difference methods through Devito's symbolic PDE specification and automatic code generation capabilities.

0 commit comments

Comments
 (0)