Skip to content

Commit

Permalink
Require specific package version in top-level CMakeLists.txt, rename…
Browse files Browse the repository at this point in the history
… EARTH_GRID_COMP to UFSDriver (#1239)

* Require specific package version in top-level CMakeLists.txt

* Rename EARTH_GRID_COMP to UFSDriver

* Update s4 support (#31)

* Updated S4 compiler versions #1223

* Single dt output (#30)
  • Loading branch information
DusanJovic-NOAA committed Jun 6, 2022
1 parent dc1316c commit 4376018
Show file tree
Hide file tree
Showing 17 changed files with 3,292 additions and 3,317 deletions.
17 changes: 9 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,23 +110,24 @@ find_package(MPI REQUIRED)
if(OPENMP)
find_package(OpenMP REQUIRED)
endif()
find_package(NetCDF REQUIRED C Fortran)
find_package(ESMF MODULE REQUIRED)

find_package(NetCDF 4.7.4 REQUIRED C Fortran)
find_package(ESMF 8.3.0 MODULE REQUIRED)
if(FMS)
find_package(FMS REQUIRED COMPONENTS R4 R8)
find_package(FMS 2022.01 REQUIRED COMPONENTS R4 R8)
if(32BIT)
add_library(fms ALIAS FMS::fms_r4)
else()
add_library(fms ALIAS FMS::fms_r8)
endif()
endif()
if(CMEPS)
find_package(PIO REQUIRED COMPONENTS C Fortran STATIC)
find_package(PIO 2.5.3 REQUIRED COMPONENTS C Fortran STATIC)
endif()

find_package(bacio REQUIRED)
find_package(sp REQUIRED)
find_package(w3nco REQUIRED)
find_package(bacio 2.4.0 REQUIRED)
find_package(sp 2.3.3 REQUIRED)
find_package(w3nco 2.4.0 REQUIRED)

# Configure Python
find_package(Python 3.6 REQUIRED COMPONENTS Interpreter)
Expand Down Expand Up @@ -208,7 +209,7 @@ endif()
###############################################################################
### UFS Library
###############################################################################
add_library(ufs driver/EARTH_GRID_COMP.F90)
add_library(ufs driver/UFSDriver.F90)
set_target_properties(ufs PROPERTIES Fortran_MODULE_DIRECTORY
${CMAKE_CURRENT_BINARY_DIR}/mod)
target_include_directories(ufs INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/mod>
Expand Down
2 changes: 1 addition & 1 deletion FV3
64 changes: 32 additions & 32 deletions driver/UFS.F90
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ PROGRAM UFS
USE ESMF
!
!-----------------------------------------------------------------------
!*** USE the EARTH gridded component module. Although it
!*** USE the UFSDriver module. Although it
!*** contains the calls to Register and the top level Initialize,
!*** Run, and Finalize, only the Register routine is public.
!-----------------------------------------------------------------------
!
USE module_EARTH_GRID_COMP
USE UFSDriver, only : UFSDriver_SS
!
!-----------------------------------------------------------------------
!
Expand All @@ -54,8 +54,9 @@ PROGRAM UFS
INTEGER :: MYPE & !<-- The MPI task ID
,NSECONDS_FCST & !<-- Length of forecast in seconds
,YY,MM,DD & !<-- Time variables for date
,HH,MNS,SEC & !<-- Time variables for time of day
,fhrot
,HH,MNS,SEC !<-- Time variables for time of day

REAL(ESMF_KIND_R8) :: fhrot !< forecast hour at restart time
!
REAL :: NHOURS_FCST !<-- Length of forecast in hours

Expand All @@ -71,7 +72,7 @@ PROGRAM UFS
! the computer CPU resource
! for the ESMF grid components.
!
TYPE(ESMF_GridComp) :: EARTH_GRID_COMP !<-- The EARTH gridded component.
TYPE(ESMF_GridComp) :: UFSDriverComp !<-- The UFS Driver gridded component.
!
TYPE(ESMF_Clock) :: CLOCK_MAIN !<-- The ESMF time management clock
!
Expand Down Expand Up @@ -158,33 +159,33 @@ PROGRAM UFS
! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!
!-----------------------------------------------------------------------
!*** Create the EARTH gridded component which will create and
!*** Create the UFS Driver gridded component which will create and
!*** control the ATM (atmoshpere), OCN (ocean), ICE (sea ice), etc.
!*** gridded components.
!-----------------------------------------------------------------------
!
! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
MESSAGE_CHECK="Create the EARTH Gridded Component"
MESSAGE_CHECK="Create the UFS Driver Gridded Component"
! CALL ESMF_LogWrite(MESSAGE_CHECK,ESMF_LOGMSG_INFO,rc=RC)
! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!
EARTH_GRID_COMP=ESMF_GridCompCreate(name ='EARTH Grid Comp' & !<-- EARTH component name
UFSDriverComp=ESMF_GridCompCreate(name ='UFS Driver Grid Comp' &
,rc = RC)
ESMF_ERR_ABORT(RC)
! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!
!-----------------------------------------------------------------------
!*** Register the EARTH gridded component's Initialize, Run and
!*** Register the UFS Driver gridded component's Initialize, Run and
!*** Finalize routines.
!-----------------------------------------------------------------------
!
! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
MESSAGE_CHECK="Register EARTH Gridded Component Init, Run, Finalize"
MESSAGE_CHECK="Register UFS Driver Gridded Component Init, Run, Finalize"
! CALL ESMF_LogWrite(MESSAGE_CHECK,ESMF_LOGMSG_INFO,rc=RC)
! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!
CALL ESMF_GridCompSetServices(EARTH_GRID_COMP & !<-- The EARTH component
,EARTH_REGISTER & !<-- User's subroutineName
CALL ESMF_GridCompSetServices(UFSDriverComp &
,UFSDriver_SS &
,rc=RC)
ESMF_ERR_ABORT(RC)
! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
Expand Down Expand Up @@ -344,19 +345,18 @@ PROGRAM UFS
!-----------------------------------------------------------------------
!*** Adjust the currTime of the main clock: CLOCK_MAIN
!*** if the fhrot is > 0
!*** This will correctly set the EARTH clocks in case of
!*** This will correctly set the UFS Driver clocks in case of
!*** Restart-From-History.
!-----------------------------------------------------------------------

CALL ESMF_ConfigGetAttribute(config = CF_MAIN &
,value = fhrot &
,label = 'fhrot:' &
,default = 0 &
CALL ESMF_ConfigGetAttribute(config = CF_MAIN &
,value = fhrot &
,label = 'fhrot:' &
,default = 0.0_ESMF_KIND_R8 &
,rc = RC)
ESMF_ERR_ABORT(RC)

if (fhrot > 0) then
CALL ESMF_TimeIntervalSet(restartOffset, h=fhrot, rc=RC)
CALL ESMF_TimeIntervalSet(restartOffset, h_r8=fhrot, rc=RC)
ESMF_ERR_ABORT(RC)
CURRTIME = STARTTIME + restartOffset
call ESMF_ClockSet(CLOCK_MAIN, currTime=CURRTIME, &
Expand All @@ -367,53 +367,53 @@ PROGRAM UFS
! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!
!-----------------------------------------------------------------------
!*** Execute the INITIALIZE step for the EARTH component.
!*** Execute the INITIALIZE step for the UFS Driver component.
!*** The Initialize routine that is called here as well as the
!*** Run and Finalize routines invoked below are those specified
!*** in the Register routine called in ESMF_GridCompSetServices above.
!-----------------------------------------------------------------------
!
! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
MESSAGE_CHECK="Execute the EARTH Component Initialize Step"
MESSAGE_CHECK="Execute the UFS Driver Component Initialize Step"
! CALL ESMF_LogWrite(MESSAGE_CHECK,ESMF_LOGMSG_INFO,rc=RC)
! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!
CALL ESMF_GridCompInitialize(gridcomp =EARTH_GRID_COMP & !<-- The EARTH component
,clock =CLOCK_MAIN & !<-- The ESMF clock
CALL ESMF_GridCompInitialize(gridcomp =UFSDriverComp &
,clock =CLOCK_MAIN &
,userRc =RC_USER &
,rc =RC)
ESMF_ERR_ABORT(RC)
ESMF_ERR_ABORT(RC_USER)
! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!
!-----------------------------------------------------------------------
!*** Execute the RUN step for the EARTH component.
!*** Execute the RUN step for the UFS Driver component.
!-----------------------------------------------------------------------
!
! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
MESSAGE_CHECK="Execute the EARTH Component Run Step"
MESSAGE_CHECK="Execute the UFS Driver Component Run Step"
! CALL ESMF_LogWrite(MESSAGE_CHECK,ESMF_LOGMSG_INFO,rc=RC)
! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!
CALL ESMF_GridCompRun(gridcomp =EARTH_GRID_COMP & !<-- The EARTH component
,clock =CLOCK_MAIN & !<-- The ESMF clock
CALL ESMF_GridCompRun(gridcomp =UFSDriverComp &
,clock =CLOCK_MAIN &
,userRc =RC_USER &
,rc =RC)
ESMF_ERR_ABORT(RC)
ESMF_ERR_ABORT(RC_USER)
! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!
!-----------------------------------------------------------------------
!*** Execute the FINALIZE step for the EARTH component.
!*** Execute the FINALIZE step for the UFS Driver component.
!-----------------------------------------------------------------------
!
! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
MESSAGE_CHECK="Execute the EARTH Component Finalize Step"
MESSAGE_CHECK="Execute the UFS Driver Component Finalize Step"
! CALL ESMF_LogWrite(MESSAGE_CHECK,ESMF_LOGMSG_INFO,rc=RC)
! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!
CALL ESMF_GridCompFinalize(gridcomp =EARTH_GRID_COMP & !<-- The EARTH component
,clock =CLOCK_MAIN & !<-- The Main ESMF clock
CALL ESMF_GridCompFinalize(gridcomp =UFSDriverComp &
,clock =CLOCK_MAIN &
,userRc =RC_USER &
,rc =RC)
ESMF_ERR_ABORT(RC)
Expand Down Expand Up @@ -451,7 +451,7 @@ PROGRAM UFS
! CALL ESMF_LogWrite(MESSAGE_CHECK, ESMF_LOGMSG_INFO, rc = RC)
! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!
CALL ESMF_GridCompDestroy(gridcomp=EARTH_GRID_COMP &
CALL ESMF_GridCompDestroy(gridcomp=UFSDriverComp &
,rc =RC)
ESMF_ERR_ABORT(RC)

Expand Down
Loading

0 comments on commit 4376018

Please sign in to comment.