Skip to content

Commit

Permalink
Correct some typos from refactor
Browse files Browse the repository at this point in the history
Removed a few unused variables
Converted integers to correct real values (e.g., 1 ==> 1._r8)
  • Loading branch information
Steve Goldhaber committed Aug 28, 2024
1 parent b5241b1 commit 773d82e
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 44 deletions.
4 changes: 2 additions & 2 deletions src/oslo_aero_depos.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1603,14 +1603,14 @@ subroutine wetdepa_v2( &
! unless the fraction of the area that is cloud is less than odds, in which
! case use the cloud fraction (assumes precabs is in kg/m2/s)
! is really: precabs*3/4/1000./1e-3*deltat
! here ICOL use .1 from Balkanski
! here I use .1 from Balkanski
!
! use a local rate of convective rain production for incloud scav
!
! Fraction of convective cloud water converted to rain. This version is used
! in 2 of the 3 branches below before fracp is reused in the stratiform calc.
! NB: In below formula for fracp conicw is a LWC/IWC that has already
! precipitated out, icol.e., conicw does not contain precipitation
! precipitated out, i.e., conicw does not contain precipitation

fracp(icol) = cmfdqr(icol,ilev)*deltat / &
max( 1.e-12_r8, cldc(icol,ilev)*conicw(icol,ilev) + (cmfdqr(icol,ilev)+dlf(icol,ilev))*deltat )
Expand Down
2 changes: 1 addition & 1 deletion src/oslo_aero_diurnal_var.F90
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ subroutine srisesetxx(iyear, month, iday, rlat, rlong, iriseset,sunrise, sunset,
! leap years are divisible by 4, except for centurial years not divisible by 400.

! year = real (iyear)
! if ((amod(year,4.) == 0.0) .and. (amod(year,100.) .ne. 0.0)) &
! if ((amod(year,4.) == 0.0) .and. (amod(year,100.) /= 0.0)) &
! leapyr = 1
! if(amod(year,400.) == 0.0) leapyr = 1

Expand Down
2 changes: 1 addition & 1 deletion src/oslo_aero_dust_sediment.F90
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ subroutine oslo_aero_dust_sediment_tend ( ncol, dtime, pint, pmid, pdel, t, &
real(r8), intent(in) :: pint(pcols,pverp) ! interfaces pressure (Pa)
real(r8), intent(in) :: pmid(pcols,pver) ! midpoint pressures (Pa)
real(r8), intent(in) :: pdel(pcols,pver) ! pressure diff across layer (Pa)
real(r8), intent(in) :: t(pcols,pver) ! temperature (
real(r8), intent(in) :: t(pcols,pver) ! temperature (K)
real(r8), intent(in) :: dustmr(pcols,pver) ! dust (kg/kg)
real(r8), intent(in) :: pvdust (pcols,pverp) ! vertical velocity of dust drops (Pa/s)
real(r8), intent(out) :: dusttend(pcols,pver) ! dust tend
Expand Down
46 changes: 23 additions & 23 deletions src/oslo_aero_hetfrz.F90
Original file line number Diff line number Diff line change
Expand Up @@ -385,35 +385,35 @@ subroutine hetfrz_classnuc_oslo_init(mincld_in)
! only consider flat surfaces due to uncertainty of curved surfaces

cos_angle = COS(theta_imm_bc*pi/180._r8)
f_imm_bc = (2+cos_angle)*(1-cos_angle)**2/4._r8
f_imm_bc = (2._r8+cos_angle)*(1._r8-cos_angle)**2/4._r8
if (.not. pdf_imm_in) then
cos_angle = COS(theta_imm_dust*pi/180._r8)
f_imm_dust_a1 = (2+cos_angle)*(1-cos_angle)**2/4._r8
f_imm_dust_a1 = (2._r8+cos_angle)*(1._r8-cos_angle)**2/4._r8

cos_angle = COS(theta_imm_dust*pi/180._r8)
f_imm_dust_a3 = (2+cos_angle)*(1-cos_angle)**2/4._r8
f_imm_dust_a3 = (2._r8+cos_angle)*(1._r8-cos_angle)**2/4._r8
end if


! form factor
cos_angle = COS(theta_dep_bc*pi/180._r8)
f_dep_bc = (2+cos_angle)*(1-cos_angle)**2/4._r8
f_dep_bc = (2._r8+cos_angle)*(1._r8-cos_angle)**2/4._r8

cos_angle = COS(theta_dep_dust*pi/180._r8)
f_dep_dust_a1 = (2+cos_angle)*(1-cos_angle)**2/4._r8
f_dep_dust_a1 = (2._r8+cos_angle)*(1._r8-cos_angle)**2/4._r8

cos_angle = COS(theta_dep_dust*pi/180._r8)
f_dep_dust_a3 = (2+cos_angle)*(1-cos_angle)**2/4._r8
f_dep_dust_a3 = (2._r8+cos_angle)*(1._r8-cos_angle)**2/4._r8

! form factor
cos_angle = COS(theta_dep_bc*pi/180._r8)
f_cnt_bc = (2+cos_angle)*(1-cos_angle)**2/4._r8
f_cnt_bc = (2._r8+cos_angle)*(1._r8-cos_angle)**2/4._r8

cos_angle = COS(theta_dep_dust*pi/180._r8)
f_cnt_dust_a1 = (2+cos_angle)*(1-cos_angle)**2/4._r8
f_cnt_dust_a1 = (2._r8+cos_angle)*(1._r8-cos_angle)**2/4._r8

cos_angle = COS(theta_dep_dust*pi/180._r8)
f_cnt_dust_a3 = (2+cos_angle)*(1-cos_angle)**2/4._r8
f_cnt_dust_a3 = (2._r8+cos_angle)*(1._r8-cos_angle)**2/4._r8

sqroot_f_imm_bc = SQRT(f_imm_bc)
sqroot_dim_f_imm_dust_a1(i1:i2) = SQRT(dim_f_imm_dust_a1(i1:i2))
Expand Down Expand Up @@ -476,7 +476,7 @@ subroutine hetfrz_classnuc_oslo_calc( &
real(r8), pointer :: frzdep(:,:) ! output shared with the microphysics via the pbuf
real(r8), pointer :: ast(:,:)
integer :: itim_old
integer :: icol, ilev, cos_angle, kk
integer :: icol, ilev, cos_angle
real(r8) :: rho(pcols,pver) ! air density (kg m-3)
real(r8) :: lcldm(pcols,pver)
real(r8) :: fn(3)
Expand Down Expand Up @@ -965,7 +965,7 @@ subroutine hetfrz_classnuc_calc( &
total_cloudborne_aer_num, errstring)

real(r8), intent(in) :: deltat ! timestep [s]
real(r8), intent(in) :: t ! temperature [ILEV]
real(r8), intent(in) :: t ! temperature [K]
real(r8), intent(in) :: p ! pressure [Pa]
real(r8), intent(in) :: supersatice ! supersaturation ratio wrt ice at 100%rh over water [ ]
real(r8), intent(in) :: eswtr ! saturation vapor pressure water [Pa]
Expand Down Expand Up @@ -1144,7 +1144,7 @@ subroutine hetfrz_classnuc_calc( &
if (.not. pdf_imm_in) then
! 1/sqrt(f)
! the expression of Chen et al. (sqrt(f)) may however lead to unphysical
! behavior as it implies J->0 when f->0 (icol.e. ice nucleation would be
! behavior as it implies J->0 when f->0 (i.e. ice nucleation would be
! more difficult on easily wettable materials).
Jimm_dust_a1 = Aimm_dust_a1*r_dust_a1**2/sqroot_f_imm_dust_a1*EXP((-dga_imm_dust-f_imm_dust_a1*dg0imm_dust_a1)/(kboltz*T))
Jimm_dust_a3 = Aimm_dust_a3*r_dust_a3**2/sqroot_f_imm_dust_a3*EXP((-dga_imm_dust-f_imm_dust_a3*dg0imm_dust_a3)/(kboltz*T))
Expand Down Expand Up @@ -1343,7 +1343,7 @@ subroutine collkernel( &
! Modifications: Yong Wang and Xiaohong Liu, UWyo, 12/2012
!-----------------------------------------------------------------------

real(r8), intent(in) :: t ! temperature [ILEV]
real(r8), intent(in) :: t ! temperature [K]
real(r8), intent(in) :: pres ! pressure [Pa]
real(r8), intent(in) :: eswtr ! saturation vapor pressure of water [Pa]
real(r8), intent(in) :: r3lx ! volume mean drop radius [m]
Expand Down Expand Up @@ -1379,7 +1379,7 @@ subroutine collkernel( &
real(r8) :: Tdiff_cotton ! temperature difference between droplet and environment [K]
real(r8) :: K_brownian,K_thermo_cotton,K_diffusio_cotton ! collision kernels [m3 s-1]
real(r8) :: K_total ! total collision kernel [cm3 s-1]
integer :: icol
integer :: imode
!------------------------------------------------------------------------------------------------

Kcoll_bc = 0._r8
Expand Down Expand Up @@ -1428,10 +1428,10 @@ subroutine collkernel( &

! variables depending on aerosol radius
! loop over 3 aerosol modes
do icol = 1, 3
if (icol == 1) r_a = r_bc
if (icol == 2) r_a = r_dust_a1
if (icol == 3) r_a = r_dust_a3
do imode = 1, 3
if (imode == 1) r_a = r_bc
if (imode == 2) r_a = r_dust_a1
if (imode == 3) r_a = r_dust_a3
! Knudsen number (Seinfeld & Pandis 8.1)
Kn = lambda/r_a
! aerosol diffusivity
Expand All @@ -1443,8 +1443,8 @@ subroutine collkernel( &
K_brownian = 4*pi*r3lx*Daer*(1 + 0.3_r8*Re**0.5_r8*Sc**0.33_r8)

! thermal conductivities from Seinfeld & Pandis, Table 8.6
if (icol == 1) Ktherm = 4.2_r8 ! Carbon
if (icol == 2 .or. icol == 3) Ktherm = 0.72_r8 ! clay
if (imode == 1) Ktherm = 4.2_r8 ! Carbon
if (imode == 2 .or. imode == 3) Ktherm = 0.72_r8 ! clay

! form factor
f_t = 0.4_r8*(1._r8 + 1.45_r8*Kn + 0.4_r8*Kn*EXP(-1._r8/Kn)) &
Expand All @@ -1461,9 +1461,9 @@ subroutine collkernel( &
! set K to 0 if negative
if (K_total < 0._r8) K_total = 0._r8

if (icol == 1) Kcoll_bc = K_total
if (icol == 2) Kcoll_dust_a1 = K_total
if (icol == 3) Kcoll_dust_a3 = K_total
if (imode == 1) Kcoll_bc = K_total
if (imode == 2) Kcoll_dust_a1 = K_total
if (imode == 3) Kcoll_dust_a3 = K_total
end do

end subroutine collkernel
Expand Down
2 changes: 1 addition & 1 deletion src/oslo_aero_microp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ subroutine oslo_aero_microp_run (state, ptend_all, deltatin, pbuf)
do ilev = top_lev, pver
do icol = 1, ncol
if (state1%t(icol,ilev) < 269.15_r8) then
!fxm: ICOL think model uses bins, not modes.. But to get it
!fxm: I think model uses bins, not modes.. But to get it
!approximately correct, use mode radius in first version
nacon(icol,ilev,2) = numberConcentration(icol,ilev,MODE_IDX_DST_A2)
nacon(icol,ilev,3) = numberConcentration(icol,ilev,MODE_IDX_DST_A3)
Expand Down
15 changes: 7 additions & 8 deletions src/oslo_aero_ndrop.F90
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ subroutine dropmixnuc_oslo( state, ptend, dtmicro, pbuf, wsub,
!NOTE: SEVERAL POINTERS POINT TO SAME FIELD, E.G. CONDENSATE WHICH IS IN SEVERAL MODES
do ispec = 1, nspec_amode(imode)
tracerIndex = tracer_index(imode,ispec) !Index in q
cloud_tracer_index = cloudTracerIndex(tracerIndex) !Index in phys-buffer
cloud_tracer_index = CloudTracerIndex(tracerIndex) !Index in phys-buffer
mm = mam_idx(imode,ispec) !Index in raer/qqcw
raer(mm)%fld => state%q(:,:,tracerIndex) !NOTE: These are total fields (for example condensate)
call pbuf_get_field(pbuf, cloud_tracer_index, qqcw(mm)%fld) !NOTE: These are total fields (for example condensate)
Expand Down Expand Up @@ -579,8 +579,7 @@ subroutine dropmixnuc_oslo( state, ptend, dtmicro, pbuf, wsub,
enddo
enddo
if (alert)then
print*,"strange number concentration "
call endrun()
call endrun("strange number concentration")
endif

! tau_cld_regenerate = time scale for regeneration of cloudy air
Expand Down Expand Up @@ -770,7 +769,7 @@ subroutine dropmixnuc_oslo( state, ptend, dtmicro, pbuf, wsub,
tracerIndex = tracer_index(imode,ispec)
componentFraction = componentFractionOK(imode,tracerIndex,ilev)
endif
!Assign to the components used here icol.e. distribute condensate/coagulate to modes
!Assign to the components used here i.e. distribute condensate/coagulate to modes
raercol_cw(ilev,mm,nsav) = qqcw(mm)%fld(icol,ilev)*componentFraction
raercol(ilev,mm,nsav) = raer(mm)%fld(icol,ilev)*componentFraction
enddo ! ilev (levels)
Expand Down Expand Up @@ -1093,7 +1092,7 @@ subroutine dropmixnuc_oslo( state, ptend, dtmicro, pbuf, wsub,
! it is forced to be >= 0
!
! steve --
! you will likely want to change this. il did not really understand
! you will likely want to change this. i did not really understand
! what was previously being done in ilev=pver
! in the cam3_5_3 code, wtke(icol,pver) appears to be equal to the
! droplet deposition velocity which is quite small
Expand Down Expand Up @@ -1125,7 +1124,7 @@ subroutine dropmixnuc_oslo( state, ptend, dtmicro, pbuf, wsub,
nsource(icol,ilev) = nsource(icol,ilev) + fluxntot/(cs(icol,ilev)*dz(icol,ilev))
endif ! (cldn(icol,ilev) - cldn(icol,kp1) > 0.01 .or. ilev == pver)

else ! icol.e: cldn(icol,ilev) < 0.01_r8
else ! i.e: cldn(icol,ilev) < 0.01_r8

! no liquid cloud
nsource(icol,ilev) = nsource(icol,ilev) - qcld(ilev)*dtinv
Expand Down Expand Up @@ -1591,7 +1590,7 @@ subroutine activate_modal_oslo(wbar, sigw, wdiab, wminf, wmaxf, tair, rhoair, &
real(r8) , intent(in) :: wdiab ! diabatic vertical velocity (0 if adiabatic)
real(r8) , intent(in) :: wminf ! minimum updraft velocity for integration (m/s)
real(r8) , intent(in) :: wmaxf ! maximum updraft velocity for integration (m/s)
real(r8) , intent(in) :: tair ! air temperature (ILEV)
real(r8) , intent(in) :: tair ! air temperature (K)
real(r8) , intent(in) :: rhoair ! air density (kg/m3)
real(r8) , intent(in) :: na(:) ! aerosol number concentration (/m3)
integer , intent(in) :: nmode ! number of aerosol modes
Expand Down Expand Up @@ -2023,7 +2022,7 @@ subroutine ccncalc_oslo(state, pbuf, cs, hasAerosol, numberConcentration, volume
real(r8) :: exp45logsig_var ! mathematical constants
integer :: lsat,imode,icol,ilev ! mathematical constants
real(r8) :: smcoefcoef,smcoef ! mathematical constants
real(r8), pointer :: tair(:,:) ! air temperature (ILEV)
real(r8), pointer :: tair(:,:) ! air temperature (K)
real(r8), parameter :: twothird=2.0_r8/3.0_r8
real(r8), parameter :: sq2=sqrt(2.0_r8)
real(r8), parameter :: surften=0.076_r8 !surface tension of water (J/m2)
Expand Down
4 changes: 2 additions & 2 deletions src/oslo_aero_sw_tables.F90
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ module oslo_aero_sw_tables
subroutine initopt()

! Local variables
integer :: kcomp, iwl, irelh, ictot, ifac, ifbc, ifaq, iband, irf
integer :: kcomp, iwl, irelh, ictot, ifac, ifbc, ifaq, irf
integer :: ifombg, ifbcbg
integer :: ik, ic, ifil, lin, linmax
real(r8) :: catot, relh, frac, fabc, fraq, frombg, frbcbg
Expand Down Expand Up @@ -1065,7 +1065,7 @@ subroutine interpol1 (ncol, daylight, xrh, irh1, mplus10, Nnatk, xfombg, ifombg1
bex(icol,ilev,kc10,iband)=e**(a*t_xrh+b)
endif

end do ! iband (iband)
end do ! iband

else ! daylight

Expand Down
12 changes: 6 additions & 6 deletions src_cam/radsw.F90
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,12 @@ subroutine rad_rrtmg_sw(lchnk,ncol ,rrtmg_levs ,r_state , &

real(r8) :: tauc_sw(nbndsw, pcols, rrtmg_levs-1) ! cloud optical depth
real(r8) :: ssac_sw(nbndsw, pcols, rrtmg_levs-1) ! cloud single scat. albedo
real(r8) :: asmc_sw(nbndsw, pcols, rrtmg_levs-1) ! cloud asymetry parameter
real(r8) :: asmc_sw(nbndsw, pcols, rrtmg_levs-1) ! cloud asymmetry parameter
real(r8) :: fsfc_sw(nbndsw, pcols, rrtmg_levs-1) ! cloud forward scattering fraction

real(r8) :: tau_aer_sw(pcols, rrtmg_levs-1, nbndsw) ! aer optical depth
real(r8) :: ssa_aer_sw(pcols, rrtmg_levs-1, nbndsw) ! aer single scat. albedo
real(r8) :: asm_aer_sw(pcols, rrtmg_levs-1, nbndsw) ! aer asymetry parameter
real(r8) :: asm_aer_sw(pcols, rrtmg_levs-1, nbndsw) ! aer asymmetry parameter

real(r8) :: cld_stosw(nsubcsw, pcols, rrtmg_levs-1) ! stochastic cloud fraction
real(r8) :: rei_stosw(pcols, rrtmg_levs-1) ! stochastic ice particle size
Expand All @@ -216,7 +216,7 @@ subroutine rad_rrtmg_sw(lchnk,ncol ,rrtmg_levs ,r_state , &
real(r8) :: cliqwp_stosw(nsubcsw, pcols, rrtmg_levs-1) ! stochastic cloud liquid wter path
real(r8) :: tauc_stosw(nsubcsw, pcols, rrtmg_levs-1) ! stochastic cloud optical depth (optional)
real(r8) :: ssac_stosw(nsubcsw, pcols, rrtmg_levs-1) ! stochastic cloud single scat. albedo (optional)
real(r8) :: asmc_stosw(nsubcsw, pcols, rrtmg_levs-1) ! stochastic cloud asymetry parameter (optional)
real(r8) :: asmc_stosw(nsubcsw, pcols, rrtmg_levs-1) ! stochastic cloud asymmetry parameter (optional)
real(r8) :: fsfc_stosw(nsubcsw, pcols, rrtmg_levs-1) ! stochastic cloud forward scattering fraction (optional)

real(r8), parameter :: dps = 1._r8/86400._r8 ! Inverse of seconds per day
Expand Down Expand Up @@ -247,16 +247,16 @@ subroutine rad_rrtmg_sw(lchnk,ncol ,rrtmg_levs ,r_state , &
real(r8) :: tauxcl(pcols,0:pver) ! water cloud extinction optical depth
real(r8) :: tauxci(pcols,0:pver) ! ice cloud extinction optical depth
real(r8) :: wcl(pcols,0:pver) ! liquid cloud single scattering albedo
real(r8) :: gcl(pcols,0:pver) ! liquid cloud asymetry parameter
real(r8) :: gcl(pcols,0:pver) ! liquid cloud asymmetry parameter
real(r8) :: fcl(pcols,0:pver) ! liquid cloud forward scattered fraction
real(r8) :: wci(pcols,0:pver) ! ice cloud single scattering albedo
real(r8) :: gci(pcols,0:pver) ! ice cloud asymetry parameter
real(r8) :: gci(pcols,0:pver) ! ice cloud asymmetry parameter
real(r8) :: fci(pcols,0:pver) ! ice cloud forward scattered fraction

! Aerosol radiative property arrays
real(r8) :: tauxar(pcols,0:pver) ! aerosol extinction optical depth
real(r8) :: wa(pcols,0:pver) ! aerosol single scattering albedo
real(r8) :: ga(pcols,0:pver) ! aerosol asymetry parameter
real(r8) :: ga(pcols,0:pver) ! aerosol asymmetry parameter
real(r8) :: fa(pcols,0:pver) ! aerosol forward scattered fraction

! CRM
Expand Down

0 comments on commit 773d82e

Please sign in to comment.