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

Merge radar_tten support for the tenth time. #119

Closed
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
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
branch = main
[submodule "ccpp/physics"]
path = ccpp/physics
url = https://github.com/NOAA-GSL/ccpp-physics
branch = gsl/develop
url = https://github.com/SamuelTrahanNOAA/ccpp-physics
branch = feature/gsl-develop-20211203-radar-tten
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This points to your branch. Is this intended? If Yes, you will change this later, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. You have to do this until a merge so people can clone your branch from the ufs-weather-model level.

99 changes: 91 additions & 8 deletions ccpp/data/GFS_typedefs.F90
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,12 @@ module GFS_typedefs
real(kind=kind_phys) :: tf
real(kind=kind_phys) :: tcr
real(kind=kind_phys) :: tcrf
!
!
integer :: num_dfi_radar !< number of timespans with radar-prescribed temperature tendencies
real (kind=kind_phys) :: fh_dfi_radar(5) !< begin+end of timespans to receive radar-prescribed temperature tendencies
real (kind=kind_phys) :: radar_tten_limits(2) !< radar_tten values outside this range (min,max) are discarded
integer :: ix_dfi_radar(4) = -1 !< Index within dfi_radar_tten of each timespan (-1 means "none")
!
logical :: effr_in !< eg to turn on ffective radii for MG
logical :: microp_uniform
logical :: do_cldliq
Expand Down Expand Up @@ -1192,6 +1197,7 @@ module GFS_typedefs
integer :: index_of_process_conv_trans !< tracer changes caused by convective transport
integer :: index_of_process_physics !< tracer changes caused by physics schemes
integer :: index_of_process_non_physics !< tracer changes caused by everything except physics schemes
integer :: index_of_process_dfi_radar !< tracer changes caused by radar mp temperature tendency forcing
integer :: index_of_process_photochem !< all changes to ozone
logical, pointer :: is_photochem(:) => null()!< flags for which processes should be summed as photochemical

Expand Down Expand Up @@ -1449,6 +1455,9 @@ module GFS_typedefs
real (kind=kind_phys), pointer :: phy_myj_a1t(:) => null() !
real (kind=kind_phys), pointer :: phy_myj_a1q(:) => null() !

!--- DFI Radar
real (kind=kind_phys), pointer :: dfi_radar_tten(:,:,:) => null() !

contains
procedure :: create => tbd_create !< allocate array data
end type GFS_tbd_type
Expand Down Expand Up @@ -3188,7 +3197,7 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
logical :: mg_do_hail = .false. !< set .true. to turn on prognostic hail (with fprcp=2)
logical :: mg_do_ice_gmao = .false. !< set .true. to turn on gmao ice formulation
logical :: mg_do_liq_liu = .true. !< set .true. to turn on liu liquid treatment

real(kind=kind_phys) :: fh_dfi_radar(5) = -2e10 !< begin&end of four timespans over which radar_tten is applied

!--- Thompson microphysical parameters
logical :: ltaerosol = .false. !< flag for aerosol version
Expand Down Expand Up @@ -3526,6 +3535,10 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
integer, parameter :: max_scav_factors = 25
character(len=40) :: fscav_aero(max_scav_factors)

real(kind=kind_phys), parameter :: limit_unspecified = 1e12
real(kind=kind_phys) :: radar_tten_limits(2) = (/ limit_unspecified, limit_unspecified /)
integer :: itime

!--- END NAMELIST VARIABLES

NAMELIST /gfs_physics_nml/ &
Expand Down Expand Up @@ -3646,7 +3659,9 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
max_lon, max_lat, min_lon, min_lat, rhcmax, huge, &
phys_version, &
!--- aerosol scavenging factors ('name:value' string array)
fscav_aero
fscav_aero, &
!--- (DFI) time ranges with radar-prescribed microphysics tendencies
fh_dfi_radar, radar_tten_limits

!--- other parameters
integer :: nctp = 0 !< number of cloud types in CS scheme
Expand Down Expand Up @@ -3720,6 +3735,49 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
Model%flag_for_scnv_generic_tend = .true.
Model%flag_for_dcnv_generic_tend = .true.

Model%fh_dfi_radar = fh_dfi_radar
Model%num_dfi_radar = 0

do i=1,4
if(fh_dfi_radar(i)>-1e10 .and. fh_dfi_radar(i+1)>-1e10) then
Model%num_dfi_radar = Model%num_dfi_radar+1
Model%ix_dfi_radar(i) = Model%num_dfi_radar
else
Model%ix_dfi_radar(i) = -1
endif
enddo

if(Model%num_dfi_radar>0) then
if(radar_tten_limits(1)==limit_unspecified) then
if(radar_tten_limits(2)==limit_unspecified) then
radar_tten_limits(1) = -19
radar_tten_limits(2) = 19
if(Model%me==Model%master) then
write(0,*) 'Warning: using internal defaults for radar_tten_limits. If the oceans boil, try different values.'
write(0,'(A,F12.4,A)') 'radar_tten_limits(1) = ',radar_tten_limits(1),' <-- lower limit'
write(0,'(A,F12.4,A)') 'radar_tten_limits(2) = ',radar_tten_limits(2),' <-- upper limit'
endif
else
radar_tten_limits(1) = -abs(radar_tten_limits(2))
radar_tten_limits(2) = abs(radar_tten_limits(2))
endif
else if(radar_tten_limits(2)==limit_unspecified) then
radar_tten_limits(1) = -abs(radar_tten_limits(1))
radar_tten_limits(2) = abs(radar_tten_limits(1))
else if(radar_tten_limits(1)>radar_tten_limits(2)) then
if(Model%me==Model%master) then
write(0,*) 'Error: radar_tten_limits lower limit is higher than upper!'
write(0,'(A,F12.4,A)') 'radar_tten_limits(1) = ',radar_tten_limits(1),' <-- lower limit'
write(0,'(A,F12.4,A)') 'radar_tten_limits(2) = ',radar_tten_limits(2),' <-- upper limit'
write(0,*) "If you do not want me to apply the prescribed tendencies, just say so! Remove fh_dfi_radar from your namelist."
stop
endif
else
!o! Rejoice !o! Radar_tten_limits had lower and upper bounds.
endif
Model%radar_tten_limits = radar_tten_limits
endif

if(gwd_opt==1) then
if(me==master) &
write(0,*) 'FLAG: gwd_opt==1 so gwd not generic'
Expand Down Expand Up @@ -4489,17 +4547,18 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
Model%index_of_process_rayleigh_damping = 12
Model%index_of_process_nonorographic_gwd = 13
Model%index_of_process_conv_trans = 14
Model%index_of_process_dfi_radar = 15

! Number of processes to sum (last index of prior set)
Model%nprocess_summed = 14
Model%nprocess_summed = Model%index_of_process_dfi_radar

! Sums of other processes, which must be after nprocess_summed:
Model%index_of_process_physics = 15
Model%index_of_process_non_physics = 16
Model%index_of_process_photochem = 17
Model%index_of_process_physics = Model%nprocess_summed+1
Model%index_of_process_non_physics = Model%nprocess_summed+2
Model%index_of_process_photochem = Model%nprocess_summed+3

! Total number of processes (last index of prior set)
Model%nprocess = 17
Model%nprocess = Model%index_of_process_photochem

