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

Update ELM-FATES API to pass fire data to FATES #5369

Merged

Conversation

glemieux
Copy link
Contributor

@glemieux glemieux commented Dec 19, 2022

This pull request updates the ELM-FATES API to provide FATES with the lightning and population density data from FireMod.F90. This provides ELM-FATES users access to the additional SPITFIRE run modes. The design is adapts the framework developed for CLM-FATES. The design document discussing the background and general design is available in the FATES Developer's Guide. All non-fates tests should be b4b as this PR only adds access to additional FATES modes which are not yet covered by existing tests.

This also updates the fates pointer to tag sci.1.63.2_api.25.1.0 bring in the fix to the cray and ibm pointer deallocation issue to resolve

Fixes #5001.
[B4B]

@rljacob rljacob requested a review from rgknox January 10, 2023 21:56
@glemieux glemieux changed the title [WIP] Update ELM-FATES API to pass fire data to FATES Update ELM-FATES API to pass fire data to FATES Feb 16, 2023
@glemieux
Copy link
Contributor Author

Removed WIP. Testing TBD this week.

@rljacob
Copy link
Member

rljacob commented Mar 2, 2023

@rgknox waiting for you to approve.

@glemieux
Copy link
Contributor Author

glemieux commented Mar 2, 2023

@rgknox waiting for you to approve.

@rgknox just a heads up that @JessicaNeedham has a small update she wants to add to this PR. It should be orthogonal to the main thrust of this PR and is a partial solution to the issue discussed in NGEET/fates#985. The change is to update use_fates_planthydro to use_fates here.

@rgknox
Copy link
Contributor

rgknox commented Mar 2, 2023

@glemieux, I will wait until the final changes are in. Can you ping me when its ready?

@glemieux
Copy link
Contributor Author

glemieux commented Mar 2, 2023

@glemieux, I will wait until the final changes are in. Can you ping me when its ready?

Will do. Jessie is testing this out the changes.

@JessicaNeedham
Copy link

Thanks @glemieux. I'm finding that establishment from bare ground works better when we start with higher initial soil moisture. I wondered about changing the use_fates_planthydro to use_fates here:

if (use_fates_planthydro .or. use_hydrstress) then
so that soil moisture is always initialised high when FATES is on.
Details are here NGEET/fates#985 although maybe I should start a separate issue? I believe @mpaiao has also found it necessary to increase soil moisture.
I haven't tested yet on this branch but I will do so now.

@glemieux
Copy link
Contributor Author

glemieux commented Mar 2, 2023

Details are here NGEET/fates#985 although maybe I should start a separate issue? I believe @mpaiao has also found it necessary to increase soil moisture.
I haven't tested yet on this branch but I will do so now.

@JessicaNeedham We could convert the discussion to an issue if you feel like it has been fully addressed. If there are still outstanding issues in the discussion then opening a new issue (and linking back to the open discussion) would be better.

Skimming the discussion, are there changes on the fates-side that need to be made as well? If so, it might be cleaner to update and integrate the fates-side first and then create new PRs for both host land model side.

@JessicaNeedham
Copy link

Thanks @glemieux, I'd say it is not totally resolved so I'll make a new issue for some of the solutions with a corresponding FATES PR.

@rgknox
Copy link
Contributor

rgknox commented Mar 2, 2023

I agree @glemieux, it might be better to add those changes in another PR

@glemieux
Copy link
Contributor Author

glemieux commented Mar 3, 2023

@rgknox we're going to do a different PR for Jessie's changes.

I ran into a run time seg fault in the testing of spitfire in mode 2 right now. I'll ping you again when I've got things fixed up.

This imports and adapts the clm-fates fire base types and
factory method of fire type creation.  The standard elm
FireMod has not been changed, but could adopt this method
in the future if so desired.  FATES will now have access
to the same lightning and population data the the FireMod
make use of.  The code also includes the hooks to enable
the use of additonal FATES fire modes, but these require
the use of data sets not currently stored on most machines.
@glemieux glemieux force-pushed the glemieux/lnd/fates-fire-data-api branch from bad2687 to 41339b9 Compare March 6, 2023 22:41
@glemieux
Copy link
Contributor Author

glemieux commented Mar 6, 2023

@peterdschwartz I'm running regression testing on perlmutter currently. I'll update with the results as soon as possible.

@glemieux
Copy link
Contributor Author

glemieux commented Mar 7, 2023

@peterdschwartz testing on perlmutter against the master baseline is complete. All tests are B4B. There are some failures due to namelist and compute time differences:

  • All fates tests have NLCOMP diffs as they include access to the lightning and pop dens data
  • 2 non-fates tests have TPUTCOMP increases

Folder location: /pscratch/sd/g/glemieux/e3sm-tests/pr5369.fates.pm-cpu.gnu.C41339b97c9-Fb8b905cc

