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

code updates for CA_global #737

Merged
merged 7 commits into from
Sep 30, 2021
Merged
Show file tree
Hide file tree
Changes from 5 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
58 changes: 41 additions & 17 deletions physics/GFS_stochastics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,43 @@ module GFS_stochastics

contains

subroutine GFS_stochastics_init ()
!> \section arg_table_GFS_stochastics_init Argument Table
!! \htmlinclude GFS_stochastics_init.html
!!
!>\section gfs_stochy_general GFS_stochastics_init General Algorithm
!! This is the GFS stochastic physics initialization.
!! -# define vertical tapering for CA global
subroutine GFS_stochastics_init (si,vfact_ca,km,do_ca,ca_global, errmsg, errflg)

use machine, only: kind_phys

implicit none
real(kind_phys), dimension(:), intent(in) :: si
real(kind_phys), dimension(:), intent(inout) :: vfact_ca
integer, intent(in) :: km
logical, intent(in) :: do_ca
logical, intent(in) :: ca_global
character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg
integer :: k,nz

errmsg = ''
errflg = 0
if (do_ca .and. ca_global) then
nz=min(km,size(vfact_ca))
vfact_ca(:)=0.0
do k=1,nz
if (si(k) .lt. 0.1 .and. si(k) .gt. 0.025) then
vfact_ca(k) = (si(k)-0.025)/(0.1-0.025)
else if (si(k) .lt. 0.025) then
vfact_ca(k) = 0.0
else
vfact_ca(k) = 1.0
endif
enddo
vfact_ca(2)=vfact_ca(3)*0.5
vfact_ca(1)=0.0
endif
end subroutine GFS_stochastics_init

subroutine GFS_stochastics_finalize()
Expand All @@ -26,7 +62,7 @@ end subroutine GFS_stochastics_finalize
!! -# interpolates coefficients for prognostic ozone calculation
!! -# performs surface data cycling via the GFS gcycle routine
subroutine GFS_stochastics_run (im, km, kdt, delt, do_sppt, pert_mp, use_zmtnblck, &
do_shum ,do_skeb, do_ca,ca_global,ca1,si,vfact_ca, &
do_shum ,do_skeb, do_ca,ca_global,ca1,vfact_ca, &
zmtnblck, sppt_wts, skebu_wts, skebv_wts, shum_wts,&
sppt_wts_inv, skebu_wts_inv, skebv_wts_inv, &
shum_wts_inv, diss_est, ugrs, vgrs, tgrs, qgrs_wv, &
Expand Down Expand Up @@ -106,8 +142,7 @@ subroutine GFS_stochastics_run (im, km, kdt, delt, do_sppt, pert_mp, use_zmtnblc
! drain_cpl, dsnow_cpl only allocated if cplflx == .true. or cplchm == .true.
real(kind_phys), dimension(:), intent(in) :: drain_cpl
real(kind_phys), dimension(:), intent(in) :: dsnow_cpl
real(kind_phys), dimension(:), intent(in) :: si
real(kind_phys), dimension(:), intent(inout) :: vfact_ca
real(kind_phys), dimension(:), intent(in) :: vfact_ca
real(kind_phys), dimension(:), intent(in) :: ca1
character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg
Expand Down Expand Up @@ -225,19 +260,8 @@ subroutine GFS_stochastics_run (im, km, kdt, delt, do_sppt, pert_mp, use_zmtnblc

if (do_ca .and. ca_global) then

if(kdt == 1)then
do k=1,km
if (si(k) .lt. 0.1 .and. si(k) .gt. 0.025) then
vfact_ca(k) = (si(k)-0.025)/(0.1-0.025)
else if (si(k) .lt. 0.025) then
vfact_ca(k) = 0.0
else
vfact_ca(k) = 1.0
endif
enddo
vfact_ca(2)=vfact_ca(3)*0.5
vfact_ca(1)=0.0
endif
!if(kdt == 1)then
!endif

do k = 1,km
do i = 1,im
Expand Down
73 changes: 63 additions & 10 deletions physics/GFS_stochastics.meta
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,68 @@
type = scheme
dependencies = machine.F

[ccpp-arg-table]
name = GFS_stochastics_init
type = scheme
[km]
standard_name = vertical_dimension_for_radiation
long_name = number of vertical levels for radiation calculations
units = count
dimensions = ()
type = integer
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
[ca_global]
standard_name = flag_for_global_cellular_automata
long_name = switch for global ca
units = flag
dimensions = ()
type = logical
intent = in
optional = F
[si]
standard_name = sigma_pressure_hybrid_vertical_coordinate
long_name = vertical sigma coordinate for radiation initialization
units = none
dimensions = (vertical_interface_dimension_for_radiation)
pjpegion marked this conversation as resolved.
Show resolved Hide resolved
type = real
kind = kind_phys
intent = in
optional = F
[vfact_ca]
standard_name = cellular_automata_vertical_weight
long_name = vertical weight for ca
units = frac
dimensions = (vertical_layer_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
units = none
dimensions = ()
type = character
kind = len=*
intent = out
optional = F
[errflg]
standard_name = ccpp_error_flag
long_name = error flag for error handling in CCPP
units = flag
dimensions = ()
type = integer
intent = out
optional = F
########################################################################
[ccpp-arg-table]
name = GFS_stochastics_run
Expand Down Expand Up @@ -105,23 +167,14 @@
kind = kind_phys
intent = in
optional = F
[si]
standard_name = sigma_pressure_hybrid_vertical_coordinate
long_name = vertical sigma coordinate for radiation initialization
units = none
dimensions = (vertical_interface_dimension_for_radiation)
type = real
kind = kind_phys
intent = in
optional = F
[vfact_ca]
standard_name = cellular_automata_vertical_weight
long_name = vertical weight for ca
units = frac
dimensions = (vertical_layer_dimension)
type = real
kind = kind_phys
intent = inout
intent = in
optional = F
[zmtnblck]
standard_name = level_of_dividing_streamline
Expand Down