Skip to content

Commit

Permalink
feature/new_ip
Browse files Browse the repository at this point in the history
Updates to compile with the combined ip/ip2 library.

Issue ufs-community#242
  • Loading branch information
GeorgeGayno-NOAA committed Jan 27, 2021
1 parent 7760027 commit 5dd6340
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 127 deletions.
3 changes: 2 additions & 1 deletion modulefiles/build.hera.intel
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ module load hpc-impi/2018.0.4

module load bacio/2.4.1
module load g2/3.4.1
module load ip/3.3.3
#module load ip/3.3.3
setenv ip_ROOT /home/Kyle.Gerheiser/NCEPLIBS-ip2/build/install
module load nemsio/2.5.2
module load sp/2.3.3
module load w3emc/2.7.3
Expand Down
32 changes: 19 additions & 13 deletions sorc/emcsfc_snow2mdl.fd/snow2mdl.f
Original file line number Diff line number Diff line change
Expand Up @@ -175,15 +175,16 @@ subroutine interp
!$$$

use gdswzd_mod
use ipolates_mod

implicit none

integer :: i, j, ii, jj, ij
integer :: ijmdl2, istart, iend, imid, iii
integer, allocatable :: idum(:,:)
integer :: int_opt, ipopt(20)
integer :: int_opt, ipopt(20), ibi(1)
integer :: kgds_mdl_tmp(200)
integer :: no, ibo, iret, nret
integer :: no, ibo(1), iret, nret

logical*1, allocatable :: bitmap_mdl(:)

Expand Down Expand Up @@ -248,6 +249,7 @@ subroutine interp
NESDIS_IMS : if (use_nesdis) then

