Skip to content

Commit

Permalink
MERRA2 3 hourly forcing passed compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
AnningCheng-NOAA committed Nov 26, 2024
1 parent 002a886 commit 588d06b
Show file tree
Hide file tree
Showing 6 changed files with 633 additions and 30 deletions.
40 changes: 29 additions & 11 deletions physics/Interstitials/UFS_SCM_NEPTUNE/GFS_phys_time_vary.fv3.F90
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ module GFS_phys_time_vary

use aerclm_def, only : aerin, aer_pres, ntrcaer, ntrcaerm, iamin, iamax, jamin, jamax
use aerinterp, only : read_aerdata, setindxaer, aerinterpol, read_aerdataf
use aerinterp, only : read_aerdata_dl, aerinterpol_dl, read_aerdataf_dl

use iccn_def, only : ciplin, ccnin, ci_pres
use iccninterp, only : read_cidata, setindxci, ciinterpol
Expand Down Expand Up @@ -80,7 +81,7 @@ end subroutine copy_error
!>\section gen_GFS_phys_time_vary_init GFS_phys_time_vary_init General Algorithm
!> @{
subroutine GFS_phys_time_vary_init ( &
me, master, ntoz, h2o_phys, iaerclm, iccn, iaermdl, iflip, im, levs, &
me, master, ntoz, h2o_phys, iaerclm, iaermdl, iccn, iflip, im, levs, &
nx, ny, idate, xlat_d, xlon_d, &
jindx1_o3, jindx2_o3, ddy_o3, jindx1_h, jindx2_h, ddy_h, h2opl,fhour, &
jindx1_aer, jindx2_aer, ddy_aer, iindx1_aer, iindx2_aer, ddx_aer, aer_nm, &
Expand Down Expand Up @@ -227,7 +228,12 @@ subroutine GFS_phys_time_vary_init (
ntrcaer = ntrcaerm
myerrflg = 0
myerrmsg = 'read_aerdata failed without a message'
call read_aerdata (me,master,iflip,idate,myerrmsg,myerrflg)
if(iaermdl == 1) then
call read_aerdata (me,master,iflip,idate,myerrmsg,myerrflg)
elseif (iaermdl == 6) then
call read_aerdata_dl(me,master,iflip, &
idate,fhour, myerrmsg,myerrflg)
end if
call copy_error(myerrmsg, myerrflg, errmsg, errflg)
else if(iaermdl ==2 ) then
do ix=1,ntrcaerm
Expand Down Expand Up @@ -351,7 +357,11 @@ subroutine GFS_phys_time_vary_init (

if (iaerclm) then
! This call is outside the OpenMP section, so it should access errmsg & errflg directly.
call read_aerdataf (me, master, iflip, idate, fhour, errmsg, errflg)
if(iaermdl==1) then
call read_aerdataf (me, master, iflip, idate, fhour, errmsg, errflg)
elseif (iaermdl==6) then
call read_aerdataf_dl (me, master, iflip, idate, fhour, errmsg, errflg)
end if
! If it is moved to an OpenMP section, it must use myerrmsg, myerrflg, and copy_error.
if (errflg/=0) return
end if
Expand Down Expand Up @@ -703,7 +713,7 @@ end subroutine GFS_phys_time_vary_init
!> @{
subroutine GFS_phys_time_vary_timestep_init ( &
me, master, cnx, cny, isc, jsc, nrcm, im, levs, kdt, idate, nsswr, fhswr, lsswr, fhour, &
imfdeepcnv, cal_pre, random_clds, nscyc, ntoz, h2o_phys, iaerclm, iccn, clstp, &
imfdeepcnv, cal_pre, random_clds, nscyc, ntoz, h2o_phys, iaerclm, iaermdl, iccn, clstp, &
jindx1_o3, jindx2_o3, ddy_o3, ozpl, jindx1_h, jindx2_h, ddy_h, h2opl, iflip, &
jindx1_aer, jindx2_aer, ddy_aer, iindx1_aer, iindx2_aer, ddx_aer, aer_nm, &
jindx1_ci, jindx2_ci, ddy_ci, iindx1_ci, iindx2_ci, ddx_ci, in_nm, ccn_nm, fn_nml, &
Expand All @@ -719,7 +729,7 @@ subroutine GFS_phys_time_vary_timestep_init (

! Interface variables
integer, intent(in) :: me, master, cnx, cny, isc, jsc, nrcm, im, levs, kdt, &
nsswr, imfdeepcnv, iccn, nscyc, ntoz, iflip
nsswr, imfdeepcnv, iccn, nscyc, ntoz, iflip, iaermdl
integer, intent(in) :: idate(:)
real(kind_phys), intent(in) :: fhswr, fhour
logical, intent(in) :: lsswr, cal_pre, random_clds, h2o_phys, iaerclm
Expand Down Expand Up @@ -786,7 +796,7 @@ subroutine GFS_phys_time_vary_timestep_init (

!$OMP parallel num_threads(nthrds) default(none) &
!$OMP shared(kdt,nsswr,lsswr,clstp,imfdeepcnv,cal_pre,random_clds) &
!$OMP shared(fhswr,fhour,seed0,cnx,cny,nrcm,wrk,rannie,rndval) &
!$OMP shared(fhswr,fhour,seed0,cnx,cny,nrcm,wrk,rannie,rndval, iaermdl) &
!$OMP shared(rann,im,isc,jsc,imap,jmap,ntoz,me,idate,jindx1_o3,jindx2_o3) &
!$OMP shared(ozpl,ddy_o3,h2o_phys,jindx1_h,jindx2_h,h2opl,ddy_h,iaerclm,master) &
!$OMP shared(levs,prsl,iccn,jindx1_ci,jindx2_ci,ddy_ci,iindx1_ci,iindx2_ci) &
Expand Down Expand Up @@ -904,11 +914,19 @@ subroutine GFS_phys_time_vary_timestep_init (
if (iaerclm) then
! aerinterpol is using threading inside, don't
! move into OpenMP parallel section above
call aerinterpol (me, master, nthrds, im, idate, &
fhour, iflip, jindx1_aer, jindx2_aer, &
ddy_aer, iindx1_aer, &
iindx2_aer, ddx_aer, &
levs, prsl, aer_nm, errmsg, errflg)
if (iaermdl==1) then
call aerinterpol (me, master, nthrds, im, idate, &
fhour, iflip, jindx1_aer, jindx2_aer, &
ddy_aer, iindx1_aer, &
iindx2_aer, ddx_aer, &
levs, prsl, aer_nm, errmsg, errflg)
else if (iaermdl==6) then
call aerinterpol_dl (me, master, nthrds, im, idate, &
fhour, iflip, jindx1_aer, jindx2_aer, &
ddy_aer, iindx1_aer, &
iindx2_aer, ddx_aer, &
levs, prsl, aer_nm, errmsg, errflg)
endif
if(errflg /= 0) then
return
endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1238,6 +1238,13 @@
dimensions = ()
type = logical
intent = in
[iaermdl]
standard_name = control_for_aerosol_radiation_scheme
long_name = control of aerosol scheme in radiation
units = 1
dimensions = ()
type = integer
intent = in
[iccn]
standard_name = control_for_ice_cloud_condensation_nuclei_forcing
long_name = flag for IN and CCN forcing for morrison gettelman microphysics
Expand Down
40 changes: 28 additions & 12 deletions physics/Interstitials/UFS_SCM_NEPTUNE/GFS_phys_time_vary.scm.F90
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ module GFS_phys_time_vary

use aerclm_def, only : aerin, aer_pres, ntrcaer, ntrcaerm, iamin, iamax, jamin, jamax
use aerinterp, only : read_aerdata, setindxaer, aerinterpol, read_aerdataf
use aerinterp, only : read_aerdata_dl, aerinterpol_dl, read_aerdataf_dl

use iccn_def, only : ciplin, ccnin, ci_pres
use iccninterp, only : read_cidata, setindxci, ciinterpol
Expand Down Expand Up @@ -58,7 +59,7 @@ module GFS_phys_time_vary
!>\section gen_GFS_phys_time_vary_init GFS_phys_time_vary_init General Algorithm
!! @{
subroutine GFS_phys_time_vary_init ( &
me, master, ntoz, h2o_phys, iaerclm, iccn, iflip, im, nx, ny, idate, xlat_d, xlon_d, &
me, master, ntoz, h2o_phys, iaerclm,iaermdl, iccn, iflip, im, nx, ny, idate, xlat_d, xlon_d, &
jindx1_o3, jindx2_o3, ddy_o3, ozphys, h2ophys, jindx1_h, jindx2_h, ddy_h, h2opl,fhour, &
jindx1_aer, jindx2_aer, ddy_aer, iindx1_aer, iindx2_aer, ddx_aer, aer_nm, &
jindx1_ci, jindx2_ci, ddy_ci, iindx1_ci, iindx2_ci, ddx_ci, imap, jmap, &
Expand All @@ -76,7 +77,7 @@ subroutine GFS_phys_time_vary_init (
implicit none

! Interface variables
integer, intent(in) :: me, master, ntoz, iccn, iflip, im, nx, ny
integer, intent(in) :: me, master, ntoz, iccn, iflip, im, nx, ny, iaermdl
logical, intent(in) :: h2o_phys, iaerclm, lsm_cold_start
integer, intent(in) :: idate(:)
real(kind_phys), intent(in) :: fhour
Expand Down Expand Up @@ -203,7 +204,11 @@ subroutine GFS_phys_time_vary_init (
! If iaerclm is .true., then ntrcaer == ntrcaerm
ntrcaer = size(aer_nm, dim=3)
! Read aerosol climatology
call read_aerdata (me,master,iflip,idate,errmsg,errflg)
if(iaermdl==1) then
call read_aerdata (me,master,iflip,idate,errmsg,errflg)
elseif(iaermdl==6) then
call read_aerdata_dl (me,master,iflip,idate,errmsg,errflg)
end if
endif
else
! Update the value of ntrcaer in aerclm_def with the value defined
Expand Down Expand Up @@ -301,9 +306,12 @@ subroutine GFS_phys_time_vary_init (
endif

if (errflg/=0) return

if (iaerclm) then
call read_aerdataf (me, master, iflip, idate, fhour, errmsg, errflg)
if (iaermdl==1) then
call read_aerdataf (me, master, iflip, idate, fhour, errmsg, errflg)
elseif (iaermdl==6) then
call read_aerdataf_dl (me, master, iflip, idate, fhour, errmsg, errflg)
end if
if (errflg/=0) return
end if

Expand Down Expand Up @@ -613,7 +621,7 @@ end subroutine GFS_phys_time_vary_init
!! @{
subroutine GFS_phys_time_vary_timestep_init ( &
me, master, cnx, cny, isc, jsc, nrcm, im, levs, kdt, idate, nsswr, fhswr, lsswr, fhour, &
imfdeepcnv, cal_pre, random_clds, ozphys, h2ophys, ntoz, h2o_phys, iaerclm, iccn, clstp, &
imfdeepcnv, cal_pre, random_clds, ozphys, h2ophys, ntoz, h2o_phys, iaerclm, iaermdl, iccn, clstp, &
jindx1_o3, jindx2_o3, ddy_o3, ozpl, jindx1_h, jindx2_h, ddy_h, h2opl, iflip, &
jindx1_aer, jindx2_aer, ddy_aer, iindx1_aer, iindx2_aer, ddx_aer, aer_nm, &
jindx1_ci, jindx2_ci, ddy_ci, iindx1_ci, iindx2_ci, ddx_ci, in_nm, ccn_nm, &
Expand All @@ -624,7 +632,7 @@ subroutine GFS_phys_time_vary_timestep_init (

! Interface variables
integer, intent(in) :: me, master, cnx, cny, isc, jsc, nrcm, im, levs, kdt, &
nsswr, imfdeepcnv, iccn, ntoz, iflip
nsswr, imfdeepcnv, iccn, ntoz, iflip, iaermdl
integer, intent(in) :: idate(:)
real(kind_phys), intent(in) :: fhswr, fhour
logical, intent(in) :: lsswr, cal_pre, random_clds, h2o_phys, iaerclm
Expand Down Expand Up @@ -776,11 +784,19 @@ subroutine GFS_phys_time_vary_timestep_init (
if (iaerclm) then
! aerinterpol is using threading inside, don't
! move into OpenMP parallel section above
call aerinterpol (me, master, nthrds, im, idate, &
fhour, iflip, jindx1_aer, jindx2_aer, &
ddy_aer, iindx1_aer, &
iindx2_aer, ddx_aer, &
levs, prsl, aer_nm)
if (iaermdl==1) then
call aerinterpol (me, master, nthrds, im, idate, &
fhour, iflip, jindx1_aer, jindx2_aer, &
ddy_aer, iindx1_aer, &
iindx2_aer, ddx_aer, &
levs, prsl, aer_nm)
elseif (iaermdl==6) then
call aerinterpol_dl (me, master, nthrds, im, idate, &
fhour, iflip, jindx1_aer, jindx2_aer, &
ddy_aer, iindx1_aer, &
iindx2_aer, ddx_aer, &
levs, prsl, aer_nm)
endif
endif

! Not needed for SCM:
Expand Down
14 changes: 14 additions & 0 deletions physics/Interstitials/UFS_SCM_NEPTUNE/GFS_phys_time_vary.scm.meta
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@
dimensions = ()
type = logical
intent = in
[iaermdl]
standard_name = control_for_aerosol_radiation_scheme
long_name = control of aerosol scheme in radiation
units = 1
dimensions = ()
type = integer
intent = in
[iccn]
standard_name = control_for_ice_cloud_condensation_nuclei_forcing
long_name = flag for IN and CCN forcing for morrison gettelman microphysics
Expand Down Expand Up @@ -1149,6 +1156,13 @@
dimensions = ()
type = logical
intent = in
[iaermdl]
standard_name = control_for_aerosol_radiation_scheme
long_name = control of aerosol scheme in radiation
units = 1
dimensions = ()
type = integer
intent = in
[iccn]
standard_name = control_for_ice_cloud_condensation_nuclei_forcing
long_name = flag for IN and CCN forcing for morrison gettelman microphysics
Expand Down
5 changes: 3 additions & 2 deletions physics/MP/Morrison_Gettelman/aerclm_def.F
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@ module aerclm_def
implicit none

integer, parameter :: levsaer=72, ntrcaerm=15, timeaer=2
integer :: latsaer, lonsaer, ntrcaer, levsw
integer :: n1sv, n2sv
integer :: latsaer, lonsaer, ntrcaer, levsw, tsaer
integer :: n1sv, n2sv, t1sv, t2sv
integer :: iamin, iamax, jamin, jamax

character*10 :: specname(ntrcaerm)
real (kind=kind_phys):: aer_time(13)

real (kind=kind_phys), allocatable, dimension(:) :: aer_lat
real (kind=kind_phys), allocatable, dimension(:) :: aer_lon
real (kind=kind_phys), allocatable, dimension(:) :: aer_t
real (kind=kind_io4), allocatable, dimension(:,:,:,:) :: aer_pres
real (kind=kind_io4), allocatable, dimension(:,:,:,:,:) :: aerin

Expand Down
Loading

0 comments on commit 588d06b

Please sign in to comment.