agentleFS
equinorequinor/neqsim/.github/skills/neqsim-input-validation/SKILL.md

neqsim-input-validation

Skill167 starsChanged 7 months agoApache-2.0View on GitHub

Input validation rules for NeqSim simulations. USE WHEN: setting up thermodynamic systems, process equipment, or running simulations. Catches physically impossible or suspect inputs before simulation runs, saving time and providing corrective guidance.

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    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
  1. Very specific:

    Corrective action: Verify units — NeqSim uses bara (absolute), not barg (gauge) or psia.

    line 31
  2. Distinctive:

    Corrective action: Search COMP.csv for the correct component name.

    line 62
  3. Distinctive:

    Use this checklist before every simulation setup:

    line 167

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

NeqSim Input Validation Rules

Validate inputs before creating NeqSim objects or running simulations. Each rule includes the check, the error it prevents, and the corrective action.

Thermodynamic System Inputs

Temperature

CheckValid RangeError If Violated
T > 0 K (> -273.15 C)50-1000 K typicalAbsolute zero violation — physically impossible
T < 2000 KEngineering rangeAbove 2000 K, EOS models are not validated
Constructor uses KelvinSystemSrkEos(273.15 + T_C, P)Passing Celsius directly gives wrong results silently

Corrective action: Convert Celsius to Kelvin: T_K = 273.15 + T_C

Pressure

CheckValid RangeError If Violated
P > 0 bara0.001-2000 bara typicalZero/negative pressure is physically impossible
P < 5000 baraEngineering rangeAbove ~2000 bara, cubic EOS accuracy degrades significantly

Corrective action: Verify units — NeqSim uses bara (absolute), not barg (gauge) or psia.

Composition

CheckRuleError If Violated
Sum of mole fractionsShould be ~1.0 (tolerance: 0.999-1.001)Wrong mixture composition — all properties incorrect
Each fraction >= 0No negative fractionsPhysically impossible
Each fraction <= 1No fraction > 100%Physically impossible
At least 1 componentCannot have empty systemNeqSim crashes on empty system

Corrective action: Normalize fractions: x_i = x_i / sum(x). Or alert user that fractions don't sum to 1.

Component Names

Valid component names must match entries in src/main/resources/data/COMP.csv. Common correct names:

Correct NameCommon Mistakes
"methane""CH4", "Methane", "c1"
"ethane""C2H6", "C2"
"propane""C3H8", "C3"
"n-butane""butane", "nC4"
"i-butane""isobutane", "iC4"
"CO2""co2", "carbon dioxide"
"H2S""h2s", "hydrogen sulfide"
"nitrogen""N2", "Nitrogen"
"water""H2O", "Water"
"MEG""meg", "ethylene glycol"

Corrective action: Search COMP.csv for the correct component name.

Mixing Rule

CheckRuleError If Violated
Mixing rule is setsetMixingRule() must be called after addComponent()Flash gives wrong results or crashes
CPA systems use numeric rulesetMixingRule(10) for CPA EOSString mixing rules don't work with CPA
Default for ordinary cubic EOSsetMixingRule("classic") for SRK/PR when no specific model basis requires another ruleA generic default can override the governing model
ISO 18453 / GERG-waterSystemGERGwaterEos with setMixingRule(8)Classic or CPA defaults change the named ISO model basis

Corrective action: Select the EOS and mixing rule from the governing named standard or validated task model before applying defaults. For ordinary SRK/PR, "classic" is a default; for CPA, numeric rule 10 is the usual setup. For ISO 18453 / GERG-water, retain rule 8 and follow the ISO 18453 / GERG-water execution rule. Set the selected rule after adding all components; never replace a specified model with a generic CPA or classic-rule recommendation.

Process Equipment Inputs

Stream

CheckRule
Flow rate > 0Zero flow breaks downstream equipment
Flow rate units specifiedsetFlowRate(value, "kg/hr") — always include unit string
Stream has a fluid objectnew Stream("name", fluid) — fluid must not be null

Compressor

CheckRule
Outlet pressure > inlet pressureCompressor cannot decompress (use valve/expander)
Pressure ratio < 6 per stageSingle-stage ratio above ~4-6 is unrealistic
Isentropic efficiency 0.5-0.95Values outside this range are non-physical
Inlet stream has gas phaseCompressor cannot handle pure liquid

Valve / Throttle

CheckRule
Outlet pressure < inlet pressureValve reduces pressure (use compressor to increase)
Outlet pressure > 0 baraCannot throttle to zero pressure

Heat Exchanger / Cooler / Heater

CheckRule
Outlet temperature setMust specify target temperature or duty
Cooler: T_out < T_inCooler reduces temperature
Heater: T_out > T_inHeater increases temperature
Temperature in Kelvin for setOutTemperature()Common mistake: passing Celsius to method expecting Kelvin

Separator

CheckRule
Inlet has 2+ phases at conditionsSingle-phase feed produces no separation
Use ThreePhaseSeparator for waterStandard Separator handles gas/liquid only

Pipeline

CheckRule
Length > 0 metersZero-length pipe has no effect
Diameter > 0 metersMust specify pipe inner diameter
Diameter typically 0.05-1.5 mValues outside range are suspect

EOS Selection Validation

Fluid TypeRequired EOSWrong EOS Symptom
ISO 18453 / GERG-water water dew pointSystemGERGwaterEos with mixing rule 8, or Standard_ISO18453CPA, GERG-2008, or ordinary PR changes the requested model basis
General hydrocarbons + water, without a specified model basisCPA (SystemSrkCPAstatoil)SRK/PR gives near-zero water solubility in HC
Hydrocarbons + MEG/methanolCPA (SystemSrkCPAstatoil)Wrong hydrate inhibition prediction
Pure hydrocarbons (no polar)SRK or PRCPA is slower with no benefit
Custody transfer / fiscal meteringGERG-2008 (SystemGERG2008Eos)Cubic EOS not accurate enough for custody
Electrolyte / brine / pHElectrolyte CPASRK/CPA ignores ionic interactions

Corrective action: Match EOS to the governing standard and task model, then the fluid type. CPA is a general water/polar-system option; it does not replace the named ISO 18453 / GERG-water calculation. Resolve an unspecified model basis before claiming standard-specific results.

Order-of-Operations Validation

These operations must happen in the correct sequence:

1. Create fluid (SystemSrkEos, etc.)
2. Add ALL components
3. Set mixing rule                    ← BEFORE characterization or flash
4. Characterize plus fractions (if oil) ← AFTER mixing rule
5. Create database (if needed)
6. Run flash (TPflash, etc.)
7. Call initProperties()              ← AFTER flash, BEFORE reading properties
8. Read properties (density, viscosity, etc.)

Common order violations:

  • Characterizing before setting mixing rule → ArrayIndexOutOfBoundsException
  • Reading properties before initProperties() → zero values for transport properties
  • Adding components after setting mixing rule → mixing rule parameters stale

Quick Validation Checklist

Use this checklist before every simulation setup:

  • Temperature in Kelvin for constructors (not Celsius)
  • Pressure in bara (not barg or psia)
  • Mole fractions sum to ~1.0
  • Component names match COMP.csv exactly
  • Mixing rule set after all components added
  • EOS and mixing rule match the named standard/task basis (ISO 18453: GERG-water and rule 8)
  • Flash called before reading properties
  • initProperties() called after flash
  • Equipment connected via outlet streams (not new streams)
  • ProcessSystem.run() called once after building full flowsheet

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.