# Relief Valve Sizing Api520

> >-

- **Type:** Skill
- **Install:** `agentstack add skill-jskherman-engg-skills-relief-valve-sizing-api520`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [jskherman](https://agentstack.voostack.com/s/jskherman)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** Apache-2.0
- **Upstream author:** [jskherman](https://github.com/jskherman)
- **Source:** https://github.com/jskherman/engg-skills/tree/main/skills/relief-valve-sizing-api520

## Install

```sh
agentstack add skill-jskherman-engg-skills-relief-valve-sizing-api520
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# 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

1. `uv` available.
2. On first use, the script writes `LICENSE_NOTIFICATION.txt` listing 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.json`
- `uv run scripts/api520.py liquid --Q 0.005 --rho 800 --P1 2500000 --Pb 200000 --Kd 0.65 --output /tmp/liq.json`

## Procedure

1. Identify the relief scenario (blocked discharge, fire, thermal expansion,
   tube rupture, etc.) and the controlling case.
2. Compute the relief load `W` (gas/vapor mass flow) or `Q` (liquid volumetric
   flow) using a separate scenario analysis (not in this skill).
3. Identify upstream relieving conditions: pressure, temperature, gas properties
   (MW, Z, gamma), or liquid properties (density, viscosity if needed).
4. Identify back-pressure conditions: built-up and superimposed back-pressure
   into the flare/atmosphere.
5. Choose `Kd` from the vendor certification or conservative screening defaults
   (typical screening: gas/vapor 0.975, liquid 0.65). Apply `Kb` only for
   gas/vapor balanced-bellows backpressure correction, `Kw` only for liquid
   balanced-bellows backpressure correction, `Kv` for liquid viscosity, and `Kc`
   for rupture-disk combination service.
6. 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).
7. Verify the inlet line pressure drop against API 520 and company criteria.
8. 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 `Kb` to all conventional spring PRVs. Use `Kb = 1` unless a
  balanced-bellows correction is being applied from the standard or vendor data.
- Applying liquid `Kw` to gas/vapor service or gas/vapor `Kb` to liquid service.
- Using `Kd = 1.0` because 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 / P1` exceeds 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 `Kc` when 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 `--output` file 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.

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [jskherman](https://github.com/jskherman)
- **Source:** [jskherman/engg-skills](https://github.com/jskherman/engg-skills)
- **License:** Apache-2.0

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-jskherman-engg-skills-relief-valve-sizing-api520
- Seller: https://agentstack.voostack.com/s/jskherman
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
