Skip to content

Commit

Permalink
Merge pull request #774 from AnningCheng-NOAA/mr2memL
Browse files Browse the repository at this point in the history
decreases memory usage by 6 times for MERRA2
  • Loading branch information
climbfuji authored Nov 18, 2021
2 parents b8b7c31 + aed5b1e commit 27a312c
Show file tree
Hide file tree
Showing 4 changed files with 191 additions and 104 deletions.
18 changes: 9 additions & 9 deletions physics/GFS_phys_time_vary.fv3.F90
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module GFS_phys_time_vary
use h2o_def, only : levh2o, h2o_coeff, h2o_lat, h2o_pres, h2o_time, h2oplin
use h2ointerp, only : read_h2odata, setindxh2o, h2ointerpol

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

use iccn_def, only : ciplin, ccnin, ci_pres
Expand Down Expand Up @@ -68,7 +68,7 @@ module GFS_phys_time_vary
!! @{
subroutine GFS_phys_time_vary_init ( &
me, master, ntoz, h2o_phys, iaerclm, iccn, iflip, im, nx, ny, idate, xlat_d, xlon_d, &
jindx1_o3, jindx2_o3, ddy_o3, ozpl, jindx1_h, jindx2_h, ddy_h, h2opl, &
jindx1_o3, jindx2_o3, ddy_o3, ozpl, 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, &
do_ugwp_v1, jindx1_tau, jindx2_tau, ddy_j1tau, ddy_j2tau, &
Expand All @@ -88,6 +88,7 @@ subroutine GFS_phys_time_vary_init (
integer, intent(in) :: me, master, ntoz, iccn, iflip, im, nx, ny
logical, intent(in) :: h2o_phys, iaerclm, flag_restart
integer, intent(in) :: idate(:)
real(kind_phys), intent(in) :: fhour
real(kind_phys), intent(in) :: xlat_d(:), xlon_d(:)

integer, intent(inout) :: jindx1_o3(:), jindx2_o3(:), jindx1_h(:), jindx2_h(:)
Expand Down Expand Up @@ -173,7 +174,7 @@ subroutine GFS_phys_time_vary_init (
integer, intent(out) :: errflg

! Local variables
integer :: i, j, ix, vegtyp, iamin, iamax, jamin, jamax
integer :: i, j, ix, vegtyp
real(kind_phys) :: rsnow

!--- Noah MP
Expand Down Expand Up @@ -387,8 +388,7 @@ subroutine GFS_phys_time_vary_init (
if (errflg/=0) return

if (iaerclm) then
call read_aerdataf (iamin, iamax, jamin, jamax, me, master, iflip, &
idate, errmsg, errflg)
call read_aerdataf (me, master, iflip, idate, fhour, errmsg, errflg)
if (errflg/=0) return
end if

Expand Down Expand Up @@ -715,7 +715,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, &
jindx1_o3, jindx2_o3, ddy_o3, ozpl, jindx1_h, jindx2_h, ddy_h, h2opl, &
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, &
imap, jmap, prsl, seed0, rann, nthrds, nx, ny, nsst, tile_num, nlunit, lsoil, lsoil_lsm,&
Expand All @@ -730,7 +730,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
nsswr, imfdeepcnv, iccn, nscyc, ntoz, iflip
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 @@ -797,7 +797,7 @@ subroutine GFS_phys_time_vary_timestep_init (
!$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) &
!$OMP shared(ddx_ci,in_nm,ccn_nm,do_ugwp_v1,jindx1_tau,jindx2_tau,ddy_j1tau) &
!$OMP shared(ddy_j2tau,tau_amf) &
!$OMP shared(ddy_j2tau,tau_amf,iflip) &
!$OMP private(iseed,iskip,i,j,k)

!$OMP sections
Expand Down Expand Up @@ -889,7 +889,7 @@ subroutine GFS_phys_time_vary_timestep_init (
! aerinterpol is using threading inside, don't
! move into OpenMP parallel section above
call aerinterpol (me, master, nthrds, im, idate, &
fhour, jindx1_aer, jindx2_aer, &
fhour, iflip, jindx1_aer, jindx2_aer, &
ddy_aer, iindx1_aer, &
iindx2_aer, ddx_aer, &
levs, prsl, aer_nm)
Expand Down
15 changes: 15 additions & 0 deletions physics/GFS_phys_time_vary.fv3.meta
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,14 @@
type = real
kind = kind_phys
intent = in
[fhour]
standard_name = forecast_time
long_name = current forecast time
units = h
dimensions = ()
type = real
kind = kind_phys
intent = in
[jindx1_aer]
standard_name = lower_latitude_index_of_aerosol_forcing_for_interpolation
long_name = interpolation low index for prescribed aerosols in the y direction
Expand Down Expand Up @@ -1151,6 +1159,13 @@
type = real
kind = kind_phys
intent = inout
[iflip]
standard_name = control_for_vertical_index_direction
long_name = iflip - is not the same as flipv
units = flag
dimensions = ()
type = integer
intent = in
[jindx1_aer]
standard_name = lower_latitude_index_of_aerosol_forcing_for_interpolation
long_name = interpolation low index for prescribed aerosols in the y direction
Expand Down
4 changes: 3 additions & 1 deletion physics/aerclm_def.F
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ module aerclm_def
use machine , only : kind_phys, kind_io4
implicit none

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

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

0 comments on commit 27a312c

Please sign in to comment.