Skip to content

A potential bug regarding nitrogen uptake by crops and trees #75

Description

@yunan-l

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 :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions