Skip to content

All branches merged and conflicts resolved? #25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/physiology/nitrogen.jl
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@

# Relative drought factor from CROPGRO. Used for N_uptake_conversion_factor.
"Relative drought factor"
drought_factor(SW, minSW, field_capacity, soil_saturation,WP) => begin
drought_factor(SW, minSW, field_capacity, soil_saturation, WP) => begin
if SW > field_capacity
1.0 - (SW - field_capacity) / (soil_saturation - field_capacity)
else
Expand Down
8 changes: 4 additions & 4 deletions src/physiology/photosynthesis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ Photosynthesis

# "Gas exchange model for sunlit leaves"

# sunlit_gasexchange(context, PPFD=Q_sun, LAI=LAI_sunlit, w=leaf_width,drought_factor =drought_factor) ~ ::GasExchange
# sunlit_gasexchange(context, PPFD=Q_sun, LAI=LAI_sunlit, w=leaf_width, drought_factor =drought_factor) ~ ::GasExchange

# "Gas exchange model for shaded leaves"
# shaded_gasexchange(context, PPFD=Q_sh, LAI=LAI_shaded, w=leaf_width, drought_factor = drought_factor) ~ ::GasExchange
# shaded_gasexchange(context, PPFD=Q_sh, LAI=LAI_shaded, w=leaf_width, drought_factor =drought_factor) ~ ::GasExchange

"Gas exchange model for sunlit leaves"
sunlit_gasexchange(context, PPFD=Q_sun, LAI=LAI_sunlit, w=leaf_width, s=s) ~ ::GasExchange
sunlit_gasexchange(context, PPFD=Q_sun, LAI=LAI_sunlit, w=leaf_width, s=s, drought_factor=drought_factor) ~ ::GasExchange

"Gas exchange model for shaded leaves"
shaded_gasexchange(context, PPFD=Q_sh, LAI=LAI_shaded, w=leaf_width, s=s) ~ ::GasExchange
shaded_gasexchange(context, PPFD=Q_sh, LAI=LAI_shaded, w=leaf_width, s=s, drought_factor=drought_factor) ~ ::GasExchange


#=================
Expand Down
46 changes: 16 additions & 30 deletions src/rhizosphere/waterbalance.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ Transpiration
"Initial soil water"
iSW => 200 ~ preserve(parameter, u"mm")


"Maximum soil water/saturation"
soil_saturation => 500 ~ preserve(parameter, u"mm")

Expand All @@ -24,8 +23,8 @@ Transpiration
#soil_table[soil_class].wilting_point
end ~ preserve(parameter, u"mm")

"Irrigation"
irrigation => 0 ~ preserve(parameter, u"mm/hr")
# "Irrigation"
# irrigation => 0 ~ preserve(parameter, u"mm/hr")

# "Maximum available soil water"
# maxASW => 200 ~ preserve(parameter, u"mm") # (Field capacity - Wilting point) * depth
Expand All @@ -34,10 +33,6 @@ Transpiration
# "Minimum available soil water"
# minASW => 0 ~ preserve(parameter, u"mm") # need to be updated based on VWC by soil types

#"Irrigation"
#irrigation => 0 ~ preserve(parameter, u"mm/hr")


"Fraction of excess water pooled"
pool_fraction => 0 ~ preserve(parameter)

Expand All @@ -61,11 +56,8 @@ Transpiration
# ((Int(soil_class) > 0) ? (11 - 2 * Int(c)) : (SWpower0))
# end ~ preserve

###
field_capacity(soil_saturation) => 327 ~ preserve(u"mm")

# fc => 0.5 ~ preserve(parameter)
# field_capacity(fc, maxASW, minASW) => fc * (maxASW + minASW) ~ preserve(u"mm")
fc => 0.5 ~ preserve(parameter)
field_capacity(fc, soil_saturation, minSW) => fc * (soil_saturation + minSW) ~ preserve(u"mm")


"Proportion of rain intercepted"
Expand Down Expand Up @@ -105,19 +97,15 @@ Transpiration
end ~ track(u"mm/hr")

###
# dSW(dPool, evapotranspiration#=, irrigation=#, rain) => begin
# -dPool - evapotranspiration#= + irrigation=# + rain

"Hourly change in avilable soil water"
dASW(dPool, evapotranspiration, irrigation, rain) => begin
dSW(dPool, evapotranspiration, irrigation, rain) => begin
-dPool - evapotranspiration + irrigation + rain
end ~ track(u"mm/hr")

flag_transpiration(transpiration) => transpiration > 0u"mm/hr" ~ flag

"Production modifier for GPP"
transpScaleFactor(evapotranspiration, transpiration, rainInterception) => begin
evapotranspiration / (transpiration + rainInterception)
evapotranspiration / (transpiration + rainInterception) # actual / potential
end ~ track(when=flag_transpiration, init=1)

SW(dSW) ~ accumulate(u"mm", init=iSW, min=minSW, max=soil_saturation)
Expand All @@ -131,33 +119,33 @@ Transpiration

"Irrigation based on profiling VWC for Slit Loam"
soil_depth => 2000 ~ preserve(parameter, u"mm") #Poplar rooting depth; soil depth for water balance
SLs => 0.486 ~ preserve(parameter) # Slit Loam - Saturated volumetric water content
SLr => 0.05 ~ preserve(parameter) # Slit Loam - Residual volumetric water content
SLs => 0.486 ~ preserve(parameter) # Silt Loam - Saturated volumetric water content
SLr => 0.05 ~ preserve(parameter) # Silt Loam - Residual volumetric water content

VWC(ASW, soil_depth) => begin
ASW / soil_depth
VWC(SW, soil_depth) => begin
SW / soil_depth
end ~ track(max = SLs)

"Calculate related water content"
RWC(SLs, SLr, VWC) => begin
(VWC - SLr) / (SLs - SLr)
end ~ track

"Field capacity as VWC"
FC => 0.330 ~ preserve(parameter) # Field capacity for Slit Loam
# "Field capacity as VWC"
# FC => 0.330 ~ preserve(parameter) # Field capacity for Slit Loam
#FC(field_capacity, soil_depth) => begin
# (field_capacity / soil_depth)
#end~ track

"wilting point as VWC"
WP => 0.133 ~ preserve(parameter) # Wilting point for Slit Loam
# "wilting point as VWC"
# WP => 0.133 ~ preserve(parameter) # Wilting point for Slit Loam
#WP(wilting_point, soil_depth) => begin
# (field_capacity / soil_depth)
#end~ track

"Irrigation control parameters"
irrigation_start => 0.133 ~ preserve(parameter) # Irrigation start point VWC- wilting point
irrigation_end => 0.330 ~ preserve(parameter) # Irrigation end point VWC - field capacity
irrigation_start(WP, soil_depth) => WP / soil_depth ~ preserve(parameter) # Irrigation start point VWC- wilting point
irrigation_end(field_capacity, soil_depth) => field_capacity / soil_depth ~ preserve(parameter) # Irrigation end point VWC - field capacity
irrigation_rate => 0.5 ~ preserve(parameter, u"mm/hr") # Irrigation rate mm/hr

"Update irrigation status based on VWC"
Expand All @@ -170,6 +158,4 @@ Transpiration
irrigation_rate
end
end ~ track(u"mm/hr")


end