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

Code and script to create required fix files for coupled model needs to be incorporated into ufs-utils. #143

Closed
DeniseWorthen opened this issue Sep 3, 2020 · 90 comments
Assignees
Labels
enhancement New feature or request

Comments

@DeniseWorthen
Copy link
Contributor

DeniseWorthen commented Sep 3, 2020

Updated Issue and Action Plan is documented here

Original issue description:

The following tools need to be integrated into ufs_utils:

  1. CICE5_ICgen: initial condition generation for cice5/cice6

  2. CICE5_gridgen: grid condition generation for cice5/cice6

  3. WeightGen: weight generation for grid->grid transformations containing

a) gen_fixgrid and associated fortran code: a fortran routine to read the MOM6 supergrid and create a netcdf file which is
the basis for the remaining transformations
b) generate_iceocn_weights.ncl: esmf weight generation for tripole:tripole or tripole:rectilinear or other grid:grid transformations
c) generate_icemesh.ncl: generation of the ice_mesh for use by the CMEPS mediator
d) generate_frac_land_weights.sh: generation of the frac_land weights (the ocean mask on the fv3 grid) using ESMF_RegridWeightGen
e) make_frac_land.ncl: creation of the 6-tiled land_frac files

For more details, see Jun's notes: https://docs.google.com/document/d/13ui4P_vE2ejVn1fsMnRdoHgjaUf8d5u_-_S4nOvcWOA/edit?usp=sharing

This work requires the use of ESMF 8.2.0. That upgrade will be done under this issue:

@GeorgeGayno-NOAA
Copy link
Collaborator

@DeniseWorthen The first step will be to add these codes to the ./sorc directory and build them. We build using CMake.

Also I recommend we add some regression or unit tests for these codes.

Are these codes run in OPS? If so, are there any 'ush' scripts that will need to be included?

@DeniseWorthen
Copy link
Contributor Author

These codes are all associated with the generation of fixed or initial conditions for the ufs-s2s-model.

The product of the weight generation routines (ie, the regridding weights) are also used in post, to regrid the tripole grid to rectilinear grids at different resolutions.

There are only two fortran routines included, one for the cice5/6 gridgen and one for the MOM6 gridgen. I do not know CMake.

The remaining contents are ncl scripts.

I need to understand how general to make these routines. For example, since they're my tools, they point to my directories. They should, if being used to create curated files, point to some baseline area for both input and output. What would a regression test entail? Currently it is a manual process to choose the resolution, create the needed grid files etc. Am I supposed to make this launch as some sort of automatic regression test end-to-end?

@GeorgeGayno-NOAA
Copy link
Collaborator

These codes are all associated with the generation of fixed or initial conditions for the ufs-s2s-model.

The product of the weight generation routines (ie, the regridding weights) are also used in post, to regrid the tripole grid to rectilinear grids at different resolutions.

There are only two fortran routines included, one for the cice5/6 gridgen and one for the MOM6 gridgen. I do not know CMake.

The remaining contents are ncl scripts.

I need to understand how general to make these routines. For example, since they're my tools, they point to my directories. They should, if being used to create curated files, point to some baseline area for both input and output. What would a regression test entail? Currently it is a manual process to choose the resolution, create the needed grid files etc. Am I supposed to make this launch as some sort of automatic regression test end-to-end?

They need to be general so that anyone can use them easily. That is the purpose of UFS_UTILS. So pointing to personal directories is not allowed. Maybe we should set up a google meet to discuss a plan forward.

@DeniseWorthen
Copy link
Contributor Author

That would be very useful. I've shared my calendar w/ you so lets find a time that works.

Thanks.

@edwardhartnett
Copy link
Collaborator

Is this issue still active?

@DeniseWorthen
Copy link
Contributor Author

Yes, in the sense that the tools still live in my personal repos. I've been updating them all for more general use and have documented how someone would use them on the ufs-weather wiki page. But exactly how and in what form they should be added to ufs-utils has not really been resolved.

@edwardhartnett
Copy link
Collaborator

OK, to clarify how it would happen:

  • We (the NCEPLIBS team) will do the CMake changes.
  • Code must be documented in Doxygen style. We can help - it's straigtforward.
  • All code must include automated tests. We will help you with that, but we will need some (small) sample data files, the commands to process them, and the expected output.

Let us know when you have determined which tools you would like to promote to UFS_UTILS.

@DeniseWorthen
Copy link
Contributor Author

At this point, there is a single Fortran code that is used. The remainder of the tools are either NCL scripts or shell scripts.

The real stumbling block for me has been the automated aspect of it. Right now the tools require changes in multiple places to generate files for any individual resolution. The changes are for things like source and output directories or naming strings which indicate the resolution. There is also a cascade of "jobs" but the tools in general are not set up to loop over the various resolutions automatically when controlled by some top-level job script--the workflow aspect of it.

@edwardhartnett edwardhartnett added the enhancement New feature or request label Feb 5, 2021
@DeniseWorthen
Copy link
Contributor Author

DeniseWorthen commented Feb 16, 2021

As a first step, I have created a branch of the grid generation tool that uses a generated namelist and compiles and runs for the 1deg resolution. The branch is here: ufsutils. It isn't using CMake and I'm not sure how what else might be required for Doxygen.

To run it, edit the OUTDIR_PATH in run_test.sh to a directory you have write permission for. It should generate the namelist (grid.nml), compile and run the code. The expected output are 3 files called tripole.mx100.nc,grid_cice_NEMS_mx100.nc, and kmtu_cice_NEMS_mx100.nc in specified output directory.

The tripole.mx100.nc file is used to generate regrid weights in WeightGen that are used for IC interpolation, Post and generating the mapped ocean mask for the coupled file. The two cice files are used at run-time to specify the CICE6 grid and land mask for the coupled model.

The additional configurations can be run by adding additional information in the run_test.sh (I've commented out the generation of the 1/4 deg grid).

Let me know what the next steps might be.

@GeorgeGayno-NOAA
Copy link
Collaborator

@DeniseWorthen What is this issue? Can we close it? Or rename it?

@DeniseWorthen
Copy link
Contributor Author

@GeorgeGayno-NOAA This was the original issue I created that was meant to bring the required functionality to ufs-utils. As you can see, it is more than a year old. I can edit the title since at this point, what needs to be added is a single fortran code and associated script.

@DeniseWorthen DeniseWorthen changed the title tripole tools need to be integrated to ufs_utils Code and script to create required fix files for coupled model needs to be incorporated into ufs-utils. Dec 7, 2021
@GeorgeGayno-NOAA
Copy link
Collaborator

@DeniseWorthen I would link to Jun's notes (https://docs.google.com/document/d/13ui4P_vE2ejVn1fsMnRdoHgjaUf8d5u_-_S4nOvcWOA/edit?usp=sharing) in the description section at the top:

@MinsukJi-NOAA
Copy link
Contributor

@GeorgeGayno-NOAA In order to successfully compile, ESMF 8.2.0 had to be used instead of ESMF 8.1.0: https://github.com/MinsukJi-NOAA/UFS_UTILS/blob/feature/cpld_gridgen2/modulefiles/build.hera.intel#L32. Do you think this will be an issue for other utilities?

@DeniseWorthen
Copy link
Contributor Author

The newer esmf is required because of a simple fix Gerhard made to access ESMF_RegridWeightGen via use ESMF. Without the fix, a use ESMF_RegridWeightGenMod is required in the main routine.

@GeorgeGayno-NOAA
Copy link
Collaborator

@GeorgeGayno-NOAA In order to successfully compile, ESMF 8.2.0 had to be used instead of ESMF 8.1.0: https://github.com/MinsukJi-NOAA/UFS_UTILS/blob/feature/cpld_gridgen2/modulefiles/build.hera.intel#L32. Do you think this will be an issue for other utilities?

Don't know. Our unit and consistency tests will tell us of any problems.

@MinsukJi-NOAA
Copy link
Contributor

@GeorgeGayno-NOAA
The following are the results of consistency tests on Hera with ESMF 8.2.0:
chgres_cube

[Minsuk.Ji@hfe09 chgres_cube]$ cat summary.log 
consistency.log01:<<< C96 FV3 RESTART TEST FAILED. >>>
consistency.log02:<<< C192 FV3 HISTORY TEST FAILED. >>>
consistency.log03:<<< C96 FV3 GAUSSIAN NEMSIO TEST FAILED. >>>
consistency.log04:<<< C96 GFS SIGIO TEST FAILED. >>>
consistency.log05:<<< C96 GFS GAUSSIAN NEMSIO TEST FAILED. >>>
consistency.log06:<<< C96 REGIONAL TEST PASSED. >>>
consistency.log07:<<< C96 FV3 GAUSSIAN NETCDF TEST FAILED. >>>
consistency.log08:<<< C192 GFS GRIB2 TEST FAILED. >>>
consistency.log09:<<< 25-KM CONUS GFS GRIB2 TEST PASSED. >>>
consistency.log10:<<< 3-km CONUS HRRR W/ GFS PHYSICS GRIB2 TEST FAILED. >>>
consistency.log11:<<< 3-km CONUS HRRR W/ GSD PHYSICS AND SFC FROM FILE GRIB2 TEST FAILED. >>>
consistency.log12:<<< 13-KM CONUS NAM GRIB2 TEST PASSED. >>>
consistency.log13:<<< 13-km CONUS RAP W/ GSD PHYSICS AND SFC FROM FILE GRIB2 TEST PASSED. >>>
consistency.log14:<<< 13-KM NA GFS NCEI GRIB2 TEST PASSED. >>>
consistency.log15:<<< C96 FV3 GAUSSIAN NETCDF2WAM TEST FAILED. >>>
consistency.log16:<<< 25-KM CONUS GFS PGRIB2+BGRIB2 TEST PASSED. >>>

grid_gen

cat summary.log
<<< C96 UNIFORM TEST PASSED. >>>
<<< C96 VIIRS VEGT TEST PASSED. >>>
<<< GFDL REGIONAL TEST PASSED. >>>
<<< ESG REGIONAL TEST PASSED. >>>
<<< REGIONAL GSL GWD TEST PASSED. >>>
  1. How do we go about creating new baselines? Is creating new baselines sufficient to switch to ESMF 8.2.0?
  2. How can the unit tests be run?

@GeorgeGayno-NOAA
Copy link
Collaborator

@GeorgeGayno-NOAA The following are the results of consistency tests on Hera with ESMF 8.2.0: chgres_cube

[Minsuk.Ji@hfe09 chgres_cube]$ cat summary.log 
consistency.log01:<<< C96 FV3 RESTART TEST FAILED. >>>
consistency.log02:<<< C192 FV3 HISTORY TEST FAILED. >>>
consistency.log03:<<< C96 FV3 GAUSSIAN NEMSIO TEST FAILED. >>>
consistency.log04:<<< C96 GFS SIGIO TEST FAILED. >>>
consistency.log05:<<< C96 GFS GAUSSIAN NEMSIO TEST FAILED. >>>
consistency.log06:<<< C96 REGIONAL TEST PASSED. >>>
consistency.log07:<<< C96 FV3 GAUSSIAN NETCDF TEST FAILED. >>>
consistency.log08:<<< C192 GFS GRIB2 TEST FAILED. >>>
consistency.log09:<<< 25-KM CONUS GFS GRIB2 TEST PASSED. >>>
consistency.log10:<<< 3-km CONUS HRRR W/ GFS PHYSICS GRIB2 TEST FAILED. >>>
consistency.log11:<<< 3-km CONUS HRRR W/ GSD PHYSICS AND SFC FROM FILE GRIB2 TEST FAILED. >>>
consistency.log12:<<< 13-KM CONUS NAM GRIB2 TEST PASSED. >>>
consistency.log13:<<< 13-km CONUS RAP W/ GSD PHYSICS AND SFC FROM FILE GRIB2 TEST PASSED. >>>
consistency.log14:<<< 13-KM NA GFS NCEI GRIB2 TEST PASSED. >>>
consistency.log15:<<< C96 FV3 GAUSSIAN NETCDF2WAM TEST FAILED. >>>
consistency.log16:<<< 25-KM CONUS GFS PGRIB2+BGRIB2 TEST PASSED. >>>

grid_gen

cat summary.log
<<< C96 UNIFORM TEST PASSED. >>>
<<< C96 VIIRS VEGT TEST PASSED. >>>
<<< GFDL REGIONAL TEST PASSED. >>>
<<< ESG REGIONAL TEST PASSED. >>>
<<< REGIONAL GSL GWD TEST PASSED. >>>
  1. How do we go about creating new baselines? Is creating new baselines sufficient to switch to ESMF 8.2.0?
  2. How can the unit tests be run?

I can create the new baselines.

@DeniseWorthen
Copy link
Contributor Author

George, my doxygen build branch fails the debug build action, saying that:

/home/runner/work/UFS_UTILS/UFS_UTILS/ufs_utils/sorc/cpld_gridgen.fd/topoedits.F90:159: error: argument 'fsrc' from the argument list of topoedits::apply_topoedits has multiple @param documentation sections 

This module contains two SRs, each of which has an input file name fsrc. How would I fix that?

@GeorgeGayno-NOAA
Copy link
Collaborator

George, my doxygen build branch fails the debug build action, saying that:

/home/runner/work/UFS_UTILS/UFS_UTILS/ufs_utils/sorc/cpld_gridgen.fd/topoedits.F90:159: error: argument 'fsrc' from the argument list of topoedits::apply_topoedits has multiple @param documentation sections 

This module contains two SRs, each of which has an input file name fsrc. How would I fix that?

@DeniseWorthen This situation occurs in many of our chgres_cube modules. So I don't know why you are having problems. I am unable to reproduce the problem on Hera or WCOSS-Dell, unfortunately. One thing I noticed - your doxygen statements for routine apply_topoedits are placed after the subroutine declaration statement. Move them before that statement and see if that helps.

@DeniseWorthen
Copy link
Contributor Author

Thanks @GeorgeGayno-NOAA. I'll try that. I'll fix the same issue in other SRs too (first doxygen statements, then subroutine statement).

Another question---do I really need to document each SR w/ me as the author? I followed the chgres example but in that case maybe you do have other authors?

@GeorgeGayno-NOAA
Copy link
Collaborator

Thanks @GeorgeGayno-NOAA. I'll try that. I'll fix the same issue in other SRs too (first doxygen statements, then subroutine statement).

Another question---do I really need to document each SR w/ me as the author? I followed the chgres example but in that case maybe you do have other authors?

We want an author for each routine. If you don't know the author, use a point-of-contact as the author. If there are multiple authors, name all of them.

@DeniseWorthen
Copy link
Contributor Author

Your fix for placing the doxygen block before the subroutine statement worked. I'm now able to build the docs and leave the WARN_AS_ERROR set YES. I'll bring the doxygenated code back to the main branch I'm working from and then start thinking about the unit test.

@GeorgeGayno-NOAA
Copy link
Collaborator

Your fix for placing the doxygen block before the subroutine statement worked. I'm now able to build the docs and leave the WARN_AS_ERROR set YES. I'll bring the doxygenated code back to the main branch I'm working from and then start thinking about the unit test.

Great. That was just a guess.

@DeniseWorthen
Copy link
Contributor Author

OK thanks---I must be going blind.

@GeorgeGayno-NOAA
Copy link
Collaborator

I placed the baseline and fix data on Jet under the role account directory - /lfs4/HFIP/hfv3gfs/emc.nemspara/role.ufsutils/ufs_utils/reg_tests/cpld_gridgen

@MinsukJi-NOAA
Copy link
Contributor

I see that Jet also requires ulimit -s unlimited. Otherwise, same errors seen on Orion result.

@MinsukJi-NOAA
Copy link
Contributor

MinsukJi-NOAA commented Apr 23, 2022

Regression tests are working for all 3 platforms: Hera, Orion and Jet.

@GeorgeGayno-NOAA I am guessing the Hera baselines were copied to Orion and Jet. Orion is nccmp reproducible, whereas Jet is not. Therefore, Jet baselines need to be generated by:

$ cd UFS_UTILS/reg_tests/cpld_gridgen
$ ./rt.sh -c

Then copying ../../../CPLD_GRIDGEN/BASELINE to /lfs4/HFIP/hfv3gfs/emc.nemspara/role.ufsutils/ufs_utils/reg_tests/cpld_gridgen/baseline_data

@GeorgeGayno-NOAA
Copy link
Collaborator

Regression tests are working for all 3 platforms: Hera, Orion and Jet.

@GeorgeGayno-NOAA I am guessing the Hera baselines were copied to Orion and Jet. Orion is nccmp reproducible, whereas Jet is not. Therefore, Jet baselines need to be generated by:

$ cd UFS_UTILS/reg_tests/cpld_gridgen
$ ./rt.sh -c

Then copying ../../../CPLD_GRIDGEN/BASELINE to /lfs4/HFIP/hfv3gfs/emc.nemspara/role.ufsutils/ufs_utils/reg_tests/cpld_gridgen/baseline_data

Done!

@GeorgeGayno-NOAA
Copy link
Collaborator

Suggestion: can you make the compilation of the repository optional?

@MinsukJi-NOAA
Copy link
Contributor

Suggestion: can you make the compilation of the repository optional?

Done.

@MinsukJi-NOAA
Copy link
Contributor

https://github.com/MinsukJi-NOAA/UFS_UTILS/tree/feature/cpld_gridgen2 has been updated to the latest NOAA-EMC/UFS_UTILS/tree/develop.

A PR can be made to NOAA-EMC/UFS_UTILS once @DeniseWorthen's unit test changes are merged in.

@DeniseWorthen
Copy link
Contributor Author

I'll merge your changes, Thanks so much!

@GeorgeGayno-NOAA
Copy link
Collaborator

@MinsukJi-NOAA I tried your branch (46ea554) on Orion. The script failed at the 'ulimit -s unlimited' step. For some reason, Orion does not let me set the ulimit from the interactive nodes. If I remove that line from rt.sh, everything worked. Did you need to use 'ulimited' on Orion? It may not be needed.

For some regression tests, using ulimited is required. I got around this problem by setting the ulimit in the child scripts. For example:

diff --git a/reg_tests/cpld_gridgen/rt.sh b/reg_tests/cpld_gridgen/rt.sh
index ee18017..d99c5e4 100755
--- a/reg_tests/cpld_gridgen/rt.sh
+++ b/reg_tests/cpld_gridgen/rt.sh
@@ -128,7 +128,8 @@ elif [[ $target = orion ]]; then
   BASELINE_ROOT=/work/noaa/nems/role-nems/ufs_utils/reg_tests/cpld_gridgen/baseline_data
   ACCOUNT=${ACCOUNT:-nems}
   QUEUE=${QUEUE:-batch}
-  ulimit -s unlimited
+# ulimit -s unlimited
+  export machine=orion
   SBATCH_COMMAND="srun -n 1 ./cpld_gridgen.sh"
 elif [[ $target = jet ]]; then
   STMP=/lfs4/HFIP/h-nems/

diff --git a/ush/cpld_gridgen.sh b/ush/cpld_gridgen.sh
index d528aec..cadd2d8 100755
--- a/ush/cpld_gridgen.sh
+++ b/ush/cpld_gridgen.sh
@@ -25,6 +25,10 @@ export DO_POSTWGTS=.false.
 export OUTDIR_PATH=${OUTDIR_PATH:-/scratch2/NCEPDEV/climate/Denise.Worthen/grids-20220116}
 export MOSAICDIR_PATH=${MOSAICDIR_PATH:-$PATHTR/fix/fix_fv3_gmted2010}

+if [ "$machine" == "orion" ]; then
+  ulimit -s unlimited
+fi
+
 if [ $RESNAME = 400 ]; then

But I would understand if you don't want to add a ulimit command to your 'ush' script.

@MinsukJi-NOAA
Copy link
Contributor

@GeorgeGayno-NOAA Do you think this unlimited issues is specific to your account? I just ran the regression test successfully on Orion.

@GeorgeGayno-NOAA
Copy link
Collaborator

@GeorgeGayno-NOAA Do you think this unlimited issues is specific to your account? I just ran the regression test successfully on Orion.

I just tried running under our role account. It worked. So, there is something odd about my account. You don't need to make any changes.

@GeorgeGayno-NOAA
Copy link
Collaborator

All regression tests are run off the cron each day on supported machines using this driver script - https://github.com/ufs-community/UFS_UTILS/blob/develop/reg_tests/rt.sh. Other regression tests create a small 'summary.log' file at the very of its processing. This driver script searches for the existence of this 'summary.log' file to determine when a test has completed. An example of this file from the global_cycle test:

scratch2/NCEPDEV/stmp1/George.Gayno/UFS_UTILS/reg_tests/global_cycle $ more summary.log
consistency.log01:<<< C768 GLOBAL CYCLE TEST PASSED. >>>
consistency.log02:<<< C768 LANDINC SOILT CYCLE TEST PASSED. >>>
consistency.log03:<<< C768 LANDINC SNOW CYCLE TEST PASSED. >>>

We can discuss more at today's meeting.

@MinsukJi-NOAA
Copy link
Contributor

All regression tests are run off the cron each day on supported machines using this driver script - https://github.com/ufs-community/UFS_UTILS/blob/develop/reg_tests/rt.sh. Other regression tests create a small 'summary.log' file at the very of its processing. This driver script searches for the existence of this 'summary.log' file to determine when a test has completed. An example of this file from the global_cycle test:

scratch2/NCEPDEV/stmp1/George.Gayno/UFS_UTILS/reg_tests/global_cycle $ more summary.log
consistency.log01:<<< C768 GLOBAL CYCLE TEST PASSED. >>>
consistency.log02:<<< C768 LANDINC SOILT CYCLE TEST PASSED. >>>
consistency.log03:<<< C768 LANDINC SNOW CYCLE TEST PASSED. >>>

We can discuss more at today's meeting.

@GeorgeGayno-NOAA Is summary.log generated only when all tests pass? In other words, if one of the tests fails, summary.log does not get generated?

@GeorgeGayno-NOAA
Copy link
Collaborator

All regression tests are run off the cron each day on supported machines using this driver script - https://github.com/ufs-community/UFS_UTILS/blob/develop/reg_tests/rt.sh. Other regression tests create a small 'summary.log' file at the very of its processing. This driver script searches for the existence of this 'summary.log' file to determine when a test has completed. An example of this file from the global_cycle test:

scratch2/NCEPDEV/stmp1/George.Gayno/UFS_UTILS/reg_tests/global_cycle $ more summary.log
consistency.log01:<<< C768 GLOBAL CYCLE TEST PASSED. >>>
consistency.log02:<<< C768 LANDINC SOILT CYCLE TEST PASSED. >>>
consistency.log03:<<< C768 LANDINC SNOW CYCLE TEST PASSED. >>>

We can discuss more at today's meeting.

@GeorgeGayno-NOAA Is summary.log generated only when all tests pass? In other words, if one of the tests fails, summary.log does not get generated?

Always generate the summary log. List all tests whether they failed or passed.

GeorgeGayno-NOAA added a commit to DeniseWorthen/UFS_UTILS that referenced this issue May 9, 2022
GeorgeGayno-NOAA added a commit to DeniseWorthen/UFS_UTILS that referenced this issue May 9, 2022
GeorgeGayno-NOAA added a commit to DeniseWorthen/UFS_UTILS that referenced this issue May 9, 2022
GeorgeGayno-NOAA added a commit to DeniseWorthen/UFS_UTILS that referenced this issue May 9, 2022
GeorgeGayno-NOAA added a commit to DeniseWorthen/UFS_UTILS that referenced this issue May 9, 2022
GeorgeGayno-NOAA added a commit to DeniseWorthen/UFS_UTILS that referenced this issue May 9, 2022
GeorgeGayno-NOAA added a commit to DeniseWorthen/UFS_UTILS that referenced this issue May 9, 2022
GeorgeGayno-NOAA added a commit to DeniseWorthen/UFS_UTILS that referenced this issue May 10, 2022
GeorgeGayno-NOAA added a commit to DeniseWorthen/UFS_UTILS that referenced this issue May 11, 2022
GeorgeGayno-NOAA added a commit to DeniseWorthen/UFS_UTILS that referenced this issue May 16, 2022
GeorgeGayno-NOAA added a commit to DeniseWorthen/UFS_UTILS that referenced this issue May 16, 2022
GeorgeGayno-NOAA added a commit to DeniseWorthen/UFS_UTILS that referenced this issue May 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants