{"id":50415157,"url":"https://github.com/felipearocha/integrity_code_series_week7_h2_lferw","last_synced_at":"2026-05-31T05:30:20.955Z","repository":{"id":357521105,"uuid":"1197689246","full_name":"felipearocha/integrity_code_series_week7_h2_lferw","owner":"felipearocha","description":"Hydrogen-conversion analysis of vintage LF-ERW pipeline. B31.12 MAOP cascade, NACE TM0316 SSC, statistical seam-weld susceptibility, X42-X70.","archived":false,"fork":false,"pushed_at":"2026-05-13T05:04:15.000Z","size":2371,"stargazers_count":0,"open_issues_count":7,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-13T06:39:20.887Z","etag":null,"topics":["api-579","asset-integrity","b31-12","fatigue-crack-growth","fracture-mechanics","hydrogen-blending","hydrogen-embrittlement","lferw","monte-carlo","pipeline-integrity","python","x65"],"latest_commit_sha":null,"homepage":null,"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":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"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-03-31T19:48:49.000Z","updated_at":"2026-05-13T04:57:45.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/felipearocha/integrity_code_series_week7_h2_lferw","commit_stats":null,"previous_names":["felipearocha/integrity_code_series_week7_h2_lferw"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/felipearocha/integrity_code_series_week7_h2_lferw","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felipearocha%2Fintegrity_code_series_week7_h2_lferw","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felipearocha%2Fintegrity_code_series_week7_h2_lferw/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felipearocha%2Fintegrity_code_series_week7_h2_lferw/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felipearocha%2Fintegrity_code_series_week7_h2_lferw/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/felipearocha","download_url":"https://codeload.github.com/felipearocha/integrity_code_series_week7_h2_lferw/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felipearocha%2Fintegrity_code_series_week7_h2_lferw/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-579","asset-integrity","b31-12","fatigue-crack-growth","fracture-mechanics","hydrogen-blending","hydrogen-embrittlement","lferw","monte-carlo","pipeline-integrity","python","x65"],"created_at":"2026-05-31T05:30:19.836Z","updated_at":"2026-05-31T05:30:20.941Z","avatar_url":"https://github.com/felipearocha.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# INTEGRITY CODE SERIES -- Week 7\n## Hydrogen Conversion of Aging LF-ERW Pipeline: Coupled Diffusion-Fracture Life Prediction\n\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.20172481.svg)](https://doi.org/10.5281/zenodo.20172481)\n\n### Problem Statement\n\nCan a 1959-vintage 20-inch API 5L X52 low-frequency ERW pipeline with pre-existing selective seam corrosion pits be safely converted from natural gas to hydrogen service?\n\nThis is the same pipe specification that failed at Willow River, Minnesota on January 16, 2026 (PHMSA Corrective Action Order).\n\n### News Hooks (March 2026)\n\n- AMPP Pipeline Industry Report 2026: corrosion incidents rose to 25%+ of all pipeline failures\n- PHMSA Corrective Action Order on Willow River LF-ERW explosion\n- ASME absorbing B31.12 hydrogen requirements into B31.8 (2026 edition)\n- 3,072 miles of pre-1970 pipe in Minnesota alone, 209 miles of unknown vintage\n\n### Governing Physics (5-mechanism sequential chain)\n\n1. **Hydrogen diffusion PDE** (Oriani stress-assisted Fick's law):\n   dC_L/dt = D_L * d2C_L/dx2 + D_L * (V_H/RT) * d/dx(C_L * dsigma_h/dx)\n   BC: C(0) = S*sqrt(p_H2), C(w) = 0\n\n2. **Pit growth at ERW seam** (power law from NG service):\n   a_pit = k * f_seam * t^n\n\n3. **Pit-to-crack transition** (Murakami + El Haddad):\n   K_pit = 0.65 * sigma * sqrt(pi * sqrt(area)) \u003e= K_th(C_H)\n\n4. **Hydrogen-assisted fatigue crack growth** (modified Paris law):\n   da/dN = C_paris * dK^m * [1 + alpha_H * (C_H/C_ref)^beta_H]\n\n5. **Failure criterion**:\n   K_max \u003e= K_IC(C_H) = K_IC_air * exp(-lambda * C_H / C_ref)\n\n### Repository Structure\n\n```\nintegrity_code_series_week7_h2_lferw/\n    src/\n        config.py                    # All parameters, [ASSUMED] flags\n        hydrogen_diffusion.py        # 1D radial H diffusion PDE\n        pit_to_crack.py              # Murakami SIF, transition criteria\n        ha_fcg.py                    # HA-FCG + integrated life engine\n        monte_carlo.py               # MC + LHS parametric sweep\n        ml_surrogate.py              # GBR surrogate, feature ranking\n        cybersecurity.py             # STRIDE, audit chain, sensor integrity\n        visualization.py             # All plots + animated GIF\n    tests/\n        test_suite.py                # 182 tests\n    assets/                          # Generated visuals\n    notebooks/                       # Optional Jupyter notebooks\n    README.md\n    requirements.txt\n```\n\n### Execution Order\n\n```bash\n# 1. Install dependencies\npip install -r requirements.txt\n\n# 2. Run test suite\ncd tests\npython -m pytest test_suite.py -v\n\n# 3. Run full simulation (from src/)\ncd ../src\npython -c \"\nfrom config import default_config\nfrom hydrogen_diffusion import solve_diffusion\nfrom ha_fcg import run_life_prediction, cycles_to_years\nfrom monte_carlo import run_monte_carlo, run_lhs_sweep\nfrom ml_surrogate import train_surrogate, validate_feature_ranking\nfrom visualization import *\n\ncfg = default_config()\nprint('Running hydrogen diffusion...')\ndiff = solve_diffusion(cfg['geom'], cfg['h2_transport'], cfg['ops'], cfg['sim'])\nprint(f'Diffusion solved: {len(diff.t_grid)} snapshots')\n\nprint('Running life prediction...')\nlife = run_life_prediction(\n    cfg['geom'], cfg['mat'], cfg['h2_transport'],\n    cfg['h2_embrittlement'], cfg['pit'], cfg['ops'], cfg['sim'],\n    diffusion_result=diff\n)\nprint(f'Failure at cycle {life.failure_cycle} ({cycles_to_years(life.failure_cycle, cfg[\\\"ops\\\"]):.1f} years)')\nprint(f'Failure mode: {life.failure_mode}')\n\nprint('Running Monte Carlo (10,000 samples)...')\nmc = run_monte_carlo(\n    cfg['geom'], cfg['mat'], cfg['h2_transport'],\n    cfg['h2_embrittlement'], cfg['pit'], cfg['ops'], cfg['sim']\n)\nprint(f'P5={mc.percentile_5:.1f} yr, P50={mc.percentile_50:.1f} yr, P95={mc.percentile_95:.1f} yr')\nprint(f'Fraction below 10yr: {mc.fraction_below_10yr:.1%}')\n\nprint('Running LHS sweep (2,000 samples)...')\nlhs = run_lhs_sweep(\n    cfg['geom'], cfg['mat'], cfg['h2_transport'],\n    cfg['h2_embrittlement'], cfg['pit'], cfg['ops'], cfg['sim']\n)\nprint('Spearman correlations:')\nfor k, v in sorted(lhs.spearman_correlations.items(), key=lambda x: -abs(x[1])):\n    print(f'  {k}: {v:.3f}')\n\nprint('Training GBR surrogate...')\nsurr = train_surrogate(lhs.params, lhs.remaining_life_years, lhs.param_names)\nprint(f'R2 test: {surr.r2_test:.3f}')\nranking = validate_feature_ranking(surr.feature_importances)\nfor k, v in ranking.items():\n    print(f'  {k}: {v}')\n\nprint('Generating visuals...')\nplot_hero_diffusion_crack(diff, life, cfg['geom'])\nplot_monte_carlo_cdf(mc)\nplot_sensitivity_tornado(lhs.spearman_correlations)\nplot_surrogate_parity(surr)\ngenerate_gif(diff, life, cfg['geom'])\nprint('All outputs generated in assets/')\n\"\n```\n\n### Key Assumptions Requiring Experimental Calibration\n\nAll parameters flagged [ASSUMED] in config.py. Critical ones:\n\n- Sievert's constant S: governs surface hydrogen uptake\n- Hydrogen embrittlement exponents (lambda_K, lambda_th): control property degradation rate\n- HA-FCG enhancement parameters (alpha_H, beta_H): control crack growth acceleration\n- ERW seam toughness K_IC and threshold K_th: must be measured on actual seam material in pressurized H2\n- Seam enhancement factor f_seam: depends on specific manufacturing vintage\n\n### Escalation from Previous Weeks\n\n| Dimension | Week 5 (MIC) | Week 6 (Galvanic) | Week 7 (H2+LF-ERW) |\n|---|---|---|---|\n| Physics coupling | Reaction-diffusion ODE | 2D Laplace + BV | Transport PDE + fracture ODE |\n| Mechanism chain | Single (biofilm + acid) | Single (galvanic) | 5-mechanism sequential |\n| Probabilistic | Parametric sweep only | MCMC inverse | Monte Carlo 10,000 + LHS |\n| Spatial | 1D chainage | 2D cross-section | 1D radial + through-wall |\n| Regulatory | None | None | ASME B31.12 / PHMSA mapping |\n\n### Cybersecurity\n\n7 threats documented (STRIDE + data poisoning). SHA-256 hash-chain audit logging.\nSensor spoofing detection for ILI data. Physics monotonicity check for training data integrity.\n\n### License\n\nEducational and research use. Not for production engineering decisions without\nexperimental calibration of all [ASSUMED] parameters.\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\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 7 - Hydrogen Conversion of Aging LF-ERW Pipeline: Coupled Diffusion-Fracture Life Prediction* (Version 1.0.1) [Computer software]. Zenodo. https://doi.org/10.5281/zenodo.20172481\n\n**BibTeX:**\n\n```bibtex\n@software{rocha_2026_week7,\n  author       = {Rocha, Felipe},\n  title        = {{Integrity Code Series - Week 7 - Hydrogen Conversion of Aging LF-ERW Pipeline: Coupled Diffusion-Fracture Life Prediction}},\n  year         = 2026,\n  publisher    = {Zenodo},\n  version      = {v1.0.1},\n  doi          = {10.5281/zenodo.20172481},\n  url          = {https://doi.org/10.5281/zenodo.20172481}\n}\n```\n\nThe two DOIs Zenodo provides are:\n\n| DOI                                  | What it points to                                                  |\n|--------------------------------------|--------------------------------------------------------------------|\n| `10.5281/zenodo.20172481` (concept)   | Always resolves to the latest version - use this for citation.     |\n| `10.5281/zenodo.20172482` (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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffelipearocha%2Fintegrity_code_series_week7_h2_lferw","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffelipearocha%2Fintegrity_code_series_week7_h2_lferw","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffelipearocha%2Fintegrity_code_series_week7_h2_lferw/lists"}