The Matlab Reservoir Simulation Toolbox (MRST)
Transcription
The Matlab Reservoir Simulation Toolbox (MRST)
The Matlab Reservoir Simulation Toolbox (MRST) Knut–Andreas Lie, SINTEF, Oslo, Norway Edinburgh, 8th January 2014 Overview of lectures Lectures today: 1 Overview of MRST (this talk) 2 Getting started 3 Grids and petrophysical properties 4 Discretization on polyhedral grids 5 Fully implicit simulators using automatic differentiation On Friday: Fast simulation of large-scale CO2 storage: spill-point analysis and vertical-equilibrium models 1 / 21 The MATLAB Reservoir Simulation Toolbox (MRST) Open-source framework for rapid prototyping of new models and computational methods written in Matlab: I grid structure and grid factory routines I petrophysical data and incompressible fluid models I physical units and conversion routines between SI and common field units I routines for setting and manipulating boundary conditions, sources/sinks, and well models I reservoir state (pressure, fluxes, saturations,. . . ) I visualisation routines for cell and face data Light weight/ special purpose Black box/ general purpose physical/computational complexity 2 / 21 Why in MATLAB? Prototyping in a scripting language is much less time-consuming than in traditional compiled languages (C, C++, Fortran, . . . ) Explore alternative algorithms/implementations close to mathematics Gradually replace individual (or bottleneck) operations with accelerated editions callable from Matlab Direct access to Matlab environment and prototype whilst developing replacement components More experienced in Matlab/Octave than in e.g., Python If we were to start all over, we would probably have chosen Phyton 3 / 21 Why free and open source? Research strategy: Support reproducible research and promote replicability Preserve know-how and simplify reuse of results from previous research Accelerate relevant research by students and our peers Benchmarking: simplify comparison of different methods on standard test problems Marked strategy: Accelerate time-to-market for new technology Combined with publications: an efficient means to disseminate results while protecting IP rights In addition: research funded by the Research Council of Norway should be freely available 4 / 21 Two open-source initiatives Open Porous Media Initiative Matlab Reservoir Simulation Toolbox Initiated by Statoil Research Center Developed by SINTEF ICT for rapid prototyping Academic partners in Norway and Germany Add-on modules by others . . . Developed mainly in C++ MRST 2013a: 1000+ downloads since Apr 18th So far: special-purpose tools mostly MRST 2013b: 360+ downloads since Oct 18th General-purpose functionality in progress Industry use increasing http://www.opm-project.org http://www.sintef.no/MRST 5 / 21 How is MRST designed? 6 / 21 Grids and petrophysical properties The fundamental object in MRST is the grid: All grids are assumed to be unstructured Data structure for geometry and topology Several grid factory routines Input of industry-standard formats Physical quantities defined as dynamic objects in Matlab: Properties of medium: φ, K, net-to-gross, . . . Reservoir fluids: ρ, µ, kr , PVT, . . . Driving forces: wells, boundary conditions, sources Reservoir state: pressure, fluxes, saturations, . . . MRST operations accept, manipulate, and produce these objects Physical quantities are assumed to be in SI units (e.g., [K] = m2 , [µ] = Pa · s, . . . ). 7 / 21 Modules in MRST 8 / 21 Modules: mimetic and MPFA methods Consistent discretization methods capable of handling general polyhedral grids TPFA MFD MPFA Example: anisotropy ratio 1 : 1000, π/6 angle with grid directions → TPFA: montone, but qualitatively incorrect → mimetic/MPFA: nonmonotone, but qualitatively correct. 9 / 21 Modules: C-acceleration via mex interface Sequential solvers: Geometry calculation: threaded implementation in C Pressure: TPFA method in Matlab with AGMG linear solver 120 Transport: reorder method in C, cellwise solver with local control over iterations Transmissibility Solver Transport TOF Geometry 100 Time-of-flight: mldivide in Matlab seconds 80 60 Computer Dell Precision T5500 40 24 GiB memory, DIMM DDR3 1333 MHz 20 Intel Xeon X5690 @ 3.47 GHz, 6 cores Cache: 384 KiB (L1), 1536 KiB (L2), 12 MiB (L3) 0 0 2 4 6 8 10 Million cells 12 14 16 18 Example: Cartesian grid, heavy-oil fluid model, two saturation regions 10 / 21 Modules: fully-implicit simulators New feature in 2012b release: I fully implicit method as in commercial simulators I reads industry standard input decks I based on automatic differentiation I calculation of adjoints is greatly simplified I easy to extend to new models – you basically write the equations! I POD methods supported SPE1 benchmark 11 / 21 Modules: interactive visualization Features: Script-based visualization in core Visualization GUI in separate module plotGrid / plotCellData time steps and complex data sets plotFaces / plotFaceData dynamic histogram filtering plotWell / plotFaults filtering and logical indices ... geometric slicing 12 / 21 Modules: interactive visualization Features: Script-based visualization in core Visualization GUI in separate module plotGrid / plotCellData time steps and complex data sets plotFaces / plotFaceData dynamic histogram filtering plotWell / plotFaults filtering and logical indices ... geometric slicing 12 / 21 Modules: interactive visualization Features: Script-based visualization in core Visualization GUI in separate module plotGrid / plotCellData time steps and complex data sets plotFaces / plotFaceData dynamic histogram filtering plotWell / plotFaults filtering and logical indices ... geometric slicing 12 / 21 Modules: flow diagnostics Numerical methods for probing the reservoir: I time-of-flight (time lines in reservoir) I I Volumes per well pair tracer-partitions: drainage regions, swept regions, well-pair connections, well allocation factors, . . . heterogeneity measures: flow-capacity/storage-capacity, sweep efficiency, Lorenz coefficient, . . . 1% 20% 29% I1, P1 I2, P1 1% I1, P2 I2, P2 I1, P3 I2, P3 I1, P4 I2, P4 6% 19% 10% 13% 13 / 21 Modules: flow diagnostics Numerical methods for probing the reservoir: I time-of-flight (time lines in reservoir) I I tracer-partitions: drainage regions, swept regions, well-pair connections, well allocation factors, . . . heterogeneity measures: flow-capacity/storage-capacity, sweep efficiency, Lorenz coefficient, . . . Allocation factors I1 I2 50 50 40 40 30 30 20 20 P1 P1 P2 10 P2 10 P3 P3 P4 0 0.5 P4 1 0 P1 0.5 1 P2 50 50 40 40 30 30 20 20 I1 I1 10 10 I2 0 0.5 I2 1 0 P3 0.5 1 P4 50 50 40 40 30 30 20 20 I1 I1 10 10 I2 0 0.5 I2 1 0 0.5 1 13 / 21 Modules: flow diagnostics Numerical methods for probing the reservoir: I time-of-flight (time lines in reservoir) I tracer-partitions: drainage regions, swept regions, well-pair connections, well allocation factors, . . . I heterogeneity measures: flow-capacity/storage-capacity, sweep efficiency, Lorenz coefficient, . . . Quality of upscaling methods 13 / 21 Modules: coarsening by amalgamation Adapting to flow Different partitioning Dynamic coarsening Adapting to geology 14 / 21 Modules: upscaling Several upscaling methods: Analytical methods: geometric, harmonic, arithmetic Flow-based single-phase upscaling Steady-state upscaling capillary limit viscous limit general steady-state In-house: various experimental 15 / 21 Modules: multiscale methods Conservative fine-scale approximation at the cost of solving a coarse-scale problem (upscaling and downscaling in one step) Key idea of multiscale methods Local decomposition Multiscale basis functions: p = Φpc + p̃ v = Ψvc + ṽ homogeneous (RT0 ) heterogeneous 16 / 21 Modules: multiscale methods Multiscale mixed FEM: Multiscale finite-volume: Very flexible wrt fine/coarse grids Well developed wrt flow physics Automated coarsening demonstrated for structured and unstructured grids Primal/dual makes coarsening challenging Mixed formulation complicates physics Prototype of coarsening algorithms demonstrated 16 / 21 Modules: numerical CO2 laboratory Example: structural trapping in the Johansen formation (model from CO2 atlas) Features: scripts to download and process public data CO2 atlas Sleipner, Johansen IGEMS, .. simulation of basic trapping mechanisms structural residual solubility with detailed volumetric inventory interactive visualization of traps and spill point paths vertical-equilibrium simulation 3D simulations 17 / 21 Modules: numerical CO2 laboratory Example: migration in the uppermost geological layer of Sleipner (model from ieaghg.org) Features: scripts to download and process public data CO2 atlas Sleipner, Johansen IGEMS, .. simulation of basic trapping mechanisms structural residual solubility with detailed volumetric inventory interactive visualization of traps and spill point paths vertical-equilibrium simulation 3D simulations 17 / 21 Simple access to public data sets Simplified access to open data sets is one of our goals with MRST. To this end, we offer a large number of scripts and utility routines, including support of Eclipse input decks. SPE10 SAIGUP Johansen Model 2 from the 10th SPE Comparative Solution Project Realistic model of shallow-marine clastic reservoir Real models of North Sea aquifer, candidate for large-scale CO2 sequestration 60 × 220 × 85 Cartesian 40 × 120 × 20 corner-point model 149 × 189 × 16 corner-point Strongly heterogeneous Faults, erosions, inactive cells, . . . 100 × 100 × n for n = 11, 16, 21 http://www.spe.org/web/csp/ http://www.sintef.no/MRST http://www.sintef.no/MatMorA/ 18 / 21 Simple access to public data sets SPE1 SPE9 The ’Egg’ model 10 × 10 × 10 Cartesian 9000 cell corner-point, 26 wells Benchmark by TU Delft Three-phase, gas injection Three-phase black oil Compare with Eclipse, GPRS, MoReS CO2 atlas: surfaces CO2 Storage Atlas: Norwegian North Sea depth and thickness maps CO2 atlas: sand volumes 14 volumetric models reconstructed from the CO2 atlas IGEMS 15 structural/stratigraphic scenarios 14 × 100 surface realizations 19 / 21 Third-party modules Ensemble Kalman Filter (EnKF) Discrete Fracture Matrix (DFM) Developed by Olwijn Leeuwenburgh (TNO). Includes: Developed by Eirik Keilegavlen and Tor Harald Sandve (University of Bergen) Includes: EnKF and EnRML schemes, triangularization routines localization, inflation, asynchronous data, TPFA discretization production and seismic (saturation) data MPFA-O discretization conventional and structural parameters Implicit/explicit transport solvers We also know of other developments (e.g., exponential integrators from Heriot–Watt, a geothermal module from Univ. Bergen, etc). New contributions are most welcome! 20 / 21 Examples of in-house prototypes Multiscale TPFA Implicit higher-order Best properties of MsMFE and MsFV Here: viscous fingering in moving reference frame. Comparison of fully implicit single-point upwind and ’TVD type’ schemes Thermal effects Geochemistry Experimental, 3D unstructured Experimental, 3D unstructured 21 / 21