Skip to main content
Glama

pyResToolbox MCP Server

rachford_rice_flash

Calculate vapor fraction and phase compositions for vapor-liquid equilibrium using the Rachford-Rice equation. Essential for separator design, compositional analysis, and phase behavior calculations in petroleum engineering.

Instructions

Solve Rachford-Rice equation for vapor-liquid equilibrium.

PHASE BEHAVIOR TOOL - Calculates vapor fraction (beta) and phase compositions for two-phase flash at specified pressure and temperature. Essential for compositional analysis, separator design, and phase behavior calculations.

Parameters:

  • zis (list, required): Overall mole fractions of components (0-1). Must sum to 1.0. Length must match Kis. Example: [0.5, 0.3, 0.2] for 3 components.

  • Kis (list, required): Equilibrium ratios (K-values) for components. Ki = yi/xi where yi = vapor mole fraction, xi = liquid mole fraction. Length must match zis. Example: [2.5, 1.8, 0.6]. K > 1 = light component.

Rachford-Rice Equation: Σ[zi(Ki - 1) / (1 + β(Ki - 1))] = 0

Where:

  • zi = overall mole fraction of component i

  • Ki = equilibrium ratio (yi/xi) for component i

  • β = vapor mole fraction (0 to 1)

Phase Behavior:

  • β = 0: All liquid (subcooled)

  • 0 < β < 1: Two-phase (vapor + liquid)

  • β = 1: All vapor (superheated)

K-Value Behavior:

  • K > 1: Component prefers vapor phase (light components)

  • K = 1: Component equally distributed (critical component)

  • K < 1: Component prefers liquid phase (heavy components)

  • K-values depend on pressure, temperature, and composition

Solution Method: Iterative Newton-Raphson method with bounds checking (0 ≤ β ≤ 1). Converges rapidly for well-posed problems. Typically converges in 3-10 iterations.

Applications:

  • Gas-Oil Separator Design: Determine separator conditions for phase split

  • Phase Envelope: Calculate bubble/dew points and phase boundaries

  • Compositional Simulation: Flash calculations in compositional models

  • EOS Flash: Solve equation of state flash calculations

  • Surface Facility Design: Design separation trains and processing units

  • Material Balance: Phase split in material balance calculations

Returns: Dictionary with:

  • vapor_fraction (float): Vapor mole fraction β (0-1)

  • liquid_composition (list): Liquid phase mole fractions xi

  • vapor_composition (list): Vapor phase mole fractions yi

  • method (str): "Rachford-Rice (Newton-Raphson)"

  • note (str): Interpretation guidance

  • inputs (dict): Echo of input parameters

Common Mistakes:

  • Mole fractions don't sum to 1.0 (must normalize)

  • K-values don't match components (length mismatch)

  • K-values at wrong P-T conditions (must match flash conditions)

  • Using weight fractions instead of mole fractions

  • Not accounting for non-hydrocarbon components

  • K-values from wrong correlation/EOS

Example Usage:

{ "zis": [0.5, 0.3, 0.2], "Kis": [2.5, 1.8, 0.6] }

Result: β ≈ 0.3-0.5 (two-phase), with light components enriched in vapor, heavy components enriched in liquid.

Note: Rachford-Rice equation assumes ideal mixing. For real systems, K-values must account for non-ideality (activity coefficients, fugacity). K-values are typically obtained from EOS (Peng-Robinson, Soave-Redlich-Kwong) or correlations (Wilson, Standing). Always ensure K-values match flash conditions.

Input Schema

NameRequiredDescriptionDefault
requestYes

Input Schema (JSON Schema)

{ "properties": { "request": { "$ref": "#/$defs/RachfordRiceRequest" } }, "required": [ "request" ], "type": "object" }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/gabrielserrao/pyrestoolbox-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server