Skip to content

infinite loop in damage code #1531

@rgknox

Description

@rgknox

@JessicaNeedham and I stumbled upon this bug in the damage code yesterday:

https://github.com/NGEET/fates/blob/main/biogeochem/EDPhysiologyMod.F90#L294-L295

There is a call to "cycle", however if you cycle inside a linked list loop, you wont advance unless you advance to the next cohort before triggering the cycle.

This probably has not given anyone trouble yet because we haven't done too much work with damage and non-woody plants, and this seems to have been buffered from encountering new plants.

Simple fix:

 if(prt_params%woody(ccohort%pft)==ifalse  .or. ccohort%isnew ) then
   ccohort => ccohort%shorter
   cycle
end

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