Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inconsistency between dlower_vai indexing and arrays that use it #1220

Open
rgknox opened this issue Jul 10, 2024 · 0 comments
Open

inconsistency between dlower_vai indexing and arrays that use it #1220

rgknox opened this issue Jul 10, 2024 · 0 comments

Comments

@rgknox
Copy link
Contributor

rgknox commented Jul 10, 2024

Various arrays we have are dimensioned by leaf layer. Leaf layer boundaries are defined by top-down depth integrated vegetation area, and controlled by the input parameters that define the starting bin width and an increase factor.

These parameters define the array dlower_vai, set here:
https://github.com/NGEET/fates/blob/main/main/FatesInterfaceMod.F90#L928-L937

The issue is that when we determine the number of leaf layers there are in a cohort, if the cohort has more VAI than the last bin in dlower_vai, it will generate an index that is out of bounds for various arrays. See here:

https://github.com/NGEET/fates/blob/main/biogeochem/EDCanopyStructureMod.F90#L2258

This is because dlower_vai is the size nlevleaf and so are the the arrays that use dlower_vai as its indexing... such as ts_net_uptake, see here:

https://github.com/NGEET/fates/blob/main/main/EDParamsMod.F90#L113
https://github.com/NGEET/fates/blob/main/biogeochem/FatesCohortMod.F90#L166

I think there are at least two ways to improve this. We could increase the allocation of arrays that use this indexing to nlevleaf+1, or we could force the last index of dlower_vai to be very very large (like e+20) or something silly large.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ❕Todo
Development

No branches or pull requests

1 participant