Skip to the content.

NeqSim Thermodynamics Guide

NeqSim (Non-Equilibrium Simulator) is a comprehensive library for thermodynamic calculations, specializing in oil and gas fluids, CO2 systems, and aqueous electrolytes. This guide provides an overview of the available models, methods, and how to use them.

1. Thermodynamic Models (Equations of State)

The core of any simulation is the Equation of State (EOS). NeqSim supports a wide range of EOSs tailored for different applications.

1.1 Cubic Equations of State

Standard models for oil and gas processing.

1.2 Cubic Plus Association (CPA)

Essential for systems containing polar molecules (water, methanol, glycol) and hydrocarbons. It combines a cubic EOS (SRK or PR) with an association term (Wertheim).

1.3 Reference Equations

High-precision multiparameter equations for specific fluids or mixtures.

1.4 Electrolyte Models

For systems containing salts and ions.

2. Mixing Rules

Mixing rules define how pure component parameters are combined for mixtures.

3. Flash Calculations

NeqSim performs various types of equilibrium calculations (flashes) via the ThermodynamicOperations class.

3.1 Standard Flashes

3.2 Saturation Points

3.3 Solid Formation

4. Physical Properties

Once a flash is performed, physical properties are available from the Phase objects.

5. Code Examples

Java Example: Natural Gas Dew Point

import neqsim.thermo.system.SystemSrkEos;
import neqsim.thermodynamicoperations.ThermodynamicOperations;

public class DewPointExample {
    public static void main(String[] args) {
        // 1. Create System
        SystemSrkEos gas = new SystemSrkEos(298.15, 50.0);
        gas.addComponent("methane", 90.0);
        gas.addComponent("ethane", 5.0);
        gas.addComponent("propane", 3.0);
        gas.addComponent("water", 0.1); // Saturated water
        
        // 2. Set Mixing Rule
        gas.setMixingRule("classic");
        
        // 3. Initialize Operations
        ThermodynamicOperations ops = new ThermodynamicOperations(gas);
        
        // 4. Calculate Hydrocarbon Dew Point
        try {
            ops.dewPointTemperatureFlash();
            System.out.println("HC Dew Point: " + gas.getTemperature("C") + " C");
        } catch (Exception e) {
            e.printStackTrace();
        }
        
        // 5. Calculate Water Dew Point
        try {
            ops.waterDewPointTemperatureFlash();
            System.out.println("Water Dew Point: " + gas.getTemperature("C") + " C");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

Python Example: CO2 Density with GERG-2008

from neqsim.thermo import SystemGERG2008Eos
from neqsim.thermodynamicoperations import ThermodynamicOperations

# 1. Create System
co2 = SystemGERG2008Eos(300.0, 100.0) # 300 K, 100 bar
co2.addComponent("CO2", 1.0)

# 2. Flash
ops = ThermodynamicOperations(co2)
ops.TPflash()

# 3. Get Properties
rho = co2.getPhase(0).getDensity("kg/m3")
print(f"CO2 Density at 100 bar/300 K: {rho} kg/m3")

6. Fluid Characterization

For real reservoir fluids containing heavy fractions (C7+), NeqSim provides tools to characterize the fluid based on specific gravity and molecular weight.

Advanced Options

See Fluid Characterization for details.