-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathTuesday Apr 14 2015 - Daisyworld.py
160 lines (111 loc) · 4.45 KB
/
Tuesday Apr 14 2015 - Daisyworld.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# -*- coding: utf-8 -*-
# <nbformat>3.0</nbformat>
# <codecell>
from pyndamics import *
# <codecell>
#constants
black_albedo = 0.25
uncovered_albedo = 0.5
white_albedo = 0.75
death_rate = 0.3
heat_absorp_fact = 20
# <codecell>
def growth(T,T_max=210.0,T_width=40.0):
val=1-( (T_max-T )/(T_width/2) )**2
if val<0.0:
val=0.0
return val
T=linspace(180,260,100)
y=[growth(_) for _ in T]
plot(T,y)
# <codecell>
def oscillation(t):
return 1.0-0.60*sin(t/pi/10)
def ramp(t):
return 0.2+0.004*t
t=linspace(0,400,100)
plot(t,oscillation(t))
plot(t,ramp(t))
# <codecell>
sim=Simulation()
sim.add("uncovered_area=1-black_area-white_area",1,plot=1)
sim.add("L=ramp(t)",1,plot=2)
sim.add("albedo=uncovered_area*uncovered_albedo + black_area*black_albedo + white_area*white_albedo",0.5,plot=3)
sim.add("global_temp=88.5*(S*L*(1-albedo))**.25",plot=4)
sim.add("global_temp_dead=88.5*(S*L*(1-uncovered_albedo))**.25",plot=4)
sim.add("black_local_temp=global_temp+q*(uncovered_albedo-black_albedo)",plot=4)
sim.add("white_local_temp=global_temp+q*(uncovered_albedo-white_albedo)",plot=4)
sim.add("black_growth=growth(black_local_temp)",plot=5)
sim.add("white_growth=growth(white_local_temp)",plot=5)
sim.add("black_area'=black_area*(uncovered_area*black_growth-gamma)+.001",0,plot=1)
sim.add("white_area'=white_area*(uncovered_area*white_growth-gamma)+.001",0,plot=1)
sim.params(black_albedo = 0.25,
uncovered_albedo = 0.5,
white_albedo = 0.75,
gamma=0.3,
S=65,
q=40,
)
sim.functions(oscillation,ramp,growth)
sim.run(0,600)
# <markdowncell>
# ## Some questions
#
# 1. What happens when the $L$ is a ramp function as opposed to the oscillations?
# 2. What happens if you change the black albedo and/or the white albedo - does it make the global temperature more flat during the ramp, or less flat?
# 3. Does it change the total uncovered area?
# 1. why do they alternate? Under what conditions does this happen? (use your own words)
# 2. all die at certain times - Under what conditions does this happen?
# 3. Can you make the modulation of the global temperature more dramatic? less dramatic?
# <markdowncell>
# ## Another scenario
#
# What happens if we make the black/white daisy growth depend only on the *global* temperature? We can do this by setting $q=0$.
# <codecell>
sim=Simulation()
sim.add("uncovered_area=1-black_area-white_area",1,plot=1)
sim.add("L=ramp(t)",1,plot=2)
sim.add("albedo=uncovered_area*uncovered_albedo + black_area*black_albedo + white_area*white_albedo",0.5,plot=3)
sim.add("global_temp=88.5*(S*L*(1-albedo))**.25",plot=4)
sim.add("global_temp_dead=88.5*(S*L*(1-uncovered_albedo))**.25",plot=4)
sim.add("black_local_temp=global_temp+q*(uncovered_albedo-black_albedo)",plot=4)
sim.add("white_local_temp=global_temp+q*(uncovered_albedo-white_albedo)",plot=4)
sim.add("black_growth=growth(black_local_temp)",plot=5)
sim.add("white_growth=growth(white_local_temp)",plot=5)
sim.add("black_area'=black_area*(uncovered_area*black_growth-gamma)+.001",0,plot=1)
sim.add("white_area'=white_area*(uncovered_area*white_growth-gamma)+.001",0,plot=1)
sim.params(black_albedo = 0.25,
uncovered_albedo = 0.5,
white_albedo = 0.75,
gamma=0.3,
S=65,
q=.1,
)
sim.functions(oscillation,ramp,growth)
sim.run(0,600)
# <markdowncell>
# Let's accentuate the albedos.
# <codecell>
sim=Simulation()
sim.add("uncovered_area=1-black_area-white_area",1,plot=1)
sim.add("L=ramp(t)",1,plot=2)
sim.add("albedo=uncovered_area*uncovered_albedo + black_area*black_albedo + white_area*white_albedo",0.5,plot=3)
sim.add("global_temp=88.5*(S*L*(1-albedo))**.25",plot=4)
sim.add("global_temp_dead=88.5*(S*L*(1-uncovered_albedo))**.25",plot=4)
sim.add("black_local_temp=global_temp+q*(uncovered_albedo-black_albedo)",plot=4)
sim.add("white_local_temp=global_temp+q*(uncovered_albedo-white_albedo)",plot=4)
sim.add("black_growth=growth(black_local_temp)",plot=5)
sim.add("white_growth=growth(white_local_temp)",plot=5)
#sim.add("black_area'=black_area*(uncovered_area*black_growth-gamma)+.001",0,plot=1)
sim.add("black_area'=0",0,plot=1)
sim.add("white_area'=white_area*(uncovered_area*white_growth-gamma)+.001",0,plot=1)
sim.params(black_albedo = 0.05,
uncovered_albedo = 0.5,
white_albedo = 0.95,
gamma=0.3,
S=65,
q=.1,
)
sim.functions(oscillation,ramp,growth)
sim.run(0,600)
# <codecell>