This commit also cleans up some comments
@glemieux
Copy link
Contributor Author

glemieux commented Mar 9, 2023

@peterdschwartz just a heads up that I attempted to run land developer tests on summit since perlmutter is down, but I ran into a model build issue. Since this didn't come up previously, I'm guessing its a compiler-specific issue that I'll need to address.

@glemieux glemieux changed the title Update ELM-FATES API to pass fire data to FATES [WIP] Update ELM-FATES API to pass fire data to FATES Mar 9, 2023
The IBM compiler requires a return assignment for functions.
@glemieux glemieux changed the title [WIP] Update ELM-FATES API to pass fire data to FATES Update ELM-FATES API to pass fire data to FATES Mar 10, 2023
@glemieux
Copy link
Contributor Author

The issue I was seeing on summit has been resolved with c94350c. The problem was that the ibm compiler didn't like that I wasn't setting a return value for two empty functions. For posterity the form of the error was:

"/autofs/nccs-svm1_home1/glemieux/e3sm/components/elm/src/biogeochem/FATESFireNoDataMod.F90", 1513-083 (E) Internal or module function lnfm24 was not set within the function.

The issue here is that the function is the intentionally empty form of a polymorphic procedure that is defined to end the run with an error message. It's setup this was to make sure that the call to the function isn't applied in an instance where it is not allowed. Intel and gnu compilers didn't seem to have a problem with this.

Final land developer testing is underway again.

@glemieux
Copy link
Contributor Author

glemieux commented Mar 10, 2023

Land developer tests are complete. Comparison against master on perlmutter is B4B with the exception of the expected NLCOMP differences for the fates tests. I ran the tests on summit as well (all PASS), although I wasn't able to compare it against the master baseline for some reason.

Folder on perlmutter: /pscratch/sd/g/glemieux/e3sm-tests/pr5369-ibmfix.fates.pm-cpu.gnu.Cc94350cd0a-Fb8b905cc
Folder on summit: /gpfs/alpine/cli115/scratch/glemieux/e3sm-tests/pr5369-ibmfix.fates.summit.ibm.Cc94350cd0a-Fb8b905cc

peterdschwartz added a commit that referenced this pull request Mar 22, 2023
…pi' into next (PR #5369)

This pull request updates the ELM-FATES API to provide FATES with the lightning and population density data from FireMod.F90.
This provides ELM-FATES users access to the additional SPITFIRE run modes. The design is adapts the framework developed for CLM-FATES.
The design document discussing the background and general design is available in the FATES Developer's Guide.
All non-fates tests should be b4b as this PR only adds access to additional FATES modes which are not yet covered by existing tests.

This also updates the fates pointer to tag sci.1.63.2_api.25.1.0 bring in the fix to the cray and ibm pointer deallocation issue to resolve #5001.

Fixes #5001

[B4B]
@peterdschwartz
Copy link
Contributor

merged to next

@peterdschwartz
Copy link
Contributor

merged to master

@grnydawn
Copy link
Contributor

This PR is already merged but I put the following bug report from one of ORNL helpdesk team in regards to this issue:

The deallocate(nextc) call throws the error because nextc is an associated pointer and was never allocated itself. I was using the ERS_Ld20.f45_f45.IELMFATES.crusher_crayclang.elm-fates test case to trigger this. The $E3SM/components/elm/src/external_models/fates/biogeochem/EDCohortDynamicsMod.F90 file is what I was looking at, as well. The following lines from that file are relevant:
subroutine fuse_cohorts(currentSite, currentPatch, bc_in)
...
type (ed_patch_type), intent(inout), target :: currentPatch
...
type (ed_cohort_type) , pointer :: nextc
...
do while(iterate == 1)
currentCohort => currentPatch%tallest
...
do while ( .not.associated(currentCohort,currentPatch%shortest) )
nextc => currentPatch%tallest
do while (associated(nextc))
...
! deallocates the members of nextc
call DeallocateCohort(nextc)
deallocate(nextc) -- this fails!

@rgknox
Copy link
Contributor

rgknox commented Oct 30, 2023

Thanks for posting @grnydawn

This seems related to this previous issue you created: #5001

Some compilers were having trouble allocating and deallocating these derived types, one of the reasons was the "target" designation. I thought we implemented a fix, in a more updated version of the code below, we don't have the target designation.

https://github.com/NGEET/fates/blob/main/biogeochem/EDCohortDynamicsMod.F90#L710-L712

Have you tried your tests with the current master version of E3SM? That should point to a more modern fates tag.

@grnydawn
Copy link
Contributor

@rgknox , No, I have not tried the tests with the latest master branch recently. I will add comment here if I still have this issue.

@glemieux glemieux deleted the glemieux/lnd/fates-fire-data-api branch January 23, 2024 23:24
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.

lib-4412 : UNRECOVERABLE library error of Cray compiler CCE/14.0.0 on Crusher
6 participants