2/13/13
1
Programming 1-‐D Transient FEM Problem Example: Overpressure Genera@on in Sedimentary Basins
€
∂∂z
K ∂ ˆ h ∂z
⎡
⎣ ⎢
⎤
⎦ ⎥ = Ss
∂h∂t−ρs − ρ f
ρ f
∂L∂t
⎡
⎣ ⎢
⎤
⎦ ⎥
h – hydraulic head (m) L – eleva@on of sediment water interface ρs – wet bulk sediment (2.3 gm/cm3) ρf – water density (1 gm/cm3)
Observa@ons:
1. Solu@on domain & mesh must grow through @me
2. Upper element width is variable through @me
Example of Anomalous Pressure Phenomena
• Gulf of Mexico Basin, Uinta Basin (Utah), Arkoma Basin (Oklahoma), Pierre Shale (underpressured, South Dakota)
• Overpressures reach 75% of lithosta@c Levels
• Induced by rapid sedimenta@on associated with Mississippi River Deposi@on
• Why worry about this….this is a drilling hazard for all major oil companies
(Harrison and Summa, 1991)
2/13/13
2
FEM Method in 1D
• Uses (linear) Trial Solu@on for each element
€
ˆ h = a + bx h1 = a h2 = a + bΔx
b =h2 − h1
Δxˆ h = h1 +
h2 − h1
Δxx
ˆ h = h1 1− x Δx
⎡
⎣ ⎢ ⎤
⎦ ⎥ + h2
x Δx⎡
⎣ ⎢ ⎤
⎦ ⎥ = φnhn
n=1
2
∑
φ1 = 1− x Δx
⎡
⎣ ⎢ ⎤
⎦ ⎥ φ2 =
x Δx
φ -‐ Shape func@ons
€
∂∂z
K ∂h∂z
⎡
⎣ ⎢ ⎤
⎦ ⎥ − Ss
∂h∂t
−ρs − ρ f
ρ f
∂L∂t
⎡
⎣ ⎢
⎤
⎦ ⎥ ≠ 0
Shape Func@on Proper@es
• Linear varia@on across element from 0 to 1
• Deriva@ves of linear shape func@ons are constant
€
∂ ˆ h ∂x
=∂φn
∂xhn
n=1
2
∑
∂φ1
∂x= −
1Δx
∂φ2
∂x=
1Δx
2/13/13
3
Transient 1D-‐FEM
• Subs@tute Trial Solu@on into Diff. Eq.
• Mul@ply Trial Solu@on by a weigh@ng func@on and require the weighted residual errors integrate to zero across the element
€
∂∂z
K ∂ ˆ h ∂z
⎡
⎣ ⎢
⎤
⎦ ⎥ − Ss
∂ ˆ h ∂t−ρs − ρ f
ρ f
∂L∂t
⎡
⎣ ⎢
⎤
⎦ ⎥ ≠ 0
€
v ∂∂z
K ∂ ˆ h ∂z
⎛
⎝ ⎜
⎞
⎠ ⎟ dz − vSs
∂ ˆ h ∂t
dz + vSs
ρs − ρ f
ρ f
∂L∂t
dz0
Δz
∫0
Δz
∫0
Δz
∫ = 0
€
ˆ h = ΦNN=1
2∑ (x )hN
v = ΦMM =1
2∑ (x )
Steps in FEM Method, 1D Example
• Formulate Diff. Eq.
T – transmisivity (m2/day) H – head (m) Q – recharge (m/day)
h(0,t) = specified head q(L,t) = specifed flux
• Discre@ze Solu@on Domain
• Define Local Coordinate System
€
∂∂x
T ∂h∂x
⎡
⎣ ⎢ ⎤
⎦ ⎥ =Q
∂∂x
T ∂h∂x
⎡
⎣ ⎢ ⎤
⎦ ⎥ −Q = 0
€
0 ≤ x ≤ Δx Δx = x2 − x1
L
2/13/13
4
1D-‐FEM Steps
• Use Integra@on by parts to “lower the order of the PDE” of second deriva@ve term
• Subs@tute trial solu@on and weigh@ng func@on into “weak form of PDE”
€
∂∂z
K ∂ ˆ h ∂z
⎛
⎝ ⎜
⎞
⎠ ⎟
⎡
⎣ ⎢ ⎢
⎤
⎦ ⎥ ⎥ vdz = − K ∂v
∂z∂ ˆ h ∂z
dz − vK ∂ ˆ h ∂z
= 00
Δz
∫0
Δz
∫0
Δz
∫
0
€
−m=1
2
∑n=1
2
∑ K ∂φm∂z
∂φn∂z
hhdz +m=1
2
∑ Ssρs − ρ f
ρ f
∂Lm∂t
φmdz −hnk+1 − hn
k
Δt m=1
2
∑0
Δz
∫ Ssφmn=1
2
∑ φn = 00
Δz
∫0
Δx
∫
1D-‐FEM Steps
• This results in a system of algebraic Equa@ons
€
Amnhnk+1 +
PmnΔt
hnk+1 = Bm +
PmnΔt
hnk
€
Amn=m=1
2
∑n=1
2
∑ K ∂φm∂z
∂φn∂z
dz0
Δz
∫
Bm =Lmk+1 − Lm
k
Δtm=1
2
∑ Ssρs − ρ f
ρ f
φmdz = 00
Δz
∫
Pmn =m=1
2
∑n=1
2
∑ Ssφmφndz0
Δz
∫
2/13/13
5
FEM-‐1D Steps
€
Amn =KΔz
1 −1−1 1⎡
⎣ ⎢
⎤
⎦ ⎥
Bm = SsLmk+1 − Lm
k
Δtρs − ρ f
ρ f
Δz211⎡
⎣ ⎢ ⎤
⎦ ⎥
We already know how to determine the Amn matrix and Bm vector:
€
P11 = Ssφ1φ1dz0
Δz
∫ = Ss 1−zΔz
⎡
⎣ ⎢ ⎤
⎦ ⎥ 1− z
Δz⎡
⎣ ⎢ ⎤
⎦ ⎥ dz
0
Δz
∫ = Ss 1−2zΔz
+z2
Δz2⎡
⎣ ⎢
⎤
⎦ ⎥ dz
0
Δz
∫
€
P11 =|0Δz Ss z −
2z2
2Δz+
z3
3Δz2⎡
⎣ ⎢
⎤
⎦ ⎥ =
SsΔz6
Pmn:
FEM-‐1D Steps
€
P12 = Ssφ1φ2dz0
Δz
∫ = Ss 1−zΔz
⎡
⎣ ⎢ ⎤
⎦ ⎥ zΔz⎡
⎣ ⎢ ⎤
⎦ ⎥ dz
0
Δz
∫ = SszΔz
−z2
Δz2⎡
⎣ ⎢
⎤
⎦ ⎥ dz
0
Δz
∫
€
P12 =|0Δz Ss
2z2
2Δz−
z3
3Δz2⎡
⎣ ⎢
⎤
⎦ ⎥ =
SsΔz12
€
Pmn =SsΔz12
2 11 2⎡
⎣ ⎢
⎤
⎦ ⎥
2/13/13
6
cin_class
run@me = 0;
for it=1:n@me run@me = run@me + delt % zero out global s@ffness matrix and load vector subsid; len; matrix; apply_bc; % solve the system of equa@ons h = a\b; porperm;
output; end
Programming FEM: overpressure.m
overpressure.m
% set up parameters to run model cin_class % runtime = 0;
for it=1:ntime % runtime is simulation time in millions of years runtime = runtime + delt/1.0e6 % atemp is the thickness of the top element atemp = (z(nnode)-z(1)); % zero out global stiffness matrix and load vector a = zeros(nnode,nnode); b = zeros(nnode,1); % grow the mesh using subsid subsid; % calculate element length len = calen(nelem,i,j,z); matrix; apply_bc; % solve the system of equations h = a\b; porperm; output; end
2/13/13
7
NNODE -‐ number of nodes NELEM -‐ number of elements X -‐ node loca@ons H -‐ heads K -‐ hydraulic conduc@vity QD -‐ diffuse recharge NH -‐ node number of specified head node HB -‐ specified head boundary condi@on NHBC -‐ number of specified head boundary condi@ons NQ -‐ node number of specified flux node QB -‐ specified flux NQBC -‐ number of specified flux boundary condi@ons I, J -‐ node numbers associated with element "M"
cin_class
cin_class.m % aquifer parameters Ss=1.0e-‐4*ones(1,nelem); k=3.16e-‐3*ones(1,nelem);
% boundary condi@ons % specified head nhbc = 1; nh = [6]; hb = [1e4]; % specified flux nqbc = 1; nq = [1]; qb = [0];
% dimensioning matrices for the program % local capacitance and s@ffness matrices pp = zeros(2,2); aa = zeros(2,2); bb = zeros(2,1); % global s@ffness matrix a = zeros(nnode,nnode); % load vector b = zeros(nnode,1);
% output matrices
index = zeros(n@me,maxnodes); eleva@on = zeros(n@me,maxnodes); heads = zeros(n@me,maxnodes); porosity = zeros(n@me,maxnodes); permeability = zeros(n@me,maxnodes); pressure = zeros(n@me,maxnodes); pressureH = zeros(n@me,maxnodes); pressureL = zeros(n@me,maxnodes);
% ini@al number of nodes and elements nelem = 5; nnode = 6;
% approximate maximum number of nodes maxnodes = 100;
n@me = 476; delt = 4.0e4; vs = 5.0e-‐4; rho_f = 1000; rho_s = 2300; delz = 105;
% node-‐wise data: z = [9500,9600,9700,9800,9900,10000]; h = 1e5*ones(1,6); % define % element-‐wise data % connec@vity informa@on i=[1,2,3,4,5]; j=[2,3,4,5,6];
2/13/13
8
for n=1:nnode-‐1 z(n) = z(n) -‐ vs*delt; end
zcheck = z(nnode) -‐ z(nnode-‐1); delh = (h(nnode) -‐ h(nnode-‐1))/zcheck; if zcheck > delz nnode = nnode + 1; nelem = nelem + 1;
% resize a matrix and b vector a = zeros(nnode,nnode); b = zeros(nnode,1); i(nelem) = nnode -‐ 1; j(nelem) = nnode; k(nelem) = k(nelem-‐1); Ss(nelem) = Ss(nelem-‐1);
% resize phi and perm vectors phi(nnode) = phi(nnode-‐1); perm(nnode) = perm(nnode-‐1); nh(1) = nnode; z(nnode) = z(nnode-‐1); h(nnode) = h(nnode-‐1); % interpolate values of heads and eleva@on on newly generated nodes z(nnode-‐1) = z(nnode-‐2) + delz; h(nnode-‐1) = h(nnode-‐2) + delh*delz; end
for m=1:nelem len(m) = z(j(m)) -‐ z(i(m)); end
For m=1:nelem; ii = i(m); jj = j(m); relrho = (rho_s -‐ rho_f)/rho_f;
% form local matrices pp(1,1) = Ss(m)*len(m)/3.d+0; pp(1,2) = Ss(m)*len(m)/6.d+0; pp(2,1) = pp(1,2); pp(2,2) = pp(1,1); aa(1,1) = k(m)/len(m); aa(1,2) = -‐k(m)/len(m); aa(2,1) = aa(1,2); aa(2,2) = aa(1,1); bb(1) = Ss(m)*relrho*vs*len(m)/2.0+ (pp(1,1)/delt)*h(ii) ... + (pp(1,2)/delt)*h(jj); bb(2) = Ss(m)*relrho*vs*len(m)/2.0+ (pp(2,1)/delt)*h(ii) ... + (pp(2,2)/delt)*h(jj);
% form global a matrix a(ii,ii) = a(ii,ii) + aa(1,1) + pp(1,1)/delt; a(ii,jj) = a(ii,jj) + aa(1,2) + pp(1,2)/delt; a(jj,ii) = a(jj,ii) + aa(2,1) + pp(2,1)/delt; a(jj,jj) = a(jj,jj) + aa(2,2) + pp(2,2)/delt; b(ii) = b(ii) + bb(1); b(jj) = b(jj) + bb(2); end
matrix.m
2/13/13
9
% solve the system of equa@ons h = a\b;
for l=1:nhbc for n=1:nnode % zero row of A matrix a(nh(l),n) = 0.0d+0; end for n=1:nnode % move specified heads to B vector b(n) = b(n) -‐ a(n,nh(l))*hb(l); % now zero coefficient in A ma@x a(n,nh(l)) = 0.0d+0; end % put 1.0 on diagonal of A matrix a(nh(l),nh(l)) = 1.0d+0; b(nh(l)) = hb(l); end % apply specified flux b.c. for m=1:nqbc b(nq(m)) = b(nq(m)) + qb(m); end
porperm.m
beta = 3.0d-‐4; phi_o = 0.5d+0; for n=1:nnode pres = rho_f*g*(h(n) -‐ z(n)); presL = rho_s*g*(z(nnode) -‐ z(n)); sigmae = presL -‐ pres; aatemp = -‐beta*sigmae/(g*(rho_s-‐rho_f)); if aatemp > 0 aatemp = 0; end phi(n) = phi_o*exp(aatemp); perm(n) = exp(9.0*phi(n)-‐18.); end
trans10(it,1)=run@me; trans10(it,2)=h(1); trans10(it,3)=phi(1); trans10(it,4)=perm(1);
% store solu@ons in @me depedent ployng arrays for n=1:nnode pres = rho_f*g*(h(n) -‐ z(n))/1.d+6; presH = rho_f*g*(z(nnode) -‐ z(n))/1.d+6; presL = rho_s*g*(z(nnode) -‐ z(n))/1.d+6; index(it,n) = n; eleva@on(it,n) = z(n); heads(it,n) = h(n); porosity(it,n) = phi(n); permeability(it,n) = perm(n); pressure(it,n) = pres; pressureH(it,n) = presH; pressureL(it,n) = presL; end
€
φ = φo exp −βσ e( )φo – porosity at sediment-‐water interface β – pore compressibility σe – effec@ve stress
2/13/13
10
finalPress.m
showHeads.m (animated)
finalPhi.m
Graphical Output Rou@nes