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

Katetc/dglc negfluxes #303

Merged
merged 10 commits into from
Sep 6, 2024
Merged

Katetc/dglc negfluxes #303

merged 10 commits into from
Sep 6, 2024

Conversation

Katetc
Copy link
Contributor

@Katetc Katetc commented Aug 30, 2024

Description of changes

Add code to Dglc to balance neg and positive ice fluxes and reduce the amount of negative water fluxes coming from each ice sheet to the ocean.

Specific notes

Contributors other than yourself, if any:

CDEPS Issues Fixed (include github issue #): #301

Are there dependencies on other component PRs (if so list):

Are changes expected to change answers (bfb, different to roundoff, more substantial):

  • Changes answers for any compset using DGLC

Any User Interface Changes (namelist or namelist defaults changes):

Testing performed (e.g. aux_cdeps, CESM prealpha, etc):

  • Only prelimary testing at this point. This PR is for discussion and review.

Hashes used for testing:

@Katetc Katetc self-assigned this Aug 30, 2024
Copy link
Member

@billsacks billsacks left a comment

Choose a reason for hiding this comment

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

This mostly looks great! It will be really good to have these corrections in dglc - thank you!

The main thing I want to talk more with you about is the use of areas, as we've been discussing by email. Other than that, I just have two small comments below.

dglc/dglc_datamode_noevolve_mod.F90 Outdated Show resolved Hide resolved
Comment on lines 390 to 393
call ESMF_MeshGet(model_meshes(ns), elementdistGrid=distGrid, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call ESMF_DistGridGet(distGrid, localDe=0, elementCount=lsize, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason you repeat this fetching of lsize rather than using the original lsize = size(Fgrg_rofi(ns)%ptr)?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I agree with @billsacks - I think that lsize should be set as a module variable on initialization.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm just not clear on everything that is done in these two function calls, but I removed the second one and replaced it with the size(Fgrg_rofi(ns)%ptr) function instead as that does seem clear and simple. I disagree with Mariana that lsize should be a module variable, as I think that would require writing it out for restarts, and that's unnecessary.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@KateC - I got rid of lsize as a module variable in my PR for the restart problem - so we're on the same page.

Copy link
Member

Choose a reason for hiding this comment

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

I'm just not clear on everything that is done in these two function calls

The ESMF_MeshGet call says: I've got this mesh (model_meshes(ns)), give me the associated elementdistGrid (distGrid); then ESMF_DistGridGet says: I've got this distgrid, give me the elementCount (lsize). (This is a common ESMF pattern: I've got this object, I want to get one or more of its components or other related information, so call a Get function that takes that object as an argument and various optional output arguments.)

dglc/dglc_datamode_noevolve_mod.F90 Outdated Show resolved Hide resolved
@mvertens
Copy link
Collaborator

mvertens commented Sep 1, 2024

@Katetc - it's important to not change the order of the initialize_noevolve flag in dglc_datamode_noevolve.

     if (initialized_noevolve) then
         ! Compute Fgrg_rofi
         do ns = 1,num_icesheets
            lsize = size(Fgrg_rofi(ns)%ptr)
            do ng = 1,lsize
               if (is_in_active_grid(usrf(ng))) then
                  Fgrg_rofi(ns)%ptr(ng) = Flgl_qice(ns)%ptr(ng)
               else
                  Fgrg_rofi(ns)%ptr(ng) = 0._r8
               end if
            end do
         end do
      end if

      ! Set initialized flag
      initialized_noevolve = .true.

This order needs to be kept since Flgl_qice(ns)%ptr(ng) is not actually received the first time this is called from InitializeRealize in glc_comp_nuopc.F90.

@mvertens
Copy link
Collaborator

mvertens commented Sep 4, 2024

@Katetc @billsacks @jedwards4b - since this PR changes answers I think it should be a separate PR from the fix to the restart for multi-level ice sheets. Also - this is still under development and NorESM really needs the fix for the restart as soon as possible.

Copy link
Member

@billsacks billsacks left a comment

Choose a reason for hiding this comment

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

It looks like you have addressed the earlier comments - thank you!

@Katetc
Copy link
Contributor Author

Katetc commented Sep 5, 2024

Note that I did run the aux_cdeps test suite on Derecho with the intel compiler and several tests failed at create_newcase due to the removal of grid aliases in ccs_config_cesm PR#177 ESMCI/ccs_config_cesm#177 . I will add an issue to update the test list.

@jedwards4b
Copy link
Contributor

@KateC I will update the tests in my incoming rpointer timestamp PR.

Copy link
Member

@billsacks billsacks left a comment

Choose a reason for hiding this comment

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

Two very minor remaining points - a line of code that I think you can remove, and a stylistic nitpick that I'm okay with you ignoring. Otherwise, looks great! Thanks again for your work on this!

dglc/dglc_datamode_noevolve_mod.F90 Show resolved Hide resolved
dglc/dglc_datamode_noevolve_mod.F90 Outdated Show resolved Hide resolved
@Katetc
Copy link
Contributor Author

Katetc commented Sep 5, 2024

Thanks everybody for the reviews, comments and help! I have completed some one-off conservation checks and looked at my results, and they all look good. I'm doing one more quick test right now to make sure that my final modifications didn't break anything unexpectedly, and then I feel this will be ready to merge.

Copy link
Member

@billsacks billsacks left a comment

Choose a reason for hiding this comment

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

Looks good now - thanks for the last couple of changes!

Let us know when you feel this is ready to merge.

@Katetc
Copy link
Contributor Author

Katetc commented Sep 6, 2024

Ok, I have run my tests and everything looks very good to me this morning. I just tried to automatically merge in Jim's morning PR, so I guess we'll see how that goes. Once it's done, this one is ready to go next.
Thanks everybody!!!

@jedwards4b jedwards4b merged commit f6bc974 into ESCOMP:main Sep 6, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DGLC bug with multiple ice sheets
4 participants