Skip to content

Commit

Permalink
add support for ip 5.x (incl. disusing sp when ip 5 is available (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderRichert-NOAA authored Oct 30, 2024
1 parent d61812b commit 02a4429
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 10 deletions.
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,11 @@ if(BUILD_POSTEXEC)
find_package(nemsio REQUIRED)
find_package(sigio REQUIRED)
endif()
find_package(sp REQUIRED)
find_package(sp QUIET)
find_package(ip 5.0 QUIET)
if((NOT ip_VERSION VERSION_GREATER_EQUAL 5.0) AND (NOT sp_FOUND))
message(SEND_ERROR "UPP requires sp or ip v5+.")
endif()
find_package(w3emc REQUIRED)
if(BUILD_WITH_WRFIO)
find_package(wrf_io REQUIRED)
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ Required NCEPLIBS packages:

- [NCEPLIBS-g2](https://github.com/NOAA-EMC/NCEPLIBS-g2)
- [NCEPLIBS-g2tmpl](https://github.com/NOAA-EMC/NCEPLIBS-g2tmpl)
- [NCEPLIBS-sp](https://github.com/NOAA-EMC/NCEPLIBS-sp)
- [NCEPLIBS-ip](https://github.com/NOAA-EMC/NCEPLIBS-ip)
- [NCEPLIBS-bacio](https://github.com/NOAA-EMC/NCEPLIBS-bacio)
- [NCEPLIBS-w3emc](https://github.com/NOAA-EMC/NCEPLIBS-w3emc)
Expand Down Expand Up @@ -135,4 +134,4 @@ States Government.

## UPP Terms of Use Notice

The UPP Terms of Use Notice is available at: https://github.com/NOAA-EMC/UPP/wiki/UPP-Terms-of-Use-Notice
The UPP Terms of Use Notice is available at: https://github.com/NOAA-EMC/UPP/wiki/UPP-Terms-of-Use-Notice
3 changes: 1 addition & 2 deletions ci/spack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ spack:
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
Expand Down
5 changes: 2 additions & 3 deletions doc/UserGuide/BuildingRunningTesting/BuildingUPP.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ the instructions in the :doc:`spack-stack User's Guide <spack-stack:index>`.
Common Modules
----------------

As of February 1, 2024, the UPP uses the following `common modules <https://github.com/NOAA-EMC/UPP/blob/develop/modulefiles/upp_common.lua>`__ from spack-stack:
As of October 2024, the UPP uses the following `common modules <https://github.com/NOAA-EMC/UPP/blob/develop/modulefiles/upp_common.lua>`__ from spack-stack:

.. code-block:: console
Expand All @@ -46,8 +46,7 @@ As of February 1, 2024, the UPP uses the following `common modules <https://gith
g2tmpl 1.10.2
parallelio 2.5.10
bacio 2.4.1
ip 4.3.0
sp 2.5.0
ip 5.0.0
crtm 2.4.0.1
w3emc 2.10.0
nemsio 2.5.4
Expand Down
1 change: 0 additions & 1 deletion modulefiles/upp_common.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ local ufs_modules = {
{["g2"] = "3.5.1" },
{["g2tmpl"] = "1.13.0" },
{["ip"] = "5.0.0" },
{["sp"] = "2.5.0" },
{["w3emc"] = "2.10.0" },
{["nemsio"] = "2.5.4" },
{["sigio"] = "2.3.2" },
Expand Down
10 changes: 9 additions & 1 deletion sorc/ncep_post.fd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,18 @@ endif()

if(BUILD_POSTEXEC)
add_executable(${EXENAME} ${EXE_SRC})
if(ip_FOUND)
set(sp_target ip::ip_4)
if(ip_VERSION VERSION_GREATER_EQUAL 5.1)
target_compile_definitions(${EXENAME} PRIVATE USE_SP_MOD=1)
endif()
else()
set(sp_target sp::sp_4)
endif()
target_link_libraries(${EXENAME} PRIVATE
${LIBNAME}
w3emc::w3emc_4
sp::sp_4)
${sp_target})
set_target_properties(${EXENAME} PROPERTIES LINKER_LANGUAGE Fortran)
if(IFI_FOUND)
target_link_libraries(${EXENAME} PRIVATE IFI)
Expand Down
18 changes: 18 additions & 0 deletions sorc/ncep_post.fd/GFSPOSTSIG.F
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ subroutine rtsig(lusig,head,k1,k2,kgds,ijo,levs,ntrac,jcap,lnt2,me, &
use sigio_module, only : sigio_intkind, sigio_head
use sigio_r_module, only : sigio_dati, sigio_rrdati
use physcons_post, only : con_omega, con_fvirt
#ifdef USE_SP_MOD
use sp_mod, only : sptezd, sptezm, sptezmv
#endif
use omp_lib
implicit none
integer(sigio_intkind),intent(in) :: lusig
Expand Down Expand Up @@ -131,7 +134,11 @@ subroutine rtsig(lusig,head,k1,k2,kgds,ijo,levs,ntrac,jcap,lnt2,me, &
endif
if (allocated(wrk)) deallocate(wrk)

#ifdef USE_SP_MOD
call sptezd(0,jcap,idrt,io,jo,trisca(1,k1+1),(/pmean/),px,py,1)
#else
call sptezd(0,jcap,idrt,io,jo,trisca(1,k1+1),pmean,px,py,1)
#endif
iret = 0

! if (k2 < k1) return
Expand Down Expand Up @@ -449,6 +456,9 @@ subroutine trssc(jcap,nc,km,ntrac,idvc,idvm,idsl,nvcoord,vcoord, &
cpi,idrt,lonb,latb,ijl,ijn,j1,j2,jc,chgq0, &
szs,sps,st,sd,sz,sq,gfszs,gfsps,gfsp,gfsdp, &
gfst,gfsu,gfsv,gfsq,gfsw)
#ifdef USE_SP_MOD
use sp_mod, only : sptran, sptranv
#endif
implicit none
integer,intent(in)::jcap,nc,km,ntrac,idvc,idvm,idsl,nvcoord,idrt,lonb,latb
integer,intent(in)::ijl,ijn,j1,j2,jc,chgq0
Expand Down Expand Up @@ -641,6 +651,9 @@ subroutine getomega(jcap,nc,km,idvc,idvm,idrt,idsl,nvcoord,vcoord, &
lonb,latb,ijn,j1,j2,jc,sd,sps,psi,ti,ui,vi,wi,pm,pd)
!!!!!
use sigio_module, only : sigio_modprd
#ifdef USE_SP_MOD
use sp_mod, only : sptran, sptrand
#endif
implicit none

integer,intent(in):: jcap,nc,km,idvc,idvm,idrt,idsl,nvcoord
Expand All @@ -660,8 +673,13 @@ subroutine getomega(jcap,nc,km,idvc,idvm,idrt,idsl,nvcoord,vcoord, &
ij=lonb2*(j2-j1+1)
in=1
is=1+lonb
#ifdef USE_SP_MOD
call sptrand(0,jcap,idrt,lonb,latb,1,1,1,lonb2,lonb2,nc,ijn, &
j1,j2,jc,sps,(/real(psmean,4)/),psx(in),psx(is),psy(in),psy(is),1)
#else
call sptrand(0,jcap,idrt,lonb,latb,1,1,1,lonb2,lonb2,nc,ijn, &
j1,j2,jc,sps,psmean,psx(in),psx(is),psy(in),psy(is),1)
#endif

call sptran(0,jcap,idrt,lonb,latb,km,1,1,lonb2,lonb2,nc,ijn, &
j1,j2,jc,sd,di(in,1),di(is,1),1)
Expand Down

0 comments on commit 02a4429

Please sign in to comment.