investigations into the aftershock distribution of the l’aquila earthquake – modelling porous...

Upload: charlie-kenzie

Post on 09-Feb-2018

213 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/22/2019 Investigations into the aftershock distribution of the LAquila earthquake modelling porous fluid flow and pore pr

    1/8

    Investigations into the aftershock distribution of the LAquila earthquake

    modeling porous fluid flow and pore pressure changesCHARLIE KENZIE

    Department of Earth Sciences, University of Durham 2013

    1. INTRODUCTION

    1.1Geological and tectonic backgroundThe central Italian region of Abruzzi, and the

    large town of LAquila, are located on theAppenines thrust belt (Chiarabba et al 2009), a

    tectonically active region, which runs in a NW

    SE direction through central Italy (Butler et al2004), (Fig.1). Progressive thinning of theApennines thrust belt is mainly accommodatedby the faults in the central regions of Abruzzi and

    Umbria, with regular seismic events occurringthroughout the Northern Apennines. However,seismic activity further south, in central Abruzzi,has remained relatively low throughout the lastfew decades (Bagh et al 2007).

    On April 6th2009 an MW6.3 earthquake occurred

    at a depth of 9km, its epicenter only a few km

    away form LAquila (Atzori et al2009), (Fig.1).After the MW 6.3 event, two additionalearthquakes, MW5.6 and MW5.4, occurred at theedges of the main fault structure (Chiarabba et al2009).

    1.2Fracture criterionThe Coulomb fracture criterion is given by theequation

    s

    c n

    where s

    is the magnitude of the critical shear

    stress, is the coefficient of internal friction, andc is the geological constant cohesion, whichdescribes the resistance to shear fracture on aplane across which the normal stress is zero(Twiss & Moores 1992). Whenever the surface

    planar stress components (

    n and

    s

    ) satisfy

    Equation (1) a shear fracture can develop alongthat plane.

    When pore fluids are present in a rock, the rockbehaves as though the confining pressure hasdecreased by an amount equal to that of the pore

    fluid pressurePF(Twiss & Moores 1992), and inthis case, the fraction criterion remains the same

    apart from the normal stress n

    is replaced by

    effective normal stress En

    , which yields the

    equation

    s

    c En c nPF

    where En

    nP

    F The effect of adding pore fluids to a fracturesystem causes the critical shear stress

    s

    to

    decrease. This is geologically significant since

    ABSTRACT

    Explicit numerical integration is an effective way of modeling differential equations. We use a forward Euler time-steppingmethod to model the 2 dimensional pressure diffusion through the crust after seismogenic faulting, a process in which a low-

    permeability seal, overlying a sill-like water rich reservoir, is ruptured and causes the overpressured fluid below to propagate

    upwards into the fault zone. Seismogenic events are hypothesized to be related to strong aftershocks following the LAquilaearthquake in central Italy. However, our model showed that a 20MPa pressure contour propagates through the surrounding

    layers too slowly after initial faulting to explain the aftershock activity at LAquila. The model set up assumes certain geologicalconstraints, which make it difficult to determine the reliability of the model results and underlines the need for further modeltesting and a greater emphasis on more informed geological constraints.

    Fig.1 (a) Aftershock distribution of the LAquila earthquake

    along the Campotosto fault plotted as distance from the mainshock. Starred symbols represent main aftershock events. (b)

    Seismicity of the LAquila area. Focal mechanism from

    CMT inversion for the three main events are shown, togetherwith aftershock distribution, the historical seismicity (red

    circles) and the active faults (black lines).

    (1)

    (2)

  • 7/22/2019 Investigations into the aftershock distribution of the LAquila earthquake modelling porous fluid flow and pore pr

    2/8

    there is a decrease in differential stress necessary

    to cause failure and this allows fractures to occurin places where the rock would otherwise be

    stable.

    1.3Fluid reservoirsAs discussed above, a high fluid pore pressure

    can cause fault zones to become unstable. Zonesof fluid overpressure are commonly associatedwith seismogenic faulting (Sibson 1990), aprocess in which a low-permeability seal,overlying a sill-like water rich reservoir, isruptured and causes the overpressured fluid to

    propagate upwards into the fault zone(Gudmundson 1999). Conditions for theformation of a sub horizontal high porosity layeris that when the vertical stress is the minimum

    compressive stress, a condition that is commonlysatisfied by areas of thrust faulting (Gudmundson

    1999). If the fluid reservoir is then sealed offfrom the surroundings, usually by a lowpermeability layer, then its fluid pressurePFmaybecome greater than the lithostatic pressure aboveit.

    1.5 Seismogenic faulting at LAquilaIf high fluid overpressure is present in rocks it ispossible for large magnitude earthquakes to bereleased when failure of the rock occurs. It ishypothesized that the LAquila earthquake

    caused the seals of high porosity layers to fail,

    allowing for seismogenic faulting great enough toaccount for the large aftershocks that occrredsoon after the initial LAquila earthquake (Fig.1),(Chiarabba et al2009).

    2. MATLAB MODEL

    2.1 Setting up the model

    To investigate the possible links of seismogenicfaulting with the LAquila aftershocks, we aim tocreate a model that will compute the pressure

    diffusion through the crust after faulting. We set

    up a model that assumes two porous layers each 5

    km thick with a uniform permeabilityknorm = 10

    -15 m2. The layers are separated by a

    400m thick seal with a much lower permeabilitykseal=10

    -18m2. The top layer is assumed to have a

    hydrostatic pore fluid pressure, and the bottomlayer has an overpressure of 200 MPa above that

    of the hydrostatic pressure. To model the pressuredistribution caused by faulting, the MatLab codeis set up so that at time t = 0the seal is rupturedby a much higher permeability vertical fault kfault= 10

    -12 m

    2, also about 400m thick. The fault is

    modelled to run completley through both layers,

    the geometry of the layers and the permeabilityfield is shown in Fig.2.

    Fluid flow through the crust, and the diffusion ofpressure is taken from Darcys law, which isgiven in 2 dimensions by

    2 2

    2 2P P Pt x z

    where1

    andP = hydrostatic pressure, =porosity, = fluid compressibilityand = fluid viscosty.

    Darcys law can be modelled numerically byusing a forward Euler time-step. Discretization of

    Darcys law yields

    1 11 1

    2 2

    22 old old old new old old old old

    j j ji i i i i

    f f ff f f f f

    t x z

    The time step formula was implmented into aMatLab code, which can be seen in the appendix.The benefits of applying this method, is that it iscapable of reaching high numerical accuracywhilst being relatively easy to implement.

    2.2 Discretization and time steppingSince we are modelling layers in the order of1000s of meters, the discretization steps dz anddxwere initially chosen as 100m, which allows

    sensible precision without overloadingcomputation. Additonally, since time integrationmethods are only conditionally stable, it isimportant to choose a time step that is no largerthan the critical time step, otherwise thenumerical solution may become unstable (Askeset al 2011). Therefore in this case we used a vonNeumann stability analysis to calculate the

    stability criterion. From the discretized formulaof Darcys law, Equation 4, the error propogates

    as

    1 11 1

    2 2

    22 old old old new old old old old

    j j ji i i i i

    t x z

    giving

    Fig.2 Permeability field: fault shown in white, the seal

    shown in black and the surrounding rock shown in grey.

    (3)

    (4)

    (5)

  • 7/22/2019 Investigations into the aftershock distribution of the LAquila earthquake modelling porous fluid flow and pore pr

    3/8

    1, , 1 , 1, , 1(1 4 )new old old old old old

    ij i j i j i j i j i jr r r r where

    2

    tr

    x

    taking the worst case scenario, where errors

    compile

    , 1, 1, , 1 , 1

    old old old old old

    i j i j i j i j i j finally yields

    1 8new old i ir and

    1 8 1r or1

    4r

    This results in the stability criterion given by2

    4crit

    xt

    wherek

    and kis permeability

    In the model we define kas the permeability ofthe seal ksealas this is the most permeable layer

    and will result in the critical time step being aslow as possible. Additionally we set the timestep as a fraction of the crtical one (appendixcode line 16). This stops the error fromincreasing as computations in the model arecontinued, in other words, it ensures a stable

    system.3. MODEL RESULTS

    3.1 Running and testing the model

    The completed model is displayed in Fig.3,which shows the diffusion of pressure upwards

    through the fault from the overpressured layerinto the upper layer. With the initial parameters

    chosen as outlined above, the pressure diffusionthrough the layers is confined to within the fault.

    It is important to thouroughly quantitively test the

    model so a benchmarking technique was carriedout to compare my model against two

    independent codes. Exactly the same parameterswere chosen for both the models and run for the

    same amount of time, and they can be comparedin Fig.4 below. The models show slight

    differences in the widths of the fault, butotherwise they agree on the rate at which pressureis diffusing through the fault and that it isconfined to the fault. This is a good sign that ourmodel is numerically accurate.

    3.2 Resolution tests

    To investigate the accuracy and speed of themodel we first run a spatial resolution test bychanging the dz and dx parameters (Appendix

    code lines 5 & 6). A significant increase in thespatial resolution, dz and dx= 1000m, and causes

    the model to become numerical unstable.Additionally, the higher discretizaton steps only

    cause the computation to slow by about 1 second,showing that a lower resolution, such as 100m, issuitable as it allows accurate computation withoutforfeiting significant time for the model to run.

    Increasing the timestep from a small fraction to alarge fraction of the stability criterion showed nonoticible effect on the model. Only time steps

    over the critical value caused instability in themodel, and significant errors were only noticed atvalues much greater than the critical value. Asexpected, smaller time steps caused computationsto be carried out much slower. When the modelwas run at a tenth of the stability criterion themodel took almost a minute to compute foraround 6000 seconds, where as the time step at avalue nine tenths of the critical time step,computed for 12000 seconds in around 23seconds. Since a higher value timestep does notseem to inhibit the model performance, we

    proceeded with a value of nine tenths of thestability criterion (Apppendix line 16).Fig.3 Diffusion of pressure from an overpressure layer after a

    vertical fault ruptures an impermeable seal. Vertical distribution of

    pressure shows that the pressure diffusion is confined to the fault.

    Fig.4 Benchmarked models ran with exactly the same parametersand ran for the same number of time steps. Similarity with my

    model suggests that the model is numerically accurate. (J.Hooker

    2013) and (E.Gregory 2013).

    (6)

    (7)

    (8)

  • 7/22/2019 Investigations into the aftershock distribution of the LAquila earthquake modelling porous fluid flow and pore pr

    4/8

    3.3 Vector field and 20MPa contour

    To investigate the direction of pore fluid pressurediffusion, a vector plot was added to the model(Fig.5). The blue arrows show the velocity field ofthe pore fluid, which is obtained from Darcys law

    x

    k dPu

    dx

    where k = peremeability, = fluid viscosity andux= the volumetric flow rate per unit area in thex-direction.The vector plot gives an idea of the direction that

    the pore fluid pressure moves from the bottomoverpressured layer into the fault. The 20MPacontour is plotted ontop of the vector field(Fig.5). The model shows that the 20MPa contourrises through the fault and the upper layer at avelocity of approximately 0.05 ms-1, or 142

    mhour

    -1

    . Additionally, the depth of the 20MPacontour is also plotted against time in Fig.5c, and

    shows that after 10 days (900,000 seconds) thecontour has migrated almost 4km from the centre

    of the fault.

    3.4 Changing the permeability of the layersIf we change the permeability of the seal so that itis less than, or near to, the permeability of the

    fault, pressure diffusion through the layers is nolonger confined to the fault and instead moves

    through the seal and the fault. When thepermeabilities of the seal and the fault are madeequal (Fig.6b), pressure diffuses rapidly through

    the seal, and travels more slowly through the

    fault (Fig.6b). This is also shown by the 20MPacontour, as it also moves more slowly through thelayers (Fig.6b). Additionally, when thepermeabilities are equal the 20MPa contour alsotravels less distance away from the seal, and is

    shown to become stable and level out after 6days(Fig.6a).

    4. DISCUSSION

    4.1 Numerical accuracy

    Numerical analysis discussed in section 3.2shows that the chosen timestep is justifiable as itallows for a stable system and relatively lowerror. A spatial resolution of 100m allows the

    model to run in relative stability, however, it stillshows some numerical error. This is shown in

    Fig.7a, which plots the pressure as a function ofdepth. The model is set up so the pressurechanges instantenously at a depth of 5000m,however with a spatial resolution of 100m, themodel shows a slight pressure gradient whenchanging from the top to the bottom layer.Further numerical analysis revealed thatimproving the spatial resolution computed aninstantaneous change in pressure between thelayers. However, it was found that a decrease in

    the discretization steps resulted in thepermeability field shrinking by the same factor.This highlights the need for the model to be set

    up in such a way that the spatial resolution can bealtered without having a detrimental effect on themodel results and that, in this respect, more timeneeds to be spent improving the model.

    4.2 20MPa contour evidence for seismogenic

    faulting at LAquilaSeismogenic faulting at LAquilais thought to betriggered by pressure pulses, released from the

    main shock, with amplitudes in the range of 10 20MPa (Miller et al 2004). The distribution ofaftershock events is displayed in Fig.1a. Since the20MPa contour indicates the upper boundary of apulse that may cause seismogenic aftershocks, itcan be used to indicate in our model how far a

    Fig.5(a) Pressure diffusion through the fault with the vector field shown as blue arrows, 20MPa contour highlighted in blue.

    (b) Vector field of pore pressure through the fault, 20MPa contour shown as green line. (c) Depth of the 20MPa contour

    through time with knorm= 10-15

    m2, kseal=10

    -18m

    2andkfault=10

    -12m

    2Contour migrates about 4km in 10 days (900,000 seconds).

    Fig.6(a) 20 MPa contour plotted through time but this time the

    permeability of the fault and the seal are equal. The contour

    shows greater depths through time indicating that it is dissipating

    at a slower rate. (b) Diffusion of pressure moves through the seal

    as well as the fault when kseal =kfault=10-12

    m2.

    (a) (b) (c)

    (b)(a)

  • 7/22/2019 Investigations into the aftershock distribution of the LAquila earthquake modelling porous fluid flow and pore pr

    5/8

    potential aftershock would be from the centre of

    the fault.When the 20MPa contour is plotted with the

    initial parameters outlined in section 2.1 (Fig.5c),the contour shows a similar curve geometry to

    that of the seismic distribution shown in Fig.1a.However, our model indicates that aftershocks

    would occur much closer to the initial hypocentreover a period of 10 days, with distances from thecentre of the fault only a fraction of that requiredto fit with the aftershock data shown in Fig.1a.

    Model analysis involving equating the

    permeabilities of the fault and the seal show thatthe 20 MPa contour indicates even smallerdistances to possible aftershocks (Fig.6a) withthese parameters. This indicates that the

    permeability of the fault must be reduced in orderto increase the rate at which the 20MPa contour

    migrates through the layers. Increasing thepermeability of the fault to 10-11 m2 computes a20MPa contour as shown in Fig.7b.

    An increased rate of pressure diffusion allows themodel to compute the 20Mpa contour to show anoffset of 4km after 1 day (85000 seconds), whichaggrees with aftershock data shown in Fig.1.However, because at a lower permeability thefluids can pass through the fault much easier, the20MPa contour stabilises after just one day,

    disagreeing with the seismic trend shown in

    Fig.1a. Further model analysis revealed that evenafter assigning the overpressure in the secondlayer to 1000 MPa, and also plotting the 10 MPacontour instead, the plot still did not agree withthe seismic data in Fig1a.

    This indicates that our model is unsuccesful infully explaining the aftershocks observed atLAquila. It may suggest that further parameters

    need to be added to the model that may have aneffect on the pressure diffusion through the layers.This further underlines the need for furtherimprovement of the model and the

    implementation of more informed geological

    constraints.

    4.2 Assumptions of the model and conclusion

    The model assumes a vertical fault, cuttingcompletely through both layers. However, inreality the fault geometries are shown to be

    oblique and at a variety of angles. Focalmechanisms shown in Fig.1, suggest that theaftershock slip motions were oblique. In additionthe fault ruptured by the earthquake developed ona planar 45 SW-dipping fault (Chiarabba et al2009). Dipping faults are not acounted for in our

    model and this is likely to cause uncertainties, andthe model results are less reliable. Again thisunderlines the need to improve the model byadding in parameters in aggreeance with

    geological constraints. Addtionally, we model theseal as a horizontal concordant layer and we

    assume that all the layers have a constanthomogenous permeability. In reality, this isunlikely to be true, as in areas of tectonic activity,where deformation of the crust is common,lihtological layers are rarely horizontal orhomogenous in their properties or geometry. It is

    equally reasonable to suggest that other faults orhydrofractures could cause diffusion of pressure

    not accounted for by our model.

    In conclusion, the model can not be applied to theaftershocks at LAquila. This may be because

    another mechanism, other than seismogenicfaulting, has occurred. Conversley, it couldequally be that our model is inadequate tosuccesfully model this mechanism and that more

    time needs to be taken to extend the model byadding extra parameters based on informed

    geological constraints.

    REFERENCES

    Fig.7(a) 20 Pressure plotted against depth. With a spatialresolution of 100m, an instantaneous change is not computed

    correctly, indicating the spatial resolution is not high enough (b)

    20MPa contour when kfault=10-11

    m2, contour stabilizes after one

    day, disagreeing with seismic data.

    ASKES, H., Nguyen, D. C., & Tyas, A. (2011). Increasing the critical

    time step: micro-inertia, inertia penalties and mass scaling.

    Computational Mechanics, 47(6), 657-667.ATZORI, S., Hunstad, I., Chini, M., Salvi, A., Tolomei, C., Bignami, C.,

    et al. (2009). Finite fault inversion of DInSAR coseismicdisplacement of the 2009 L'Aquila earthquake (central Italy).Geophysical Research Letters , 36, L15305.

    BAGH, S., Chiaraluce, L., De Gori, P., Moretti, M., Govoni, A.,

    Chiarabba, C., et al. (2007). Background seismicity in the centralApennines of Italy: The Abruzzo region case study. Tectonic

    physics(444), 80-92.

    BAILEY, I. W., & Ben-Zion, Y. (2009, June). Statistics of Earthquake

    Stress Drops on a Heterogenous Fault in an Elastic Half-Space.

    Bulletin of the Seismological Society of America, 99(3), 1786-1800.BUTLER, R. W., Mazzoli, S., Corrado, S., De Donatis, M., Di Bucci,

    D., Gambini, R., et al. (2004). Applying Thick-skinned Tectonic

    Models to the Apennine Thrust Belt of Italy Limitations andImplications. In K. R. McClay, Thrust Tectonics and hydrocarbon

    systems(pp. 647-667). AAPG Memoir 82.

    CHIARABBA, C., Amato, A., Anselmi, M., Baccheschi, P., Bianchi, I.,

    Cattaneo, M., et al. (2009). The 2009 L'Aquila (central Italy) Mw6.4 earthquake; Main shock and aftershocks. Geophysical research

    letters 36, 36, L18308.

    GUDMUNDSSON, A. (1999). Fluid overpressure and stress drop in

    fault zones. Geophysical Research Letters, 26(1), 115-118.

    MILLER, S. A., Collettini, C., Chiaraluce, L., Cocco, M., Barchi, M., &Kaus, B. P. (2004, February 19). Aftershocks driven by a high

    pressure CO2 source at depth.Nature, 427, 724-727.

    TWISS, R. J., & Moores, E. M. (1992). Structural Geology & Tectonics.California: W. H. Freeman and Company.

    (b)(a)

  • 7/22/2019 Investigations into the aftershock distribution of the LAquila earthquake modelling porous fluid flow and pore pr

    6/8

    APPENDIX

    functionPerm_Modelling1tic2% initial parameters3k = 1e-6; % diffusivity4dx = 100 % x-discretization step5dz = 100; % z-discretization step6kseal = 1e-18 %permeability of seal7

    8porosity = 0.059beta = 1e-8 % fluid compressibility10viscosity = 1e-411kfault = 1e-12;% permeability of fault12knorm = 1e-15 %permeability elsewhere13kappa = (kfault/porosity/beta/viscosity);14coeff = (1/porosity/beta/viscosity);15dt = 0.9.*dx^2./(4*kappa); % timestep (see Equation 4 in main text)16t=0 % set time to zero17Pcontour = 20e618h = 1e4; % box size height( 2, 5km layers)19hor = 5e3; % each horizontal box of size 5km)20nx = ceil(hor/dx+1);21nz = ceil(h/dz+1);22nt = 100; % number of tsteps to run code23time = zeros(nt,1);24fmax = 200e6; % max f-value25

    26

    27x = 0:dx:hor; %creates an array of x from 0 to 5000m28z = 0:dz:h; %creates an array of z from 0 to 5000m29[xx,zz]=meshgrid(x,z); % build a 2D grid from two 1D ones30xxMP = (xx(:,1:end-1)+xx(:,2:end))/2;31zzMP = (zz(1:end-1,:)+zz(2:end,:))/2;32

    33

    % Initial pressure conditions:34Perm=ones(nz,nx).*10^-15; % array of initial permeability35fault = floor((2400/hor)*nx):ceil((2600/hor)*nx); % define position of fault36seal = floor((4800/h)*nz):ceil((5200/h)*nz); % define position of seal37

    38% Initial permeability conditions:39Perm(seal,1:end) = kseal; % defining permeability of seal40Perm(1:end,fault) = kfault; % defining permeability of fault41

    42% build a 2D grid (similar to xxMP, zzMP) to model changing permeability43% through crust44PermxMP = (Perm(:,1:end-1)+Perm(:,2:end))/2;45PermzMP = (Perm(1:end-1,:)+Perm(2:end,:))/2;46

    % kz = ones(size(zzMP))47% kx = ones(size(xxMP))48

    49%kz(seal,1:end)=(kseal/porosity/beta/viscosity); 50%kx(seal,1:end)=(kfault/porosity/beta/viscosity); 51

    52fold = zeros(nz,nx);53xrange = 1:(1*nx);54zrange = ceil((5200/h)*nz):nz;55fold(zrange,xrange) = fmax;56

    57% Plot permeability field58

    figure(1), clf59

    pcolor(xx,zz,log10(Perm));60shading FLAT61colormap gray62

  • 7/22/2019 Investigations into the aftershock distribution of the LAquila earthquake modelling porous fluid flow and pore pr

    7/8

    xlabel('x')63ylabel('z')64

    set (gca,'YDir','reverse');6566

    % Plot Pressure with depth to show the resolution of pressure boundary67figure (2), clf68plot(fold(:,0.5*nx-0.5),z,'LineWidth',4)69xlabel('Pressure (MPa)')70ylabel('z')71

    72% timestepping73forit=1:nt;74%update time75t = t+dt;76time(it) = t;77tyears=floor(t./(60*60*24*365));78

    79

    80% apply one numerical diffusion timestep:81fnew = twoDdiff(fold, xx, zz, xxMP, zzMP, PermzMP, PermxMP, coeff, dt);82

    83% define a 1D array in the fault to use for contour 20MPa84finterp(it) = MYinterp(fnew(:,0.5*nx-0.5),z,Pcontour);85

    86% plot the pressure through the fault and seal87figure(3), clf88

    pcolor (xx,zz,fnew)89shading interp;90h=colorbar('location','southoutside')91ylabel(h, 'Pressure (Pa)')92colormap(hot);93legend94xlabel('x')95ylabel('z')96title(['time (s)',num2str(floor(t))])97

    set (gca,'YDir','reverse');9899

    % plot the pressure through the fault and seal this time with contour and vector100plot overlain101figure(4), clf102

    pcolor (xx,zz,fnew)103shading interp;104h=colorbar('location','southoutside')105ylabel(h, 'Pressure (Pa)')106colormap(hot);107legend108

    xlabel('x')109ylabel('z')110title(['time (s)',num2str(floor(t))])111axis([1500,3500,3000,7000])112

    % overlay vector plot113hold on114[dPdx,dPdz]=gradient(fnew);115vx=-Perm.*dPdx/viscosity;116vz=-Perm.*dPdz/viscosity;117quiver(xx,zz,vx,vz,3)118quiver(xx(1:2:end,1:2:end),zz(1:2:end,1:2:end),vx(1:2:end,1:2:end),vz(1:2:end,1:1192:end),3)120set (gca,'YDir','reverse');121

    % overlay 20 MPa contour122hold on123contour (xx,zz,fnew,[20e6, 20e6],'LineWidth',1.5,'LineColor',[0 0 1])124%plot the vector field of pore fluid pressure ascending through the fault.125

  • 7/22/2019 Investigations into the aftershock distribution of the LAquila earthquake modelling porous fluid flow and pore pr

    8/8

    figure(5), clf126quiver(xx,zz,vx,vz,3)127set (gca,'YDir','reverse');128hold on129contour (xx,zz,fnew,[20e6, 20e6])130title(['time (s) at ',num2str(floor(t)),])131axis([1500,3500,3000,7000])132xlabel('x')133ylabel('z')134

    %prepare for next time step:135fold = fnew;136end137% %**************************************************************************138

    139%Plot 20MPa pressure contour against time140figure (6), clf141plot(time,finterp,'LineWidth',1.5)142xlabel(['time (s)',num2str(floor(t))])143ylabel('z [m]')144title(['Depth of 20MPa isobar'])145

    146147functionfout = twoDdiff (fin,xx,zz,xxMP,zzMP,PermzMP,PermxMP,coeff,dt);148

    % (use the same philosophy as for the 1D diffusion code to149% calculate 2D diffusion)150

    dfdzz=PermzMP.*diff(fin,1,1)./diff(zz,1,1); 151d2fdzz2=diff(dfdzz,1,1)./diff(zzMP,1,1); 152dfdxx=PermxMP.*diff(fin,1,2)./diff(xx,1,2); 153d2fdxx2=diff(dfdxx,1,2)./diff(xxMP,1,2); 154% make an array of zeros with size xx, and call dfdt155dfdt=zeros(size(xx));156% lay the arrays of d2fdzz2 and d2fdxx2 on top of array of the zeros array.157% This is because the two initial arrays are different sizes, and unable to158

    % compute at the boundaries.159 % This process makes all boundary values 0 and allows for the final160% computation of the differential equation.161dfdt(2:end-1,2:end-1)=coeff.*(d2fdzz2(:,2:end-1)+d2fdxx2(2:end-1,:)); 162

    163%Apply fixed f boundaries164fout=fin+dfdt*dt;165

    166% Separate function for the 20MPa contour.167functionfinterp = MYinterp(fnew,z,Pcontour)168% find interval where f-f0 changes sign:169larger=fnew>Pcontour;170ifsum(larger) == 0;171

    finterp = NaN;172elseix=find(diff(larger)==1)+1;173

    % interpolate to find where exaclty on this interval f=f0:174finterp=-(z(ix)-(fnew(ix)-Pcontour)/(fnew(ix)-fnew(ix-1))*(z(ix)-z(ix-1))); 175end176toc177

    178