Skip to content

Commit

Permalink
Connect MMM nTiedtke to CCPP SCM
Browse files Browse the repository at this point in the history
	new file:   gfs_mmm_cu_ntiedtke_post.F90
	new file:   gfs_mmm_cu_ntiedtke_post.meta
	new file:   gfs_mmm_cu_ntiedtke_pre.F90
	new file:   gfs_mmm_cu_ntiedtke_pre.meta
	deleted:    mmm_cu_ntiedtke_post.F90
	deleted:    mmm_cu_ntiedtke_post.meta
	deleted:    mmm_cu_ntiedtke_pre.F90
	deleted:    mmm_cu_ntiedtke_pre.meta
	renamed:    cu_ntiedtke.F90 -> ufs_cu_ntiedtke.F90
	renamed:    cu_ntiedtke.meta -> ufs_cu_ntiedtke.meta
	renamed:    cu_ntiedtke_post.F90 -> ufs_cu_ntiedtke_post.F90
	renamed:    cu_ntiedtke_post.meta -> ufs_cu_ntiedtke_post.meta
	renamed:    cu_ntiedtke_pre.F90 -> ufs_cu_ntiedtke_pre.F90
	renamed:    cu_ntiedtke_pre.meta -> ufs_cu_ntiedtke_pre.meta
	modified:   ../../mmm_physics
  • Loading branch information
bluefinweiwei committed Oct 9, 2024
1 parent 5e80dda commit d211542
Show file tree
Hide file tree
Showing 15 changed files with 902 additions and 241 deletions.
101 changes: 101 additions & 0 deletions physics/CONV/nTiedtke/gfs_mmm_cu_ntiedtke_post.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
! ###########################################################################################
!
! ###########################################################################################
module gfs_mmm_cu_ntiedtke_post
use machine, only: kind_phys

implicit none

public gfs_mmm_cu_ntiedtke_post_run

contains
!> \section arg_table_gfs_mmm_cu_ntiedtke_post_run
!! \htmlinclude gfs_mmm_cu_ntiedtke_post_run.html
!!
! #########################################################################################
!
! #########################################################################################
subroutine gfs_mmm_cu_ntiedtke_post_run(nCol, nLev, qv, temp, spechum, prevst, prevsq, qc, qi, &
ugrs, vgrs, pres, presi, geoph, geophi, pomg, forcet, forceq, &
raincd_mm, raincd, &
errmsg, errflg)

! Input variables
integer, intent(in ) :: &
nCol, & ! Number of horizontal gridpoints
nLev ! Number of vertical levels
real(kind_phys), dimension(:), intent(in ) :: raincd_mm
real(kind_phys), dimension(:,:), intent(in ), optional :: qv

! In/out variables
real(kind_phys), dimension(:,:), intent(inout) :: temp, spechum, qc, qi, ugrs, vgrs, pres, presi, pomg
real(kind_phys), dimension(:,:), intent(inout), optional:: forcet, forceq, geoph, geophi

! Output variables
real(kind_phys), dimension(:), intent(out ) :: raincd
real(kind_phys), dimension(:,:), intent(out ), optional :: prevst, prevsq

character(len=*), intent(out) :: &
errmsg ! CCPP error message
integer, intent(out) :: &
errflg ! CCPP error code

! Local variables
integer :: i, k, kk
real(kind_phys), dimension(nCol, nLev) :: pt, pqv, pqc, pqi, pu, pv, prsl, zl, omega, tendt, tendq
real(kind_phys), dimension(nCol,nLev+1):: prsli, zi

! Initialize CCPP error handling
errmsg = ''
errflg = 0

! Convert water vapor mixing ratio back to specific humidity
spechum = qv/(1.0_kind_phys+qv)

! Variables with vertical layer being reversed back
do k=1,nLev
kk = nLev-k+1
do i=1,nCol
pt(i,k) = temp(i,kk)
pqv(i,k) = spechum(i,kk)
pqc(i,k) = qc(i,kk)
pqi(i,k) = qi(i,kk)
pu(i,k) = ugrs(i,kk)
pv(i,k) = vgrs(i,kk)
prsl(i,k) = pres(i,kk)
prsli(i,k) = presi(i,kk+1)
zl(i,k) = geoph(i,kk)
zi(i,k) = geophi(i,kk+1)
omega(i,k) = pomg(i,kk)
tendt(i,k) = forcet(i,kk)
tendq(i,k) = forceq(i,kk)
enddo
enddo
prsli(:,nLev+1)=presi(:,1)
zi(:,nLev+1)=geophi(:,1)

!output
temp = pt
spechum = pqv
qc = pqc
qi = pqi
ugrs = pu
vgrs = pv
pres = prsl
presi = prsli
geoph = zl
geophi = zi
pomg = omega
forcet = tendt
forceq = tendq

! To calculate tendencies in next iteration
prevst = temp
prevsq = spechum

