From 4dee5ee452952b32f91ebfc2955030770774ed04 Mon Sep 17 00:00:00 2001 From: noel Date: Sun, 7 May 2017 16:07:14 -0700 Subject: [PATCH 1/2] 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 ) --- components/cam/src/physics/cam/clubb_intr.F90 | 27 ++++++++++++------- .../src/physics/cam/hetfrz_classnuc_cam.F90 | 14 ++++++---- 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/components/cam/src/physics/cam/clubb_intr.F90 b/components/cam/src/physics/cam/clubb_intr.F90 index e28b02531bdf..a648d6bb1222 100644 --- a/components/cam/src/physics/cam/clubb_intr.F90 +++ b/components/cam/src/physics/cam/clubb_intr.F90 @@ -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) @@ -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 @@ -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 = wprcp(: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 ) diff --git a/components/cam/src/physics/cam/hetfrz_classnuc_cam.F90 b/components/cam/src/physics/cam/hetfrz_classnuc_cam.F90 index 9ce6a38b7e41..d56ba809ea0e 100644 --- a/components/cam/src/physics/cam/hetfrz_classnuc_cam.F90 +++ b/components/cam/src/physics/cam/hetfrz_classnuc_cam.F90 @@ -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) @@ -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) @@ -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 From 67ed2c0e339a4969ac97f801cf62005dcde7af4f Mon Sep 17 00:00:00 2001 From: noel Date: Mon, 8 May 2017 10:49:05 -0700 Subject: [PATCH 2/2] Correct a copy-paste error in first attempt. Should be tmp_array = wpthvp(:ncol,:)*cpair --- components/cam/src/physics/cam/clubb_intr.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/cam/src/physics/cam/clubb_intr.F90 b/components/cam/src/physics/cam/clubb_intr.F90 index a648d6bb1222..899ca3e3979b 100644 --- a/components/cam/src/physics/cam/clubb_intr.F90 +++ b/components/cam/src/physics/cam/clubb_intr.F90 @@ -2463,7 +2463,7 @@ subroutine clubb_tend_cam( & tmp_array = rcm_in_layer(:ncol,:)*1000._r8 call outfld( 'RCMINLAYER_CLUBB', tmp_array, ncol, lchnk ) call outfld( 'CLOUDCOVER_CLUBB', cloud_frac, pcols, lchnk ) - tmp_array = wprcp(:ncol,:)*cpair + 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 )