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

Initialize nocomp mode with large trees #995

Merged
merged 18 commits into from
Mar 23, 2023

Conversation

JessicaNeedham
Copy link
Contributor

@JessicaNeedham JessicaNeedham commented Mar 2, 2023

Description:

This PR allows nocomp mode to be initialised with large trees by allowing the initial_density parameter to be interpreted as initial dbh when negative. It then calculates the crown area of a single tree using that DBH, and calculates number density needed to fill the canopy.
Related to issue #994 and discussion #985

Collaborators:

@ckoven @jenniferholm @rgknox @glemieux

Expectation of Answer Changes:

This PR will change answers only in nocomp mode when the parameter fates_recruit_init_density is set to a negative number.

Checklist:

  • My change requires a change to the documentation.
  • I have updated the in-code documentation .AND. (the technical note .OR. the wiki) accordingly.
  • [X ] I have read the CONTRIBUTING document.
  • FATES PASS/FAIL regression tests were run
  • If answers were expected to change, evaluation was performed and provided

Test Results:

CTSM (or) E3SM (specify which) test hash-tag:

CTSM (or) E3SM (specify which) baseline hash-tag:

FATES baseline hash-tag:

Test Output:

call bbgw_allom(temp_cohort%dbh,pft,c_bgw)
! calculate crown area of a single plant
dummy_n = 1.0_r8 ! make n=1 to get area of one tree
spread = 1.0_r8 ! fix this to 0 to remove dynamics of canopy clousre, assuming a closed canopy.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are these two named constants that you can optionally use for spread, if you like. Seems like we initialize with a spread of 0 for an inventory init, 1 for a bare ground init.
https://github.com/NGEET/fates/blob/sci.1.64.2_api.25.2.0/main/EDTypesMod.F90#L108-L109

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like I should be using init_spread_inventory since this isn't a near bare ground case. I've changed it now.

write(fates_log(),*) 'c_area: ', temp_cohort%c_area
write(fates_log(),*) 'p_area: ', patch_in%area

deallocate(temp_cohort) ! get rid of temporary cohort
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a duplicate deallocate, will be harmless, but better to remove it because the following deallocation has more logging.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh good catch, thanks. Deleted the duplicate.

temp_cohort%coage, temp_cohort%dbh, prt_obj, cstatus, rstatus, &
temp_cohort%canopy_trim, temp_cohort%c_area,1,temp_cohort%crowndamage, site_in%spread, bc_in)

write(fates_log(),*) 'c_area: ', temp_cohort%c_area
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these look temporary, can remove

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

temp_cohort%canopy_trim = 1.0_r8
temp_cohort%crowndamage = 1 ! Assume no damage to begin with

if(EDPftvarcon_inst%initd(pft)>nearzero) then ! interpret as initial density and calculate diameter
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JessicaNeedham Should we gracefully fail (during parameter reading) a cold-start simulation where initd=0 (ie abs(initd)<nearzero) ? It seems like if someone sets the diameter to zero, or the density to zero, the run will fail anyway. Although the user may be wondering what happened.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. I've added a check in EDPftvarcon

Copy link
Contributor

@adrifoster adrifoster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This all looks great to me. Thanks for adding the fail. I guess my only thing is that I would prefer having the dbh initialization be a separate parameter rather than used when initd is negative, but it's not a super strong opinion.

@JessicaNeedham
Copy link
Contributor Author

Thanks for the reviews @rgknox and @adrifoster !

@adrifoster I agree that initial dbh value might be better as its own parameter. It's kind of confusing to have parameters mean different things depending on context. Unless anyone has strong feelings otherwise I will go ahead and add it as a new parameter.

Couple of questions on how best to do this:

  1. Should it still have the recruit prefix given it might be used to initialise with large trees? fates_recruit_init_dbh seems like the obvious name but I'm not sure if the recruit bit is confusing.
  2. Do we need another parameter to specify whether this is a density or dbh initialisation (e.g. no_comp_cold_start_mode)? An alternative would be to have the initial_dbh parameter as unset and a note in the long name that if set to positive values (in no comp mode) they will be used and will override the init_density values?

@JessicaNeedham
Copy link
Contributor Author

At the software meeting today we discussed whether to add another parameter v include better comments in the code to explain the dual function of the fates_recruit_init_density parameter. We decided on better comments so I have gone ahead and added those to EDInitMod.

@glemieux
Copy link
Contributor

Regression testing on Cheyenne underway

main/EDInitMod.F90 Outdated Show resolved Hide resolved
@glemieux
Copy link
Contributor

All expected tests are B4B against the fates-sci.1.65.1_api.25.3.0-ctsm5.1.dev118 baseline.

Folder on Cheyenne: /glade/u/home/glemieux/scratch/ctsm-tests/tests_pr995

@glemieux glemieux merged commit 7f448b0 into NGEET:main Mar 23, 2023
@JessicaNeedham JessicaNeedham deleted the JFN-nocomp-init-large-sizes branch January 11, 2024 23:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants