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

Inventory initialization patch numbering method is inconsistent with set_patchno #915

Open
glemieux opened this issue Oct 5, 2022 · 0 comments
Labels
refactor Restructures code without changing functionality

Comments

@glemieux
Copy link
Contributor

glemieux commented Oct 5, 2022

While working on #911, I noticed that the initialize_sites_bv_inventory procedure sets patchno in the reverse order compared to set_patchno procedure in that it starts from the youngest patch and iterates through to the oldest:

ipa=1
total_cohorts = 0
currentpatch => sites(s)%youngest_patch
do while(associated(currentpatch))
currentpatch%patchno = ipa
ipa=ipa+1
! Perform Cohort Fusion
call fuse_cohorts(sites(s), currentpatch,bc_in(s))
call sort_cohorts(currentpatch)
! This calculates %countcohorts
call count_cohorts(currentpatch)
total_cohorts = total_cohorts + currentPatch%countcohorts
currentPatch => currentpatch%older
enddo

Here is set_patchno for comparison:

patchno = 1
currentPatch => currentSite%oldest_patch
do while(associated(currentPatch))
currentPatch%patchno = patchno
patchno = patchno + 1
currentPatch => currentPatch%younger
enddo

This works out to be consistent with everything else in the end given that we call set_patchno after the call to initialize_sites_bv_inventory within init_patches. Additionally, while fuse_patch (called a few lines down) utilizes patchno to check that the patches being fused are different, as long as each patch has a unique number, the order doesn't matter.

That said, we probably should replace the patch number update with a call set_patchno.

@glemieux glemieux added the refactor Restructures code without changing functionality label Oct 5, 2022
@glemieux glemieux changed the title Inventory initialization setting patch numbers inconsistent with set_pachno Inventory initialization patch numbering method is inconsistent with set_pachno Oct 5, 2022
@glemieux glemieux moved this to ❕Todo in FATES issue board Oct 5, 2022
@glemieux glemieux changed the title Inventory initialization patch numbering method is inconsistent with set_pachno Inventory initialization patch numbering method is inconsistent with set_patchno Oct 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Restructures code without changing functionality
Projects
Status: ❕Todo
Development

No branches or pull requests

1 participant