! List which processes should be summed as photochemical:
allocate(Model%is_photochem(Model%nprocess))
Expand Down Expand Up @@ -4614,6 +4673,7 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
call label_dtend_cause(Model,Model%index_of_process_ozmix,'o3mix','tendency due to ozone mixing ratio')
call label_dtend_cause(Model,Model%index_of_process_temp,'temp','tendency due to temperature')
call label_dtend_cause(Model,Model%index_of_process_overhead_ozone,'o3column','tendency due to overhead ozone column')
call label_dtend_cause(Model,Model%index_of_process_dfi_radar,'dfi_radar','tendency due to dfi radar mp temperature forcing')
call label_dtend_cause(Model,Model%index_of_process_photochem,'photochem','tendency due to photochemical processes')
call label_dtend_cause(Model,Model%index_of_process_physics,'phys','tendency due to physics')
call label_dtend_cause(Model,Model%index_of_process_non_physics,'nophys','tendency due to non-physics processes', &
Expand All @@ -4631,6 +4691,7 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
call fill_dtidx(Model,dtend_select,Model%index_of_temperature,Model%index_of_process_dcnv,have_dcnv)
call fill_dtidx(Model,dtend_select,Model%index_of_temperature,Model%index_of_process_scnv,have_scnv)
call fill_dtidx(Model,dtend_select,Model%index_of_temperature,Model%index_of_process_mp,have_mp)
call fill_dtidx(Model,dtend_select,Model%index_of_temperature,Model%index_of_process_dfi_radar,have_mp .and. Model%num_dfi_radar>0)
call fill_dtidx(Model,dtend_select,Model%index_of_temperature,Model%index_of_process_orographic_gwd)
call fill_dtidx(Model,dtend_select,Model%index_of_temperature,Model%index_of_process_rayleigh_damping,have_rdamp)
call fill_dtidx(Model,dtend_select,Model%index_of_temperature,Model%index_of_process_nonorographic_gwd)
Expand Down Expand Up @@ -5404,6 +5465,9 @@ subroutine control_print(Model)
!--- interface variables
class(GFS_control_type) :: Model

!--- local variables
integer :: i

if (Model%me == Model%master) then
print *, ' '
print *, 'basic control parameters'
Expand Down Expand Up @@ -5572,6 +5636,17 @@ subroutine control_print(Model)
print *, ' icloud : ', Model%icloud
print *, ' '
endif
if (Model%num_dfi_radar>0) then
print *, ' num_dfi_radar : ', Model%num_dfi_radar
do i = 1, 5
8888 format(' fh_dfi_radar(',I0,') :',F12.4)
if(Model%fh_dfi_radar(i)>-1e10) then
print 8888,i,Model%fh_dfi_radar(i)
endif
enddo
9999 format(' radar_tten_limits: ', F12.4, ' ... ',F12.4)
print 9999,Model%radar_tten_limits(1),Model%radar_tten_limits(2)
endif
print *, 'land/surface model parameters'
print *, ' lsm : ', Model%lsm
print *, ' lsoil : ', Model%lsoil
Expand Down Expand Up @@ -5951,6 +6026,14 @@ subroutine tbd_create (Tbd, IM, Model)
Tbd%icsdlw = zero
endif

!--- DFI radar forcing
nullify(Tbd%dfi_radar_tten)
if(Model%num_dfi_radar>0) then
allocate(Tbd%dfi_radar_tten(IM,Model%levs,Model%num_dfi_radar))
Tbd%dfi_radar_tten = -20.0
Tbd%dfi_radar_tten(:,1,:) = 0.0
endif

!--- ozone and stratosphere h2o needs
allocate (Tbd%ozpl (IM,levozp,oz_coeff))
allocate (Tbd%h2opl (IM,levh2o,h2o_coeff))
Expand Down
39 changes: 39 additions & 0 deletions ccpp/data/GFS_typedefs.meta
Original file line number Diff line number Diff line change
Expand Up @@ -3357,6 +3357,12 @@
dimensions = ()
type = real
kind = kind_phys
[num_dfi_radar]
standard_name = num_dfi_radar
long_name = number of time ranges with dfi radar tendencies
units = count
dimensions = ()
type = integer
[effr_in]
standard_name = flag_for_cloud_effective_radii
long_name = flag for cloud effective radii calculations in GFDL microphysics
Expand Down Expand Up @@ -3435,6 +3441,26 @@
units = flag
dimensions = ()
type = logical
[radar_tten_limits]
standard_name = allowed_bounds_of_radar_prescribed_tendencies
long_name = allowed bounds of prescribed microphysics temperature tendencies
units = K
dimensions = (2)
type = real
kind = kind_phys
[fh_dfi_radar]
standard_name = times_at_which_dfi_radar_tten_is_available
long_name = times at which dfi_radar_tten is available
units = h
dimensions = (5)
type = real
kind = kind_phys
[ix_dfi_radar]
standard_name = time_indices_in_dfi_radar_tten
long_name = time indices in dfi radar tten
units = index
dimensions = (4)
type = integer
[shoc_parm(1)]
standard_name = pressure_threshold_for_increased_tke_dissipation
long_name = pressure below which extra TKE diss. is applied in SHOC
Expand Down Expand Up @@ -4705,6 +4731,12 @@
units = index
dimensions = ()
type = integer
[index_of_process_dfi_radar]
standard_name = index_of_radar_mp_temperature_forcing_in_cumulative_change_index
long_name = index of radar mp temperature forcing in second dimension of array cumulative change index
units = index
dimensions = ()
type = integer
[index_of_process_physics]
standard_name = index_of_all_physics_process_in_cumulative_change_index
long_name = index of all physics transport process in second dimension of array cumulative change index
Expand Down Expand Up @@ -6227,6 +6259,13 @@
type = real
kind = kind_phys
active = (flag_for_mellor_yamada_janjic_surface_layer_scheme .or. flag_for_mellor_yamada_janjic_pbl_scheme)
[dfi_radar_tten]
standard_name = dfi_radar_tten
long_name = prescribed microphysics temperature tendency from radar data
units = K s-1
dimensions = (horizontal_loop_extent,vertical_layer_dimension,num_dfi_radar)
type = real
kind = kind_phys

########################################################################
[ccpp-table-properties]
Expand Down
21 changes: 20 additions & 1 deletion ccpp/driver/GFS_diagnostics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ subroutine GFS_externaldiag_populate (ExtDiag, Model, Statein, Stateout, Sfcprop
type(GFS_init_type), intent(in) :: Init_parm

!--- local variables
integer :: idt, idx, num, nb, nblks, NFXR, idtend, ichem, itrac, iprocess
integer :: idt, idx, num, nb, nblks, NFXR, idtend, ichem, itrac, iprocess, i
character(len=2) :: xtra
real(kind=kind_phys), parameter :: cn_one = 1._kind_phys
real(kind=kind_phys), parameter :: cn_100 = 100._kind_phys
Expand Down Expand Up @@ -3281,6 +3281,25 @@ subroutine GFS_externaldiag_populate (ExtDiag, Model, Statein, Stateout, Sfcprop
enddo
enddo
end if thompson_extended_diagnostics

do i=1,Model%num_dfi_radar
idx = idx + 1
ExtDiag(idx)%axes = 3
if(i>1) then
write(ExtDiag(idx)%name,'(A,I0)') 'radar_tten_',i
else
ExtDiag(idx)%name = 'radar_tten'
endif
write(ExtDiag(idx)%desc,'(A,I0,A,I0)') 'temperature tendency due to dfi radar tendencies ',i,' of ',Model%num_dfi_radar
ExtDiag(idx)%unit = 'K s-1'
ExtDiag(idx)%mod_name = 'gfs_phys'
ExtDiag(idx)%time_avg = .FALSE.

allocate (ExtDiag(idx)%data(nblks))
do nb = 1,nblks
ExtDiag(idx)%data(nb)%var3 => Tbd(nb)%dfi_radar_tten(:,:,i)
enddo
enddo

!! Cloud effective radii from Microphysics
!if (Model%imp_physics == Model%imp_physics_thompson .or. Model%imp_physics == Model%imp_physics_wsm6 .or. Model%imp_physics == Model%imp_physics_fer_hires) then
Expand Down
25 changes: 24 additions & 1 deletion ccpp/driver/GFS_restart.F90
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ subroutine GFS_restart_populate (Restart, Model, Statein, Stateout, Sfcprop, &

!--- local variables
integer :: idx, ndiag_rst
integer :: ndiag_idx(20)
integer :: ndiag_idx(20), itime
integer :: nblks, num, nb, max_rstrt, offset
character(len=2) :: c2 = ''

Expand Down Expand Up @@ -123,6 +123,9 @@ subroutine GFS_restart_populate (Restart, Model, Statein, Stateout, Sfcprop, &
endif

Restart%num3d = Model%ntot3d
if (Model%num_dfi_radar>0) then
Restart%num3d = Restart%num3d + Model%num_dfi_radar
endif
if(Model%lrefres) then
Restart%num3d = Model%ntot3d+1
endif
Expand Down Expand Up @@ -410,6 +413,26 @@ subroutine GFS_restart_populate (Restart, Model, Statein, Stateout, Sfcprop, &
enddo
endif

! DFI Radar
if (Model%num_dfi_radar > 0) then
print *,'have num dfi radar ',Model%num_dfi_radar
do itime=1,4
if(Model%ix_dfi_radar(itime)>0) then
num = num + 1
if(itime==1) then
Restart%name3d(num) = 'radar_tten'
else
write(Restart%name3d(num),'("radar_tten_",I0)') itime
endif
print *,'restart ',trim(Restart%name3d(num))
do nb = 1,nblks
Restart%data(nb,num)%var3p => Tbd(nb)%dfi_radar_tten( &
:,:,Model%ix_dfi_radar(itime))
enddo
endif
enddo
endif

end subroutine GFS_restart_populate

end module GFS_restart