Skip to content

[Campaign] Refinery simulation: crude assays, petroleum fractions, fractionation, blending and conversion models #3305

Description

@EvenSol

Goal

Build a validated refinery-simulation capability in NeqSim that is useful for real engineering studies while preserving NeqSim's strengths as an open, programmable Java/Python thermodynamics and process-simulation platform.

This campaign should close the largest refinery-model gaps relative to mature tools such as Aspen HYSYS, Petro-SIM and AVEVA PRO/II, but must not attempt to clone proprietary simulator behavior or datasets. The target is a transparent, testable and extensible refinery calculation framework built from public science, standards, open data and reproducible engineering correlations.

Target end-state

NeqSim should be able to take a crude/petroleum assay or characterized heavy hydrocarbon feed and support a reproducible workflow such as:

assay / TBP data → pseudo-components → thermodynamic characterization → preheat / flash → atmospheric fractionation → vacuum/further fractionation → product streams → blending / specifications → energy, emissions and economics

Selected simplified conversion-unit models may then be added where defensible public models and validation data exist.

Competitive benchmark

The campaign should periodically maintain a capability matrix against refinery functionality typically available in:

  • Aspen HYSYS
  • Petro-SIM
  • AVEVA PRO/II / AVEVA Process Simulation
  • DWSIM

The matrix is for gap identification only. Do not reproduce proprietary equations, parameter databases or implementation details.


Workstreams

A. Crude assay and petroleum characterization — highest priority

Establish one coherent representation for refinery feeds and petroleum fractions.

Required capabilities

  • TBP curve ingestion.
  • ASTM D86/D1160-style distillation representations where implementation is legally and technically appropriate.
  • Conversion between supported distillation-curve representations using published correlations with explicit provenance and validity limits.
  • Pseudo-component generation from boiling-range cuts.
  • Characterization from combinations of boiling point/range, density or specific gravity, API gravity and molecular weight.
  • Watson/UOP K factor and other useful characterization descriptors.
  • Heavy-end / plus-fraction splitting and lumping.
  • Preserve characterization metadata and provenance through calculations.
  • Re-lumping/re-characterization APIs suitable for refinery flowsheets.

Acceptance criteria

  • Public reference datasets with regression tests.
  • Mass and composition conservation demonstrated for splitting/lumping workflows.
  • Round-trip characterization behavior documented where mathematically possible.
  • Java and Python APIs.
  • Clear warnings for extrapolation outside correlation ranges.

B. Refinery stream properties and product specifications

Provide first-class refinery properties rather than requiring users to reconstruct them externally.

Candidate properties include:

  • API gravity / specific gravity
  • average molecular weight
  • density and viscosity
  • normal/mean boiling descriptors
  • RVP/TVP and volatility indicators where technically well-defined
  • distillation curves and boiling-range yields
  • heating value / energy density
  • sulfur or other assay-carried quality attributes when represented in the feed model
  • flash point, pour/cloud point or other quality correlations only when sufficiently validated public correlations exist
  • quality/property mixing rules with explicit linear/nonlinear assumptions

Each property must expose units, source/model provenance, applicability range and validation evidence where possible.

C. Thermodynamic robustness for refinery fluids

Refinery support depends on reliable thermodynamics for very broad boiling ranges and heavy pseudo-components.

Required work

  • Validate SRK/PR/CPA and relevant mixing-rule behavior for heavy characterized fractions.
  • Stable TP/PH/PS flash behavior over atmospheric and vacuum tower conditions.
  • Reliable vapor/liquid root selection for wide-boiling mixtures.
  • Bubble/dew/saturation calculations with pseudo-components.
  • Numerical behavior for traces of water/light gases in heavy feeds.
  • Energy/enthalpy consistency for heating, cooling and fractionation calculations.
  • Detect and report unsupported extrapolation rather than silently returning questionable results.

Do not introduce refinery-specific hacks into generic flash algorithms. Generic thermodynamic fixes should be coordinated with the relevant flash/thermodynamic roadmaps.

D. Atmospheric and vacuum fractionation

Make rigorous fractionation the central refinery unit-operation milestone.

Scope

  • Atmospheric crude column workflows using existing NeqSim column abstractions where possible.
  • Vacuum fractionation and low-pressure robustness.
  • Side draws.
  • Pump-around loops.
  • Side strippers where supported by the process architecture.
  • Condenser/reboiler and heat-balance handling appropriate to refinery service.
  • Cut-point targeting / product-yield calculations.
  • Column initialization and convergence improvements for very broad boiling mixtures.

Acceptance benchmark

Create at least one open/reference refinery fractionation case with:

  • crude/pseudo-component feed characterization;
  • atmospheric tower;
  • multiple products/cuts;
  • mass and energy balance closure;
  • documented product boiling ranges/yields;
  • repeatable Java/Python calculation.

E. Refinery front-end equipment

Prioritize models that compose naturally with ProcessSystem:

  • crude preheat train workflows
  • fired heater/furnace duty, fuel demand and emissions
  • stabilizers/splitters
  • flash drums
  • desalting as an engineering/conceptual model where defensible
  • heat-exchanger and utility integration
  • compressor/pump energy

Prefer reusable equipment APIs over refinery-only monolithic classes.

F. Blending and optimization

Add refinery/product blending as a first-class optimization problem.

Scope

  • crude blending
  • intermediate/product blending
  • linear property blending where valid
  • nonlinear blending correlations where published and validated
  • product quality constraints
  • economic/objective-function interfaces
  • integration with NeqSim optimization facilities

Representative use case:
minimize blend cost or energy while satisfying density/API, volatility, boiling-range and other represented specifications.

