Skip to content

Commit

Permalink
Avoid uninitialized array references in v3atm
Browse files Browse the repository at this point in the history
  • Loading branch information
amametjanov committed Sep 22, 2023
1 parent 3b6253d commit ba16f5b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion components/eam/src/physics/cam/clubb_intr.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2572,7 +2572,7 @@ subroutine clubb_tend_cam( &
call t_stopf('adv_clubb_core_col_loop')


call outfld('fixerCLUBB', te_a(:)-te_b(:), pcols, lchnk )
call outfld('fixerCLUBB', te_a(:ncol)-te_b(:ncol), ncol, lchnk )


! Add constant to ghost point so that output is not corrupted
Expand Down
13 changes: 9 additions & 4 deletions components/eam/src/physics/cam/cospsimulator_intr.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1212,6 +1212,7 @@ subroutine cospsimulator_intr_run(state,pbuf, cam_in,emis,coszrs,cld_swtau_in,sn
use mod_cosp, only: cosp_simulator
use mod_quickbeam_optics, only: size_distribution
#endif
use shr_infnan_mod, only: shr_infnan_isnan

! ######################################################################################
! Inputs
Expand Down Expand Up @@ -1971,8 +1972,8 @@ subroutine cospsimulator_intr_run(state,pbuf, cam_in,emis,coszrs,cld_swtau_in,sn
reff_cosp(1:ncol,1:pver,2) = rei(1:ncol,1:pver)*1.e-6_r8 !! LSCICE (same as effi and effice in stratiform.F90)
reff_cosp(1:ncol,1:pver,3) = ls_reffrain(1:ncol,1:pver)*1.e-6_r8 !! LSRAIN (calculated in cldwat2m_micro.F90, passed to stratiform.F90)
reff_cosp(1:ncol,1:pver,4) = ls_reffsnow(1:ncol,1:pver)*1.e-6_r8 !! LSSNOW (calculated in cldwat2m_micro.F90, passed to stratiform.F90)
reff_cosp(1:ncol,1:pver,5) = cv_reffliq(1:ncol,1:pver)*1.e-6_r8 !! CVCLIQ (calculated in stratiform.F90, not actually used in radiation)
reff_cosp(1:ncol,1:pver,6) = cv_reffice(1:ncol,1:pver)*1.e-6_r8 !! CVCICE (calculated in stratiform.F90, not actually used in radiation)
!reff_cosp(1:ncol,1:pver,5) = cv_reffliq(1:ncol,1:pver)*1.e-6_r8 !! CVCLIQ (calculated in stratiform.F90, not actually used in radiation)
!reff_cosp(1:ncol,1:pver,6) = cv_reffice(1:ncol,1:pver)*1.e-6_r8 !! CVCICE (calculated in stratiform.F90, not actually used in radiation)
reff_cosp(1:ncol,1:pver,7) = ls_reffrain(1:ncol,1:pver)*1.e-6_r8 !! CVRAIN (same as stratiform per Andrew)
reff_cosp(1:ncol,1:pver,8) = ls_reffsnow(1:ncol,1:pver)*1.e-6_r8 !! CVSNOW (same as stratiform per Andrew)
reff_cosp(1:ncol,1:pver,9) = 0._r8 !! LSGRPL (using radar default reff)
Expand All @@ -1991,11 +1992,15 @@ subroutine cospsimulator_intr_run(state,pbuf, cam_in,emis,coszrs,cld_swtau_in,sn
where (ls_reffsnow(1:ncol,1:pver) .eq. R_UNDEF)
reff_cosp(1:ncol,1:pver,4) = 0._r8
end where
where (cv_reffliq(1:ncol,1:pver) .eq. R_UNDEF)
where (shr_infnan_isnan(cv_reffliq(1:ncol,1:pver)) .or. (cv_reffliq(1:ncol,1:pver) .eq. R_UNDEF))
reff_cosp(1:ncol,1:pver,5) = 0._r8
elsewhere
reff_cosp(1:ncol,1:pver,5) = cv_reffliq(1:ncol,1:pver)*1.e-6_r8
end where
where (cv_reffice(1:ncol,1:pver) .eq. R_UNDEF)
where (shr_infnan_isnan(cv_reffice(1:ncol,1:pver)) .or. (cv_reffice(1:ncol,1:pver) .eq. R_UNDEF))
reff_cosp(1:ncol,1:pver,6) = 0._r8
elsewhere
reff_cosp(1:ncol,1:pver,6) = cv_reffice(1:ncol,1:pver)*1.e-6_r8
end where
where (ls_reffrain(1:ncol,1:pver) .eq. R_UNDEF)
reff_cosp(1:ncol,1:pver,7) = 0._r8
Expand Down
2 changes: 0 additions & 2 deletions components/eam/src/physics/cam/modal_aer_opt.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1017,8 +1017,6 @@ subroutine modal_aero_sw(list_idx, dt, state, pbuf, nnite, idxnite, is_cmip6_vol
aodvis(i) = aodvis(i) + dopaer(i)
if ((k .le. trop_level(i)) .and. (is_output_interactive_volc)) then ! in stratosphere
saodvis(i) = saodvis(i) + dopaer(i)
else
saodvis(i) = saodvis(i) + 0.0_r8
endif
aodall(i) = aodall(i) + dopaer(i)
aodabs(i) = aodabs(i) + pabs(i)*mass(i,k)
Expand Down
4 changes: 2 additions & 2 deletions components/eam/src/physics/cam/zm_conv_intr.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1012,9 +1012,9 @@ subroutine zm_conv_tend(pblh ,mcon ,cme , &
lambdadpcu, microp_st, wuc)

if (zm_microp) then
dlftot(:,:) = dlf(:,:) + dif(:,:) + dsf(:,:)
dlftot(:ncol,:pver) = dlf(:ncol,:pver) + dif(:ncol,:pver) + dsf(:ncol,:pver)
else
dlftot(:,:) = dlf(:,:)
dlftot(:ncol,:pver) = dlf(:ncol,:pver)
end if


Expand Down

0 comments on commit ba16f5b

Please sign in to comment.