Skip to content

Do not round 1d LithosphericTemp profile to nearest km (fixes extrapolation error)#185

Merged
boriskaus merged 1 commit intoJuliaGeodynamics:mainfrom
mitchellmcm27:mitchellmcm27/bugfix-lithospheric_temp
Nov 3, 2025
Merged

Do not round 1d LithosphericTemp profile to nearest km (fixes extrapolation error)#185
boriskaus merged 1 commit intoJuliaGeodynamics:mainfrom
mitchellmcm27:mitchellmcm27/bugfix-lithospheric_temp

Conversation

@mitchellmcm27
Copy link
Contributor

I'm reopening this after changing branches on my fork. The failing tests are expected as this PR will yield slightly different temperature interpolations (more accurate ones IMO). Let me know if I should update the tests.


This change is driven by the fact that, by default, the interp_linear_T function created by linear_interpolation throws when asked to extrapolate without being given an extrapolation method.

The need for extrapolation is due the 1d temperature profile being constructed by rounding min/max depth to the nearest km, sometimes resulting in a slightly smaller depth range than the actual layers in the model.

I think I understand the original impetus for rounding to the nearest km: it is highly likely that the user has input lithosphere thicknesses as a whole-km number, but finite grid spacing means that interfaces get shifted a bit.

However, I think it is more accurate to forego rounding here. Whether my lithosphere ends up being 100km or 99.3km, I want the base and surface of it to initially be certain temperatures in the model.

Removing the rounding removes the possibility of extrapolation and results in a T profile that will be interpolated onto the model slightly more accurately.

Also renamed some of the internal variables for clarity.

@aelligp aelligp requested a review from boriskaus November 3, 2025 16:52
@boriskaus boriskaus merged commit 6257075 into JuliaGeodynamics:main Nov 3, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants