Skip to content

Negative promotion/demotion area due to double float precision #1508

@jiamenglai

Description

@jiamenglai

Describe the issue

Hello, I met an error of 'negative or more area than the cohort has is being promoted/demoted' in EDCanopyStructureMod, and I think it's due to double float precision. I am running ELM-FATES with ed_st3 on and with my inventory file. The trigger of this error is in the code lines below (Line 662 - 664):

remainder_area = cohort%c_area - layer_co(ic)%pd_area
copyc%n = cohort%n*remainder_area/cohort%c_area
cohort%n = cohort%n - copyc%n

When I output those values, I found that pd_area is about 4E-16 (positive), but the copyc%n is slightly larger than the original cohort%n, which is wrong mathematically. This gives a negative cohort%n after those code, and led to negative demotion area in the next demotion phase.

Any suggestions to fix this bug? Thanks!

Relevant log output

FATES tag

sci.1.88.0_api.42.0.0

Host land model tag

v3.1.0-alpha-4304-ge909ef9f6f

Machine

perlmutter

Other supported machine name

No response

Additional context

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

✔ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions