1 Stokes equations with FD on a staggered grid using the stream ...
1 Stokes equations with FD on a staggered grid using the stream ...
1 Stokes equations with FD on a staggered grid using the stream ...
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
1 STOKES EQUATIONSWITH<str<strong>on</strong>g>FD</str<strong>on</strong>g> ON ASTAGGEREDGRIDUSINGTHE<br />
STREAM-FUNCTIONAPPROACH.<br />
Figure1: Discretizati<strong>on</strong>for<strong>the</strong><strong>stream</strong>functi<strong>on</strong>approach. Theboundaryc<strong>on</strong>diti<strong>on</strong>saresetthrough<br />
fictiousboundarypoints.<br />
1 <str<strong>on</strong>g>Stokes</str<strong>on</strong>g> <str<strong>on</strong>g>equati<strong>on</strong>s</str<strong>on</strong>g> <str<strong>on</strong>g>with</str<strong>on</strong>g> <str<strong>on</strong>g>FD</str<strong>on</strong>g> <strong>on</strong> a <strong>staggered</strong> <strong>grid</strong> <strong>using</strong> <strong>the</strong><br />
<strong>stream</strong>-functi<strong>on</strong>approach.<br />
1.1 Introducti<strong>on</strong><br />
As was discussed in sec. ??, <strong>the</strong> basis of basically all mantle c<strong>on</strong>vecti<strong>on</strong> and lithospheric<br />
dynamicscodes are <strong>the</strong> <str<strong>on</strong>g>Stokes</str<strong>on</strong>g> <str<strong>on</strong>g>equati<strong>on</strong>s</str<strong>on</strong>g> for slowly movingviscous fluids.<br />
There are several ways to solve those <str<strong>on</strong>g>equati<strong>on</strong>s</str<strong>on</strong>g>, and <strong>the</strong> goal of this exercise is to<br />
use a <strong>stream</strong>functi<strong>on</strong>, finite difference approach. Stream functi<strong>on</strong> means that <strong>the</strong>re is a<br />
potential field which we solve for, and <strong>the</strong>n obtain velocities from <strong>the</strong> derivatives of this<br />
field. The advantage of this approach is that <strong>the</strong> c<strong>on</strong>tinuity equati<strong>on</strong> for incompressible<br />
flow can be satisfied implicitly, ra<strong>the</strong>r than having to use a panelty parameter as for <strong>the</strong><br />
primitive variable approach of sec. ??. (It is, however, possible to formulate <strong>the</strong> <strong>stream</strong><br />
functi<strong>on</strong> method for compressible c<strong>on</strong>vecti<strong>on</strong> approximati<strong>on</strong>s, e.g. ?). For a comparis<strong>on</strong><br />
ofdifferent finite difference approaches, see ?, for example.<br />
Themainchallengesofthisprojectare,1),havingfairlyhigh-orderandmixedderivatives<br />
(up to4 th order) and,2), setting of boundaryc<strong>on</strong>diti<strong>on</strong>s.<br />
1.2 Governing<str<strong>on</strong>g>equati<strong>on</strong>s</str<strong>on</strong>g><br />
It is assumed that <strong>the</strong> rheology is incompressible and that <strong>the</strong> rheology is Newt<strong>on</strong>ian<br />
viscous. In thiscase, <strong>the</strong> governing <str<strong>on</strong>g>equati<strong>on</strong>s</str<strong>on</strong>g>are (see sec. ??):<br />
USCGEOL557: ModelingEarth Systems 1
1 STOKES EQUATIONSWITH<str<strong>on</strong>g>FD</str<strong>on</strong>g> ON ASTAGGEREDGRIDUSINGTHE<br />
STREAM-FUNCTIONAPPROACH.<br />
∂v x<br />
∂x + ∂v z<br />
= 0<br />
∂z<br />
(1)<br />
∂σ xx<br />
∂x + ∂σ xz<br />
= 0<br />
∂z<br />
(2)<br />
∂σ xz<br />
∂x + ∂σ zz<br />
− ρg = 0<br />
∂z<br />
(3)<br />
σ xx = −p +2µ ∂v x<br />
∂x<br />
σ zz = −p +2µ ∂v z<br />
( ∂z<br />
∂vx<br />
σ xz = µ<br />
∂z + ∂v )<br />
z<br />
∂x<br />
Bysubstituting eqs.(4)-(6) into eqs.(1)-(3), weobtain (compare sec. ??)<br />
− ∂p<br />
∂x +2 ∂ (<br />
∂x<br />
− ∂p<br />
∂z +2 ∂ ∂z<br />
µ ∂v x<br />
∂x<br />
(<br />
µ ∂v z<br />
∂z<br />
∂v x<br />
∂x + ∂v z<br />
)<br />
∂z<br />
+ ∂ ( ( ∂vx<br />
µ<br />
∂z ∂z + ∂v ))<br />
z<br />
∂x<br />
)<br />
+ ∂ ( ( ∂vx<br />
µ<br />
∂x ∂z + ∂v ))<br />
z<br />
∂x<br />
(4)<br />
(5)<br />
(6)<br />
= 0 (7)<br />
= 0 (8)<br />
= ρg (9)<br />
We can eliminate pressure from eqs. (8) and (9) by taking <strong>the</strong> derivative of eq. (8) versus<br />
z andsubtracting eq. (9)derivedversus x. Thisresults in:<br />
(<br />
2 ∂2<br />
µ ∂v (<br />
x<br />
)−2 ∂2<br />
µ ∂v )<br />
z<br />
+<br />
∂x∂z ∂x ∂x∂z ∂z<br />
∂ 2 ( ( ∂vx<br />
∂z 2 µ<br />
∂z + ∂v ( (<br />
z<br />
))− ∂2 ∂vx<br />
∂x ∂x 2 µ<br />
∂z + ∂v ))<br />
z<br />
= − ∂ ρg. (10)<br />
∂x<br />
∂x<br />
Wecan alsouse <strong>the</strong> incompressibility c<strong>on</strong>straint (7)to simplify things alittle bitmore:<br />
(<br />
−4 ∂2<br />
µ ∂v )<br />
z<br />
+<br />
∂x∂z ∂z<br />
∂ 2 ( ( ∂vx<br />
∂z 2 µ<br />
∂z + ∂v ( (<br />
z<br />
))− ∂2 ∂vx<br />
∂x ∂x 2 µ<br />
∂z + ∂v ))<br />
z<br />
= − ∂ ρg (11)<br />
∂x<br />
∂x<br />
Now we introduce a variable Ψ (<strong>the</strong> <strong>stream</strong> functi<strong>on</strong>) which is defined by its relati<strong>on</strong>ship<br />
to <strong>the</strong> velocities as<br />
v x = ∂Ψ<br />
∂z<br />
v z = − ∂Ψ<br />
∂x<br />
USCGEOL557: ModelingEarth Systems 2<br />
(12)<br />
(13)
1 STOKES EQUATIONSWITH<str<strong>on</strong>g>FD</str<strong>on</strong>g> ON ASTAGGEREDGRIDUSINGTHE<br />
STREAM-FUNCTIONAPPROACH.<br />
Note that Ψ satisfies incompressibility byplugging eqs. (12)and(13)into eq.(1).<br />
By<strong>using</strong> Ψ, we can write eq. (11)as:<br />
∂ 2 ( ( ∂ 2 )) (<br />
Ψ<br />
∂z 2 µ<br />
∂z 2 − ∂2 Ψ<br />
∂x 2 − ∂2<br />
∂x 2 µ<br />
4 ∂2<br />
( )<br />
µ ∂2 Ψ<br />
∂x∂z<br />
∂x∂z<br />
( ∂ 2 ))<br />
Ψ<br />
∂z 2 − ∂2 Ψ<br />
∂x 2<br />
+<br />
= − ∂ ρg. (14)<br />
∂x<br />
Note that this equati<strong>on</strong> now has 4 th order derivatives for Ψ (easier to see for c<strong>on</strong>stant µ,<br />
where we can pull <strong>the</strong> viscosity out of <strong>the</strong> derivatives.) The challenge is to solve eq. (14)<br />
for Ψ given <strong>the</strong>n density gradients.<br />
1.3 Exercise<br />
1. Discretize eq.(14)<strong>on</strong> a <strong>grid</strong> asshown <strong>on</strong> Figure 1.<br />
2. A MATLAB subroutine is shown <strong>on</strong> Figure 2. The subroutine sets up <strong>the</strong> <strong>grid</strong> and<br />
<strong>the</strong> node numbering. Finish <strong>the</strong> code by programming <strong>the</strong> discretized eq. (14). To<br />
start simple, assume thatviscosity isc<strong>on</strong>stant.<br />
3. Addfree-slip boundary c<strong>on</strong>diti<strong>on</strong>s <strong>on</strong> all sides(which means v z = 0, σ xz = 0<strong>on</strong> <strong>the</strong><br />
lowerandupperboundariesand σ xz = 0,v x = 0<strong>on</strong><strong>the</strong>sideboundaries;you’llhave<br />
to write <strong>the</strong>se <str<strong>on</strong>g>equati<strong>on</strong>s</str<strong>on</strong>g> in termsof Ψ andemploy fictious boundary points).<br />
4. Assume a model domain x = [0;1], z = [0;1], and assume that <strong>the</strong> density below<br />
z = 0.1cos(2πx) +0.5 is1, whereas <strong>the</strong> density above it is 2. Compute <strong>the</strong> velocity,<br />
andplot <strong>the</strong> velocity vectors.<br />
5. Write<strong>the</strong>codefor<strong>the</strong>caseofvariableviscosity(whichisrelevantfor<strong>the</strong>Earthsince<br />
rock properties are a str<strong>on</strong>g functi<strong>on</strong> of temperature).<br />
USCGEOL557: ModelingEarth Systems 3
1 STOKES EQUATIONSWITH<str<strong>on</strong>g>FD</str<strong>on</strong>g> ON ASTAGGEREDGRIDUSINGTHE<br />
STREAM-FUNCTIONAPPROACH.<br />
% Solve <strong>the</strong> 2D <str<strong>on</strong>g>Stokes</str<strong>on</strong>g> <str<strong>on</strong>g>equati<strong>on</strong>s</str<strong>on</strong>g> <strong>on</strong> a <strong>staggered</strong> <strong>grid</strong>, <strong>using</strong> <strong>the</strong> Vx,Vz,P<br />
% formulati<strong>on</strong>.<br />
clear<br />
% Material properties phase #1 phase #2<br />
mu_vec = [1 1 ];<br />
rho_vec = [1 2 ];<br />
% Input parameters<br />
Nx = 6;<br />
Nz = 6;<br />
W = 1;H = 1;g = 1;<br />
% Setup <strong>the</strong> interface<br />
x_int = 0:.01:W;<br />
z_int = cos(x_int*2*pi/W)*1e-2 - 0.5;<br />
% Setup <strong>the</strong> <strong>grid</strong>s----------------------------------------------------------<br />
dz = H/(Nz-1);dx = W/(Nx-1);<br />
[X2d,Z2d] = mesh<strong>grid</strong>(0:dx:W,-H:dz:0);<br />
%--------------------------------------------------------------------------<br />
% Compute material properties from interface-------------------------------<br />
% Properties are computed in <strong>the</strong> center of a c<strong>on</strong>trol volume<br />
Rho = <strong>on</strong>es(Nz,Nx)*rho_vec(2);<br />
Mu = <strong>on</strong>es(Nz,Nx)*mu_vec(2);<br />
z_int_intp = interp1(x_int,z_int,X2d(1,:));<br />
for ix = 1:length(z_int_intp)<br />
ind = find(Z2d(:,1)
BIBLIOGRAPHY<br />
Bibliography<br />
USCGEOL557: ModelingEarth Systems 5