Skip to content

Commit 4eae8dc

Browse files
committed
Add basic time integration test for Klein-Gordon solver; update progress log
1 parent ab1e44e commit 4eae8dc

2 files changed

Lines changed: 41 additions & 39 deletions

File tree

docs/progress_log.md

Lines changed: 17 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@
4646
- CLI demo executed successfully, generated HDF5 output as expected.
4747

4848
```latest-progress
49+
The basic time integration test passed locally. I updated progress_log.md. Next, I’ll refine the solver’s accuracy like comparing to analytical solution for small `dt`.
50+
```
51+
```progress
4952
Local tests and the CLI demo ran successfully. The `pandas` dependency resolved the test failures, and the demo generated expected output. I updated the progress log—next, I’ll push these changes so CI can verify the remote workflow, then proceed with dynamic field evolution validation.
5053
```
5154
```progress
@@ -103,7 +106,8 @@ I created a merge_wip.sh helper to install MPB via conda and merge all `wip` bra
103106

104107
```file-history
105108
~/Code/asciimath$ find . -path "./.venv" -prune -o -type f -regex '.*\.\(ps1\|py\|sh\|ndjson\|json\|md\|yml\|toml\|h5\)$' -print | while read file; do stat -c '%Y %n' "$file"; done | sort -nr | while read timestamp file; do echo "$(date -d @$timestamp '+%Y-%m-%d %H:%M:%S') $file"; done | head -n 40
106-
2025-08-01 15:14:58 ./docs/progress_log.md
109+
2025-08-01 15:33:59 ./docs/progress_log.md
110+
2025-08-01 15:32:26 ./tests/test_time_integration_basic.py
107111
2025-08-01 15:05:30 ./pyproject.toml
108112
2025-08-01 15:05:30 ./.github/workflows/ci.yml
109113
2025-08-01 15:04:58 ./results/demo_sweep.h5
@@ -142,45 +146,19 @@ I created a merge_wip.sh helper to install MPB via conda and merge all `wip` bra
142146
2025-07-31 13:22:17 ./test_multilayer.py
143147
2025-07-31 13:22:17 ./test_mathematical_enhancements.py
144148
2025-07-31 13:22:17 ./test_hardware_modules.py
145-
2025-07-31 13:22:17 ./test_complete_integration.py
146149
````
147150
148151
```test-history
149-
$ export PYTHONPATH=src && /home/sherri3/Code/asciimath/negative-energy-generator/.venv/bin/python -m pytest --maxfail=1 --disable-warnings -q
150-
........................................... [100%]
151-
43 passed, 1185 warnings in 413.74s (0:06:53)
152-
$ gh run view 16686236180
153-
154-
X main CI · 16686236180
155-
Triggered via push about 1 minute ago
156-
157-
JOBS
158-
X build (3.10) in 27s (ID 47236144928)
159-
X build (3.12) in 26s (ID 47236144930)
160-
✓ Set up job
161-
✓ Run actions/checkout@v3
162-
✓ Run actions/checkout@v3
163-
✓ Set PYTHONPATH
164-
✓ Set up Python
165-
X Install dependencies
166-
- Run unit tests
167-
- Run CLI demo
168-
- Post Set up Python
169-
✓ Post Run actions/checkout@v3
170-
✓ Post Run actions/checkout@v3
171-
✓ Complete job
172-
173-
ANNOTATIONS
174-
X The operation was canceled.
175-
build (3.10): .github#123
176-
177-
X The strategy configuration was canceled because "build._3_12" failed
178-
build (3.10): .github#1
179-
180-
X Process completed with exit code 1.
181-
build (3.12): .github#114
182-
183-
184-
To see what failed, try: gh run view 16686236180 --log-failed
185-
View this run on GitHub: https://github.com/arcticoder/negative-energy-generator/actions/runs/16686236180
152+
$ export PYTHONPATH=src && /home/sherri3/Code/asciimath/negative-energy-generator/.venv/bin/python -m pytest tests/test_time_integration_basic.py --maxfail=1 --disable-warnings -q
153+
. [100%]
154+
1 passed, 1 warning in 0.20s
186155
````
156+
157+
## 2025-08-06
158+
159+
### In Progress
160+
- Added `test_time_integration_basic.py` to validate `solve_klein_gordon` output shapes and finite values.
161+
162+
### Next Tasks
163+
- Run the new test locally and confirm CI compatibility.
164+
- Refine time integration accuracy by comparing against analytical solution for small dt.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import sys
2+
import pathlib
3+
# Ensure local 'src' directory is on the import path
4+
sys.path.insert(0, str(pathlib.Path(__file__).parent.parent / "src"))
5+
import numpy as np
6+
from simulation.lattice_qft import solve_klein_gordon # type: ignore
7+
8+
def test_solve_klein_gordon_shapes_and_values():
9+
N = 50
10+
dx = 0.1
11+
dt = 0.01
12+
steps = 10
13+
alpha = 0.0 # massless
14+
beta = 0.0 # no damping
15+
16+
phi, phi_dt = solve_klein_gordon(N, dx, dt, steps, alpha, beta)
17+
18+
# Check output shapes
19+
assert phi.shape == (N,), "Field array phi has incorrect shape"
20+
assert phi_dt.shape == (N,), "Field derivative phi_dt has incorrect shape"
21+
22+
# Values should be finite numbers
23+
assert np.all(np.isfinite(phi)), "Field values contain non-finite entries"
24+
assert np.all(np.isfinite(phi_dt)), "Field derivative contains non-finite entries"

0 commit comments

Comments
 (0)