-
Notifications
You must be signed in to change notification settings - Fork 16
/
.Rhistory
170 lines (170 loc) · 5.33 KB
/
.Rhistory
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
159
160
161
162
163
164
165
166
167
168
169
170
source('calc_optimal_vcmax.R')
par_seq = calc_optimal_vcmax(paro = seq(100, 1000, 100))
par_seq
t_seq = calc_optimal_vcmax(tg_c = seq(10, 30, 5))
t_seq
vpd_seq = calc_optimal_vcmax(vpdo = seq(0.5, 4, 0.5))
z_seq = calc_optimal_vcmax(z = seq(0, 1000, 100))
ca_seq = calc_optimal_vcmax(cao = seq(250, 1000, 50))
ca_seq
source('calc_optimal_vcmax.R')
par_seq = calc_optimal_vcmax(paro = seq(100, 1000, 100))
t_seq = calc_optimal_vcmax(tg_c = seq(10, 30, 5))
vpd_seq = calc_optimal_vcmax(vpdo = seq(0.5, 4, 0.5))
z_seq = calc_optimal_vcmax(z = seq(0, 1000, 100))
ca_seq = calc_optimal_vcmax(cao = seq(250, 1000, 50))
par_seq
source('calc_optimal_vcmax.R')
par_seq = calc_optimal_vcmax(paro = seq(100, 1000, 100))
t_seq = calc_optimal_vcmax(tg_c = seq(10, 30, 5))
function(theta, c, m){ # paro in µmol m-2 s-1 and z in m
cm = ((4 * c) / m) # simplification term for omega calculation
v = 1/(cm * (1 - (theta * cm))) - 4 * theta # simplification term for omega calculation
# account for non-linearities at low m values
cquad = -1
bquad = 3.4
aquad = -(3.4 * theta)
quad_root = (-bquad + sqrt(bquad^2 - (4 * aquad * cquad))) / (2 * aquad)
m_star = (4 * c) / quad_root
if(8*c < m){
omega = -(1 - (2 * theta)) + sqrt((1 - theta) * v)
} else{
omega = -(1 - (2 * theta)) - sqrt((1 - theta) * v)
}
#omega = ifelse(m < m_star, -(1 - (2 * theta)) - sqrt((1 - theta) * v), -(1 - (2 * theta)) + sqrt((1 - theta) * v))
omega
}
t_seq = calc_optimal_vcmax(tg_c = seq(10, 30, 5))
par_seq = calc_optimal_vcmax(paro = seq(100, 1000, 100))
par_seq
theta = 0.85
c = 0.05336251
# constants
R <- 8.314
c <- 0.05336251
leakiness <- 0.01
z = 0
# environmental terms
patm <- calc_patm(z)
paro=800
par <- calc_par(paro, z)
tg_c = 10
vpdo = 1
vpd <- calc_vpd(tg_c, z, vpdo)
ca <- cao * 1e-6 * patm
cao - 400
cao = 400
oao = 209460
ca <- cao * 1e-6 * patm
oa <- oao * 1e-6 * patm
# K and Gamma* model terms
km <- calc_km_pa(tg_c, z)
gammastar <- calc_gammastar_pa(tg_c, z)
chi =0.7
ci <- chi * ca # Pa
mc <- ((ci - gammastar) / (ci + km))
m <- ((ci - gammastar)/(ci + (2 * gammastar)))
m
omega <- calc_omega(theta = theta, c = c, m = m)
8*c
m
if(8*c < m){
omega = -(1 - (2 * theta)) + sqrt((1 - theta) * v)
} else{
omega = -(1 - (2 * theta)) - sqrt((1 - theta) * v)
}
cm = ((4 * c) / m) # simplification term for omega calculation
v = 1/(cm * (1 - (theta * cm))) - 4 * theta # simplification term for omega calculation
if(8*c < m){
omega = -(1 - (2 * theta)) + sqrt((1 - theta) * v)
} else{
omega = -(1 - (2 * theta)) - sqrt((1 - theta) * v)
}
omega
t_seq = calc_optimal_vcmax(tg_c = seq(10, 30, 5))
source('calc_optimal_vcmax.R')
par_seq = calc_optimal_vcmax(paro = seq(100, 1000, 100))
t_seq = calc_optimal_vcmax(tg_c = seq(10, 30, 5))
t_seq
t_seq$m
omega = ifelse(8*c > m, -(1 - (2 * theta)) - sqrt((1 - theta) * v), -(1 - (2 * theta)) + sqrt((1 - theta) * v))
omega
theta = 0.99
cm = ((4 * c) / m) # simplification term for omega calculation
v = 1/(cm * (1 - (theta * cm))) - 4 * theta # simplification term for omega calculation
omega = ifelse(8*c > m, -(1 - (2 * theta)) - sqrt((1 - theta) * v), -(1 - (2 * theta)) + sqrt((1 - theta) * v))
omega
-(1 - (2 * theta)) - sqrt((1 - theta) * v)
-(1 - (2 * theta)) + sqrt((1 - theta) * v)
8*c
m
m/c
8*theta
m
m=0.4
m/c
tg_c=2
gammastar <- calc_gammastar_pa(tg_c, z)
m <- ((ci - gammastar)/(ci + (2 * gammastar)))
m
tg_c=50
gammastar <- calc_gammastar_pa(tg_c, z)
m <- ((ci - gammastar)/(ci + (2 * gammastar)))
m
omega = ifelse(8*c > m & 4*c < m & m/c < 8*theta, -(1 - (2 * theta)) - sqrt((1 - theta) * v), -(1 - (2 * theta)) + sqrt((1 - theta) * v))
omega
par_seq = calc_optimal_vcmax(paro = seq(100, 1000, 100))
t_seq = calc_optimal_vcmax(tg_c = seq(10, 30, 5))
vpd_seq = calc_optimal_vcmax(vpdo = seq(0.5, 4, 0.5))
z_seq = calc_optimal_vcmax(z = seq(0, 1000, 100))
ca_seq = calc_optimal_vcmax(cao = seq(250, 1000, 50))
ca_seq
ca_seq2 = calc_optimal_vcmax(cao = seq(250, 1000, 50), tg_c = 45)
ca_seq2
ca_seq2 = calc_optimal_vcmax(cao = seq(250, 1000, 50), tg_c = 45, theta = 0.99)
source('calc_optimal_vcmax.R')
ca_seq2 = calc_optimal_vcmax(cao = seq(250, 1000, 50), tg_c = 45, theta = 0.99)
ca_seq2
plot(ca_seq2$cao, ca_seq2$vcmax)
plot(ca_seq2$cao, ca_seq2$vcmax25)
plot(ca_seq2$cao, ca_seq2$omega)
# test optimal vcmax predicitons
source('calc_optimal_vcmax.R')
par_seq = calc_optimal_vcmax(paro = seq(100, 1000, 100))
t_seq = calc_optimal_vcmax(tg_c = seq(10, 30, 5))
vpd_seq = calc_optimal_vcmax(vpdo = seq(0.5, 4, 0.5))
z_seq = calc_optimal_vcmax(z = seq(0, 1000, 100))
ca_seq = calc_optimal_vcmax(cao = seq(250, 1000, 50))
ca_seq
ca_seq = calc_optimal_vcmax(cao = seq(400, 1000, 50))
ca_seq
25/75
30/100
source('calc_optimal_vcmax.R')
test<- calc_optimal_vcmax(beta=seq(10,1000,10))
test$beta
test$pathway
testc4<- calc_optimal_vcmax(beta=seq(10,1000,10), pathway = 'c4')
testc4<- calc_optimal_vcmax(beta=seq(10,1000,10), pathway = 'C4')
testc4$beta
testc4$vcmax
testc4$chi
testc4$chi_bs
calc_optimal_vcmax()
calc_optimal_vcmax
head(testc4)
return_chi_c4
calc_chi_c4
calc_chi_c4(beta=seq(10,1000,100))
calc_chi_c4(beta=seq(10,1000,100), z = 0)
calc_chi_c4(beta=seq(10,1000,100), z = 0, ca= 400)
calc_chi_c4(beta=seq(10,1000,100), z = 0, ca= 400, temp=25)
calc_chi_c4(beta=seq(10,1000,100), z = 0, ca= 400, temp=25, vpd=1)
seq(10,1000,100)
source('calc_optimal_vcmax.R')
testc4<- calc_optimal_vcmax(beta=seq(10,1000,10), pathway = 'C4')
testc4$beta
testc4$chi
testc4_2<- calc_optimal_vcmax(pathway = 'C4')
testc4_2$beta
testc4_2$chi