Peng-Robinson Equation of State (1978) simulator for black oil phase behavior — bubble point, CCE, and differential liberation, running entirely in the browser.
Spring 2026 · Individual Project · 100% Client-Side
A browser-based PVT simulator that implements the Peng-Robinson Equation of State (1978) to model black oil phase behavior. Input a multicomponent hydrocarbon composition, and the simulator calculates saturation pressure, runs Constant Composition Expansion (CCE), and performs stepwise Differential Liberation (DL) — all with interactive charts and Excel export. No backend, no installation required.
Calculates Psat via successive substitution using fugacity equilibrium (φᵢᴸ = φᵢⱽ). Starting from Wilson's K-value correlation for initial estimates, the algorithm iterates until ΣKᵢxᵢ = 1 within tolerance of 10⁻⁷.
Simulates a PVT cell expansion at constant temperature and overall composition:
- Above Psat — single-phase liquid; computes Z-factor, molar volume, and oil density directly from the cubic EOS
- Below Psat — two-phase flash using Rachford-Rice with Newton-Raphson; computes liquid/vapor splits, phase densities, and total relative volume (V/Vsat)
Output properties: Relative Volume (Vrel), Oil Density (ρo), Gas Density (ρg)
Stepwise liberation simulating laboratory DL at reservoir temperature:
- Flash the current liquid at each pressure stage
- Remove all liberated gas
- Flash residual liquid to standard conditions (14.7 psia, 60°F) to obtain Vo,sc
- Compute all volumetric properties referenced to stock-tank barrel
Output properties: Oil FVF (Bo), Total FVF (BtD), Gas FVF (Bg), Solution GOR (RsD), Cumulative Released Gas (RsDb)
With the 1978 κ correlation:
| Component | Method |
|---|---|
| Cubic solver | Cardano's method — handles 1-root and 3-root regimes; selects min(Z) for liquid, max(Z) for vapor |
| Mixing rules | van der Waals one-fluid (kᵢⱼ = 0) |
| Fugacity coefficients | Analytical derivation from the PR EOS with component-specific partial derivatives |
| Flash convergence | Successive substitution on K-values; Rachford-Rice solved by Newton-Raphson; convergence criterion: Σ(Kᵢⁿ⁺¹/Kᵢⁿ − 1)² < 10⁻⁹ |
| DL gas removal | Moles of liberated gas tracked cumulatively; residual liquid recomposed at each stage |
| Standard conditions | Final flash of residual oil to 14.7 psia / 60°F for Bo and RsD normalization |
| Symbol | Value | Unit |
|---|---|---|
| R | 10.73146 | psia·ft³/(lb-mol·°R) |
| Ωa | 0.45724 | — |
| Ωb | 0.07780 | — |
| Component | zᵢ | Tc (°R) | Pc (psia) | ω | MW |
|---|---|---|---|---|---|
| Methane | 0.19962 | 343.00 | 666.40 | 0.01142 | 16.043 |
| Ethane | 0.10010 | 549.76 | 706.50 | 0.09950 | 30.070 |
| Propane | 0.18579 | 665.68 | 616.00 | 0.15230 | 44.097 |
| n-Butane | 0.09036 | 765.29 | 550.60 | 0.20020 | 58.124 |
| n-Pentane | 0.18851 | 845.37 | 488.78 | 0.25150 | 72.150 |
| Pseudo C6+ | 0.23563 | 913.32 | 436.29 | 0.29600 | 86.177 |
All values are editable in the UI. Reservoir temperature defaults to 129.7°F.
├── eos.ts # PR EOS class — parameters, cubic solver, fugacity coefficients
├── simulator.ts # MiniSimulator — Psat, CCE, and DL algorithms
├── App.tsx # React UI — input panel, charts (Recharts), Excel export
├── utils.ts # Tailwind utility helpers
├── index.css # Global styles and CSS theme variables
├── main.tsx # React entry point
└── vite.config.ts # Vite build configuration
| Layer | Technology |
|---|---|
| Language | TypeScript |
| Framework | React 19 |
| Build | Vite 6 |
| Styling | Tailwind CSS 4 |
| Charts | Recharts |
| Animations | Framer Motion |
| Export | SheetJS (xlsx) |
| Deployment | Vercel |
git clone https://github.com/jairam25/PETE-665-Mini-Simulator.git
cd PETE-665-Mini-Simulator
npm install
npm run dev
# → http://localhost:3000Click Download Results (.XLSX) after running a simulation. The Excel workbook contains three sheets:
- Fluid Properties — component table with zᵢ, Tc, Pc, ω, MW
- CCE Results — pressure, V/Vsat, ρo, ρg, Z-factor
- DL Results — pressure, Bo, BtD, Bg, RsD, RsDb, ρo
- Peng, D.-Y. & Robinson, D.B. (1976). A New Two-Constant Equation of State. Industrial & Engineering Chemistry Fundamentals, 15(1), 59–64.
- Peng, D.-Y. & Robinson, D.B. (1978). The Characterization of the Heptanes and Heavier Fractions for the GPA Peng-Robinson Programs. GPA Research Report RR-28.
- Pedersen, K.S., Christensen, P.L., & Shaikh, J.A. Phase Behavior of Petroleum Reservoir Fluids, Ch. 4.
- Rachford, H.H. & Rice, J.D. (1952). Procedure for Use of Electronic Digital Computers in Calculating Flash Vaporization Hydrocarbon Equilibrium. JPT, 4(10), 19.
👉 pete-665-mini-simulator.vercel.app
Built for PETE 665 — Advanced Reservoir Fluid Properties