Hey, I noticed that the crop and tree nitrogen-uptake routines appear to compare the remaining plant N demand against n_uptake, which is still initialized to zero at that point, rather than against the calculated potential uptake nupsum.
In src/crop/nuptake_crop.c, the n_uptake is initialized to zero at the beginning of the function. After accumulating the potential NO3 and NH4 uptake in nupsum, the code uses:
if(n_uptake>*n_plant_demand-pft->bm_inc.nitrogen)
n_uptake=*n_plant_demand-pft->bm_inc.nitrogen;
else
n_uptake=nupsum;
The tree routine contains the same pattern in src/tree/nuptake_tree.c.
By contrast, the grass implementation compares nupsum with the remaining demand in src/grass/nuptake_grass.c:
if(nupsum>*n_plant_demand-(vegn_sum_grass(pft)+pft->bm_inc.nitrogen))
n_uptake=*n_plant_demand-(vegn_sum_grass(pft)+pft->bm_inc.nitrogen);
else
n_uptake=nupsum;
Is this a bug :)
Hey, I noticed that the crop and tree nitrogen-uptake routines appear to compare the remaining plant N demand against
n_uptake, which is still initialized to zero at that point, rather than against the calculated potential uptakenupsum.In
src/crop/nuptake_crop.c, then_uptakeis initialized to zero at the beginning of the function. After accumulating the potential NO3 and NH4 uptake innupsum, the code uses:The tree routine contains the same pattern in
src/tree/nuptake_tree.c.By contrast, the grass implementation compares
nupsumwith the remaining demand insrc/grass/nuptake_grass.c:Is this a bug :)