From 82f795dbd77f6efe2a1386c69725c0e9dee3852a Mon Sep 17 00:00:00 2001 From: "Grant.Firl" Date: Wed, 19 Dec 2018 13:19:49 -0700 Subject: [PATCH] fix a couple of bugs in aer_cloud.F leading to uninitialized memory being accessed and a segmentation fault when compiling with gfortran --- physics/aer_cloud.F | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/physics/aer_cloud.F b/physics/aer_cloud.F index 680ce8438..ed7d38ab4 100644 --- a/physics/aer_cloud.F +++ b/physics/aer_cloud.F @@ -172,7 +172,7 @@ end subroutine aer_cloud_init subroutine aerosol_activate(tparc_in, pparc_in, sigwparc_in, - & wparc_ls, Aer_Props, npre_in, dpre_in, ccn_diagr8, Ndropr8, + & wparc_ls, Aer_Props, npre_in, dpre_in, ccn_diagr8, Ndropr8, & cdncr8, smaxliqr8, incr8, smaxicer8, nheticer8, INimmr8, & dINimmr8, Ncdepr8, Ncdhfr8, sc_icer8, fdust_immr8, fdust_depr8, & fdust_dhfr8, nlimr8, use_average_v, CCN_param, IN_param, fd_dust, @@ -224,9 +224,9 @@ subroutine aerosol_activate(tparc_in, pparc_in, sigwparc_in, ! & ddust_ice real*8 :: temp_par, pres_par real*8 :: akoh_par, alfa_par, bet2_par - real*8 aka_par, dv_par, psat_par, dair_par,surt_par,ddry_ice, + real*8 aka_par, dv_par, psat_par, dair_par,surt_par,ddry_ice, & np_ice,nin_ice,alfa_ice,beta_ice,shom_ice, koft_ice, dliq_ice, - & g1_ice, g2_ice,gdoin_ice, z_ice, norg_ice, sigorg_ice, + & g1_ice, g2_ice,gdoin_ice, z_ice, norg_ice, sigorg_ice, & dorg_ice, dbc_ice,sigbc_ice,lambda_ice, & kdust_ice, kbc_ice, shdust_ice, shbc_ice, & effdust_ice, effbc_ice, del1dust_ice, si0dust_ice, del1bc_ice, @@ -433,7 +433,7 @@ subroutine aerosol_activate(tparc_in, pparc_in, sigwparc_in, shdust_ice = 0. shbc_ice = 0. effdust_ice = 0. - effbc_ice = 0. + effbc_ice = 0. del1dust_ice = 0. si0dust_ice = 0. del1bc_ice = 0. @@ -460,7 +460,9 @@ subroutine aerosol_activate(tparc_in, pparc_in, sigwparc_in, ! allocate(sigdust_ice(nbindust_ice)) ! allocate(ddust_ice(nbindust_ice)) - + ddust_ice = zero_par + ndust_ice = zero_par + sigdust_ice = zero_par do n=1,nbindust_ice ddust_ice(n) = DBLE(Aeraux%dpg(n)) ndust_ice(n) = DBLE(Aeraux%num(n))*air_den @@ -1294,7 +1296,7 @@ subroutine ccn_at_super (super,ccn_at_s,nmodes, do j=1, nmodes dlgsg = sig_par(j) - + if (sg_par(j) .gt. 0.0) then if (super .gt. 0.0) then dlgsp = dlog(sg_par(j)/super) @@ -2634,7 +2636,7 @@ real*8 function FINDSMAX(SX,DSH, tao=NHET_*SIZECORR*SX*sqrt(DSTAR)/(SX+1d0)/NSTAR - + else DSH=SX-sh_ice @@ -3076,7 +3078,8 @@ subroutine INSPEC_ice(six, N, Dsh,np_ice,norg_ice, sigorg_ice, & dNglassy, SIW, D_grid_bio, n_grid_bio,vpresw_ice,vpresi_ice real*8, dimension(3) :: sig_array, the_array, frac_array - real*8, dimension(:) :: ndust_ice, sigdust_ice,ddust_ice + real*8, dimension(1:nbindust_ice) :: ndust_ice, sigdust_ice, + & ddust_ice real :: n_iw, DSh_s , nbc_s, dbc_s, Asolo real, dimension (nbindust_ice) :: ndust_s, ddust_s @@ -4012,9 +4015,3 @@ real function H_1_smooth(X, X_1, X_2, Hlo, Hhi,dH1smooth) END MODULE aer_cloud - - - - - -