Skip to content

Commit fa52c96

Browse files
committed
Add Makefile targets for null-results and report; update README/docs for null-results, script paths, formatting, and status wording; make examples a package and fix imports in examples/refined_feasibility; ensure scripts add repo root to PYTHONPATH and add timing to benchmark output; add benchmark_results.json and optimized_vs_baseline figure
1 parent 3598aba commit fa52c96

9 files changed

Lines changed: 157 additions & 39 deletions

Makefile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ help:
1111
@echo " make domain-sweep - Domain padding sensitivity study"
1212
@echo ""
1313
@echo "Analysis:"
14-
@echo " make analysis - Run interactive analysis menu"
14+
@echo " make analysis - Run analysis CLI (prints usage; see --help for subcommands)"
1515
@echo " make optimize - Run geometry optimization"
1616
@echo ""
1717
@echo "Code quality:"
@@ -92,6 +92,15 @@ paper:
9292
cd papers && pdflatex coherence_gravity_coupling.tex && bibtex coherence_gravity_coupling \
9393
&& pdflatex coherence_gravity_coupling.tex && pdflatex coherence_gravity_coupling.tex
9494

95+
# Build null_results PDF (curvature–EM coupling null-results paper)
96+
null-results:
97+
cd papers && pdflatex null_results.tex && bibtex null_results \
98+
|| true; pdflatex null_results.tex && pdflatex null_results.tex
99+
100+
# Generate consolidated analysis tables (CSV/Markdown/LaTeX)
101+
report:
102+
python scripts/generate_report.py --all
103+
95104
manifest:
96105
python scripts/generate_manifest.py --output data_manifest.csv --roots results papers/figures
97106

README.md

Lines changed: 39 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,22 @@ pdflatex coherence_gravity_coupling.tex && bibtex coherence_gravity_coupling \
2929
&& pdflatex coherence_gravity_coupling.tex && pdflatex coherence_gravity_coupling.tex
3030
```
3131

32+
```bash
33+
# Also build the null-results paper (curvature–EM coupling constraints)
34+
cd papers
35+
pdflatex null_results.tex && bibtex null_results \
36+
&& pdflatex null_results.tex && pdflatex null_results.tex
37+
```
38+
39+
Why multiple pdflatex runs? LaTeX generally requires 2–3 passes to resolve cross-references, citations, and the bibliography. The sequence above (pdflatex → bibtex → pdflatex → pdflatex) is the standard pattern to ensure all references are correct for both papers.
40+
3241
Expected outputs:
3342
- `papers/figures/convergence_analysis.pdf` (Fig 1)
3443
- `papers/figures/material_comparison.pdf` (Fig 2)
3544
- `papers/figures/landscape_YBCO_z_slice.pdf` (Fig 3)
3645
- `papers/coherence_gravity_coupling.pdf` (5 pages)
3746

38-
Runtime guidance (Intel i7-10700K, 32GB RAM): 41³ ~ 3–5s/solve; 61³ ~ 5–8s/solve; 81³ ~ 20–30s; 101³ ~ 1–2min. Full convergence (61/81/101) ~ 1–8 hours.
47+
Runtime guidance (Intel i7-10700K, 32GB RAM): 41³ ~ 3–5s/solve; 61³ ~ 5–8s/solve; 81³ ~ 20–30s; 101³ ~ 1–2min. Full convergence (61/81/101) ~ 1–8 hours. Note: These timings apply to the 3D solver runs (examples/analysis). pdflatex and figure generation complete in seconds.
3948

4049
### Using Make (recommended)
4150

@@ -47,7 +56,7 @@ make test # Run full test suite (23 tests, ~90s)
4756
make quick-bench # Quick benchmark at 41³ (~30s)
4857
make figures # Generate manuscript figures
4958
make paper # Build coherence_gravity_coupling.pdf
50-
make analysis # Interactive analysis menu
59+
make analysis # Analysis CLI (prints usage; see --help for subcommands)
5160
make optimize # Run geometry optimization
5261
make cache-info # Show cache statistics
5362
make cache-clean # Clear all cached results
@@ -60,7 +69,7 @@ This repo now includes a module and CLI to derive exclusion limits on a curvatur
6069
- Implementation: `src/field_equations/curvature_coupling.py`
6170
- Plots: `src/visualization/plot_utils.py::plot_exclusion_limits`
6271
- Preprint: `papers/null_results.tex`
63-
- Reports: auto-generated CSV/Markdown/LaTeX in `results/reports/` via `python generate_report.py --all`
72+
- Reports: auto-generated CSV/Markdown/LaTeX in `results/reports/` via `python scripts/generate_report.py --all` or `make report`
6473

6574
### CLI examples
6675

@@ -449,21 +458,22 @@ where $`\tilde{T}_{\mu\nu} = T_{\mu\nu}^{\text{matter}} + T_{\mu\nu}^{\Phi}`$ in
449458

450459
4. **Run geometric Cavendish simulation**:
451460
```bash
452-
# Single configuration with volume-averaged force (recommended)
453-
python -c "
454-
import numpy as np
455-
from examples.geometric_cavendish import sweep_coherent_position
456-
457-
result = sweep_coherent_position(
458-
y_range=np.linspace(0.0, 0.05, 3),
459-
z_range=np.linspace(-0.12, -0.04, 3),
460-
xi=100.0,
461-
Phi0=6.67e8, # YBCO
462-
verbose=True
463-
)
464-
print(f'\\nOptimal position: {result[\"optimal\"][\"position\"]}')
465-
print(f'Delta tau: {result[\"optimal\"][\"delta_tau\"]:.3e} N·m')
466-
"
461+
# Single configuration with volume-averaged force (recommended)
462+
python -c "
463+
import numpy as np
464+
from examples.geometric_cavendish import sweep_coherent_position
465+
466+
result = sweep_coherent_position(
467+
y_range=np.linspace(0.0, 0.05, 3),
468+
z_range=np.linspace(-0.12, -0.04, 3),
469+
base_geom_params={},
470+
xi=100.0,
471+
Phi0=6.67e8, # YBCO
472+
verbose=True
473+
)
474+
print(f'\nOptimal position: {result[\"optimal\"][\"position\"]}')
475+
print(f'Delta tau: {result[\"optimal\"][\"delta_tau\"]:.3e} N·m')
476+
"
467477
```
468478

469479
4. **Run convergence test**:
@@ -472,10 +482,10 @@ python -c "
472482
from examples.geometric_cavendish import convergence_test
473483
474484
convergence_test(
475-
grid_resolutions=[41, 61],
476-
xi=100.0,
477-
Phi0=6.67e8,
478-
verbose=True
485+
grid_resolutions=[41, 61],
486+
xi=100.0,
487+
Phi0=6.67e8,
488+
verbose=True
479489
)
480490
"
481491
```
@@ -597,7 +607,7 @@ coherence-gravity-coupling/
597607

