diff --git a/README.md b/README.md index c385b31..a65a4bc 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ # ICS2 Week 9 — CUI Coupled Thermohygro-Electrochemical Simulation -[](https://doi.org/10.5281/zenodo.20172508) - [](https://github.com/felipearocha/integrity-code-series-week9-cui/actions/workflows/ci.yml) -[](https://www.python.org/) -[](#testing) -[](LICENSE) +[](LICENSE) +[](https://www.python.org/downloads/) +[](tests) +[](https://github.com/astral-sh/ruff) +[](https://doi.org/10.5281/zenodo.20172508) Three-way coupled physics-first simulator for **Corrosion Under Insulation (CUI)** on insulated carbon-steel process piping. Simulates moisture ingress through a @@ -21,11 +21,12 @@ Part of an ongoing series of physics-first integrity simulators by Felipe Rocha: | # | Repo | Domain | |---|---|---| | Week 3 | [Integrity-code-series-3](https://github.com/felipearocha/Integrity-code-series-3) | F1 lap simulation (six coupled ODEs) | -| Week 6 | [Integrity-code-series-week6-smartphone-galvanic](https://github.com/felipearocha/Integrity-code-series-week6-smartphone-galvanic) | Smartphone galvanic corrosion (Laplace + Butler-Volmer) | +| Week 6 | [integrity-code-series-week6-smartphone-galvanic](https://github.com/felipearocha/Integrity-code-series-week6-smartphone-galvanic) | Smartphone galvanic corrosion (Laplace + Butler-Volmer) | | Week 7 | [integrity_code_series_week7_h2_lferw](https://github.com/felipearocha/integrity_code_series_week7_h2_lferw) | LF-ERW H2 conversion (B31.12 + NACE TM0316) | | Week 8 | [integrity-code-series-week8-creep-fatigue-heater](https://github.com/felipearocha/integrity-code-series-week8-creep-fatigue-heater) | Creep-fatigue 9Cr-1Mo (Norton/Omega + Coffin-Manson) | -| Week 9 | [integrity-code-series-week9-cui](https://github.com/felipearocha/integrity-code-series-week9-cui) | CUI thermohygro-electrochemical (3 PDEs, Strang) | +| **Week 9** | **[integrity-code-series-week9-cui](https://github.com/felipearocha/integrity-code-series-week9-cui)** | **CUI thermohygro-electrochemical (3 PDEs, Strang) — this repo** | | Week 10 | [integrity-code-series-week-10_nnph_scc](https://github.com/felipearocha/integrity-code-series-week-10_nnph_scc) | NNpHSCC full-physics (Chen-Sutherby-Xing + BS 7910) | +| Week 11 | [integrity-code-series-week11-erosion-corrosion-multiphase](https://github.com/felipearocha/integrity-code-series-week11-erosion-corrosion-multiphase) | Erosion-corrosion multiphase (NORSOK M-506 + DNV-RP-O501 + G119 + API 579) | | Bonus | [Vibration-Accelerated-Corrosion-Coupled-Mechano-Electrochemical-Simulation](https://github.com/felipearocha/Vibration-Accelerated-Corrosion-Coupled-Mechano-Electrochemical-Simulation) | Vibration-accelerated corrosion (SDOF + Butler-Volmer + Archard) | | Bonus | [synthetic-integrity-digital-twin-piml](https://github.com/felipearocha/synthetic-integrity-digital-twin-piml) | Physics-informed neural-network surrogate | | Bonus | [integrity-data-foundation](https://github.com/felipearocha/integrity-data-foundation) | Engineering data validation baseline | @@ -38,7 +39,7 @@ cd REPO python -m venv .venv && source .venv/bin/activate # Windows: .venv\Scripts\activate pip install -r requirements.txt python run_all.py # ~70 s on a laptop; produces 7 figures + 1 GIF + audit_chain.json -pytest tests/ -v # 151 tests +pytest tests/ -v # 154 tests python validation/benchmarks.py # 5 analytical benchmarks ``` @@ -60,6 +61,8 @@ locations from outer cladding temperature measurements. ## Governing Equations +Full rendered (MathJax) reference: **[docs/equations.html](docs/equations.html)** — open in any browser. + ### Field 1 — Fourier Heat Conduction (Eq. 1) ``` @@ -167,6 +170,8 @@ integrity_code_series_week9_cui_thermohygro/ │ ├── surrogate_gbr.py GBR surrogate, parity metrics │ ├── fad_assessment.py API 579-1 Level 2 FAD │ └── audit_chain.py SHA-256 hash-linked run log +├── docs/ +│ └── equations.html Rendered (MathJax) governing-equations reference ├── validation/ │ └── benchmarks.py ├── visualization/ @@ -177,6 +182,7 @@ integrity_code_series_week9_cui_thermohygro/ ├── tests/ │ ├── test_geometry_thermal.py │ ├── test_moisture_electrochemistry.py +│ ├── test_extended.py │ └── test_remaining.py ├── assets/figures/ 8 static PNG panels (300 DPI) ├── assets/animations/ cui_moisture_front.gif @@ -214,7 +220,7 @@ integrity_code_series_week9_cui_thermohygro/ --- -## Cybersecurity Summary +## Cybersecurity (STRIDE) STRIDE threat model applied to DFOS sensor network feeding inverse solver: @@ -230,12 +236,41 @@ STRIDE threat model applied to DFOS sensor network feeding inverse solver: --- +## Anti-Hallucination Note + +Every physical parameter carries an explicit provenance tag. Constants read directly from +a standard or the literature are stated as such; parameters anchored to literature but not +calibrated to a specific site are flagged `[ASSUMED]` in `src/constants.py` and collected +in the **[ASSUMED] Parameter Flags** table above. In the Integrity Code Series tiering this +maps to: + +- **T1 [SOURCE]** — values fixed by physics or a cited standard (the API 579-1 Level 2 + Option B FAD curve, Faraday's law, the API RP 583 50-175 C CUI window). +- **T2 [SOURCE]** — quantities derived from T1 inputs (effective insulation properties, the + golden-section Tikhonov recovery restricted to `S ∈ [0, S_ref]`). +- **T3 [ASSUMED]** — practitioner / literature estimates that are not site-calibrated: the + mineral-wool moisture diffusivity `D_theta0` and slope `beta_theta`, the electrolyte + threshold `theta_crit`, the Fe-dissolution `i0_ref` / `E_a` / mixed overpotential, and the + `D_T` coupling form. + +No equation, constant, or citation in this repository or in `docs/equations.html` is +introduced beyond what the model actually implements. + +--- + +## Disclaimer + +Research tool only. Not for design, fitness-for-service, or safety-critical decisions without site-specific calibration and independent PE review. + +Additionally: API RP 583, API 579-1, and PHMSA regulations take precedence over model +output, and `[ASSUMED]` parameters must be validated against site-specific inspection data +before any operational use. + +--- + ## License -Research and educational use only. Not for operational fitness-for-service decisions -without independent engineering review and site-specific validation. -API RP 583, API 579-1, PHMSA regulations take precedence over model output. -[ASSUMED] parameters must be validated against site-specific inspection data. +MIT — Felipe Rocha. See [LICENSE](LICENSE). --- diff --git a/docs/equations.html b/docs/equations.html new file mode 100644 index 0000000..b463626 --- /dev/null +++ b/docs/equations.html @@ -0,0 +1,306 @@ + + +
+ +CUI Coupled Thermohygro-Electrochemical Simulation — Governing Equations Reference
+Felipe Rocha
+[ASSUMED] are anchored to literature, not site-calibrated (see
+src/constants.py and the [ASSUMED] Parameter Flags
+table in the README). No equation, constant, or citation has been added beyond what the
+repository already states.
+SOURCE: Fourier heat conduction; CUI critical window 50–175 °C per API RP 583 (process temperature 120 °C, see src/constants.py → T_PROCESS).
+Code: src/thermal_field.py → build_thermal_system, thermal_step, lambda_eff, rho_cp_eff.
+(1a) inner-wall Dirichlet · (1b) Robin convective + radiative outer cladding · (1c) adiabatic axial ends. Cladding emissivity $\varepsilon$ [ASSUMED], $h_{\text{conv}}$ [ASSUMED].
Code: src/thermal_field.py → build_thermal_system.
+SOURCE: Philip-de Vries hygrothermal moisture transport (name as used in the repository).
+Code: src/moisture_field.py → moisture_step.
+SOURCE: $D_{\theta 0}$, $\beta_\theta$, and the $D_T$ coupling form are [ASSUMED] (mineral-wool / simplified Philip-de Vries literature, see src/constants.py).
Code: src/moisture_field.py → D_theta, D_T_coeff, apply_holiday_bc.
+[ASSUMED], API RP 583 qualitative guidance). Transfer coefficients $\alpha_a, \alpha_c$, exchange current density $i_{0,\text{ref}}$, activation energy $E_a$, and mixed overpotential $\eta$ are all [ASSUMED].SOURCE: Butler-Volmer kinetics with Arrhenius exchange-current density; constants [ASSUMED] per src/constants.py.
Code: src/electrochemistry.py → i_corr, i0.
+SOURCE: Faraday's law of electrolysis; $M_{\text{Fe}}$, $n$, $F$, $\rho_{\text{steel}}$ from src/constants.py.
+Code: src/electrochemistry.py → wall_loss_rate, faraday_step.
+Second-order symmetric splitting of the electrochemistry (EC), hygrothermal (HY), and thermal (TH) sub-operators.
+SOURCE: Strang symmetric operator splitting.
+Code: src/coupled_solver.py → run_coupled.
+SOURCE: Tikhonov-regularised least-squares inverse.
+Code: src/inverse_problem.py → solve_inverse, misfit.
+Uncertainty propagation over the six-parameter vector $\xi$ by Latin-hypercube sampling; failure is wall loss exceeding 20% of nominal wall thickness.
+SOURCE: Latin-hypercube Monte Carlo; failure fraction $0.20$ from src/constants.py → MAX_WL_FRAC.
+Code: src/monte_carlo.py → run_monte_carlo, latin_hypercube_sample, spearman_sensitivity.
+Level 2 Option B FAD curve with cut-off $L_{r,\max}$; UTS and SMYS for X52 from src/constants.py ($K_{\text{mat}} = 70\ \text{MPa}\sqrt{\text{m}}$ [ASSUMED]).
SOURCE: API 579-1/ASME FFS-1 Level 2 Option B FAD.
+Code: src/fad_assessment.py → fad_curve, Lr_max_value, assessment_point.
+[ASSUMED]. API RP 583, API 579-1, and PHMSA regulations take precedence over model output. Outputs are SHA-256 hash-chained; verify with the audit chain in src/audit_chain.py.
+