Vous êtes sur la page 1sur 26

Geological Society, London, Special Publications Numerical simulation of multi-phase fluid flow in structurally complex reservoirs

S. K. Matthi, S. Geiger, S. G. Roberts, A. Paluszny, M. Belayneh, A. Burri, A. Mezentsev, H. Lu, D. Coumou, T. Driesner and C. A. Heinrich Geological Society, London, Special Publications 2007; v. 292; p. 405-429 doi:10.1144/SP292.22

Email alerting service Permission request Subscribe

click here to receive free email alerts when new articles cite this article click here to seek permission to re-use all or part of this article click here to subscribe to Geological Society, London, Special Publications or the Lyell Collection


Downloaded by

Imperial College London on 8 January 2008

2007 Geological Society of London

Numerical simulation of multi-phase uid ow in structurally complex reservoirs


Department of Earth Sciences, Imperial College London, South Kensington Campus, i@imperial.ac.uk) Exhibition Road, London SW7 2AZ, UK (e-mail: s.mattha

Institute of Petroleum Engineering, Heriot-Watt University, Edinburgh EH14 4AS, UK and Edinburgh Collaborative on Subsurface Science and Engineering (ECOSSE)

Department of Mathematics, Mathematical Sciences Institute, Australian National University, Canberra, ACT 02000, Australia rich, Ra mistrasse 101. 5, CH-8092, Zurich, Switzerland Department of Mathematics, ETH Zu rich, Clausiusstrasse 25, CH-8092, Zurich, Switzerland Department of Earth Sciences, ETH Zu
Abstract: Realistic simulation of structurally complex reservoirs (SCR) is challenging in at least three ways: (1) geological structures must be represented and discretized accurately on vastly different length scales; (2) extreme ranges and discontinuous variations of material properties have to be associated with the discretized structures and accounted for in the computations; and (3) episodic, highly transient and often localized events such as well shut-in have to be resolved adequately within the overall production history, necessitating a highly adaptive resolution of time. To facilitate numerical experiments that elucidate the emergent properties, typical states and state transitions of SCRs, an application programmer interface (API) called complex systems modelling platform (CSMP ) has been engineered in ANSI/ISO C . It implements a geometry and process-based SCR decomposition in space and time, and uses an algebraic multigrid solver (SAMG) for the spatio-temporal integration of the governing partial differential equations. This paper describes a new SCR simulation workow including a two-phase uid ow model that is compared with ECLIPSE in a single-fracture ow simulation. Geologically realistic application examples are presented for incompressible 2-phase ow, compressible 3-phase ow, and pressure-diffusion in a sector-scale model of a structurally complex reservoir.

4 5

The recovery of hydrocarbons from the subsurface is an application area where a good understanding of the geology can have a dramatic impact. Establishing the impact of geological features on multiphase ow requires Earth scientists to work with reservoir engineers in the building of forward models of reservoir production. Examination of current best practice suggests that decisive geological information can be lost at this interface because, faced with the wealth of collected data, reservoir teams struggle to discriminate between observations that are critical for uid ow and are usually forced to simplify the geological model in order to apply conventional simulation tools and/ or obtain the desired history match within a limited amount of time. Reservoir engineering heavily relies on meta-models (e.g. dual porosity, multiple continuum etc.), effective material properties, and other approximations made at the eld scale. Thus, model-guided intuition of the impact of the original underlying geological features on

ow may be awed, especially if their size is below the level of seismic resolution. Since the actual reservoir system is only partially revealed by measurements, cause and effect chains may be difcult to interpret so that misconceptions may survive for a long time. The inverse correlation between geological complexity and nal recovery (Fisher 1991) indicates that there is room for improvement in model-guided reservoir management. The goal of any such forward modelling is to understand how physical processes known to operate in a complex reservoir will interact and what system behaviour these interactions result in. The better our understanding of these couplings becomes, the more accurately we can assess how a reservoir will respond to a certain management strategy and which eld data must be acquired to constrain such sensitivities. Numerous studies have demonstrated that structurally complex reservoirs have a strongly heterogeneous permeability and may contain many

From: JOLLEY , S. J., BARR , D., WALSH , J. J. & KNIPE , R. J. (eds) Structurally Complex Reservoirs. Geological Society, London, Special Publications, 292, 405429. DOI: 10.1144/SP292.22 0305-8719/07/$15.00 # The Geological Society of London 2007.



high-aspect ratio faults, discontinuous layers and fractures (e.g. Nelson 1985). Multi-phase uid ow is the consequence of an intricate and spatially variable interplay of viscous, gravitational and capillary forces in this complex geometry. Bulk velocities vary spatially over 58 orders of magnitude and are subject to non-linear feedbacks i between saturation and total mobility (Mattha et al. 2005a). Most commercial reservoir simulators only operate on structured grids, and these are not capable of incorporating all of the elements of cross-cutting inclined faults combined with layer offsets. Thus, non-neighbour connections, transmissibility multipliers and shape factors are used to patch the grids and to account for the missing features. Yet, simulation results show that such simpli i et al. ed models can lack physical realism (Mattha 2005a; Belayneh et al. 2006). Various studies (e.g. Durlofsky 1993; Kim & Deo 2000; Geiger et al. 2004; Monteagudo & Firoozabadi 2004; KarimiFard et al. 2005) have demonstrated numerical methods that are, in theory, suitable to model ow in geometrically complex structures but have only applied them to proof-of-concept ow geometries as opposed to eld-data based geological interpretations with a hierarchy of structures. We have developed a multi-purpose simulation workow and reservoir simulation modules for multi-phase ow, diffusion and transport processes in structurally complex reservoirs resolved in sufcient detail to capture both seismic and subseismic features at the same time. This methodology has been applied successfully to model single-phase and multi-phase ow in fractures, reactive transport, formation of ore deposits, and convection in i & Roberts 1996; hydrothermal systems (Mattha i et al. 1998, 2004, 2005a; Geiger et al. Mattha i & Belayneh 2004; Coumou 2002, 2005; Mattha et al. 2006; Belayneh et al. 2006). Importantly, our workow also relies on state-of-the-art computer aided design (CAD), meshing, and numerical tools including an algebraic multigrid solver for ben 1999). systems (SAMG, Stu

are described in Geiger et al. (2004) and Paluszny et al. (2007). Steps 5 and 6 are shown in Belayneh i et al. (2005b). Step (7) et al. (2006) and Mattha constitutes a separate subject which is touched i et al. (2005a). Here we present upon by Mattha an overview of Steps 1 and 2, discussing Step 3 in some detail, including relevant aspects of the required software engineering, some of which are described in an associated appendix. Steps 5 and 6 are illustrated in the results section.

CAD-based model building/geological interpretation and hybrid nite element discretization

Geological models of structurally complex reservoirs are characterized by a feature-rich geometry with a large number of volumetric sub-domains bounded by irregularly shaped surfaces. The traditional representation of such geological interpretation-based geometries by non-smooth polyhedral surfaces is sufcient for visualization purposes but unsatisfactory for unstructured nite-element meshing due to inherent geometric discretization errors. In these circumstances, there may be tiny gaps where polyhedral surfaces are used to delimit the extent of strata truncated by faults and the discontinuous nature of these entities may result in erratic intersection lines. Also, although it is textbook knowledge that the degree of mesh renement should be tailored to the needs imposed by the equations that are being solved, the commonly used polyhedral surfaces predene mesh resolution when the geological interpretation is prepared. Furthermore, typical geo-cellular models lack intersection curves where surfaces cross-cut each other and there is no information on how surfaces combine into volumetric entities (Preparata & Shamos 1985). This means that the surface-delimited volumetric subdomains of the model are dened only indirectly and cannot be addressed or analysed as separate entities. These problems are readily solved if the so-called Boundary REPresentation format (BREP) is used at the geological interpretation stage. This method has been extensively tested and is well established because BREP represents the standard in computer aided design (CAD) for engineering applications (Lienhardt 1991). BREP approximates the shape by the outer boundary of an object, in terms of highly stable smooth Non-Uniform B-spline curves and surfaces (NURBS). From an interpreting geologists point of view, NURBS have the advantage that geometrical changes made as the understanding evolves impact only the immediate vicinity of the modied point, curve or surface. NURBS are also ideally suited to match geometry across regions with variable

The sequential steps of the new simulation workow are; (1) feature representation and geological interpretation of the model geometry in CAD; (2) hybrid nite-element discretization of the model geometry; (3) discretization of the governing equations using operator splitting in a combined nite-element and nite-volume framework; (4) a posteriori mesh adaptation for the pressure equation based on an estimate of the discretization error; (5) simulation; (6) visualization and analysis of results; and (7) upscaling. Details of Steps 3 and 4



data density. In CAD, NURBS entities are stored hierarchically in a consistent topological tree structure. This topology ascertains that geometric search, curvature analysis, surface area and volume determination operations on the constructed model are performed with maximum efciency. Free-form CAD tools also implement absolutely critical design proong operations such as orientation consistency checks, identication of non-matching surfaces, and tests whether ensuing sub-volumes are water-tight. Methods and algorithms for automatic meshing of free-form NURBS geometry are a lively area of research. Current meshing tools (e.g. Baker 1989; Shephard & Georges 1991; Thompson et al. 1998; Owen 2002) use the BREP format because, by denition, it is not possible to represent complex free-form (as opposed to analytical) geometry by Cartesian structured grids (Thompson et al. 1985). The only feasible alternative is automatic unstructured meshing (Baker 1989; George & Borouchaki 1998; Owen & Saigal 2001). The automatic generation of tetrahedral meshes representing layers or massive rock is not a problem, but the situation is different for large-aspect ratio geological structures such as faults and fractures. Realistic simulation of multi-phase ow including capillary and gravitational effects requires fracture and fault meshes with internal degrees of freedom, i.e. several layers of elements have to be placed inside individual fractures. The ensuing small element size leads to prohibitively large overall element numbers and existing incremental meshing algorithms (Juanes et al. 2002; Bogdanov et al. 2003) do not work well between close subparallel surfaces producing highly distorted tetrahedra that can cause numerical errors (Thompson et al. 1998). Automatic generation of all-hexahedral unstructured meshes for free-form geometry is extremely difcult. Although a number of new robust algorithms for hexahedral meshing were proposed recently (White 1995; Blacker 1996), these methods still cannot handle arbitrary multiply connected geometry without intensive operator intervention. As a further possibility, surface only representations of fractures (e.g. Juanes et al. 2000; Bogdanov et al. 2003) have been introduced but they preclude the necessary internal degrees of freedom and cannot be used to model sealing faults because the nodes on either side are shared. As a good compromise between the complexity and efciency of all-hexahedral meshing and the simplicity of automatic tetrahedralization hexahedradominant hybrid meshes containing other types of elements including prisms and pyramids can be created by post-processing of an initial tetrahedral i et al. 2005a; Paluszny et al. 2007). mesh (Mattha Such a hybrid mesh will contain hexahedral

elements in geometrically unconstrained regions, whereas more shape-adaptive element types will populate regions of geometric complexity. To achieve the transition from hexahedral elements to tetrahedra, pyramid and prism elements are introduced (Fig. 1). The hybrid meshing approach is called indirect meshing (e.g. Owen & Saigal 2001). Threedimensional hybrid meshes contain 15 20 percent fewer nodes and up to 12 times fewer elements than tetrahedral plus triangle meshes. They require less memory for mesh storage and the sparseness of solution matrices is increased. A decisive advantage of indirect hybrid meshing is that surface-only fracture and fault representations can subsequently be extruded into volumes of high aspect ratio elements, mostly thin prisms. This technique, developed for the detailed resolution of boundary ows in aerospace applications, is our preferred way to capture thin or sheet-like features like fracture, faults, dykes and pinching out layers. Figure 1 presents cross sections (cut planes) through three-dimensional hybrid element meshes of large-aspect ratio structures. Tapering of the prism layers representing there brings extra realism to the fracture representation. The matrix domain is meshed by a hexahedra-dominated hybrid mesh. The latter is the most economic solution in terms of element numbers and node connectivity. As is described in the following section on the discretization of the governing equations, nodecentred control volumes are used for the mass conservative solution of the transport equations. Control volumes are formed around the nodes of the hybrid nite-element mesh via the introduction of subdividing surfaces, positioned such that they match between the different types of element (Fig. 2). The generalization of this method to hybrid meshes has required us to develop a new consistent isoparametric nite volume tessellation for hybrid meshes, including volume and surface integration points (Paluszny et al. 2007). The key feature of this tessellation is that the resulting mesh does not have to be stored in memory. Storage is required only for a single stencil per nite element type in parametric space because fast mapping techniques can be applied to generate the nite volume integrals in the solution process.

Engineering of simulation software

A careful examination of reservoir and/or geohydrological simulation software in 1995, when we decided to write CSMP , lead us to the conclusion that existing architectures, especially implementations in procedural languages imposed limitations that stood in the way of reproducing



Fig. 1. Structure discretization with high aspect ratio prism and hexahedral elements (mesh generated with Tetra, ANSYS Corp.). (a) Cross-section of hybrid element mesh of a bifurcating fault; (b) pointed tip of single fracture represented by tapering prism layers.

and disentangling complex geological phenomena. In spite of the somewhat reduced shortcomings of packages in 2006, reservoir teams often do not get near to using even their functionality. For example, most teams model faults as transmissibility multipliers without even attempting to work out what these mean in real terms (e.g. their permeability, thickness etc.). By contrast this article proposes that one should begin modelling a poorly understood system by including as many of its known characteristic features and potentially important component processes as is possible so that simulations can discriminate between noninuential ones from others which determine reservoir behaviour. One may start with a geometrically simple model with small material property

contrasts, but to make predictions comparable with eld data, a realistic geometry and material property ranges have to be introduced. It may only take a few realistic simulations to identify how sector- or eld-scale models can be simplied without loss of accuracy, but for the structurally complex reservoirs identied by Fisher (1991), a large part of this step still lies ahead of us (cf. Gilman 2003). The if-in-doubt leave-in strategy is based on, albeit limited, experience that diagnostic model behaviour will ensue only if models and /or the represented physics are system specic (Matthai et al. 2004, 2005a; Geiger et al. 2005, 2006b). The human readiness to ignore selective geological facts combined with the inability to anticipate side



Fig. 2. Node-centred control volumes in a hybrid nite element mesh. (a) lines meet at the central node of a single nite volume delimited by coloured translucent surfaces and sectors in four different nite element types marked by the different colours. (b) Multiple translucent nite volumes arise from nite-element nite-volume stencils with facets, the outward-pointing normals of which are marked by red cones. Note the pyramid stencils in the upper left of the graph.

effects of deliberate changes to natural systems is illustrated by a rich literature (cf. Nelson 1985; Reisner 1987). The if-in-doubt leave-in simulation approach leads to software design objectives and an implementation approach that differ considerably from those motivating conventional reservoir simulation tools. These and the basic functionality of CSMP code are reviewed in the Appendix.

Governing equations and numerical solution methods Derivation of governing equations

The governing equations that describe compressible and incompressible single- and multi-phase uid ow in porous media can be derived from mass balance equations and Darcys law. For simplicity, the discussion is restricted to isothermal uid ow and explicit transport schemes. Non-isothermal uid ow can also be simulated with CSMP i et al. 2004; Geiger et al. 2006a). (Mattha The mass balance for a chemical component c (e.g. H2O, CO2, CHX, NaCl) is given by: @ Mc r Fc qc , @t (1)

into different phases a which are commonly oleic o, gaseous g, or aqueous a. The partition behaviour is a function of pressure and composition, and also temperature in non-isothermal systems. The phase state and PVT properties are given by equations of state (e.g. Soave 1972; Haar et al. 1984; Spycher et al. 2003; Driesner & Heinrich in press). In reservoir engineering applications, these are often simplied in the form of a Black-Oil model (cf. Aziz & Settari 1979). The mass of component c per unit volume is given by the sum of the mass Mca of component c in each phase a: Mc X

Mca f


Sa rca (2)

a [ fo, g, ag:
Here, f is the porosity of the rock, S the saturation, i.e. the volume fraction of the pore space that is occupied by a, and rca the density of c in a. It is also useful to dene a phase density ra which is simply the sum of all component densities rca contributing to phase a:


nc X c1

rca ,


where M is the mass of component c per unit volume, Fc the ux vector of c, and qc a source or sink specic to c. A component c can partition

where nc is the total number of components c. The saturations of all uid phases must add up to one,



i.e. satisfy the relation: X


oil gaswater system: (4) pcoa po pa pcgo pg po pcga pg pa :

Sa 1 a [ fo, g, ag:

If one phase is absent, for example Sg 0, the system reduces to two-phase ow and if two phases are absent, for example Sg So 0, to single-phase ow. Yet, the same set of equations is still applicable. The ux vector Fc describes the transport of c in the different phases a and is given by: Fc X

va rca

a [ fo, g, ag,


The generic Equations 1 to 9 describe isothermal single- and multi-phase uid ow in porous or fractured media. The PVT properties, relative permeabilities, and capillary pressures are derived from empirical correlations or experimental data. For the numerical solution, it is convenient to formulate an additional equation that describes the evolution of the uid pressure at constant concentration and saturation. To derive this equation, it is helpful to dene the total mass and ux in each phase, Ma and Fa, respectively; Ma Fa
nc X c1 nc X c1

where va the velocity of phase a. If it is assumed that the rock matrix is incompressible, the uid densities are constant, and the phases are immiscible, the conservation equation (Eqn 1) simplies to the classical saturation equation: @ Sa r va qa @t

Mca fra Sa Fca ra va

a [ fo, g, ag,

a [ fo, g, ag:

a [ fo, ag:


Assuming, for simplicity, that sources or sinks are absent (q 0), Law 1 can now be rewritten as a conservation equation for the mass of phase a: @ Ma r Fa 0 a [ fo, g, ag: @t (11)

The velocity va at which phase a ows is given by Darcys law: kra Sa krpa ra g ma



Expanding Ma using the chain rule and summing over all phases present yields X @ Ma

a [ fo, g, ag
and the sum of the three phase velocities yields the total velocity vt vt X


@f @r fSa a @ t @t a  @ Sa fra a [ fo, g, ag: @t Sa ra




a [ fo, g, ag:

(8) From Equation 4 it is apparent that the sum of the saturation is always one and hence the sum of the saturation-time derivatives is constant. Since rock matrix and uid are compressible, f and ra change as a function of pressure. By inserting Equation 12 into 11, taking the derivatives of f and ra with respect to p, and dividing the nal equation by ra, we obtain:   @p X @f 1 @ ra f Sa @p ra @ p @t a X 1 r Fa 0 a [ fo; g; ag: ra a (13)

The relative permeability kr and the viscosity m are generally combined as the phase mobility la kra =ma . Note that the relative permeability kra is a function of the saturation Sa (e.g. Brooks & Corey 1964; Stone 1970; van Genuchten 1980). Furthermore, k is the permeability tensor, p the uid pressure, and g 0, 0, gT -the gravitational acceleration vector. To complete the equations, the difference between the phase pressures must be dened. These are given by the capillary pressure pc, which is a known function of saturation. Three capillary pressures exist for an



Dening the uid compressibility as ba and rock compressibility as bF


1 @ ra ra @ p



@f , @p


and inserting Darcys law (Eqn 7) into Equation 13, yields the transient diffusion equation for the uid pressure: X

Sa bf fba

p @p bt )@ @t @t

X 1 r ra la k(r( p pcaa ) ra g) ra a


a [ fo; g; ag: In this formulation, the uid pressure p is set equal to the pressure of the aqueous phase pa. The capillary pressure between the aqueous phase and the oleic or gaseous phase, pcaa, is given by Equation 9. If rock matrix and uid phases are incompressible and the uid density is constant, Equation 15 simplies to a steady-state diffusion equation 0 X

r la k(r ( p pcaa ) ra g)


r vt a [ fo, ag:

Equations 15 and 16 are non-linear because bt, ra, la and pcaa are functions of pressure or saturation, which both change as the pressure eld evolves.

Numerical solution
This section discusses how we solve the governing equations on the discretized geological structure using nite element and nite volume methods. The pressure and mass balance equations for compressible (Eqns 1 and 15) and incompressible (Eqns 6 and 16) uid ow provide us with a system of equations that can be solved efciently using numerical methods. It has long been recognized that the nature of the pressure and mass balance equations is fundamentally different (cf. Gerritsen & Durlofsky 2005). The pressure equation is a non-linear diffusion equation and of parabolic (compressible) or elliptic (incompressible) character. The mass balance equation is a non-linear advection equation and of hyperbolic character. Hence, pressure and mass balance equations are usually solved by a sequential approach that allows

us to choose the numerical method that is best suited for solving diffusion and advection equations, respectively (cf. Gerritsen & Durlofsky 2005): First, the pressure eld is updated while holding concentration and saturation constant (Eqns 15 or 16). Then, the uid velocities are computed from Darcys law (Eqn 7) by differentiating the pressure eld. They are subsequently employed to solve the mass balance equations (Eqns 1 or 6) while holding the pressure constant. This decoupled approach is also termed Implicit Pressure Explicit Saturation (IMPES; Aziz &Settari 1979) or Implicit Pressure Explicit Concentration method (IMPEC; Gerritsen & Durlofsky 2005). In recent years, the combination of nite element and nite volume methods on unstructured grids has received a lot of attention for solving multi-phase uid ow in complex geological structures (e.g. Kim & Deo 2000; Geiger et al. 2004; Monteagudo & Firoozabadi 2004; Karimi-Fard i et al. 2005a). As previously diset al. 2005; Mattha cussed, unstructured nite element meshes enable resolution of complex geometries with great detail. Still, the nite element method is only used to compute the uid pressure because nite volume methods are better suited than nite element methods for the solution of mass balance equations (cf. Chung 2002). They can also resolve steep gradients in saturation and concentration when higher-order accuracy is used. These advantages commonly alleviate the solution error that is introduced by a sequential approach and is of the order of the timestep, ODt. The following section discusses how the compressible pressure equation (Eqn 15) can be solved by the nite element method and the mass balance equation (Eqn 1) by the nite volume method. We use the classical BubnovGalerkin nite element method for the integration of the ux term r ra la krp over a nite element with an irreducible formulation (cf. Huyakorn & Pinder 1983). Although mixed-element methods yield a pressure and velocity eld that is consistent for compressible ows (e.g. Durlofsky 1993), they are unsuitable for fracture-matrix systems in which the direction of ow changes abruptly across material interfaces and it has been debated if the extra computational costs are justied (Cordes & Kinzelbach 1996). Recent studies i & Belayneh (Geiger et al. 2004, 2006b; Mattha i et al. 2005a) have further demon2004; Mattha strated that excellent results can be obtained when using a classical Galerkin formulation to solve the pressure equation for non-linear problems on complex geometries. In the Bubnov Galerkin nite element formulation, we represent our geological domain by the computational domain V. It is discretized as a set



of nite elements (triangles or quadrilaterals in 2D, tetrahedra, hexahedra, prism or pyramid elements in 3D) spanning the nite element space V of continuous linear or quadratic polynomials. V has n Lagrange points N fxi gn i1 , representing the nodes or integration points of the nite elements. n It also has a set of basis functions Fxi i1 , V associated with each Lagrange point. x is the coordinate vector in one, two, or three dimensions. In its weak formulation, the pressure diffusion equation (Eqn 15) is: X @p Fi dx @t a

some algebraic modication ! n n X 1 tDt X X tDt A ptDt Kij Dt ij a j1 j1

n n X 1 t t X tDt X X Dt Aij p qi KtijDt ptca a : Dt a a j1 j1

(20) Equation 21 completes the nite element formulation of the compressible uid pressure equation (Eqn 15). To solve the mass balance equation (Eqn 1) by the nite volume method, it is integrated over the nite volume Vi that is associated with the corner node i of a nite element (Fig. 2).


1 rra la k ra

p pcaa rFi dx X ra la kgT rFi dx,



@ Mc dVi Vi @ t


r Fc dVi

qc dVi :


where, for convenience, the expression a [ fo, g, ag has been dropped. We then approximate the solution variable p using the interpolation px, t n P pj tFj x to arrive at the Galerkin formulation

Application of the Gauss divergence theorem to the ux term r Fc yields X @ Mc cj qc Vi , Vi Aj nj F @t ji



for xed time t:

n X dpj j1


tAij t ! pt pcaa tj Kij t qi t , (18)

n X X


where A and K are the mass and stiffness matrix, respectively, and q is the right-hand side vector. They have the following denitions:

Aij t Kij t qi t

bt Fj Fi d x

1 rFj ra la krFi dx r V a

ra la kgT rFi dx:



A is diagonalized using a row-summing technique. To compute the evolution of p from time t to time t Dt, the unconditionally stable implicit Euler formulation is best suited. This yields after

where f is the number of faces j bounding the nite volume Vi. A is the area, respectively length in two dimensions, of face j. n is the outward normal of j. cj denotes that it The tilde above the ux vector F is evaluated at the upwind nite volume, i.e. the nite volume that lies upstream of the direction of cj is evaluated at the upstream ow across face j. If F nite volume, the nite volume method is rst order accurate in space. This leads to dispersed saturation and concentration gradients because they cannot be resolved accurately by rst order accurate methods. cj is evaluated directly at the interface j between If F two neighbouring nite volumes using the gradient of Fc between these two nite volumes, the nite volume method becomes second order accurate in space. This resolves steep saturation and concentration gradients but leads to spurious oscillations, i.e. non-physical values, where gradients of Fc are steep. It is therefore necessary to apply a limiter, so-called Total Variation Diminishing (TVD) schemes (Harten 1983; Sweby 1984), to the value cj at interface j. TVD schemes remove any of F spurious oscillations. They have been applied successfully to unstructured nite volumes in combination with the IMPES approach for two-phase ow simulations (e.g. Bergamaschi et al. 1999; Huber & Helmig 1999; Geiger et al. 2004; i et al. 2005b). It is convenient for the Mattha



cj to express the phase higher order evaluation of F velocity va in terms of the total velocity vt. This results in a fractional ow, gravity, and capillary multiplier for vt, which are evaluated individually at interface j. The necessary algebraic manipulation is omitted and given elsewhere (Aziz & Settari 1979). As mentioned before, the auxiliary nite volume grid is virtual (Paluszny et al. 2007). The mass balance equation is solved in its discretized form (Eqn 22) on this virtual grid. Two different temporal discretizations of Equation 22 are possible and each has distinct advantages. In the IMPES approach, Equation 22 is discretized in time by an explicit Euler formulation to evolve the mass balance equation from time t to time t Dt. This yields:
tDt t Mc Mc

Application of algebraic multigrid methods

The resulting piecewise nite-element or nitevolume integrals of the governing equations (Eqns 20, 23, & 25) combine into systems of linear algebraic equations of the form A x b. Since the discretization of a complex three-dimensional structure often requires millions of nite element nodes, matrix A will contain millions of equations. An efcient matrix solver is therefore crucial for transient simulations of ow and transport in which the i & system A x b is solved repeatedly. Mattha Roberts (1996) have demonstrated that the nite element form of the transient pressure equation can be solved rapidly by algebraic multigrid methods (AMG) because A is sparse, symmetrical, and positive denite. Also, AMG methods do not require any geometric information on the computational domain. They initialize the solution vector x with a (v-cycle). A x b is then trial solution x restricted recursively to coarser grids and the trial solution is smoothed until A x b can be solved directly, for example by LU matrix decomposition. This solution is interpolated back onto successively . ner grids to obtain an improved trial solution x Repeated smoothing, coarsening, and interpolation with sufcient accuracy. nally yield a solution x We use the state-of-the-art algebraic multigrid ben 1999, 2001) for the efcient solver SAMG (Stu solution of the resulting matrix system. It can also be applied to the implicit solution of the mass balance equation (Eqn 25) where A is no longer symmetrical. The explicit solution of the transport equation (Eqn 23) is obtained sequentially by looping over the nite volumes (Geiger et al. 2004). AMG methods are not required.

Dt X tcj Dtqtci : Al nl F Vi ji


This formulation allows a straight-forward cal cj . It is culation of the higher-order ux terms F stable as long as the Courant-Friedrich-Levy (CFL) criterion is met which gives the maximum permissible timestep Dtmax  Dtmax ri vmax a  i [ V,


where ri is the radius of nite volume i and vmax the a maximum phase velocity in it. This ratio is evaluated for all nite volumes belonging to the nite element space V and its minimum yields the size of the permissible timestep. The CFL criterion displays the limitation of the IMPES approach: the phase velocities are generally highest where the nite volumes are smallest, for example in fractures. This allows a solution of the mass balance equation only for very small time-steps, although the ratio of nite volume radius to maximum velocity might be more favourable in other regions. To overcome the restrictions of the CFL criterion, Equation 22 can also be solved with an Implicit Pressure and Saturation approach i (IMPSAT; Gerritsen & Durlofsky 2005; Mattha et al. 2005b):
tDt t Mc Mc

Numerical simulation case studies Benchmarking of the CSMP black oil model with ECLIPSE
CSMP based transport models have recently been benchmarked on a variety of ow problems, demonstrating their suitability for compressible and incompressible, single- and multi-phase-, isothermal and non-isothermal uid ow problems (Geiger et al. 2006b). Here we present another benchmark of particular interest to fractured hydrocarbon reservoirs. For a three-dimensional single fracture model, solutions for incompressible twophase ow, including capillary and gravity effects with ECLIPSE are compared. The 50 20 10 m benchmark model is cut by a single vertical highpermeability fracture along its length (Fig. 3). It intersects horizontal injector and producer wells located at opposite upper and lower model edges,

Dt X Dt Dt tcj Al nl F Dtqtci : (25) Vi ji


However, this approach requires iterations cj must be because the non-linear ux term F known at time t Dt. This is often non-trivial, cj and its gradients must be evaluated especially if F for second order accurate solutions.



Fig. 3. Model dimensions and initial uid pressure in the fracture. The model is 50 20 10 m (length width height). The fracture (1 cm wide) cuts the rock along its length at z 10 m. The thin black lines show the outline of the nite element grid, consisting of hexahedral elements rening towards the fracture. Initially, a linear uid pressure gradient exists in the model. It is visualized here for the fracture only using a rainbow colour scheme (red 1.0 107 Pa, blue 5.0 107 Pa).

respectively. Water is injected into initially oilsaturated rock. Relative permeability and capillary pressure saturation curves are nonlinear and linear for the rock matrix and the fracture, respectively (Table 1). The pressures at the injector and producer are held constant throughout the simulation. Initially, a linear uid pressure gradient is present. So that we can run the model with ECLIPSE, it

has been discretized with a regular nite element grid consisting of hexahedra only. The grid is rened towards the 1 cm wide fracture which is represented by three layers of hexahedral elements with an aspect ratio of 333. Equations 6 and 16 have been solved on this grid, with Sg 0 in the nite element and nite volume framework implemented in CSMP .

Table 1. Petrophysical and uid properties used in the CSMP versus ECLIPSE comparison Property Fracture Permeability Porosity Capillary pressure Relative permeability Capillary entry pressure Residual sat. oil Residual sat. water Viscosity oil Viscosity water Density oil Density oil 1.0 10 m 0.7 Linear model* Linear model* 500 Pa 0.1 0.05 5.0 1024 Pa s 1.0 1023 Pa s 800 kg m23 1000 kg m23
212 2

Unit Matrix 1.0 10214 m2 0.25 Brooks Corey model Brooks Corey model 100 Pa 0.25 0.1 5.0 1024 Pa s 1.0 1023 Pa s 800 kg m23 1000 kg m23

*Relative permeability and capillary pressure are computed as a linear function of the effective water saturation. Relative permeability and capillary pressure are computed using the model by Brooks & Corey (1964) with an exponent of 3.



Fig. 4. Oil saturation for the CSMP two-phase simulation after 10.4 days. The oil saturation is shown in a rainbow colour scheme: (a) for the entire model; (b) along a cut plane in the fracture; and (c) perpendicular to the fracture in the centre of the model.



Fig. 5. Oil saturation for the ECLIPSE two-phase simulation after 10.6 days. The oil saturation is shown in a rainbow colour scheme (a) along the front of the model; (b) along a cut plane through the fracture; and (c) perpendicular to the fracture in the centre of the model.

Figures 4 and 5 are snapshots of our CSMP and ECLIPSE simulations after 10.4 and 10.6 days, respectively. They demonstrate a good agreement between both codes although the discretization is different: in ECLIPSE, saturation is constant in each cell and in CSMP it varies in a linear fashion which allows retention of steep gradients in saturation. The water-front in the ECLIPSE simulations appears to advance somewhat faster than in the CSMP simulation. This is probably an artefact of the rst order accurate solution in

ECLIPSE that tends to smear out the wateroil contact. Another small difference is that the lighter oil overrides the heavier water in the fracture. This is not observed in the CSMP simulation where water appears to override the oil.

Waterooding of fractured rock

Two discrete fracture models illustrate insights which can be gained from geologically realistic simulation of multi-phase ow in fractured porous



Fig. 6. Discrete fracture simulation example 1: (a) Waterood of a 2 2 0.2 km (length width height) model of a reservoir stochastically populated with 2000 fractures with a power-law diameter range from 5 180 m i et al. 2005a); geological input data are from San Andreas formation (CA, USA, FracMan model by Paul (Mattha LaPointe, Golder Associates, Inc.). Aperture is consistent with eld measurements and ranges between 0.5 and 3.5 mm correlating linearly with fracture diameter. (b) Evolution of total mobility during the water ood in comparison with a Brooks-Corey curve for a strongly heterogeneous model.

media: in both, we have solved Equation 6 and Equation 15 with Sg 0. Neither could have been represented by a structured grid and both show emergent behaviour. The rst (FRACS2000, Fig. 6) is a geologically fairly realistic although stochastically generated model of part of a waterwet fractured oil reservoir in the San Andreas formation, California, USA. Fracture aperture is linearly correlated with fracture diameter which has a Maxwell frequency distribution in both of two fracture sets. The fractures carry 150 times more of the cross-sectional ow than the rock matrix. Flow is fracture dominated although the model is below the fracture percolation threshold. The largest percolating cluster is about 550 m in length. Details of the parameterization of this 2-phase ow slightly compressible ow model are i et al. (2005a). described in Mattha Simultaneous monitoring of the evolving pattern of saturation and integral properties like total mobility reveals hidden system properties. Thus, in waterood simulations, total mobility monotonously decreases with increasing wetting front surface area (see later) and only a small fraction of the total fracture surface area, associated with the larger fractures, becomes ooded before the irreducible saturation is reached. Since countercurrent imbibition (CCI) can only occur where water imbibes a fracture, this simulation result aws the logic of dual porosity calculations which use a constant shape factor to estimate the effects of CCI on production. Also, total mobility is consistently lower than would be predicted from any parameterization of a Brooks-Corey relative

permeability model and the effective permeability of FRACS2000. The BC-assumption of a uniform saturation distribution is invalid for fractured systems. The second model (MARGATE, Fig. 7, cf. Belayneh et al. 2007), was constructed from a fracture map of chalk exposed in a cliff near Margate, UK. The fractures carry only about 85% of the total cross-sectional ow. The chalk at the base and top of the model is left intact. The MARGATE model was used to simulate gravitationally stabilized displacement of oil by heavier water injected at the base (Dr 200 kg m23). For the chosen injection rate, the bulk ratio between gravitational and viscous forces, G/n, is six. Thus, one would anticipate a stable horizontal oil water contact. Figure 7b shows that this assumption is wrong. The counter-intuitive model behaviour appears logical in hindsight because the simulation shows that G/n in the fractures is less than one and that capillary forces dominate in the chalk matrix. The two discrete fracture simulation examples highlight the potential of multi-phase uid-ow simulations with geologically realistic models. A few years ago, these simulations would not have been possible, certainly not without algebraic multigrid solvers. Beyond benchmarking and the demonstration of numerical methods on simple ow geometries, the decisive step necessary to gain new insights is the application of such new tools to relevant and realistic models. Once the controls on their behaviour have been claried, simplications can be made by the elimination of noninuential features and processes.



Fig. 7. Discrete fracture simulation example 2. (a) Exposure of fractured chalk at Margate, UK; (b) 8 1 6 m (length width height) model of an adjacent outcrop. Simulation snapshot after 174 days. Water injected from the base has shot up through the fracture network. Colour shading of saturation as in previous gure (red 0.9, blue 0.0).

Well tests in structurally complex reservoirs

The last application comprises the numerical simulation of a single-phase drawdown pump-test in a complex three-dimensional reservoir. Drawdown and build-up tests are routinely carried out in

hydrocarbon reservoirs. Well tests are often the only methods that allow us to estimate large-scale permeability of sedimentary units within a reservoir. The reservoir considered here extends 980 m, respectively 790 m into the horizontal directions and has a height of 310 m. It contains seven

Fig. 8. Geometry of the faulted multilayer reservoir used in the synthetic drawdown test. Its dimensions are 980 790 310 m (length width height). It contains seven folded sedimentary layers and sixteen impermeable fault zones. A horizontal well is located in the centre of LAYER 2, i.e. the second layer from the top. The top and bottom boundaries are no-ow boundaries. All other are constant pressure boundaries with pressures equal to the initial reservoir pressure pi.



folded sedimentary layers that are cut by sixteen impermeable fault zones (Fig. 8). The petrophysical properties of the sedimentary layers and fault zones are listed in Table 2. In the synthetic drawdown test presented here, a horizontal well in the centre of LAYER2 extracts uid from a 30-m completion well at a constant rate of 25 m3 per day for 100 days. The horizontal boundaries (top and bottom) are now-ow boundaries. All other boundaries are held xed at the initial reservoir pressure. To simulate drawdown in this reservoir, we discretized it with 1.67 million nite elements and 278 054 nodes. On this discretization, we solve Equation 15 with Sa 1 and So Sg 0 using the nite element formulation given by Equation 20. Figure 9 shows the pressure contours after 100 days of production. The pressure departs signicantly from a radial drawdown: Drawdown pressure is not transduced across the impermeable faults and at least parts of the reservoir are compartmentalized. The lowest pressures are observed directly

Table 2. Petrophysical and uid properties used in the drawdown simulation Unit Layer1 Layer2 Layer3 Layer4 Layer5 Layer6 Layer7 Faults Well Permeability (m2) 1.0 10215 1.0 10212 5.0 10213 1.0 10213 5.0 10214 1.0 10214 1.0 10215 Impermeable 1.0 1027 Porosity (%) 10 25 22 20 18 15 10 27 100

Property ct m q pi rw B

Value 5.0 10215 1.6 1023 25 2.0 107 0.125 1

Unit Pa21 Pa s m3 day21 Pa m

Fig. 9. Pressure contours after 100 days of production from the faulted multilayer reservoir. The red contour is within 1% of the initial reservoir pressure of 2.0 107 Pa. The lowest pressures (yellow and green colours) are found close to the horizontal well. There is a signicant departure from the classical radial drawdown due to the presence of impermeable faults. The grey surfaces show the layer boundaries and fault surfaces.



at the well. The non-radial drawdown due to reservoir heterogeneity is also apparent from the derivative plot. Well tests are commonly interpreted by comparison with analytical type curves. They are plotted in derivative plots that display the dimensionless wellbore pressure pD and its rate of change pD0 as a function of dimensionless time tD. pD and tD are dened as pD 2pkh pi pw qBm and tD kt , (26) 2 fmbt rw

faults. Still, such simulations complement automated type-curve analyses of observed wellbore pressures in complex reservoirs well. The approach presented here allows (i) investigation of the response of wellbore pressure to geologically realistic fault structures in a geometrically complex reservoir, (ii) analysis of how simulated well tests deviate from theoretical predictions and actual dynamic data, and (iii) examination whether other well tests, for example cross-hole interference tests, would be better suited.

k is the reservoir permeability, h the height of the reservoir, pi the initial reservoir pressure, pw the wellbore pressure, q the pumping rate, B the formation factor, and rw the wellbore radius. The response of the normalized wellbore pressure pD and its rate of change pD0 (Fig. 10) indicate that the reservoir is highly heterogeneous because pD0 deviates signicantly from a slope 0.5 that is typical for the innite acting period in a homogeneous reservoir. The results, however, do not clearly show the presence of low-permeability i et al. (1998), faults. As discussed by Mattha inhomogeneous reservoir permeabilities can lead to type curves that differ signicantly from theoretical predictions of the responses of low-permeability

The structural complexity, non-linear relative permeabilitycapillary pressure relationships, PVT relationships in equations of state for the uids, and the constitutive models for deforming rock make realistic simulation of SCR difcult. Usually non-linearities are linearized iteratively to obtain an internally consistent solution. Whether multiple constraints are honoured simultaneously by a fully coupled solution procedure or sequentially as in our iterative approach, the accuracy of the model will depend on the linearization strategies and how often the non-linearly coupled interdependent variables are updated. Therefore the price of a


pD and pD


pD p D'
0.1 1.0e+3 1.0e+4 1.0e+5 tD
Fig. 10. Derivative plot showing the dimensionless pressure pD and its rate of change pD0 as a function of dimensionless time tD for the simulated drawdown of the faulted multilayer reservoir.






1.0 x 104 Finite elements 1.0 x 105 Finite elements 6 0.5 x 10 Finite elements


10 Number of Processors [-]

Fig. 11. Scaling behaviour of parallelized CSMP nite element nite volume discretization for three meshes with different degrees of freedom.

higher accuracy is additional run-time and a genuine speedup can only be achieved by software parallelization. Although the benet of using additional processors diminishes with the number of processors, a hundred or even thousand fold speed increase which is theoretically possible on very large clusters would have a dramatic impact on the feasibility of geologically realistic sector-scale or even eld-scale simulations. Thus far, we have parallelized CSMP using the MPICH library and the parallel version of the commercial algebraic multigrid solver SAMGp. First tests gave promising results, showing an almost linear speed increase with the number of processors for meshes with over one million degrees of freedom (Fig. 11). Facing criticisms like those of Sasowsky (2006), the main challenge for complex systems modellers will be to control discretization, round-off, and truncation errors so closely that they the user has the possibility to dene a target level of uncertainty for a computation. In this goal-based approach, mesh renement, time-stepping, and variable updates will be tailored accordingly before the run starts and during the simulation. Dynamic mesh adaptivity based on error metrics (e.g. Power et al. 2006) will have a major role in facing this challenge.

resulting water-tight CAD model into an unstructured hybrid nite-element mesh. This is achieved by indirect incremental meshing, starting with an octree-based tetrahedralization and surface representations of large-aspect ratio features like faults. These are later extruded into volumes by growing layers of prism elements on them. Then, as many tetrahedra as possible are converted into hexahedra. These are interfaced with the tetrahedra using pyramid and prism elements. Finally, geological attributes and material properties are transferred to this mesh. Step 3 is the multi-phase ow simulation and analysis of emergent model behaviour, elucidating how processes operating on different length scales interact. The complex systems modelling platform (CSMP ) has been designed to facilitate such numerical experiments in the form of an application programmer interface (API). It implements a geology and process-based model decomposition in space and time and exploits any hierarchical aspects of solution variable elds through the application of algebraic multigrid methods to the spatio-temporal integration of the governing partial differential equations. Here, we used it for two-phase ow simulations combining nite elements with virtual nite volumes, achieving mass conservation at the lowest possible cost. A single-fracture model of this kind compared favourably with the ECLIPSE reservoir simulator. Simulation capabilities are also demonstrated for incompressible 2-phase ow and pressure-diffusion in a fractured and faulted sector-scale hydrocarbon reservoir model. Step 4, visualization, is indirectly addressed through the illustrations in this paper. Steps 5 and 6 of our workow, analysis and upscaling, respectively, are the subjects of other publications.
The authors thank the sponsors of the ITF project Improved Simulation of Fractured and Faulted Reservoirs for their support of the development of the transport methods and modelling workow. S. Geiger and D. Coumou thank the Swiss National Science Foundation for nancial support during their Ph.D. theses. We are also ben and his team the continuous support grateful to K. Stu with the SAMG solver.

Speed Up [-]

Appendix: software design considerations

Alexandrescu (2001) illustrates how generic programming with templates and design patterns can be used to design software that deals effectively with complexity, arbitrarily combined conguration options, and commands entered through a graphical user interface. A multi-physics complex-geometry simulation would be very difcult to verify as a whole (cf. Sasowsky 2006). The key issue here is that component failure must be detected exactly where and when it originates. This applies as much to

A new workow for the realistic simulation of coupled physical processes in structurally complex reservoirs is presented. Step 1, model building, involves the geological interpretation/representation of the structures of interest using a boundary representation and non-uniform regular B-spline curves and surfaces. Step 2 is to convert the


I ET AL. S. K. MATTHA because a transient model requires an initial state. The term essential condition is preferred over boundary condition because corresponding assignments may also be made somewhere inside the model domain. Input and output methods which transform the results of a computation into a human-readable format such as graphics, charts etc.

the software development process as to its actual application. The most stringent requirement imposed by this logic is that implementation and debugging must occur incrementally and testing of components must be possible in isolation. Once tested, further work on the tested components must not alter the already incrementally debugged code. CSMP was written in C because it is a high-level programming language suitable for large software projects involving multiple programmers (Stroustrup 1994) but still permits byte level coding for maximum efciency. Veldhuizen (1995) has shown that optimized C code can match the performance of Fortran 77 code and outperform Fortran 90. However, since a better algorithm can always lead to more dramatic performance improvements than compiler-based optimization or incrementally better hardware (Skiena 1998), we regard more advanced language features like templates as far more important (Barton & Nackman 1994; Alexandrescu 2001; Vandervoorde & Josuttis 2003). This appendix summarizes how the CSMP code for complex reservoir simulations benets from the features of C .


Requirements 1 and 2 are discussed in the main text of this paper. Requirement 3 is met by the generic design of an Algorithm class whose responsibility it is to assemble nite-element and nite-volume integrals into a global sparse matrix class and essential conditions into a righthand vector class. These are composed by classes representing individual integral terms. The solution of the matrix equations is possible with a variety of numerical methods made available as subclasses of Algorithm and a Solver class using the Strategy design pattern (Gamma et al. 1995). To support (3b) two types of operator classes are desirable: 1. Interrelations among physical variables that apply locally and without a need for global coupling mechanism(s). These can be expressed on unit cells of the discretization, the nite elements and nite volumes. They do not require integration or interpolation. For example, the hydraulic conductivity discretized on a nite element can be calculated from its permeability and a temperature and pressure dependent uid viscosity discretized on its nodes. Visitors for cell-based computations and a change in reference frame (Eulerian attached to the material; Lagrangian attached to the owing uid) when traversing the model or specic regions thereof. The name comes from an object-oriented design pattern used for the visitation of a hierarchy of objects (Gamma et al. 1995).

Reservoir model components

Any software infrastructure for the modelling of structurally complex reservoirs must support the following germane features of spatio-temporal computations: 1. A spatial discretization of the real-world system that is continuous to the atomic scale but, given runtime and memory limitations, can only be represented at a few selected points that link up into computational cells. The number of these points, excluding those where the property that shall be computed is known already, denes the degrees of freedom (DOF) or unknowns of the problem of interest. The DOF must be able to change at runtime if a simulation is expected to resolve emergent patterns. A set of physical variables derived from the governing equations and underlying constitutive relationships which are needed to capture the behaviour of interest. Spatial and temporal coupling mechanisms relating dependent variables with one another. These are (a) basic laws of physics expressed by partial differential equations (PDEs) that apply to the entire domain or regions thereof with particular properties; (b) constitutive relationships such as relative permeability models. Spatial and temporal integration of the PDEs acting on the model (3a) reveals the behaviour of interest. This necessitates fast and memory efcient solution algorithms for large sets of linear algebraic equations. Essential conditions and initial values of the dependent physical variables must be prescribed to the model as a prerequisite for a unique solution and 2.



An example of a discretized geological model (Fig. A1) claries the basic terminology and object relationships that are considered essential. It is represented by a SuperGroup class forming a composite of C Standard Template Library (STL) container classes which interconnect, manage, and store a hierarchy of Group, Element, Node and Integration-Point classes used to represent the nite element mesh, associated material properties, and discretized physical variables (Fig. A2). All these are user-dened abstract data types (ADTs; cf. Sengupta & Korobkin 1994), serving as blueprints for objects created just like any integral type: int x(12); SuperGroup model( mesh, model_topology ); The second statement constructs a computational model from a supplied mesh and topology objects. For the success of complex systems modelling it is essential that a programming language treats user-dened ADTs like in-built types, lending support to hierarchical





Fig. A1. Box-shaped, discretized model of a folded rock sequence illustrating our terminology for model entities. The computational model ( geometry connectivity data) is stored by the instance ( object) folded layer model of the blueprint SuperGroup class. It is discretized by a nite-element mesh to which permeability and porosity values are assigned as material properties. Selected sub-regions of the model are identied by Group objects with unique names. Here, the Group object sandstone is contiguous but this is not a requirement for groups. The functionality associated with groups could, for instance, be used to monitor the uid ux through this unit.

Folded layer model SuperGroup Shale 1 Group parent - daughter Sandstone Group parent - daughter Element 1 Element 4 shared among groups Shale 2 Group
programming and incremental debugging. Compiler recognition of ADTs is notably absent from procedural languages in which traditional reservoir simulation codes are written. Among other ensuing limitations, this implies that only primitive types can be passed among code modules ruling out encapsulation as a means to deal with complexity. SuperGroup objects are aggregates of geological entities represented by Groups knowing their boundary elements, faces, and nodes. Aggregate (cf. Booch 1994) refers to a runtime association of objects. Thus, group objects can be formed dynamically as patterns evolve, for instance, during the formation of fractures. Groups are important also as a means to restrict computation to specic arbitrarily shaped model regions. This embedding limits the spatial extent of computationally expensive calculations while realistic boundary conditions are obtained from less involved global calculations. The domain decomposition into groups can also be used for spatially variable time-stepping (certain regions are solved more often than others) and for distributed computations (parallel or vector processing). Group objects are also used for monitoring uxes through wells, across-faults and so forth. In summary, the functionality offered by Groups is essential because it carries forward into the computational model the Boolean geometric capabilities from the CAD model.

Node 1

Node 2 Element 3

neighbor Element 2

Node 3

Node 4 shared among elements

Node 5

Fig. A2. Unied modelling language (UML) representation of the class hierarchy we use for the representation of an unstructured nite-element mesh. In addition to the top down connections making this a tree structure there are also neighbour element and node to element connections making it a graph which can be traversed laterally or following streamlines.



Fig. A3. Two-dimensional triangular element mesh of a layered rock illustrating the placement of node and element variables and their numbering. In this mechanical model, grey-shading indicates domains with an elevated Youngs modulus. By contrast to a nite difference model where materials properties are averaged between adjacent grid cells, the use of arbitrarily shaped elements with piecewise constant properties supports discrete material interfaces.

Unstructured hybrid element meshes are fundamentally different from regular grids where cell neighbour information can be obtained by trivial operations. A nite element mesh is a tree-graph (Fig. A3), and elements, nodes, and integration points assume complementary roles in the assembly of integrals of governing partial differential equations. To resolve and track emergent patterns in the solution variable, this tree must be able to grow or loose branches. Such adaptations require a dynamic and multidirectional connectivity: nodes need to know their parent elements, elements their parent groups and neighbours. While there is a storage and runtime overhead associated with such operations, this connectivity also permits certain economies. Those material properties, for example, that have a constant value in a Group have to be stored only once. Since the functionality of any computational library eventually becomes insufcient, developers will need to add new capabilities. This must be possible without intervention in existing carefully unit-tested code. It can be achieved using inheritance and polymorphism (Cardelli & Wegner 1985). Abstract base classes like the aforementioned Visitor or Algorithm capture the commonalities of present and future subclasses so that developers can implement the desired new behaviour adhering to and building on standardized interfaces. A small code example serves to clarify the important role of polymorphism: function double kro(double sw, RelativePermeabilityModel rpm ); computes and returns the relative permeability for the oil phase, kro, for an input saturation of water, sw, and the supplied relative permeability model rpm. When the function kro() is implemented it is unlikely that all desirable relative permeability models are available to the implementer.

With polymorphism this is not an issue because as long as future implementations are inherited from RelativePermeabilityModel, function kro() will be able to apply them in computations such as: VanGenuchtenModel rpm; double kr_val = kro( 0.4, rpm ); The placement of material properties and physical variables on the nite element mesh is dependent on the discretization of the governing equations. By contrast with regular grid approaches, the nite element discretization supports a free-form representation of material interfaces across which properties vary discontinuously, i.e. from element to element (Fig. A3). Interoperable variable classes for scalars, vectors, and tensors need to be dened with a hardware platform independent precision to ensure portability of the code. Variable storage must be able to grow or shrink with the evolving mesh. To facilitate nite-element computations, the spatially distributed physical variables have to be associated with ags indicating to computational algorithms whether their values represent essential conditions or unknowns to be determined in the solution process. At a single nite element node, a uid pressure value may act as a Dirichlet condition whereas force is agged as Neumann variable. A simple computation of a steady-state uid pressure distribution in which such boundary conditions are applied is illustrated by the UML activity diagram (Fig. A4). Dynamic memory allocation and polymorphism permit that the decision of whether to construct certain memory intensive objects can be made at runtime. Thus, a HydraulicFractureVisitor enhancing permeability where uid pressure exceeds the conning stress plus the tensile strength of the rock is created only in



build SuperGroup

read input file create finite elements from pixels build model

assign material properties & initial conditions

assign Dirichlet boundary conditions

apply interrelation to calculate K

setup computational Algorithm

compute fluid pressure and Darcy velocity

display and output results to JPEG & VTK

Fig. A4. UML activity diagram for a calculation of a steady-state uid pressure distribution. simulations where uid pressure reaches a critical level. Specic solvers for matrices with certain characteristics can also be constructed on demand. To use available memory efciently, physical variables must be managed at runtime. For each variable we dene a physically meaningful value range at the outset of a computation, performing range checks during each write operation. This ascertains that component process errors are detected where they arise instead of being propagated. If process modules receive data outside of the input range for which they have been tested they will raise C exceptions (Stroustrup 1994). A certain number of these exceptions will prompt a computation to terminate while the model in its prefailure state is written to disk. This approach known as persistence, enables later debugging and data recovery. Initialization of oating point variables to NaN (not-a-number) is recommended to detect the accidental use of uninitialized variables. The NaN value is part of the Institute of Electrical and Electronics Engineering (IEEE) oating point standard, propagates itself through calculations and can be queried for. illustrates how the described classes interact in a twophase ow simulation. This program involves Interrelation and Visitor subclasses as well as an application specic layer of high-level software including the ZonedProductionWell class. An important feature of Algorithm-based computations revealed by the reservoir simulation program is that integral forms of partial differential equations (PDEs) arising from the nite-element method are assembled term by term using PDE operator classes (Integral_NT_op_N_dV etc.). This implementation is free of the complexities arising from the use of different element shapes and interpolation functions. These have already been dealt with on a lower layer of software. Further hierarchical module integration leads to more specic albeit simpler to use objects, for instance, for the solution of the pressure equation or multi-phase transport. As a further important implementation feature, most of the classes shown are C templates (Vandevoorde & Josuttis 2003). Templates are classes or functions which are dened using placeholders for the actual data types which they will eventually be applied to. Thus, a templatized matrix class could hold integers, ADTs etc. as specied by the user who can rely upon the compiler to identify whether this would lead to illegitimate operations. Without any runtime overhead, this technology elegantly

Reservoir model
A simplied representation of our rst command line version of a reservoir simulation program (Fig. A5),



Fig. A5. UML sequence diagram of a basic object-oriented reservoir simulation program written using the CSMP API. Boxes represent classes, lines indicate class associations. The slim vertical box marks the lifetime of the model (SuperGroup object) after its construction from alternative formats of input data.

SIMULATING MULTI-PHASE FLOW IN SCR removes the necessity to duplicate code for operations on different data types. Among the many benets of templates they make it possible to use the same high-level code for 1D, 2D and 3D models:
SuperGroup , double,2 . double_precision_model_in_2D; SuperGroup , oat,3 . single _precision_model_in_3D;


This greatly simplies unit testing and debugging. In summary, this Appendix outlines the original object-oriented software engineering approach and implementation of a multiphysics/complex geometry code suitable for structurally complex reservoirs. Modularity through compiler-supported abstract data types, hierarchical programming using polymorphism, and templates to implement the ability to add functionality without breaking incrementally veried code are at the core of this design.

A LEXANDRESCU , A. 2001. Modern C Design: Generic Programming and Design Patterns Applied. Addison Wesley, Boston. A ZIZ , K. & S ETTARI , A. 1979. Petroleum Reservoir Simulation. Applied Science Publishers, London. B AKER , T. J. 1989. Automatic mesh generation for complex three-dimensional regions using a constrained Delaunay triangulation. Engineering with Computers, 5, 161175. B ARTON , J. J. & N ACKMAN , L. R. 1994. Scientic and Engineering C . Addison-Wesley Longmann, Inc., Boston. I , S. K. 2006. B ELAYNEH , M., G EIGER , S. & M ATTHA Numerical Simulation of Water Injection into Layered Fractured Carbonate Reservoir Analogues. American Association of Petroleum Geologists Bulletin, 90, 1473 1493. I , S. K. & C OSGROVE , J. W. B ELAYNEH , M., M ATTHA 2007. The implications of fracture swarms in the chalk of SE England on the tectonic history of the basin and their impact on uid ow in high porosity, low permeability rocks. In: R IES , A. C., B UTLER , R. W. H. & G RAHAM , R. H.(eds) Deformation of the Continental Crust: The Legacy of Mike Coward. Geological Society, London, Special Publications, 272, 501519 B ERGAMSCHI , L., M ANTICA , S. & M ANZINI , G. 1999. A mixed nite element-nite volume formulation of the Black-Oil model. SIAM Journal on Scientic Computing, 20, 970997. B LACKER , T. D. 2000. Meeting the Challenge for Automated Conformal Hexahedral Meshing. Proceedings of the 9th International Meshing Roundtable, Sandia National Laboratories, NM, USA, October 25, 1119. B OGDANOV , I. I., M OURZENKO , V. V. & T HOVERT , J. F. 2003. Effective permeability of fractured porous media in steady state ow. Water Resources Research, 39, 1023; doi:1029/2001WR000756. B OOCH , G. 1994. Object-Oriented Analysis and Design with Applications. 2nd edn. Benjamin-Cummings, Redwood City, CA.

B ROOKS , R. H. & C OREY , A. T. 1964. Hydraulic Properties of Porous Media. Hydrological Paper 3, Colorado State University, USA. C ARDELLI , L. & W EGNER , P. 1985. On Understanding Types, Data Abstraction, and Polymorphism, from Computing Surveys. ACM Computing Surveys (CSUR), MIT Press archive 17, 471523. C HUNG , T. J. 2002. Computational Fluid Dynamics. Cambridge University Press, Cambridge. C ORDES , C. & K INZELBACH , W. 1996. Comment on Application of the mixed hybrid nite element approximation in a groundwater ow model: luxury , R., S IEGEL , P., A CKERER , or necessity? by M OSE P. & C HAVENT , G. Water Resources Research, 32, 1905 1909. C OUMOU , D., D RIESNER , T., G EIGER , S., H EINRICH , I , S. K. 2006. The dynamics of midC. A. & M ATTHA ocean ridge hydrothermal systems: Splitting plumes and uctuating vent temperatures. Earth and Planetary Science Letters, 245, 218 231. I , S. K., G EIGER , S. & C OUMOU , D., M ATTHA D RIESNER , T. 2008. A parallel FE-FV scheme to solve uid ow in complex geologic media. Computers and Geosciences, in review. D RIESNER , T. & H EINRICH , C. A. in press. Correlation formulae for phase relations in temperature-pressurecomposition space from 0 to 10008C, 0 to 5000 bar, and 0 to 1 X NaCl. Geochimica et Cosmochimica Acta, doi:10.1016/j.gca.2006.01.033 D URLOFSKY , L. J. 1993. A triangle based mixed nite element nite volume technique for modeling twophase ow through porous media. Journal of Computational Physics, 105, 252266. F ISHER , W. L. 1991. Future supply potential of US oil and natural gas. Geophysics: The Leading Edge of Exploration, 10, 1521. G AMMA , E., H ELM , R., J OHNSON , R. & V LISSIDES , J. 1995. Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley, Reading Massachusetts. G EIGER , S., H AGGERTY , R., D ILLES , J. H., R EED , M. H. I , S. K. 2002. New insights from reactive & M ATTHA transport modelling: the formation of the sericitic vein envelopes during early hydrothermal alteration at Butte, Montana. Geouids, 2, 185201. I , S. K., Z OPPOU , C. & G EIGER , S., R OBERTS , S., M ATTHA B URRI , A. 2004. Combining nite element and nite volume methods for efcient multi-phase ow simulation in highly heterogeneous and geometrically complex porous media. Geouids, 4, 284 299. G EIGER , S., D RIESNER , T., H EINRICH , C. A. & I , S. K. 2005. On the dynamics of NaCl M ATTHA H2O uid convection in the Earths crust. Journal of Geophysical Research, 110, B07101; doi:10.1029/ 2004JB003362. G EIGER , S., D RIESNER , T., H EINRICH , C. A. & I , S. K. 2006a. Multi-phase thermohaline M ATTHA convection in the Earths crust: I. A new nite element nite volume solution technique combined with a new equation of state for NaClH2O. Transport in Porous Media, 63, 399434. G EIGER , S., D RIESNER , T., H EINRICH , C. A. & I , S. K. 2006b Multi-phase thermohaline M ATTHA convection in the Earths crust: II. Benchmarking


I ET AL. S. K. MATTHA key to hydrothermal ore formation. Geology, 32, 357360. I , S. K., M EZENTSEV , A. & B ELAYNEH , M. M ATTHA 2005a. Control-volume nite-element two-phase ow experiments with fractured rock represented by unstructured 3D hybrid meshes. SPE Paper 93341. Proceedings of the SPE Reservoir Simulation Symposium, 31 January 2 February 2005. I , S. K., M EZENTSEV , A., P AIN , C. C. & M ATTHA E ATON , M. 2005b. A high-order TVD transport method for hybrid meshes on complex geological geometry. International Journal for Numerical Methods in Fluids, 45, 11811187. M ONTEAGUDO , J. E. P. & F IROOZABADI , A. 2004. Control-volume method for numerical simulation of two-phase immiscible ow in two- and threedimensional discrete-fractured media. Water Resources Research, 40, W07405; doi:1029/2003/WR002996. N ELSON , R. A. 1985. Geologic Analysis of Naturally Fractured Reservoirs. Gulf Professional Publishing, Co. O WEN , S. J. 2002. Meshing software survey webpage. Word Wide Web Address: http://www.andrew.cmu. edu/user/sowen/software. O WEN , S. J. & S AIGAL , S. 2001. Formation of pyramid elements for hexahedra to tetrahedra transitions. Computational Methods in Mechanical Engineering, 190, 4505 4518. I , S. K. & H OHMEYER , M. P ALUSZNY , A., M ATTHA 2007. Hybrid nite element nite volume discretization of complex geologic structures and a new simulation workow demonstrated on fractured rocks. Geouids, 7, 1 23. P OWER , P. W., P AIN , C. C., P IGGOTT , M. D. ET AL . 2006. Adjoint a posteriori error measures for goal-based anisotropic mesh optimisation. Ocean Modelling, 15, 3 38. P REPARATA , F. P. & S HAMOS , M. I. 1985. Computational Geometry: An Introduction. Springer Verlag, New York. R EISNER , M. 1987. Cadillac Desert: a History of Water Management in the American West. Viking Penguin Inc., New York, USA. S ASOWSKY , I. R. 2006. Model verication and documentation are needed. EOS AGU Transactions, 87, 3. SENGUPTA, S. & K OROBKIN , C. P. 1994. C ObjectOriented Data Structures. Springer Verlag, New York. S HEPHARD , M. S. & G EORGES , M. K. 1991. Threedimensional mesh generation by nite octree technique. International Journal for Numerical Methods in Engineering, 32, 709 749. S KIENA , S. S. 1998. The Algorithm Design Manual. Telos, The Electronic Library of Science, Springer-Verlag, New York. S OAVE , G. 1972. Equilibrium constants from a modied Redlich-Kwong equation of state. Chemical Engineering Science, 27, 11971203. S TONE , H. L. 1970. Probability model for estimating three-phase relative permeability. Journal of Petroleum Technology, 22, 214 218. S PYCHER , N., P RUESS , K. & E NNIS -K ING , J. 2003. CO2 H2O mixtures in the geological sequestration of CO2. I. Assessment and calculation of mutual solubilities from 12 to 100 degrees C and up to 600 bar. Geochimica et Cosmochimica Acta, 67, 30153031.

and application of a nite element nite volume technique with a new NaClH2O equation of state. Transport in Porous Media, 63, 435 461. G EORGE , P. L. & B OROUCHAKI , H. 1998. Delaunay Triangulation and Meshing: Application to Finite Elements. Hermes, France. G ERRITSEN , M. G. & D URLOFKSY , J. L. 2005 Modelling uid ow in oil reservoirs. Annual Reviews in Fluid Mechanics, 37, 211 238. G ILMAN , J. R. 2003. Practical aspects of simulation of fractured reservoirs. International Forum on Reservoir hl, Germany, June 2327. University Simulation, Bu of Leoben, Austria. H AAR , L., G ALLAGHER , J. S. & K ELL , G. S. 1984. NBS/ NRC Steam Tables. Hemisphere Publishing Corporation, New York. H ARTEN , A. 1983. High resolution schemes for hyperbolic conservation laws. Journal of Computational Physics, 49, 357393. H UBER , R. & H ELMIG , R. 1999. Multi-phase ow in heterogeneous porous media: A classical nite element method versus and implicit pressure-explicit saturation-based mixed nite element-nite volume approach. International Journal of Numerical Methods in Fluids, 29, 899920. H UYAKORN , P. S. & P INDER , G. F. 1983. Computational Methods in Subsurface Flow. Academic Press, New York, U.S.A. J UANES , R., S AMPER , J. & M OLINERO , J. 2002. A general and efcient formulation of fractures and boundary conditions in the nite element method. International Journal for Numerical Methods in Engineering, 54, 17511774. K ARIMI -F ARD , M., D URLOFSKY , L. J. & A ZIZI , K. 2005. An efcient discrete-fracture model applicable for general-purpose reservoir simulators. SPE Journal, 9, 227 236. K IM , J. & D EO , M. 2000. Finite element discrete fracture model for multi-phase ow in porous media. American Institute of Chemical Engineers Journal, 46, 11201130. L IENHARDT , P. 1991. Topological models for boundary representation: a comparison with n-dimensional generalized maps. Computer-Aided Design, 23, 59 82. I , S. K. & B ELAYNEH , M. 2004. Fluid ow parM ATTHA titioning between fractures and a permeable rock matrix. Geophysical Research Letters, 31, L07602; doi:10.1029/2003GL019027. I , S. K. & R OBERTS , S. 1996. The inuence of M ATTHA fault permeability on single-phase uid ow near fault-sand intersections: results from steady-state high resolution models of pressure-driven uid ow. American Association of Petroleum Geologists Bulletin, 80, 17631779. I , S. K., A YDIN , A., P OLLARD , D. D. & M ATTHA R OBERTS , S. 1998. Numerical simulation of departures from radial drawdown in a faulted sandstone reservoir with joints and deformation bands. In: J ONES , G., F ISHER , Q. J. & K NIPE , R. J. (eds) Faulting, Fault Sealing and Fluid Flow in Hydrocarbon Reservoirs. Geological Society London, Special Publications, 147, 157 191. I , S. K., D RIESNER , T. & H EINRICH , C. A. 2004. M ATTHA Large-scale advection and small-scale uid mixing: a

SIMULATING MULTI-PHASE FLOW IN SCR S TROUSTRUP , B. 1994. The Design and Evolution of C . Addison Wesley, Reading, Massachusetts. BEN , K. 1999. Algebraic multigrid (AMG): An introS TU duction with applications. GMD Forschungszentrum Informationstechnik GmbH, Sankt Augustin, Germany, Report 70. BEN , K. 2001. A review of algebraic multigrid. S TU Journal of Computational and Applied Mathematics, 128, 281 309. S WEBY , P. K. 1984. High resolution schemes using ux limiters for hyperbolic conservation laws. SIAM Journal on Numerical Analysis, 21, 9951011. T HOMPSON , J. F., W ARSI , Z. U. A. & M ASTIN , C. W. 1985. Numerical Grid Generation, Foundations and Applications. Elsevier, New York.


T HOMPSON , J. F., S ONI , B. & W EATHERILL , N. P. 1998. Handbook of Grid Generation. CRC Press, Boston, New York. V ANDEVOORDE , D. & J OSUTTIS , D. 2003. C Templates: The Complete Guide. Addison Wesley Inc., Boston. V AN G ENUCHTEN , M. T. 1980. A closed-form equation for predicting the hydraulic conductivity of unsaturated soils. Soil Science Society of America Journal, 44, 892 898. V ELDHUIZEN , T. 1995. Using C Metaprograms. C Report, 7, 36 43. W HITE , D. 1995. Automated Hexahedral Mesh Generation by Virtual Decomposition, Proceedings, 4th International Meshing Roundtable, Sandia National Laboratories, NM, USA, October, 165 176.