snowball.py
— 2.6 KB
File contents
""" Snowball Earth experiment
"""
import numpy as np
import time
import matplotlib.pyplot as plt
from snowball_definitions import insol, solve_temp
###################################
# adjustable parameters
num_lat_zones = 9. # number of latitudinal bands
solar_constant = 1370. # solar constant
max_tilt = 23.5 # tilt of earth in degrees
S_frac_min = 0.6 # minimum fraction of solar constant for hysteresis experiment
S_frac_max = 1.4 # maximum fraction of solar constant for hysteresis experiment
N_sol = 100 # number of steps between S_frac_min and S_frac_max
k_t = 3.80 # transport coefficient (in W/(m^2*degree C))
A = 204. # radiative-heat-loss coefficient
B = 2.17 # radiative-heat-loss coefficient
albedo_ice = 0.60 # albedo of ice
albedo_land = 0.30 # albedo of land
temp_critical = -10. # critical temperature (all ice)
#####################################
# solar insolation per latitude band
lats, lats_frac, insolation=insol(solar_constant,max_tilt,num_lat_zones)
#####################################
# hysteresis
# initial guess for latitudinal temperature distribution (cold earth)
temp=[-50.0]*int(num_lat_zones)
solar_mult=[0.0]*int(N_sol)
avg_temp=[0.0]*int(N_sol)
fig=plt.figure()
plt.ion()
plt.show()
fig=plt.figure()
ax1 = fig.add_subplot(2, 1, 1)
ax2 = fig.add_subplot(2, 2, 3)
ax3 = fig.add_subplot(2, 2, 4)
ax1.set_xlabel('S/S_pres')
ax1.set_ylabel('Temperature')
ax1.set_xlim(S_frac_min, S_frac_max)
ax1.set_ylim(-60, 60)
ax2.set_ylabel('Latitude')
ax2.set_xlabel('Temperature')
ax2.set_ylim(0, 90)
ax2.set_xlim(-70, 70)
ax3.set_ylabel('Latitude')
ax3.set_xlabel('Albedo')
ax3.set_ylim(0, 90)
ax3.set_xlim(0, 1)
plt.ion()
plt.show()
for k in range(0,N_sol):
if k<=N_sol/2.:
solar_mult[k] = S_frac_min+k/(N_sol/2.)*(S_frac_max-S_frac_min)
avg_temp[k],temp,albedo = solve_temp(solar_mult[k],temp,lats,lats_frac,insolation,num_lat_zones,k_t,A,B,albedo_ice,albedo_land,temp_critical)
ax1.plot(solar_mult[0:k], avg_temp[0:k],'r.-')
ax2.plot(temp,lats,'r-')
ax3.plot(albedo,lats,'r-')
else:
solar_mult[k] = S_frac_max-(k-(N_sol/2.))/(N_sol/2.)*(S_frac_max-S_frac_min)
avg_temp[k],temp,albedo = solve_temp(solar_mult[k],temp,lats,lats_frac,insolation,num_lat_zones,k_t,A,B,albedo_ice,albedo_land,temp_critical)
ax1.plot(solar_mult[N_sol/2:k], avg_temp[N_sol/2:k],'b.-')
ax2.plot(temp,lats,'b-')
ax3.plot(albedo,lats,'b-')
plt.draw()
plt.savefig('snowball_hysteresis_bis.png')
time.sleep(5)