Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for CALIPSO simulator and MG precipitation fluxes #1333

Merged
merged 2 commits into from
Apr 20, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions components/cam/src/physics/cam/cospsimulator_intr.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2456,6 +2456,32 @@ subroutine cospsimulator_intr_run(state,pbuf, cam_in,emis,coszrs,cliqwp_in,cicew
reff_cosp(1:ncol,1:pver,8) = 0._r8
end where

! reset negative values to avoid COSP warning
where (rel(1:ncol,1:pver) .lt. 0.0_r8)
reff_cosp(1:ncol,1:pver,1) = 0.0_r8
end where
where (rei(1:ncol,1:pver) .lt. 0.0_r8)
reff_cosp(1:ncol,1:pver,2) = 0.0_r8
end where
where (ls_reffrain(1:ncol,1:pver) .lt. 0.0_r8)
reff_cosp(1:ncol,1:pver,3) = 0.0_r8
end where
where (ls_reffsnow(1:ncol,1:pver) .lt. 0.0_r8)
reff_cosp(1:ncol,1:pver,4) = 0.0_r8
end where
where (cv_reffliq(1:ncol,1:pver) .lt. 0.0_r8)
reff_cosp(1:ncol,1:pver,5) = 0.0_r8
end where
where (cv_reffice(1:ncol,1:pver) .lt. 0.0_r8)
reff_cosp(1:ncol,1:pver,6) = 0.0_r8
end where
where (ls_reffrain(1:ncol,1:pver) .lt. 0.0_r8)
reff_cosp(1:ncol,1:pver,7) = 0.0_r8
end where
where (ls_reffsnow(1:ncol,1:pver) .lt. 0.0_r8)
reff_cosp(1:ncol,1:pver,8) = 0.0_r8
end where

end if !!if cam5

!! Make sure interpolated values are not less than 0 - COSP was complaining and resetting small negative values to zero.
Expand Down
32 changes: 25 additions & 7 deletions components/cam/src/physics/cam/micro_mg2_0.F90
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ subroutine micro_mg_tend ( &
cmeout, deffi, &
pgamrad, lamcrad, &
qsout, dsout, &
lflx, iflx, &
rflx, sflx, qrout, &
reff_rain, reff_snow, &
qcsevap, qisevap, qvres, &
Expand Down Expand Up @@ -501,6 +502,8 @@ subroutine micro_mg_tend ( &
real(r8), intent(out) :: lamcrad(:,:) ! slope of droplet distribution for optics (radiation) (1/m)
real(r8), intent(out) :: qsout(:,:) ! snow mixing ratio (kg/kg)
real(r8), intent(out) :: dsout(:,:) ! snow diameter (m)
real(r8), intent(out) :: lflx(:,:) ! grid-box average liquid condensate flux (kg m^-2 s^-1)
real(r8), intent(out) :: iflx(:,:) ! grid-box average ice condensate flux (kg m^-2 s^-1)
real(r8), intent(out) :: rflx(:,:) ! grid-box average rain flux (kg m^-2 s^-1)
real(r8), intent(out) :: sflx(:,:) ! grid-box average snow flux (kg m^-2 s^-1)
real(r8), intent(out) :: qrout(:,:) ! grid-box average rain mixing ratio (kg/kg)
Expand Down Expand Up @@ -951,6 +954,8 @@ subroutine micro_mg_tend ( &

rflx=0._r8
sflx=0._r8
lflx=0._r8
iflx=0._r8

! initialize precip output

Expand Down Expand Up @@ -1950,13 +1955,6 @@ subroutine micro_mg_tend ( &
qsout = qs
nsout = ns * rho

! calculate precip fluxes
! calculate the precip flux (kg/m2/s) as mixingratio(kg/kg)*airdensity(kg/m3)*massweightedfallspeed(m/s)
! ---------------------------------------------------------------------

rflx(:,2:) = rflx(:,2:) + (qric*rho*umr*precip_frac)
sflx(:,2:) = sflx(:,2:) + (qsic*rho*ums*precip_frac)

! calculate n0r and lamr from rain mass and number
! divide by precip fraction to get in-precip (local) values of
! rain mass and number, divide by rhow to get rain number in kg^-1
Expand Down Expand Up @@ -2217,6 +2215,11 @@ subroutine micro_mg_tend ( &

end do

! Ice flux
do k = 1,nlev
iflx(i,k+1) = iflx(i,k+1) + falouti(k) / g / real(nstep)
end do

! units below are m/s
! sedimentation flux at surface is added to precip flux at surface
! to get total precip (cloud + precip water) rate
Expand Down Expand Up @@ -2283,6 +2286,11 @@ subroutine micro_mg_tend ( &

end do

!Liquid condensate flux here
do k = 1,nlev
lflx(i,k+1) = lflx(i,k+1) + faloutc(k) / g / real(nstep)
end do

prect(i) = prect(i)+faloutc(nlev)/g/real(nstep)/1000._r8

end do
Expand Down Expand Up @@ -2334,6 +2342,11 @@ subroutine micro_mg_tend ( &

end do

! Rain Flux
do k = 1,nlev
rflx(i,k+1) = rflx(i,k+1) + faloutr(k) / g / real(nstep)
end do

prect(i) = prect(i)+faloutr(nlev)/g/real(nstep)/1000._r8

end do
Expand Down Expand Up @@ -2385,6 +2398,11 @@ subroutine micro_mg_tend ( &

end do !! k loop

! Snow Flux
do k = 1,nlev
sflx(i,k+1) = sflx(i,k+1) + falouts(k) / g / real(nstep)
end do

prect(i) = prect(i)+falouts(nlev)/g/real(nstep)/1000._r8
preci(i) = preci(i)+falouts(nlev)/g/real(nstep)/1000._r8

Expand Down
37 changes: 37 additions & 0 deletions components/cam/src/physics/cam/micro_mg_cam.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1120,6 +1120,8 @@ subroutine micro_mg_cam_tend(state, ptend, dtime, pbuf)
real(r8), target :: prodsnow(state%psetcols,pver) ! Local production of snow
real(r8), target :: cmeice(state%psetcols,pver) ! Rate of cond-evap of ice within the cloud
real(r8), target :: qsout(state%psetcols,pver) ! Snow mixing ratio
real(r8), target :: cflx(state%psetcols,pverp) ! grid-box avg liq condensate flux (kg m^-2 s^-1)
real(r8), target :: iflx(state%psetcols,pverp) ! grid-box avg ice condensate flux (kg m^-2 s^-1)
real(r8), target :: rflx(state%psetcols,pverp) ! grid-box average rain flux (kg m^-2 s^-1)
real(r8), target :: sflx(state%psetcols,pverp) ! grid-box average snow flux (kg m^-2 s^-1)
real(r8), target :: qrout(state%psetcols,pver) ! Rain mixing ratio
Expand Down Expand Up @@ -1246,6 +1248,8 @@ subroutine micro_mg_cam_tend(state, ptend, dtime, pbuf)
real(r8), allocatable, target :: packed_prodsnow(:,:)
real(r8), allocatable, target :: packed_cmeout(:,:)
real(r8), allocatable, target :: packed_qsout(:,:)
real(r8), allocatable, target :: packed_cflx(:,:)
real(r8), allocatable, target :: packed_iflx(:,:)
real(r8), allocatable, target :: packed_rflx(:,:)
real(r8), allocatable, target :: packed_sflx(:,:)
real(r8), allocatable, target :: packed_qrout(:,:)
Expand Down Expand Up @@ -1817,6 +1821,10 @@ subroutine micro_mg_cam_tend(state, ptend, dtime, pbuf)
call post_proc%add_field(p(cmeice), p(packed_cmeout))
allocate(packed_qsout(mgncol,nlev))
call post_proc%add_field(p(qsout), p(packed_qsout))
allocate(packed_cflx(mgncol,nlev+1))
call post_proc%add_field(p(cflx), p(packed_cflx))
allocate(packed_iflx(mgncol,nlev+1))
call post_proc%add_field(p(iflx), p(packed_iflx))
allocate(packed_rflx(mgncol,nlev+1))
call post_proc%add_field(p(rflx), p(packed_rflx))
allocate(packed_sflx(mgncol,nlev+1))
Expand Down Expand Up @@ -2144,6 +2152,7 @@ subroutine micro_mg_cam_tend(state, ptend, dtime, pbuf)
packed_cmeout, packed_dei, &
packed_mu, packed_lambdac, &
packed_qsout, packed_des, &
packed_cflx, packed_iflx, &
packed_rflx, packed_sflx, packed_qrout, &
reff_rain_dum, reff_snow_dum, &
packed_qcsevap, packed_qisevap, packed_qvres, &
Expand Down Expand Up @@ -2264,14 +2273,41 @@ subroutine micro_mg_cam_tend(state, ptend, dtime, pbuf)
end do
end do

! array must be zeroed beyond trop_cloud_top_pre otherwise undefined values will be used in cosp.
mgflxprc(:ncol,1:top_lev) = 0.0_r8
mgflxsnw(:ncol,1:top_lev) = 0.0_r8

mgflxprc(:ncol,top_lev:pverp) = rflx(:ncol,top_lev:pverp) + sflx(:ncol,top_lev:pverp)
mgflxsnw(:ncol,top_lev:pverp) = sflx(:ncol,top_lev:pverp)

! mgflxprc and mgflxsnw are used in COSP to compulate precipitation fractional
! area and derive precipitation (rain and snow) mixing ratios. Including iflx and cflx
! in precipitation fluxes would result in additional effects of cloud liquid and ice
! on cosp's smiluated lidar and radar reflectivity signal through the rain/snow
! portion of calculations that are handled separately from that of cloud liquid and ice.
! If included, it would not exactly amount to double counting the effect of cloud liquid and ice
! because the mixing ratio derived from iflx and cflx epected to be much smaller than
! the actual grid-mean cldliq and cldice, and rain or snow size distribution
! would be used to compute the lidar/radar signal strength.
!
! Note that it would need to include iflx and cflx to make the values at surface interface
! consistent with large scale precipitation rates.

! rain and snow species.
!
!ADD CONDENSATE FLUXES FOR MG2 (ice and snow already added for MG1)
! if (micro_mg_version .ge. 2) then
! mgflxprc(:ncol,top_lev:pverp) = mgflxprc(:ncol,top_lev:pverp) + iflx(:ncol,top_lev:pverp) + cflx(:ncol,top_lev:pverp)
! mgflxsnw(:ncol,top_lev:pverp) = mgflxsnw(:ncol,top_lev:pverp) + iflx(:ncol,top_lev:pverp)
! end if

mgmrprc(:ncol,top_lev:pver) = qrout(:ncol,top_lev:pver) + qsout(:ncol,top_lev:pver)
mgmrsnw(:ncol,top_lev:pver) = qsout(:ncol,top_lev:pver)

!! calculate effective radius of convective liquid and ice using dcon and deicon (not used by code, not useful for COSP)
!! hard-coded as average of hard-coded values used for deep/shallow convective detrainment (near line 1502/1505)
! this needs to be replaced by clubb_liq_deep and clubb_ice+deep accordingly

cvreffliq(:ncol,top_lev:pver) = 9.0_r8
cvreffice(:ncol,top_lev:pver) = 37.0_r8

Expand Down Expand Up @@ -2358,6 +2394,7 @@ subroutine micro_mg_cam_tend(state, ptend, dtime, pbuf)
cldfsnow(i,k) = 0.25_r8
endif
endif

! Calculate in-cloud snow water path
icswp(i,k) = qsout(i,k) / max( mincld, cldfsnow(i,k) ) * state_loc%pdel(i,k) / gravit
end do
Expand Down