# Solvx ReservoirTools

A TypeScript client library for comprehensive reservoir engineering calculations, including PVT property calculations, Bottom Hole Pressure calculations, and Rate Transient Analysis.

**IMPORTANT: This is proprietary software owned by Nexa Consulting Services. Unauthorized use, distribution, or modification is strictly prohibited.**

## Installation

This is a private package. To install, you need to:
1. Obtain a license from Nexa Consulting Services
2. Get access to the private npm registry
3. Install using npm:

```bash
npm install solvx_reservoir_tools
```

## Usage

```typescript
import { SolvxaiClient } from 'solvx_reservoir_tools';

// Initialize the client
const client = new SolvxaiClient({
  baseUrl: 'https://your-api-url.com', //https://solvxai-pvt-services.vercel.app 
  apiKey: 'your-api-key' // contact sd@nexaconsultinc.com
});

// Calculate all PVT properties in one call
const pvtResult = await client.calculatePvtProperties({
  reservoir_temperature: 200,
  reservoir_pressure: 3000,
  api_gravity: 35,
  gas_specific_gravity: 0.7,
  gas_oil_ratio: 500,
  h2s_content: 0.1,
  co2_content: 0.5,
  n2_content: 0.2,
  water_salinity: 10000
});

// Calculate bubble point pressure
const pb = await client.calculatePbFromGor({
  correlation: 'STANDING',
  initial_gor: 500,
  gas_gravity: 0.7,
  api: 35,
  temperature: 200
});

// Calculate gas-oil ratio from bubble point pressure
const gor = await client.calculateGorFromPb({
  correlation: 'STANDING',
  pb: 2000,
  gas_gravity: 0.7,
  api: 35,
  temperature: 200
});

// Calculate oil formation volume factor
const bo = await client.calculateOilFvf({
  correlation: 'STANDING',
  temperature: 200,
  pressure: 3000,
  api: 35,
  gas_gravity: 0.7,
  pb: 2000
});

// Calculate gas formation volume factor
const bg = await client.calculateGasFvf({
  correlation: 'HALLYARBOROUGH',
  temperature: 200,
  pressure: 3000,
  gas_gravity: 0.7,
  n2_content: 0.2,
  co2_content: 0.5,
  h2s_content: 0.1
});

// Calculate gas compressibility factor (Z-factor)
const z = await client.calculateZFactor({
  correlation: 'HALLYARBOROUGH',
  temperature: 200,
  pressure: 3000,
  gas_gravity: 0.7,
  n2_content: 0.2,
  co2_content: 0.5,
  h2s_content: 0.1
});

// Calculate oil viscosity
const oilViscosity = await client.calculateOilViscosity({
  dead_oil_correlation: 'BEGGSROBINSON',
  saturated_correlation: 'BEGGSROBINSON',
  undersaturated_correlation: 'BEAL',
  api: 35,
  temperature: 200,
  pressure: 3000,
  gas_gravity: 0.7,
  pb: 2000
});

// Calculate gas viscosity
const gasViscosity = await client.calculateGasViscosity({
  correlation: 'CARRKOBAYASHI',
  temperature: 200,
  pressure: 3000,
  gas_gravity: 0.7,
  n2_content: 0.2,
  co2_content: 0.5,
  h2s_content: 0.1
});

// Calculate water properties
const waterProps = await client.calculateWaterProperties({
  reservoir_temperature: 200,
  pressure: 3000,
  water_salinity: 10000
});

// Calculate interfacial tension (oil-gas)
const ift = await client.calculateIftRamey({
  rs: 500,
  api: 35,
  gas_gravity: 0.7,
  bo: 1.2,
  pressure: 3000,
  temperature: 200,
  z: 0.9
});

// Calculate Bottom Hole Pressure (BHP)
const bhp = await client.calculateBhp({
  mt_data: {
    md: [0, 5000, 10000],
    tvd: [0, 4500, 9000]
  },
  annulus_data: {
    AnnulusFlow: 0,
    VaryAnnulus: 0,
    DepthVaryingAnnulus: 0,
    TopCasingDia: 0,
    AnTub: 0
  },
  tubular_data: {
    MDTubingShoe: 10000,
    CasingID: 4.892,
    TubingID: 2.441,
    TubingOD: 2.875,
    Datum: 10000,
    piperough: 0.0006
  },
  temperature_data: {
    md_temp: [0, 5000, 10000],
    temp: [100, 150, 200]
  },
  pvt_data: {
    API: 35,
    GG: 0.7,
    Salinity: 10000,
    correlation_name: 'HAGEDORN_BROWN'
  },
  production_data: {
    qo: 1000,
    qw: 500,
    qg: 1000,
    thp: 500,
    chp: 0
  },
  pvt_correlation_model: {
    pvt_model: 'VAZQUEZBEGGS',
    co_correlation: 'VAZQUEZBEGGS',
    dead_oil_viscosity_correlation: 'BEGGSROBINSON',
    saturated_oil_viscosity_correlation: 'BEGGSROBINSON',
    undersaturated_oil_viscosity_correlation: 'BEAL'
  }
});
```

## Features

- Calculate all PVT properties in one call
- Individual property calculations
- Support for multiple correlations
- Bottom Hole Pressure calculations
- TypeScript support
- Promise-based API

**Multiphase Flow Correlation Options:**
- `HAGEDORN_BROWN`: Hagedorn-Brown correlation
- `BEGGS_BRILL`: Beggs-Brill correlation
- `GRAY`: Gray correlation

**PVT Correlation Options:**
- `pvt_model`: STANDING, VAZQUEZBEGGS, GLASO
- `co_correlation`: VAZQUEZBEGGS, PETROSKYFARSHAD
- `dead_oil_viscosity_correlation`: BEAL, GLASO, BEGGSROBINSON, PETROSKYFARSHAD
- `saturated_oil_viscosity_correlation`: BEGGSROBINSON, PETROSKYFARSHAD, CHEWCONNALLY
- `undersaturated_oil_viscosity_correlation`: BEAL, BEGGSROBINSON, PETROSKYFARSHAD, VAZQUESBEGGS


## API Documentation

For detailed API documentation, please refer to the [OpenAPI specification](openapi.json).

## License

Proprietary - Nexa Consulting Services

This software is the property of Nexa Consulting Services and is protected by copyright law and international treaties. Any unauthorized reproduction, distribution, modification, or use of this software is strictly prohibited and may result in severe civil and criminal penalties.

### Terms of Use

1. This software is licensed, not sold
2. A valid license key is required for use
3. No modification of the source code is allowed
4. No redistribution is permitted
5. One license per installation/user (as specified in your license agreement)

For licensing inquiries, please contact:
- Email: [sd@nexaconsultinc.com]


© 2024 Nexa Consulting Services. All rights reserved.