Skip to content

Commit 98df026

Browse files
committed
change L0/D -> Length/Thickness (clearer)
1 parent c85341f commit 98df026

File tree

2 files changed

+35
-35
lines changed

2 files changed

+35
-35
lines changed

src/Setup_geometry.jl

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,18 +1203,18 @@ function Compute_ThermalStructure(Temp, X, Y, Z,Phase, s::McKenzie_subducting_sl
12031203
@unpack Tsurface, Tmantle, Adiabat, v_cm_yr, κ, it = s
12041204

12051205
# Thickness of the layer:
1206-
D0 = (maximum(Z)-minimum(Z));
1206+
Thickness = (maximum(Z)-minimum(Z));
12071207
Zshift = Z .- Z[end] # McKenzie model is defined with Z = 0 at the bottom of the slab
12081208

12091209
# Convert subduction velocity from cm/yr -> m/s;
12101210
convert_velocity = 1/(100.0*365.25*60.0*60.0*24.0);
12111211
v_s = v_cm_yr*convert_velocity;
12121212

12131213
# calculate the thermal Reynolds number
1214-
Re = (v_s*D0*1000)/2/κ; # factor 1000 to transfer D0 from km to m
1214+
Re = (v_s*Thickness*1000)/2/κ; # factor 1000 to transfer Thickness from km to m
12151215

12161216
# McKenzie model
1217-
sc = 1/D0
1217+
sc = 1/Thickness
12181218
σ = ones(size(Temp));
12191219
# Dividi et impera
12201220
for i=1:it
@@ -1317,9 +1317,9 @@ Parameters
13171317
- `Start` - Start of the trench (`x`,`y`) coordinates
13181318
- `End` - End of the trench (`x`,`y`) coordinates
13191319
- `n_seg` - The number of segment through which the slab is discretize along the dip
1320-
- `L0` - The length of the slab
1321-
- `D0` - The thickness of the slab
1322-
- `Lb` - Critical distance through which apply the bending angle functions Lb ∈ [0,L0];
1320+
- `Length` - The length of the slab
1321+
- `Thickness` - The thickness of the slab
1322+
- `Lb` - Critical distance through which apply the bending angle functions Lb ∈ [0,Length];
13231323
- `θ_max` - maximum angle of bending ∈ [0°,90°].
13241324
- `direction` - the direction of the dip
13251325
The rotation of the coordinate system is done as such that the new X is parallel to the segment. Since the
@@ -1328,7 +1328,7 @@ Parameters
13281328
to y by multiplying it with -1 or +1;
13291329
- `d_decoupling` - depth at which the slab is fully submerged into the mantle.
13301330
- `type_bending` - is the type of bending angle of the slab [`:Linear`, `:Ribe`].
1331-
The angle of slab changes as a function of `l` (∈ [0,L0]). `l` is the actual distance along the slab length from
1331+
The angle of slab changes as a function of `l` (∈ [0,Length]). `l` is the actual distance along the slab length from
13321332
the trench.
13331333
In case:
13341334
- `:Linear`
@@ -1346,11 +1346,11 @@ Parameters
13461346
Start::NTuple{Nseg,Float64} = (0.0,0.0) # Start (x,y) coordinates of trench (in mapview)
13471347
End::NTuple{Nseg,Float64} = (0.0,1.0) # End (x,y) coordinates of trench (in mapview)
13481348
n_seg::Int64 = 50 # number of segments in downdip direction
1349-
L0:: Float64 = 400.0 # length of the slab
1350-
D0:: Float64 = 100.0 # thickness of the slab
1351-
Lb:: Float64 = 200.0 # Length at which all the bending is happening (Lb<=L0)
1349+
Length:: Float64 = 400.0 # length of the slab
1350+
Thickness:: Float64 = 100.0 # thickness of the slab
1351+
Lb:: Float64 = 200.0 # Length at which all the bending is happening (Lb<=Length)
13521352
θ_max::Float64 = 45.0 # max bending angle, (must be converted into radians)
1353-
direction::Float64 = 1.0 # Direction of the bending angle.
1353+
direction::Float64 = 1.0 # Direction of the bending angle (from left to right or right to left)
13541354
d_decoupling:: Float64 = 100 # decoupling depth of the slab
13551355
type_bending::Symbol = :Ribe # Mode Ribe | Linear | Customize
13561356
WeakzoneThickness::Float64 = 0.0 # Thickness of the weakzone
@@ -1374,7 +1374,7 @@ Next, it compute the coordinates assuming that the trench is at 0.0, and assumin
13741374
"""
13751375
function compute_slab_surface(trench::Trench)
13761376

1377-
@unpack D0, L0, n_seg, Lb, θ_max, type_bending, direction, WeakzoneThickness = trench;
1377+
@unpack Thickness, Length, n_seg, Lb, θ_max, type_bending, direction, WeakzoneThickness = trench;
13781378

13791379
# Convert θ_max into radians
13801380
θ_max *= π / 180;
@@ -1383,17 +1383,17 @@ function compute_slab_surface(trench::Trench)
13831383
Top = zeros(n_seg+1,2);
13841384
Bottom = zeros(n_seg+1,2);
13851385
WeakZone = zeros(n_seg+1,2);
1386-
Bottom[1,2] = -D0;
1386+
Bottom[1,2] = -Thickness;
13871387
WeakZone[1,2] = WeakzoneThickness;
13881388
MidS = zeros(n_seg+1,2);
1389-
MidS[1,2] = -D0/2;
1389+
MidS[1,2] = -Thickness/2;
13901390

13911391
# Initialize the length.
13921392
l = 0.0; # initial length
13931393
it = 1; # iteration
13941394

1395-
dl = L0/n_seg; # dl
1396-
while l<L0
1395+
dl = Length/n_seg; # dl
1396+
while l<Length
13971397

13981398
# Compute the mean angle within the segment
13991399
θ = compute_bending_angle(θ_max, Lb, l , type_bending)
@@ -1407,16 +1407,16 @@ function compute_slab_surface(trench::Trench)
14071407
MidS[it+1,2] = MidS[it,2] - dl * sinθ;
14081408

14091409
# Top surface coordinates (x,z)
1410-
Top[it+1,1] = MidS[it+1,1] + 0.5 * D0 * abs(sinθ);
1411-
Top[it+1,2] = MidS[it+1,2] + 0.5 * D0 * abs(cosθ);
1410+
Top[it+1,1] = MidS[it+1,1] + 0.5 * Thickness * abs(sinθ);
1411+
Top[it+1,2] = MidS[it+1,2] + 0.5 * Thickness * abs(cosθ);
14121412

14131413
# Bottom surface coordinate
1414-
Bottom[it+1,1] = MidS[it+1,1] - 0.5 * D0 * abs(sinθ);
1415-
Bottom[it+1,2] = MidS[it+1,2] - 0.5 * D0 * abs(cosθ);
1414+
Bottom[it+1,1] = MidS[it+1,1] - 0.5 * Thickness * abs(sinθ);
1415+
Bottom[it+1,2] = MidS[it+1,2] - 0.5 * Thickness * abs(cosθ);
14161416

14171417
# Compute the top surface for the weak zone
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θ);
1418+
WeakZone[it+1,1] = MidS[it+1,1] + (0.5 * Thickness + WeakzoneThickness) * abs(sinθ);
1419+
WeakZone[it+1,2] = MidS[it+1,2] + (0.5 * Thickness + WeakzoneThickness) * abs(cosθ);
14201420

14211421
# update l
14221422
l = l + dl;
@@ -1433,7 +1433,7 @@ function that computes the bending angle `θ` as a function of length along the
14331433
Parameters
14341434
===
14351435
`θ_max` = maximum bending angle
1436-
`Lb` = length at which the function of bending is applied (Lb<=L0)
1436+
`Lb` = length at which the function of bending is applied (Lb<=Length)
14371437
`l` = current position within the slab
14381438
`type` = type of bending [`:Ribe`,`:Linear`]
14391439
@@ -1459,7 +1459,7 @@ Function that finds the perpendicular distance to the top and bottom of the slab
14591459
14601460
"""
14611461
function find_slab_distance!(ls, d, X,Y,Z, Top, Bottom, trench::Trench)
1462-
@unpack D0, L0, n_seg, Start, End, direction = trench;
1462+
@unpack Thickness, Length, n_seg, Start, End, direction = trench;
14631463

14641464
# Perform rotation of 3D coordinates along the angle from Start -> End:
14651465
Xrot = X .- Start[1];
@@ -1470,9 +1470,9 @@ function find_slab_distance!(ls, d, X,Y,Z, Top, Bottom, trench::Trench)
14701470
xb = Rot3D(End[1]-Start[1],End[2]-Start[2], 0.0, cosd(StrikeAngle), sind(StrikeAngle), 1.0, 0.0)
14711471

14721472
# dl
1473-
dl = L0/n_seg;
1473+
dl = Length/n_seg;
14741474
l = 0 # length at the trench position
1475-
#D = @SVector [0.0, -D0,-D0,0.0]
1475+
#D = @SVector [0.0, -Thickness,-Thickness,0.0]
14761476

14771477
D = @SVector [Top[1,2], Bottom[1,2], Bottom[1,2],Top[1,2] ]
14781478

@@ -1481,9 +1481,9 @@ function find_slab_distance!(ls, d, X,Y,Z, Top, Bottom, trench::Trench)
14811481
ln = l+dl;
14821482

14831483
pa = (Top[i,1], Top[i,2]); # D = 0 | L = l
1484-
pb = (Bottom[i,1], Bottom[i,2]); # D = -D0 | L=l
1484+
pb = (Bottom[i,1], Bottom[i,2]); # D = -Thickness | L=l
14851485

1486-
pc = (Bottom[i+1,1],Bottom[i+1,2]); # D = -D0 |L=L+dl
1486+
pc = (Bottom[i+1,1],Bottom[i+1,2]); # D = -Thickness |L=L+dl
14871487
pd = (Top[i+1,1],Top[i+1,2]) # D = 0| L = L+dl
14881488

14891489
# Create the polygon
@@ -1555,7 +1555,7 @@ julia> Cart = CartData(XYZGrid(x, y, z));
15551555
julia> Phase = ones(Int64,size(Cart));
15561556
julia> Temp = fill(1350.0,size(Cart));
15571557
# Define the trench:
1558-
julia> trench= Trench(Start = (400.0,400.0), End = (800.0,800.0), θ_max = 45.0, direction = 1.0, n_seg = 50, L0 = 600.0, D0 = 80.0, Lb = 500.0, d_decoupling = 100.0, type_bending =:Ribe)
1558+
julia> trench= Trench(Start = (400.0,400.0), End = (800.0,800.0), θ_max = 45.0, direction = 1.0, n_seg = 50, Length = 600.0, Thickness = 80.0, Lb = 500.0, d_decoupling = 100.0, type_bending =:Ribe)
15591559
julia> phase = LithosphericPhases(Layers=[5 7 88], Phases = [2 3 4], Tlab=nothing)
15601560
julia> TsHC = HalfspaceCoolingTemp(Tsurface=20.0, Tmantle=1350, Age=30, Adiabat=0.4)
15611561
julia> addSlab!(Phase, Temp, Cart, trench, phase = phase, T = TsHC)
@@ -1578,7 +1578,7 @@ function addSlab!(Phase, Temp, Grid::AbstractGeneralGrid, trench::Trench;
15781578
find_slab_distance!(ls, d, X,Y,Z, Top, Bottom, trench);
15791579

15801580
# Function to fill up the temperature and the phase.
1581-
ind = findall((-trench.D0 .<= d .<= 0.0));
1581+
ind = findall((-trench.Thickness .<= d .<= 0.0));
15821582

15831583
if isa(T, LinearWeightedTemperature)
15841584
l_decouplingind = findall(Top[:,2].<=-trench.d_decoupling);

test/test_setup_geometry.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,10 @@ X,Y,Z = XYZGrid(x, y, z);
226226
Phase = ones(Int32,size(Cart));
227227
Temp = fill(1350.0,size(Cart));
228228

229-
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, type_bending =:Ribe)
229+
t1 = Trench(Start = (400.0,400.0), End = (800.0,800.0),θ_max = 45, direction = 1.0, n_seg = 50, Length = 600.0, Thickness = 80.0, Lb = 500.0,d_decoupling = 100.0, type_bending =:Ribe)
230230
@test t1.θ_max == 45.0
231-
@test t1.D0 == 80.0
232-
@test t1.L0 == 600.0
231+
@test t1.Thickness == 80.0
232+
@test t1.Length == 600.0
233233
@test t1.Lb == 500.0
234234

235235
phase = LithosphericPhases(Layers=[5 7 88], Phases = [2 3 4], Tlab=nothing)
@@ -241,7 +241,7 @@ addSlab!(Phase,Temp,Cart, t1, phase=phase, T = TsHC)
241241
@test extrema(Phase) == (1, 4)
242242

243243
# 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)
244+
t1 = Trench(Start = (400.0,400.0), End = (800.0,800.0),θ_max = 45, direction = 1.0, n_seg = 50, Length = 600.0, Thickness = 80.0, Lb = 500.0,d_decoupling = 100.0, WeakzoneThickness=10, WeakzonePhase=9)
245245
Phase = ones(Int32,size(Cart));
246246
Temp = fill(1350.0,size(Cart));
247247
addSlab!(Phase,Temp,Cart, t1, phase=phase, T = TsHC)
@@ -261,7 +261,7 @@ TsHC = HalfspaceCoolingTemp(Tsurface=20.0, Tmantle=1350, Age=120, Adiabat=0.4)
261261
TsMK = McKenzie_subducting_slab(Tsurface = 20.0, Tmantle = 1350.0, v_cm_yr = 4.0, Adiabat = 0.0)
262262
T_slab = LinearWeightedTemperature(crit_dist=600, F1=TsHC, F2=TsMK);
263263
phase = LithosphericPhases(Layers=[5 7 88], Phases = [2 3 4], Tlab=nothing)
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)
264+
t1 = Trench(Start = (400.0,400.0), End = (800.0,800.0),θ_max = 90.0, direction = 1.0, n_seg = 50, Length = 600.0, Thickness = 80.0, Lb = 500.0,d_decoupling = 100.0, type_bending =:Ribe, WeakzoneThickness=10, WeakzonePhase=9)
265265

266266
addSlab!(Phase,Temp,Cart, t1, phase=phase, T = T_slab)
267267
@test Temp[84,84,110] 718.8406936737412

0 commit comments

Comments
 (0)