Skip to content
Preview.inp@modelscript/relap5 10 diagnostic rules
Parser WASM GLR
Diagnostics 10 rules
DAE Arena Lowering
Simulation Native Solvers
Projections Modelica
Live ExamplePwrPrimaryCoolantLoop.inp

RELAP5-3D Pressurized Water Reactor Primary Coolant Loop

Coupled six-equation two-fluid thermal-hydraulics and point reactor kinetics deck for a PWR core, hot leg, U-tube steam generator, and RCP.

Playground
Source (20 lines)
1= RELAP5-3D PWR Primary Loop & Point Kinetics Deck
20000100 new transnt
30000105 5.0 20.0
40000201 20.0 1.0e-4 0.02 3 10 100
5* Hydrodynamic Components
61000000 reactor-core pipe
71000101 0.42 3.65 0.0 0.0 90.0 0.0 4.5e-5 0.0 00
81001201 003 15.5e6 582.0 0.0 0.0 0.0
91100000 hot-leg branch
101100101 0.74 6.20 0.0 0.0 0.0 0.0 4.5e-5 0.0 00
111101201 003 15.4e6 598.0 0.0 0.0 0.0
121200000 steam-gen pipe
131200101 1.15 9.80 0.0 0.0 -90.0 0.0 4.5e-5 0.0 00
141201201 003 15.2e6 566.0 0.0 0.0 0.0
151300000 coolant-pump pump
161300101 0.68 2.10 0.0 0.0 0.0 0.0 0.0 0.0 00
171301201 003 15.6e6 565.0 0.0 0.0 0.0
18* Point Reactor Kinetics
193000000 point-kinetics
203000001 0 3411.0e6 0.0065 1.8e-5
RELAP5 Nuclear Reactor Nodalization Diagram
new transnt Reactor Coolant System (RCS) Thermal-Hydraulic Nodalization reactor-core hot-leg steam-gen coolant-pump point-kinetics Coolant Temp: Cold Leg (~285°C) Hot Leg (~320°C) PZR Saturation (~345°C)
Drag to pan · Click % to reset

RELAP5 Nuclear Reactor Thermal-Hydraulics (.i, .inp, .r5) ​

@modelscript/relap5 (languages/relap5) provides high-fidelity 80-column card deck parsing, non-equilibrium two-phase hydrodynamic modeling, 6-group delayed neutron point kinetics solving, DAE lowering, and Modelica 3.x projection for INL RELAP5-3D nuclear reactor systems, thermal-hydraulic loops, and safety margin evaluations.


Supported Extensions & Standards ​

ExtensionFormatDescription
.i / .inpRELAP5 Input Card DeckFixed-column card deck specifying hydrodynamic volumes, junctions, heat structures, trips, and kinetics
.r5RELAP5-3D System DeckMulti-loop PWR/BWR coolant systems, steam generators, emergency core cooling systems (ECCS)

Key Capabilities ​

1. Two-Phase Non-Equilibrium Hydrodynamics ​

  • Employs a full 6-equation two-fluid formulation with separate mass, momentum, and energy conservation equations for liquid and vapor phases:
    • Phase Mass Conservation:∂∂t(αkρk)+1A∂∂x(αkρkvkA)=Γk(k∈{l,v})
    • Phase Momentum Conservation:αkρk∂vk∂t+αkρkvk∂vk∂x=−αk∂P∂x+αkρkgcos⁡θ−Fwall,k−Finter,k+Γk(vki−vk)
    • Phase Energy Conservation:∂∂t(αkρkuk)+1A∂∂x(αkρkukvkA)=−P[∂αk∂t+1A∂∂x(αkvkA)]+Qwall,k+Qinter,k+Γkhki
  • Tracks interphase friction, bubbly/slug/annular flow regime transitions, and subcooled boiling.

2. 6-Group Delayed Neutron Point Kinetics & Reactivity Feedback ​

  • Solves the stiff differential equations of reactor core power during transients and reactor SCRAM:dPdt=ρ(t)−βΛP(t)+∑i=16λiCi(t)dCidt=βiΛP(t)−λiCi(t)(i=1,…,6)where P is normalized thermal power, Λ is prompt neutron generation time, and β=∑βi is delayed neutron fraction.
  • Incorporates dynamic physical reactivity feedback:ρ(t)=ρcontrol(t)+αDoppler(Tfuel−Tfuel,0)+αdensity(ρmod−ρmod,0)ensuring negative Doppler fuel temperature feedback stabilizes reactor transients.

3. Direct DAE Lowering ​

  • Compiles hydrodynamic volumes, inter-volume junctions, and heat structures into @modelscript/runtime's DAEBuilder linear memory arena.
  • Enables co-simulation between nuclear primary coolant loops, secondary steam turbine power plants, and electrical generator controls (@modelscript/psse).

4. Bidirectional Modelica 3.x Projection ​

  • Projects RELAP5 primary loops and core volumes into Modelica.Fluid two-phase thermal hydraulic circuits and nuclear reactor models.

Pre-Flight Diagnostics ​

The RELAP5 parser and validator enforce card syntax, hydrodynamic connectivity, and trip cutset safety:

10 rules8 error2 warning Run with msx relap5 lint

CodeRuleSeverityMessage
M8601dangling-volume-connectionerrorJunction '<junctionId>' specifies undefined <end>-volume '<volId>'.
M8602unclosed-trip-logic-cutseterrorTrip logic '<parentTripId>' references undefined child trip ID '<childTripId>'.
M8603negative-heat-capacityerrorHeat structure '<hsId>' specifies non-positive conductivity (<k> W/m-K) or capacity (<cp> J/m³-K).
M8604sonic-choked-flow-singularitywarningJunction '<junctionId>' flagged for critical sonic choked flow transition.
M8605missing-kinetics-delayed-groupserrorPoint kinetics model specifies <count> delayed groups; standard reactor kinetics requires 6 precursor groups.
M8606negative-prompt-neutron-lifetimeerrorPrompt neutron generation time '<lambda>' s must be strictly positive.
M8607adverse-volume-elevationwarningVolume '<volId>' elevation change dz (<dz> m) exceeds physical volume length (<length> m).
M8608negative-junction-loss-coefficienterrorJunction '<junctionId>' specifies negative form loss coefficient (K_forw=<kForw>, K_rev=<kRev>).
M8609invalid-time-step-boundserrorMinimum time step (<minDt> s) exceeds maximum time step (<maxDt> s).
M8610negative-pressure-stateerrorVolume '<volId>' specifies non-positive thermodynamic pressure (<p> Pa).

Generated from languages/relap5/src/errors.ts. All languages →


CLI Usage ​

bash
# Inspect hydrodynamic volumes, junctions, and core kinetics cards
msx relap5 inspect PwrPrimaryLoop.i

# Run pre-flight card validation and trip logic cutset analysis
msx relap5 lint PwrPrimaryLoop.i

# Simulate 6-group delayed neutron point kinetics during rod drop / SCRAM
msx relap5 kinetics PwrPrimaryLoop.i --duration=10.0

# Lower two-phase volumes and kinetics into ModelScript linear DAE arena
msx relap5 to-dae PwrPrimaryLoop.i

# Project into Modelica 3.x two-phase nuclear thermal-hydraulics model
msx relap5 to-modelica PwrPrimaryLoop.i -o NuclearLoop.mo

Open-Core under the GNU AGPL v3 License; Enterprise Edition (ee/) under the ModelScript Enterprise License. • Trademark Policy