Simulator#

class resmda.reservoir_simulator.Simulator(nx, ny, phi=0.2, c_f=1e-05, p0=1.0, rho0=1.0, mu_w=1.0, rw=0.15, pres_ini=150.0, wells=None, dx=50.0, dz=10.0)[source]#

Bases: object

A small 2D Reservoir Simulator.

2D connection-based, single-phase, single-component system using the Darcy assumption, employing backward Euler for time discretization and finite volume for space discretization. It simulates a single-phase fluid (likely water) with compressibility in a reservoir with constant porosity and a heterogeneous permeability field. The simulator utilizes SciPy’s sparse.linalg.solve for pressure solutions and calculates transmissibilities for inter-block connections. Well modeling is handled through the Peaceman well model for well indices, with constant pressure boundary conditions for injection and production wells. The simulation operates on a 2D grid with user-defined dimensions (nx, ny), uses flexible time steps, and starts from a specified initial pressure condition. Physical processes accounted for include fluid density changes with pressure (modeling a slightly compressible fluid) while assuming constant fluid viscosity.”

Created by following the course AESM304A - Flow and Simulation of Subsurface processes at Delft University of Technology (TUD); this particular part was taught by Dr. D.V. Voskov, https://orcid.org/0000-0002-5399-1755.

Parameters:
nx, nyint

Dimension of field (number of cells).

phifloat, default: 0.2

Porosity (-).

c_ffloat, default: 1e-5

Formation compressibility (1/kPa).

p0float, default: 1.0

Zero pressure (bar).

rho0float, default: 1.0

Fixed density (kg/m3).

mu_wfloat, default: 1.0

Viscosity (cP).

rwfloat, default: 0.15

Well radius (m).

pres_inifloat, default: 150.0

Initial well pressure (bar).

wells{ndarray, None}, default: None

Nd array of shape (nwells, 3), indicating well locations (with cell indices) and pressure. If None, the default is used, which is

np.array([[0, 0, 180], [self.nx-1, self.ny-1, 120]])

corresponding to a well in the first and in the last cell, with a pressure of 180 and 120, respectively.

dx, dzfloats, default: 50.0, 10.0

Cell dimensions in horizontal (dx) and vertical (dz) directions (m).

Methods Summary

__call__(perm_fields[, dt, data])

Run simulator.

solve(pressure, dt)

Construct & solve K-matrix for the simulation of pressure over time.

Methods Documentation

__call__(perm_fields, dt=array([0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001]), data=False)[source]#

Run simulator.

Run the simulation across multiple time steps and possibly multiple permeability scenarios.

Parameters:
perm_fieldsndarray

Permeability fields (mD) to simulate, either of dimension (ne, nx, ny), or of dimension (nx, ny).

dtndarray, default: np.ones(10)*0.0001

Time steps to use for simulation (days).

data{False, [ndarray, ndarray]}, default: False

Specific indices [nx, ny] to output data for; if False, return all data

Returns:
simulationndarray

Simulation results over time for given permeability fields.

solve(pressure, dt)[source]#

Construct & solve K-matrix for the simulation of pressure over time.

Parameters:
pressurendarray

Current pressure state of the reservoir of size self.size.

dtfloat

Time step for the simulation (days).

Returns:
pressurendarray

Pressure state after applying the time step, of size self.size.