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

wmesmf needs SCRIP/SCRIPNC CPP ifdefs added #506

Closed
JessicaMeixner-NOAA opened this issue Oct 24, 2021 · 3 comments · Fixed by #537
Closed

wmesmf needs SCRIP/SCRIPNC CPP ifdefs added #506

JessicaMeixner-NOAA opened this issue Oct 24, 2021 · 3 comments · Fixed by #537
Labels
bug Something isn't working

Comments

@JessicaMeixner-NOAA
Copy link
Collaborator

Describe the bug
wmesmf has recently had calls to SCRIP/SCRIPNC subroutines but the SCRIP/SCRIPNC switch files were not added. These calls need to be added behind the SCRIP/SCRIPNC switch file calls. Additionally if a check should be added to ensure the SCRIP/SCRIPNC switch is used to complete the new parts of wmesmf and abort otherwise. I believe these are the new features added for HAFS.

To Reproduce
Try to compile wmesmf without SCRIP/SCRIPNC flag.

Expected behavior
We should be able to compile wmesmf without SCRIP/SCIPNC switch - and/or we should add appropriate checks in the check switches routine in build_utils.sh.

FYI @uturuncoglu @aliabdolali @kgerheiser

@JessicaMeixner-NOAA
Copy link
Collaborator Author

JessicaMeixner-NOAA commented Oct 24, 2021

@uturuncoglu I can get the code to compile without the SCRIP switch by doing the following:

diff --git a/model/src/wmesmfmd.F90 b/model/src/wmesmfmd.F90
index 2fbdd91d..718423c5 100644
--- a/model/src/wmesmfmd.F90
+++ b/model/src/wmesmfmd.F90
@@ -166,7 +166,9 @@
       use W3SRC4MD, only: W3SPR4
 #endif
       use W3IOGOMD, only: W3OUTG
+#ifdef W3_SCRIP
       use WMSCRPMD, only: get_scrip_info_structured 
+#endif
 !/
 !/ Specify default data typing
 !/
@@ -3130,6 +3132,7 @@
         staggerLoc=ESMF_STAGGERLOC_CORNER, rc=rc )
       if (ESMF_LogFoundError(rc, PASSTHRU)) return
 
+#ifdef W3_SCRIP
       ! Calculate grid coordinates with help of SCRIP module
       ! It does not return coordinates of top-most row and 
       ! right-most column but ESMF expects it. So, top-most row 
@@ -3137,6 +3140,7 @@
       call get_scrip_info_structured(impGridID, &
         xgrd_center, ygrd_center, xgrd_corner, ygrd_corner, &
         land_sea, grid_dims, grid_size, grid_corners, grid_rank)
+#endif
 
       ! Add corner coordinates 
       if ( impGridIsLocal ) then
@@ -3610,6 +3614,7 @@
         staggerLoc=ESMF_STAGGERLOC_CORNER, rc=rc )
       if (ESMF_LogFoundError(rc, PASSTHRU)) return
 
+#ifdef W3_SCRIP
       ! Calculate grid coordinates with help of SCRIP module
       ! It does not return coordinates of top-most row and 
       ! right-most column but ESMF expects it. So, top-most row 
@@ -3617,6 +3622,7 @@
       call get_scrip_info_structured(expGridID, &
         xgrd_center, ygrd_center, xgrd_corner, ygrd_corner, &
         land_sea, grid_dims, grid_size, grid_corners, grid_rank)
+#endif 
 
       ! Add corner coordinates 
       if ( impGridIsLocal ) then


However, going back to 2b4b287 it seems like we should maybe expand where we put the ifdefs for SCRIP around the whole section of code that adds the corner points? And then maybe add a check somewhere else that if med_present=true, then we add a check to make sure you are using the SCRIP, otherwise, exit? Or alternatively, if you use wmesmf, we have now required that SCRIP be used, and therefor add that check in the build and leave the SCRIP flags as they are here in the smaller section of the code. What are your thoughts?

@uturuncoglu
Copy link
Contributor

@JessicaMeixner-NOAA if I remember correctly we were protecting these regions with med_present=true in the initial implementation but I am not fully sure. I am not sure the latest situation about global application testing through CMEPS but we might consider to add corner coordinates to the grid in all the cases. So, you could get rid of SCRIP specific CPP flags.

@JessicaMeixner-NOAA
Copy link
Collaborator Author

Based on your documentation and the code itself, the calling of scrip and adding the corner points is done regardless of the med_present=true flag. See: https://github.com/NOAA-EMC/WW3/blob/develop/model/src/wmesmfmd.F90#L3126-L3199 therefore I think we're in the situation where we are requiring SCRIP in any situation when running structured grid wmesmf, therefore we need to add the appropriate logic to check for this (to catch errors before people compile without the SCRIP switch selected and fail) and appropriately state that SCRIP is required. Otherwise, we could try to comment out this section of code and see if we can run w/out scrip. We've always run with SCRIP in both regional and global cases so we never ran into this issue before. I don't know if the unstructured application uses SCRIP - @aliabdolali do you know? If unstructured doesn't need SCRIP I don't think we want to avoid requiring it at build. Regardless, I think we need to add not get rid of SCRIP specific CPP flags.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants