Skip to content

Commit d602d93

Browse files
add numerical validation evidence
1 parent 2133045 commit d602d93

3 files changed

Lines changed: 197 additions & 0 deletions

File tree

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
name: Numerical Validation Evidence
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
duration_s:
7+
description: Simulation duration in seconds
8+
required: false
9+
default: "10.0"
10+
type: string
11+
dt_values:
12+
description: Comma-separated dt sweep
13+
required: false
14+
default: "0.4,0.2,0.1,0.05,0.025"
15+
type: string
16+
enforce_order:
17+
description: Enforce convergence thresholds
18+
required: false
19+
default: true
20+
type: boolean
21+
schedule:
22+
- cron: "30 7 * * 1"
23+
24+
env:
25+
VCPKG_COMMIT: "66c0373dc7fca549e5803087b9487edfe3aca0a1"
26+
27+
jobs:
28+
windows-validation:
29+
name: Windows numerical validation evidence
30+
runs-on: windows-2022
31+
timeout-minutes: 45
32+
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@v4
36+
37+
- name: Setup vcpkg
38+
uses: lukka/run-vcpkg@v11
39+
with:
40+
vcpkgGitCommitId: ${{ env.VCPKG_COMMIT }}
41+
doNotCache: false
42+
43+
- name: Setup Python
44+
uses: actions/setup-python@v5
45+
with:
46+
python-version: "3.12"
47+
48+
- name: Resolve validation options
49+
id: opts
50+
shell: pwsh
51+
run: |
52+
$duration = "10.0"
53+
$dtValues = "0.4,0.2,0.1,0.05,0.025"
54+
$enforce = "true"
55+
56+
if ("${{ github.event_name }}" -eq "workflow_dispatch") {
57+
if ("${{ github.event.inputs.duration_s }}" -ne "") {
58+
$duration = "${{ github.event.inputs.duration_s }}"
59+
}
60+
if ("${{ github.event.inputs.dt_values }}" -ne "") {
61+
$dtValues = "${{ github.event.inputs.dt_values }}"
62+
}
63+
if ("${{ github.event.inputs.enforce_order }}" -eq "false") {
64+
$enforce = "false"
65+
}
66+
}
67+
68+
$validationDir = "artifacts/validation/${{ github.run_id }}_${{ github.run_attempt }}_ci-windows-release"
69+
70+
"duration=$duration" >> $env:GITHUB_OUTPUT
71+
"dt_values=$dtValues" >> $env:GITHUB_OUTPUT
72+
"enforce=$enforce" >> $env:GITHUB_OUTPUT
73+
"validation_dir=$validationDir" >> $env:GITHUB_OUTPUT
74+
75+
- name: Run numerical validation
76+
shell: pwsh
77+
run: |
78+
$args = @(
79+
"scripts/run_numerical_validation.py",
80+
"--preset", "ci-windows-release",
81+
"--config", "Release",
82+
"--output-dir", "${{ steps.opts.outputs.validation_dir }}",
83+
"--duration-s", "${{ steps.opts.outputs.duration }}",
84+
"--dt-values", "${{ steps.opts.outputs.dt_values }}"
85+
)
86+
87+
if ("${{ steps.opts.outputs.enforce }}" -eq "true") {
88+
$args += "--enforce-order"
89+
}
90+
91+
python @args
92+
93+
- name: Upload validation artifacts
94+
uses: actions/upload-artifact@v4
95+
with:
96+
name: numerical-validation-evidence-windows-${{ github.run_id }}-${{ github.run_attempt }}
97+
path: ${{ steps.opts.outputs.validation_dir }}
98+
if-no-files-found: error

docs/numerical-methods.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
This document defines the numerical integration policy for FluxGraph models.
66
It complements `docs/semantics_spec.md` and is authoritative for solver
77
selection and stability interpretation.
8+
Validation protocol details are documented in `docs/validation-methodology.md`.
89

910
## Current Policy (Phase 3.1 baseline)
1011

@@ -69,3 +70,7 @@ Windows example:
6970
```powershell
7071
python .\scripts\run_numerical_validation.py --preset dev-windows-release --config Release --enforce-order
7172
```
73+
74+
CI evidence runs are produced by:
75+
76+
1. `.github/workflows/numerical-validation-evidence.yml`

docs/validation-methodology.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# Numerical Validation Methodology
2+
3+
## Purpose
4+
5+
This document defines the validation protocol used to support Phase 3
6+
numerical claims for FluxGraph model integration behavior.
7+
8+
## Systems Under Test
9+
10+
Current validation scope targets `thermal_mass` with two canonical scenarios:
11+
12+
1. `thermal.cooling.v1`
13+
2. `thermal.forced_response.v1`
14+
15+
Each scenario is evaluated with:
16+
17+
1. `forward_euler`
18+
2. `rk4`
19+
20+
## Reference Solution
21+
22+
Validation uses the analytical solution of the first-order linear thermal model:
23+
24+
`dT/dt = (P - h*(T - T_amb)) / C`
25+
26+
Closed-form references are used for both cooling and forced-response settings.
27+
28+
## Error Metrics
29+
30+
For each `(scenario, method, dt)` run:
31+
32+
1. `L2` error over the sampled trajectory
33+
2. `Linf` error over the sampled trajectory
34+
3. Final-time absolute error
35+
36+
## Convergence Estimation
37+
38+
Observed order is estimated by linear regression on log-log scale:
39+
40+
`log(error) = p * log(dt) + b`
41+
42+
`p` is reported as:
43+
44+
1. `observed_order_l2`
45+
2. `observed_order_linf`
46+
47+
## Evidence Thresholds
48+
49+
Current CI-enforced minima (`Linf`):
50+
51+
1. `forward_euler >= 0.9`
52+
2. `rk4 >= 3.5`
53+
54+
These thresholds are conservative guards. They are not intended as publication
55+
claims by themselves; publication claims should cite full artifact sets.
56+
57+
## Reproducibility
58+
59+
Local run:
60+
61+
```bash
62+
python scripts/run_numerical_validation.py --preset dev-release --enforce-order
63+
```
64+
65+
Windows run:
66+
67+
```powershell
68+
python .\scripts\run_numerical_validation.py --preset dev-windows-release --config Release --enforce-order
69+
```
70+
71+
CI run:
72+
73+
1. GitHub Actions workflow: `.github/workflows/numerical-validation-evidence.yml`
74+
2. Output artifact directory: `artifacts/validation/<timestamp_or_runid>_*`
75+
76+
Each evidence run includes:
77+
78+
1. `validation_results.json`
79+
2. `validation_results.csv`
80+
3. `validation_evaluation.json`
81+
4. stdout/stderr and build/configure logs
82+
83+
## Threats to Validity
84+
85+
1. Current suite validates only one model family (`thermal_mass`).
86+
2. Convergence is measured on fixed `dt` sweeps and selected parameter regimes.
87+
3. Floating-point behavior may vary slightly across compilers/architectures.
88+
4. Threshold-based pass/fail does not replace full statistical or multi-platform analysis.
89+
90+
## Next Extensions
91+
92+
1. Add validation scenarios for additional models as they are introduced.
93+
2. Extend to transform stochastic validation (e.g., noise distribution checks).
94+
3. Add publication-grade plotting/notebook pipeline over stored CSV results.

0 commit comments

Comments
 (0)