Skip to content

Commit

Permalink
Number Concentrated code moved to interstitial code
Browse files Browse the repository at this point in the history
  • Loading branch information
hannahcbarnes committed Jan 6, 2020
1 parent 4eaa560 commit 1c6cad5
Show file tree
Hide file tree
Showing 6 changed files with 125 additions and 114 deletions.
20 changes: 15 additions & 5 deletions physics/GFS_DCNV_generic.F90
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,17 @@ end subroutine GFS_DCNV_generic_pre_finalize
!! \htmlinclude GFS_DCNV_generic_pre_run.html
!!
#endif
subroutine GFS_DCNV_generic_pre_run (im, levs, ldiag3d, do_cnvgwd, do_ca, &
isppt_deep, gu0, gv0, gt0, gq0_water_vapor, &
save_u, save_v, save_t, save_qv, ca_deep, &
errmsg, errflg)
subroutine GFS_DCNV_generic_pre_run (im, levs, ldiag3d, do_cnvgwd, do_ca, &
isppt_deep, imp_physics, imp_physics_thompson, &
gu0, gv0, gt0, gq0_water_vapor, &
save_u, save_v, save_t, save_tcp, save_qv, &
ca_deep, errmsg, errflg)

use machine, only: kind_phys

implicit none

integer, intent(in) :: im, levs
integer, intent(in) :: im, levs, imp_physics, imp_physics_thompson
logical, intent(in) :: ldiag3d, do_cnvgwd, do_ca, isppt_deep
real(kind=kind_phys), dimension(im,levs), intent(in) :: gu0
real(kind=kind_phys), dimension(im,levs), intent(in) :: gv0
Expand All @@ -35,6 +36,7 @@ subroutine GFS_DCNV_generic_pre_run (im, levs, ldiag3d, do_cnvgwd, do_ca,
real(kind=kind_phys), dimension(im,levs), intent(inout) :: save_u
real(kind=kind_phys), dimension(im,levs), intent(inout) :: save_v
real(kind=kind_phys), dimension(im,levs), intent(inout) :: save_t
real(kind=kind_phys), dimension(im,levs), intent(out), optional :: save_tcp
real(kind=kind_phys), dimension(im,levs), intent(inout) :: save_qv
real(kind=kind_phys), dimension(im), intent(in) :: ca_deep
character(len=*), intent(out) :: errmsg
Expand Down Expand Up @@ -70,6 +72,14 @@ subroutine GFS_DCNV_generic_pre_run (im, levs, ldiag3d, do_cnvgwd, do_ca,
enddo
endif

if (imp_physics == imp_physics_thompson) then
do k=1,levs
do i=1,im
save_tcp(i,k) = gt0(i,k)
enddo
enddo
endif

if (ldiag3d .or. isppt_deep) then
do k=1,levs
do i=1,im
Expand Down
25 changes: 25 additions & 0 deletions physics/GFS_DCNV_generic.meta
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,22 @@
type = logical
intent = in
optional = F
[imp_physics]
standard_name = flag_for_microphysics_scheme
long_name = choice of microphysics scheme
units = flag
dimensions = ()
type = integer
intent = in
optional = F
[imp_physics_thompson]
standard_name = flag_for_thompson_microphysics_scheme
long_name = choice of Thompson microphysics scheme
units = flag
dimensions = ()
type = integer
intent = in
optional = F
[gu0]
standard_name = x_wind_updated_by_physics
long_name = zonal wind updated by physics
Expand Down Expand Up @@ -112,6 +128,15 @@
kind = kind_phys
intent = inout
optional = F
[save_tcp]
standard_name = air_temperature_save_from_cumulus_paramterization
long_name = air temperature after cumulus parameterization
units = K
dimensions = (horizontal_dimension,vertical_dimension)
type = real
kind = kind_phys
intent = out
optional = T
[save_qv]
standard_name = water_vapor_specific_humidity_save
long_name = water vapor specific humidity before entering a physics scheme
Expand Down
64 changes: 40 additions & 24 deletions physics/GFS_suite_interstitial.F90
Original file line number Diff line number Diff line change
Expand Up @@ -662,9 +662,10 @@ end subroutine GFS_suite_interstitial_4_finalize
subroutine GFS_suite_interstitial_4_run (im, levs, ltaerosol, cplchm, tracers_total, ntrac, ntcw, ntiw, ntclamt, &
ntrw, ntsw, ntrnc, ntsnc, ntgl, ntgnc, ntlnc, ntinc, nn, imp_physics, imp_physics_gfdl, imp_physics_thompson, &
imp_physics_zhao_carr, imp_physics_zhao_carr_pdf, dtf, save_qc, save_qi, con_pi, &
gq0, clw, dqdti, imfdeepcnv, imfdeepcnv_gf, errmsg, errflg)
gq0, clw, prsl, save_tcp, con_rd, nwfa, spechum, dqdti, imfdeepcnv, imfdeepcnv_gf, errmsg, errflg)

use machine, only: kind_phys
use module_mp_thompson_make_number_concentrations, only: make_IceNumber, make_DropletNumber

implicit none

Expand All @@ -683,6 +684,11 @@ subroutine GFS_suite_interstitial_4_run (im, levs, ltaerosol, cplchm, tracers_to

real(kind=kind_phys), dimension(im,levs,ntrac), intent(inout) :: gq0
real(kind=kind_phys), dimension(im,levs,nn), intent(inout) :: clw
real(kind=kind_phys), dimension(im,levs), intent(in) :: prsl
real(kind=kind_phys), intent(in) :: con_rd
real(kind=kind_phys), dimension(im,levs), intent(in), optional :: nwfa, save_tcp
real(kind=kind_phys), dimension(im,levs), intent(in) :: spechum

! dqdti may not be allocated
real(kind=kind_phys), dimension(:,:), intent(inout) :: dqdti

Expand All @@ -693,10 +699,12 @@ subroutine GFS_suite_interstitial_4_run (im, levs, ltaerosol, cplchm, tracers_to
! local variables
integer :: i,k,n,tracers

real(kind=kind_phys) :: liqm, icem

liqm = 4./3.*con_pi*1.e-12
icem = 4./3.*con_pi*3.2768*1.e-14*890.
real(kind=kind_phys), dimension(im,levs) :: rho_dryar
real(kind=kind_phys), dimension(im,levs) :: qv_mp !< kg kg-1 (dry mixing ratio)
real(kind=kind_phys), dimension(im,levs) :: qc_mp !< kg kg-1 (dry mixing ratio)
real(kind=kind_phys), dimension(im,levs) :: qi_mp !< kg kg-1 (dry mixing ratio)
real(kind=kind_phys), dimension(im,levs) :: nc_mp !< kg-1 (dry mixing ratio)
real(kind=kind_phys), dimension(im,levs) :: ni_mp !< kg-1 (dry mixing ratio)

! Initialize CCPP error handling variables
errmsg = ''
Expand Down Expand Up @@ -729,32 +737,39 @@ subroutine GFS_suite_interstitial_4_run (im, levs, ltaerosol, cplchm, tracers_to
imp_physics == imp_physics_zhao_carr_pdf .or. &
imp_physics == imp_physics_gfdl) then
gq0(1:im,:,ntcw) = clw(1:im,:,1) + clw(1:im,:,2)

elseif (ntiw > 0) then
do k=1,levs
do i=1,im
gq0(i,k,ntiw) = clw(i,k,1) ! ice
gq0(i,k,ntcw) = clw(i,k,2) ! water
enddo
enddo
! if (imp_physics == imp_physics_thompson) then
if (imp_physics == imp_physics_thompson .and. imfdeepcnv /= imfdeepcnv_gf) then
if (ltaerosol) then
do k=1,levs
do i=1,im
gq0(i,k,ntlnc) = gq0(i,k,ntlnc) &
+ max(0.0, (clw(i,k,2)-save_qc(i,k))) / liqm
gq0(i,k,ntinc) = gq0(i,k,ntinc) &
+ max(0.0, (clw(i,k,1)-save_qi(i,k))) / icem
enddo
enddo
else
do k=1,levs
do i=1,im
gq0(i,k,ntinc) = gq0(i,k,ntinc) &
+ max(0.0, (clw(i,k,1)-save_qi(i,k))) / icem
enddo
enddo
endif

if (imp_physics == imp_physics_thompson) then
do k=1,levs
do i=1,im
!> - Density of air in kg m-3
rho_dryar(i,k) = prsl(i,k)/(con_rd*save_tcp(i,k))

!> - Convert specific humidity/moist mixing ratios to dry mixing ratios
qv_mp(i,k) = spechum(i,k)/(1.0_kind_phys-spechum(i,k))
qc_mp(i,k) = save_qc(i,k)/(1.0_kind_phys-spechum(i,k))
qi_mp(i,k) = save_qi(i,k)/(1.0_kind_phys-spechum(i,k))

!> - Convert number concentrations from moist to dry
nc_mp(i,k) = gq0(i,k,ntlnc)/(1.0_kind_phys-spechum(i,k))
ni_mp(i,k) = gq0(i,k,ntinc)/(1.0_kind_phys-spechum(i,k))


nc_mp(i,k) = nc_mp(i,k) + max(0.0, make_DropletNumber(qc_mp(i,k) * rho_dryar(i,k), nwfa(i,k)) * (1.0/rho_dryar(i,k)))
ni_mp(i,k) = ni_mp(i,k) + max(0.0, make_IceNumber(qi_mp(i,k) * rho_dryar(i,k), save_tcp(i,k)) * (1.0/rho_dryar(i,k)))

!> - Convert number concentrations from dry to moist
gq0(i,k,ntlnc) = nc_mp(i,k)/(1.0_kind_phys+qv_mp(i,k))
gq0(i,k,ntinc) = ni_mp(i,k)/(1.0_kind_phys+qv_mp(i,k))
enddo
enddo
endif

else
Expand All @@ -764,6 +779,7 @@ subroutine GFS_suite_interstitial_4_run (im, levs, ltaerosol, cplchm, tracers_to
enddo
enddo
endif ! end if_ntiw

else
do k=1,levs
do i=1,im
Expand Down
45 changes: 45 additions & 0 deletions physics/GFS_suite_interstitial.meta
Original file line number Diff line number Diff line change
Expand Up @@ -1692,6 +1692,51 @@
kind = kind_phys
intent = inout
optional = F
[prsl]
standard_name = air_pressure
long_name = mean layer pressure
units = Pa
dimensions = (horizontal_dimension,vertical_dimension)
type = real
kind = kind_phys
intent = in
optional = F
[save_tcp]
standard_name = air_temperature_save_from_cumulus_paramterization
long_name = air temperature after cumulus parameterization
units = K
dimensions = (horizontal_dimension,vertical_dimension)
type = real
kind = kind_phys
intent = in
optional = T
[con_rd]
standard_name = gas_constant_dry_air
long_name = ideal gas constant for dry air
units = J kg-1 K-1
dimensions = ()
type = real
kind = kind_phys
intent = in
optional = F
[nwfa]
standard_name = water_friendly_aerosol_number_concentration
long_name = number concentration of water-friendly aerosols
units = kg-1
dimensions = (horizontal_dimension,vertical_dimension)
type = real
kind = kind_phys
intent = in
optional = T
[spechum]
standard_name = water_vapor_specific_humidity
long_name = water vapor specific humidity
units = kg kg-1
dimensions = (horizontal_dimension,vertical_dimension)
type = real
kind = kind_phys
intent = inout
optional = F
[dqdti]
standard_name = instantaneous_water_vapor_specific_humidity_tendency_due_to_convection
long_name = instantaneous moisture tendency due to convection
Expand Down
26 changes: 0 additions & 26 deletions physics/cu_gf_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ module cu_gf_driver
use machine , only: kind_phys
use cu_gf_deep, only: cu_gf_deep_run,neg_check,autoconv,aeroevap,fct1d3
use cu_gf_sh , only: cu_gf_sh_run
use module_mp_thompson_make_number_concentrations, only: make_IceNumber, make_DropletNumber

implicit none

Expand Down Expand Up @@ -74,7 +73,6 @@ subroutine cu_gf_driver_run(ntracer,garea,im,ix,km,dt,cactiv, &
us,vs,t2di,w,qv2di_spechum,p2di,psuri, &
hbot,htop,kcnv,xland,hfx2,qfx2,cliw,clcw, &
pbl,ud_mf,dd_mf,dt_mf,cnvw_moist,cnvc,imfshalcnv, &
nwfa,con_rd,gq0,ntinc,ntlnc,imp_physics,imp_physics_thompson, &
errmsg,errflg)
!-------------------------------------------------------------
implicit none
Expand Down Expand Up @@ -126,12 +124,6 @@ subroutine cu_gf_driver_run(ntracer,garea,im,ix,km,dt,cactiv, &
real(kind=kind_phys), dimension( im ),intent(in) :: garea
real(kind=kind_phys), intent(in ) :: dt

! additional variables for number concentrations
real(kind=kind_phys), intent(in) :: nwfa(1:im,1:km)
real(kind=kind_phys), intent(in) :: con_rd
real(kind=kind_phys), dimension(im,km,ntracer), intent(inout) :: gq0
integer, intent(in) :: imp_physics,imp_physics_thompson,ntlnc,ntinc

integer, intent(in ) :: imfshalcnv
character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg
Expand Down Expand Up @@ -826,26 +818,8 @@ subroutine cu_gf_driver_run(ntracer,garea,im,ix,km,dt,cactiv, &
cliw(i,k) = max(0.,cliw(i,k) + tem)
endif

!
!> calculate cloud water and cloud ice number concentrations
!
rho_dryar(i,k) = p2di(i,k)/(con_rd*t(i,k)) ! Density of dry air in kg m-3
if (imp_physics == imp_physics_thompson) then
if ((tem*tem1)>1.e-5) then
gq0(i,k,ntinc) = max(0., gq0(i,k,ntinc) + &
make_IceNumber(tem*tem1*rho_dryar(i,k), t(i,k)) * &
(1/rho_dryar(i,k)))
end if
if ((tem*(1-tem1))>1.e-5) then
gq0(i,k,ntlnc) = max(0., gq0(i,k,ntlnc) + &
make_DropletNumber(tem*(1-tem1)*rho_dryar(i,k), nwfa(i,k)) &
* (1/rho_dryar(i,k)))
end if
end if

enddo


gdc(i,1,10)=forcing(i,1)
gdc(i,2,10)=forcing(i,2)
gdc(i,3,10)=forcing(i,3)
Expand Down
59 changes: 0 additions & 59 deletions physics/cu_gf_driver.meta
Original file line number Diff line number Diff line change
Expand Up @@ -358,65 +358,6 @@
type = integer
intent = in
optional = F
[nwfa]
standard_name = water_friendly_aerosol_number_concentration
long_name = number concentration of water-friendly aerosols
units = kg-1
dimensions = (horizontal_dimension,vertical_dimension)
type = real
kind = kind_phys
intent = in
optional = F
[con_rd]
standard_name = gas_constant_dry_air
long_name = ideal gas constant for dry air
units = J kg-1 K-1
dimensions = ()
type = real
kind = kind_phys
intent = in
optional = F
[gq0]
standard_name = tracer_concentration_updated_by_physics
long_name = tracer concentration updated by physics
units = kg kg-1
dimensions = (horizontal_dimension,vertical_dimension,number_of_tracers)
type = real
kind = kind_phys
intent = inout
optional = F
[ntinc]
standard_name = index_for_ice_cloud_number_concentration
long_name = tracer index for ice number concentration
units = index
dimensions = ()
type = integer
intent = in
optional = F
[ntlnc]
standard_name = index_for_liquid_cloud_number_concentration
long_name = tracer index for liquid number concentration
units = index
dimensions = ()
type = integer
intent = in
optional = F
[imp_physics]
standard_name = flag_for_microphysics_scheme
long_name = choice of microphysics scheme
units = flag
dimensions = ()
type = integer
intent = in
optional = F
[imp_physics_thompson]
standard_name = flag_for_thompson_microphysics_scheme
long_name = choice of Thompson microphysics scheme
units = flag
dimensions = ()
type = integer
intent = in
optional = F
[errmsg]
standard_name = ccpp_error_message
long_name = error message for error handling in CCPP
Expand Down

0 comments on commit 1c6cad5

Please sign in to comment.