<jupyter_start><jupyter_text>Diffusion of temperature changes in the subsurfaceChanges of the surface temperature are a natural observation. They happen on a daily (day-night cycle) or annual (seasons). Also on longer timescales, there are cycles which change the surface temperature. The longer such a temperature signal lasts, the deeper it still can be observed. In the following, we will see how to qualitatively ass ess the depths to which a periodic temperature change propagates, and create an iso-plot between temperature deviation and depth for signals of different lengths (day to millenium).Then we will look at a "boxcar" signal, which is a simplification of an instantanious temperature change $\Delta T_s$ at the surface, which persists for a certain time $\tau$.<jupyter_code>import numpy as np
import pandas as pd
from scipy.special import erf, erfc

import seaborn as sns
sns.set_style('whitegrid')
sns.set_context('talk')
import h5netcdf as nc

import matplotlib.pyplot as plt
%matplotlib inline<jupyter_output><empty_output><jupyter_text>Transient temperature diffusionDepths to which the temperature change propagates ("skin depth")  $$T(z,t) = T_1 + \Delta T * erfc(z/(2\sqrt{kt}))$$Temperature variation at depth:$$ T(z,t) = T_0 * exp(-z/d_w) * cos(\omega * t - z / d_w) $$  with $d_w = \sqrt{2*k_t/\omega}$<jupyter_code>T1 = 20
dT = -20
kappa = 1e-6
hour = 3600
day = hour*24
month = day*30.5
year = month*12
millenium = year*1000

times = np.array([hour, day, month, year, millenium])

z = np.logspace(-3,3,100)
# Depth calculation
the_keys = ['Stunde', 'Tag', 'Monat', 'Jahr', 'Jahrtausend']
Tdepth = {}
for t in range(len(times)):
    Tdepth_temp = T1 + dT*erfc(z/(2*np.sqrt(kappa*times[t])))
    key = the_keys[t]
    Tdepth[key] = Tdepth_temp
time_depths = pd.DataFrame.from_dict(Tdepth)
fig = plt.figure(figsize=[7,10])

for i in the_keys:
    plt.semilogy(time_depths[i], z, label=i)

plt.legend(loc='best')
plt.xlim([0,20])
plt.ylim([1e-3,1e3])
plt.xlabel('Temperaturabweichung (K)')
plt.ylabel('Tiefe (m)')

plt.gca().invert_yaxis()
#plt.savefig('temp_abweichung.svg', bbox_inches='tight')<jupyter_output><empty_output><jupyter_text>Boxcar testLet's assume, 20000 years ago, temperature dropped by of 10 K for a duration of of 10000 years, until temperatures rose again by 10 K. This can be simulated with the boxcar signal. In this specific case, we can use the superposition of two signals of equal amplitude here:$$\frac{\Delta T(z)_{t=0}}{\Delta T_S} = erfc\bigg(\frac{z}{\sqrt{4 k t_2}}\bigg) - erfc\bigg(\frac{z}{\sqrt{4 k t_1}}\bigg) $$Also, we assume a thermal diffusivity of $\kappa = 1e^{-6}$.<jupyter_code>y2s = 3600*24*365.25
DT = 10
t1 = 29000 * y2s
t2 = 19000 * y2s
z = np.linspace(1,5000,1000)
DTZ_Boxcar = DT * (erfc(z/np.sqrt(4*kappa*t2)) - erfc(z/np.sqrt(4*kappa*t1)))
plt.plot(DTZ_Boxcar,-z)
plt.xlabel('$\Delta T$ (K)')
plt.ylabel('Tiefe (m)')<jupyter_output><empty_output><jupyter_text>Now let's just calculate a very simple, linear temperature gradient (not considering radiogenic heat for example), and see, if we can spot a difference between the temperature profile, uncorrected and corrected for the ice-age signal.<jupyter_code># gradient
Ts = 11
Geotherm = 0.030 * z + Ts
plt.plot(Geotherm + DTZ_Boxcar,-z, label='corrected')
plt.plot(Geotherm,-z, label='uncorrected')
plt.xlabel('T (°C)')
plt.ylabel('Tiefe (m)')
plt.ylim([-3000,0])
plt.xlim([10,100])
plt.legend()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13400868306801736, 'fraction_numerical': 0.035311143270622285, 'mean_word_length': 5.411873840445269, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '545854', 'license': 'MIT', 'n_tokens_mistral': 1335, 'n_tokens_neox': 1224, 'n_words': 376, 'path': '15_Temperature_disturbance_ice_age.ipynb', 'repo_name': 'Zqs0527/geothermics', 'size': '3455'}