Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
… into HEAD
  • Loading branch information
dustinswales committed Jan 2, 2024
2 parents a7b8325 + df9e1ad commit 26ca617
Show file tree
Hide file tree
Showing 30 changed files with 2,106 additions and 1,068 deletions.
267 changes: 240 additions & 27 deletions physics/CONV/Grell_Freitas/cu_gf_deep.F90

Large diffs are not rendered by default.

29 changes: 22 additions & 7 deletions physics/CONV/Grell_Freitas/cu_gf_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ subroutine cu_gf_driver_run(ntracer,garea,im,km,dt,flag_init,flag_restart,&
fhour,fh_dfi_radar,ix_dfi_radar,num_dfi_radar,cap_suppress, &
dfi_radar_max_intervals,ldiag3d,qci_conv,do_cap_suppress, &
maxupmf,maxMF,do_mynnedmf,ichoice_in,ichoicem_in,ichoice_s_in, &
spp_cu_deep,spp_wts_cu_deep, &
errmsg,errflg)
spp_cu_deep,spp_wts_cu_deep,nchem,chem3d,fscav,wetdpc_deep, &
do_smoke_transport,errmsg,errflg)
!-------------------------------------------------------------
implicit none
integer, parameter :: maxiens=1
Expand All @@ -86,7 +86,7 @@ subroutine cu_gf_driver_run(ntracer,garea,im,km,dt,flag_init,flag_restart,&
& spp_wts_cu_deep
real(kind=kind_phys) :: spp_wts_cu_deep_tmp

logical, intent(in) :: do_cap_suppress
logical, intent(in) :: do_cap_suppress, do_smoke_transport
real(kind=kind_phys), parameter :: aodc0=0.14
real(kind=kind_phys), parameter :: aodreturn=30.
real(kind=kind_phys) :: dts,fpi,fp
Expand All @@ -95,7 +95,7 @@ subroutine cu_gf_driver_run(ntracer,garea,im,km,dt,flag_init,flag_restart,&
integer :: ishallow_g3 ! depend on imfshalcnv
!-------------------------------------------------------------
integer :: its,ite, jts,jte, kts,kte
integer, intent(in ) :: im,km,ntracer
integer, intent(in ) :: im,km,ntracer, nchem
integer, intent(in ) :: ichoice_in,ichoicem_in,ichoice_s_in
logical, intent(in ) :: flag_init, flag_restart, do_mynnedmf
logical, intent(in ) :: flag_for_scnv_generic_tend,flag_for_dcnv_generic_tend
Expand Down Expand Up @@ -154,7 +154,11 @@ subroutine cu_gf_driver_run(ntracer,garea,im,km,dt,flag_init,flag_restart,&

integer, intent(in ) :: imfshalcnv
integer, dimension(:), intent(inout) :: cactiv,cactiv_m
!$acc declare copy(cactiv,cactiv_m)
real(kind_phys), dimension(:), intent(in) :: fscav
!$acc declare copyin(fscav)
real(kind_phys), dimension(:,:,:), intent(inout) :: chem3d
real(kind_phys), dimension(:,:), intent(inout) :: wetdpc_deep
!$acc declare copy(cactiv,cactiv_m,chem3d,wetdpc_deep)

character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg
Expand All @@ -179,19 +183,20 @@ subroutine cu_gf_driver_run(ntracer,garea,im,km,dt,flag_init,flag_restart,&
real(kind=kind_phys), dimension (im) :: tau_ecmwf,edt,edtm,edtd,ter11,aa0,xlandi
real(kind=kind_phys), dimension (im) :: pret,prets,pretm,hexec
real(kind=kind_phys), dimension (im,10) :: forcing,forcing2
real(kind=kind_phys), dimension (im,nchem) :: wetdpc_mid

integer, dimension (im) :: kbcon, ktop,ierr,ierrs,ierrm,kpbli
integer, dimension (im) :: k22s,kbcons,ktops,k22,jmin,jminm
integer, dimension (im) :: kbconm,ktopm,k22m
!$acc declare create(k22_shallow,kbcon_shallow,ktop_shallow,rand_mom,rand_vmas, &
!$acc rand_clos,gdc,gdc2,ht,ccn_gf,ccn_m,dx,frhm,frhd, &
!$acc rand_clos,gdc,gdc2,ht,ccn_gf,ccn_m,dx,frhm,frhd,wetdpc_mid, &
!$acc outt,outq,outqc,phh,subm,cupclw,cupclws, &
!$acc dhdt,zu,zus,zd,phf,zum,zdm,outum,outvm, &
!$acc outts,outqs,outqcs,outu,outv,outus,outvs, &
!$acc outtm,outqm,outqcm,submm,cupclwm, &
!$acc cnvwt,cnvwts,cnvwtm,hco,hcdo,zdo,zdd,hcom,hcdom,zdom, &
!$acc tau_ecmwf,edt,edtm,edtd,ter11,aa0,xlandi, &
!$acc pret,prets,pretm,hexec,forcing,forcing2, &
!$acc pret,prets,pretm,hexec,forcing,forcing2,wetdpc_mid, &
!$acc kbcon, ktop,ierr,ierrs,ierrm,kpbli, &
!$acc k22s,kbcons,ktops,k22,jmin,jminm,kbconm,ktopm,k22m)

Expand Down Expand Up @@ -743,6 +748,11 @@ subroutine cu_gf_driver_run(ntracer,garea,im,km,dt,flag_init,flag_restart,&
,frhm &
,ierrm &
,ierrcm &
,nchem &
,fscav &
,chem3d &
,wetdpc_mid &
,do_smoke_transport &
! the following should be set to zero if not available
,rand_mom & ! for stochastics mom, if temporal and spatial patterns exist
,rand_vmas & ! for stochastics vertmass, if temporal and spatial patterns exist
Expand Down Expand Up @@ -825,6 +835,11 @@ subroutine cu_gf_driver_run(ntracer,garea,im,km,dt,flag_init,flag_restart,&
,frhd &
,ierr &
,ierrc &
,nchem &
,fscav &
,chem3d &
,wetdpc_deep &
,do_smoke_transport &
! the following should be set to zero if not available
,rand_mom & ! for stochastics mom, if temporal and spatial patterns exist
,rand_vmas & ! for stochastics vertmass, if temporal and spatial patterns exist
Expand Down
38 changes: 38 additions & 0 deletions physics/CONV/Grell_Freitas/cu_gf_driver.meta
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,44 @@
dimensions = ()
type = integer
intent = in
[nchem]
standard_name = number_of_chemical_species_vertically_mixed
long_name = number of chemical species vertically mixed
units = count
dimensions = ()
type = integer
intent = in
[chem3d]
standard_name = chem3d_mynn_pbl_transport
long_name = mynn pbl transport of smoke and dust
units = various
dimensions = (horizontal_loop_extent,vertical_layer_dimension,number_of_chemical_species_vertically_mixed)
type = real
kind = kind_phys
intent = inout
[fscav]
standard_name = smoke_dust_conv_wet_coef
long_name = smoke dust convetive wet scavanging coefficents
units = none
dimensions = (3)
type = real
kind = kind_phys
intent = in
[do_smoke_transport]
standard_name = do_smoke_conv_transport
long_name = flag for rrfs smoke convective transport
units = flag
dimensions = ()
type = logical
intent = in
[wetdpc_deep]
standard_name = conv_wet_deposition_smoke_dust
long_name = convective wet removal of smoke and dust
units = kg kg-1
dimensions = (horizontal_loop_extent,number_of_chemical_species_vertically_mixed)
type = real
kind = kind_phys
intent = inout
[errmsg]
standard_name = ccpp_error_message
long_name = error message for error handling in CCPP
Expand Down
13 changes: 11 additions & 2 deletions physics/CONV/Grell_Freitas/cu_gf_driver_post.F90
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module cu_gf_driver_post
!> \section arg_table_cu_gf_driver_post_run Argument Table
!! \htmlinclude cu_gf_driver_post_run.html
!!
subroutine cu_gf_driver_post_run (im, km, t, q, prevst, prevsq, cactiv, cactiv_m, conv_act, conv_act_m, errmsg, errflg)
subroutine cu_gf_driver_post_run (im, km, t, q, prevst, prevsq, cactiv, cactiv_m, conv_act, conv_act_m, rrfs_sd, ntsmoke, ntdust, ntcoarsepm, chem3d, gq0, errmsg, errflg)

use machine, only: kind_phys

Expand All @@ -31,8 +31,11 @@ subroutine cu_gf_driver_post_run (im, km, t, q, prevst, prevsq, cactiv, cactiv_m
integer, intent(in) :: cactiv_m(:)
real(kind_phys), intent(out) :: conv_act(:)
real(kind_phys), intent(out) :: conv_act_m(:)
logical, intent(in) :: rrfs_sd
integer, intent(in) :: ntsmoke, ntdust, ntcoarsepm
real(kind_phys), intent(inout) :: chem3d(:,:,:), gq0(:,:,:)
character(len=*), intent(out) :: errmsg
!$acc declare copyin(t,q,cactiv,cactiv_m) copyout(prevst,prevsq,conv_act,conv_act_m)
!$acc declare copyin(t,q,cactiv,cactiv_m) copyout(prevst,prevsq,conv_act,conv_act_m,chem3d,gq0)
integer, intent(out) :: errflg

! Local variables
Expand All @@ -58,6 +61,12 @@ subroutine cu_gf_driver_post_run (im, km, t, q, prevst, prevsq, cactiv, cactiv_m
conv_act_m(i)=0.0
endif
enddo

if (rrfs_sd) then
gq0(:,:,ntsmoke ) = chem3d(:,:,1)
gq0(:,:,ntdust ) = chem3d(:,:,2)
gq0(:,:,ntcoarsepm) = chem3d(:,:,3)
endif
!$acc end kernels

end subroutine cu_gf_driver_post_run
Expand Down
44 changes: 44 additions & 0 deletions physics/CONV/Grell_Freitas/cu_gf_driver_post.meta
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,34 @@
type = real
kind = kind_phys
intent = out
[rrfs_sd]
standard_name = do_smoke_coupling
long_name = flag controlling rrfs_sd collection
units = flag
dimensions = ()
type = logical
intent = in
[ntsmoke]
standard_name = index_for_smoke_in_tracer_concentration_array
long_name = tracer index for smoke
units = index
dimensions = ()
type = integer
intent = in
[ntdust]
standard_name = index_for_dust_in_tracer_concentration_array
long_name = tracer index for dust
units = index
dimensions = ()
type = integer
intent = in
[ntcoarsepm]
standard_name = index_for_coarse_particulate_matter_in_tracer_concentration_array
long_name = tracer index for coarse particulate matter
units = index
dimensions = ()
type = integer
intent = in
[errmsg]
standard_name = ccpp_error_message
long_name = error message for error handling in CCPP
Expand All @@ -91,6 +119,22 @@
type = character
kind = len=*
intent = out
[chem3d]
standard_name = chem3d_mynn_pbl_transport
long_name = mynn pbl transport of smoke and dust
units = various
dimensions = (horizontal_loop_extent,vertical_layer_dimension,number_of_chemical_species_vertically_mixed)
type = real
kind = kind_phys
intent = inout
[gq0]
standard_name = tracer_concentration_of_new_state
long_name = tracer concentration updated by physics
units = kg kg-1
dimensions = (horizontal_loop_extent,vertical_layer_dimension,number_of_tracers)
type = real
kind = kind_phys
intent = inout
[errflg]
standard_name = ccpp_error_code
long_name = error code for error handling in CCPP
Expand Down
12 changes: 11 additions & 1 deletion physics/CONV/Grell_Freitas/cu_gf_driver_pre.F90
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ module cu_gf_driver_pre
!!
subroutine cu_gf_driver_pre_run (flag_init, flag_restart, kdt, fhour, dtp, t, q, prevst, prevsq, &
forcet, forceq, cactiv, cactiv_m, conv_act, conv_act_m, &
rrfs_sd, ntsmoke, ntdust, ntcoarsepm, chem3d, gq0, &
errmsg, errflg)

use machine, only: kind_phys
Expand All @@ -25,6 +26,7 @@ subroutine cu_gf_driver_pre_run (flag_init, flag_restart, kdt, fhour, dtp, t, q,

logical, intent(in) :: flag_init
logical, intent(in) :: flag_restart
logical, intent(in) :: rrfs_sd
integer, intent(in) :: kdt
real(kind_phys), intent(in) :: fhour
real(kind_phys), intent(in) :: dtp
Expand All @@ -37,10 +39,12 @@ subroutine cu_gf_driver_pre_run (flag_init, flag_restart, kdt, fhour, dtp, t, q,
real(kind_phys), intent(out) :: forceq(:,:)
integer, intent(out) :: cactiv(:)
integer, intent(out) :: cactiv_m(:)
integer, intent(in) :: ntsmoke, ntdust, ntcoarsepm
!$acc declare copyout(forcet,forceq,cactiv,cactiv_m)
real(kind_phys), intent(in) :: conv_act(:)
real(kind_phys), intent(in) :: conv_act_m(:)
!$acc declare copyin(conv_act,conv_act_m)
real(kind_phys), intent(inout) :: chem3d(:,:,:), gq0(:,:,:)
!$acc declare copyin(conv_act,conv_act_m) copy(chem3d,gq0)
character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg

Expand Down Expand Up @@ -77,6 +81,12 @@ subroutine cu_gf_driver_pre_run (flag_init, flag_restart, kdt, fhour, dtp, t, q,
!$acc kernels
cactiv(:)=nint(conv_act(:))
cactiv_m(:)=nint(conv_act_m(:))

if (rrfs_sd) then
chem3d(:,:,1) = gq0(:,:,ntsmoke)
chem3d(:,:,2) = gq0(:,:,ntdust)
chem3d(:,:,3) = gq0(:,:,ntcoarsepm)
endif
!$acc end kernels

end subroutine cu_gf_driver_pre_run
Expand Down
44 changes: 44 additions & 0 deletions physics/CONV/Grell_Freitas/cu_gf_driver_pre.meta
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,50 @@
type = real
kind = kind_phys
intent = in
[rrfs_sd]
standard_name = do_smoke_coupling
long_name = flag controlling rrfs_sd collection
units = flag
dimensions = ()
type = logical
intent = in
[ntsmoke]
standard_name = index_for_smoke_in_tracer_concentration_array
long_name = tracer index for smoke
units = index
dimensions = ()
type = integer
intent = in
[ntdust]
standard_name = index_for_dust_in_tracer_concentration_array
long_name = tracer index for dust
units = index
dimensions = ()
type = integer
intent = in
[ntcoarsepm]
standard_name = index_for_coarse_particulate_matter_in_tracer_concentration_array
long_name = tracer index for coarse particulate matter
units = index
dimensions = ()
type = integer
intent = in
[chem3d]
standard_name = chem3d_mynn_pbl_transport
long_name = mynn pbl transport of smoke and dust
units = various
dimensions = (horizontal_loop_extent,vertical_layer_dimension,number_of_chemical_species_vertically_mixed)
type = real
kind = kind_phys
intent = inout
[gq0]
standard_name = tracer_concentration_of_new_state
long_name = tracer concentration updated by physics
units = kg kg-1
dimensions = (horizontal_loop_extent,vertical_layer_dimension,number_of_tracers)
type = real
kind = kind_phys
intent = inout
[errmsg]
standard_name = ccpp_error_message
long_name = error message for error handling in CCPP
Expand Down
Loading

0 comments on commit 26ca617

Please sign in to comment.