Skip to content

Commit

Permalink
Merge branch ACME-Climate/ndk/cam/add-tmp_arrays-for-outfld3 (PR #1501)
Browse files Browse the repository at this point in the history
For several outfld() calls that do array operations in the function call,
instead create a temporary array, and only do the operation on ncol values.

For example:
!call outfld( 'RTP2_CLUBB', rtp2*1000._r8, pcols, lchnk )
tmp_array = rtp2(:ncol,:)*1000._r8
call outfld( 'RTP2_CLUBB', tmp_array, ncol, lchnk )

We hit issues using a couple of different PE layouts in these outfld calls. Additionally, for cori-knl, the SMS_D_Ld1.ne16_ne16.FC5ATMMOD test was failing, but now passes.

Fixes #1263
  • Loading branch information
ndkeen authored May 9, 2017
2 parents 6848e9c + 67ed2c0 commit dd54f30
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 14 deletions.
27 changes: 18 additions & 9 deletions components/cam/src/physics/cam/clubb_intr.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1091,7 +1091,7 @@ subroutine clubb_tend_cam( &
real(r8) :: qmin
real(r8) :: varmu(pcols)
real(r8) :: varmu2

! Variables below are needed to compute energy integrals for conservation
real(r8) :: ke_a(pcols), ke_b(pcols), te_a(pcols), te_b(pcols)
real(r8) :: wv_a(pcols), wv_b(pcols), wl_b(pcols), wl_a(pcols)
Expand Down Expand Up @@ -1147,6 +1147,7 @@ subroutine clubb_tend_cam( &
real(r8) :: es(pcols,pver)
real(r8) :: qs(pcols,pver)
real(r8) :: gam(pcols,pver)
real(r8) :: tmp_array(pcols,pverp)
real(r8) :: bfact, orgparam, delpavg
character(len=6) :: choice_radf

Expand Down Expand Up @@ -2449,17 +2450,25 @@ subroutine clubb_tend_cam( &
call outfld( 'VPWP_CLUBB', vpwp, pcols, lchnk )
call outfld( 'WPTHLP_CLUBB', wpthlp_output, pcols, lchnk )
call outfld( 'WPRTP_CLUBB', wprtp_output, pcols, lchnk )
call outfld( 'RTP2_CLUBB', rtp2*1000._r8, pcols, lchnk )
tmp_array = rtp2(:ncol,:)*1000._r8
call outfld( 'RTP2_CLUBB', tmp_array, ncol, lchnk )
call outfld( 'THLP2_CLUBB', thlp2, pcols, lchnk )
call outfld( 'RTPTHLP_CLUBB', rtpthlp_output*1000._r8, pcols, lchnk )
call outfld( 'RCM_CLUBB', rcm*1000._r8, pcols, lchnk )
call outfld( 'WPRCP_CLUBB', wprcp*latvap, pcols, lchnk )
tmp_array = rtpthlp_output(:ncol,:)*1000._r8
call outfld( 'RTPTHLP_CLUBB', tmp_array, ncol, lchnk )
tmp_array = rcm(:ncol,:)*1000._r8
call outfld( 'RCM_CLUBB', tmp_array, ncol, lchnk )
tmp_array = wprcp(:ncol,:)*latvap
call outfld( 'WPRCP_CLUBB', tmp_array, ncol, lchnk )
call outfld( 'CLOUDFRAC_CLUBB', alst, pcols, lchnk )
call outfld( 'RCMINLAYER_CLUBB', rcm_in_layer*1000._r8, pcols, lchnk )
tmp_array = rcm_in_layer(:ncol,:)*1000._r8
call outfld( 'RCMINLAYER_CLUBB', tmp_array, ncol, lchnk )
call outfld( 'CLOUDCOVER_CLUBB', cloud_frac, pcols, lchnk )
call outfld( 'WPTHVP_CLUBB', wpthvp*cpair, pcols, lchnk )
call outfld( 'ZT_CLUBB', 1._r8*zt_out, pcols, lchnk )
call outfld( 'ZM_CLUBB', 1._r8*zi_out, pcols, lchnk )
tmp_array = wpthvp(:ncol,:)*cpair
call outfld( 'WPTHVP_CLUBB', tmp_array, ncol, lchnk )
tmp_array = 1._r8*zt_out(:ncol,:)
call outfld( 'ZT_CLUBB', tmp_array, ncol, lchnk )
tmp_array = 1._r8*zi_out(:ncol,:)
call outfld( 'ZM_CLUBB', tmp_array, ncol, lchnk )
call outfld( 'UM_CLUBB', um, pcols, lchnk )
call outfld( 'VM_CLUBB', vm, pcols, lchnk )
call outfld( 'THETAL', thetal_output, pcols, lchnk )
Expand Down
14 changes: 9 additions & 5 deletions components/cam/src/physics/cam/hetfrz_classnuc_cam.F90
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,7 @@ subroutine hetfrz_classnuc_cam_calc( &
real(r8) :: numice10s(pcols,pver)
real(r8) :: numice10s_imm_dst(pcols,pver)
real(r8) :: numice10s_imm_bc(pcols,pver)
real(r8) :: tmp_array(pcols,pver)

real(r8) :: na500(pcols,pver)
real(r8) :: tot_na500(pcols,pver)
Expand Down Expand Up @@ -962,9 +963,12 @@ subroutine hetfrz_classnuc_cam_calc( &
call outfld('BCFREZCNT', nnucct_bc, pcols, lchnk)
call outfld('BCFREZDEP', nnudep_bc, pcols, lchnk)

call outfld('NIMIX_IMM', niimm_bc+niimm_dst, pcols, lchnk)
call outfld('NIMIX_CNT', nicnt_bc+nicnt_dst, pcols, lchnk)
call outfld('NIMIX_DEP', nidep_bc+nidep_dst, pcols, lchnk)
tmp_array = niimm_bc(:ncol,:)+niimm_dst(:ncol,:)
call outfld('NIMIX_IMM', tmp_array, ncol, lchnk)
tmp_array = nicnt_bc(:ncol,:)+nicnt_dst(:ncol,:)
call outfld('NIMIX_CNT', tmp_array, ncol, lchnk)
tmp_array = nidep_bc(:ncol,:)+nidep_dst(:ncol,:)
call outfld('NIMIX_DEP', tmp_array, ncol, lchnk)

call outfld('DSTNICNT', nicnt_dst, pcols, lchnk)
call outfld('DSTNIDEP', nidep_dst, pcols, lchnk)
Expand All @@ -974,9 +978,9 @@ subroutine hetfrz_classnuc_cam_calc( &
call outfld('BCNIDEP', nidep_bc, pcols, lchnk)
call outfld('BCNIIMM', niimm_bc, pcols, lchnk)

call outfld('NUMICE10s', numice10s, pcols, lchnk)
call outfld('NUMICE10s', numice10s, pcols, lchnk)
call outfld('NUMIMM10sDST', numice10s_imm_dst, pcols, lchnk)
call outfld('NUMIMM10sBC', numice10s_imm_bc, pcols, lchnk)
call outfld('NUMIMM10sBC', numice10s_imm_bc, pcols, lchnk)

end associate

Expand Down

0 comments on commit dd54f30

Please sign in to comment.