neqsim-teg-dehydration-modeling
Skill4 starsChanged 5 months agoApache-2.0View on GitHub
Build a validated, closed-loop TEG (triethylene glycol) gas dehydration plant in NeqSim, including absorber, flash drum, regeneration column, stripper, lean-TEG recycle, and still-vent emission classification. USE WHEN: a task needs a runnable NeqSim TEG dehydration flowsheet (water dew point, lean-TEG purity, NMVOC/methane/benzene still-vent emissions) rather than a screening-level water-content estimate.
In this repository90 other files it gives its agents.
- neqsim-document-intelligence-extractionSkill
- neqsim-co2-emissions-screeningSkill
- neqsim-energy-emissions-screeningSkill
- neqsim-weather-dataSkill
- neqsim-anp-open-dataSkill
- neqsim-artificial-lift-screeningSkill
- neqsim-asset-value-npv-screeningSkill
- neqsim-capex-opex-screeningSkill
- neqsim-design-basis-screeningSkill
- neqsim-economy-basis-screeningSkill
- neqsim-ncs-infrastructure-networkSkill
- neqsim-ncs-ownership-equitySkill
- neqsim-ncs-value-chain-optimizationSkill
- neqsim-norwegian-continental-shelf-dataSkill
- neqsim-psc-bid-economics-screeningSkill
- neqsim-reservoir-depletion-screeningSkill
- neqsim-reservoir-facility-value-chainSkill
- neqsim-reservoir-model-builderSkill
- neqsim-resource-classification-screeningSkill
- neqsim-hydrate-margin-checkSkill
- neqsim-hydrate-screeningSkill
- neqsim-multiphase-flow-slug-screeningSkill
- neqsim-olga-multiphase-simulatorSkill
- neqsim-produced-water-scale-screeningSkill
- neqsim-surf-cooldown-screeningSkill
- neqsim-two-phase-flow-regime-screeningSkill
- neqsim-wax-margin-checkSkill
- neqsim-acoustic-induced-vibration-screeningSkill
- neqsim-adsorbent-capillary-condensation-screeningSkill
- neqsim-ageing-life-extension-screeningSkill
- neqsim-cfd-couplingSkill
- neqsim-compressor-antisurge-recycleSkill
- neqsim-compressor-operating-window-checkSkill
- neqsim-compressor-power-screeningSkill
- neqsim-continuous-improvement-toolkitSkill
- neqsim-control-authority-screeningSkill
- neqsim-control-valve-cv-screeningSkill
- neqsim-dry-gas-seal-screeningSkill
- neqsim-dynamic-instrument-controller-setupSkill
- neqsim-dynamic-process-preparationSkill
- neqsim-fem-couplingSkill
- neqsim-fired-heater-duty-screeningSkill
- neqsim-flow-induced-vibration-screeningSkill
- neqsim-gas-scrubber-sizing-screeningSkill
- neqsim-gas-turbine-performance-screeningSkill
- neqsim-heat-exchanger-fouling-assessmentSkill
- neqsim-line-velocity-checkSkill
- neqsim-noise-screeningSkill
- neqsim-pipe-wall-thickness-screeningSkill
- neqsim-piping-flexibility-screeningSkill
- neqsim-pressure-drop-screeningSkill
- neqsim-pump-hydraulics-screeningSkill
- neqsim-reciprocating-compressor-screeningSkill
- neqsim-reliability-data-screeningSkill
- neqsim-sand-erosion-screeningSkill
- neqsim-separator-modellingSkill
- neqsim-uncertainty-quantificationSkill
- neqsim-utility-balance-screeningSkill
- neqsim-water-dewpoint-dehydration-screeningSkill
- neqsim-benchmark-reference-dataSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 5 are distinctive, and 0 are 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.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 16
Use this skill to build a complete, converging triethylene-glycol (TEG) gas dehydration plant in NeqSim.
- Distinctive: line 30
When a user asks to model a TEG dehydration unit and read water dew point, lean TEG purity, or regeneration still-vent emissions.
- Distinctive: line 32
When an agent needs a runnable TEG flowsheet to study stripping gas, reboiler temperature, TEG circulation rate, or once-through vs …
- Distinctive: line 34
When emissions (NMVOC, methane, benzene, CO2, water) from the regeneration still vent must be quantified and classified for an …
- Distinctive: line 144
Use this when the question is "does a few tens of mbar more reboiler pressure matter?" rather than a full flowsheet.
≈ “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.
Files
TEG Dehydration Modeling
Use this skill to build a complete, converging triethylene-glycol (TEG) gas
dehydration plant in NeqSim. It captures a validated flowsheet topology and the
non-obvious settings (CPA fluid setup, regeneration-column tolerances, recycle
priorities, condenser/preheat energy coupling, makeup calculator) needed for the
process to solve as a closed loop. It returns a ProcessSystem plus the key
streams an agent needs for water dew point, lean-TEG purity, and still-vent
emission classification.
This is a real NeqSim build, not a public correlation placeholder. For a quick
"is dehydration required?" triage without building a plant, use
neqsim-water-dewpoint-dehydration-screening instead.
When to Use
- When a user asks to model a TEG dehydration unit and read water dew point, lean TEG purity, or regeneration still-vent emissions.
- When an agent needs a runnable TEG flowsheet to study stripping gas, reboiler temperature, TEG circulation rate, or once-through vs recirculated stripping gas.
- When emissions (NMVOC, methane, benzene, CO2, water) from the regeneration still vent must be quantified and classified for an environmental screening.
Inputs
The build_teg_plant(...) function is fully parameterized. Key inputs:
feed_fractions: list of mole fractions (or percentages) aligned withGAS_COMPONENTS(nitrogen, CO2, methane, ... , benzene).feed_flow_MSm3_day: wet/dry feed gas flow rate in MSm3/day.feed_temp_C,feed_pressure_bara: feed gas conditions.absorber_pressure_bara,absorber_temp_C: contactor conditions.teg_flow_kg_hr,teg_feed_temp_C,lean_teg_purity: lean TEG circulation.flash_drum_pressure_bara,reboiler_temp_C,stripping_gas_Sm3_hr: regeneration conditions.n_absorber_stages,stage_efficiency: absorber model resolution.water_mode:'saturated'(water-saturate the feed) or'specified'(set an inlet water content in mol-ppm viawater_content_ppm_mol).saturation_temp_C,saturation_pressure_bara: optional saturation TP setter.recirculate_stripping_gas:Truebuilds a true closed-loop stripping-gas recycle (split dried overhead, blower, heater) to cut still-vent emissions.
Outputs
build_teg_plant(...) returns (process, streams):
process: a NeqSimProcessSystemready to run.streams: a dict of handles —dehydratedGas,flashGas,stillVent,leanTEGtoAbs,waterDewAnalyser,strippingGas,recircBlower.
Helper functions produce the engineering results:
comp_mass_flows_kg_hr(stream): per-component mass flow (kg/hr).teg_mass_fraction(stream): TEG weight percent of a stream.classify_emissions(stream): dict withNMVOC,methane,CO2,water,TEG,benzene, andtotalmass flows (kg/hr).
Engineering Method
The flowsheet follows the standard TEG dehydration topology:
- Fluid —
SystemSrkCPAstatoil(CPA EOS) withsetMixingRule(10)andsetMultiPhaseCheck(False). TEG is added last so the lean-TEG composition maps toleanComp[-1] = lean_teg_purityandleanComp[-2] = 1 - lean_teg_purity. - Feed conditioning — optional saturation TP setter +
StreamSaturatorUtil(saturated mode) or an inlet water component (specified mode), then a heater to absorber TP. - Absorber —
SimpleTEGAbsorberwith gas-in and lean-TEG solvent-in streams. - Rich TEG let-down and pre-heat — HP flash valve, rich preheater,
lean/rich exchangers (
HeatExchangerwith UA values), degassing separator, fine filter, LP flash valve. - Regeneration —
DistillationColumn(reboiler + condenser) with loosened tolerances (temperature 5e-2, mass 2e-1, enthalpy 2e-1) so the glycol/water split converges; stripping gas fed to the reboiler tray;WaterStripperColumnfor deep lean-TEG purity. - Recycles — lean-TEG recycle (priority 200,
setDownstreamProperty('flow rate')) closes the solvent loop; the internal stripping-gas recycle returns stripper overhead to the reboiler. Withrecirculate_stripping_gas=True, a second makeup recycle recirculates dried overhead as stripping gas. Keep both coupled stripping-gas recycles at the same controller priority (currently 100); an intermediate priority may be skipped by the currentRecycleControllersequence. - Makeup and energy coupling — a
Calculatorsizes TEG makeup from TEG lost in the dry gas, flash gas, still vent, and water draws; the rich preheater is driven by the condenser energy stream:richPreheat.setEnergyStream(column.getCondenser().getEnergyStream()). - Run —
process.runAsThread()thenthr.join(...)(worker thread avoids blocking and tolerates the recycle iterations). A completed worker thread or successful unit statuses do not prove closed-loop convergence: requireprocess.solved()and inspectprocess.getConvergenceDiagnostics()before accepting water or TEG closure.
Python Usage Pattern
from teg_dehydration_modeling import (
DEFAULT_FEED,
build_teg_plant,
classify_emissions,
teg_mass_fraction,
)
process, streams = build_teg_plant(
feed_fractions=DEFAULT_FEED,
feed_flow_MSm3_day=4.65,
feed_temp_C=25.0,
feed_pressure_bara=70.0,
absorber_pressure_bara=85.0,
absorber_temp_C=35.0,
teg_flow_kg_hr=5500.0,
teg_feed_temp_C=48.5,
lean_teg_purity=0.97,
flash_drum_pressure_bara=4.8,
reboiler_temp_C=197.5,
stripping_gas_Sm3_hr=180.0,
n_absorber_stages=4,
stage_efficiency=0.7,
)
thr = process.runAsThread()
thr.join(300000) # ~15 s once-through, ~40 s with stripping-gas recirculation
water_dew_C = float(streams["waterDewAnalyser"].getMeasuredValue("C"))
lean_teg_wt = teg_mass_fraction(streams["leanTEGtoAbs"])
still_vent = classify_emissions(streams["stillVent"])
print(water_dew_C, lean_teg_wt, still_vent["NMVOC"])Regeneration-Pressure Sensitivity (reboiler floating on the LP flare)
Use this when the question is "does a few tens of mbar more reboiler pressure matter?" rather
than a full flowsheet. A reboiler/still connected to an LP flare header has no pressure control;
its pressure is the header pressure plus the pressure drop of the overhead path. Lean-TEG water
content at fixed temperature and vapour composition scales with total pressure, so the
effect is proportional (verified 2026-10-08, Aasta Hansteen, SRK-CPA, mixingRule 10):
p_w(x_water, T)=y_water * P_bubblefrombubblePointPressureFlash(False)on aTEG/waterbinary (fl.getPhase(0)is the gas); solvex_waterso thatp_w = y_steam * P_reboilerby bisection (y_steam= steam / (steam + stripping gas), about 0.85 to 0.92 for 76 Sm3/h stripping gas and 690 kg/h water).- Benchmark: 98.90 wt% TEG at 204 C and 1 atm without stripping gas (textbook value about 98.7).
- 0.200 to 0.215 barg at 198 C: lean-TEG water +1.29 % relative (about -0.005 wt%-points at the design 99.6 wt%), equal to about 0.6 C of reboiler temperature, and +0.16 C on the equilibrium dry-gas dew point at 69 barg. Reaching the 0.4 barg H alarm costs about +17 % water.
- Dry-gas equilibrium: flash gas +
water+TEGwith 5 mol TEG solution per mol gas so the liquid composition stays fixed;dewPointTemperatureFlash()for the dew point. - Water load: saturate the gas at the WET-GAS-SCRUBBER temperature (e.g. 22 C), not the contactor lean-TEG inlet temperature (35 C); the two differ by a factor of two in kg/h.
- In
neqsim_dev_setuptask scripts usens.JClass("neqsim.thermo.system.SystemSrkCPAstatoil")and the component nameTEG.
Validation Checklist
- Water dew point of the dry gas is well below 0 C at the reference pressure.
- Lean TEG purity is above 90 wt% (typically 97-99 wt% with stripping gas).
- Still-vent NMVOC and methane mass flows are finite and non-negative.
- With
recirculate_stripping_gas=True, still-vent NMVOC and methane do not increase versus the once-through case. - The process is run on a worker thread and the join timeout is large enough for the recycles to converge.
process.solved()is true and every active recycle reportssolved() == True; record priority, iterations, and residuals for any unsolved recycle.- Water and TEG closure are interpreted only after the closed loop converges.
- Example inputs are public and synthetic.
Common Mistakes
| Symptom | Cause | Fix |
| Regeneration column will not converge | Default tolerances too tight for glycol/water split | Loosen setTemperatureTolerance(5e-2), setMassBalanceTolerance(2e-1), setEnthalpyBalanceTolerance(2e-1) |
| Lean TEG purity wrong / NaN | TEG not added last, or composition indices off | Add water then TEG last; set leanComp[-1]=purity, leanComp[-2]=1-purity |
| Lean-TEG loop never closes | Recycle priority/property not set | Lean TEG recycle priority 200 with setDownstreamProperty('flow rate') |
| Stripping-gas makeup recycle never executes | Coupled stripping-gas recycles use different priorities and an intermediate level is skipped | Assign the makeup recycle the same priority as the internal stripping-gas recycle; verify both with convergence diagnostics |
| Class not found | Wrong CPA class name | Use SystemSrkCPAstatoil (lowercase statoil) |
| Run blocks or stalls | Running inline instead of on a thread | Use process.runAsThread() + thr.join(timeout_ms) |
| TEG inventory drifts | No makeup | Add the Calculator makeup sized from TEG in dry gas, flash gas, still vent, water draws |
| Water balance looks open | Closed-loop convergence was not established, or a water outlet was omitted | First require process.solved() and all recycle diagnostics solved; then include still vent + regen water/HC draw + degassing flash gas in the water accounting |
Limitations
- Inputs and examples are public and synthetic; no proprietary plant data, vendor glycol packages, or company emission factors are included.
- Emission classification is a component-bucketing of stream mass flows (NMVOC/methane/benzene/CO2/water); it is not a regulatory emission inventory.
- The absorber uses
SimpleTEGAbsorberwith stage efficiency, not a rate-based contactor model; deep dew-point design needs validated review. - Convergence depends on reasonable inputs; extreme TEG rates, stripping gas, or reboiler temperatures may require tolerance or guess-temperature tuning.
Related NeqSim Functionality
neqsim.thermo.system.SystemSrkCPAstatoil— CPA equation of state for glycol/water/hydrocarbon systems (reached viafrom neqsim import jneqsim).neqsim.process.equipment.absorber.SimpleTEGAbsorber,neqsim.process.equipment.absorber.WaterStripperColumn— TEG contactor and stripper.neqsim.process.equipment.distillation.DistillationColumn— TEG regeneration column.neqsim.process.equipment.util.Recycle,Calculator— solvent/stripping-gas recycles and TEG makeup sizing.neqsim.process.measurementdevice.WaterDewPointAnalyser— dry-gas water dew point.- For a screening-only water-content triage before building a plant, use the
neqsim-water-dewpoint-dehydration-screeningcommunity skill.
References
- NeqSim repository: https://github.com/equinor/neqsim
- NeqSim TEG dehydration emissions notebook: https://github.com/equinor/neqsim/blob/master/examples/notebooks/teg_dehydration_emissions.ipynb
- NeqSim Skills Guide: https://github.com/equinor/neqsim/blob/master/docs/integration/skills_guide.md
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.