598608
### Solver Performance
599609

600-
**Recent Improvements** (January 2025): Implemented performance optimizations for 3D Poisson solver:
610+
**Recent Improvements** (October 2025): Implemented performance optimizations for 3D Poisson solver:
601611

602612
#### Key Features
603613
- **Diagonal (Jacobi) preconditioner**: Fast preconditioning with O(N) setup cost
@@ -641,7 +651,7 @@ For details, see [`SOLVER_PERFORMANCE_IMPROVEMENTS.md`](SOLVER_PERFORMANCE_IMPRO
641651

642652
#### Result Caching
643653

644-
**New Feature** (January 2025): Optional result caching for parameter sweeps.
654+
**New Feature** (October 2025): Optional result caching for parameter sweeps.
645655

646656
```python
647657
# Enable caching to skip repeated expensive calculations
@@ -669,7 +679,7 @@ make cache-clean # Clear all cached results
669679

670680
#### Domain Size and Boundary Conditions
671681

672-
**Recommendation** (January 2025): Use `domain_size ≥ 2.5× minimum_enclosing_size`.
682+
**Recommendation** (October 2025): Use `domain_size ≥ 2.5× minimum_enclosing_size`.
673683

674684
**Domain Study Results** (61³ resolution, xi=100, YBCO):
675685
- **Padding 2.0×**: 7.1% variation in Δτ
@@ -811,7 +821,7 @@ Improvement: 1.00× (already optimal)
811821
- ⏳ Energy cost of warp drops to laboratory scale (~MJ instead of Earth mass) (not yet validated for full warp metric)
812822
- ⏳ Path to engineering curvature becomes plausible (testable with proposed experiment)
813823

814-
**Phase D Status:** 🎯 **BREAKTHROUGH ACHIEVED** - Experiment is **trivially feasible**
824+
**Phase D Status:** 🎯 **BREAKTHROUGH ACHIEVED** - Experiment is **feasible but challenging** (requires cryogenics and precision isolation)
815825

816826
### Latest Updates (Phase D+)
817827

@@ -880,10 +890,12 @@ Improvement: 1.00× (already optimal)
880890

881891
### Grid Convergence
882892
- **41³ grid**: Fast (~3s/solve), sufficient for parameter scans
883-
- **61³ grid**: Moderate (~10s/solve), shows ~220% Δτ change from 41³ (not fully converged)
893+
- **61³ grid**: Moderate (~10s/solve), often shows O(10²%) Δτ change vs 41³ (not fully converged)
884894
- **81³+ grid**: Recommended for quantitative predictions; requires volume averaging for stability
885895
- **Volume averaging**: Reduces aliasing by integrating ∇φ over test mass volume; use for convergence studies
886896

897+
Note: A message like "Not fully converged (>62.49% change)" on 41³→61³ is expected for point-sample torque. Enable volume averaging (use_volume_average=True) and/or include 81³ to see the relative change drop below ~1–5%.
898+
887899
### Experimental Challenges
888900
1. **Cryogenic operation required**: Room temperature noise floor too high (0/18 configs <24hr feasible)
889901
2. **Integration times**: 0.7-24 hours for SNR=5 (not milliseconds as initially estimated)

benchmark_results.json

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
{
2+
"resolution": 41,
3+
"n_runs": 2,
4+
"materials": [
5+
"rb87_bec"
6+
],
7+
"results": {
8+
"rb87_bec": {
9+
"cg+none": {
10+
"mean_time": 3.213704396504909,
11+
"std_time": 0.008873526501702145,
12+
"min_time": 3.2048308700032067,
13+
"max_time": 3.222577923006611,
14+
"mean_residual": 0.0,
15+
"mean_torque": -5.105970735621204e-13,
16+
"solver_method": "cg",
17+
"preconditioner": "none",
18+
"speedup": 1.0
19+
},
20+
"cg+diagonal": {
21+
"mean_time": 3.120515021495521,
22+
"std_time": 0.06067115650512278,
23+
"min_time": 3.0598438649903983,
24+
"max_time": 3.181186178000644,
25+
"mean_residual": 0.0,
26+
"mean_torque": -4.99161046947598e-13,
27+
"solver_method": "cg",
28+
"preconditioner": "diagonal",
29+
"speedup": 1.0298634598351417
30+
},
31+
"bicgstab+none": {
32+
"mean_time": 3.839985500992043,
33+
"std_time": 0.10384562800754793,
34+
"min_time": 3.736139872984495,
35+
"max_time": 3.943831128999591,
36+
"mean_residual": 0.0,
37+
"mean_torque": -4.961596603107724e-13,
38+
"solver_method": "bicgstab",
39+
"preconditioner": "none",
40+
"speedup": 0.8369053465630698
41+
},
42+
"bicgstab+diagonal": {
43+
"mean_time": 3.181468226001016,
44+
"std_time": 0.0014283429918577895,
45+
"min_time": 3.180039883009158,
46+
"max_time": 3.1828965689928737,
47+
"mean_residual": 0.0,
48+
"mean_torque": -4.991611064723489e-13,
49+
"solver_method": "bicgstab",
50+
"preconditioner": "diagonal",
51+
"speedup": 1.0101324823050055
52+
},
53+
"cg+amg": {
54+
"mean_time": 3.3534587640024256,
55+
"std_time": 0.009777534985914826,
56+
"min_time": 3.3436812290165108,
57+
"max_time": 3.3632362989883404,
58+
"mean_residual": 0.0,
59+
"mean_torque": -4.991610680311029e-13,
60+
"solver_method": "cg",
61+
"preconditioner": "amg",
62+
"speedup": 0.9583253060995696
63+
}
64+
}
65+
},
66+
"best_configs": {
67+
"rb87_bec": {
68+
"config": "cg+diagonal",
69+
"time": 3.120515021495521,
70+
"speedup": 1.0298634598351417
71+
}
72+
},
73+
"target_speedup": 2.0
74+
}

docs/SOLVER_PERFORMANCE_IMPROVEMENTS.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,15 @@ def run_geometric_cavendish(
9494
Created `benchmark_solver.py` to systematically test performance:
9595

9696
```bash
97-
# Test at 61³ resolution
98-
python benchmark_solver.py --resolution 61 --runs 3 --materials rb87_bec --xi 100
97+
# Test at 61³ resolution (from repo root)
98+
python scripts/benchmark_solver.py --resolution 61 --runs 3 --materials rb87_bec --xi 100
9999

100100
# Test multiple materials
101-
python benchmark_solver.py --resolution 81 --runs 2 --materials rb87_bec nb_cavity al_film
101+
python scripts/benchmark_solver.py --resolution 81 --runs 2 --materials rb87_bec nb_cavity al_film
102+
103+
# Or use the Makefile presets
104+
make quick-bench # 41³, fast sanity check
105+
make bench # 61³, standard benchmark
102106
```
103107

104108
Output includes:
@@ -253,15 +257,19 @@ COO format advantages:
253257
Run benchmarks:
254258
```bash
255259
# Quick test (41³)
256-
python benchmark_solver.py --resolution 41 --runs 2
260+
python scripts/benchmark_solver.py --resolution 41 --runs 2
257261

258262
# Standard test (61³)
259-
python benchmark_solver.py --resolution 61 --runs 3
263+
python scripts/benchmark_solver.py --resolution 61 --runs 3
260264

261265
# Comprehensive test (multiple resolutions)
262266
for res in 41 61 81; do
263-
python benchmark_solver.py --resolution $res --runs 3 --output benchmark_${res}.json
267+
python scripts/benchmark_solver.py --resolution $res --runs 3 --output benchmark_${res}.json
264268
done
269+
270+
# Makefile alternatives
271+
make quick-bench
272+
make bench
265273
```
266274

267275
Verify correctness:

examples/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Make `examples` a package so absolute imports like `from examples.geometric_cavendish import ...` work
136 KB
Loading

examples/refined_feasibility.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,13 @@
1212
import numpy as np
1313
import json
1414
from pathlib import Path
15+
import sys
1516
import matplotlib.pyplot as plt
1617
from scipy.constants import k as k_B, hbar, c, G as G_newton
18+
# Ensure repository root is on sys.path so `import examples...` works when running this file directly
19+
ROOT = Path(__file__).resolve().parents[1]
20+
if str(ROOT) not in sys.path:
21+
sys.path.insert(0, str(ROOT))
1722

1823
# Physical constants (baseline geometry)
1924
m_test_baseline = 10e-3 # Test mass 10 mg (typical for micro-torsion balance)

scripts/benchmark_solver.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@
1010

1111
import sys
1212
from pathlib import Path
13-
sys.path.insert(0, str(Path(__file__).parent))
13+
14+
# Ensure repository root is on sys.path so `examples` and `src` are importable
15+
ROOT = Path(__file__).resolve().parents[1]
16+
if str(ROOT) not in sys.path:
17+
sys.path.insert(0, str(ROOT))
1418

1519
from examples.geometric_cavendish import run_geometric_cavendish
1620
from src.analysis.phi_calibration import get_all_calibrations
@@ -41,6 +45,7 @@ def benchmark_configuration(
4145
print(f"\n Testing: {solver_method} + {preconditioner} (n={n_runs})")
4246

4347
for i in range(n_runs):
48+
t0 = time.perf_counter()
4449
result = run_geometric_cavendish(
4550
xi=xi,
4651
Phi0=Phi0,
@@ -49,12 +54,11 @@ def benchmark_configuration(
4954
solver_method=solver_method,
5055
preconditioner=preconditioner
5156
)
52-
53-
sys.path.insert(0, str(Path(__file__).parent.parent))
57+
dt = time.perf_counter() - t0
58+
times.append(dt)
5459
residuals.append(result.get('residual_coherent', 0.0))
5560
torques.append(result['tau_coherent'])
56-
57-
print(f" Run {i+1}: {times[-1]:.2f} s, residual: {residuals[-1]:.2e}")
61+
print(f" Run {i+1}: {dt:.2f} s, residual: {residuals[-1]:.2e}")
5862

5963
return {
6064
'mean_time': float(np.mean(times)),

scripts/optimize_geometry.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@
3535
import subprocess
3636
from importlib import metadata as _metadata
3737

38+
# Ensure repository root on sys.path so `examples`/`src` are importable when run via Makefile
39+
ROOT = Path(__file__).resolve().parents[1]
40+
if str(ROOT) not in sys.path:
41+
sys.path.insert(0, str(ROOT))
42+
3843
from examples.geometric_cavendish import run_geometric_cavendish
3944

4045
# Output directory

0 commit comments

Comments
 (0)