! Convert unit of deep convection induced precipitation from mm to m
raincd = raincd_mm * 1e-3

end subroutine gfs_mmm_cu_ntiedtke_post_run

end module gfs_mmm_cu_ntiedtke_post
187 changes: 187 additions & 0 deletions physics/CONV/nTiedtke/gfs_mmm_cu_ntiedtke_post.meta
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
[ccpp-table-properties]
name = gfs_mmm_cu_ntiedtke_post
type = scheme
dependencies = ../../hooks/machine.F

########################################################################
[ccpp-arg-table]
name = gfs_mmm_cu_ntiedtke_post_run
type = scheme
[nCol]
standard_name = horizontal_loop_extent
long_name = horizontal loop extent
units = count
dimensions = ()
type = integer
intent = in
[nLev]
standard_name = vertical_layer_dimension
long_name = number of vertical levels
units = count
dimensions = ()
type = integer
intent = in
[qv]
standard_name = water_vapor_mixing_ratio
long_name = water vapor mixing ratio
units = kg kg-1
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
type = real | kind = kind_phys
intent = in
optional = T
[temp]
standard_name = air_temperature_of_new_state
long_name = temperature updated by physics
units = K
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
type = real
kind = kind_phys
intent = inout
[spechum]
standard_name = specific_humidity_of_new_state
long_name = water vapor specific humidity updated by physics
units = kg kg-1
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
type = real
kind = kind_phys
intent = inout
[prevst]
standard_name = air_temperature_on_previous_timestep
long_name = temperature from previous time step
units = K
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
type = real
kind = kind_phys
intent = out
optional = True
[prevsq]
standard_name = specific_humidity_on_previous_timestep
long_name = moisture from previous time step
units = kg kg-1
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
type = real
kind = kind_phys
intent = out
optional = True
[qc]
standard_name = cloud_condensed_water_mixing_ratio_convective_transport_tracer
long_name = ratio of mass of cloud water to mass of dry air plus vapor (without condensates) in the convectively transported tracer array
units = kg kg-1
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
type = real
kind = kind_phys
intent = inout
[qi]
standard_name = ice_water_mixing_ratio_convective_transport_tracer
long_name = ratio of mass of ice water to mass of dry air plus vapor (without condensates) in the convectively transported tracer array
units = kg kg-1
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
type = real
kind = kind_phys
intent = inout
[ugrs]
standard_name = x_wind_of_new_state
long_name = updated x-direction wind
units = m s-1
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
type = real
kind = kind_phys
intent = inout
[vgrs]
standard_name = y_wind_of_new_state
long_name = updated y-direction wind
units = m s-1
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
type = real
kind = kind_phys
intent = inout
[pres]
standard_name = air_pressure
long_name = mean layer pressure
units = Pa
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
type = real
kind = kind_phys
intent = inout
[presi]
standard_name = air_pressure_at_interface
long_name = air pressure at model layer interfaces
units = Pa
dimensions = (horizontal_loop_extent,vertical_interface_dimension)
type = real
kind = kind_phys
intent = inout
[geoph]
standard_name = geopotential_height
long_name = geopotential height at model layer centers
units = m
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
type = real
intent = inout
optional = T
[geophi]
standard_name = geopotential_height_at_interface
long_name = geopotential height at model layer interfaces
units = m
dimensions = (horizontal_loop_extent,vertical_interface_dimension)
type = real
kind = kind_phys
intent = inout
optional = T
[pomg]
standard_name = lagrangian_tendency_of_air_pressure
long_name = layer mean vertical velocity
units = Pa s-1
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
type = real
kind = kind_phys
intent = inout
[forcet]
standard_name = tendency_of_air_temperature_due_to_nonphysics
long_name = temperature tendency due to dynamics only
units = K s-1
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
type = real
kind = kind_phys
intent = inout
optional = True
[forceq]
standard_name = tendendy_of_water_vapor_mixing_ratio_due_to_nonphysics
long_name = moisture tendency due to dynamics only
units = kg kg-1 s-1
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
type = real
kind = kind_phys
intent = inout
optional = True
[raincd_mm]
standard_name = lwe_thickness_of_deep_convective_precipitation_amount_in_mm
long_name = deep convective rainfall amount on physics timestep in mm
units = mm
dimensions = (horizontal_loop_extent)
type = real
kind = kind_phys
intent = in
[raincd]
standard_name = lwe_thickness_of_deep_convective_precipitation_amount
long_name = deep convective rainfall amount on physics timestep
units = m
dimensions = (horizontal_loop_extent)
type = real
kind = kind_phys
intent = in
[errmsg]
standard_name = ccpp_error_message
long_name = error message for error handling in CCPP
units = none
dimensions = ()
type = character
kind = len=*
intent = out
[errflg]
standard_name = ccpp_error_code
long_name = error code for error handling in CCPP
units = 1
dimensions = ()
type = integer
intent = out
Loading

0 comments on commit d211542

Please sign in to comment.