Skip to content

Commit

Permalink
Merge pull request #162 from oleksmialyk/master
Browse files Browse the repository at this point in the history
Fixing bugs with groundwater, irrigation, soil bunds, canopy and root development
  • Loading branch information
chris-s-bowden authored Aug 14, 2024
2 parents e861bea + 6918249 commit 7791ba0
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 18 deletions.
4 changes: 2 additions & 2 deletions aquacrop/entities/fieldManagement.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class FieldMngt:
f_mulch (float): Soil evaporation adjustment factor due to effect of mulches
z_bund (float): Bund height (m)
z_bund (float): Bund height, user specifies in (m) but immediately converted to (mm) on initialisation for coherent calculations
bund_water (float): Initial water height in surface bunds (mm)
Expand Down Expand Up @@ -47,7 +47,7 @@ def __init__(

self.mulch_pct = mulch_pct # Area of soil surface covered by mulches (%)
self.f_mulch = f_mulch # Soil evaporation adjustment factor due to effect of mulches
self.z_bund = z_bund # Bund height (m)
self.z_bund = z_bund * 1000 # Bund height, user-specified as (m), here immediately converted to (mm)
self.bund_water = bund_water # Initial water height in surface bunds (mm)
self.curve_number_adj_pct = curve_number_adj_pct # Percentage change in curve number (positive or negative)

Expand Down
3 changes: 2 additions & 1 deletion aquacrop/solution/HIref_current_day.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from aquacrop.entities.crop import CropStructNT


@cc.export("HIref_current_day", (f8,f8,i8,i8,b1,f8,f8,f8,CropStructNT_type_sig,b1))
@cc.export("HIref_current_day", (f8,f8,i8,i8,b1,f8,f8,f8,f8,CropStructNT_type_sig,b1))
def HIref_current_day(
NewCond_HIref: float,
NewCond_HIfinal: float,
Expand All @@ -27,6 +27,7 @@ def HIref_current_day(
NewCond_YieldForm: bool,
NewCond_PctLagPhase: float,
NewCond_CC: float,
NewCond_CC_prev: float,
NewCond_CCxW: float,
Crop: "CropStructNT",
growing_season: bool,
Expand Down
4 changes: 2 additions & 2 deletions aquacrop/solution/check_groundwater_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ def check_groundwater_table(
# Store adjusted field capacity values
NewCond_th_fc_Adj = thfcAdj
# prof.th_fc_Adj = thfcAdj
return (NewCond_th_fc_Adj, NewCond_WTinSoil)
return (NewCond_th_fc_Adj, NewCond_WTinSoil, NewCond_zGW)

return (NewCond_th_fc_Adj, None)
return (NewCond_th_fc_Adj, None, None)

if __name__ == "__main__":
cc.compile()
12 changes: 6 additions & 6 deletions aquacrop/solution/infiltration.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,11 @@ def infiltration(
NewCond_SurfaceStorage = 0

# Calculate additional runoff
if NewCond_SurfaceStorage > (FieldMngt_zBund * 1000):
if NewCond_SurfaceStorage > FieldMngt_zBund:
# Water overtops bunds and runs off
RunoffIni = NewCond_SurfaceStorage - (FieldMngt_zBund * 1000)
RunoffIni = NewCond_SurfaceStorage - FieldMngt_zBund
# Surface storage equal to bund height
NewCond_SurfaceStorage = FieldMngt_zBund * 1000
NewCond_SurfaceStorage = FieldMngt_zBund * 1
else:
# No overtopping of bunds
RunoffIni = 0
Expand Down Expand Up @@ -286,11 +286,11 @@ def infiltration(
# Increase surface storage
NewCond_SurfaceStorage = NewCond_SurfaceStorage + (Runoff - RunoffIni)
# Limit surface storage to bund height
if NewCond_SurfaceStorage > (FieldMngt_zBund * 1000):
if NewCond_SurfaceStorage > FieldMngt_zBund:
# Additonal water above top of bunds becomes runoff
Runoff = RunoffIni + (NewCond_SurfaceStorage - (FieldMngt_zBund * 1000))
Runoff = RunoffIni + (NewCond_SurfaceStorage - FieldMngt_zBund)
# Set surface storage to bund height
NewCond_SurfaceStorage = FieldMngt_zBund * 1000
NewCond_SurfaceStorage = FieldMngt_zBund
else:
# No additional overtopping of bunds
Runoff = RunoffIni
Expand Down
4 changes: 2 additions & 2 deletions aquacrop/solution/irrigation.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@ def irrigation(
EffAdj = ((100 - IrrMngt_AppEff) + 100) / 100
IrrReq = IrrReq * EffAdj
# Limit irrigation to maximum depth
# Irr = min(IrrMngt_MaxIrr, IrrReq)
Irr = 15 # hard-code in 15mm depth for tests
Irr = min(IrrMngt_MaxIrr, IrrReq)
# Irr = 15 # hard-code in 15mm depth for tests
else:
Irr = 0

Expand Down
2 changes: 1 addition & 1 deletion aquacrop/solution/root_development.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ def root_development(
# No root system outside of the growing season
NewCond_Zroot = 0

return NewCond_Zroot
return NewCond_Zroot, NewCond_rCor

if __name__ == "__main__":
cc.compile()
6 changes: 3 additions & 3 deletions aquacrop/timestep/run_single_timestep.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def solution_single_time_step(

# Run simulations %%
# 1. Check for groundwater table
NewCond.th_fc_Adj, NewCond.wt_in_soil = check_groundwater_table(
NewCond.th_fc_Adj, NewCond.wt_in_soil, NewCond.z_gw = check_groundwater_table(
Soil.Profile,
NewCond.z_gw,
NewCond.th,
Expand All @@ -189,7 +189,7 @@ def solution_single_time_step(
)

# 2. Root development
NewCond.z_root = root_development(
NewCond.z_root, NewCond.r_cor = root_development(
Crop,
Soil.Profile,
NewCond.dap,
Expand Down Expand Up @@ -396,8 +396,8 @@ def solution_single_time_step(
NewCond.delayed_cds,
NewCond.yield_form,
NewCond.pct_lag_phase,
#NewCond.cc_prev,
NewCond.canopy_cover,
NewCond.cc_prev,
NewCond.ccx_w,
Crop,
growing_season,
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = aquacrop
version = 3.0.8
version = 3.0.9
author = Tim Foster
author_email = timothy.foster@manchester.ac.uk
description = Soil-Crop-Water model based on AquaCrop-OS.
Expand Down

0 comments on commit 7791ba0

Please sign in to comment.