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

Implements CCPP-ized tropopause_find #293

Merged
merged 26 commits into from
Oct 7, 2024

Conversation

jimmielin
Copy link
Member

Companion PR: ESCOMP/atmospheric_physics#112

Note: I think I brought in more changes than necessary in ncar_ccpp due to the my atmospheric_physics branch being based off development rather than the released used in CAM-SIMA. I can do a rebase if necessary...

Changes made to support CCPP-ized tropopause_find

  • Copied utility module interpolate_data.F90 from CAM
  • Added utility module tropopause_read_file.F90 to provide climatological tropopause data to tropopause_find from CAM-SIMA
  • &tropopause_nl tropopause_climo_file is read from tropopause_read_file.F90 inside SIMA and not in the parameterization, to avoid passing this file name back and forth between the parameterization to CAM-SIMA
  • Adds get_curr_calday() result to new standard name variable fractional_calendar_days_on_end_of_current_timestep
  • Submodule update (possibly need a rebase?)

I recommend manually merging in the history PR for testing. It might be easier to merge my branch (jimmielin:hplin/tropopause_find) into peverwhee:history_court.

@jimmielin
Copy link
Member Author

jimmielin commented Aug 26, 2024

Verified that CAM and CAM-SIMA should give the same results now (via good old write(6,*)...), although not in the history tape. The same numbers written to the history tape in CAM and CAM-SIMA differ slightly.

My bad, namelist error when setting the output precision, user error as I suspected 😄 False alarm!

@jimmielin
Copy link
Member Author

Updated generate_registry_data.py to check for valid numeric values before assuming it's a variable.

@jimmielin
Copy link
Member Author

jimmielin commented Sep 9, 2024

After the fillvalue change I'm getting very small differences in the cold-point-tropopause history output and bit-for-bit in others, still figuring out why...

Seems like the fillvalues are being written as 9.999...E+35

 TROPF_P   (ncol,time)  t_index =      1     1
         23     1352  (  1017,     1) (  1260,     1) (  1017,     1) (  1017,     1)
                1352   9.999999616903162E+35   3.451314683962001E+03 3.8E+28  9.999999616903162E+35 6.5E-10  9.999999616903162E+35
                1352   1.000000000000000E+36   3.451314683962001E+03          1.000000000000000E+36          1.000000000000000E+36
                1352  (  1017,     1) (  1260,     1)
          avg abs field values:    1.701183366780863E+34    rms diff: 5.0E+27   avg rel diff(npos):  6.5E-10
                                   1.701183431952662E+34                        avg decimal digits(ndif):  7.4 worst:  7.4
 RMS TROPF_P                          4.9967E+27            NORMALIZED  2.9372E-07

 TROPF_T   (ncol,time)  t_index =      1     1
         23     1352  (  1017,     1) (   862,     1) (  1017,     1) (  1017,     1)
                1352   9.999999616903162E+35   1.786520363629979E+02 3.8E+28  9.999999616903162E+35 6.5E-10  9.999999616903162E+35
                1352   1.000000000000000E+36   1.786520363629979E+02          1.000000000000000E+36          1.000000000000000E+36
                1352  (  1017,     1) (   862,     1)
          avg abs field values:    1.701183366780863E+34    rms diff: 5.0E+27   avg rel diff(npos):  6.5E-10
                                   1.701183431952662E+34                        avg decimal digits(ndif):  7.4 worst:  7.4
 RMS TROPF_T                          4.9967E+27            NORMALIZED  2.9372E-07

 TROPF_Z   (ncol,time)  t_index =      1     1
         23     1352  (  1017,     1) (  1045,     1) (  1017,     1) (  1017,     1)
                1352   9.999999616903162E+35   9.015423193848925E+03 3.8E+28  9.999999616903162E+35 6.5E-10  9.999999616903162E+35
                1352   1.000000000000000E+36   9.015423193848925E+03          1.000000000000000E+36          1.000000000000000E+36
                1352  (  1017,     1) (  1045,     1)
          avg abs field values:    1.701183366780863E+34    rms diff: 5.0E+27   avg rel diff(npos):  6.5E-10
                                   1.701183431952662E+34                        avg decimal digits(ndif):  7.4 worst:  7.4
 RMS TROPF_Z                          4.9967E+27            NORMALIZED  2.9372E-07

… regex match

This resolves bit-for-bit issues with fillvalue being written as 9.99e+35 without this fix.
@jimmielin
Copy link
Member Author

I had to specify _kind_phys in the <initial_value>1.e36_kind_phys</initial_value> to get the correct definition in physics_state.F90 and bit-for-bit results with CAM/previous version of CAM-SIMA. The regex in generate_registry_data.py has also been updated. Thanks!

@nusbaume nusbaume self-requested a review October 1, 2024 15:34
@nusbaume nusbaume added enhancement New feature or request externals externals updating issue or PR labels Oct 1, 2024
Copy link
Collaborator

@nusbaume nusbaume left a comment

Choose a reason for hiding this comment

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

Thanks @jimmielin for ensuring the tropopause code works in CAM-SIMA! I do have some change requests, but hopefully none that are too difficult to implement. Of course if you find that there is a problem or issue with anything I requested just let me know. Thanks!

.gitmodules Outdated Show resolved Hide resolved
cime_config/namelist_definition_cam.xml Outdated Show resolved Hide resolved
cime_config/namelist_definition_cam.xml Outdated Show resolved Hide resolved
cime_config/namelist_definition_cam.xml Outdated Show resolved Hide resolved
src/control/cam_comp.F90 Outdated Show resolved Hide resolved
src/physics/utils/tropopause_read_file.F90 Outdated Show resolved Hide resolved
src/physics/utils/tropopause_read_file.F90 Outdated Show resolved Hide resolved
src/physics/utils/tropopause_read_file.F90 Outdated Show resolved Hide resolved
src/physics/utils/tropopause_read_file.meta Outdated Show resolved Hide resolved
src/utils/interpolate_data.F90 Show resolved Hide resolved
- rename tropopause_read_file -> tropopause_climo_read and corrresponding subroutine names
- move ccpp variable initialization calls into read subroutine
- improved error handling with errmsg
- compile Fortran numeric regex in generate_registry_data.py
@jimmielin
Copy link
Member Author

Thanks @nusbaume for the review. I've addressed most of the concerns. There are a few questions that I wanted to confirm for some suggested changes, could you please take a look? I appreciate your help!

Copy link
Collaborator

@nusbaume nusbaume left a comment

Choose a reason for hiding this comment

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

Super-close! Just one last code change and a standard-name change.

src/physics/utils/tropopause_climo_read.F90 Outdated Show resolved Hide resolved
src/physics/utils/tropopause_read_file.meta Outdated Show resolved Hide resolved
Copy link
Collaborator

@nusbaume nusbaume left a comment

Choose a reason for hiding this comment

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

Looks great now, thanks @jimmielin!

Copy link
Collaborator

@peverwhee peverwhee left a comment

Choose a reason for hiding this comment

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

One tiny comment to take or leave! Thanks @jimmielin

src/physics/utils/tropopause_climo_read.F90 Show resolved Hide resolved
@jimmielin
Copy link
Member Author

Thanks @nusbaume and @peverwhee for the reviews, merging it in! I'll address the standard names and the check_allocate issues in separate PRs following this.

@jimmielin jimmielin merged commit 0b6a468 into ESCOMP:development Oct 7, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request externals externals updating issue or PR
Projects
Status: Tag
Development

Successfully merging this pull request may close these issues.

3 participants