MATLAB Carbon Sequestration Reference Application - MATLAB
Video Player is loading.
Current Time 0:00
Duration 51:18
Loaded: 0.32%
Stream Type LIVE
Remaining Time 51:18
 
1x
  • Chapters
  • descriptions off, selected
  • captions off, selected
  • en (Main), selected
    Video length is 51:18

    MATLAB Carbon Sequestration Reference Application

    Dr. Francesca Watson, SINTEF Digital

    Overview

    Modelling geological storage of carbon dioxide is characterized by scarce data, large spans in spatial and temporal scales, and delicate balances between different physical flow mechanisms. This reference application uses the MATLAB Reservoir Simulation Toolbox (MRST) to offer a set of simulators and workflow tools, that have been specially designed to meet these challenges. The software combines results from more than a decade of academic research and development in CO2 storage modelling into a unified toolchain that is easy and intuitive to use.

    In this webinar we will demonstrate the following functionality from the MRST:

    • Studying hypothetical carbon storage in large-scale aquifer systems from the Norwegian Continental Shelf
    • GUIs which can be used in a workflow going from regional-scale estimates to detailed characterization of a specific storage site
    • Static capacity estimates, basic analysis of CO2 trapping mechanisms at a specific reservoir, interactive simulation of CO2 injection into a reservoir
    • Varying various simulation parameters through a GUI e.g., well locations, injection rates and boundary conditions
    • Setting up a more detailed simulation of a particular CO2 injection site

    About the Presenter

    Dr. Francesca Watson is a researcher in the Computational Geosciences Group at SINTEF Digital in Oslo. She has a PhD from Durham University, UK and specializes in reservoir simulation for CO2 storage. She has worked at SINTEF since 2018 where she has been involved in both software development and managing bi-annual releases of the MRST software.

    Recorded: 23 Sep 2021

    Welcome to everyone. And without any further ado, I think I will just hand it over to you, Francesca, to take this away.

    OK, thank you very much for the introduction.

    Would you like to have questions along the way, or would you rather save them to the end?

    We can have questions along the way if any come up, I think.

    And please feel free to post questions to the chat as well.

    OK, thank you very much for the introduction. Yes, as Peter said, I am Francesca, and I work in the computational geosciences department in SINTEF Digital, which is based in Oslo. And we developed the MATLAB Reservoir Simulation Toolbox. So in this webinar, I'm going to talk a little bit about the toolbox in general, but mostly I'm going to be focusing on the carbon sequestration modeling capabilities that we have.

    So as an overview of what we're going to do, like I said, I'll give a brief instruction to the software and tell you a little bit about how it's set up. And then an introduction to the specific module that we use for modeling CO2 storage, which is the co2lab module.

    And then the main part of the webinar will be going through the new reference application, which can be downloaded from The MathWorks website, which introduces several aspects of the co2lab module and displays some of the tools that we have.

    OK, so MATLAB Reservoir Simulation Toolbox, also also known as MRST, is basically an open source set of tools for reservoir simulation that had been written in MATLAB. So to use the tools, we only use a basic-- you only need to have a basic MATLAB license. So we designed it so that you don't need any extra toolboxes. So as long as you have a MATLAB license, then you can download the toolbox from our website for free and you can use it with MATLAB to run reservoir simulation.

    Part of the reason for using it and the philosophy behind it is that we want to use it for quick prototyping. So if we come up with a quick new way of-- a new set of equations that we'd like to try or test things out, then we can quite easily do that in MATLAB. And we can also easily use the MATLAB debugger to figure out where things are going wrong and try and build new models and run simulations.

    So that's part of the reason why we have this here, and it's very useful because we can quickly develop things within MATLAB using it. But we also accept standard industry data formats. So we have functionality for loading-- for instance, if you have an ECLIPSE deck, we have functionality for importing that into MRST.

    And we also have now quite a lot of advanced features, which means that if you don't want to do any or very minimal coding, you can load a deck. You can run a function that will convert that deck into a model that you can simulate. You can simulate it and use the tool actually as a full simulator.

    So depending on what you want to do, you can either get really deep into the code or you can use it just for running a simulation. Because we actually actively research reservoir simulation here in the group, we can implement state of the art methods. And we do this frequently, so it contains some of the latest research that we've been doing on the best ways for simulating reservoir simulation.

    The toolbox is fully differentiable, and we also have C and C++ acceleration. So even if we have fairly large models, if we use these compiled backends, we are able to solve relatively large models in a pretty quick time. It's not quite as quick as you might get with other software, but it's pretty close, and it's getting closer all the time.

    So as well as that, we have a worldwide user base. Many people download the software. We have lots of people in universities who use it for research and master's and PhD theses. There are also many academic publications which have been written using the toolbox.

    We also now have two open access textbooks describing the functionality. So the first one is the introductory textbook. You can find links to it on our website, which is mrst.no. And then the second one contains some more specific functionality that we have introduced more recently and specific modules doing more complicated modeling.

    So the way we designed it is that we have a small MRST core, which has the routines that are likely to be used in all situations. And then we have lots of independent modules which can be added on, depending on what you want to do. So when you download the software from our website, you can get all these modules and then load them, whichever ones you want to use.

    We try our best to have in-source documentation so that you can figure out what's going on by looking at the code. And we also have plenty of code examples and tutorials, so each module should come with several tutorials to show you how to use it. And the best way or the easiest way to get into using MRST is basically to find a tutorial which is closest to what you want to do and modify it for your own purposes.

    The other thing that we're very proud of is this is actually a community code. So we develop quite a lot of the functionality. But we also have contributions from external users who have contributed modules, people from different institutions. And so MRST is growing quite rapidly in lots of areas that we haven't necessarily researched ourselves but other people have contributed, which is really good I think.

    This slide is just a summary of some of the modules that we have. So our latest release of the software was mrst2021b, which came out last week. And we had 60 modules to be added on.

    In general, we have grid generation modules. We have ones for looking at upscaling or different solvers, black-oil, EOR, and compositional modules. We have some modules that deal with fractures. Geomechanics, geochemistry, and geothermal modeling, we can have modules that deal with that. Well modeling, multisegment wells, right? And then we also have the CO2 storage laboratory module that I will talk about in this presentation. And then stuff for ensembles and optimization and flow diagnostics and many more that I haven't mentioned.

    So if you're interested in any of these things as well as the co2lab, then please go to our website, and you should be able to find out more information about this.

    So the co2lab toolbox is what we use for modeling CO2 storage in saline aquifers, and it's based on vertical equilibrium modeling. So vertical equilibrium modeling is a-- vertical equilibrium assumption is something that can be used for CO2 modeling because the way it works is we assume that the vertical fluxes happen very quickly compared to the horizontal fluxes. And this is because of the large density contrasts between the CO2 and the brine that's in-situ.

    So if you can make this assumption, then we can numerically model the horizontal fluxes, but we can assume that the vertical fluxes are already in equilibrium. So we don't need to model them. And then we can use an algebraic expression to figure out the depth of the CO2 through-- to figure out the vertical configuration of the CO2 and the brine.

    So this means that all the simulations that we run in co2lab can run very quickly because we can reduce our grid from being fully 3D grid into a 2D grid. And research has shown that this actually gives very similar results to using the vertical equilibrium for this problem. It has very similar results to doing a fully 3D grid. So that's one thing that's good about this module.

    Another thing that's fairly unique within MRST is that it has very many graphical user interfaces. So we also have feature interfaces for other modules, but co2lab has a lot too. So that makes it quite easy to use intuitively and interactively without going very deep into the code if you don't want to.

    And we also have a toolchain of modules of functionality so that we can model things from basic static capacity estimates. We can model then trapping and spill-point analysis. And then we can get more and more complex. We could have a simple sharp-interface VE simulation. But then we could also include other things such as dissolution trapping and subscale tracking and make our simulations more complex.

    And this has been developed over many years. So there are many papers that we have written based on this. And you can find these out also on our website. You can find a lot of references.

    The co2lab module is used-- has quite a lot of functionality for exploring the geological formations from the Norwegian continental shelf because the Norwegian Petroleum Directorate published the CO2 storage atlas. So we use quite a lot of the models from there. So these can be explored automatically but within MRST.

    Yeah, and like I said, we can visualize the pathways. We can compute trapping capacities and the different types of trapping. And then we can also do more sort of dynamic simulation. And if you want to visit the co2lab web page on our web page, there's a more detailed explanation there.

    And then finally, what I'm about to introduce in this next part of the seminar is the MATLAB Carbon Sequestration Reference Application. So this is something we developed with MathWorks. It can be downloaded for free from MathWorks website. And it's an introduction to co2lab.

    So we have selected functionality where we can go from regional-scale and static capacity estimates to more and more complex simulations. And I'm going to talk you through that now.

    Well, that was it for the slides. Now, I will share my MATLAB window. Are you still able to see it perfectly? Hopefully, you can still see it.

    Yes.

    OK. So for the reference application, if you go to the MathWorks web page and you download the application, what you will find is an m-file, and there is also an HTML version. And what I've done here is I'm running it as a live script. So I've opened the m-file as a live script.

    So in order to run these things, you need the reference application. But you also need the MRST software. So to get the MRST software, you need to go to mrst.no and download it from there. And the download consists of a zip file. You should unzip that zip file and then navigate to the directory that you unzipped it to. So in this case, I'm in mrst-2021b.

    And then within that directory, there's a script called startup. And if you run the startup script, this will set up all of the tests that you need so that you can load the relevant modules. And it also gives you a handy startup message, which has some links to picking up-- for you to be able to find examples or explore the data sets that we have within the software or the modules. So that is now installed and ready to use.

    So if we go back to the example, so the first line of code, the first thing we need to do, is load some modules that we're going to be using. So we're going to be using the co2lab module, coarsegrid module ad-core-- it stands for automatic differentiation core-- and ad-props.

    So I just run that line. And then if we go back here, we can see mrstModule list. And we can now see that we have these four modules active. So now we have the environment set up, we can start running some things.

    So if you are looking for-- trying to find the site to put some CO2 in, you might want to do some sort of large-scale static storage capacity estimates as a first pass to try and identify sites that might be suitable. So here we have a tool called exploreCapacity, which is an interactive graphical user interface. Well, it's just loading a little bit. It's taking a little bit of time.

    If you want to look at this in more detail, we have a web page, and we have a video tutorial, which have a lot more information than what I'm going to be able to cover in this webinar. But here we are. So by default, this has loaded the Utsira formation.

    And we can use this user interface to investigate some static capacity estimates. So these are just capacity estimates where you haven't-- you're not worried about the pressure build up. You just say, how much CO2 can we store in this formation if we fill all the areas of topographic highs with CO2? And we have just residual trapping throughout the reservoir and also as much dissolved CO2 as we can possibly get into the brine.

    So first things first, because we are able to load any models that we want from the Norwegian CO2 atlas, so you can change that by clicking down here. But here, I'm going to stick with the Utsira formation. And then at the minute, on this left-hand plot, we're plotting the caprock depth.

    But we can also have a look at some structural trapping. So if we click this button, we can see that we're-- we can see where the structural traps are, so where the highs would be in this formation. And the other thing list this down here, we have a breakdown of the trapping capacity that we have. So the total trapping capacity is 108.41 gigatons, but then we have-- not very much of that would be structural trapping. Most of it would be residual trapping, and a little bit would be dissolved trapping.

    And you can see these sliders on the right-hand side. So the point of the tool is we can change some of these sliders. So if I reduce the amount of residual CO2 saturation or the value of the residual CO2 saturation, you can see that the total trapping capacity has gone down. And also the amount of residually dissolved-- residually trapped CO2 has also gone down.

    Equally with the dissolution, we could increase the maximum amount of dissolved CO2, and then the trapping capacity has gone up a little bit. And the dissolved CO2 has gone up a little bit.

    So if you go to the web pages, you can find out detailed information about what all of these mean. I don't have time to go through that now. I think I'll move on to the next step. But this is the first GUI that I wanted to show you. So this is very basic stuff .

    So moving on to the next part, once we have the static capacity estimates, we might pick a certain reservoir that we thought was interesting. So here, we would like to do a tracking analysis, which is looking purely at the structural or stratigraphic trapping. So this is not including the residual or the dissolved CO2 trapping. And the structural stratigraphic trapping is what will happen in the early part of the storage operation. So as soon as you inject some CO2, it will migrate into a structural stratigraphic trap.

    So in this section, we're going to load the Johansen formation. So if I run this here, we can get the Johansen grid from the CO2 atlas. And then we should plot it within this window here. And here you can see the grid that we have. So this is the 3D version of the Johansen grid.

    In order to run the VE simulation, we need to use the top surface grid. So we need the top surface grid function. We'll create a grid which is only 2D, but it has some extra information about the depths of the cells beneath each cell, so the thickness of the reservoir for each cell.

    So if I run this cell-- oh, ran the wrong one. OK, I run this cell again. Then this will generate the top surface grid and hopefully plot it on top of the other grid. So here we can see the top surface grid plotted, colored by depths, and then the fully 3D grid is underneath.

    OK, so now we have the correct grids, we want to do some trap analysis. So in this instance, actually, we want to look at-- we're not running a full simulation, but we're looking at geometrical considerations. So analogous to if you had water flowing in a watershed, also we have CO2 which will rise and fill the highest points of the surface.

    So when we run this trap analysis, they will use the MATLAB BDL library to calculate where these traps will be and also figure out what the flow pathways would be. So MRST also, if you don't have the MATLAB BDL library installed, MRST will give you instructions on how to install this. And it's essentially-- all you have to do is copy and paste the line into the command window, and then MRST has some functionality for automatically downloading this and installing it for you.

    OK, so this has run. So this is the same grid from above, as shown in the graph previously but looking down plan view. And the red plots are the traps for the CO2, which were calculated using this graph algorithm.

    So now, we want to have a look at the spill paths, so how CO2 would migrate between these two traps, between the traps. So here, this is the same thing again, but it's shifted by 90 degrees. And you can see we still have these big traps here, but the black lines show the spill points and the spill pathways, so how the CO2 would migrate between the traps.

    And we also have plotted down here the number of cells in each trap versus the bulk volume of the trap. And you see we have quite a lot of traps that are down at this bottom end that are very low number of cells and relatively low volume, but we also have a few large cells with a large number of cells and large volume traps. So that was kind of a way to do it programmatically.

    Well, you also have the functionality called interactive trapping, which loads the graphical user interface. And this has quite a lot of functionality. So if you click on this link here, which you can find in the reference application, it'll take you to the website where we have quite a lot of explanation about the functionality. So I probably won't explain every single bit right now, but I'll explain a little bit. And if you want to find out more, please go visit the website.

    OK, so this here is the same formation. And you can see hopefully there's a red line here, which is the well. And by clicking anywhere within this GUI, I can place another well. So if I place a well here, you can see that the traps that the well accesses are now colored in gray.

    So if I wanted to inject CO2 here, 60% of the total storage capacity of the reservoir would be in this primary trap, so the first trap that I injected into. 2% of the storage capacity in the reservoir is reachable by a migration, so basically 2% of the total reservoir storage capacity is in these three traps, which you can reach if you inject here because they're upslope from the injection point. But 37% of the total storage capacity of the reservoir is not reachable from this injection point because it lies further down here in these traps, which are downslope of the injection point, so they'll never be reached.

    And you can see the volume for each of the traps is displayed in this chart here. So instead, if I move the injection point to here, you can see that actually now, a lot more traps will be filled. And 90% of the storage capacity can be accessed with an injection point that's here via migration and also 3% in the primary area that it's injected. So 93% of the storage capacity can be accessed by having an injection point here.

    So that's one way you can interactively play around and see where a possible injection point might be, a possible good injection point might be. Also up here on the left, we have several buttons which change views on how this is plotted and things you can see, which you can read more about in the website. But this button here is quite interesting because this allows you to set up a simulation based on where you have put your well.

    If you click the simulation button, you will get some parameters that you can set interactively here. So I think just for the sake of time, we will have a migration of 10 years and injection time of 10 years. So we will inject for 10 years, and now we will allow the simulation to run for 10 years after we've stopped injecting and just see what happens.

    And then we click Simulate here. I'm doing that because we have this Advanced Plot button checked. So we have another window here. This is being a little bit slow. And hopefully, we will see some injection happening as we're running the simulation.

    So this is our injection point here. This blue cross-section is shown here, so you can see how CO2 is moving that way. The pink one is shown down here, so you can see how the CO2 moves in that direction. We can see the plot from above here. And then here, we can see how the trapping, the amounts of trapped CO2, are changing throughout the simulation.

    So as you would expect, as the CO2 moves through the formation, the amount of residual trapping is increasing. And also have-- I guess you can't see because it's on my other window-- a progress bar to show how close we are to the end of the simulation. Yeah.

    Thank you very much, Francesca. Any questions so far? Please feel free to shout out or type to me in the chat if you have any questions for Francesca.

    OK well, this simulation is taking a little bit longer than it was this morning. My computer, it has too much stuff open. But yeah, as you can see, we get an interactive plot, and we can see how things are progressing as the simulation progresses.

    So like I said, there's more functionality to this GUI. Please look at the website and find out all the other things that it does, which I haven't had time to go through now.

    OK, so there's those first two parts. We're looking at sort of a fairly static estimates of how things were moving around and structural trappings without any sort of-- yeah, and looking at trapping mechanisms like that, but without so much fine-grained control about how the simulation was set up.

    So the next two parts of the webinar of the reference application show how to set up a more complicated simulation. So the first part we can use a graphical user interface to set up the simulation, and the second part, we will be doing it more programmatically. So I'll show you how to go into MRST and to set up a simulation.

    OK, so if we run this explore simulation graphical user interface, by default we end up with something like this, which is also the Utsira formation again. So here, we can see that sort of formation. And we can see these green lines are the boundary conditions. So it's green, it's open; yellow, semi-open; and red is closed.

    We can also click this button down here, which will show the traps, the topographic highs in the surface. And if we rotate the model, let's see if we can see that a little bit. So these are the places where the CO2 would pool when we injected.

    And the good thing about this GUI is that it's quite easy to set up a simulation how you want. So for instance, if you wanted to edit the boundaries and set up a closed boundary say here, we can click. And then we can get a closed boundary indicated by this red, yeah.

    And then also, we can select the well sites. So we pick this here, and then maybe we have one here, one here, and perhaps one down here. And so you can fiddle with some of the simulation parameters using the GUI. And we can also change the times and migration times and the number of timesteps.

    I'm going to click launch new simulation here, and we can see what happens. As a first pass, this simulation is going to be just a simple flat interface model, so--

    So Francesca, while we wait for that, we actually got a question in the chat that came up when you showed the previous application or example with the over time. And that was, how do you-- this is from Gavin-- he said, how do you create this grid? Do you import it from external? I don't know. He may have missed that bit or asked if you could, sorry.

    So within that user interface, we have these grids that are from the Norwegian CO2 atlas, so it's probably less-- I mean it would be possible to import your own grid, but that requires a little bit more. If you want to use the graphical user interface, you would have to go a little bit more into how that was set up. But I think you have to just find some of the input parameters that are needed to do that.

    But what I will show in the next part of the demonstration is how we can actually just run a simulation on our own grid as well. Read that in. So I hope that answers your question.

    Now, the other thing to note is that if you do want to try these things and you get stuck or you have some more questions, then we have a very active user forum for MRST. So if you post a question on there, you're very likely to get an answer, giving you some help and tips on how to do things. OK, well I hope that answered your question.

    This simulation has now finished running. So we could see as it was going through that the saturation of CO2, as you injected here, it was migrating up there and filling these traps. And we had a little bit of an injection up here, but this latest boundary is mostly closed because I closed it. I set it to be a closed boundary. And then we had some injection into this trap here.

    And then automatically, once the simulation has finished, then we get this plot here, which tells us the amounts of different trapping mechanisms active through time. So at the start, we had quite a lot of CO2 that just existed within the reservoir. And then we had some in the structural traps, and this increased. And then we also had a little bit of CO2 that exited the model, presumably through this boundary here, which is open, a little part of it. And then the amount of residual trapping increased.

    So this user interface is pretty good for running very quick simulations. So this only took-- it didn't take very long to run, 3,000 years of simulation time, because we're using the vertical equilibrium model. And it is fairly easy to change the boundary conditions here and change the wells and change the injection rates and play around.

    Also in here, we don't just have to look at the saturation. We can also look at the pressure-- it's not that interesting in this case-- or the height of the plume and other things that can be plotted. And you can scroll through the different timesteps of the simulation as well.

    The other thing to note about this GUI is that actually we can include more effects than just the flat interface model. So we can have the capillary fringe or the subscale trapping. So if you have bumps in the caprock, you can use that, or we can include dissolution trapping.

    OK, so I think we can move on to the final part of the demonstration. Yeah, so in this final part, instead of using a graphical user interface, I'll just explain a little bit more how you can run a VE simulation programmatically using MRST co2lab.

    So for this demonstration, we're going to use the Johansen formation. And actually I have quite a few links here to places where you can download the data sets and some references to papers and the PhD by Odd Andersen who talked a lot about this model and set this model up. So feel free to go and look at all these references to find out more information about what's going on.

    So to begin with, to set up the model, we first set up some parameters. So we make sure that we have gravity on, and we make sure that it's reset so that it's traveling in the z-direction. And then we have set up the gravity and then the density and viscosity of the CO2 and water and some residual saturation parameters and also capillary entry pressure.

    So in this case, we are having-- we're going to use constant properties. The water properties or the brine properties have been set manually, but the CO2 properties we take using this-- find using the CO2props function, which uses the coreProps equation of state. We have a tabulated version of that within MRST.

    So we set the pressure and temperature, and then we are taking the CO2 properties that reference pressure and temperature, but we will keep them constant through the simulation. So this just sets up some variables that we're going to need later.

    So the next part of the-- make sure I run that so we have everything-- the next part of the script sets up the grid. So it's still using the Johansen grid from before. We already have an inbuilt function that will make the Johansen grid and give us everything we want.

    So in this case, we want the G as the grid structure. We have a rock structure, which is the porosity and permeability for each cell. And then we have some indices relating to the boundary conditions and where we want to set the boundary conditions. So this is a custom function for making the Johansen grid for this example.

    But it's also possible to import an ECLIPSE deck, so if you have your own grid or there's also routines for generating simple grids from horizons or just Cartesian grids. So there's lots of functionality for grid creation within MRST.

    And if you are interested in finding out more about that or you want to like an example for that, then if you go to our website, you should be able to find things for setting up ECLIPSE grid and details about all of that on there. And like I said, if you get stuck in anything, it's always a good idea to send a message to the forum because we monitor it and we answer most of the questions that come through. And quite a lot of questions are there.

    And I've posted a link to the forum in the chat if you want to take a look. Francesca, I think there was also follow up on the previous question regarding the grid. If it can be imported, the grid and geometry, from other geological model tools such as Petrel? I don't know if something you can answer right now, or if you would like to defer that to the forum.

    If you have a GRDECL file, you can import that. I'm not so good on Petrel. I'm not an expert on Petrel to know what sorts of formats you can export from it, but yeah.

    So it may be a good question for Gavin to post to the MRST forum, and people can look at it with both knowledge in MRST and in Petrel.

    Yeah, OK.

    Thanks, Francesca.

    So then once we have the grid that we want, this is actually the 3D grid in MRST, and we set up the well that fit that grid. So to set up the well, we need to know what cell the well is going to be in. And in this case, we want one injector, which we're going to put quite far down close to the major fault within the model.

    So we set the injection rate, and then we use this addWell function, which is used throughout MRST to add wells to models. So here we give it the grid. We give it the rock and the well cell. We're using a rate injection at constant rate, so we set the type to rate. The other type would be BHP, but we're not using that here.

    And then we set the value to be the injection rate. And then because we're injecting CO2, we set the composition for the injector. And here, the water index would be the first one, so we set that to 0. And the CO2, we're talking about the second index, set to 1 if you want to inject CO2.

    So that's the full grid. And then moving further down to this line here, we use the topSurfaceGrid function, which I mentioned before. So we have Gt, which is the topSurfaceGrid that we're going to use. And that is the VE grid. That's the 2D grid.

    To calculate the properties for that grid, we average the rock properties, so the average permeability and porosity for each column corresponding to each cell in the top surface grid. And then we also have a function that converts the wells to VE wells so they fit with the new grid. And that will calculate all the injection rates and the wells indices correctly.

    So then we have the rock and the wells. And the next thing we want to set up is the initial state. So for the initial state, we-- well, I'll just run this so it works while I'm talking. So for the initial state, we have the pressure, which is going to be hydrostatic pressure. So the initial state will be the reservoir full of water at hydrostatic pressure.

    So we can just calculate that manually, this here. The saturation, like I said, we will have water, which is 1 in the first index, and the second index the CO2 is 0. And then we also set the maximum gas saturation for the initial state, which is also going to be 0 because we have no CO2 yet in the model.

    And then this bit of code here, we'll do some plotting, and we can have a look and see. Have a look at the model that we've set up.

    So here it is. We have the injector at the bottom here. The yellow grid is the full 3D grid, but the blue grid is the topSurfaceGrid that we're going to be using. And we just shifted them to make it easier to see in the plotting. So this is the grid.

    And next, we need to set up the fluid model. So to set up the fluid model, we can use the function makeVEFluid. So fluid structure in MRST is fairly flexible. So it needs certain parameters, but also you can pass in anonymous functions for different things. So if you want to have the density that's dependent on pressure, you can pass in a function on pressure, which makes it kind of flexible.

    So to make VE fluid, in this case, we are going to use a capillary fringe model. So we select this P-scaled table type of fluid. But actually makeVEFluid has very many options, the different types of fluid models. And if you go into the file to makeVEFluid, you'll find out a lot more information about what everything does.

    So here with using the parameters that we set up right at the start of this, where we calculated some densities and discussed these, and we create the third model here in this part.

    So we're nearly there. Once we got the third model, we need some boundary conditions. So if we didn't set any boundary conditions, then MRST would just assume closed boundaries for the model. But here, we want to have hydrostatic boundary condition on some of the faces. So these are the faces that we got from when we calculated the grid right at the start.

    And then once we've got the boundary condition set, we set the schedule. So here we want to have an injection period and then a migration period. So we set the control. To make the control, we give it the well and the boundary condition. And then we do the same thing again for the second control. But then we want to only have CO2 migration and no injection, so we set the value of the well in second control to 0.

    We set the time that we want to run for. So here are the timestep lengths. This is a bit modified from the version that you might download because I reduced the number of timesteps. So we're going to run for 500 years. So 50 years injection and 450 years migration.

    And then this final part, we need to tell the schedule which control to use. So we want to use the first control for the first 50 timesteps and the second control for the second 450 timesteps.

    OK, and now, I'm going to set this running so it can run while I talk.

    So once we have the schedule and the control set up, the next thing to do is set up the model. So here, we're using a CO2VEBlackOilTypeModel. And for that, we give it the top surface grids and the rock that corresponds to that grid that we calculated with the average rock and the fluid structure that we set up.

    And then once that's ready, we're ready to simulate our model. So we can do that using the simulateScheduleAD, which takes in the initial state, the model that we just created and the schedule, and then it runs the simulation. And you can see as the simulation is running, you get this printout of the timesteps, and you can see how far it's gone. So we're on 35 out of 94.

    Another neat thing that you can do with MRST if you want to have a little bit more print out is you can use the command MRSTVerboseOn, which will tell you a little bit more about stuff. And it's very useful. If, for instance, your simulation is not converging, you can see which parts of the simulation are not working as well as they should be or where the issues might be occurring and get a bit more help with debugging.

    So this is taking more time than it was taking before also. So yeah, once this simulation has finished, then this bit of code down here will plot the results for us. So what we're going to do is plot an animation of the results through time and see how the CO2 has migrated through time. It's nearly there.

    Yeah, and then once we have looked at the animation, then finally, the final part we're going to do is look at the trapping analysis and see what trapping mechanisms we have working. OK, so there it is. We've finished the simulation here, simulation complete. And now, let's have a look at some of the results.

    So this is the CO2 concentration from the injection point. You can see that as we inject, it migrates upslope and also pulls in these areas of high topographic relief. So this is just the injection timesteps. And then at some point, it will go switch over to migration. So here we're going at 10 year timesteps. And we can see it migrating upstream, upslope.

    OK, and then as I said, the final part of the demonstration looks at the trapping analysis. So the trap analysis was shown automatically from the graphical user interface before, but we can also run it manually with our results that we've just calculated.

    So if I run this, and hopefully you can see here, the tracking distribution. So you get a-- this is a function. This has something to do with the live script, makes a figure, and plots it, and then updates the figure and another figure underneath, I think.

    So here you can see the results for the different trapping mechanisms, and actually most of the trapping is-- most of the CO2 is still free in the model. So it has not found a structural trap to reside in yet. But nothing has exited the model. And we have a little bit of residual trapping, which is increasing through time.

    OK, that was the end of the reference application. So thank you very much for listening. This was very fun, and I hope you'll be interested to find out more about it and have a look on our website for more information. Does anyone have any questions?

    Well, thank you very much, Francesca. And as you think about your questions, before that, I just want to mention that in the chat, I posted two links. One to the reference application that you can download from MathWork's web page, free of charge. And the other link is to download MRST from SINTEF's web page, also free of charge. So if you're interested to try this on your own, you've got all the resources there.

    Do we have any additional questions before we close? OK, so once again, thank you very much, Francesca, for a very interesting webinar. I'm not into carbon storage, but it was very interesting for me to hear about this. And I would like to thank everyone for attending.

    And please remember the MRST forum for any questions that you may have leaving this webinar today and thinking about it when you're going home or tomorrow.

    Thank you very much, everyone. Have a nice evening and hope to speak to you soon. Bye bye for now.

    Bye bye.