Fix: uninitialised variables in cable_canopy.F90 #352
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
CABLE
Thank you for submitting a pull request to the CABLE Project.
Description
Fixes #351.
Move the definition of sum_rad_gradis and sum_rad_rniso out of the NITER loop in
define_canopy()
since these variables do not change in the loop. Having a quick comparison between the outputs before and after this commit the effect is negligeable.Use
sum_rad_gradis
andsum_rad_rniso
as calculated in define_canopy() everywhere in define_canopy(), dryLeaf() and wetLeaf(), instead of recalculating them sometimes.Move the initialisation of
canopy%DvLitt
andcanopy%kthLitt
to the top ofdefine_canopy()
since these variables are constant throughout the run. We also want these variables to be defined in all cases to avoid errors in function calls, but only used withcable_user%litter
turned on.Type of change
Please delete options that are not relevant.
Testing
benchcab/me.org analysis: https://modelevaluation.org/analyses/anywhere/BPLvifw3DyARokYdg/s6k22L3WajmiS9uGv/CJGXP5GQWhGf3nH28/all
Tested in benchcab the changes for DvLitt and kthLitt on their own. benchcab showed bitwise identical results when moving the initialisation compared to the previous implementation with the litter option on.
Please add a reviewer when ready for review.
📚 Documentation preview 📚: https://cable--352.org.readthedocs.build/en/352/