G. Conversion-unit engineering models — later phase

Only implement models for which NeqSim can provide transparent assumptions and credible validation.

Potential sequence:

  1. hydrotreating / HDS engineering model
  2. catalytic reforming simplified yield/property model
  3. hydrocracking simplified yield model
  4. FCC yield/surrogate model
  5. coking or other conversion models if justified

Initially favor:

  • yield/reactor-surrogate models;
  • hydrogen consumption;
  • heat duty;
  • gas/liquid/product distribution;
  • sulfur/removal bookkeeping;
  • process integration.

High-fidelity proprietary-style kinetic packages are not required for campaign success.

H. Energy, emissions and economics

Refinery workflows should naturally connect to NeqSim's broader process capabilities:

  • fired-heater fuel consumption
  • compressor/pump power
  • steam/utility duties
  • hydrogen demand
  • CO2 emissions
  • heat integration metrics
  • simple operating-cost/economic metrics

I. Validation, provenance and uncertainty

This is a differentiator for NeqSim and is mandatory.

For each substantial model/correlation, record where practical:

  • publication/DOI/stable public reference;
  • equation/model name;
  • implementation assumptions;
  • parameter provenance/licensing;
  • units and basis;
  • stated validity range;
  • validation dataset;
  • error/uncertainty statistics;
  • extrapolation behavior.

Prefer primary literature, NIST/API/public government datasets, openly licensed academic data and reproducible benchmark cases.


Reference implementation roadmap

Phase 0 — inventory and benchmark

  • Inventory existing NeqSim petroleum fraction, characterization, distillation, column and refinery-adjacent code/tests/docs.
  • Identify duplicated/dead/inconsistent APIs.
  • Build and maintain a refinery capability/gap matrix.
  • Select the highest-value reusable foundation instead of creating parallel APIs.

Phase 1 — characterization foundation

  • Unified assay/petroleum fraction model.
  • TBP/boiling curves.
  • Pseudo-component generation/splitting/lumping.
  • Characterization validation suite.

Phase 2 — property framework

  • Refinery stream property API.
  • Validation and provenance.
  • Mixing/blending property framework.

Phase 3 — fractionation

  • Broad-boiling-mixture column robustness.
  • Atmospheric fractionation reference case.
  • Vacuum fractionation reference case.
  • Side draws/pump-around workflows as supported.

Phase 4 — refinery process workflow

Create an end-to-end example:
crude assay → characterization → preheat → furnace → atmospheric column → products → vacuum/feed preparation → utilities/emissions.

Phase 5 — blending/optimization

  • Crude and product blending.
  • Specification constraints.
  • Optimization examples.

Phase 6 — selected conversion models

Add only validated engineering-level models justified by public data and demonstrated user value.


Engineering quality gates

A refinery increment is not complete merely because an API exists.

Every implementation PR should, where applicable, include:

  • focused unit tests;
  • regression tests;
  • mass/element/energy balance checks;
  • literature/public-data validation;
  • numerical edge cases;
  • Java API coverage;
  • Python accessibility/example;
  • documentation of assumptions/limits;
  • no unexplained degradation of generic thermodynamic behavior.

For numerical changes, compare accuracy and runtime before/after and preserve representative benchmark results.

Definition of campaign success

The campaign can be considered mature when NeqSim can reproducibly simulate a representative refinery front-end from crude characterization through atmospheric/vacuum separation and product blending, with:

  • robust heavy-fraction thermodynamics;
  • realistic refinery stream properties;
  • reusable ProcessSystem equipment;
  • energy/emission accounting;
  • Java/Python workflows;
  • published validation evidence and limitations;
  • regression-protected benchmark cases;
  • an explicit documented gap list for functionality intentionally left to specialist refinery simulators.

Campaign governance

  • Maintain at most one active implementation PR for this issue at any time.
  • Respect the portfolio cap of no more than ten open autonomous NeqSim campaign implementation PRs overall.
  • At the start of every run, read this issue and newest comments, current master, repository instructions, relevant source/tests/docs, active/recent related issues and PRs, reviews/checks, recent commits and the previous refinery campaign ledger/progress comment.
  • If an active [Campaign] Refinery simulation: crude assays, petroleum fractions, fractionation, blending and conversion models #3305 implementation PR exists, work only on its exact current remote head and advance/repair/validate it before considering new work.
  • Do not merge or rebase master into an active campaign PR merely to continue or repair it.
  • If no active [Campaign] Refinery simulation: crude assays, petroleum fractions, fractionation, blending and conversion models #3305 PR exists, verify the previous increment is merged/closed and a campaign slot is available before creating one draft PR.
  • Maximize useful work per PR: implement the largest coherent dependency-ready batch that can be responsibly reviewed and validated.
  • Coordinate generic thermodynamics/TP-flash/performance/dynamics work with their owning NeqSim roadmaps instead of duplicating fixes here.
  • Use the connected GitHub repository state as authoritative for campaign continuity.
  • Local Maven/Java/Python validation is useful but not a prerequisite for advancing an existing PR. If unavailable, use GitHub CI and state VALIDATION PENDING CI or VALIDATION BLOCKED BY INFRASTRUCTURE; never claim an unrun check passed.
  • Do not modify scientific code merely to silence transient runner/network/infrastructure failures.
  • Keep a concise campaign ledger in [Campaign] Refinery simulation: crude assays, petroleum fractions, fractionation, blending and conversion models #3305 after meaningful increments: exact PR/head, validation status, capability gained, benchmark evidence, remaining highest-value gaps and recommended next dependency-ready increment.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions