Skip to content

Commit 47d9bf3

Browse files
committed
add weak zone
1 parent 4a8d48f commit 47d9bf3

File tree

2 files changed

+45
-70
lines changed

2 files changed

+45
-70
lines changed

src/Setup_geometry.jl

Lines changed: 35 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1338,8 +1338,8 @@ Parameters
13381338
which is taken from Ribe 2010 [Bending mechanics and mode selection in free subduction: a thin-sheet analysis]
13391339
13401340
For l>Lb, θ(l) = θ_max;
1341-
# [Dev] Potential development: using the elastic bending differential equation and numerically integrate
1342-
#- `WZ` - Thickness of the weakzone.
1341+
- `WeakzoneThickness` - Thickness of the weakzone [km]
1342+
- `WeakzonePhase` - Phase of the weakzone
13431343
13441344
"""
13451345
@with_kw_noshow mutable struct Trench{Nseg} <: AbstractTrenchSlab
@@ -1353,6 +1353,8 @@ Parameters
13531353
direction::Float64 = 1.0 # Direction of the bending angle.
13541354
d_decoupling:: Float64 = 100 # decoupling depth of the slab
13551355
type_bending::Symbol = :Ribe # Mode Ribe | Linear | Customize
1356+
WeakzoneThickness::Float64 = 0.0 # Thickness of the weakzone
1357+
WeakzonePhase::Int64 = 5 # Phase of the weak zone
13561358
end
13571359

13581360
"""
@@ -1372,17 +1374,19 @@ Next, it compute the coordinates assuming that the trench is at 0.0, and assumin
13721374
"""
13731375
function compute_slab_surface(trench::Trench)
13741376

1375-
@unpack D0, L0, n_seg, Lb, θ_max, type_bending, direction = trench;
1377+
@unpack D0, L0, n_seg, Lb, θ_max, type_bending, direction, WeakzoneThickness = trench;
13761378

13771379
# Convert θ_max into radians
13781380
θ_max *= π / 180;
13791381

13801382
# Allocate the top, mid and bottom surface
1381-
Top = zeros(n_seg+1,2);
1382-
Bottom = zeros(n_seg+1,2);
1383-
Bottom[1,2] = -D0;
1384-
MidS = zeros(n_seg+1,2);
1385-
MidS[1,2] = -D0/2;
1383+
Top = zeros(n_seg+1,2);
1384+
Bottom = zeros(n_seg+1,2);
1385+
WeakZone = zeros(n_seg+1,2);
1386+
Bottom[1,2] = -D0;
1387+
WeakZone[1,2] = WeakzoneThickness;
1388+
MidS = zeros(n_seg+1,2);
1389+
MidS[1,2] = -D0/2;
13861390

13871391
# Initialize the length.
13881392
l = 0.0; # initial length
@@ -1411,14 +1415,14 @@ function compute_slab_surface(trench::Trench)
14111415
Bottom[it+1,2] = MidS[it+1,2] - 0.5 * D0 * abs(cosθ);
14121416

14131417
# Compute the top surface for the weak zone
1414-
#WZ_surf[it+1,1] = MidS[it+1,1] + (0.5 * D0 + WZ) * abs(sinθ);
1415-
#WZ_surf[it+1,2] = MidS[it+1,2] + (0.5 * D0 + WZ) * abs(cosθ);
1418+
WeakZone[it+1,1] = MidS[it+1,1] + (0.5 * D0 + WeakzoneThickness) * abs(sinθ);
1419+
WeakZone[it+1,2] = MidS[it+1,2] + (0.5 * D0 + WeakzoneThickness) * abs(cosθ);
14161420

14171421
# update l
14181422
l = l + dl;
14191423
it = it + 1;
14201424
end
1421-
return Top, Bottom
1425+
return Top, Bottom, WeakZone
14221426
end
14231427

14241428
"""
@@ -1448,49 +1452,6 @@ function compute_bending_angle(θ_max::Float64,Lb::Float64,l::Float64,type::Symb
14481452
return θ
14491453
end
14501454

1451-
#=
1452-
"""
1453-
transform_coordinate!(X,Y,Z,XT,YT,A,B,direction)
1454-
1455-
Transform the coordinate such that the new x axis (XT) is parallel to the segment A-B of the slab. The rotation is
1456-
anticlockwise. If θ_max is negative, it multiplies YT with the sign of the angle, changing the dip of the subduction.
1457-
It returns Bn -> which is the point B coordinate in the new transformed system.
1458-
"""
1459-
function transform_coordinate!(X,Y,Z,XT,YT,Start,End,direction)
1460-
1461-
# find the slope of AB points
1462-
s = (End[2]-Start[2])/(End[1]-Start[1])
1463-
1464-
angle_rot = -atand(s);
1465-
1466-
# Shift the origin
1467-
XT .= X .- Start[1];
1468-
YT .= Y .- Start[2];
1469-
1470-
Bn = zeros(3);
1471-
1472-
Bn[1] = End[1]-Start[1];
1473-
1474-
Bn[2] = End[2]-Start[2];
1475-
1476-
Bn[3] = 0.0;
1477-
1478-
# Transform the coordinates
1479-
Rot3D!(XT,YT,Z, angle_rot, 0);
1480-
1481-
YT .*= direction;
1482-
1483-
#Find Point B in the new coordinate system
1484-
roty = [cosd(-0) 0 sind(-0) ; 0 1 0 ; -sind(-0) 0 cosd(-0)];
1485-
rotz = [cosd(angle_rot) -sind(angle_rot) 0 ; sind(angle_rot) cosd(angle_rot) 0 ; 0 0 1]
1486-
1487-
Bn = rotz*Bn;
1488-
Bn = roty*Bn;
1489-
1490-
return Bn
1491-
end
1492-
=#
1493-
14941455
"""
14951456
find_slab_distance!(ls, d, X,Y,Z, trench::Trench)
14961457
@@ -1511,11 +1472,12 @@ function find_slab_distance!(ls, d, X,Y,Z, Top, Bottom, trench::Trench)
15111472
# dl
15121473
dl = L0/n_seg;
15131474
l = 0 # length at the trench position
1514-
D = @SVector [0.0, -D0,-D0,0.0]
1475+
#D = @SVector [0.0, -D0,-D0,0.0]
1476+
1477+
D = @SVector [Top[1,2], Bottom[1,2], Bottom[1,2],Top[1,2] ]
15151478

15161479
# Construct the slab
15171480
for i = 1:(n_seg-1)
1518-
15191481
ln = l+dl;
15201482

15211483
pa = (Top[i,1], Top[i,2]); # D = 0 | L = l
@@ -1553,21 +1515,20 @@ function find_slab_distance!(ls, d, X,Y,Z, Top, Bottom, trench::Trench)
15531515

15541516
itp1 = ScatteredInterpolation.interpolate(Shepard(), points, D);
15551517
itp2 = ScatteredInterpolation.interpolate(Shepard(), points, L);
1556-
1518+
15571519
# Loop over the chosen particles and interpolate the current value of L and D.
15581520
for ip in ind_seg
15591521
point_ = [Yrot[ip], Z[ip]];
15601522
d[ip] = ScatteredInterpolation.evaluate(itp1,point_)[1];
15611523
ls[ip] = ScatteredInterpolation.evaluate(itp2,point_)[1];
15621524
end
1563-
1525+
15641526
#Update l
15651527
l = ln;
15661528
end
15671529
end
15681530

15691531

1570-
15711532
"""
15721533
addSlab!(Phase, Temp, Grid::AbstractGeneralGrid, trench::Trench; phase = ConstantPhase(1), T = nothing)
15731534
@@ -1608,18 +1569,17 @@ function addSlab!(Phase, Temp, Grid::AbstractGeneralGrid, trench::Trench;
16081569
# Retrieve 3D data arrays for the grid
16091570
X,Y,Z = coordinate_grids(Grid)
16101571

1611-
d = fill(NaN,size(Grid)); # -> d = distance perpendicular to the slab
1612-
ls = fill(NaN,size(Grid)); # -> l = length from the trench along the slab
1613-
16141572
# Compute top and bottom of the slab
1615-
Top,Bottom = compute_slab_surface(trench);
1573+
Top,Bottom, WeakZone = compute_slab_surface(trench);
16161574

16171575
# Find the distance to the slab (along & perpendicular)
1576+
d = fill(NaN,size(Grid)); # -> d = distance perpendicular to the slab
1577+
ls = fill(NaN,size(Grid)); # -> l = length from the trench along the slab
16181578
find_slab_distance!(ls, d, X,Y,Z, Top, Bottom, trench);
16191579

16201580
# Function to fill up the temperature and the phase.
1621-
ind = findall((-trench.D0 .<= d .<= 0.0));Grid
1622-
1581+
ind = findall((-trench.D0 .<= d .<= 0.0));
1582+
16231583
if isa(T, LinearWeightedTemperature)
16241584
l_decouplingind = findall(Top[:,2].<=-trench.d_decoupling);
16251585
l_decoupling = Top[l_decouplingind[1],1];
@@ -1634,7 +1594,16 @@ function addSlab!(Phase, Temp, Grid::AbstractGeneralGrid, trench::Trench;
16341594
# Set the phase
16351595
Phase[ind] = Compute_Phase(Phase[ind], Temp[ind], ls[ind], Y[ind], d[ind], phase)
16361596

1637-
# Place holder of the weak zone: it is simply using the find slab routine, and cutting it at d_decoupling.
1597+
# Add a weak zone on top of the slab (indicated by a phase number but not by temperature)
1598+
if trench.WeakzoneThickness>0.0
1599+
d_weakzone = fill(NaN,size(Grid)); # -> d = distance perpendicular to the slab
1600+
ls_weakzone = fill(NaN,size(Grid)); # -> l = length from the trench along the slab
1601+
find_slab_distance!(ls_weakzone, d_weakzone, X,Y,Z, WeakZone, Top, trench);
1602+
1603+
ind = findall( (0.0 .<= d_weakzone .<= trench.WeakzoneThickness) .& (Z .>-trench.d_decoupling) );
1604+
Phase[ind] .= trench.WeakzonePhase
1605+
@info "added weak zone for " length(ind)
1606+
end
16381607

16391608
return nothing
16401609
end

test/test_setup_geometry.jl

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,24 +238,30 @@ temp = TsHC;
238238

239239
addSlab!(Phase,Temp,Cart, t1, phase=phase, T = TsHC)
240240
@test Temp[84,84,110] 1142.25814954244
241+
@test extrema(Phase) == (1, 4)
241242

242-
Data_Final = CartData(X,Y,Z,(Phase=Phase,Temp=Temp))
243-
#Write_Paraview(Data_Final, "Data_Final");
243+
# with weak zone
244+
t1 = Trench(Start = (400.0,400.0), End = (800.0,800.0),θ_max = 45, direction = 1.0, n_seg = 50, L0 = 600.0, D0 = 80.0, Lb = 500.0,d_decoupling = 100.0, WeakzoneThickness=10, WeakzonePhase=9)
245+
Phase = ones(Int32,size(Cart));
246+
Temp = fill(1350.0,size(Cart));
247+
addSlab!(Phase,Temp,Cart, t1, phase=phase, T = TsHC)
248+
@test extrema(Phase) == (1, 9)
244249

250+
#Data_Final = CartData(X,Y,Z,(Phase=Phase,Temp=Temp))
251+
#Write_Paraview(Data_Final, "Data_Final");
245252

246253
Phase = ones(Int32,size(Cart));
247254
Temp = fill(1350.0,size(Cart));
248255
TsMK = McKenzie_subducting_slab(Tsurface = 20.0, Tmantle = 1350.0, v_cm_yr = 4.0, Adiabat = 0.0)
249256
temp = TsMK
250257

251-
252258
Phase = ones(Int32,size(Cart));
253259
Temp = fill(1350.0,size(Cart));
254260
TsHC = HalfspaceCoolingTemp(Tsurface=20.0, Tmantle=1350, Age=120, Adiabat=0.4)
255261
TsMK = McKenzie_subducting_slab(Tsurface = 20.0, Tmantle = 1350.0, v_cm_yr = 4.0, Adiabat = 0.0)
256262
T_slab = LinearWeightedTemperature(crit_dist=600, F1=TsHC, F2=TsMK);
257263
phase = LithosphericPhases(Layers=[5 7 88], Phases = [2 3 4], Tlab=nothing)
258-
t1 = Trench(Start = (400.0,400.0), End = (800.0,800.0),θ_max = 90.0, direction = 1.0, n_seg = 50, L0 = 600.0, D0 = 80.0, Lb = 500.0,d_decoupling = 100.0, type_bending =:Ribe)
264+
t1 = Trench(Start = (400.0,400.0), End = (800.0,800.0),θ_max = 90.0, direction = 1.0, n_seg = 50, L0 = 600.0, D0 = 80.0, Lb = 500.0,d_decoupling = 100.0, type_bending =:Ribe, WeakzoneThickness=10, WeakzonePhase=9)
259265

260266
addSlab!(Phase,Temp,Cart, t1, phase=phase, T = TsHC)
261267
@test Temp[84,84,110] 713.1083054586794

0 commit comments

Comments
 (0)