ipopt = 0
ibi = 1
if (nesdis_res < (0.5*resol_mdl)) then
print*,"- INTERPOLATE NH NESDIS/IMS DATA TO MODEL GRID USING BUDGET METHOD."
ipopt(1)=2 ! break model grid cell into 25 points.
Expand All @@ -274,9 +276,9 @@ subroutine interp
bitmap_mdl=.false. ! if interpolation routine can't find data
! at a point, this flag is false.
call ipolates(int_opt, ipopt, kgds_nesdis, kgds_mdl_tmp, &
call ipolates_grib1(int_opt, ipopt, kgds_nesdis, kgds_mdl_tmp, &
(inesdis*jnesdis), ijmdl, &
1, 1, bitmap_nesdis, snow_cvr_nesdis, &
1, ibi, bitmap_nesdis, snow_cvr_nesdis, &
no, lats_mdl, lons_mdl, ibo, bitmap_mdl, &
snow_cvr_mdl_1d, iret)
Expand All @@ -302,7 +304,7 @@ subroutine interp
if (lats_mdl(ij) <= lat_threshold) then
snow_cvr_mdl_1d(ij) = 0.0
else
call gdswzd(kgds_nesdis,-1,1,undefined_value,gridi,gridj, &
call gdswzd_grib1(kgds_nesdis,-1,1,undefined_value,gridi,gridj, &
lons_mdl(ij),lats_mdl(ij),nret)
if (nret /= 1) then
print*,"- WARNING: MODEL POINT OUTSIDE NESDIS/IMS GRID: ", ipts_mdl(ij), jpts_mdl(ij)
Expand Down Expand Up @@ -337,6 +339,7 @@ subroutine interp
!----------------------------------------------------------------------
ipopt = 0
ibi = 1
if (afwa_res < (0.5*resol_mdl)) then
print*,"- INTERPOLATE GLOBAL AFWA DATA TO MODEL GRID USING BUDGET METHOD."
ipopt(1)=-1 ! break model grid cell into 25 points.
Expand All @@ -361,9 +364,9 @@ subroutine interp
allocate (bitmap_mdl(ijmdl))
bitmap_mdl = .false.
call ipolates(int_opt, ipopt, kgds_afwa_global, kgds_mdl_tmp, &
call ipolates_grib1(int_opt, ipopt, kgds_afwa_global, kgds_mdl_tmp, &
(iafwa*jafwa), ijmdl, &
1, 1, bitmap_afwa_global, snow_dep_afwa_global, &
1, ibi, bitmap_afwa_global, snow_dep_afwa_global, &
no, lats_mdl, lons_mdl, ibo, bitmap_mdl, &
snow_dep_mdl_tmp, iret)
Expand Down Expand Up @@ -408,6 +411,7 @@ subroutine interp
!----------------------------------------------------------------------
ipopt = 0
ibi = 1
if (afwa_res < (0.5*resol_mdl)) then
print*,"- INTERPOLATE NH AFWA DATA TO MODEL GRID USING BUDGET METHOD."
ipopt(1)=-1 ! break model grid cell into 25 points.
Expand All @@ -432,9 +436,9 @@ subroutine interp
allocate (bitmap_mdl(ijmdl))
bitmap_mdl = .false.
call ipolates(int_opt, ipopt, kgds_afwa_nh, kgds_mdl_tmp, &
call ipolates_grib1(int_opt, ipopt, kgds_afwa_nh, kgds_mdl_tmp, &
(iafwa*jafwa), ijmdl, &
1, 1, bitmap_afwa_nh, snow_dep_afwa_nh, &
1, ibi, bitmap_afwa_nh, snow_dep_afwa_nh, &
no, lats_mdl, lons_mdl, ibo, bitmap_mdl, &
snow_dep_mdl_tmp, iret)
Expand Down Expand Up @@ -545,6 +549,7 @@ subroutine interp
AUTOSNOW : if (use_autosnow) then
ipopt = 0
ibi = 1
if (autosnow_res < (0.5*resol_mdl)) then
print*,"- INTERPOLATE AUTOSNOW DATA TO MODEL GRID USING BUDGET METHOD."
ipopt(1)=2 ! break model grid cell into 25 points.
Expand All @@ -571,9 +576,9 @@ subroutine interp
bitmap_mdl=.false. ! if interpolation routine can't find data
! at a point, this flag is false.

call ipolates(int_opt, ipopt, kgds_autosnow, kgds_mdl_tmp, &
call ipolates_grib1(int_opt, ipopt, kgds_autosnow, kgds_mdl_tmp, &
(iautosnow*jautosnow), ijmdl, &
1, 1, bitmap_autosnow, snow_cvr_autosnow, &
1, ibi, bitmap_autosnow, snow_cvr_autosnow, &
no, lats_mdl, lons_mdl, ibo, bitmap_mdl, &
snow_cvr_mdl_1d, iret)

Expand Down Expand Up @@ -618,6 +623,7 @@ subroutine interp
!----------------------------------------------------------------------

ipopt = 0
ibi = 1
if (afwa_res < (0.5*resol_mdl)) then
print*,"- INTERPOLATE SH AFWA DATA TO MODEL GRID USING BUDGET METHOD."
ipopt(1)=-1 ! break model grid cell into 25 points.
Expand All @@ -642,9 +648,9 @@ subroutine interp
allocate (bitmap_mdl(ijmdl))
bitmap_mdl = .false.

call ipolates(int_opt, ipopt, kgds_afwa_sh, kgds_mdl_tmp, &
call ipolates_grib1(int_opt, ipopt, kgds_afwa_sh, kgds_mdl_tmp, &
(iafwa*jafwa), ijmdl, &
1, 1, bitmap_afwa_sh, snow_dep_afwa_sh, &
1, ibi, bitmap_afwa_sh, snow_dep_afwa_sh, &
no, lats_mdl, lons_mdl, ibo, bitmap_mdl, &
snow_dep_mdl_tmp, iret)

Expand Down
10 changes: 6 additions & 4 deletions sorc/global_chgres.fd/chgres_utils.f90
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@
!! - ipolates() IREDELL'S POLATE FOR SCALAR FIELDS
!!
SUBROUTINE GL2ANY(IP,KM,G1,IM1,JM1,G2,IM2,JM2,RLON,RLAT)
use ipolates_mod
IMPLICIT NONE
INTEGER, INTENT(IN) :: IP, KM, IM1, JM1, IM2, JM2
REAL, INTENT(IN) :: G1(IM1,JM1,KM)
REAL, INTENT(IN) :: RLAT(IM2,JM2),RLON(IM2,JM2)
REAL, INTENT(INOUT) :: RLAT(IM2,JM2),RLON(IM2,JM2)
REAL, INTENT(OUT) :: G2(IM2,JM2,KM)
LOGICAL*1 :: L1(IM1,JM1,KM),L2(IM2,JM2,KM)
INTEGER :: IB1(KM),IB2(KM)
Expand All @@ -41,7 +42,7 @@ SUBROUTINE GL2ANY(IP,KM,G1,IM1,JM1,G2,IM2,JM2,RLON,RLAT)
KGDS1(3)=JM1
KGDS1(8)=NINT(-360000./IM1)
KGDS1(10)=JM1/2
CALL IPOLATES(IP,IPOPT,KGDS1,KGDS2,IM1*JM1,IM2*JM2,KM,IB1,L1,G1, &
CALL IPOLATES_GRIB1(IP,IPOPT,KGDS1,KGDS2,IM1*JM1,IM2*JM2,KM,IB1,L1,G1, &
NO,RLAT,RLON,IB2,L2,G2,IRET)
IF(IRET/=0)THEN
PRINT*,'FATAL ERROR IN ROUTINE GL2ANY, IRET: ', IRET
Expand Down Expand Up @@ -85,10 +86,11 @@ SUBROUTINE GL2ANYV(IP,KM,G1U,G1V,IM1,JM1,G2U,G2V,IM2,JM2,RLON,RLAT)
! LANGUAGE: FORTRAN 90
!
!C$$$
use ipolatev_mod
IMPLICIT NONE
INTEGER, INTENT(IN) :: IP, KM, IM1, JM1, IM2, JM2
REAL, INTENT(IN) :: G1U(IM1,JM1,KM), G1V(IM1,JM1,KM)
REAL, INTENT(IN) :: RLAT(IM2,JM2),RLON(IM2,JM2)
REAL, INTENT(INOUT) :: RLAT(IM2,JM2),RLON(IM2,JM2)
REAL, INTENT(OUT) :: G2U(IM2,JM2,KM), G2V(IM2,JM2,KM)
LOGICAL*1 :: L1(IM1,JM1,KM),L2(IM2,JM2,KM)
INTEGER :: IB1(KM),IB2(KM)
Expand All @@ -109,7 +111,7 @@ SUBROUTINE GL2ANYV(IP,KM,G1U,G1V,IM1,JM1,G2U,G2V,IM2,JM2,RLON,RLAT)
KGDS1(10)=JM1/2
CROT = 1.0 ! DONT ROTATE WINDS TO THE OUTPUT GRID.
SROT = 0.0 ! FV3 EXPECTS EARTH RELATIVE WINDS.
CALL IPOLATEV(IP,IPOPT,KGDS1,KGDS2,IM1*JM1,IM2*JM2,KM,IB1,L1,G1U, &
CALL IPOLATEV_GRIB1(IP,IPOPT,KGDS1,KGDS2,IM1*JM1,IM2*JM2,KM,IB1,L1,G1U, &
G1V,NO,RLAT,RLON,CROT,SROT,IB2,L2,G2U,G2V,IRET)
IF(IRET/=0)THEN
PRINT*,'FATAL ERROR IN ROUTINE GL2ANYV, IRET: ', IRET
Expand Down
3 changes: 2 additions & 1 deletion sorc/global_chgres.fd/nsst_chgres.f90
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ subroutine nsst_chgres(im_input, jm_input, &
data_input, mask_input, data_output, num_nsst_fields, &
kgds_output, rlat_output, rlon_output)

use ipolates_mod
implicit none

integer, intent(in) :: imo
Expand Down Expand Up @@ -178,7 +179,7 @@ subroutine nsst_chgres(im_input, jm_input, &
iret =0
ij_input =im_input*jm_input

call ipolates(ip,ipopt,kgds_input,kgds,ij_input,count_water,&
call ipolates_grib1(ip,ipopt,kgds_input,kgds,ij_input,count_water,&
num_nsst_fields, ibi, bitmap_input, data_input, &
count_water,rlat_water,rlon_water,ibo,bitmap_water, &
data_water,iret)
Expand Down
Loading

0 comments on commit 5dd6340

Please sign in to comment.