We construct a corner-point grid that with sloping pillars and wavy layers, construct a lognormal layered permeability field and use the default single-phase fluid with unit viscosity
nx = 20; ny = 20; nz = 8;
Nx = 5; Ny = 4; Nz = 2;
verbose = true;
grdecl = simpleGrdecl([nx, ny, nz], 0.15);
G = processGRDECL(grdecl); clear grdecl;
G = computeGeometry(G);
Here we can see that several blocks are disconnected over the fault. We therefore postprocess the grid to make sure that all blocks consist of a connected set of fine cells. Whereas this step is superfluous for Cartesian grids, the example shows that it is required for grids that are only logically Cartesian (e.g., corner-point and other mapped grids that may contain non-neighbouring connections and inactive or degenerate cells).
Using inner product: 'ip_simple'.
Computing cell inner products ... Elapsed time is 0.424627 seconds.
Assembling global inner product matrix ... Elapsed time is 0.003307 seconds.
Computing flux and pressure basis functions... Elapsed time is 0.981419 seconds.
Plot Schur complement matrices
The Schur complement matrices are formed as part of the solution process and it can be instructive to see how this matrix differs on the fine and coarse scale
Finally, we display a graphical representation of a few flux basis functions. Relying on the fact that function 'processPartition' preserves the index of unsplit coarse blocks, we compute the index of the coarse block at original coarse logical position (5,2,1) and its Cartesian neighbour (5,3,1). Similarly, we compute the block index of the coarse block at original coarse position (2,3,3) and its Cartesian lower neighbour (2,3,4).
The flux basis functions are stored in a packed data structure indexed by coarse faces. We therefore need to retrieve the face numbers of the coarse faces connecting each of the coarse block pairs defined above. This information is indirectly available in the coarse grid topology matrix, CG.faces.neigbors. As the block numbers may come in any order on a row in the topology matrix, we sort the individual rows to have a deterministic sort order.
We now extract the individual basis functions values on 'faces'. A further complication is that the actual values stored in the packed storage format is 'B' times the flux values, so we need to multiply by the inverse 'B' matrix, S.BI, in order to extract the flux values.
Finally, compute plotting data (accumulated total flux in each cell) for each individual basis function, and normalize the data to have same colour limit for each basis function.
d = sparse(cellNo, 1 : size(G.cells.faces,1), 1) * abs(bf);
d = bsxfun(@rdivide, d, max(d));
Extract the fine-scale cells in each of the four coarse blocks for plotting purposes.