@@ -235,8 +235,8 @@ julia> segments = [((-500.0, -1000.0), (-500.0, 0.0)),
235
235
((-250.0, 0.0), (-250.0, 200.0)),
236
236
((-750.0, 200.0), (-750.0, 1000.0))];
237
237
julia> lith = LithosphericPhases(Layers=[15 55], Phases=[1 2], Tlab=1250);
238
- julia> add_box!(Phases, Temp, Grid; xlim=(-1000.0, 0.0), ylim=(-500.0, 500.0),
239
- zlim=(-80.0, 0.0), phase=lith,
238
+ julia> add_box!(Phases, Temp, Grid; xlim=(-1000.0, 0.0), ylim=(-500.0, 500.0),
239
+ zlim=(-80.0, 0.0), phase=lith,
240
240
T=SpreadingRateTemp(SpreadingVel=3), segments=segments)
241
241
julia> Grid = addfield(Grid, (; Phases, Temp)); # Add to Cartesian model
242
242
julia> write_paraview(Grid, "Ridge_Thermal_Structure") # Save model to Paraview
@@ -248,7 +248,7 @@ function add_box!(Phase, Temp, Grid::AbstractGeneralGrid; # required input
248
248
Origin= nothing , StrikeAngle= 0 , DipAngle= 0 , # origin & dip/strike
249
249
phase = ConstantPhase (1 ), # Sets the phase number(s) in the box
250
250
T= nothing , # Sets the thermal structure (various functions are available)
251
- segments= nothing , # Allows defining multiple ridge segments
251
+ segments= nothing , # Allows defining multiple ridge segments
252
252
cell= false ) # if true, Phase and Temp are defined on cell centers
253
253
254
254
@@ -804,23 +804,23 @@ julia> segments = [
804
804
((-750.0, 200.0), (-750.0, 1000.0)) # Segment 3
805
805
]
806
806
julia> lith = LithosphericPhases(Layers=[15 55], Phases=[1 2], Tlab=1250)
807
- julia> add_plate!(Phases, Temp, Grid;
808
- xlim=(-1000.0, -750.0, -250.0, 0.0, -250.0, -750.0),
809
- ylim=(0.0, 500.0, 500.0, 0.0, -500.0, -500.0),
810
- zlim=(-150.0, 0.0),
811
- phase=lith,
812
- T=SpreadingRateTemp(SpreadingVel=3),
807
+ julia> add_plate!(Phases, Temp, Grid;
808
+ xlim=(-1000.0, -750.0, -250.0, 0.0, -250.0, -750.0),
809
+ ylim=(0.0, 500.0, 500.0, 0.0, -500.0, -500.0),
810
+ zlim=(-150.0, 0.0),
811
+ phase=lith,
812
+ T=SpreadingRateTemp(SpreadingVel=3),
813
813
segments=segments)
814
814
julia> Grid = addfield(Grid, (; Phases, Temp)) # Add fields
815
815
julia> write_paraview(Grid, "Plate") # Save model to Paraview
816
816
1-element Vector{String}:
817
817
"Plate.vts"
818
818
"""
819
819
820
- function add_plate! (Phase, Temp, Grid:: AbstractGeneralGrid ;
821
- xlim= (), ylim= (), zlim:: Tuple = (0.0 ,0.8 ),
822
- phase = ConstantPhase (1 ),
823
- T= nothing , segments= nothing , cell= false )
820
+ function add_plate! (Phase, Temp, Grid:: AbstractGeneralGrid ;
821
+ xlim= (), ylim= (), zlim:: Tuple = (0.0 ,0.8 ),
822
+ phase = ConstantPhase (1 ),
823
+ T= nothing , segments= nothing , cell= false )
824
824
825
825
xlim_ = collect (xlim)
826
826
ylim_ = collect (ylim)
@@ -948,7 +948,9 @@ function add_volcano!(
948
948
949
949
# @views Temp[ind .== false] .= 0.0
950
950
if ! isempty (ind_flat)
951
+ if ! isnothing (T)
951
952
Temp[ind_flat] = compute_thermal_structure (Temp[ind_flat], Grid. x. val[ind], Grid. y. val[ind], depth[ind], Phases[ind_flat], T)
953
+ end
952
954
end
953
955
954
956
return nothing
@@ -1244,7 +1246,7 @@ function compute_thermal_structure(Temp, X, Y, Z, Phase, s::SpreadingRateTemp)
1244
1246
dz = Z[end ]- Z[1 ];
1245
1247
1246
1248
MantleAdiabaticT = Tmantle .+ Adiabat* abs .(Z); # Adiabatic temperature of mantle
1247
-
1249
+
1248
1250
if MORside== " left"
1249
1251
Distance = X .- X[1 ,1 ,1 ];
1250
1252
elseif MORside== " right"
@@ -1257,7 +1259,7 @@ function compute_thermal_structure(Temp, X, Y, Z, Phase, s::SpreadingRateTemp)
1257
1259
else
1258
1260
error (" unknown side" )
1259
1261
end
1260
-
1262
+
1261
1263
for i in eachindex (Temp)
1262
1264
ThermalAge = abs (Distance[i] * 1.0e3 * 1.0e2 ) / SpreadingVel + AgeRidge * 1.0e6 # Thermal age in years
1263
1265
if ThermalAge > maxAge * 1.0e6
@@ -1272,7 +1274,7 @@ function compute_thermal_structure(Temp, X, Y, Z, Phase, s::SpreadingRateTemp)
1272
1274
Temp[i] = (Tsurface .- Tmantle) * erfc ((abs .(Z[i]) * 1.0e3 ) ./ (2 * sqrt (kappa * ThermalAge))) + MantleAdiabaticT[i]
1273
1275
1274
1276
end
1275
-
1277
+
1276
1278
return Temp
1277
1279
end
1278
1280
@@ -1310,7 +1312,7 @@ function compute_thermal_structure(Temp, X, Y, Z, Phase, s::SpreadingRateTemp, s
1310
1312
MantleAdiabaticT = Tmantle .+ Adiabat * abs .(Z)
1311
1313
1312
1314
# Create delimiters
1313
- delimiters = [(segments[i][2 ], segments[i + 1 ][1 ]) for i in 1 : length (segments) - 1 ]
1315
+ delimiters = [(segments[i][2 ], segments[i + 1 ][1 ]) for i in 1 : length (segments) - 1 ]
1314
1316
1315
1317
for I in eachindex (X)
1316
1318
px, py, pz = X[I], Y[I], Z[I]
0 commit comments