Configuration file

In the initial development of pyopmspe11, the adopted configuration file format was the one described below, i.e., via txt files. The current development of pyopmspe11 considers toml files. To keep compatibility with previous configuration files and Python versions of at least 3.8, then support for txt files will be kept, while new features will by added using toml configuration files (which requires at least Python3.11).

txt

The first input parameter in the configuration file is:

1"""Set the full path to the flow executable and flags"""
2flow --enable-tuning=true --enable-opm-rst-file=true --output-extra-convergence-info=steps,iterations

If flow is not in your path, then write the full path to the executable (e.g., /Users/dmar/opm/build/opm-simulators/bin/flow). We also add in the same line as many flags as required (see the OPM Flow documentation here).

Note

If you have installed flow with MPI support, then you can run the simulations in parallel by adding mpirun -np N flow … where N is the number of cpus.

Tip

By executing flow -h you get an overview of the available flags in the flow simulator to improve/fix convergence and mass issues (i.e., by setting the flag --linear-solver=cprw to change the linear solver, by tightening the cnv tolerances (--tolerance-cnv), etc.).

toml

The previous configuration file can be written using the widely in-use toml format as:

 1# Set the full path to the flow executable and flags
 2flow = "flow --enable-tuning=true --enable-opm-rst-file=true --output-extra-convergence-info=steps,iterations"
 3
 4# Set the model parameters
 5spe11 = "spe11c" # Name of the spe case (spe11a, spe11b, or spe11c)
 6version = "release" # OPM Flow version (release or master)
 7model = "complete" # Name of the co2 model (immiscible, convective, or complete)
 8co2store = "gaswater" # co2store implementation (gaswater or gasoil [oil properties are set to water internally in OPM flow])
 9grid = "corner-point" # Type of grid (cartesian, tensor, or corner-point)
10dims = [8400.0, 5000.0, 1200.0] # Length, width, and depth [m]
11x_n = [420] # If cartesian, number of x cells [-]; otherwise, variable array of x-refinment
12y_n = [30, 40, 50, 40, 30] # If cartesian, number of y cells [-]; otherwise, variable array of y-refinment [-] (for spe11c)
13z_n = [5, 3, 1, 2, 3, 2, 4, 4, 10, 4, 6, 6, 4, 8, 4, 15, 30, 9] # If cartesian, number of z cells [-]; if tensor, variable array of z-refinment; if corner-point, fix array of z-refinment (18 entries)
14temperature = [70.0, 36.12] # Temperature bottom and top rig [C]
15datum = 300 # Datum [m]
16pressure = 3e7 # Pressure at the datum [Pa]
17kzMult = 0.1 # Multiplier for the permeability in the z direction [-]
18diffusion = [1e-9, 2e-8] # Diffusion (in liquid and gas) [m^2/s]
19rockExtra = [8.5e-1, 2500.0] # Rock specific heat capacity [kJ/(kg K)] and rock density [kg/m^3] (for spe11b/c)
20pvAdded = 5e4  # Extra pore volume per area on lateral boundaries [m] (for spe11b/c)
21widthBuffer = 1 # Width of buffer cells [m] (for spe11b/c)
22elevation = 150 # Maximum elevation difference (relative to the baseline gradient) of the arch in the y direction [m] (for spe11c)
23backElevation = 10 # Back boundary elevation w.r.t the front boundary [m] (for spe11c)
24dispersion = [10, 10, 10, 10, 10, 10, 0] # Dispersion rock [m], facie 1 to 7
25rockCond = [1.9, 1.25, 1.25, 1.25, 0.92, 0.26, 2.0] # Thermal conductivity rock [W/(m K)], facie 1 to 7
26radius = [0.15, 0.15] # Wells radius [m] (0 to use the SOURCE keyword instead of well keywords), well 1 to 2
27wellCoord = [[2700.0, 1000.0, 300.0], [5100.0, 1000.0, 700.0]] # Well positions: x, y, and z coordinates [m], well 1 to 2
28wellCoordF = [[2700.0, 4000.0, 300.0], [5100.0, 4000.0, 700.0]] # Well final positions: x, y, and z coordinates [m], well 1 to 2 (for spe11c)
29
30# Set the saturation functions
31krw = "(max(0, (s_w - swi) / (1 - swi))) ** 1.5"                                                         # Wetting rel perm saturation function [-]
32krn = "(max(0, (1 - s_w - sni) / (1 - sni))) ** 1.5"                                                     # Non-wetting rel perm saturation function [-]
33pcap = "penmax * math.erf(pen * ((s_w-swi) / (1.-swi)) ** (-(1.0 / 1.5)) * math.pi**0.5 / (penmax * 2))" # Capillary pressure saturation function [Pa]
34s_w = "(np.exp(np.flip(np.linspace(0, 5.0, npoints))) - 1) / (np.exp(5.0) - 1)"                          # Points to evaluate the saturation functions (s_w) [-]
35
36# Properties sat functions: 1) swi [-], 2) sni [-], 3) pen [Pa], 4) penmax [Pa], and 5) npoints [-], facie 1 to 7
37safu = [[0.32, 0.1, 193531.39, 3e7, 1000],
38        [0.14, 0.1, 8654.99,   3e7, 1000],
39        [0.12, 0.1, 6120.00,   3e7, 1000],
40        [0.12, 0.1, 3870.63,   3e7, 1000],
41        [0.12, 0.1, 3060.00,   3e7, 1000],
42        [0.10, 0.1, 2560.18,   3e7, 1000],
43        [0,      0,       0,   3e7,    2]]
44
45# Properties rock: 1) K [mD] and 2) phi [-], facie 1 to 7
46rock = [[0.10132, 0.10],
47        [101.324, 0.20],
48        [202.650, 0.20],
49        [506.625, 0.20],
50        [1013.25, 0.25],
51        [2026.50, 0.35],
52        [1e-5,    1e-6]]
53
54# Define the injection values ([hours] for spe11a; [years] for spe11b/c): 1) injection time, 2) time step size to write results, 3) maximum solver time step, 4) injected fluid (0 water, 1 co2) (well1), 5) injection rate [kg/s] (well1), 6) temperature [C] (well1), 7) injected fluid (0 water, 1 co2) (well2), 8) injection rate [kg/s] (well2), and 9) temperature [C] (well2)
55inj = [[999.9, 999.9, 100, 1,  0, 10, 1,  0, 10],
56       [  0.1,   0.1, 0.1, 1,  0, 10, 1,  0, 10],
57       [   25,     5,   5, 1, 50, 10, 1,  0, 10],
58       [   25,     5,   5, 1, 50, 10, 1, 50, 10],
59       [   50,    25,  25, 1,  0, 10, 1,  0, 10],
60       [  400,    50,  50, 1,  0, 10, 1,  0, 10],
61       [  500,   100, 100, 1,  0, 10, 1,  0, 10]]

For additional examples of configuration files using toml, see the hello_world and configs folders.

Note

A Python version of at least 3.11 is requiered to use the toml format. For older Python versions, then use the txt configuration files.