{"id":50415147,"url":"https://github.com/felipearocha/integrity-code-series-week-10_nnph_scc","last_synced_at":"2026-05-31T05:30:17.816Z","repository":{"id":357521312,"uuid":"1237314872","full_name":"felipearocha/integrity-code-series-week-10_nnph_scc","owner":"felipearocha","description":"Full-physics NNpHSCC simulation for gas transmission pipelines — Chen-Sutherby-Xing, BS 7910, API 579/581, Bayesian RBI.","archived":false,"fork":false,"pushed_at":"2026-05-20T23:39:27.000Z","size":3548,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-21T05:52:28.894Z","etag":null,"topics":["api-571","api-579","api-581","bayesian-inference","bs-7910","cathodic-protection","fracture-mechanics","hydrogen-embrittlement","monte-carlo","nnphscc","pipeline-integrity","python","risk-based-inspection","stress-corrosion-cracking"],"latest_commit_sha":null,"homepage":"https://github.com/felipearocha/integrity-code-series-week-10_nnph_scc","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/felipearocha.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-13T04:24:07.000Z","updated_at":"2026-05-20T23:39:30.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/felipearocha/integrity-code-series-week-10_nnph_scc","commit_stats":null,"previous_names":["felipearocha/integrity-code-series-week-10_nnph_scc"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/felipearocha/integrity-code-series-week-10_nnph_scc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felipearocha%2Fintegrity-code-series-week-10_nnph_scc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felipearocha%2Fintegrity-code-series-week-10_nnph_scc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felipearocha%2Fintegrity-code-series-week-10_nnph_scc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felipearocha%2Fintegrity-code-series-week-10_nnph_scc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/felipearocha","download_url":"https://codeload.github.com/felipearocha/integrity-code-series-week-10_nnph_scc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felipearocha%2Fintegrity-code-series-week-10_nnph_scc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33720897,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-31T02:00:06.040Z","response_time":95,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-571","api-579","api-581","bayesian-inference","bs-7910","cathodic-protection","fracture-mechanics","hydrogen-embrittlement","monte-carlo","nnphscc","pipeline-integrity","python","risk-based-inspection","stress-corrosion-cracking"],"created_at":"2026-05-31T05:30:17.203Z","updated_at":"2026-05-31T05:30:17.809Z","avatar_url":"https://github.com/felipearocha.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Integrity Code Series — Week 10 — NNpHSCC Full-Physics Simulation\n\n[![CI](https://github.com/felipearocha/integrity-code-series-week-10_nnph_scc/actions/workflows/ci.yml/badge.svg)](https://github.com/felipearocha/integrity-code-series-week-10_nnph_scc/actions/workflows/ci.yml)\n[![Release](https://github.com/felipearocha/integrity-code-series-week-10_nnph_scc/actions/workflows/release.yml/badge.svg)](https://github.com/felipearocha/integrity-code-series-week-10_nnph_scc/actions/workflows/release.yml)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)\n[![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://www.python.org/downloads/)\n[![Tests](https://img.shields.io/badge/tests-194%20passed-brightgreen.svg)](#validation)\n[![Code style: ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.20172241.svg)](https://doi.org/10.5281/zenodo.20172241)\n\n**Author:** Felipe Rocha — Independent Researcher\n\n## Integrity Code Series\n\nPart of an ongoing series of physics-first integrity simulators by Felipe Rocha:\n\n| # | Repo | Domain |\n|---|---|---|\n| Week 3 | [Integrity-code-series-3](https://github.com/felipearocha/Integrity-code-series-3) | F1 lap simulation (six coupled ODEs) |\n| Week 6 | [Integrity-code-series-week6-smartphone-galvanic](https://github.com/felipearocha/Integrity-code-series-week6-smartphone-galvanic) | Smartphone galvanic corrosion (Laplace + Butler-Volmer) |\n| 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) |\n| 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) |\n| Week 9 | [integrity-code-series-week9-cui](https://github.com/felipearocha/integrity-code-series-week9-cui) | CUI thermohygro-electrochemical (3 PDEs, Strang) |\n| 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) |\n| 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) |\n| Bonus | [synthetic-integrity-digital-twin-piml](https://github.com/felipearocha/synthetic-integrity-digital-twin-piml) | Physics-informed neural-network surrogate |\n| Bonus | [integrity-data-foundation](https://github.com/felipearocha/integrity-data-foundation) | Engineering data validation baseline |\n\n## Quick Start\n\n```bash\n# Clone and install\ngit clone https://github.com/felipearocha/integrity-code-series-week-10_nnph_scc.git\ncd integrity-code-series-week-10_nnph_scc\npip install -e .[dev]\n\n# Validate\npytest tests/ -q                          # 194 tests\npython -m validation.benchmarks           # textbook constants\n\n# Reproduce all panels + audit-chained outputs\npython run_all.py\n```\n\nBrowse `equations.html` in any modern browser for the full LaTeX equations reference.\n\n## Problem Statement\n\nNear-Neutral pH Stress Corrosion Cracking (NNpHSCC) accounts for a major fraction of\nreportable incidents on gas transmission pipelines in North America. Two specific incidents\nmotivate this package:\n\n- **2018 Prince George, BC rupture** — 914mm gas pipeline; NNpHSCC cause; downstream of compressor\n- **2015 Unityville, PA rupture** — 609mm gas pipeline; NNpHSCC; [SOURCE: Sun et al. 2021 JIPR]\n\nPHMSA §192.611(a)(4) (effective March 16, 2026) requires integrity assessment for class location\nchanges. This package provides the physics foundation for that assessment.\n\n**Key finding from v2:** Even the best available NNpHSCC crack growth model has COV = 61.2% on\nvalidated full-scale test data. This package explicitly incorporates that model structural\nuncertainty as a sampled variable — not a footnote.\n\n---\n\n## Governing Equations\n\n### PDE 1 — Laplace (soil electrochemistry)\n∇·(σ_soil·∇φ) = 0 in soil; Butler-Volmer BC at coating holiday\n\n### PDE 2 — Oriani-Fick (H diffusion in steel wall)\n∂C_L/∂t = D_eff·∂²C_L/∂r²;  D_eff = D_H(T)/(1+K_trap_eff)\n\n### PDE 3 — Chen-Sutherby-Xing crack growth (most accurate available model)\n**[SOURCE: Chen \u0026 Sutherby 2007; Xing et al. via Sun et al. 2021]**\n\n    da/dN = A_CF × (K_max × ΔK² × f_eff^(-0.1))^n × HE_factor\n\n    HE_factor = (C_H_bulk / C_H_ref)^n_HE        Xing HEDE multiplier\n    f_eff = max(f, f_crit = 10^-3 Hz)            frequency saturation\n    n = 2.0   [SOURCE: Chen \u0026 Sutherby 2007]\n    n_HE = 0.88 [SOURCE: Sun et al. 2021, Xing model]\n\n### Variable Amplitude Loading (Type I underload)\n**[SOURCE: Chen 2007 — \"10x enhancement under underload VA loading\"]**\n\n    da/dt = f_major × da/dN_major + f_minor × da/dN_minor × F_INT\n\n    F_INT = 10  [SOURCE: Chen 2007 — underload-minor interaction factor]\n\n### Crack Dormancy Criterion (Stage I → Stage II)\n**[SOURCE: Zhao et al. 2017 — \u003e95% cracks remain dormant below 1mm]**\n\n    Dormant if: ΔK \u003c ΔK_th_Stage2 = 2.2 MPa√m  OR  C_H \u003c C_H_crit\n\n### 3D Semi-Elliptical Crack (two coupled EDOs)\n**[SOURCE: Newman \u0026 Raju 1981]**\n\n    da/dt = v(K_A, ΔK_A)    (deepest point)\n    dc/dt = v(K_C, ΔK_C)    (surface point)\n\n### Crack Tip Acidification\n**[SOURCE: Turnbull 1993]**\n\n    pH_tip = pH_bulk − 0.6×log10(c/a) − 0.3×v_diss + buffering_correction\n    C_H_corrected = C_H_0 × 10^(0.3 × Δ_pH)\n\n### Residual Stress SIF\n**[SOURCE: BS 7910:2019 Annex Q]**\n\n    K_I_res = sqrt(π·a) × (σ_res_m × Y_m + σ_res_b × Y_b)\n\n### ILI POD (Weibull)\n**[SOURCE: PHMSA TVC; general EMAT performance]**\n\n    POD(a) = 1 − exp(−(a/a_90)^k)    a_90 = 4mm, k = 2 [ASSUMED]\n\n### Model Structural Uncertainty\n**[SOURCE: Sun, Zhou \u0026 Kang 2021 JIPR — 39 full-scale CanmetMATERIALS tests]**\n\n    da/dt_real = da/dt_model × ε_model\n    ε_model ~ LogNormal(mean=1.06, COV=61.2%)\n\n### BS 7910 Coalescence Rule\n**[SOURCE: BS 7910:2019 Clause 7.3]**\n\n    Merge if: gap between cracks s \u003c min(a_i, a_j)\n\n### Bayesian Posterior Update (particle filter)\n**[SOURCE: Straub 2004 — inspection-based reliability]**\n\n    p(θ | a_obs) ∝ p(a_obs | θ) × p(θ)\n\n---\n\n## Repository Structure\n\n```\nintegrity_code_series_week10v3_nnph_scc_fullphysics/\n├── run_all.py\n├── requirements.txt\n├── README.md\n├── conftest.py\n├── src/\n│   ├── constants.py              All parameters with [SOURCE] tags\n│   ├── hydrogen_diffusion.py     Oriani-Fick PDE + C_H_surface_from_potential\n│   ├── pressure_spectrum.py      Chen-Sutherby-Xing + VA loading\n│   ├── microstructure.py         HAZ vs base metal zones (incl. vintage ERW)\n│   ├── crack_growth_v2.py        3D shape + residual stress + dormancy\n│   ├── crack_tip_chemistry.py    Turnbull acidification\n│   ├── model_uncertainty.py      Sun 2021 COV=61.2% epistemic error\n│   ├── pod_ilicurve.py           ILI POD + post-inspection a0\n│   ├── crack_colony_v2.py        Full-physics colony + BS 7910 coalescence\n│   ├── bayesian_update.py        Particle filter posterior\n│   ├── fad_assessment.py         API 579-1 Level 2 FAD\n│   ├── monte_carlo_v2.py         8-param MC with all gaps closed\n│   ├── surrogate_gbr.py          GBR surrogate (8 features)\n│   ├── audit_chain.py            SHA-256 hash-linked audit log\n│   ├── cp_optimization.py        Non-monotonic CP curve (v3)\n│   ├── h2_blending.py            H2 blend K_IH degradation (v3)\n│   └── inspection_optimizer.py   RBI re-inspection interval (v3)\n├── validation/benchmarks.py      Analytical benchmarks\n├── visualization/\n│   ├── plot_all_v2.py            8 v2 panels + colony GIF generator\n│   └── plot_new_v3.py            3 v3 panels (CP, H2, inspection optimizer)\n├── tests/test_week10v2.py        194 tests\n├── assets/figures/               11 panels (300 DPI)\n├── assets/animations/            Crack colony GIF\n├── assets/audit_chain.json\n└── linkedin/                     Post drafts (not in GitHub)\n```\n\n---\n\n## New Mechanisms vs v1\n\n| Mechanism | v1 | v2 | Source |\n|-----------|----|----|--------|\n| Crack growth model | Paris law | Chen-Sutherby-Xing combined parameter | Chen \u0026 Sutherby 2007 |\n| Frequency dependence | Linear f | Saturation at f_crit = 10^-3 Hz | Xing et al. |\n| VA loading | Constant amplitude | Type I underload with F_INT=10 | Chen 2007 |\n| Crack dormancy | None | Stage I/II criterion, 95% dormant | Zhao et al. 2017 |\n| Microstructure | Uniform | HAZ vs base, K_IH and da/dt different | Beavers et al. 2001 |\n| ILI POD | LogNormal a0 | Post-inspection Weibull rejection sampling | PHMSA TVC |\n| Model error | None | LogNormal(1.06, COV=61.2%) per crack | Sun et al. 2021 |\n| Crack tip chemistry | None | Turnbull acidification, pH_tip(c/a) | Turnbull 1993 |\n| Residual stress | None | BS 7910 Annex Q K_I_res at HAZ | BS 7910:2019 |\n| Bayesian update | None | Particle filter posterior from re-ILI | Straub 2004 |\n| 3D crack shape | 1D (a only) | 2D (a, c coupled EDOs) | Newman-Raju 1981 |\n| Coalescence | Independent cracks | BS 7910:2019 Cl.7.3 merging rule | BS 7910:2019 |\n\n---\n\n## Key [ASSUMED] Parameters\n\n| Parameter | Value | Basis |\n|-----------|-------|-------|\n| A_CF_BASE | 2.4×10^-14 | Calibrated to CEPA field: 0.3 mm/yr at a=2mm |\n| K_IH base | 25 MPa√m | CEPA RP 3rd Ed. range 15–35 |\n| K_IH HAZ | 17.5 MPa√m | 70% of base [ASSUMED] |\n| F_INT | 10 | Chen 2007 underload interaction |\n| f_crit | 10^-3 Hz | Xing et al. frequency saturation |\n| a_90 (POD) | 4 mm | Modern EMAT [ASSUMED] |\n| C_H_bulk X65 | 0.02 mol/m³ | Sun et al. 2021 range calibrated |\n\n---\n\n## Escalation Table\n\n| Week | Topic | Key escalation |\n|------|-------|---------------|\n| 8 | CO2 pipeline | Supercritical EOS |\n| 9 | CUI | 3-PDEs, Strang splitting |\n| 10 v1 | NNpHSCC | 4-PDEs, crack colony |\n| **10 v2** | **NNpHSCC full-physics** | **+12 mechanisms, Chen-Sutherby-Xing, COV=61.2% epistemic** |\n\n---\n\n## Cybersecurity (STRIDE)\nSHA-256 hash-chain audit for all runs. Sensor integrity checks. GBR surrogate OOD fallback.\n\n---\n\n## How to Cite\n\nIf this software contributes to your work, please cite both the software (this repository) and the underlying methods it implements.\n\n**Software (archived release):**\n\n\u003e Rocha, F. (2026). *Integrity Code Series — Week 10 — NNpHSCC Full-Physics Simulation* (Version 1.0.1) [Computer software]. Zenodo. https://doi.org/10.5281/zenodo.20172241\n\n**BibTeX:**\n\n```bibtex\n@software{rocha_2026_nnphscc_fullphysics,\n  author       = {Rocha, Felipe},\n  title        = {{Integrity Code Series --- Week 10 --- NNpHSCC\n                   Full-Physics Simulation}},\n  year         = 2026,\n  publisher    = {Zenodo},\n  version      = {v1.0.1},\n  doi          = {10.5281/zenodo.20172241},\n  url          = {https://doi.org/10.5281/zenodo.20172241}\n}\n```\n\nThe two DOIs Zenodo provides are:\n\n| DOI                                | What it points to                                                  |\n|------------------------------------|--------------------------------------------------------------------|\n| [`10.5281/zenodo.20172241`](https://doi.org/10.5281/zenodo.20172241) (concept) | Always resolves to the latest version — use this for citation in papers, CV, talks. |\n| [`10.5281/zenodo.20172242`](https://doi.org/10.5281/zenodo.20172242) (version) | Pinned to v1.0.1 specifically — use when reproducibility matters. |\n\nA machine-readable citation file is also available in [`CITATION.cff`](CITATION.cff) — GitHub will display a \"Cite this repository\" widget at the top right of the repo page that exports BibTeX / APA / RIS automatically.\n\n---\n\nResearch tool only. Not for FFS decisions without site-specific calibration and independent review.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffelipearocha%2Fintegrity-code-series-week-10_nnph_scc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffelipearocha%2Fintegrity-code-series-week-10_nnph_scc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffelipearocha%2Fintegrity-code-series-week-10_nnph_scc/lists"}