Leakage-aware thermal-event forecasting, physics-guided modelling, inverse PINNs, and safety-gated adaptation for Wire Arc Additive Manufacturing.
This repository contains an end-to-end research pipeline for forecasting and reconstructing thermal behaviour in multi-layer WAAM using real four-channel thermocouple recordings from three independent steel-wall builds.
The project was designed around the realities of WAAM experimental data:
- logger restarts and uncertain recording gaps;
- sensor reconnection and channel-quality changes;
- unequal deposition strategies across builds;
- strong heat accumulation across layers;
- only three independent physical builds despite many sequential thermal cycles;
- the risk of temporal and build-level data leakage;
- the fact that a complex PINN may not outperform a simple causal baseline on a new build.
The final repository therefore does not present a single over-claimed neural model. It separates three different WAAM prediction tasks and evaluates each under an appropriate validation protocol.
| Build | Current | Voltage | Travel speed | Heat input | Deposition strategy | Approx. layers |
|---|---|---|---|---|---|---|
| W1 | 140 A | 24 V | 3.40 mm/s | 0.6 kJ/mm | Two overlapping opposite-direction passes per layer | 27 |
| W2 | 180 A | 23.5 V | 2.10 mm/s | 1.2 kJ/mm | One deposition pass; arc off during return | 26 |
| W3 | 220 A | 24 V | 1.7167 mm/s | 1.8 kJ/mm | One deposition pass; arc off during return | 24–25 |
Common conditions:
- ST37 substrate: 150 × 100 × 10 mm;
- wall deposited along the 150 mm longitudinal direction at the transverse centreline;
- nominal wall height: approximately 50 mm;
- nominal wall width: approximately 20 mm;
- shielding gas flow: 18 L/min;
- ambient temperature: approximately 30 °C;
- target interpass temperature: approximately 200 °C, with some restarts near 185 °C;
- cooling intervals increased from roughly 60 s in lower layers to as much as 900 s in upper layers.
All four thermocouple junctions were located at the longitudinal midpoint, x = 75 mm, and approximately at substrate mid-thickness, z = -5 mm when the substrate top surface is z = 0.
| Sensor | Coordinate (x, y, z) mm |
Role |
|---|---|---|
| D1 | (75, -20, -5) |
near, D side |
| D2 | (75, -40, -5) |
far, D side |
| U1 | (75, +20, -5) |
near, U side |
| U2 | (75, +40, -5) |
far, U side |
The D/U signs are a modelling convention. Physical left/right naming is not asserted.
- 76 accepted thermal cycles across the three successful builds;
- 71 event-to-next-event forecasting records after respecting sequence boundaries;
- 3 independent physical builds—the sequential rows are not treated as independent experiments;
- the first failed/collapsed 220 A attempt is retained only as auxiliary out-of-distribution provenance;
- two unusable logger files are retained under
data/auxiliary/rejected/and excluded from quantitative modelling; - no forecasting target crosses a logger restart or sensor-reconnection boundary;
- W3 uses time-varying sensor masks because channel quality changes between recording segments;
- one W3 event with a single formal derivative vote is explicitly audited and subjected to strict sensitivity analyses.
Full provenance is documented in docs/Data_Provenance.md.
| Stage | WAAM-focused purpose |
|---|---|
| Stage 1 | logger parsing, channel QC, smoothing, event detection, sequence protection |
| Stage 2 | strictly causal feature construction and leakage-aware ML baselines |
| Stage 3 | lumped thermal-memory models and physics-guided residual learning |
| Stage 4.0–4.1 | canonical WAAM geometry, APDL/FEM audit, PINN-readiness assessment |
| Stage 4.2 | within-build sensor-constrained inverse PINN on W2 |
| Stage 4.3 | strict leave-one-build-out conditional PINN transfer |
| Stage 4.4 | chronological few-shot adaptation using early layers of a new build |
| Stage 4.5 | uncertainty-gated PINN residual correction with mandatory causal fallback |
| Stage 4.6 | final evidence synthesis, uncertainty audit, model card, and claim lock |
The rows below correspond to different prediction tasks and should not be ranked against one another without considering the target and validation design.
| Task | Validation | Selected model | MAE | Interpretation |
|---|---|---|---|---|
| Next-event peak forecasting | Leave-one-build-out | PhysicsResidualRidgeCausal | 19.23 °C | Final primary deployable research model; 20.3% lower MAE than persistence |
| Next-event peak with known future dwell | Leave-one-build-out | PhysicsMemoryScheduleAware | 18.14 °C | Lower MAE, but requires the next schedule interval in advance |
| W2 held-out event-trace reconstruction | Complete events withheld | Sensor-Constrained PINN | 16.12 °C | 2.43% better than matched data-only network; spatial field remains unvalidated |
| New-build continuation after five early events | Chronological few-shot test | Uncertainty-Gated Hybrid | 25.62 °C | Small pooled improvement over 26.62 °C causal baseline; not statistically conclusive across three builds |
The strictly causal PhysicsResidualRidgeCausal model achieved:
- MAE: 19.23 °C
- RMSE: 26.24 °C
- bias: −1.89 °C
- R²: 0.736
- MAE improvement over persistence: 20.3%
It reduced MAE on each held-out build separately. W3 nevertheless retained a negative held-out R², so its result is reported as an MAE improvement rather than reliable trend reconstruction.
The within-build W2 inverse PINN slightly improved on a matched data-only network and recovered physically plausible effective parameters. However, strict cross-build testing exposed substantial distribution shift: the conditional PINN was worse than the causal sensor baseline on every completely unseen wall. Few-shot adaptation reduced the zero-shot PINN error but still did not beat the baseline consistently.
The final hybrid therefore preserves the causal prediction and permits only a bounded PINN residual correction when early-build out-of-fold evidence supports it. For W2 the gate closed completely and used alpha = 0.
This negative-to-safe-hybrid progression is a central result of the project, not a hidden failure.
git clone <YOUR_REPOSITORY_URL>
cd WAAM-Thermal-Forecasting
python -m venv .venvWindows PowerShell:
.venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
pip install -e .Linux/macOS:
source .venv/bin/activate
python -m pip install --upgrade pip
pip install -e .pytest -q
python scripts/validate_repository.pyExpected test result:
51 passed
python scripts/run_stage1.py
python scripts/run_stage2.py
python scripts/run_stage3.py
python scripts/run_final_validation.pyOr:
python scripts/run_pipeline.py --profile corepython scripts/run_stage4_2.py
python scripts/run_stage4_3.py
python scripts/run_stage4_4.py
python scripts/run_stage4_5.py
python scripts/run_stage4_6.pyA full retraining run is substantially slower than the core causal pipeline. Precomputed audited outputs are included for inspection and test reproducibility.
See docs/REPRODUCIBILITY.md for stage dependencies, expected outputs, and practical runtime guidance.
WAAM-Thermal-Forecasting/
├── assets/ # GitHub banner, geometry, workflow and key figures
├── configs/ # audited experimental and model configurations
├── data/
│ ├── raw/ # successful WAAM logger segments
│ └── auxiliary/ # failed/rejected recordings, excluded from main fitting
├── docs/ # experimental setup, data dictionary, methods, results and limits
├── references/ # legacy APDL/FEM provenance and build photographs
├── results/ # locked stage outputs and manuscript-ready evidence
├── scripts/ # stage runners and repository validation
├── src/waam_thermal/ # reusable implementation
└── tests/ # 51 automated scientific and software checks
This repository supports the following claim:
An audited proof-of-concept for causal next-event thermal-peak forecasting in multi-layer WAAM, complemented by within-build sensor-constrained PINN reconstruction and a safety-gated early-build residual hybrid.
It does not claim:
- industrial deployment readiness;
- validated full 2D or 3D temperature fields away from the four thermocouples;
- sensor-free operation;
- generalisation beyond the three independent successful builds;
- statistically conclusive superiority of the hybrid over the causal fallback;
- uniquely identified heat-source or boundary-condition parameters.
Detailed limitations are in docs/LIMITATIONS.md and the final model card in docs/MODEL_CARD.md.
Citation metadata are provided in CITATION.cff. GitHub will expose a Cite this repository button after publication.
Suggested citation:
Mori, A. (2026). WAAM Thermal Forecasting: Leakage-Aware Causal Modelling, Sensor-Constrained PINNs, and Safety-Gated Adaptation (Version 1.5.0) [Computer software and research dataset].
- Source code: MIT License
- Experimental data, figures and photographs: CC BY-NC 4.0
Before public release, confirm that the experimental data and photographs may be redistributed under the selected data licence.
Ali Mori — WAAM experiments, welding metallurgy interpretation, thermal-data audit, modelling, validation, and project documentation.
The repository is intentionally transparent about limited independent sample size, measurement heterogeneity and negative model-transfer results. Its value lies in reproducible WAAM data engineering, leakage-aware validation, physics-guided modelling, and explicit separation between promising research behaviour and deployment-ready evidence.

