Skip to content

Commit

Permalink
Ca develop (NCAR#418)
Browse files Browse the repository at this point in the history
* CA updates in CCPP

* make nthresh a namelist variable

* nthresh update

* Updates to GFS_debug

* introducing closure/trigger/entrainment switches for CA applications in CCPP

* review comments vfact_ca

* pass in kdt

* updates to kdt and vfact_ca
  • Loading branch information
lisa-bengtsson authored May 4, 2020
1 parent 4944892 commit 25a72ec
Show file tree
Hide file tree
Showing 11 changed files with 285 additions and 174 deletions.
46 changes: 9 additions & 37 deletions physics/GFS_DCNV_generic.F90
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ 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, cplchm,&
isppt_deep, gu0, gv0, gt0, gq0_water_vapor, &
subroutine GFS_DCNV_generic_pre_run (im, levs, ldiag3d, do_cnvgwd, cplchm, &
gu0, gv0, gt0, gq0_water_vapor, &
save_u, save_v, save_t, save_qv, ca_deep, &
dqdti, errmsg, errflg)

Expand All @@ -27,7 +27,7 @@ subroutine GFS_DCNV_generic_pre_run (im, levs, ldiag3d, do_cnvgwd, do_ca, cplchm
implicit none

integer, intent(in) :: im, levs
logical, intent(in) :: ldiag3d, do_cnvgwd, do_ca, cplchm, isppt_deep
logical, intent(in) :: ldiag3d, do_cnvgwd, cplchm
real(kind=kind_phys), dimension(im,levs), intent(in) :: gu0
real(kind=kind_phys), dimension(im,levs), intent(in) :: gv0
real(kind=kind_phys), dimension(im,levs), intent(in) :: gt0
Expand All @@ -49,15 +49,7 @@ subroutine GFS_DCNV_generic_pre_run (im, levs, ldiag3d, do_cnvgwd, do_ca, cplchm
errmsg = ''
errflg = 0

if (do_ca) then
do k=1,levs
do i=1,im
gq0_water_vapor(i,k) = gq0_water_vapor(i,k)*(1.0 + ca_deep(i)/500.)
enddo
enddo
endif

if (ldiag3d .or. isppt_deep) then
if (ldiag3d) then
do k=1,levs
do i=1,im
save_t(i,k) = gt0(i,k)
Expand All @@ -73,7 +65,7 @@ subroutine GFS_DCNV_generic_pre_run (im, levs, ldiag3d, do_cnvgwd, do_ca, cplchm
enddo
endif

if (ldiag3d .or. cplchm .or. isppt_deep) then
if (ldiag3d .or. cplchm) then
do k=1,levs
do i=1,im
save_qv(i,k) = gq0_water_vapor(i,k)
Expand Down Expand Up @@ -102,19 +94,19 @@ end subroutine GFS_DCNV_generic_post_finalize
!> \section arg_table_GFS_DCNV_generic_post_run Argument Table
!! \htmlinclude GFS_DCNV_generic_post_run.html
!!
subroutine GFS_DCNV_generic_post_run (im, levs, lssav, ldiag3d, ras, cscnv, do_ca, &
isppt_deep, frain, rain1, dtf, cld1d, save_u, save_v, save_t, save_qv, gu0, gv0, gt0, &
subroutine GFS_DCNV_generic_post_run (im, levs, lssav, ldiag3d, ras, cscnv, &
frain, rain1, dtf, cld1d, save_u, save_v, save_t, save_qv, gu0, gv0, gt0, &
gq0_water_vapor, ud_mf, dd_mf, dt_mf, con_g, npdf3d, num_p3d, ncnvcld3d, &
rainc, cldwrk, dt3dt, dq3dt, du3dt, dv3dt, upd_mf, dwn_mf, det_mf, &
cnvw, cnvc, cnvw_phy_f3d, cnvc_phy_f3d, &
cape, tconvtend, qconvtend, uconvtend, vconvtend, errmsg, errflg)
errmsg, errflg)

use machine, only: kind_phys

implicit none

integer, intent(in) :: im, levs
logical, intent(in) :: lssav, ldiag3d, ras, cscnv, do_ca, isppt_deep
logical, intent(in) :: lssav, ldiag3d, ras, cscnv

real(kind=kind_phys), intent(in) :: frain, dtf
real(kind=kind_phys), dimension(im), intent(in) :: rain1, cld1d
Expand All @@ -135,9 +127,6 @@ subroutine GFS_DCNV_generic_post_run (im, levs, lssav, ldiag3d, ras, cscnv, do_c
! as long as these do not get used when not allocated (it is still invalid Fortran code, though).
real(kind=kind_phys), dimension(:,:), intent(inout) :: cnvw_phy_f3d, cnvc_phy_f3d

real(kind=kind_phys), dimension(im), intent(inout) :: cape
real(kind=kind_phys), dimension(im,levs), intent(inout) :: tconvtend, qconvtend, uconvtend, vconvtend

character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg

Expand All @@ -148,11 +137,6 @@ subroutine GFS_DCNV_generic_post_run (im, levs, lssav, ldiag3d, ras, cscnv, do_c
errflg = 0

if (.not. ras .and. .not. cscnv) then
if(do_ca) then
do i=1,im
cape(i) = cld1d(i)
enddo
endif
if (npdf3d == 3 .and. num_p3d == 4) then
do k=1,levs
do i=1,im
Expand Down Expand Up @@ -198,18 +182,6 @@ subroutine GFS_DCNV_generic_post_run (im, levs, lssav, ldiag3d, ras, cscnv, do_c

endif ! if (lssav)


if (isppt_deep) then
do k=1,levs
do i=1,im
tconvtend(i,k) = gt0(i,k) - save_t(i,k)
qconvtend(i,k) = gq0_water_vapor(i,k) - save_qv(i,k)
uconvtend(i,k) = gu0(i,k) - save_u(i,k)
vconvtend(i,k) = gv0(i,k) - save_v(i,k)
enddo
enddo
endif

end subroutine GFS_DCNV_generic_post_run

end module GFS_DCNV_generic_post
77 changes: 0 additions & 77 deletions physics/GFS_DCNV_generic.meta
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,6 @@
type = logical
intent = in
optional = F
[do_ca]
standard_name = flag_for_cellular_automata
long_name = cellular automata main switch
units = flag
dimensions = ()
type = logical
intent = in
optional = F
[cplchm]
standard_name = flag_for_chemistry_coupling
long_name = flag controlling cplchm collection (default off)
Expand All @@ -49,14 +41,6 @@
type = logical
intent = in
optional = F
[isppt_deep]
standard_name = flag_for_combination_of_sppt_with_isppt_deep
long_name = switch for combination with isppt_deep.
units = flag
dimensions = ()
type = logical
intent = in
optional = F
[gu0]
standard_name = x_wind_updated_by_physics
long_name = zonal wind updated by physics
Expand Down Expand Up @@ -217,22 +201,6 @@
type = logical
intent = in
optional = F
[do_ca]
standard_name = flag_for_cellular_automata
long_name = cellular automata main switch
units = flag
dimensions = ()
type = logical
intent = in
optional = F
[isppt_deep]
standard_name = flag_for_combination_of_sppt_with_isppt_deep
long_name = switch for combination with isppt_deep.
units = flag
dimensions = ()
type = logical
intent = in
optional = F
[frain]
standard_name = dynamics_to_physics_timestep_ratio
long_name = ratio of dynamics timestep to physics timestep
Expand Down Expand Up @@ -518,51 +486,6 @@
kind = kind_phys
intent = inout
optional = F
[cape]
standard_name = convective_available_potential_energy_for_coupling
long_name = convective available potential energy for coupling
units = m2 s-2
dimensions = (horizontal_dimension)
type = real
kind = kind_phys
intent = inout
optional = F
[tconvtend]
standard_name = tendency_of_air_temperature_due_to_deep_convection_for_coupling_on_physics_timestep
long_name = tendency of air temperature due to deep convection
units = K
dimensions = (horizontal_dimension,vertical_dimension)
type = real
kind = kind_phys
intent = inout
optional = F
[qconvtend]
standard_name = tendency_of_water_vapor_specific_humidity_due_to_deep_convection_for_coupling_on_physics_timestep
long_name = tendency of specific humidity due to deep convection
units = kg kg-1
dimensions = (horizontal_dimension,vertical_dimension)
type = real
kind = kind_phys
intent = inout
optional = F
[uconvtend]
standard_name = tendency_of_x_wind_due_to_deep_convection_for_coupling_on_physics_timestep
long_name = tendency_of_x_wind_due_to_deep_convection
units = m s-1
dimensions = (horizontal_dimension,vertical_dimension)
type = real
kind = kind_phys
intent = inout
optional = F
[vconvtend]
standard_name = tendency_of_y_wind_due_to_deep_convection_for_coupling_on_physics_timestep
long_name = tendency_of_y_wind_due_to_deep_convection
units = m s-1
dimensions = (horizontal_dimension,vertical_dimension)
type = real
kind = kind_phys
intent = inout
optional = F
[errmsg]
standard_name = ccpp_error_message
long_name = error message for error handling in CCPP
Expand Down
6 changes: 3 additions & 3 deletions physics/GFS_MP_generic.F90
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ subroutine GFS_MP_generic_post_run(im, ix, levs, kdt, nrcm, ncld, nncl, ntcw, nt
rann, xlat, xlon, gt0, gq0, prsl, prsi, phii, tsfc, ice, snow, graupel, save_t, save_qv, rain0, ice0, snow0, &
graupel0, del, rain, domr_diag, domzr_diag, domip_diag, doms_diag, tprcp, srflag, sr, cnvprcp, totprcp, totice, &
totsnw, totgrp, cnvprcpb, totprcpb, toticeb, totsnwb, totgrpb, dt3dt, dq3dt, rain_cpl, rainc_cpl, snow_cpl, pwat, &
do_sppt, dtdtr, dtdtc, drain_cpl, dsnow_cpl, lsm, lsm_ruc, lsm_noahmp, raincprv, rainncprv, iceprv, snowprv, &
do_sppt, ca_global, dtdtr, dtdtc, drain_cpl, dsnow_cpl, lsm, lsm_ruc, lsm_noahmp, raincprv, rainncprv, iceprv, snowprv, &
graupelprv, draincprv, drainncprv, diceprv, dsnowprv, dgraupelprv, dtp, errmsg, errflg)
!
use machine, only: kind_phys
Expand Down Expand Up @@ -114,7 +114,7 @@ subroutine GFS_MP_generic_post_run(im, ix, levs, kdt, nrcm, ncld, nncl, ntcw, nt
real(kind=kind_phys), dimension(:,:), intent(inout) :: dt3dt, dq3dt

! Stochastic physics / surface perturbations
logical, intent(in) :: do_sppt
logical, intent(in) :: do_sppt, ca_global
real(kind=kind_phys), dimension(im,levs), intent(inout) :: dtdtr
real(kind=kind_phys), dimension(im,levs), intent(in) :: dtdtc
real(kind=kind_phys), dimension(im), intent(inout) :: drain_cpl
Expand Down Expand Up @@ -375,7 +375,7 @@ subroutine GFS_MP_generic_post_run(im, ix, levs, kdt, nrcm, ncld, nncl, ntcw, nt
enddo

! Stochastic physics / surface perturbations
if (do_sppt) then
if (do_sppt .or. ca_global) then
!--- radiation heating rate
dtdtr(1:im,:) = dtdtr(1:im,:) + dtdtc(1:im,:)*dtf
endif
Expand Down
8 changes: 8 additions & 0 deletions physics/GFS_MP_generic.meta
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,14 @@
type = logical
intent = in
optional = F
[ca_global]
standard_name = flag_for_global_cellular_automata
long_name = switch for global ca
units = flag
dimensions = ()
type = logical
intent = in
optional = F
[dtdtr]
standard_name = tendency_of_air_temperature_due_to_radiative_heating_on_physics_time_step
long_name = temp. change due to radiative heating per time step
Expand Down
7 changes: 1 addition & 6 deletions physics/GFS_debug.F90
Original file line number Diff line number Diff line change
Expand Up @@ -478,17 +478,12 @@ subroutine GFS_diagtoscreen_run (Model, Statein, Stateout, Sfcprop, Coupling,
call print_var(mpirank,omprank, blkno, 'Coupling%sfc_wts' , Coupling%sfc_wts )
end if
if (Model%do_ca) then
call print_var(mpirank,omprank, blkno, 'Coupling%tconvtend', Coupling%tconvtend )
call print_var(mpirank,omprank, blkno, 'Coupling%qconvtend', Coupling%qconvtend )
call print_var(mpirank,omprank, blkno, 'Coupling%uconvtend', Coupling%uconvtend )
call print_var(mpirank,omprank, blkno, 'Coupling%vconvtend', Coupling%vconvtend )
call print_var(mpirank,omprank, blkno, 'Coupling%ca_out ', Coupling%ca_out )
call print_var(mpirank,omprank, blkno, 'Coupling%ca1 ', Coupling%ca1 )
call print_var(mpirank,omprank, blkno, 'Coupling%ca_deep ', Coupling%ca_deep )
call print_var(mpirank,omprank, blkno, 'Coupling%ca_turb ', Coupling%ca_turb )
call print_var(mpirank,omprank, blkno, 'Coupling%ca_shal ', Coupling%ca_shal )
call print_var(mpirank,omprank, blkno, 'Coupling%ca_rad ', Coupling%ca_rad )
call print_var(mpirank,omprank, blkno, 'Coupling%ca_micro ', Coupling%ca_micro )
call print_var(mpirank,omprank, blkno, 'Coupling%cape ', Coupling%cape )
end if
if(Model%imp_physics == Model%imp_physics_thompson .and. Model%ltaerosol) then
call print_var(mpirank,omprank, blkno, 'Coupling%nwfa2d', Coupling%nwfa2d)
Expand Down
Loading

0 comments on commit 25a72ec

Please sign in to comment.