Skip to content

Commit 2bcdaa7

Browse files
committed
avoid division by 0 and NaN
1 parent 72709cb commit 2bcdaa7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Setup_geometry.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,8 @@ Parameters
803803
- AgeRidge : thermal age of the ridge [Myrs]
804804
- maxAge : maximum thermal Age of plate [Myrs]
805805
806+
Note: the thermal age at the mid oceanic ridge is set to 1 year to avoid division by zero
807+
806808
"""
807809
@with_kw_noshow mutable struct SpreadingRateTemp <: AbstractThermalStructure
808810
Tsurface = 0 # top T
@@ -843,6 +845,9 @@ function Compute_ThermalStructure(Temp, X, Y, Z, Phase, s::SpreadingRateTemp)
843845
end
844846

845847
ThermalAge = ThermalAge*SecYear;
848+
if ThermalAge==0
849+
ThermalAge = 1e-6 # doesn't like zero
850+
end
846851

847852
Temp[i] = (Tsurface .- Tmantle)*erfc((abs.(Z[i])*1e3)./(2*sqrt(kappa*ThermalAge))) + MantleAdiabaticT[i];
848853
end

0 commit comments

Comments
 (0)