relief-valve-sizing-api520
Skill7 starsChanged 6 months agoApache-2.0View on GitHub
Preliminary pressure-relief device orifice area for gas/vapor or liquid service using API 520 Part I sizing equations. Use only for early screening of relief loads, comparing scenarios, and sanity-checking vendor sizing. Don't use for final design (which requires the authoritative API 520/521/526 text and qualified relief engineering), for two-phase / flashing relief (DIERS methodology), or for fire-case relief load development (use API 521 to establish the load first).
In this repository31 other files it gives its agents.
- absorption-stripping-designSkill
- bayesian-hierarchical-process-modelsSkill
- caustic-merox-extractionSkill
- censored-regressionSkill
- compositional-data-analysisSkill
- control-valve-sizing-isa75Skill
- convective-heat-transfer-correlationsSkill
- design-of-experimentsSkill
- dimensionless-numbersSkill
- distillation-shortcut-designSkill
- distributed-lag-modelsSkill
- engg-skills-commonSkill
- engineering-skill-creatorSkill
- engineering-statisticsSkill
- equation-of-state-selectionSkill
- heat-exchanger-sizingSkill
- literature-search-engineeringSkill
- material-energy-balancesSkill
- pipe-flow-pressure-dropSkill
- process-causal-inference-dagsSkill
- process-units-conversionSkill
- reactor-sizing-and-kineticsSkill
- separator-vessel-sizingSkill
- sour-gas-amine-treatingSkill
- statistical-process-controlSkill
- steam-tables-iapwsSkill
- thermo-process-propertiesSkill
- time-series-process-data-analysisSkill
- two-phase-flowSkill
- uvSkill
- vle-flash-calculationsSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 5 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 88
Run the script; round the orifice area UP to the nearest API 526 orifice designation (D, E, F, G, H, J, K, L, M, N, P, Q, R, T).
- Distinctive: line 90
Verify the inlet line pressure drop against API 520 and company criteria.
- Distinctive: line 91
Verify the total back-pressure and corrected capacity remain within the valve type and vendor envelope.
- Distinctive: line 115
If the scenario load is unknown, stop.
- Very specific: line 119
Run the listed script with representative inputs and an --output file when a deterministic calculation is available.
- Distinctive: line 121
Check result magnitudes against the stated assumptions, references, and a hand calculation or known operating range before reporting them.
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
API 520 Pressure-Relief Sizing (Preliminary)
Overview
Implements the gas/vapor (critical and sub-critical) and liquid forms of the API 520 Part I sizing equations as preliminary screening. The standard's correction factors are user-supplied:
Kd— effective coefficient of discharge.Kb— gas/vapor balanced-bellows backpressure correction.Kw— liquid balanced-bellows backpressure correction.Kc— rupture-disk combination correction when applicable.Kv— liquid viscosity correction.
The script does not embed the standard's correction charts or vendor-specific limits.
Safety Scope
This skill produces a preliminary, screening-grade required orifice area. Final relief device selection, certification (NB-7), inlet/outlet piping pressure-drop checks, blowdown system back-pressure analysis, and compliance with ASME BPVC Section VIII / Section XIII and jurisdictional codes require the authoritative API 520/521/526 text, vendor data, and qualified pressure-relief engineering review.
Prerequisites
uvavailable.- On first use, the script writes
LICENSE_NOTIFICATION.txtlisting the referenced standards (titles only).
When to Use
- Screening the order-of-magnitude orifice area for a relief case.
- Comparing several scenarios (blocked discharge, fire, thermal, tube rupture).
- Cross-checking vendor or simulator output before issuing a PR specification.
Don't use for
- Final design / certification.
- Two-phase or flashing relief: use DIERS-style methodology. The script will not warn you if your scenario is actually two-phase.
- Fire case relief load calculation: use API 521 to establish the fire heat input and relief load before using this sizing helper.
Utility Scripts
uv run scripts/api520.py gas --m 2.5 --T-K 320 --MW 44.1 --gamma 1.13 --Z 0.95 --P1 1500000 --Pb 200000 --Kd 0.975 --output /tmp/gas.jsonuv run scripts/api520.py liquid --Q 0.005 --rho 800 --P1 2500000 --Pb 200000 --Kd 0.65 --output /tmp/liq.json
Procedure
- Identify the relief scenario (blocked discharge, fire, thermal expansion, tube rupture, etc.) and the controlling case.
- Compute the relief load
W(gas/vapor mass flow) orQ(liquid volumetric flow) using a separate scenario analysis (not in this skill). - Identify upstream relieving conditions: pressure, temperature, gas properties (MW, Z, gamma), or liquid properties (density, viscosity if needed).
- Identify back-pressure conditions: built-up and superimposed back-pressure into the flare/atmosphere.
- Choose
Kdfrom the vendor certification or conservative screening defaults (typical screening: gas/vapor 0.975, liquid 0.65). ApplyKbonly for gas/vapor balanced-bellows backpressure correction,Kwonly for liquid balanced-bellows backpressure correction,Kvfor liquid viscosity, andKcfor rupture-disk combination service. - Run the script; round the orifice area UP to the nearest API 526 orifice designation (D, E, F, G, H, J, K, L, M, N, P, Q, R, T).
- Verify the inlet line pressure drop against API 520 and company criteria.
- Verify the total back-pressure and corrected capacity remain within the valve type and vendor envelope.
Pitfalls
- Using molecular weight in kg/mol instead of g/mol / kg/kmol.
- Treating the relief load (W or Q) as exact; it is the dominant uncertainty in many relief-sizing checks.
- Applying gas/vapor
Kbto all conventional spring PRVs. UseKb = 1unless a balanced-bellows correction is being applied from the standard or vendor data. - Applying liquid
Kwto gas/vapor service or gas/vaporKbto liquid service. - Using
Kd = 1.0because the manufacturer has not been chosen; use certified vendor data for final design and conservative screening defaults before then. - Sizing for set pressure instead of relieving pressure.
- Treating gas relief as critical when
Pb / P1exceeds the critical ratio for a conventional or pilot-operated valve. - Sizing for the wrong fluid state (vapor instead of two-phase for boiling, flashing, or entraining service).
- Ignoring rupture-disk combination correction
Kcwhen applicable.
Fallback Strategies
- Two-phase / flashing relief is OUTSIDE this skill's scope. State that DIERS-style methodology is needed.
- If the scenario load is unknown, stop; do not guess.
Verification
- Run the listed script with representative inputs and an
--outputfile when a deterministic calculation is available. - Confirm the JSON result contains
ok: true, expected units, and no unhandled warnings. - Check result magnitudes against the stated assumptions, references, and a hand calculation or known operating range before reporting them.
References
references/api520_equations.md— equation forms used.references/typical_kd_values.md— typical Kd ranges (Vendor data needed for final design).- API 520 Part I — Sizing, Selection, and Installation of Pressure-Relieving Devices.
- API 521 — Pressure-Relieving and Depressuring Systems (for the load side).
- API 526 — Flanged Steel Pressure-Relief Valves (orifice designations).
Anti-Patterns
- Reporting an orifice in mm² without naming the API 526 designation.
- Sizing PRV without documenting the controlling scenario and the relief load source.
- Using this skill output to specify the valve directly to the vendor.
- Skipping inlet-line pressure-drop, outlet back-pressure, and reaction-force checks.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

