****************** Configuration file ****************** In the initial development of **pyopmspe11**, the adopted configuration file format was the one described below, i.e., via :ref:`txt` files. The current development of **pyopmspe11** considers :ref:`toml` files. To keep compatibility with previous configuration files and Python versions of at least 3.8, then support for :ref:`txt` files will be kept, while new features will by added using :ref:`toml` configuration files (which requires at least Python3.11). .. _txt: === txt === The first input parameter in the configuration file is: .. code-block:: python :linenos: """Set the full path to the flow executable and flags""" flow --relaxed-max-pv-fraction=0 --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=cpr_trueimpes to change the linear solver, by tightening the cnv tolerances (\-\-tolerance-cnv), etc.). ---------------------------- Reservoir-related parameters ---------------------------- The following input lines in the configuration file are: .. code-block:: python :linenos: :lineno-start: 4 """Set the model parameters""" spe11c master #Name of the spe case (spe11a, spe11b, or spe11c) and OPM Flow version (master or release) complete gaswater #Name of the co2 model (immiscible, convective, or complete) and co2store implementation (gaswater or gasoil [oil properties are set to water internally in OPM flow]) corner-point #Type of grid (cartesian, tensor, or corner-point) 8400 5000 1200 #Length, width, and depth [m] 420 #If cartesian, number of x cells [-]; otherwise, variable array of x-refinement 30,40,50,40,30 #If cartesian, number of y cells [-]; otherwise, variable array of y-refinement [-] (for spe11c) 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-refinement; if corner-point, fix array of z-refinement (18 entries) 70 36.12 #Temperature bottom and top rig [C] 300 3e7 0.1 #Datum [m], pressure at the datum [Pa], and multiplier for the permeability in the z direction [-] 1e-9 2e-8 #Diffusion (in liquid and gas) [m^2/s] 8.5e-1 2500 #Rock specific heat and density (for spe11b/c) 0 5e4 1 #Added pore volume on top boundary (for spe11a [if 0, free flow bc]), pore volume on lateral boundaries, and width of buffer cell [m] (for spe11b/c) 150 10 #Elevation of the parabola and back [m] (for spe11c) In line 5 you specify if you are using OPM Flow from the master branch or from the latest stable release (OPM-flow 2024.04 release). This since there are continuous changues in the OPM master branch. Then we will keep updating the decks for using Flow from master and also we will keep the framework to produce decks compatible for the latest OPM stable release. The immiscible model allows for faster prototyping while the complete model includes dissolution of the components in the gas and liquid phases, in addition to thermal effects. Details on the convective model can be found in `Mykkeltvedt et al. (2025) `_. Regarding the grid type, the cartesian mode generates an uniform grid with the defined number of elements in lines 9 to 11. The tensor grid allows to define arrays in each direction where the grid is first divided with the number of entries in the array, and after it divides each of these elements by the assigned number in the array entry. The corner-point mode generates a grid where the x and y direction are defined as in the array mode, but the cell faces in the z-direction follows the lines as defined in the `lines_coordinates.geo `_ script, resulting in 18 levels. Then, the z-refinement in each of these levels is set. See the configuration files in the `tests `_ and `examples `_ folder for the setting of these grids. .. figure:: figs/satnum.png .. figure:: figs/fipnum.png Corner-point grid generated by the configuration file (INJ0 the horizontal well and INJ1 the curve well). The top figure shows the 7 different facies, while the bottom figure shows the fipnum numbers used to identify the boxes (A, B, and C), sensors, and the required regions to report the benchmark data. ----------------------- Soil-related parameters ----------------------- The following entries define the properties of the different facies: .. code-block:: python :linenos: :lineno-start: 19 """Set the saturation functions""" (max(0, (s_w - swi) / (1 - swi))) ** 1.5 #Wetting rel perm saturation function [-] (max(0, (1 - s_w - sni) / (1 - sni))) ** 1.5 #Non-wetting rel perm saturation function [-] penmax * math.erf(pen * ((s_w-swi) / (1.-swi)) ** (-(1.0 / 1.5)) * math.pi**0.5 / (penmax * 2)) #Capillary pressure saturation function [Pa] (np.exp(np.flip(np.linspace(0, 5.0, npoints))) - 1) / (np.exp(5.0) - 1) #Points to evaluate the saturation functions (s_w) [-] """Properties sat functions""" """swi [-], sni [-], pen [Pa], penmax [Pa], npoints [-]""" SWI1 0.32 SNI1 0.1 PEN1 193531.39 PENMAX1 3e7 NPOINTS1 1000 SWI2 0.14 SNI2 0.1 PEN2 8654.99 PENMAX2 3e7 NPOINTS2 1000 SWI3 0.12 SNI3 0.1 PEN3 6120.00 PENMAX3 3e7 NPOINTS3 1000 SWI4 0.12 SNI4 0.1 PEN4 3870.63 PENMAX4 3e7 NPOINTS4 1000 SWI5 0.12 SNI5 0.1 PEN5 3060.00 PENMAX5 3e7 NPOINTS5 1000 SWI6 0.10 SNI6 0.1 PEN6 2560.18 PENMAX6 3e7 NPOINTS6 1000 SWI7 0 SNI7 0 PEN7 0 PENMAX7 3e7 NPOINTS7 2 """Properties rock""" """K [mD], phi [-], disp [m], thconr [W m-1 K-1]""" PERM1 0.10132 PORO1 0.10 DISP1 10 THCONR1 1.90 PERM2 101.324 PORO2 0.20 DISP2 10 THCONR2 1.25 PERM3 202.650 PORO3 0.20 DISP3 10 THCONR3 1.25 PERM4 506.625 PORO4 0.20 DISP4 10 THCONR4 1.25 PERM5 1013.25 PORO5 0.25 DISP5 10 THCONR5 0.92 PERM6 2026.50 PORO6 0.35 DISP6 10 THCONR6 0.26 PERM7 1e-5 PORO7 1e-6 DISP7 0 THCONR7 2.00 .. figure:: figs/kr.png .. figure:: figs/cap.png Visualization in ResInsight of the relative permeability and capillary pressure functions in the facie 1. ----------------------- Well-related parameters ----------------------- The last part of the configuration file sets the wells radius, location, and the injection schedule. .. code-block:: python :linenos: :lineno-start: 45 """Wells radius and position""" """radius (0 to use the SOURCE keyword instead of well keywords), x, y, and z position [m] (final positions as well for spe11c)""" 0.15 2700. 1000. 300. 2700. 4000. 300. #Well 1 0.15 5100. 1000. 700. 5100. 4000. 700. #Well 2 """Define the injection values ([hours] for spe11a; [years] for spe11b/c)""" """injection time, time step size to write results, maximum solver time step, injected fluid (0 water, 1 co2) (well1), injection rate [kg/s] (well1), temperature [C] (well1), injected fluid (0 water, 1 co2) (well2), ...""" 999.9 999.9 100 1 0 10 1 0 10 0.1 0.1 0.1 1 0 10 1 0 10 25 5 5 1 50 10 1 0 10 25 5 5 1 50 10 1 50 10 50 25 25 1 0 10 1 0 10 400 50 50 1 0 10 1 0 10 500 100 100 1 0 10 1 0 10 .. warning:: Keep the linebreak between the sections (in the current implementation this is used for the reading of the parameters). .. _toml: ==== toml ==== The previous configuration file can be written using the widely in-use `toml format `_ as: .. code-block:: python :linenos: # Set the full path to the flow executable and flags flow = "flow --relaxed-max-pv-fraction=0 --enable-tuning=true --enable-opm-rst-file=true --output-extra-convergence-info=steps,iterations" # Set the model parameters spe11 = "spe11c" # Name of the spe case (spe11a, spe11b, or spe11c) version = "release" # OPM Flow version (release or master) model = "complete" # Name of the co2 model (immiscible, convective, or complete) co2store = "gaswater" # co2store implementation (gaswater or gasoil [oil properties are set to water internally in OPM flow]) grid = "corner-point" # Type of grid (cartesian, tensor, or corner-point) dims = [8400.0, 5000.0, 1200.0] # Length, width, and depth [m] x_n = [420] # If cartesian, number of x cells [-]; otherwise, variable array of x-refinement y_n = [30, 40, 50, 40, 30] # If cartesian, number of y cells [-]; otherwise, variable array of y-refinement [-] (for spe11c) z_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-refinement; if corner-point, fix array of z-refinement (18 entries) temperature = [70.0, 36.12] # Temperature bottom and top rig [C] datum = 300 # Datum [m] pressure = 3e7 # Pressure at the datum [Pa] kzMult = 0.1 # Multiplier for the permeability in the z direction [-] diffusion = [1e-9, 2e-8] # Diffusion (in liquid and gas) [m^2/s] rockExtra = [8.5e-1, 2500.0] # Rock specific heat capacity [kJ/(kg K)] and rock density [kg/m^3] (for spe11b/c) pvAdded = 5e4 # Extra pore volume per area on lateral boundaries [m] (for spe11b/c) widthBuffer = 1 # Width of buffer cells [m] (for spe11b/c) elevation = 150 # Maximum elevation difference (relative to the baseline gradient) of the arch in the y direction [m] (for spe11c) backElevation = 10 # Back boundary elevation w.r.t the front boundary [m] (for spe11c) dispersion = [10, 10, 10, 10, 10, 10, 0] # Dispersion rock [m], facie 1 to 7 rockCond = [1.9, 1.25, 1.25, 1.25, 0.92, 0.26, 2.0] # Thermal conductivity rock [W/(m K)], facie 1 to 7 radius = [0.15, 0.15] # Wells radius [m] (0 to use the SOURCE keyword instead of well keywords), well 1 to 2 wellCoord = [[2700.0, 1000.0, 300.0], [5100.0, 1000.0, 700.0]] # Well positions: x, y, and z coordinates [m], well 1 to 2 wellCoordF = [[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) # Set the saturation functions krw = "(max(0, (s_w - swi) / (1 - swi))) ** 1.5" # Wetting rel perm saturation function [-] krn = "(max(0, (1 - s_w - sni) / (1 - sni))) ** 1.5" # Non-wetting rel perm saturation function [-] pcap = "penmax * math.erf(pen * ((s_w-swi) / (1.-swi)) ** (-(1.0 / 1.5)) * math.pi**0.5 / (penmax * 2))" # Capillary pressure saturation function [Pa] s_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) [-] # Properties sat functions: 1) swi [-], 2) sni [-], 3) pen [Pa], 4) penmax [Pa], and 5) npoints [-], facie 1 to 7 safu = [[0.32, 0.1, 193531.39, 3e7, 1000], [0.14, 0.1, 8654.99, 3e7, 1000], [0.12, 0.1, 6120.00, 3e7, 1000], [0.12, 0.1, 3870.63, 3e7, 1000], [0.12, 0.1, 3060.00, 3e7, 1000], [0.10, 0.1, 2560.18, 3e7, 1000], [0, 0, 0, 3e7, 2]] # Properties rock: 1) K [mD] and 2) phi [-], facie 1 to 7 rock = [[0.10132, 0.10], [101.324, 0.20], [202.650, 0.20], [506.625, 0.20], [1013.25, 0.25], [2026.50, 0.35], [1e-5, 1e-6]] # 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) inj = [[999.9, 999.9, 100, 1, 0, 10, 1, 0, 10], [ 0.1, 0.1, 0.1, 1, 0, 10, 1, 0, 10], [ 25, 5, 5, 1, 50, 10, 1, 0, 10], [ 25, 5, 5, 1, 50, 10, 1, 50, 10], [ 50, 25, 25, 1, 0, 10, 1, 0, 10], [ 400, 50, 50, 1, 0, 10, 1, 0, 10], [ 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 :ref:`txt` configuration files.