From 72711368a8b93e7e8523baf4cf2bd4ae0ded8587 Mon Sep 17 00:00:00 2001
From: Dustin Swales <dustin.swales@noaa.gov>
Date: Thu, 11 Aug 2022 20:56:55 +0000
Subject: [PATCH 001/115] Issue 886

---
 ...odule_sf_noahmp_glacier.f90 => module_sf_noahmp_glacier.F90} | 2 +-
 physics/{module_sf_noahmplsm.f90 => module_sf_noahmplsm.F90}    | 2 +-
 physics/noahmpdrv.meta                                          | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
 rename physics/{module_sf_noahmp_glacier.f90 => module_sf_noahmp_glacier.F90} (99%)
 rename physics/{module_sf_noahmplsm.f90 => module_sf_noahmplsm.F90} (99%)

diff --git a/physics/module_sf_noahmp_glacier.f90 b/physics/module_sf_noahmp_glacier.F90
similarity index 99%
rename from physics/module_sf_noahmp_glacier.f90
rename to physics/module_sf_noahmp_glacier.F90
index ee57e336f..40202a827 100644
--- a/physics/module_sf_noahmp_glacier.f90
+++ b/physics/module_sf_noahmp_glacier.F90
@@ -1,5 +1,5 @@
 #define CCPP
-!>  \file module_sf_noahmp_glacier.f90
+!>  \file module_sf_noahmp_glacier.F90
 !!  This file contains the NoahMP Glacier scheme.
 
 !>\ingroup NoahMP_LSM
diff --git a/physics/module_sf_noahmplsm.f90 b/physics/module_sf_noahmplsm.F90
similarity index 99%
rename from physics/module_sf_noahmplsm.f90
rename to physics/module_sf_noahmplsm.F90
index 652db602d..57e047c3e 100644
--- a/physics/module_sf_noahmplsm.f90
+++ b/physics/module_sf_noahmplsm.F90
@@ -1,5 +1,5 @@
 #define CCPP
-!>  \file module_sf_noahmplsm.f90
+!>  \file module_sf_noahmplsm.F90
 !!  This file contains the NoahMP land surface model.
 
 !>\ingroup NoahMP_LSM
diff --git a/physics/noahmpdrv.meta b/physics/noahmpdrv.meta
index 9ad9092ec..ddf16f65d 100644
--- a/physics/noahmpdrv.meta
+++ b/physics/noahmpdrv.meta
@@ -1,7 +1,7 @@
 [ccpp-table-properties]
   name = noahmpdrv
   type = scheme
-  dependencies = funcphys.f90,machine.F,sfc_diff.f,module_sf_noahmp_glacier.f90,module_sf_noahmplsm.f90,noahmp_tables.f90,set_soilveg.f
+  dependencies = funcphys.f90,machine.F,sfc_diff.f,module_sf_noahmp_glacier.F90,module_sf_noahmplsm.F90,noahmp_tables.f90,set_soilveg.f
 
 ########################################################################
 [ccpp-arg-table]

From 8329e07281c33832c0fd334b7c023f2bf9177e5b Mon Sep 17 00:00:00 2001
From: Dustin Swales <dustin.swales@noaa.gov>
Date: Thu, 11 Aug 2022 22:24:11 +0000
Subject: [PATCH 002/115] Issue 764

---
 physics/drag_suite.F90 | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/physics/drag_suite.F90 b/physics/drag_suite.F90
index 09ee621bd..ec8bf2f5e 100644
--- a/physics/drag_suite.F90
+++ b/physics/drag_suite.F90
@@ -7,6 +7,11 @@ module drag_suite
 
       contains
 
+!>\brief This subroutine initializes the GFS_ogwd GFS Orographic Gravity Wave Drag scheme.
+!!
+!> \section arg_table_drag_suite_init Argument Table
+!! \htmlinclude drag_suite_init.html
+!!
       subroutine drag_suite_init(gwd_opt, errmsg, errflg)
 
       integer,          intent(in)  :: gwd_opt

From a282821eb995c7780b066af5f34b55f50119144d Mon Sep 17 00:00:00 2001
From: Dustin Swales <dustin.swales@noaa.gov>
Date: Thu, 11 Aug 2022 22:39:14 +0000
Subject: [PATCH 003/115] Issue 672

---
 physics/GFS_phys_time_vary.fv3.F90  |  5 +++--
 physics/GFS_phys_time_vary.fv3.meta |  8 ++++++++
 physics/gcycle.F90                  | 13 +++++++------
 3 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/physics/GFS_phys_time_vary.fv3.F90 b/physics/GFS_phys_time_vary.fv3.F90
index 3c5a5af9b..3cfa9e956 100644
--- a/physics/GFS_phys_time_vary.fv3.F90
+++ b/physics/GFS_phys_time_vary.fv3.F90
@@ -713,7 +713,7 @@ subroutine GFS_phys_time_vary_timestep_init (
             imfdeepcnv, cal_pre, random_clds, nscyc, ntoz, h2o_phys, iaerclm, iccn, clstp,          &
             jindx1_o3, jindx2_o3, ddy_o3, ozpl, jindx1_h, jindx2_h, ddy_h, h2opl, iflip,            &
             jindx1_aer, jindx2_aer, ddy_aer, iindx1_aer, iindx2_aer, ddx_aer, aer_nm,               &
-            jindx1_ci, jindx2_ci, ddy_ci, iindx1_ci, iindx2_ci, ddx_ci, in_nm, ccn_nm,              &
+            jindx1_ci, jindx2_ci, ddy_ci, iindx1_ci, iindx2_ci, ddx_ci, in_nm, ccn_nm, fn_nml,      &
             imap, jmap, prsl, seed0, rann, nthrds, nx, ny, nsst, tile_num, nlunit, lsoil, lsoil_lsm,&
             kice, ialb, isot, ivegsrc, input_nml_file, use_ufo, nst_anl, frac_grid, fhcyc, phour,   &
             lakefrac, min_seaice, min_lakeice, smc, slc, stc, smois, sh2o, tslb, tiice, tg3, tref,  &
@@ -754,6 +754,7 @@ subroutine GFS_phys_time_vary_timestep_init (
          integer,              intent(in)    :: nthrds, nx, ny, nsst, tile_num, nlunit, lsoil
          integer,              intent(in)    :: lsoil_lsm, kice, ialb, isot, ivegsrc
          character(len=*),     intent(in)    :: input_nml_file(:)
+         character(len=*),     intent(in)    :: fn_nml
          logical,              intent(in)    :: use_ufo, nst_anl, frac_grid
          real(kind_phys),      intent(in)    :: fhcyc, phour, lakefrac(:), min_seaice, min_lakeice,  &
                                                 xlat_d(:), xlon_d(:), landfrac(:)
@@ -894,7 +895,7 @@ subroutine GFS_phys_time_vary_timestep_init (
 !> - Call gcycle() to repopulate specific time-varying surface properties for AMIP/forecast runs
          if (nscyc >  0) then
            if (mod(kdt,nscyc) == 1) THEN
-             call gcycle (me, nthrds, nx, ny, isc, jsc, nsst, tile_num, nlunit,              &
+             call gcycle (me, nthrds, nx, ny, isc, jsc, nsst, tile_num, nlunit, fn_nml,      &
                  input_nml_file, lsoil, lsoil_lsm, kice, idate, ialb, isot, ivegsrc,         &
                  use_ufo, nst_anl, fhcyc, phour, landfrac, lakefrac, min_seaice, min_lakeice,&
                  frac_grid, smc, slc, stc, smois, sh2o, tslb, tiice, tg3, tref, tsfc,        &
diff --git a/physics/GFS_phys_time_vary.fv3.meta b/physics/GFS_phys_time_vary.fv3.meta
index f37235975..ce350a7b2 100644
--- a/physics/GFS_phys_time_vary.fv3.meta
+++ b/physics/GFS_phys_time_vary.fv3.meta
@@ -1285,6 +1285,14 @@
   type = real
   kind = kind_phys
   intent = inout
+[fn_nml]
+  standard_name = filename_of_namelist
+  long_name = namelist filename
+  units = none
+  dimensions = ()
+  type = character
+  kind = len=*
+  intent = in
 [imap]
   standard_name = map_of_block_column_number_to_global_i_index
   long_name = map of local index ix to global index i for this block
diff --git a/physics/gcycle.F90 b/physics/gcycle.F90
index 5f4f959c6..7e301c480 100644
--- a/physics/gcycle.F90
+++ b/physics/gcycle.F90
@@ -15,7 +15,7 @@ module gcycle_mod
 !>\ingroup mod_GFS_phys_time_vary
 !! This subroutine repopulates specific time-varying surface properties for
 !! atmospheric forecast runs.
-  subroutine gcycle (me, nthrds, nx, ny, isc, jsc, nsst, tile_num, nlunit,         &
+  subroutine gcycle (me, nthrds, nx, ny, isc, jsc, nsst, tile_num, nlunit, fn_nml, &
       input_nml_file, lsoil, lsoil_lsm, kice, idate, ialb, isot, ivegsrc,          &
       use_ufo, nst_anl, fhcyc, phour, landfrac, lakefrac, min_seaice, min_lakeice, &
       frac_grid, smc, slc, stc, smois, sh2o, tslb, tiice, tg3, tref, tsfc,         &
@@ -31,6 +31,7 @@ subroutine gcycle (me, nthrds, nx, ny, isc, jsc, nsst, tile_num, nlunit,
     integer,              intent(in)    :: me, nthrds, nx, ny, isc, jsc, nsst, &
                                            tile_num, nlunit, lsoil, lsoil_lsm, kice
     integer,              intent(in)    :: idate(:), ialb, isot, ivegsrc
+    character(len = 64), intent(in)     :: fn_nml
     character(len=*),     intent(in)    :: input_nml_file(:)
     logical,              intent(in)    :: use_ufo, nst_anl, frac_grid
     real(kind=kind_phys), intent(in)    :: fhcyc, phour, landfrac(:), lakefrac(:), &
@@ -210,13 +211,13 @@ subroutine gcycle (me, nthrds, nx, ny, isc, jsc, nsst, tile_num, nlunit,
       enddo
 !
 #ifndef INTERNAL_FILE_NML
-      inquire (file=trim(Model%fn_nml),exist=exists)
+      inquire (file=trim(fn_nml),exist=exists)
       if (.not. exists) then
-        write(6,*) 'gcycle:: namelist file: ',trim(Model%fn_nml),' does not exist'
+        write(6,*) 'gcycle:: namelist file: ',trim(fn_nml),' does not exist'
         stop
       else
-        open (unit=Model%nlunit, file=trim(Model%fn_nml), action='READ', status='OLD', iostat=ios)
-        rewind (Model%nlunit)
+        open (unit=nlunit, file=trim(fn_nml), action='READ', status='OLD', iostat=ios)
+        rewind (nlunit)
       endif
 #endif
       CALL SFCCYCLE (9998, npts, max(lsoil,lsoil_lsm), sig1t, fhcyc, &
@@ -233,7 +234,7 @@ subroutine gcycle (me, nthrds, nx, ny, isc, jsc, nsst, tile_num, nlunit,
                      min_ice, ialb, isot, ivegsrc,                   &
                      trim(tile_num_ch), i_indx, j_indx)
 #ifndef INTERNAL_FILE_NML
-      close (Model%nlunit)
+      close (nlunit)
 #endif
 !
       if ( nsst > 0 ) then

From 7c37906f8997a1e7311c74a4a3cee66908c54ab9 Mon Sep 17 00:00:00 2001
From: Dustin Swales <dustin.swales@noaa.gov>
Date: Fri, 12 Aug 2022 16:43:44 -0600
Subject: [PATCH 004/115] Cleanup to radiation_aerosols. Related to #923. Made
 changes to made radiation_aerosols.f ccpp compliant

---
 physics/GFS_phys_time_vary.fv3.F90  |   5 +-
 physics/GFS_phys_time_vary.fv3.meta |   7 +
 physics/GFS_rad_time_vary.fv3.F90   |   2 +-
 physics/GFS_rad_time_vary.scm.F90   |   2 +-
 physics/GFS_rrtmg_pre.F90           |  17 +-
 physics/GFS_rrtmg_pre.meta          |  23 +-
 physics/GFS_rrtmg_setup.F90         |  60 +++--
 physics/GFS_rrtmg_setup.meta        |  51 ++++
 physics/GFS_rrtmgp_setup.F90        |  21 +-
 physics/GFS_rrtmgp_setup.meta       |  44 ++++
 physics/GFS_time_vary_pre.scm.F90   |   2 +-
 physics/physparam.f                 |  17 --
 physics/radiation_aerosols.f        | 345 +++++++++++++++++++---------
 physics/rrtmgp_aerosol_optics.F90   |  12 +-
 physics/rrtmgp_aerosol_optics.meta  |  21 ++
 15 files changed, 455 insertions(+), 174 deletions(-)

diff --git a/physics/GFS_phys_time_vary.fv3.F90 b/physics/GFS_phys_time_vary.fv3.F90
index 3cfa9e956..2803212b7 100644
--- a/physics/GFS_phys_time_vary.fv3.F90
+++ b/physics/GFS_phys_time_vary.fv3.F90
@@ -35,7 +35,6 @@ module GFS_phys_time_vary
       !--- variables needed for calculating 'sncovr'
       use namelist_soilveg, only: salp_data, snupx
       use set_soilveg_mod, only: set_soilveg
-      use physparam,              only : iaermdl
 
       ! --- needed for Noah MP init
       use noahmp_tables, only: laim_table,saim_table,sla_table,      &
@@ -68,7 +67,7 @@ module GFS_phys_time_vary
 !>\section gen_GFS_phys_time_vary_init GFS_phys_time_vary_init General Algorithm
 !! @{
       subroutine GFS_phys_time_vary_init (                                                         &
-              me, master, ntoz, h2o_phys, iaerclm, iccn, iflip, im, levs,                          &
+              me, master, ntoz, h2o_phys, iaerclm, iccn, iaermdl, iflip, im, levs,                 &
               nx, ny, idate, xlat_d, xlon_d,                                                       &
               jindx1_o3, jindx2_o3, ddy_o3, ozpl, jindx1_h, jindx2_h, ddy_h, h2opl,fhour,          &
               jindx1_aer, jindx2_aer, ddy_aer, iindx1_aer, iindx2_aer, ddx_aer, aer_nm,            &
@@ -87,7 +86,7 @@ subroutine GFS_phys_time_vary_init (
          implicit none
 
          ! Interface variables
-         integer,              intent(in)    :: me, master, ntoz, iccn, iflip, im, nx, ny, levs
+         integer,              intent(in)    :: me, master, ntoz, iccn, iflip, im, nx, ny, levs, iaermdl
          logical,              intent(in)    :: h2o_phys, iaerclm, lsm_cold_start
          integer,              intent(in)    :: idate(:)
          real(kind_phys),      intent(in)    :: fhour
diff --git a/physics/GFS_phys_time_vary.fv3.meta b/physics/GFS_phys_time_vary.fv3.meta
index ce350a7b2..36ac38ab9 100644
--- a/physics/GFS_phys_time_vary.fv3.meta
+++ b/physics/GFS_phys_time_vary.fv3.meta
@@ -44,6 +44,13 @@
   dimensions = ()
   type = logical
   intent = in
+[iaermdl]
+  standard_name = flag_for_aerosol_radiation_scheme
+  long_name = flag for aerosol scheme to use in	radiation
+  units = flag
+  dimensions = ()
+  type = integer
+  intent = in
 [iccn]
   standard_name = control_for_ice_cloud_condensation_nuclei_forcing
   long_name = flag for IN and CCN forcing for morrison gettelman microphysics
diff --git a/physics/GFS_rad_time_vary.fv3.F90 b/physics/GFS_rad_time_vary.fv3.F90
index 8dd070b12..24d18d3f7 100644
--- a/physics/GFS_rad_time_vary.fv3.F90
+++ b/physics/GFS_rad_time_vary.fv3.F90
@@ -20,7 +20,7 @@ subroutine GFS_rad_time_vary_timestep_init (
               imap, jmap, sec, kdt, imp_physics, imp_physics_zhao_carr, ps_2delt,      &
               ps_1delt, t_2delt, t_1delt, qv_2delt, qv_1delt, t, qv, ps, errmsg, errflg)
 
-         use physparam,                 only: ipsd0, ipsdlim, iaerflg
+         use physparam,                 only: ipsd0, ipsdlim
          use mersenne_twister,          only: random_setseed, random_index, random_stat
          use machine,                   only: kind_phys
          use radcons,                   only: qmin, con_100
diff --git a/physics/GFS_rad_time_vary.scm.F90 b/physics/GFS_rad_time_vary.scm.F90
index d7d4cda26..db1e7e290 100644
--- a/physics/GFS_rad_time_vary.scm.F90
+++ b/physics/GFS_rad_time_vary.scm.F90
@@ -20,7 +20,7 @@ subroutine GFS_rad_time_vary_timestep_init (
               imap, jmap, sec, kdt, imp_physics, imp_physics_zhao_carr, ps_2delt,      &
               ps_1delt, t_2delt, t_1delt, qv_2delt, qv_1delt, t, qv, ps, errmsg, errflg)
 
-         use physparam,                 only: ipsd0, ipsdlim, iaerflg
+         use physparam,                 only: ipsd0, ipsdlim
          use mersenne_twister,          only: random_setseed, random_index, random_stat
          use machine,                   only: kind_phys
          use radcons,                   only: qmin, con_100
diff --git a/physics/GFS_rrtmg_pre.F90 b/physics/GFS_rrtmg_pre.F90
index c75278a33..b4b69d447 100644
--- a/physics/GFS_rrtmg_pre.F90
+++ b/physics/GFS_rrtmg_pre.F90
@@ -33,7 +33,8 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp,        &
         lmfdeep2, fhswr, fhlwr, solhr, sup, con_eps, epsm1, fvirt,             &
         rog, rocp, con_rd, xlat_d, xlat, xlon, coslat, sinlat, tsfc, slmsk,    &
         prsi, prsl, prslk, tgrs, sfc_wts, mg_cld, effrr_in, pert_clds,         &
-        sppt_wts, sppt_amp, cnvw_in, cnvc_in, qgrs, aer_nm, dx, icloud,        & !inputs from here and above
+        sppt_wts, sppt_amp, cnvw_in, cnvc_in, qgrs, aer_nm, dx, icloud,        & 
+        iaermdl, iaerflg,                                                      & !inputs from here and above
         coszen, coszdg, effrl_inout, effri_inout, effrs_inout,                 &
         clouds1, clouds2, clouds3, clouds4, clouds5, qci_conv,                 & !in/out from here and above
         kd, kt, kb, mtopa, mbota, raddt, tsfg, tsfa, de_lgth, alb1d, delp, dz, & !output from here and below
@@ -43,7 +44,7 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp,        &
         clouds9, cldsa, cldfra, cldfra2d, lwp_ex,iwp_ex, lwp_fc,iwp_fc,        &
         faersw1, faersw2, faersw3, faerlw1, faerlw2, faerlw3, alpha,           &
         aero_dir_fdb, smoke_ext, dust_ext,                                     &
-        spp_wts_rad, spp_rad, rrfs_smoke_band, errmsg, errflg)
+        spp_wts_rad, spp_rad, rrfs_smoke_band, top_at_1, errmsg, errflg)
 
       use machine,                   only: kind_phys
 
@@ -80,7 +81,6 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp,        &
                                            make_IceNumber,           &
                                            make_DropletNumber,       &
                                            make_RainNumber
-      use physparam,              only : iaermdl
       implicit none
 
       integer,              intent(in)  :: im, levs, lm, lmk, lmp, n_var_lndp, &
@@ -100,7 +100,7 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp,        &
                                            imp_physics_mg, imp_physics_wsm6,   &
                                            imp_physics_nssl,                   &
                                            imp_physics_fer_hires,              &
-                                           yearlen, icloud
+                                           yearlen, icloud, iaermdl, iaerflg
 
       integer,              intent(in)  ::                                     &
          iovr_rand,                        & ! Flag for random cloud overlap method
@@ -200,7 +200,7 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp,        &
                                                              faerlw2,&
                                                              faerlw3
       real(kind=kind_phys), dimension(:,:),   intent(out) :: alpha
-
+      logical, intent(out) :: top_at_1
       character(len=*), intent(out) :: errmsg
       integer,          intent(out) :: errflg
 
@@ -257,6 +257,9 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp,        &
       errmsg = ''
       errflg = 0
 
+      ! Vertical ordering
+      top_at_1 = (prsi(1,1) .lt.  prsi(1, lm))
+      
       if (.not. (lsswr .or. lslwr)) return
 
       !--- set commonly used integers
@@ -634,8 +637,8 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp,        &
 
       call setaer (plvl, plyr, prslk1, tvly, rhly, slmsk,    & !  ---  inputs
                    tracer1, aer_nm, xlon, xlat, IM, LMK, LMP,&
-                   lsswr,lslwr,                              &
-                   faersw,faerlw,aerodp)                       !  ---  outputs
+                   lsswr,lslwr,iaermdl,iaerflg,top_at_1,     &
+                   faersw,faerlw,aerodp,errflg,errmsg)         !  ---  outputs
 
 ! CCPP
       do j = 1,NBDSW
diff --git a/physics/GFS_rrtmg_pre.meta b/physics/GFS_rrtmg_pre.meta
index b98512c7d..e15ca3730 100644
--- a/physics/GFS_rrtmg_pre.meta
+++ b/physics/GFS_rrtmg_pre.meta
@@ -2,7 +2,7 @@
   name = GFS_rrtmg_pre
   type = scheme
   dependencies = funcphys.f90,iounitdef.f,machine.F,module_bfmicrophysics.f,module_mp_radar.F90,module_mp_thompson.F90
-  dependencies = module_mp_thompson_make_number_concentrations.F90,physcons.F90,physparam.f,radcons.f90,radiation_aerosols.f
+  dependencies = module_mp_thompson_make_number_concentrations.F90,physparam.f,physcons.F90,radcons.f90,radiation_aerosols.f
   dependencies = radiation_astronomy.f,radiation_clouds.f,radiation_gases.f,radlw_param.f,radsw_param.f,surface_perturbation.F90,radiation_cloud_overlap.F90
 
 ########################################################################
@@ -205,6 +205,20 @@
   dimensions = ()
   type = integer
   intent = in
+[iaermdl]
+  standard_name = flag_for_aerosol_radiation_scheme
+  long_name = flag for aerosol scheme to use in radiation
+  units = flag
+  dimensions = ()
+  type = integer
+  intent = in
+[iaerflg]
+  standard_name = flag_for_aerosol_effects_in_radiation
+  long_name = flag for aerosol effects to include in radiation
+  units = flag
+  dimensions = ()
+  type = integer
+  intent = in
 [nssl_ccn_on]
   standard_name = nssl_ccn_on
   long_name = CCN activation flag in NSSL micro
@@ -1306,6 +1320,13 @@
   type = real
   kind = kind_phys
   intent = out
+[top_at_1]
+  standard_name = flag_for_vertical_ordering_in_RRTMGP
+  long_name = flag for vertical ordering in RRTMGP
+  units = flag
+  dimensions = ()
+  type = logical
+  intent = out
 [aero_dir_fdb]
   standard_name = do_smoke_aerosol_direct_feedback
   long_name = flag for smoke and dust radiation feedback
diff --git a/physics/GFS_rrtmg_setup.F90 b/physics/GFS_rrtmg_setup.F90
index 0e2d87feb..ebe34a705 100644
--- a/physics/GFS_rrtmg_setup.F90
+++ b/physics/GFS_rrtmg_setup.F90
@@ -4,8 +4,8 @@
 !> \defgroup GFS_rrtmg_setup_mod GFS RRTMG Scheme Setup
 module GFS_rrtmg_setup
 
-   use physparam, only : isolar , ictmflg, ico2flg, ioznflg, iaerflg, &
-   &             iaermdl,                            icldflg,         &
+   use physparam, only : isolar , ictmflg, ico2flg, ioznflg, &
+   &                                         icldflg,                 &
    &             iovrRad=>iovr, lcrick , lcnorm , lnoprec,            &
    &             isubcsw, isubclw, ivflip , ipsd0,                    &
    &             iswcliq,                                             &
@@ -48,7 +48,8 @@ subroutine GFS_rrtmg_setup_init (                          &
           icliq_sw, crick_proof, ccnorm,                      &
           imp_physics,                                        &
           norad_precip, idate, iflip,                         &
-          do_RRTMGP, me, errmsg, errflg)
+          do_RRTMGP, me, lalw1bd, iaermdl, iaerflg,           &
+          aeros_file, errmsg, errflg)
 ! =================   subprogram documentation block   ================ !
 !                                                                       !
 ! subprogram:   GFS_rrtmg_setup_init - a subprogram to initialize radiation !
@@ -167,10 +168,12 @@ subroutine GFS_rrtmg_setup_init (                          &
       logical, intent(in) :: norad_precip
       integer, intent(in) :: idate(:)
       integer, intent(in) :: iflip
-      logical, intent(in) :: do_RRTMGP
+      logical, intent(in) :: do_RRTMGP, lalw1bd
       integer, intent(in) :: me
+      character(len=26), intent(in) :: aeros_file
       character(len=*), intent(out) :: errmsg
       integer,          intent(out) :: errflg
+      integer,          intent(out) :: iaermdl, iaerflg
 
       ! Initialize the CCPP error handling variables
       errmsg = ''
@@ -241,7 +244,8 @@ subroutine GFS_rrtmg_setup_init (                          &
 
       call radinit                                                      &
 !  ---  inputs:
-     &     ( si, levr, imp_physics, me )
+     &     ( si, levr, imp_physics, me, iaermdl, iaerflg, lalw1bd,      &
+     &       aeros_file, errmsg, errflg )
 !  ---  outputs:
 !          ( none )
 
@@ -261,8 +265,8 @@ end subroutine GFS_rrtmg_setup_init
 !! \htmlinclude GFS_rrtmg_setup_timestep_init.html
 !!
    subroutine GFS_rrtmg_setup_timestep_init (      &
-          idate, jdate, deltsw, deltim, lsswr, me, &
-          slag, sdec, cdec, solcon, errmsg, errflg)
+          idate, jdate, deltsw, deltim, lsswr, me, iaermdl, &
+          iaerflg, aeros_file, slag, sdec, cdec, solcon, errmsg, errflg)
 
       implicit none
 
@@ -273,6 +277,8 @@ subroutine GFS_rrtmg_setup_timestep_init (      &
       real(kind=kind_phys), intent(in)  :: deltim
       logical,              intent(in)  :: lsswr
       integer,              intent(in)  :: me
+      integer,              intent(in)  :: iaermdl, iaerflg
+      character(len=26),    intent(in)  :: aeros_file
       real(kind=kind_phys), intent(out) :: slag
       real(kind=kind_phys), intent(out) :: sdec
       real(kind=kind_phys), intent(out) :: cdec
@@ -291,8 +297,8 @@ subroutine GFS_rrtmg_setup_timestep_init (      &
       errmsg = ''
       errflg = 0
 
-      call radupdate(idate,jdate,deltsw,deltim,lsswr,me, &
-                     slag,sdec,cdec,solcon)
+      call radupdate(idate,jdate,deltsw,deltim,lsswr,me, iaermdl,&
+           iaerflg, aeros_file,  slag,sdec,cdec,solcon,errflg,errmsg)
 
    end subroutine GFS_rrtmg_setup_timestep_init
 
@@ -322,13 +328,14 @@ end subroutine GFS_rrtmg_setup_finalize
 ! Private functions
 
 
-   subroutine radinit( si, NLAY, imp_physics, me )
+   subroutine radinit( si, NLAY, imp_physics, me, iaermdl, iaerflg, lalw1bd, &
+        aeros_file, errmsg, errflg)
 !...................................
 
 !  ---  inputs:
-!     &     ( si, NLAY, imp_physics, me )
+!     &     ( si, NLAY, imp_physics, me, iaermdl, iaerflg)
 !  ---  outputs:
-!          ( none )
+!          ( errmsg, errflg )
 
 ! =================   subprogram documentation block   ================ !
 !                                                                       !
@@ -435,12 +442,14 @@ subroutine radinit( si, NLAY, imp_physics, me )
       implicit none
 
 !  ---  inputs:
-      integer, intent(in) :: NLAY, me, imp_physics 
-
+      integer, intent(in) :: NLAY, me, imp_physics, iaermdl, iaerflg
+      logical, intent(in) :: lalw1bd
       real (kind=kind_phys), intent(in) :: si(:)
+      character(len=26), intent(in) :: aeros_file
 
-!  ---  outputs: (none, to module variables)
-
+!  ---  outputs: (ccpp error handling)
+      character(len=*),     intent(out) :: errmsg
+      integer,              intent(out) :: errflg
 !  ---  locals:
 
 !
@@ -525,7 +534,7 @@ subroutine radinit( si, NLAY, imp_physics, me )
 
       call sol_init ( me )          !  --- ...  astronomy initialization routine
 
-      call aer_init ( NLAY, me )    !  --- ...  aerosols initialization routine
+      call aer_init ( NLAY, me, iaermdl, iaerflg, lalw1bd, aeros_file, errflg, errmsg)    !  --- ...  aerosols initialization routine
 
       call gas_init ( me )          !  --- ...  co2 and other gases initialization routine
 
@@ -561,8 +570,9 @@ end subroutine radinit
 !> \section gen_radupdate General Algorithm
 !> @{
 !-----------------------------------
-      subroutine radupdate( idate,jdate,deltsw,deltim,lsswr, me,        &
-     &                      slag,sdec,cdec,solcon)
+      subroutine radupdate( idate,jdate,deltsw,deltim,lsswr,me, iaermdl,&
+     &                      iaerflg, aeros_file, slag,sdec,cdec,solcon, &
+     &                      errflg,errmsg)
 !...................................
 
 ! =================   subprogram documentation block   ================ !
@@ -630,13 +640,16 @@ subroutine radupdate( idate,jdate,deltsw,deltim,lsswr, me,        &
       implicit none
 
 !  ---  inputs:
-      integer, intent(in) :: idate(:), jdate(:), me
+      integer, intent(in) :: idate(:), jdate(:), me, iaermdl, iaerflg
       logical, intent(in) :: lsswr
+      character(len=26),intent(in) :: aeros_file
 
       real (kind=kind_phys), intent(in) :: deltsw, deltim
 
 !  ---  outputs:
       real (kind=kind_phys), intent(out) :: slag, sdec, cdec, solcon
+      character(len=*),     intent(out) :: errmsg
+      integer,              intent(out) :: errflg
 
 !  ---  locals:
       integer :: iyear, imon, iday, ihour
@@ -648,6 +661,11 @@ subroutine radupdate( idate,jdate,deltsw,deltim,lsswr, me,        &
 !
 !===> ...  begin here
 !
+
+      ! Initialize the CCPP error handling variables
+      errmsg = ''
+      errflg = 0
+
 !> -# Set up time stamp at fcst time and that for green house gases
 !! (currently co2 only)
 !  --- ...  time stamp at fcst time
@@ -703,7 +721,7 @@ subroutine radupdate( idate,jdate,deltsw,deltim,lsswr, me,        &
 !> -# Call module_radiation_aerosols::aer_update(), monthly update, no
 !! time interpolation
       if ( lmon_chg ) then
-        call aer_update ( iyear, imon, me )
+        call aer_update ( iyear, imon, me, iaermdl, aeros_file, errflg, errmsg )
       endif
 
 !> -# Call co2 and other gases update routine:
diff --git a/physics/GFS_rrtmg_setup.meta b/physics/GFS_rrtmg_setup.meta
index ae0da3a5e..09068b6a6 100644
--- a/physics/GFS_rrtmg_setup.meta
+++ b/physics/GFS_rrtmg_setup.meta
@@ -163,6 +163,35 @@
   dimensions = ()
   type = integer
   intent = in
+[aeros_file]
+  standard_name = aerosol_data_file
+  long_name = aerosol data file
+  units = none
+  dimensions =  ()
+  type = character
+  kind = len=26
+  intent = in
+[lalw1bd]
+  standard_name = flag_for_longwave_aerosol_band_properties
+  long_name = flag for band or multiband longwave aerosol properties
+  units = flag
+  dimensions = ()
+  type = logical
+  intent = in
+[iaermdl]
+  standard_name = flag_for_aerosol_radiation_scheme
+  long_name = flag for aerosol scheme to use in radiation
+  units = flag
+  dimensions = ()
+  type = integer
+  intent = out
+[iaerflg]
+  standard_name = flag_for_aerosol_effects_in_radiation
+  long_name = flag for aerosol effects to include in radiation
+  units = flag
+  dimensions = ()
+  type = integer
+  intent = out
 [errmsg]
   standard_name = ccpp_error_message
   long_name = error message for error handling in CCPP
@@ -227,6 +256,28 @@
   dimensions = ()
   type = integer
   intent = in
+[iaermdl]
+  standard_name = flag_for_aerosol_radiation_scheme
+  long_name = flag for aerosol scheme to use in radiation
+  units = flag
+  dimensions = ()
+  type = integer
+  intent = in
+[iaerflg]
+  standard_name = flag_for_aerosol_effects_in_radiation
+  long_name = flag for aerosol effects to include in radiation
+  units = flag
+  dimensions = ()
+  type = integer
+  intent = in
+[aeros_file]
+  standard_name = aerosol_data_file
+  long_name = aerosol data file
+  units = none
+  dimensions =  ()
+  type = character
+  kind = len=26
+  intent = in
 [slag]
   standard_name = equation_of_time
   long_name = equation of time (radian)
diff --git a/physics/GFS_rrtmgp_setup.F90 b/physics/GFS_rrtmgp_setup.F90
index f7f657b50..54a40d505 100644
--- a/physics/GFS_rrtmgp_setup.F90
+++ b/physics/GFS_rrtmgp_setup.F90
@@ -8,8 +8,7 @@ module GFS_rrtmgp_setup
   !  use GFS_cloud_diagnostics,      only : hml_cloud_diagnostics_initialize
   ! *NOTE* These parameters below are required radiation_****** modules. They are not
   !        directly used by the RRTMGP routines.
-  use physparam,                  only : isolar,  ictmflg, ico2flg, ioznflg, iaerflg,    &
-                                         iaermdl, ivflip
+  use physparam,                  only : isolar,  ictmflg, ico2flg, ioznflg, ivflip
   implicit none
   
   public GFS_rrtmgp_setup_init, GFS_rrtmgp_setup_timestep_init, GFS_rrtmgp_setup_finalize
@@ -43,7 +42,7 @@ subroutine GFS_rrtmgp_setup_init(do_RRTMGP, imp_physics, imp_physics_fer_hires,
        imp_physics_gfdl, imp_physics_thompson, imp_physics_wsm6, imp_physics_zhao_carr,  &
        imp_physics_zhao_carr_pdf, imp_physics_mg,  si, levr, ictm, isol, ico2, iaer,     &
        ntcw, num_p3d,  ntoz, iovr, isubc_sw, isubc_lw, icliq_sw, crick_proof, ccnorm,    &
-       norad_precip, idate, iflip, me, errmsg, errflg)
+       norad_precip, lalw1bd, idate, iflip, me, aeros_file, iaermdl, iaerflg, errmsg, errflg)
 
     ! Inputs
     logical, intent(in) :: do_RRTMGP
@@ -60,15 +59,17 @@ subroutine GFS_rrtmgp_setup_init(do_RRTMGP, imp_physics, imp_physics_fer_hires,
          si
     integer, intent(in) :: levr, ictm, isol, ico2, iaer, & 
          ntcw, num_p3d, ntoz, iovr, isubc_sw, isubc_lw,  &
-         icliq_sw, iflip, me 
+         icliq_sw, iflip, me
     logical, intent(in) :: &
-         crick_proof, ccnorm, norad_precip
+         crick_proof, ccnorm, norad_precip, lalw1bd
     integer, intent(in), dimension(:) :: &
          idate
+    character(len=26),intent(in) :: aeros_file
 
     ! Outputs
     character(len=*), intent(out) :: errmsg
     integer,          intent(out) :: errflg
+    integer,          intent(out) :: iaermdl, iaerflg
     
     ! Initialize the CCPP error handling variables
     errmsg = ''
@@ -128,7 +129,7 @@ subroutine GFS_rrtmgp_setup_init(do_RRTMGP, imp_physics, imp_physics_fer_hires,
 
     ! Call initialization routines..
     call sol_init ( me )
-    call aer_init ( levr, me )
+    call aer_init ( levr, me, iaermdl, iaerflg, lalw1bd, aeros_file, errflg, errmsg)
     call gas_init ( me )
     !call hml_cloud_diagnostics_initialize(imp_physics, imp_physics_fer_hires,           &
     !     imp_physics_gfdl, imp_physics_thompson, imp_physics_wsm6,                      &
@@ -150,8 +151,8 @@ end subroutine GFS_rrtmgp_setup_init
 !> \section arg_table_GFS_rrtmgp_setup_timestep_init
 !! \htmlinclude GFS_rrtmgp_setup_timestep_init.html
 !!
-  subroutine GFS_rrtmgp_setup_timestep_init (idate, jdate, deltsw, deltim, lsswr, me, &
-                                             slag, sdec, cdec, solcon, errmsg, errflg)
+  subroutine GFS_rrtmgp_setup_timestep_init (idate, jdate, deltsw, deltim, lsswr, me, iaermdl,&
+       iaerflg, aeros_file, slag, sdec, cdec, solcon, errmsg, errflg)
      
     ! Inputs
     integer,         intent(in)  :: idate(:)
@@ -160,6 +161,8 @@ subroutine GFS_rrtmgp_setup_timestep_init (idate, jdate, deltsw, deltim, lsswr,
     real(kind_phys), intent(in)  :: deltim
     logical,         intent(in)  :: lsswr
     integer,         intent(in)  :: me
+    integer,         intent(in)  :: iaermdl, iaerflg
+    character(len=26), intent(in) :: aeros_file
 
     ! Outputs
     real(kind_phys), intent(out) :: slag
@@ -230,7 +233,7 @@ subroutine GFS_rrtmgp_setup_timestep_init (idate, jdate, deltsw, deltim, lsswr,
 
     ! Update aerosols...
     if ( lmon_chg ) then
-       call aer_update ( iyear, imon, me )
+       call aer_update ( iyear, imon, me, iaermdl, aeros_file, errflg, errmsg)
     endif
 
     ! Update trace gases (co2 only)...
diff --git a/physics/GFS_rrtmgp_setup.meta b/physics/GFS_rrtmgp_setup.meta
index 41bf63ac8..ea4fdcb88 100644
--- a/physics/GFS_rrtmgp_setup.meta
+++ b/physics/GFS_rrtmgp_setup.meta
@@ -185,6 +185,13 @@
   dimensions = ()
   type = logical
   intent = in
+[lalw1bd]
+  standard_name = flag_for_longwave_aerosol_band_properties
+  long_name = flag for band or multiband longwave aerosol properties
+  units = flag
+  dimensions = ()
+  type = logical
+  intent = in
 [idate]
   standard_name = date_and_time_at_model_initialization_in_united_states_order
   long_name = initialization date and time
@@ -206,6 +213,28 @@
   dimensions = ()
   type = integer
   intent = in
+[aeros_file]
+  standard_name = aerosol_data_file
+  long_name = aerosol data file
+  units = none
+  dimensions =  ()
+  type = character
+  kind = len=26
+  intent = in
+[iaermdl]
+  standard_name = flag_for_aerosol_radiation_scheme
+  long_name = flag for aerosol scheme to use in radiation
+  units = flag
+  dimensions = ()
+  type = integer
+  intent = out
+[iaerflg]
+  standard_name = flag_for_aerosol_effects_in_radiation
+  long_name = flag for aerosol effects to include in radiation
+  units = flag
+  dimensions = ()
+  type = integer
+  intent = out
 [errmsg]
   standard_name = ccpp_error_message
   long_name = error message for error handling in CCPP
@@ -270,6 +299,21 @@
   dimensions = ()
   type = integer
   intent = in
+[aeros_file]
+  standard_name = aerosol_data_file
+  long_name = aerosol data file
+  units = none
+  dimensions =  ()
+  type = character
+  kind = len=26
+  intent = in
+[iaermdl]
+  standard_name = flag_for_aerosol_radiation_scheme
+  long_name = flag for aerosol scheme to use in radiation
+  units = flag
+  dimensions = ()
+  type = integer
+  intent = in
 [slag]
   standard_name = equation_of_time
   long_name = equation of time (radian)
diff --git a/physics/GFS_time_vary_pre.scm.F90 b/physics/GFS_time_vary_pre.scm.F90
index 2bb6b3ceb..17cf09ca9 100644
--- a/physics/GFS_time_vary_pre.scm.F90
+++ b/physics/GFS_time_vary_pre.scm.F90
@@ -122,7 +122,7 @@ subroutine GFS_time_vary_pre_timestep_init (jdat, idat, dtp, nsswr, &
         else if (w3kindreal == 4) then
            rinc4(1:5) = 0
            call w3difdat(jdat,idat,4,rinc4)
-           sec = rina4c(4)
+           sec = rinc4(4)
         else
            write(0,*)' FATAL ERROR: Invalid w3kindreal'
            call abort
diff --git a/physics/physparam.f b/physics/physparam.f
index 5518c6163..0e6a6f663 100644
--- a/physics/physparam.f
+++ b/physics/physparam.f
@@ -157,23 +157,6 @@ module physparam
 !> \name  2.2 For module radiation_aerosols
 ! ............................................. !
 
-!> aerosol model scheme control flag
-!!\n =0:seasonal global distributed OPAC aerosol climatology
-!!\n =1:monthly global distributed GOCART aerosol climatology
-!!\n =2: GOCART prognostic aerosol model
-!!\n =5: OPAC climatoloy with new band mapping
-!!\n Opr GFS=0; Opr CFS=n/a
-      integer, save :: iaermdl = 0
-
-!> aerosol effect control flag
-!!\n 3-digit flag 'abc':
-!!\n a-stratospheric volcanic aerols
-!!\n b-tropospheric aerosols for LW
-!!\n c-tropospheric aerosols for SW
-!!\n =0:aerosol effect is not included; =1:aerosol effect is included
-!!\n Opr GFS/CFS =111; see IAER in run scripts
-      integer, save :: iaerflg = 0
-
 !> external aerosols data file: aerosol.dat
       character, save :: aeros_file*26
 !     data aeros_file   / 'climaeropac_global.txt    ' /
diff --git a/physics/radiation_aerosols.f b/physics/radiation_aerosols.f
index e7fd3631b..20a456cf4 100644
--- a/physics/radiation_aerosols.f
+++ b/physics/radiation_aerosols.f
@@ -15,20 +15,20 @@
 !         inputs:                                                      !
 !           ( NLAY, me )                                               !
 !         outputs:                                                     !
-!           ( none )                                                   !
+!           ( errflg, errmsg )                                         !
 !                                                                      !
 !      'aer_update' -- updating aerosol data                           !
 !         inputs:                                                      !
 !           ( iyear, imon, me )                                        !
 !         outputs:                                                     !
-!           ( none )                                                   !
+!           ( errflg, errmsg )                                         !
 !                                                                      !
 !      'setaer'     -- mapping aeros profile, compute aeros opticals   !
 !         inputs:                                                      !
 !           (prsi,prsl,prslk,tvly,rhlay,slmsk,tracer,aerfld,xlon,xlat, !
 !            IMAX,NLAY,NLP1, lsswr,lslwr,                              !
 !         outputs:                                                     !
-!          (aerosw,aerolw,aerodp)                                      !
+!          (aerosw,aerolw,aerodp,errmsg,errflg)                        !
 !                                                                      !
 !                                                                      !
 !   external modules referenced:                                       !
@@ -157,8 +157,7 @@
       module module_radiation_aerosols   !
 !........................................!
 !
-      use physparam,only : iaermdl, iaerflg, lalw1bd, aeros_file,       &
-     &                     ivflip, kind_phys, kind_io4, kind_io8
+      use machine,  only : kind_phys, kind_io4, kind_io8
       use physcons, only : con_pi, con_rd, con_g, con_t0c, con_c,       &
      &                     con_boltz, con_plnk, con_amd
 
@@ -500,7 +499,8 @@ module module_radiation_aerosols   !
 !! @{
 !-----------------------------------
       subroutine aer_init                                               &
-     &     ( NLAY, me ) !  ---  inputs
+     &     ( NLAY, me, iaermdl, iaerflg, lalw1bd, aeros_file,           &
+     &     errflg, errmsg)
 !  ---  outputs: ( to module variables )
 
 !  ==================================================================  !
@@ -512,7 +512,9 @@ subroutine aer_init                                               &
 !     NLAY    - number of model vertical layers  (not used)            !
 !     me      - print message control flag                             !
 !                                                                      !
-!  outputs: (to module variables)                                      !
+!  outputs: (CCPP error handling)                                      !
+!     errmsg  - CCPP error message                                     !
+!     errflg  - CCPP error flag                                        !
 !                                                                      !
 !  external module variables: (in physparam)                           !
 !     iaermdl - tropospheric aerosol model scheme flag                 !
@@ -543,9 +545,12 @@ subroutine aer_init                                               &
 !  ==================================================================  !
 
 !  ---  inputs:
-      integer,  intent(in) :: NLAY, me
-
-!  ---  output: ( none )
+      integer,          intent(in) :: NLAY, me, iaermdl, iaerflg
+      logical,          intent(in) :: lalw1bd
+      character(len=26),intent(in) :: aeros_file
+!  ---  output:
+      integer,          intent(out) :: errflg
+      character(len=*), intent(out) :: errmsg
 
 !  ---  locals:
       real (kind=kind_phys), dimension(NWVTOT) :: solfwv        ! one wvn sol flux
@@ -553,6 +558,11 @@ subroutine aer_init                                               &
 !
 !===>  ...  begin here
 !
+
+! Initialize CCPP error handling variables
+      errmsg = ''
+      errflg = 0
+
       kyrstr  = 1
       kyrend  = 1
       kyrsav  = 1
@@ -566,9 +576,9 @@ subroutine aer_init                                               &
 
       if ( me == 0 ) then
 
-        call wrt_aerlog      ! write aerosol param info to log file
+        call wrt_aerlog(iaermdl, iaerflg, lalw1bd, errflg, errmsg)      ! write aerosol param info to log file
 !  ---  inputs:   (in scope variables)
-!  ---  outputs:  ( none )
+!  ---  outputs:  (CCPP error handling)
 
       endif
 
@@ -618,9 +628,9 @@ subroutine aer_init                                               &
 !> -# Call set_spectrum() to set up spectral one wavenumber solar/IR
 !! fluxes.
 
-        call set_spectrum
+        call set_spectrum(errflg, errmsg)
 !  ---  inputs:   (module constants)
-!  ---  outputs:  (in-scope variables)
+!  ---  outputs:  (ccpp error handling)
 
 !> -# Call clim_aerinit() to invoke tropospheric aerosol initialization.
 
@@ -628,23 +638,26 @@ subroutine aer_init                                               &
 
           call clim_aerinit                                             &
 !  ---  inputs:
-     &     ( solfwv, eirfwv, me                                         &
+     &     ( solfwv, eirfwv, me, aeros_file,                            &
 !  ---  outputs:
-     &     )
+     &     errflg, errmsg)
 
         elseif ( iaermdl==1 .or. iaermdl==2 ) then  ! gocart clim/prog scheme
 
           call gocart_aerinit                                           &
 !  ---  inputs:
-     &     ( solfwv, eirfwv, me                                         &
+     &     ( solfwv, eirfwv, me,                                        &
 !  ---  outputs:
-     &     )
+     &     errflg, errmsg)
 
         else
           if ( me == 0 ) then
             print *,'  !!! ERROR in aerosol model scheme selection',    &
      &              ' iaermdl =',iaermdl
-            stop
+            errflg = 1
+            errmsg = 'ERROR(aer_init): aerosol model scheme selected'// &
+     &           'is invalid'
+            return
           endif
         endif
 
@@ -655,9 +668,9 @@ subroutine aer_init                                               &
 
       if ( lavoflg ) then
 
-        call set_volcaer
+        call set_volcaer(errflg, errmsg)
 !  ---  inputs:  (module variables)
-!  ---  outputs: (module variables)
+!  ---  outputs: (module variables: ccpp error handling)
 
       endif    ! end if_lavoflg_block
 
@@ -668,10 +681,10 @@ subroutine aer_init                                               &
 
 !> This subroutine writes aerosol parameter configuration to run log file.
 !--------------------------------
-      subroutine wrt_aerlog
+      subroutine wrt_aerlog(iaermdl, iaerflg, lalw1bd, errflg, errmsg)
 !................................
 !  ---  inputs:    (in scope variables)
-!  ---  outputs:   ( none )
+!  ---  outputs:   (CCPP error handling)
 
 !  ==================================================================  !
 !                                                                      !
@@ -682,14 +695,14 @@ subroutine wrt_aerlog
 !  ====================  defination of variables  ===================  !
 !                                                                      !
 !  external module variables:  (in physparam)                          !
-!   iaermdl  - aerosol scheme flag: 0:opac-clm; 1:gocart-clim;         !
-!              2:gocart-prog; 5:opac-clim+new mapping                  !
 !   iaerflg  - aerosol effect control flag: 3-digits (volc,lw,sw)      !
 !   lalwflg  - toposphere lw aerosol effect: =f:no; =t:yes             !
 !   laswflg  - toposphere sw aerosol effect: =f:no; =t:yes             !
 !   lavoflg  - stratospherer volcanic aeros effect: =f:no; =t:yes      !
 !                                                                      !
-!  outputs: ( none )                                                   !
+!  outputs:                                                            !
+!   errmsg   - CCPP error message                                      !
+!   errflg   - CCPP error flag                                         !
 !                                                                      !
 !  subroutines called: none                                            !
 !                                                                      !
@@ -697,13 +710,22 @@ subroutine wrt_aerlog
 !                                                                      !
 !  ==================================================================  !
 
-!  ---  inputs: ( none )
-!  ---  output: ( none )
+!  ---  inputs: ()
+      integer,          intent(in) :: iaermdl, iaerflg
+      logical,          intent(in) :: lalw1bd
+!  ---  output: (CCPP error handling)
+      integer,          intent(out) :: errflg
+      character(len=*), intent(out) :: errmsg
 !  ---  locals:
 
 !
 !===>  ...  begin here
 !
+
+! Initialize CCPP error handling variables
+      errmsg = ''
+      errflg = 0
+
       print *, VTAGAER    ! print out version tag
 
       if ( iaermdl==0 .or. iaermdl==5 ) then
@@ -718,7 +740,10 @@ subroutine wrt_aerlog
       else
         print *,' !!! ERROR in selection of aerosol model scheme',      &
      &          ' IAER_MDL =',iaermdl
-        stop
+        errflg = 1
+        errmsg = 'ERROR(wrt_aerlog): Selected aerosol model scheme is'//&
+     &       'is invalid'
+        return
       endif   ! end_if_iaermdl_block
 
       print *,'   IAER=',iaerflg,'  LW-trop-aer=',lalwflg,              &
@@ -765,10 +790,10 @@ end subroutine wrt_aerlog
 !> This subroutine defines the one wavenumber solar fluxes based on toa
 !! solar spectral distribution, and define the one wavenumber IR fluxes
 !! based on black-body emission distribution at a predefined temperature.
-      subroutine set_spectrum
+      subroutine set_spectrum(errflg, errmsg)
 !................................
 !  ---  inputs:   (module constants)
-!  ---  outputs:  (in-scope variables)
+!  ---  outputs:  (ccpp error handling)
 
 !  ==================================================================  !
 !                                                                      !
@@ -789,6 +814,8 @@ subroutine set_spectrum
 !!                        (\f$W/m^2\f$)
 !!  -   eirfwv(NWVTIR):   ir flux(273k) for each individual wavenumber
 !!                        (\f$W/m^2\f$)
+!!  -   errflg:           CCPP error flag
+!!  -   errmsg:           CCPP error message
 !                                                                      !
 !  subroutines called: none                                            !
 !                                                                      !
@@ -802,11 +829,16 @@ subroutine set_spectrum
 !  ---  output: (in-scope variables)
 !     real (kind=kind_phys), dimension(NWVTOT) :: solfwv        ! one wvn sol flux
 !     real (kind=kind_phys), dimension(NWVTIR) :: eirfwv        ! one wvn ir flux
-
+      integer,          intent(out) :: errflg
+      character(len=*), intent(out) :: errmsg
 !  ---  locals:
       real (kind=kind_phys) :: soltot, tmp1, tmp2, tmp3
 
       integer :: nb, nw, nw1, nw2, nmax, nmin
+
+! Initialize CCPP error handling variables
+      errmsg = ''
+      errflg = 0
 !
 !===>  ...  begin here
 !
@@ -858,11 +890,12 @@ end subroutine set_spectrum
 
 !> The initialization program for stratospheric volcanic aerosols.
 !-----------------------------
-      subroutine set_volcaer
+      subroutine set_volcaer(errflg, errmsg)
 !.............................
-!  ---  inputs:   ( none )
-!  ---  outputs:  (module variables)
-
+!  ---  inputs:   ( none )                                             !
+!  outputs: (CCPP error handling)                                      !
+!   errflg           - CCPP error flag                                 !
+!   errmsg           - CCPP error message                              ! 
 !  ==================================================================  !
 !                                                                      !
 !  subprogram : set_volcaer                                            !
@@ -878,13 +911,19 @@ subroutine set_volcaer
 
 !  ---  inputs: (none)
 
-!  ---  output: (module variables)
+!  ---  output: (CCPP error handling)
 !     integer :: ivolae(:,:,:)
-
+      integer,          intent(out) :: errflg
+      character(len=*), intent(out) :: errmsg
 !  ---  locals:
 !
 !===>  ...  begin here
 !
+
+! Initialize CCPP error handling variables
+      errmsg = ''
+      errflg = 0
+
 !  ---  allocate data space
 
       if ( .not. allocated(ivolae) ) then
@@ -913,8 +952,8 @@ end subroutine aer_init
 !!\section gen_clim_aerinit General Algorithm
 !!@{
       subroutine clim_aerinit                                           &
-     &     ( solfwv, eirfwv, me                                         &          ! ---  inputs
-     &     )                                                           !  ---  outputs
+     &     ( solfwv, eirfwv, me, aeros_file,                            &          ! ---  inputs
+     &     errflg, errmsg)                                                         !  ---  outputs
 
 !  ==================================================================  !
 !                                                                      !
@@ -926,7 +965,9 @@ subroutine clim_aerinit                                           &
 !   eirfwv(NWVTIR)   - ir flux(273k) for each individual wavenum (w/m2)!
 !   me               - print message control flag                      !
 !                                                                      !
-!  outputs: (to module variables)                                      !
+!  outputs: (CCPP error handling)                                      !
+!   errflg           - CCPP error flag                                 !
+!   errmsg           - CCPP error message                              !
 !                                                                      !
 !  external module variables: (in physparam)                           !
 !     iaerflg - abc 3-digit integer aerosol flag (abc:volc,lw,sw)      !
@@ -965,8 +1006,10 @@ subroutine clim_aerinit                                           &
       real (kind=kind_phys), dimension(:) :: eirfwv        ! one wvn ir flux
 
       integer,  intent(in) :: me
-
-!  ---  output: ( none )
+      character(len=26), intent(in) :: aeros_file
+!  ---  output: (CCPP error handling)
+      integer,          intent(out) :: errflg
+      character(len=*), intent(out) :: errmsg
 
 !  ---  locals:
       real (kind=kind_phys), dimension(NAERBND,NCM1)       ::           &
@@ -985,10 +1028,14 @@ subroutine clim_aerinit                                           &
 !
 !===>  ...  begin here
 !
+! Initialize CCPP error handling variables
+      errmsg = ''
+      errflg = 0
+
 !  --- ...  invoke tropospheric aerosol initialization
 
 !> - call set_aercoef() to invoke tropospheric aerosol initialization.
-      call set_aercoef
+      call set_aercoef(aeros_file, errflg, errmsg)
 !  ---  inputs:   (in-scope variables, module constants)
 !  ---  outputs:  (module variables)
 
@@ -1003,10 +1050,10 @@ subroutine clim_aerinit                                           &
 !!\section det_set_aercoef General Algorithm
 !! @{
 !--------------------------------
-      subroutine set_aercoef
+      subroutine set_aercoef(aeros_file,errflg, errmsg)
 !................................
 !  ---  inputs:   (in-scope variables, module constants)
-!  ---  outputs:  (module variables)
+!  ---  outputs:  (CCPP error handling)
 
 !  ==================================================================  !
 !                                                                      !
@@ -1025,6 +1072,9 @@ subroutine set_aercoef
 !   me           - integer, select cpu number as print control flag    !
 !                                                                      !
 !  outputs: (to the module variables)                                  !
+!  outputs: (CCPP error handling)                                      !
+!   errflg       - CCPP error flag                                     !
+!   errmsg       - CCPP error message                                  !
 !                                                                      !
 !  external module variables:  (in physparam)                          !
 !   lalwflg   - module control flag for lw trop-aer: =f:no; =t:yes     !
@@ -1080,7 +1130,10 @@ subroutine set_aercoef
 !  ==================================================================  !
 !
 !  ---  inputs:  ( none )
-!  ---  output: ( none )
+      character(len=26),intent(in) :: aeros_file
+!  ---  output: (CCPP error handling)
+      integer,          intent(out) :: errflg
+      character(len=*), intent(out) :: errmsg
 
 !  ---  locals:
       integer, dimension(NAERBND) :: iendwv
@@ -1094,6 +1147,11 @@ subroutine set_aercoef
 !
 !===>  ...  begin here
 !
+
+! Initialize CCPP error handling variables
+      errmsg = ''
+      errflg = 0
+
 !> -# Reading climatological aerosols optical data from aeros_file,
 !! including:
 
@@ -1108,7 +1166,10 @@ subroutine set_aercoef
         print *,'    Requested aerosol data file "',aeros_file,         &
      &          '" not found!'
         print *,'    *** Stopped in subroutine aero_init !!'
-        stop
+        errflg = 1
+        errmsg = 'ERROR(set_aercoef): Requested aerosol data file '//   &
+     &       aeros_file//' not found'
+        return
       endif     ! end if_file_exist_block
 
 !  --- ...  skip monthly global distribution
@@ -1712,8 +1773,8 @@ end subroutine clim_aerinit
 !! @{
 !-----------------------------------
       subroutine aer_update                                             &
-     &     ( iyear, imon, me ) !  ---  inputs:
-!  ---  outputs: ( to module variables )
+     &     ( iyear, imon, me, iaermdl, aeros_file, errflg, errmsg ) !  ---  inputs:
+!  ---  outputs: ( CCPP error handling )
 
 !  ==================================================================  !
 !                                                                      !
@@ -1725,7 +1786,9 @@ subroutine aer_update                                             &
 !     imon    - month of the year                     1                !
 !     me      - print message control flag            1                !
 !                                                                      !
-!  outputs: ( none )                                                   !
+!  outputs: (CCPP error handling)                                      !
+!     errmsg  - CCPP error message                                     !
+!     errflg  - CCPP error flag                                        !  
 !                                                                      !
 !  external module variables: (in physparam)                           !
 !     lalwflg     - control flag for tropospheric lw aerosol           !
@@ -1739,33 +1802,41 @@ subroutine aer_update                                             &
 !  ==================================================================  !
 
 !  ---  inputs:
-      integer,  intent(in) :: iyear, imon, me
-
+      integer,  intent(in) :: iyear, imon, me, iaermdl
+      character(len=26),intent(in) :: aeros_file
 !  ---  output: ( none )
-
+      integer,          intent(out) :: errflg
+      character(len=*), intent(out) :: errmsg
 !  ---  locals: ( none )
 !
 !===> ...  begin here
 !
+
+! Initialize CCPP error handling variables
+      errmsg = ''
+      errflg = 0
+
       if ( imon < 1 .or. imon > 12 ) then
         print *,' ***** ERROR in specifying requested month !!! ',      &
      &          'imon=', imon
         print *,' ***** STOPPED in subroutinte aer_update !!!'
-        stop
+        errflg = 1
+        errmsg = 'ERROR(aer_update): Requested month not valid'
+        return
       endif
 
 !> -# Call trop_update() to update monthly tropospheric aerosol data.
       if ( lalwflg .or. laswflg ) then
 
         if ( iaermdl == 0 .or. iaermdl==5 ) then    ! opac-climatology scheme
-        call trop_update
+        call trop_update(aeros_file, errflg, errmsg)
         endif
 
       endif
 
 !> -# Call volc_update() to update yearly stratospheric volcanic aerosol data.
       if ( lavoflg ) then
-        call volc_update
+        call volc_update(errflg, errmsg)
       endif
 
 
@@ -1776,10 +1847,10 @@ subroutine aer_update                                             &
 !> This subroutine updates the monthly global distribution of aerosol
 !! profiles in five degree horizontal resolution.
 !--------------------------------
-      subroutine trop_update
+      subroutine trop_update(aeros_file, errflg, errmsg)
 !................................
 !  ---  inputs:    (in scope variables, module variables)
-!  ---  outputs:   (module variables)
+!  ---  outputs:   (CCPP error handling)
 
 !  ==================================================================  !
 !                                                                      !
@@ -1814,7 +1885,10 @@ subroutine trop_update
 !  ==================================================================  !
 
 !  ---  inputs: ( none )
-!  ---  output: ( none )
+      character(len=26),intent(in) :: aeros_file
+!  ---  output: (CCPP error handling)
+      integer,          intent(out) :: errflg
+      character(len=*), intent(out) :: errmsg
 
 !  ---  locals:
 !     real (kind=kind_io8)  :: cmix(NXC), denn, tem
@@ -1828,6 +1902,11 @@ subroutine trop_update
 !
 !===>  ...  begin here
 !
+
+! Initialize CCPP error handling variables
+      errmsg = ''
+      errflg = 0
+
 !  --- ...  reading climatological aerosols data
 
       inquire (file=aeros_file, exist=file_exist)
@@ -1845,7 +1924,10 @@ subroutine trop_update
         print *,'    Requested aerosol data file "',aeros_file,         &
      &          '" not found!'
         print *,'    *** Stopped in subroutine trop_update !!'
-        stop
+        errflg = 1
+        errmsg = 'ERROR(trop_update):Requested aerosol data file '//    &
+     &       aeros_file // ' not found.'
+        return
       endif      ! end if_file_exist_block
 
 !$omp parallel do private(i,j,m)
@@ -1937,10 +2019,10 @@ end subroutine trop_update
 !> This subroutine searches historical volcanic data sets to find and
 !! read in monthly 45-degree lat-zone band of optical depth.
 !--------------------------------
-      subroutine volc_update
+      subroutine volc_update(errflg, errmsg)
 !................................
 !  ---  inputs:    (in scope variables, module variables)
-!  ---  outputs:   (module variables)
+!  ---  outputs:   (CCPP error handling)
 
 !  ==================================================================  !
 !                                                                      !
@@ -1975,6 +2057,8 @@ subroutine volc_update
 
 !  ---  output: (module variables)
 !     integer :: ivolae(:,:,:), kyrstr, kyrend, kyrsav, kmonsav
+      integer,          intent(out) :: errflg
+      character(len=*), intent(out) :: errmsg
 
 !  ---  locals:
       integer :: i, j, k
@@ -1985,6 +2069,11 @@ subroutine volc_update
 !
 !===>  ...  begin here
 !
+
+! Initialize CCPP error handling variables
+      errmsg = ''
+      errflg = 0
+
       kmonsav = imon
 
       if ( kyrstr<=iyear .and. iyear<=kyrend ) then   ! use previously input data
@@ -2039,7 +2128,10 @@ subroutine volc_update
             print *,'   Requested volcanic data file "',                &
      &              volcano_file,'" not found!'
             print *,'   *** Stopped in subroutine VOLC_AERINIT !!'
-            stop
+            errflg = 1
+            errmsg = 'ERROR(volc_update): Requested volcanic data '//   &
+     &              'file '//volcano_file//' not found!'
+            return
           endif   ! end if_file_exist_block
 
         endif   ! end if_iyear_block
@@ -2093,9 +2185,9 @@ end subroutine aer_update
 !-----------------------------------
       subroutine setaer                                                 &
      &     ( prsi,prsl,prslk,tvly,rhlay,slmsk,tracer,aerfld,xlon,xlat,  &   !  ---  inputs
-     &       IMAX,NLAY,NLP1, lsswr,lslwr,                               &
-     &       aerosw,aerolw                                              &   !  ---  outputs
-     &,      aerodp                                                     &
+     &       IMAX,NLAY,NLP1, lsswr,lslwr,iaermdl,iaerflg,top_at_1,      &
+     &       aerosw,aerolw,                                             &   !  ---  outputs
+     &       aerodp, errflg, errmsg                                     &
      &     )
 
 !  ==================================================================  !
@@ -2132,6 +2224,9 @@ subroutine setaer                                                 &
 !     tau_gocart - 550nm aeros opt depth     IMAX*NLAY*MAX_NUM_GRIDCOMP!
 !!    aerodp - vertically integrated optical depth         IMAX*NSPC1  !
 !                                                                      !
+!     errflg  - CCPP error flag                                        !
+!     errmsg  - CCPP error message                                     !
+!                                                                      !
 !  external module variable: (in physparam)                            !
 !     iaerflg - aerosol effect control flag (volc,lw,sw, 3-dig)        !
 !     laswflg - tropospheric aerosol control flag for sw radiation     !
@@ -2140,10 +2235,6 @@ subroutine setaer                                                 &
 !               =f: no lw aeros calc.  =t: do lw aeros calc.           !
 !     lavoflg - control flag for stratospheric vocanic aerosols        !
 !               =t: add volcanic aerosols to the background aerosols   !
-!     ivflip  - control flag for direction of vertical index           !
-!               =0: index from toa to surface                          !
-!               =1: index from surface to toa                          !
-!                                                                      !
 !  internal module variable: (set by subroutine aer_init)              !
 !     ivolae  - stratosphere volcanic aerosol optical depth (fac 1.e4) !
 !                                                     12*4*10          !
@@ -2154,7 +2245,7 @@ subroutine setaer                                                 &
 !  ==================================================================  !
 
 !  ---  inputs:
-      integer, intent(in) :: IMAX, NLAY, NLP1
+      integer, intent(in) :: IMAX, NLAY, NLP1, iaermdl, iaerflg
 
       real (kind=kind_phys), dimension(:,:), intent(in) :: prsi, prsl,  &
      &       prslk, tvly, rhlay
@@ -2163,7 +2254,7 @@ subroutine setaer                                                 &
       real (kind=kind_phys), dimension(:,:,:),intent(in):: tracer
       real (kind=kind_phys), dimension(:,:,:),intent(in):: aerfld
 
-      logical, intent(in) :: lsswr, lslwr
+      logical, intent(in) :: lsswr, lslwr, top_at_1
 
 
 !  ---  outputs:
@@ -2171,6 +2262,8 @@ subroutine setaer                                                 &
      &       aerosw, aerolw
 
       real (kind=kind_phys), dimension(:,:)    , intent(out) :: aerodp
+      integer,          intent(out) :: errflg
+      character(len=*), intent(out) :: errmsg
 
 !  ---  locals:
       real (kind=kind_phys), parameter :: psrfh = 5.0    ! ref press (mb) for upper bound
@@ -2192,6 +2285,10 @@ subroutine setaer                                                 &
 
 !===>  ...  begin here
 
+! Initialize CCPP error handling variables
+      errmsg = ''
+      errflg = 0
+
       do m = 1, NF_AESW
         do j = 1, NBDSW
           do k = 1, NLAY
@@ -2245,7 +2342,7 @@ subroutine setaer                                                 &
 
         lab_do_IMAX : do i = 1, IMAX
 
-          lab_if_flip : if (ivflip == 1) then       ! input from sfc to toa
+          lab_if_flip : if (.not. top_at_1) then       ! input from sfc to toa
 
             do k = 1, NLAY
               prsln(k) = log(prsi(i,k))
@@ -2300,10 +2397,10 @@ subroutine setaer                                                 &
 !  ---  inputs:
      &       ( prsi,prsl,prslk,tvly,rhlay,dz,hz,tracer,                   &
      &         alon,alat,slmsk, laersw,laerlw,                            &
-     &         IMAX,NLAY,NLP1,                                            &
+     &         IMAX,NLAY,NLP1,top_at_1,                                   &
 !    &         IMAX,NLAY,NLP1,NSPC1,                                      &
 !  ---  outputs:
-     &         aerosw,aerolw,aerodp                                       &
+     &         aerosw,aerolw,aerodp,errflg,errmsg                         &
      &       )
 
 !
@@ -2315,7 +2412,7 @@ subroutine setaer                                                 &
      &         alon,alat,slmsk,laersw,laerlw,                             &
      &         IMAX,NLAY,NLP1,                                            &
 !  ---  outputs:
-     &         aerosw,aerolw,aerodp                                       &
+     &         aerosw,aerolw,aerodp,errflg,errmsg                         &
      &       )
         endif     ! end if_iaerflg_block
 
@@ -2402,7 +2499,7 @@ subroutine setaer                                                 &
           endif
         enddo
 
-        if ( ivflip == 0 ) then         ! input data from toa to sfc
+        if (top_at_1) then         ! input data from toa to sfc
 
 !  ---  find lower boundary of stratosphere
 
@@ -2637,7 +2734,7 @@ subroutine setaer                                                 &
             endif      ! end if_NLWBND_block
           endif        ! end if_laddlw_block
 
-        endif                           ! end if_ivflip_block
+        endif                           ! end if_top_at_1_block
 
       endif   ! end if_lavoflg_block
 !
@@ -2680,8 +2777,8 @@ end subroutine setaer
       subroutine aer_property                                           &
      &     ( prsi,prsl,prslk,tvly,rhlay,dz,hz,tracer,                   &     !  ---  inputs:
      &       alon,alat,slmsk, laersw,laerlw,                            &
-     &       IMAX,NLAY,NLP1,                                            &
-     &       aerosw,aerolw,aerodp                                       &     !  ---  outputs:
+     &       IMAX,NLAY,NLP1,top_at_1,                                   &
+     &       aerosw,aerolw,aerodp,errflg,errmsg                         &     !  ---  outputs:
      &     )
 
 !  ==================================================================  !
@@ -2724,11 +2821,6 @@ subroutine aer_property                                           &
 !     NLWBND  - total number of actual lw spectral bands computed      !
 !     NSWLWBD - total number of sw+lw bands computed                   !
 !                                                                      !
-!  external module variables: (in physparam)                           !
-!     ivflip  - control flag for direction of vertical index           !
-!               =0: index from toa to surface                          !
-!               =1: index from surface to toa                          !
-!                                                                      !
 !  module variable: (set by subroutine aer_init)                       !
 !     kprfg   - aerosols profile index                IMXAE*JMXAE      !
 !               1:ant  2:arc  3:cnt  4:mar  5:des  6:marme 7:cntme     !
@@ -2748,7 +2840,7 @@ subroutine aer_property                                           &
 !  ---  inputs:
       integer, intent(in) :: IMAX, NLAY, NLP1
 !     integer, intent(in) :: IMAX, NLAY, NLP1, NSPC
-      logical, intent(in) :: laersw, laerlw
+      logical, intent(in) :: laersw, laerlw, top_at_1
 
       real (kind=kind_phys), dimension(:,:), intent(in) :: prsi, prsl,  &
      &       prslk, tvly, rhlay, dz, hz
@@ -2760,6 +2852,8 @@ subroutine aer_property                                           &
       real (kind=kind_phys), dimension(:,:,:,:), intent(out) ::         &
      &       aerosw, aerolw
       real (kind=kind_phys), dimension(:,:)    , intent(out) :: aerodp
+      integer,          intent(out) :: errflg
+      character(len=*), intent(out) :: errmsg
 
 !  ---  locals:
       real (kind=kind_phys), dimension(NCM) :: cmix
@@ -2786,6 +2880,11 @@ subroutine aer_property                                           &
 !
 !===>  ...  begin here
 !
+
+! Initialize CCPP error handling variables
+      errmsg = ''
+      errflg = 0
+
 !> -# Map aerosol data to model grids
 !!    - Map grid in longitude direction, lon from 0 to 355 deg resolution
 !!    - Map grid in latitude direction, lat from 90n to 90s in 5 deg resolution
@@ -2811,7 +2910,9 @@ subroutine aer_property                                           &
             if ( i3 > IMXAE ) then
               print *,' ERROR! In setclimaer alon>360. ipt =',i,        &
      &           ',  dltg,alon,tlon,dlon =',dltg,alon(i),tmp1,dtmp
-              stop
+              errflg = 1
+              errmsg = 'ERROR(aer_property)'
+              return
             endif
           elseif ( dtmp >= f_zero ) then
             i1 = i3
@@ -2829,7 +2930,9 @@ subroutine aer_property                                           &
             if ( i3 < 1 ) then
               print *,' ERROR! In setclimaer alon< 0. ipt =',i,         &
      &           ',  dltg,alon,tlon,dlon =',dltg,alon(i),tmp1,dtmp
-              stop
+              errflg = 1
+              errmsg = 'ERROR(aer_property)'
+              return
             endif
           endif
         enddo  lab_do_IMXAE
@@ -2848,7 +2951,9 @@ subroutine aer_property                                           &
             if ( j3 >= JMXAE ) then
               print *,' ERROR! In setclimaer alat<-90. ipt =',i,        &
      &           ',  dltg,alat,tlat,dlat =',dltg,alat(i),tmp2,dtmp
-              stop
+              errflg = 1
+              errmsg = 'ERROR(aer_property)'
+              return
             endif
           elseif ( dtmp >= f_zero ) then
             j1 = j3
@@ -2866,7 +2971,9 @@ subroutine aer_property                                           &
             if ( j3 < 1 ) then
               print *,' ERROR! In setclimaer alat>90. ipt =',i,         &
      &           ',  dltg,alat,tlat,dlat =',dltg,alat(i),tmp2,dtmp
-              stop
+              errflg = 1
+              errmsg = 'ERROR(aer_property)'
+              return
             endif
           endif
         enddo  lab_do_JMXAE
@@ -2963,14 +3070,16 @@ subroutine aer_property                                           &
           dz1(k) = dz   (i,k)
         enddo
 
-        lab_if_flip : if (ivflip == 1) then       ! input from sfc to toa
+        lab_if_flip : if (.not. top_at_1) then       ! input from sfc to toa
 
           if ( prsi(i,1) > 100.0 ) then
             rps = f_one / prsi(i,1)
           else
             print *,' !!! (1) Error in subr radiation_aerosols:',       &
      &              ' unrealistic surface pressure =', i,prsi(i,1)
-            stop
+            errflg = 1
+            errmsg = 'ERROR(aer_property): Unrealistic surface pressure'
+            return
           endif
 
           ii = 1
@@ -3043,7 +3152,7 @@ subroutine aer_property                                           &
 !> -# Call radclimaer() to calculate SW/LW aerosol optical properties
 !!    for the corresponding frequency bands.
 
-        call radclimaer
+        call radclimaer(top_at_1)
 !  ---  inputs:  (in-scope variables)
 !  ---  outputs: (in-scope variables)
 
@@ -3104,7 +3213,7 @@ subroutine aer_property                                           &
 !! troposphere, aerosol distribution at each grid point is composed
 !! from up to six components out of ten different substances.
 !--------------------------------
-      subroutine radclimaer
+      subroutine radclimaer(top_at_1)
 !................................
 
 !  ---  inputs:  (in scope variables)
@@ -3140,6 +3249,7 @@ subroutine radclimaer
       parameter (crt1=30.0, crt2=0.03333)
 
 !  ---  inputs:
+      logical, intent(in) :: top_at_1
 !  ---  outputs:
 
 !  ---  locals:
@@ -3342,7 +3452,7 @@ subroutine radclimaer
 !
 !===> ... smooth profile at domain boundaries
 !
-      if ( ivflip == 0 ) then    ! input from toa to sfc
+      if (top_at_1) then    ! input from toa to sfc
 
         do ib = 1, NSWLWBD
         do kk = 2, NLAY
@@ -3419,8 +3529,8 @@ end subroutine aer_property
 !! @{
 !-----------------------------------
       subroutine gocart_aerinit                                         &
-     &     ( solfwv, eirfwv, me                                         &
-     &     )
+     &     ( solfwv, eirfwv, me,                                        &
+     &     errflg, errmsg)
 
 !  ==================================================================  !
 !                                                                      !
@@ -3434,7 +3544,9 @@ subroutine gocart_aerinit                                         &
 !   eirfwv(NWVTIR)   - ir flux(273k) for each individual wavenum (w/m2)!
 !   me               - print message control flag                      !
 !                                                                      !
-!  outputs: (to module variables)                                      !
+!  outputs: (CCPP error handling)                                      !
+!   errflg           - CCPP error flag                                 !
+!   errmsg           - CCPP error message                              !
 !                                                                      !
 !  module variables:                                                   !
 !     NWVSOL  - num of wvnum regions where solar flux is constant      !
@@ -3460,7 +3572,9 @@ subroutine gocart_aerinit                                         &
 
       integer,  intent(in) :: me
 
-!  ---  output: ( none )
+!  ---  output: (CCPP error handling)
+      integer,          intent(out) :: errflg
+      character(len=*), intent(out) :: errmsg
 
 !  ---  locals:
       real (kind=kind_phys), dimension(kaerbndi,kcm1)       ::          &
@@ -3491,13 +3605,20 @@ subroutine gocart_aerinit                                         &
 
 !
 !===>  ...  begin here
+
+! Initialize CCPP error handling variables
+      errmsg = ''
+      errflg = 0
+
 !
 !  --- ...  invoke gocart aerosol initialization
 
 
       if (KCM /= ntrcaerm ) then
         print *, 'ERROR in # of gocart aer species',KCM
-        stop 3000
+        errflg = 1
+        errmsg = 'ERROR(gocart_init): Incorrect # of species'
+        return
       endif
 
 !  --- ...  aloocate and input aerosol optical data
@@ -3814,7 +3935,9 @@ subroutine rd_gocart_luts
        else
          print *,' Requested luts file ',trim(fin),' not found'
          print *,' ** Stopped in rd_gocart_luts ** '
-         stop 1220
+         errflg = 1
+         errmsg = 'Requested luts file '//trim(fin)//' not found'
+         return
        endif      ! end if_file_exist_block
 
        iradius = 5
@@ -3876,7 +3999,9 @@ subroutine rd_gocart_luts
         else
           print *,' Requested luts file ',trim(fin),' not found'
           print *,' ** Stopped in rd_gocart_luts ** '
-          stop 1222
+          errflg = 1
+          errmsg = 'Requested luts file '//trim(fin)//' not found'
+          return
         endif      ! end if_file_exist_block
 
         ibeg  =  radius_lower(ib) - kcm1
@@ -4199,7 +4324,7 @@ subroutine aer_property_gocart                                    &
      &       alon,alat,slmsk, laersw,laerlw,                            &
      &       imax,nlay,nlp1,                                            &
 !  ---  outputs:
-     &       aerosw,aerolw,aerodp                                       &
+     &       aerosw,aerolw,aerodp,errflg,errmsg                         &
      &     )
 
 !  ==================================================================  !
@@ -4242,11 +4367,6 @@ subroutine aer_property_gocart                                    &
 !     NLWBND  - total number of actual lw spectral bands computed      !
 !     NSWLWBD - total number of sw+lw bands computed                   !
 !                                                                      !
-!  external module variables: (in physparam)                           !
-!     ivflip  - control flag for direction of vertical index           !
-!               =0: index from toa to surface                          !
-!               =1: index from surface to toa                          !
-!                                                                      !
 !  module variable: (set by subroutine aer_init)                       !
 !                                                                      !
 !  usage:    call aer_property_gocart                                  !
@@ -4268,6 +4388,8 @@ subroutine aer_property_gocart                                    &
       real (kind=kind_phys), dimension(:,:,:,:), intent(out) ::         &
      &       aerosw, aerolw
       real (kind=kind_phys), dimension(:,:)    , intent(out) :: aerodp
+      integer,          intent(out) :: errflg
+      character(len=*), intent(out) :: errmsg
 
 !  ---  locals:
       real (kind=kind_phys), dimension(nlay,nswlwbd):: tauae,ssaae,asyae
@@ -4281,6 +4403,11 @@ subroutine aer_property_gocart                                    &
 !
 !===>  ...  begin here
 !
+
+! Initialize CCPP error handling variables
+      errmsg = ''
+      errflg = 0
+
       lab_do_IMAXg : do i = 1, IMAX
 
 ! --- initialize tauae, ssaae, asyae
diff --git a/physics/rrtmgp_aerosol_optics.F90 b/physics/rrtmgp_aerosol_optics.F90
index eb7797125..977594d6c 100644
--- a/physics/rrtmgp_aerosol_optics.F90
+++ b/physics/rrtmgp_aerosol_optics.F90
@@ -26,18 +26,22 @@ module rrtmgp_aerosol_optics
 !!
   subroutine rrtmgp_aerosol_optics_run(doSWrad, doLWrad, nCol, nLev, nTracer, nTracerAer,   &
        nDay, idxday, p_lev, p_lay, p_lk, tv_lay, relhum, lsmask, tracer, aerfld, lon, lat,  &
-       aerodp, sw_optical_props_aerosol, lw_optical_props_aerosol, errmsg, errflg       )
+       iaermdl, iaerflg, top_at_1, aerodp, sw_optical_props_aerosol,                        &
+       lw_optical_props_aerosol, errmsg, errflg  )
 
     ! Inputs
     logical, intent(in) :: &
          doSWrad,               & ! Logical flag for shortwave radiation call
-         doLWrad                  ! Logical flag for longwave radiation call 
+         doLWrad,               & ! Logical flag for longwave radiation call 
+         top_at_1                 ! Logical flag for vertical grid direcetion
     integer, intent(in) :: &
          nCol,                  & ! Number of horizontal grid points
          nDay,                  & ! Number of daylit points
          nLev,                  & ! Number of vertical layers
          nTracer,               & ! Number of tracers
-         nTracerAer               ! Number of aerosol tracers
+         nTracerAer,            & ! Number of aerosol tracers
+         iaermdl,               & ! Aerosol model scheme flag
+         iaerflg                  ! Aerosol effects to include
     integer,intent(in),dimension(:) :: &
          idxday              ! Indices for daylit points.
     real(kind_phys), dimension(:), intent(in) :: &
@@ -83,7 +87,7 @@ subroutine rrtmgp_aerosol_optics_run(doSWrad, doLWrad, nCol, nLev, nTracer, nTra
 
     ! Call module_radiation_aerosols::setaer(),to setup aerosols property profile
     call setaer(p_lev*0.01, p_lay*0.01, p_lk, tv_lay, relhum, lsmask, tracer, aerfld, lon, lat, nCol, nLev, &
-         nLev+1, .true., .true., aerosolssw2, aerosolslw, aerodp)
+         nLev+1, .true., .true., iaermdl, iaerflg, top_at_1, aerosolssw2, aerosolslw, aerodp, errflg, errmsg)
 
     ! Shortwave
     if (nDay .gt. 0) then
diff --git a/physics/rrtmgp_aerosol_optics.meta b/physics/rrtmgp_aerosol_optics.meta
index f0c37edc0..516943d49 100644
--- a/physics/rrtmgp_aerosol_optics.meta
+++ b/physics/rrtmgp_aerosol_optics.meta
@@ -21,6 +21,13 @@
   dimensions = ()
   type = logical
   intent = in
+[top_at_1]
+  standard_name = flag_for_vertical_ordering_in_RRTMGP
+  long_name = flag for vertical ordering in RRTMGP
+  units = flag
+  dimensions = ()
+  type = logical
+  intent = in
 [ncol]
   standard_name = horizontal_loop_extent
   long_name = horizontal dimension
@@ -143,6 +150,20 @@
   type = real
   kind = kind_phys
   intent = in
+[iaermdl]
+  standard_name = flag_for_aerosol_radiation_scheme
+  long_name = flag for aerosol scheme to use in radiation
+  units = flag
+  dimensions = ()
+  type = integer
+  intent = in
+[iaerflg]
+  standard_name = flag_for_aerosol_effects_in_radiation
+  long_name = flag for aerosol effects to include in radiation
+  units = flag
+  dimensions = ()
+  type = integer
+  intent = in
 [aerodp]
   standard_name = atmosphere_optical_thickness_due_to_ambient_aerosol_particles
   long_name = vertical integrated optical depth for various aerosol species

From 11f1ef0351411e6b05160458c7b7ebe60fabf588 Mon Sep 17 00:00:00 2001
From: Dustin Swales <dustin.swales@noaa.gov>
Date: Mon, 15 Aug 2022 12:27:19 -0600
Subject: [PATCH 005/115] Remove dependency on physcons and physparam in
 radiation_aerosols.f. Provided as ccpp interstitials.

---
 physics/GFS_rrtmg_pre.F90          |  28 +++--
 physics/GFS_rrtmg_pre.meta         |  34 +++++--
 physics/GFS_rrtmg_setup.F90        |  28 ++---
 physics/GFS_rrtmg_setup.meta       |  42 +++++++-
 physics/GFS_rrtmgp_setup.F90       |   8 +-
 physics/GFS_rrtmgp_setup.meta      |  40 ++++++++
 physics/physparam.f                |  18 ----
 physics/radiation_aerosols.f       | 158 ++++++++++++++++-------------
 physics/rrtmgp_aerosol_optics.F90  |  10 +-
 physics/rrtmgp_aerosol_optics.meta |  24 +++++
 10 files changed, 258 insertions(+), 132 deletions(-)

diff --git a/physics/GFS_rrtmg_pre.F90 b/physics/GFS_rrtmg_pre.F90
index b4b69d447..3387e7d40 100644
--- a/physics/GFS_rrtmg_pre.F90
+++ b/physics/GFS_rrtmg_pre.F90
@@ -34,7 +34,7 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp,        &
         rog, rocp, con_rd, xlat_d, xlat, xlon, coslat, sinlat, tsfc, slmsk,    &
         prsi, prsl, prslk, tgrs, sfc_wts, mg_cld, effrr_in, pert_clds,         &
         sppt_wts, sppt_amp, cnvw_in, cnvc_in, qgrs, aer_nm, dx, icloud,        & 
-        iaermdl, iaerflg,                                                      & !inputs from here and above
+        iaermdl, iaerflg, con_pi, con_g,                                       & !inputs from here and above
         coszen, coszdg, effrl_inout, effri_inout, effrs_inout,                 &
         clouds1, clouds2, clouds3, clouds4, clouds5, qci_conv,                 & !in/out from here and above
         kd, kt, kb, mtopa, mbota, raddt, tsfg, tsfa, de_lgth, alb1d, delp, dz, & !output from here and below
@@ -48,8 +48,6 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp,        &
 
       use machine,                   only: kind_phys
 
-      use physparam
-
       use radcons,                   only: itsfc,ltp, lextop, qmin,  &
                                            qme5, qme6, epsq, prsmin
       use funcphys,                  only: fpvs
@@ -130,7 +128,7 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp,        &
       real(kind_phys),      intent(in) :: spp_wts_rad(:,:)
 
       real(kind=kind_phys), intent(in) :: fhswr, fhlwr, solhr, sup, julian, sppt_amp
-      real(kind=kind_phys), intent(in) :: con_eps, epsm1, fvirt, rog, rocp, con_rd
+      real(kind=kind_phys), intent(in) :: con_eps, epsm1, fvirt, rog, rocp, con_rd, con_pi, con_g
 
       real(kind=kind_phys), dimension(:), intent(in) :: xlat_d, xlat, xlon,    &
                                                         coslat, sinlat, tsfc,  &
@@ -258,7 +256,7 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp,        &
       errflg = 0
 
       ! Vertical ordering
-      top_at_1 = (prsi(1,1) .lt.  prsi(1, lm))
+      top_at_1 = (prsi(1,1) .lt.  prsi(1, LMP))
       
       if (.not. (lsswr .or. lslwr)) return
 
@@ -285,7 +283,7 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp,        &
 !  variables
 
       if ( lextop ) then
-        if ( ivflip == 1 ) then    ! vertical from sfc upward
+        if (.not. top_at_1) then   ! vertical from sfc upward
           kd = 0                   ! index diff between in/out and local
           kt = 1                   ! index diff between lyr and upper bound
           kb = 0                   ! index diff between lyr and lower bound
@@ -301,16 +299,16 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp,        &
           llb = 1                  ! local index at toa level
           lya = 2                  ! local index for the 2nd layer from top
           lyb = 1                  ! local index for the top layer
-        endif                      ! end if_ivflip_block
+        endif                      ! end if_top_at_1_block
       else
         kd = 0
-        if ( ivflip == 1 ) then    ! vertical from sfc upward
+        if (.not. top_at_1) then   ! vertical from sfc upward
           kt = 1                   ! index diff between lyr and upper bound
           kb = 0                   ! index diff between lyr and lower bound
         else                       ! vertical from toa downward
           kt = 0                   ! index diff between lyr and upper bound
           kb = 1                   ! index diff between lyr and lower bound
-        endif                      ! end if_ivflip_block
+        endif                      ! end if_top_at_1_block
       endif   ! end if_lextop_block
 
       raddt = min(fhswr, fhlwr)
@@ -337,7 +335,7 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp,        &
 !
 
       lsk = 0
-      if (ivflip == 0 .and. lm < levs) lsk = levs - lm
+      if (top_at_1 .and. lm < levs) lsk = levs - lm
 
 !     convert pressure unit from pa to mb
       do k = 1, LM
@@ -366,7 +364,7 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp,        &
         enddo
       enddo
 !
-      if (ivflip == 0) then                                ! input data from toa to sfc
+      if (top_at_1) then                                ! input data from toa to sfc
         if (lsk > 0) then
           k1 = 1 + kd
           k2 = k1 + kb
@@ -475,7 +473,7 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp,        &
         enddo
       enddo
 
-      if (ivflip == 0) then              ! input data from toa to sfc
+      if (top_at_1) then              ! input data from toa to sfc
         do i = 1, IM
           tem1d (i)   = QME6
           tem2da(i,1) = log( plyr(i,1) )
@@ -605,7 +603,7 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp,        &
           dzb(i,1) = hzb(i,1) - hz(i,1)
         enddo
 
-      endif                              ! end_if_ivflip
+      endif                              ! end_if_top_at_1
 
 !>  - Call module_radiation_aerosols::setaer(),to setup aerosols
 !! property profile for radiation.
@@ -637,8 +635,8 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp,        &
 
       call setaer (plvl, plyr, prslk1, tvly, rhly, slmsk,    & !  ---  inputs
                    tracer1, aer_nm, xlon, xlat, IM, LMK, LMP,&
-                   lsswr,lslwr,iaermdl,iaerflg,top_at_1,     &
-                   faersw,faerlw,aerodp,errflg,errmsg)         !  ---  outputs
+                   lsswr, lslwr, iaermdl, iaerflg, top_at_1, con_pi,  &
+                   con_rd, con_g, faersw, faerlw, aerodp, errflg, errmsg)         !  ---  outputs
 
 ! CCPP
       do j = 1,NBDSW
diff --git a/physics/GFS_rrtmg_pre.meta b/physics/GFS_rrtmg_pre.meta
index e15ca3730..0c2240720 100644
--- a/physics/GFS_rrtmg_pre.meta
+++ b/physics/GFS_rrtmg_pre.meta
@@ -2,7 +2,7 @@
   name = GFS_rrtmg_pre
   type = scheme
   dependencies = funcphys.f90,iounitdef.f,machine.F,module_bfmicrophysics.f,module_mp_radar.F90,module_mp_thompson.F90
-  dependencies = module_mp_thompson_make_number_concentrations.F90,physparam.f,physcons.F90,radcons.f90,radiation_aerosols.f
+  dependencies = module_mp_thompson_make_number_concentrations.F90,radcons.f90,radiation_aerosols.f
   dependencies = radiation_astronomy.f,radiation_clouds.f,radiation_gases.f,radlw_param.f,radsw_param.f,surface_perturbation.F90,radiation_cloud_overlap.F90
 
 ########################################################################
@@ -639,6 +639,30 @@
   type = real
   kind = kind_phys
   intent = in
+[con_pi]
+  standard_name = pi
+  long_name = ratio of a circle's circumference to its diameter
+  units = none
+  dimensions = ()
+  type = real
+  kind = kind_phys
+  intent = in
+[con_rd]
+  standard_name = gas_constant_of_dry_air
+  long_name = ideal gas constant for dry air
+  units = J kg-1 K-1
+  dimensions = ()
+  type = real
+  kind = kind_phys
+  intent = in
+[con_g]
+  standard_name = gravitational_acceleration
+  long_name = gravitational acceleration
+  units = m s-2
+  dimensions = ()
+  type = real
+  kind = kind_phys
+  intent = in
 [epsm1]
   standard_name = ratio_of_dry_air_to_water_vapor_gas_constants_minus_one
   long_name = (rd/rv) - 1
@@ -671,14 +695,6 @@
   type = real
   kind = kind_phys
   intent = in
-[con_rd]
-  standard_name = gas_constant_of_dry_air
-  long_name = ideal gas constant for dry air
-  units = J kg-1 K-1
-  dimensions = ()
-  type = real
-  kind = kind_phys
-  intent = in
 [xlat_d]
   standard_name = latitude_in_degree
   long_name = latitude in degree north
diff --git a/physics/GFS_rrtmg_setup.F90 b/physics/GFS_rrtmg_setup.F90
index ebe34a705..8fb417f61 100644
--- a/physics/GFS_rrtmg_setup.F90
+++ b/physics/GFS_rrtmg_setup.F90
@@ -4,13 +4,11 @@
 !> \defgroup GFS_rrtmg_setup_mod GFS RRTMG Scheme Setup
 module GFS_rrtmg_setup
 
-   use physparam, only : isolar , ictmflg, ico2flg, ioznflg, &
-   &                                         icldflg,                 &
+   use physparam, only : isolar , ictmflg, ico2flg, ioznflg, icldflg, &
    &             iovrRad=>iovr, lcrick , lcnorm , lnoprec,            &
    &             isubcsw, isubclw, ivflip , ipsd0,                    &
-   &             iswcliq,                                             &
-   &             kind_phys
-
+   &             iswcliq
+   use machine, only:  kind_phys
    use radcons, only: ltp, lextop
 
    implicit none
@@ -49,7 +47,8 @@ subroutine GFS_rrtmg_setup_init (                          &
           imp_physics,                                        &
           norad_precip, idate, iflip,                         &
           do_RRTMGP, me, lalw1bd, iaermdl, iaerflg,           &
-          aeros_file, errmsg, errflg)
+          aeros_file, con_pi, con_t0c, con_c, con_boltz,      &
+          con_plnk, errmsg, errflg)
 ! =================   subprogram documentation block   ================ !
 !                                                                       !
 ! subprogram:   GFS_rrtmg_setup_init - a subprogram to initialize radiation !
@@ -170,7 +169,8 @@ subroutine GFS_rrtmg_setup_init (                          &
       integer, intent(in) :: iflip
       logical, intent(in) :: do_RRTMGP, lalw1bd
       integer, intent(in) :: me
-      character(len=26), intent(in) :: aeros_file
+      character(len=26),intent(in)  :: aeros_file
+      real(kind_phys),  intent(in)  :: con_pi,con_t0c,con_c,con_boltz,con_plnk
       character(len=*), intent(out) :: errmsg
       integer,          intent(out) :: errflg
       integer,          intent(out) :: iaermdl, iaerflg
@@ -245,7 +245,8 @@ subroutine GFS_rrtmg_setup_init (                          &
       call radinit                                                      &
 !  ---  inputs:
      &     ( si, levr, imp_physics, me, iaermdl, iaerflg, lalw1bd,      &
-     &       aeros_file, errmsg, errflg )
+     &       aeros_file, con_pi, con_t0c, con_c, con_boltz, con_plnk,   &
+     &       errmsg, errflg )
 !  ---  outputs:
 !          ( none )
 
@@ -297,8 +298,8 @@ subroutine GFS_rrtmg_setup_timestep_init (      &
       errmsg = ''
       errflg = 0
 
-      call radupdate(idate,jdate,deltsw,deltim,lsswr,me, iaermdl,&
-           iaerflg, aeros_file,  slag,sdec,cdec,solcon,errflg,errmsg)
+      call radupdate(idate,jdate,deltsw,deltim,lsswr,me,iaermdl,&
+           iaerflg,aeros_file,slag,sdec,cdec,solcon,errflg,errmsg)
 
    end subroutine GFS_rrtmg_setup_timestep_init
 
@@ -329,7 +330,7 @@ end subroutine GFS_rrtmg_setup_finalize
 
 
    subroutine radinit( si, NLAY, imp_physics, me, iaermdl, iaerflg, lalw1bd, &
-        aeros_file, errmsg, errflg)
+        aeros_file, con_pi, con_t0c, con_c, con_boltz, con_plnk, errmsg, errflg)
 !...................................
 
 !  ---  inputs:
@@ -444,7 +445,7 @@ subroutine radinit( si, NLAY, imp_physics, me, iaermdl, iaerflg, lalw1bd, &
 !  ---  inputs:
       integer, intent(in) :: NLAY, me, imp_physics, iaermdl, iaerflg
       logical, intent(in) :: lalw1bd
-      real (kind=kind_phys), intent(in) :: si(:)
+      real (kind=kind_phys), intent(in) :: si(:), con_pi,con_t0c, con_c, con_boltz, con_plnk
       character(len=26), intent(in) :: aeros_file
 
 !  ---  outputs: (ccpp error handling)
@@ -534,7 +535,8 @@ subroutine radinit( si, NLAY, imp_physics, me, iaermdl, iaerflg, lalw1bd, &
 
       call sol_init ( me )          !  --- ...  astronomy initialization routine
 
-      call aer_init ( NLAY, me, iaermdl, iaerflg, lalw1bd, aeros_file, errflg, errmsg)    !  --- ...  aerosols initialization routine
+      call aer_init ( NLAY, me, iaermdl, iaerflg, lalw1bd, aeros_file, con_pi, &
+           con_t0c, con_c, con_boltz, con_plnk, errflg, errmsg)    !  --- ...  aerosols initialization routine
 
       call gas_init ( me )          !  --- ...  co2 and other gases initialization routine
 
diff --git a/physics/GFS_rrtmg_setup.meta b/physics/GFS_rrtmg_setup.meta
index 09068b6a6..6ca7552cc 100644
--- a/physics/GFS_rrtmg_setup.meta
+++ b/physics/GFS_rrtmg_setup.meta
@@ -2,7 +2,7 @@
   name = GFS_rrtmg_setup
   type = scheme
   dependencies = iounitdef.f,module_bfmicrophysics.f,physparam.f,radcons.f90,radiation_aerosols.f,radiation_astronomy.f,radiation_clouds.f
-  dependencies = module_mp_thompson.F90,radiation_gases.f,radlw_main.F90,radlw_param.f,radsw_main.F90,radsw_param.f
+  dependencies = module_mp_thompson.F90,radiation_gases.f,radlw_main.F90,radlw_param.f,radsw_main.F90,radsw_param.f,machine.F
 
 ########################################################################
 [ccpp-arg-table]
@@ -171,6 +171,46 @@
   type = character
   kind = len=26
   intent = in
+[con_pi]
+  standard_name = pi
+  long_name = ratio of a circle's circumference to its diameter
+  units = none
+  dimensions = ()
+  type = real
+  kind = kind_phys
+  intent = in
+[con_c]
+  standard_name = speed_of_light_in_vacuum
+  long_name = speed of light in vacuum
+  units = m s-1
+  dimensions = ()
+  type = real
+  kind = kind_phys
+  intent = in
+[con_plnk]
+  standard_name = planck_constant
+  long_name = Planck constant
+  units = J s-1
+  dimensions = ()
+  type = real
+  kind = kind_phys
+  intent = in
+[con_boltz]
+  standard_name = boltzmann_constant
+  long_name = Boltzmann constant
+  units = J K-1
+  dimensions = ()
+  type = real
+  kind = kind_phys
+  intent = in
+[con_t0c]
+  standard_name = temperature_at_zero_celsius
+  long_name = temperature at 0 degree Celsius
+  units = K
+  dimensions = ()
+  type = real
+  kind = kind_phys
+  intent = in
 [lalw1bd]
   standard_name = flag_for_longwave_aerosol_band_properties
   long_name = flag for band or multiband longwave aerosol properties
diff --git a/physics/GFS_rrtmgp_setup.F90 b/physics/GFS_rrtmgp_setup.F90
index 54a40d505..b8e5d4fd7 100644
--- a/physics/GFS_rrtmgp_setup.F90
+++ b/physics/GFS_rrtmgp_setup.F90
@@ -42,7 +42,8 @@ subroutine GFS_rrtmgp_setup_init(do_RRTMGP, imp_physics, imp_physics_fer_hires,
        imp_physics_gfdl, imp_physics_thompson, imp_physics_wsm6, imp_physics_zhao_carr,  &
        imp_physics_zhao_carr_pdf, imp_physics_mg,  si, levr, ictm, isol, ico2, iaer,     &
        ntcw, num_p3d,  ntoz, iovr, isubc_sw, isubc_lw, icliq_sw, crick_proof, ccnorm,    &
-       norad_precip, lalw1bd, idate, iflip, me, aeros_file, iaermdl, iaerflg, errmsg, errflg)
+       norad_precip, lalw1bd, idate, iflip, me, aeros_file, iaermdl, iaerflg, con_pi,    &
+       con_t0c, con_c, con_boltz, con_plnk, errmsg, errflg)
 
     ! Inputs
     logical, intent(in) :: do_RRTMGP
@@ -55,6 +56,8 @@ subroutine GFS_rrtmgp_setup_init(do_RRTMGP, imp_physics, imp_physics_fer_hires,
          imp_physics_zhao_carr,     & ! Flag for zhao-carr scheme
          imp_physics_zhao_carr_pdf, & ! Flag for zhao-carr+PDF scheme
          imp_physics_mg               ! Flag for MG scheme
+    real(kind_phys), intent(in) :: &
+         con_pi, con_t0c, con_c, con_boltz, con_plnk
     real(kind_phys), dimension(:), intent(in) :: &
          si
     integer, intent(in) :: levr, ictm, isol, ico2, iaer, & 
@@ -129,7 +132,8 @@ subroutine GFS_rrtmgp_setup_init(do_RRTMGP, imp_physics, imp_physics_fer_hires,
 
     ! Call initialization routines..
     call sol_init ( me )
-    call aer_init ( levr, me, iaermdl, iaerflg, lalw1bd, aeros_file, errflg, errmsg)
+    call aer_init ( levr, me, iaermdl, iaerflg, lalw1bd, aeros_file, con_pi, con_t0c,    &
+         con_c, con_boltz, con_plnk, errflg, errmsg)
     call gas_init ( me )
     !call hml_cloud_diagnostics_initialize(imp_physics, imp_physics_fer_hires,           &
     !     imp_physics_gfdl, imp_physics_thompson, imp_physics_wsm6,                      &
diff --git a/physics/GFS_rrtmgp_setup.meta b/physics/GFS_rrtmgp_setup.meta
index ea4fdcb88..028495f14 100644
--- a/physics/GFS_rrtmgp_setup.meta
+++ b/physics/GFS_rrtmgp_setup.meta
@@ -221,6 +221,46 @@
   type = character
   kind = len=26
   intent = in
+[con_pi]
+  standard_name = pi
+  long_name = ratio of a circle's circumference to its diameter
+  units = none
+  dimensions = ()
+  type = real
+  kind = kind_phys
+  intent = in
+[con_c]
+  standard_name = speed_of_light_in_vacuum
+  long_name = speed of light in vacuum
+  units = m s-1
+  dimensions = ()
+  type = real
+  kind = kind_phys
+  intent = in
+[con_plnk]
+  standard_name = planck_constant
+  long_name = Planck constant
+  units = J s-1
+  dimensions = ()
+  type = real
+  kind = kind_phys
+  intent = in
+[con_boltz]
+  standard_name = boltzmann_constant
+  long_name = Boltzmann constant
+  units = J K-1
+  dimensions = ()
+  type = real
+  kind = kind_phys
+  intent = in
+[con_t0c]
+  standard_name = temperature_at_zero_celsius
+  long_name = temperature at 0 degree Celsius
+  units = K
+  dimensions = ()
+  type = real
+  kind = kind_phys
+  intent = in
 [iaermdl]
   standard_name = flag_for_aerosol_radiation_scheme
   long_name = flag for aerosol scheme to use in radiation
diff --git a/physics/physparam.f b/physics/physparam.f
index 0e6a6f663..b6dd84c99 100644
--- a/physics/physparam.f
+++ b/physics/physparam.f
@@ -119,15 +119,6 @@ module physparam
 !!      \cite fu_et_al_1998 method
       integer,save      :: ilwcice = 3
 
-! ............................................. !
-!>\name  1.3 Control flag for LW aerosol property
-
-!> selects 1 band or multi bands for LW aerosol properties
-!!\n =.true.:aerosol properties calculated in 1 broad LW band
-!!\n =.false.:aerosol properties calculated in all LW bands
-!!\n variable names diff in Opr CFS
-      logical,parameter :: lalw1bd =.false.
-
 !==================================================================================
 !  Section - 2 -
 !     values of control flags might be re-set in initialization subroutines
@@ -153,15 +144,6 @@ module physparam
 !     data solar_file   / 'solarconstantdata.txt     ' /
       data solar_file   / 'solarconstant_noaa_a0.txt ' /
 
-! ............................................. !
-!> \name  2.2 For module radiation_aerosols
-! ............................................. !
-
-!> external aerosols data file: aerosol.dat
-      character, save :: aeros_file*26
-!     data aeros_file   / 'climaeropac_global.txt    ' /
-      data aeros_file   / 'aerosol.dat               ' /
-
 ! ............................................. !
 !> \name  2.3 For module radiation_gases
 ! ............................................. !
diff --git a/physics/radiation_aerosols.f b/physics/radiation_aerosols.f
index 20a456cf4..a96b1d942 100644
--- a/physics/radiation_aerosols.f
+++ b/physics/radiation_aerosols.f
@@ -32,8 +32,6 @@
 !                                                                      !
 !                                                                      !
 !   external modules referenced:                                       !
-!       'module physparam'               in 'physparam.f'              !
-!       'module physcons'                in 'physcons.f'               !
 !       'module module_radsw_parameters' in 'radsw_xxxx#_param.f'      !
 !       'module module_radlw_parameters' in 'radlw_xxxx#_param.f'      !
 !       'module module_radlw_cntr_para'  in 'radsw_xxxx#_param.f'      !
@@ -158,9 +156,6 @@ module module_radiation_aerosols   !
 !........................................!
 !
       use machine,  only : kind_phys, kind_io4, kind_io8
-      use physcons, only : con_pi, con_rd, con_g, con_t0c, con_c,       &
-     &                     con_boltz, con_plnk, con_amd
-
       use module_iounitdef,        only : NIAERCM
       use module_radsw_parameters, only : NBDSW,  wvnsw1=>wvnum1,       &
      &                                    NSWSTR, wvnsw2=>wvnum2
@@ -499,9 +494,8 @@ module module_radiation_aerosols   !
 !! @{
 !-----------------------------------
       subroutine aer_init                                               &
-     &     ( NLAY, me, iaermdl, iaerflg, lalw1bd, aeros_file,           &
-     &     errflg, errmsg)
-!  ---  outputs: ( to module variables )
+     &     ( NLAY, me, iaermdl, iaerflg, lalw1bd, aeros_file, con_pi,   &
+     &     con_t0c, con_c, con_boltz, con_plnk, errflg, errmsg)
 
 !  ==================================================================  !
 !                                                                      !
@@ -511,26 +505,26 @@ subroutine aer_init                                               &
 !  inputs:                                                             !
 !     NLAY    - number of model vertical layers  (not used)            !
 !     me      - print message control flag                             !
+!     iaermdl - tropospheric aerosol model scheme flag                 !
+!               =0 opac-clim; =1 gocart-clim, =2 gocart-prognostic     !
+!               =5 opac-clim new spectral mapping                      !
+!     lalw1bd = logical lw aeros propty 1 band vs multi-band cntl flag !
+!               =t use 1 broad band optical property                   !
+!               =f use multi bands optical property                    !
 !                                                                      !
 !  outputs: (CCPP error handling)                                      !
 !     errmsg  - CCPP error message                                     !
 !     errflg  - CCPP error flag                                        !
 !                                                                      !
-!  external module variables: (in physparam)                           !
-!     iaermdl - tropospheric aerosol model scheme flag                 !
-!               =0 opac-clim; =1 gocart-clim, =2 gocart-prognostic     !
-!               =5 opac-clim new spectral mapping                      !
+!  internal module variables:                                          !
 !     lalwflg - logical lw aerosols effect control flag                !
 !               =t compute lw aerosol optical prop                     !
 !     laswflg - logical sw aerosols effect control flag                !
 !               =t compute sw aerosol optical prop                     !
 !     lavoflg - logical stratosphere volcanic aerosol control flag     !
 !               =t include volcanic aerosol effect                     !
-!     lalw1bd = logical lw aeros propty 1 band vs multi-band cntl flag !
-!               =t use 1 broad band optical property                   !
-!               =f use multi bands optical property                    !
 !                                                                      !
-!  module constants:                                                   !
+!  internal module constants:                                          !
 !     NWVSOL  - num of wvnum regions where solar flux is constant      !
 !     NWVTOT  - total num of wave numbers used in sw spectrum          !
 !     NWVTIR  - total num of wave numbers used in the ir region        !
@@ -548,6 +542,8 @@ subroutine aer_init                                               &
       integer,          intent(in) :: NLAY, me, iaermdl, iaerflg
       logical,          intent(in) :: lalw1bd
       character(len=26),intent(in) :: aeros_file
+      real(kind_phys),  intent(in) :: con_pi,con_t0c, con_c, con_boltz, & 
+     &     con_plnk
 !  ---  output:
       integer,          intent(out) :: errflg
       character(len=*), intent(out) :: errmsg
@@ -628,14 +624,14 @@ subroutine aer_init                                               &
 !> -# Call set_spectrum() to set up spectral one wavenumber solar/IR
 !! fluxes.
 
-        call set_spectrum(errflg, errmsg)
+        call set_spectrum(con_pi, con_t0c, con_c, con_boltz, con_plnk,  &
+     &        errflg, errmsg)
 !  ---  inputs:   (module constants)
 !  ---  outputs:  (ccpp error handling)
 
 !> -# Call clim_aerinit() to invoke tropospheric aerosol initialization.
 
         if ( iaermdl==0 .or. iaermdl==5 ) then      ! opac-climatology scheme
-
           call clim_aerinit                                             &
 !  ---  inputs:
      &     ( solfwv, eirfwv, me, aeros_file,                            &
@@ -682,10 +678,6 @@ subroutine aer_init                                               &
 !> This subroutine writes aerosol parameter configuration to run log file.
 !--------------------------------
       subroutine wrt_aerlog(iaermdl, iaerflg, lalw1bd, errflg, errmsg)
-!................................
-!  ---  inputs:    (in scope variables)
-!  ---  outputs:   (CCPP error handling)
-
 !  ==================================================================  !
 !                                                                      !
 !  subprogram : wrt_aerlog                                             !
@@ -694,11 +686,14 @@ subroutine wrt_aerlog(iaermdl, iaerflg, lalw1bd, errflg, errmsg)
 !                                                                      !
 !  ====================  defination of variables  ===================  !
 !                                                                      !
-!  external module variables:  (in physparam)                          !
-!   iaerflg  - aerosol effect control flag: 3-digits (volc,lw,sw)      !
+!  internal module variables:                                          !
 !   lalwflg  - toposphere lw aerosol effect: =f:no; =t:yes             !
 !   laswflg  - toposphere sw aerosol effect: =f:no; =t:yes             !
-!   lavoflg  - stratospherer volcanic aeros effect: =f:no; =t:yes      !
+!   lavoflg  - stratosphere volcanic aeros effect: =f:no; =t:yes       !
+!                                                                      !
+!  inputs:                                                             !
+!   iaerflg  - aerosol effect control flag: 3-digits (volc,lw,sw)      !
+!   iaermdl  - tropospheric aerosol model scheme flag                  !
 !                                                                      !
 !  outputs:                                                            !
 !   errmsg   - CCPP error message                                      !
@@ -790,10 +785,8 @@ end subroutine wrt_aerlog
 !> This subroutine defines the one wavenumber solar fluxes based on toa
 !! solar spectral distribution, and define the one wavenumber IR fluxes
 !! based on black-body emission distribution at a predefined temperature.
-      subroutine set_spectrum(errflg, errmsg)
-!................................
-!  ---  inputs:   (module constants)
-!  ---  outputs:  (ccpp error handling)
+      subroutine set_spectrum(con_pi, con_t0c, con_c, con_boltz,        &
+     &     con_plnk, errflg, errmsg)
 
 !  ==================================================================  !
 !                                                                      !
@@ -805,7 +798,14 @@ subroutine set_spectrum(errflg, errmsg)
 !                                                                      !
 !  ====================  defination of variables  ===================  !
 !                                                                      !
-!> -  inputs:  (module constants)
+!> -  inputs: (CCPP Interstitials)
+!!  -   con_pi:  Physical constant (pi)
+!!  -   con_t0c: Physical constant (temperature kelvin at zero celcius)
+!!  -   con_c:   Physical constant (speed of light)
+!!  -   con_boltz: Physical constant (Boltzmann constant)
+!!  -   con_plnk: Physical constant (Planck constant)
+!!
+!> -  inputs: (in-scope variables)
 !!  -   NWVTOT:  total num of wave numbers used in sw spectrum
 !!  -   NWVTIR:  total num of wave numbers used in the ir region
 !!
@@ -814,6 +814,8 @@ subroutine set_spectrum(errflg, errmsg)
 !!                        (\f$W/m^2\f$)
 !!  -   eirfwv(NWVTIR):   ir flux(273k) for each individual wavenumber
 !!                        (\f$W/m^2\f$)
+!!
+!> -  outputs: (CCPP error-handling) 
 !!  -   errflg:           CCPP error flag
 !!  -   errmsg:           CCPP error message
 !                                                                      !
@@ -825,10 +827,14 @@ subroutine set_spectrum(errflg, errmsg)
 
 !  ---  inputs: (module constants)
 !     integer :: NWVTOT, NWVTIR
+!  ---  inputs: (CCPP Interstitials)
+      real(kind_phys),intent(in) :: con_pi, con_t0c, con_c, con_boltz,  &
+     &     con_plnk
 
 !  ---  output: (in-scope variables)
 !     real (kind=kind_phys), dimension(NWVTOT) :: solfwv        ! one wvn sol flux
 !     real (kind=kind_phys), dimension(NWVTIR) :: eirfwv        ! one wvn ir flux
+!  ---  output: (CCPP error-handling)
       integer,          intent(out) :: errflg
       character(len=*), intent(out) :: errmsg
 !  ---  locals:
@@ -964,26 +970,17 @@ subroutine clim_aerinit                                           &
 !   solfwv(NWVTOT)   - solar flux for each individual wavenumber (w/m2)!
 !   eirfwv(NWVTIR)   - ir flux(273k) for each individual wavenum (w/m2)!
 !   me               - print message control flag                      !
+!   aeros_file       - external aerosol data file name                 !
 !                                                                      !
 !  outputs: (CCPP error handling)                                      !
 !   errflg           - CCPP error flag                                 !
 !   errmsg           - CCPP error message                              !
 !                                                                      !
-!  external module variables: (in physparam)                           !
-!     iaerflg - abc 3-digit integer aerosol flag (abc:volc,lw,sw)      !
-!               a: =0 use background stratospheric aerosol             !
-!                  =1 incl stratospheric vocanic aeros (MINVYR-MAXVYR) !
-!               b: =0 no topospheric aerosol in lw radiation           !
-!                  =1 include tropspheric aerosols for lw radiation    !
-!               c: =0 no topospheric aerosol in sw radiation           !
-!                  =1 include tropspheric aerosols for sw radiation    !
+!  internal module variables:                                          !
 !     lalwflg - logical lw aerosols effect control flag                !
 !               =t compute lw aerosol optical prop                     !
 !     laswflg - logical sw aerosols effect control flag                !
 !               =t compute sw aerosol optical prop                     !
-!     lalw1bd = logical lw aeros propty 1 band vs multi-band cntl flag !
-!               =t use 1 broad band optical property                   !
-!               =f use multi bands optical property                    !
 !                                                                      !
 !  module constants:                                                   !
 !     NWVSOL  - num of wvnum regions where solar flux is constant      !
@@ -1004,7 +1001,6 @@ subroutine clim_aerinit                                           &
 !  ---  inputs:
       real (kind=kind_phys), dimension(:) :: solfwv        ! one wvn sol flux
       real (kind=kind_phys), dimension(:) :: eirfwv        ! one wvn ir flux
-
       integer,  intent(in) :: me
       character(len=26), intent(in) :: aeros_file
 !  ---  output: (CCPP error handling)
@@ -1076,7 +1072,7 @@ subroutine set_aercoef(aeros_file,errflg, errmsg)
 !   errflg       - CCPP error flag                                     !
 !   errmsg       - CCPP error message                                  !
 !                                                                      !
-!  external module variables:  (in physparam)                          !
+!  external module variables:                                          !
 !   lalwflg   - module control flag for lw trop-aer: =f:no; =t:yes     !
 !   laswflg   - module control flag for sw trop-aer: =f:no; =t:yes     !
 !   aeros_file- external aerosol data file name                        !
@@ -1536,7 +1532,7 @@ subroutine optavg
 !   NSWBND           - total number of sw spectral bands               !
 !   NLWBND           - total number of lw spectral bands               !
 !                                                                      !
-! external module variables:  (in physparam)                           !
+! external module variables:                                           !
 !   laswflg          - control flag for sw spectral region             !
 !   lalwflg          - control flag for lw spectral region             !
 !                                                                      !
@@ -1773,24 +1769,25 @@ end subroutine clim_aerinit
 !! @{
 !-----------------------------------
       subroutine aer_update                                             &
-     &     ( iyear, imon, me, iaermdl, aeros_file, errflg, errmsg ) !  ---  inputs:
-!  ---  outputs: ( CCPP error handling )
+     &     ( iyear, imon, me, iaermdl, aeros_file, errflg, errmsg )
 
 !  ==================================================================  !
 !                                                                      !
 !  aer_update checks and update time varying climatology aerosol       !
 !    data sets.                                                        !
 !                                                                      !
-!  inputs:                                          size               !
-!     iyear   - 4-digit calender year                 1                !
-!     imon    - month of the year                     1                !
-!     me      - print message control flag            1                !
+!  inputs:                                                  size       !
+!     iyear      - 4-digit calender year                      1        !
+!     imon       - month of the year                          1        !
+!     me         - print message control flag                 1        !
+!     iaermdl    - tropospheric aerosol model scheme flag     1        !
+!     aeros_file - external aerosol data file name          len=26     !
 !                                                                      !
-!  outputs: (CCPP error handling)                                      !
-!     errmsg  - CCPP error message                                     !
+!  outputs: (CCPP error handling)                           len=*      !
+!     errmsg  - CCPP error message                            1        !
 !     errflg  - CCPP error flag                                        !  
 !                                                                      !
-!  external module variables: (in physparam)                           !
+!  internal module variables:                                          !
 !     lalwflg     - control flag for tropospheric lw aerosol           !
 !     laswflg     - control flag for tropospheric sw aerosol           !
 !     lavoflg     - control flag for stratospheric volcanic aerosol    !
@@ -1804,7 +1801,7 @@ subroutine aer_update                                             &
 !  ---  inputs:
       integer,  intent(in) :: iyear, imon, me, iaermdl
       character(len=26),intent(in) :: aeros_file
-!  ---  output: ( none )
+!  ---  output: (CCPP error-handling)
       integer,          intent(out) :: errflg
       character(len=*), intent(out) :: errmsg
 !  ---  locals: ( none )
@@ -1848,9 +1845,6 @@ subroutine aer_update                                             &
 !! profiles in five degree horizontal resolution.
 !--------------------------------
       subroutine trop_update(aeros_file, errflg, errmsg)
-!................................
-!  ---  inputs:    (in scope variables, module variables)
-!  ---  outputs:   (CCPP error handling)
 
 !  ==================================================================  !
 !                                                                      !
@@ -1864,11 +1858,14 @@ subroutine trop_update(aeros_file, errflg, errmsg)
 !  inputs:  (in-scope variables, module constants)                     !
 !   imon     - integer, month of the year                              !
 !   me       - integer, print message control flag                     !
+!  inputs:  (CCPP Interstitials)                                       !
+!   aeros_file   - external aerosol data file name                     !
 !                                                                      !
 !  outputs: (module variables)                                         !
-!                                                                      !
-!  external module variables: (in physparam)                           !
-!    aeros_file   - external aerosol data file name                    !
+! 
+!  outputs: (CCPP error-handling)                                      !
+!   errmsg  - Error message                                            !
+!   errflg  - Error flag                                               !
 !                                                                      !
 !  internal module variables:                                          !
 !    kprfg (    IMXAE*JMXAE)   - aeros profile index                   !
@@ -1884,7 +1881,7 @@ subroutine trop_update(aeros_file, errflg, errmsg)
 !                                                                      !
 !  ==================================================================  !
 
-!  ---  inputs: ( none )
+!  ---  inputs: (CCPP Interstitials)
       character(len=26),intent(in) :: aeros_file
 !  ---  output: (CCPP error handling)
       integer,          intent(out) :: errflg
@@ -2046,6 +2043,10 @@ subroutine volc_update(errflg, errmsg)
 !   kyrsav   - integer, the year of data in use in the input file      !
 !   kmonsav  - integer, the month of data in use in the input file     !
 !                                                                      !
+!  outputs: (CCPP error-handling)                                      !
+!   errmsg  - Error message                                            !
+!   errflg  - Error flag                                               !
+!                                                                      ! 
 !  subroutines called: none                                            !
 !                                                                      !
 !  usage:    call volc_aerinit                                         !
@@ -2057,6 +2058,7 @@ subroutine volc_update(errflg, errmsg)
 
 !  ---  output: (module variables)
 !     integer :: ivolae(:,:,:), kyrstr, kyrend, kyrsav, kmonsav
+!  ---  output: (CCPP error-handling)
       integer,          intent(out) :: errflg
       character(len=*), intent(out) :: errmsg
 
@@ -2186,7 +2188,7 @@ end subroutine aer_update
       subroutine setaer                                                 &
      &     ( prsi,prsl,prslk,tvly,rhlay,slmsk,tracer,aerfld,xlon,xlat,  &   !  ---  inputs
      &       IMAX,NLAY,NLP1, lsswr,lslwr,iaermdl,iaerflg,top_at_1,      &
-     &       aerosw,aerolw,                                             &   !  ---  outputs
+     &       con_pi,con_rd,con_g,aerosw,aerolw,                         &   !  ---  outputs
      &       aerodp, errflg, errmsg                                     &
      &     )
 
@@ -2211,6 +2213,12 @@ subroutine setaer                                                 &
 !     NLAY,NLP1-vertical dimensions of arrays                   1      !
 !     lsswr,lslwr                                                      !
 !             - logical flags for sw/lw radiation calls         1      !
+!     con_pi  - Physical constant (pi)                                 !
+!     con_t0c - Physical constant (temperature kelvin at zero celcius) !
+!     con_c   - Physical constant (speed of light)                     !
+!     iaermdl - tropospheric aerosol model scheme flag                 !
+!     iaerflg - aerosol effect control flag                            ! 
+!     top_at_1 - Vertical ordering convection flag                     !
 !                                                                      !
 !  outputs:                                                            !
 !     aerosw - aeros opt properties for sw      IMAX*NLAY*NBDSW*NF_AESW!
@@ -2227,8 +2235,7 @@ subroutine setaer                                                 &
 !     errflg  - CCPP error flag                                        !
 !     errmsg  - CCPP error message                                     !
 !                                                                      !
-!  external module variable: (in physparam)                            !
-!     iaerflg - aerosol effect control flag (volc,lw,sw, 3-dig)        !
+!  internal module variable:                                           !
 !     laswflg - tropospheric aerosol control flag for sw radiation     !
 !               =f: no sw aeros calc.  =t: do sw aeros calc.           !
 !     lalwflg - tropospheric aerosol control flag for lw radiation     !
@@ -2246,7 +2253,7 @@ subroutine setaer                                                 &
 
 !  ---  inputs:
       integer, intent(in) :: IMAX, NLAY, NLP1, iaermdl, iaerflg
-
+      real (kind=kind_phys), intent(in) :: con_pi, con_rd, con_g
       real (kind=kind_phys), dimension(:,:), intent(in) :: prsi, prsl,  &
      &       prslk, tvly, rhlay
       real (kind=kind_phys), dimension(:),   intent(in) :: xlon, xlat,  &
@@ -2280,10 +2287,12 @@ subroutine setaer                                                 &
       logical               :: laddlw=.false.,  laerlw=.false.
 
 !  ---  conversion constants
-      real (kind=kind_phys), parameter :: rdg  = 180.0 / con_pi
-      real (kind=kind_phys), parameter :: rovg = 0.001 * con_rd / con_g
+      real (kind=kind_phys) :: rdg
+      real (kind=kind_phys) :: rovg
 
 !===>  ...  begin here
+      rdg  = 180._kind_phys / con_pi
+      rovg = 0.001_kind_phys * con_rd / con_g
 
 ! Initialize CCPP error handling variables
       errmsg = ''
@@ -2409,7 +2418,7 @@ subroutine setaer                                                 &
           call aer_property_gocart                                        &
 !  ---  inputs:
      &       ( prsi,prsl,prslk,tvly,rhlay,dz,hz,tracer,aerfld,            &
-     &         alon,alat,slmsk,laersw,laerlw,                             &
+     &         alon,alat,slmsk,laersw,laerlw,con_rd,                      &
      &         IMAX,NLAY,NLP1,                                            &
 !  ---  outputs:
      &         aerosw,aerolw,aerodp,errflg,errmsg                         &
@@ -2804,6 +2813,7 @@ subroutine aer_property                                           &
 !     IMAX    - horizontal dimension of arrays                  1      !
 !     NLAY,NLP1-vertical dimensions of arrays                   1      !
 !!    NSPC    - num of species for optional aod output fields   1      !
+!     top_at_1 - vertical ordering flag                                !
 !                                                                      !
 !  outputs:                                                            !
 !     aerosw - aeros opt properties for sw      IMAX*NLAY*NBDSW*NF_AESW!
@@ -2816,6 +2826,9 @@ subroutine aer_property                                           &
 !               (:,:,:,3): asymmetry parameter                         !
 !!    aerodp - vertically integrated aer-opt-depth         IMAX*NSPC+1 !
 !                                                                      !
+!     errflg  - CCPP error flag                                        !
+!     errmsg  - CCPP error message                                     !
+!                                                                      !
 !  module parameters and constants:                                    !
 !     NSWBND  - total number of actual sw spectral bands computed      !
 !     NLWBND  - total number of actual lw spectral bands computed      !
@@ -4109,7 +4122,7 @@ subroutine optavg_gocart
 !   nswbnd           - total number of sw spectral bands               !
 !   nlwbnd           - total number of lw spectral bands               !
 !                                                                      !
-! external module variables:  (in physparam)                           !
+! external module variables:                                           !
 !   laswflg          - control flag for sw spectral region             !
 !   lalwflg          - control flag for lw spectral region             !
 !                                                                      !
@@ -4321,7 +4334,7 @@ subroutine aer_property_gocart                                    &
 
 !  ---  inputs:
      &     ( prsi,prsl,prslk,tvly,rhlay,dz,hz,tracer,aerfld,            &
-     &       alon,alat,slmsk, laersw,laerlw,                            &
+     &       alon,alat,slmsk, laersw,laerlw,con_rd,                     &
      &       imax,nlay,nlp1,                                            &
 !  ---  outputs:
      &       aerosw,aerolw,aerodp,errflg,errmsg                         &
@@ -4350,6 +4363,7 @@ subroutine aer_property_gocart                                    &
 !             - logical flag for sw/lw aerosol calculations            !
 !     IMAX    - horizontal dimension of arrays                  1      !
 !     NLAY,NLP1-vertical dimensions of arrays                   1      !
+!     con_rd  - Physical constant (gas constant for dry air)           !
 !                                                                      !
 !  outputs:                                                            !
 !     aerosw - aeros opt properties for sw      IMAX*NLAY*NBDSW*NF_AESW!
@@ -4361,6 +4375,8 @@ subroutine aer_property_gocart                                    &
 !               (:,:,:,2): single scattering albedo                    !
 !               (:,:,:,3): asymmetry parameter                         !
 !     aerodp - vertically integrated aer-opt-depth         IMAX*NSPC+1 !
+!     errflg  - CCPP error flag                                        !
+!     errmsg  - CCPP error message                                     !
 !                                                                      !
 !  module parameters and constants:                                    !
 !     NSWBND  - total number of actual sw spectral bands computed      !
@@ -4376,7 +4392,7 @@ subroutine aer_property_gocart                                    &
 !  ---  inputs:
       integer, intent(in) :: IMAX, NLAY, NLP1
       logical, intent(in) :: laersw, laerlw
-
+      real (kind=kind_phys), intent(in) :: con_rd
       real (kind=kind_phys), dimension(:,:), intent(in) :: prsi, prsl,  &
      &       prslk, tvly, rhlay, dz, hz
       real (kind=kind_phys), dimension(:),   intent(in) :: alon, alat,  &
diff --git a/physics/rrtmgp_aerosol_optics.F90 b/physics/rrtmgp_aerosol_optics.F90
index 977594d6c..d53f3ffb8 100644
--- a/physics/rrtmgp_aerosol_optics.F90
+++ b/physics/rrtmgp_aerosol_optics.F90
@@ -26,7 +26,7 @@ module rrtmgp_aerosol_optics
 !!
   subroutine rrtmgp_aerosol_optics_run(doSWrad, doLWrad, nCol, nLev, nTracer, nTracerAer,   &
        nDay, idxday, p_lev, p_lay, p_lk, tv_lay, relhum, lsmask, tracer, aerfld, lon, lat,  &
-       iaermdl, iaerflg, top_at_1, aerodp, sw_optical_props_aerosol,                        &
+       iaermdl, iaerflg, top_at_1, con_pi, con_rd, con_g, aerodp, sw_optical_props_aerosol, &
        lw_optical_props_aerosol, errmsg, errflg  )
 
     ! Inputs
@@ -43,7 +43,11 @@ subroutine rrtmgp_aerosol_optics_run(doSWrad, doLWrad, nCol, nLev, nTracer, nTra
          iaermdl,               & ! Aerosol model scheme flag
          iaerflg                  ! Aerosol effects to include
     integer,intent(in),dimension(:) :: &
-         idxday              ! Indices for daylit points.
+         idxday                   ! Indices for daylit points.
+    real(kind_phys),intent(in) :: &
+         con_pi,                & ! Physical constant (pi)
+         con_rd,                & ! Physical constant (gas constant for dry-air)
+         con_g                    ! Physical constant (gravitational constant)
     real(kind_phys), dimension(:), intent(in) :: &
          lon,                   & ! Longitude
          lat,                   & ! Latitude
@@ -87,7 +91,7 @@ subroutine rrtmgp_aerosol_optics_run(doSWrad, doLWrad, nCol, nLev, nTracer, nTra
 
     ! Call module_radiation_aerosols::setaer(),to setup aerosols property profile
     call setaer(p_lev*0.01, p_lay*0.01, p_lk, tv_lay, relhum, lsmask, tracer, aerfld, lon, lat, nCol, nLev, &
-         nLev+1, .true., .true., iaermdl, iaerflg, top_at_1, aerosolssw2, aerosolslw, aerodp, errflg, errmsg)
+         nLev+1, .true., .true., iaermdl, iaerflg, top_at_1, con_pi, con_rd, con_g, aerosolssw2, aerosolslw, aerodp, errflg, errmsg)
 
     ! Shortwave
     if (nDay .gt. 0) then
diff --git a/physics/rrtmgp_aerosol_optics.meta b/physics/rrtmgp_aerosol_optics.meta
index 516943d49..f2fc09be6 100644
--- a/physics/rrtmgp_aerosol_optics.meta
+++ b/physics/rrtmgp_aerosol_optics.meta
@@ -28,6 +28,30 @@
   dimensions = ()
   type = logical
   intent = in
+[con_pi]
+  standard_name = pi
+  long_name = ratio of a circle's circumference to its diameter
+  units = none
+  dimensions = ()
+  type = real
+  kind = kind_phys
+  intent = in
+[con_rd]
+  standard_name = gas_constant_of_dry_air
+  long_name = ideal gas constant for dry air
+  units = J kg-1 K-1
+  dimensions = ()
+  type = real
+  kind = kind_phys
+  intent = in
+[con_g]
+  standard_name = gravitational_acceleration
+  long_name = gravitational acceleration
+  units = m s-2
+  dimensions = ()
+  type = real
+  kind = kind_phys
+  intent = in
 [ncol]
   standard_name = horizontal_loop_extent
   long_name = horizontal dimension

From 063e15d3f9380416ae04a76424274380f2316660 Mon Sep 17 00:00:00 2001
From: Dustin Swales <dustin.swales@noaa.gov>
Date: Mon, 15 Aug 2022 12:55:02 -0600
Subject: [PATCH 006/115] bug fix in argument list.

---
 physics/GFS_rrtmgp_setup.F90 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/physics/GFS_rrtmgp_setup.F90 b/physics/GFS_rrtmgp_setup.F90
index b8e5d4fd7..3339d64ae 100644
--- a/physics/GFS_rrtmgp_setup.F90
+++ b/physics/GFS_rrtmgp_setup.F90
@@ -156,7 +156,7 @@ end subroutine GFS_rrtmgp_setup_init
 !! \htmlinclude GFS_rrtmgp_setup_timestep_init.html
 !!
   subroutine GFS_rrtmgp_setup_timestep_init (idate, jdate, deltsw, deltim, lsswr, me, iaermdl,&
-       iaerflg, aeros_file, slag, sdec, cdec, solcon, errmsg, errflg)
+       aeros_file, slag, sdec, cdec, solcon, errmsg, errflg)
      
     ! Inputs
     integer,         intent(in)  :: idate(:)
@@ -165,7 +165,7 @@ subroutine GFS_rrtmgp_setup_timestep_init (idate, jdate, deltsw, deltim, lsswr,
     real(kind_phys), intent(in)  :: deltim
     logical,         intent(in)  :: lsswr
     integer,         intent(in)  :: me
-    integer,         intent(in)  :: iaermdl, iaerflg
+    integer,         intent(in)  :: iaermdl
     character(len=26), intent(in) :: aeros_file
 
     ! Outputs

From 225f5b566a7a96c9782e6dc856f217088106d929 Mon Sep 17 00:00:00 2001
From: Dustin Swales <dustin.swales@noaa.gov>
Date: Mon, 15 Aug 2022 15:10:40 -0600
Subject: [PATCH 007/115] Remove dependency on physcons and physparam in
 radiation_astronomy.f. Provided as ccpp interstitials.

---
 physics/GFS_rrtmg_setup.F90   | 50 +++++++++++------------
 physics/GFS_rrtmg_setup.meta  | 39 ++++++++++++++++++
 physics/GFS_rrtmgp_setup.F90  | 23 +++++------
 physics/GFS_rrtmgp_setup.meta | 39 ++++++++++++++++++
 physics/physparam.f           | 19 ---------
 physics/radiation_astronomy.f | 74 ++++++++++++++++++++---------------
 6 files changed, 159 insertions(+), 85 deletions(-)

diff --git a/physics/GFS_rrtmg_setup.F90 b/physics/GFS_rrtmg_setup.F90
index 8fb417f61..1960ff11e 100644
--- a/physics/GFS_rrtmg_setup.F90
+++ b/physics/GFS_rrtmg_setup.F90
@@ -4,7 +4,7 @@
 !> \defgroup GFS_rrtmg_setup_mod GFS RRTMG Scheme Setup
 module GFS_rrtmg_setup
 
-   use physparam, only : isolar , ictmflg, ico2flg, ioznflg, icldflg, &
+   use physparam, only : ictmflg, ico2flg, ioznflg, icldflg, &
    &             iovrRad=>iovr, lcrick , lcnorm , lnoprec,            &
    &             isubcsw, isubclw, ivflip , ipsd0,                    &
    &             iswcliq
@@ -41,14 +41,14 @@ module GFS_rrtmg_setup
 !! \htmlinclude GFS_rrtmg_setup_init.html
 !!
    subroutine GFS_rrtmg_setup_init (                          &
-          si, levr, ictm, isol, ico2, iaer, ntcw,             &
+          si, levr, ictm, isol, solar_file, ico2, iaer, ntcw, &
           num_p3d, npdf3d, ntoz, iovr, isubc_sw, isubc_lw,    &
           icliq_sw, crick_proof, ccnorm,                      &
           imp_physics,                                        &
           norad_precip, idate, iflip,                         &
           do_RRTMGP, me, lalw1bd, iaermdl, iaerflg,           &
           aeros_file, con_pi, con_t0c, con_c, con_boltz,      &
-          con_plnk, errmsg, errflg)
+          con_plnk, con_solr_2008, con_solr_2002, errmsg, errflg)
 ! =================   subprogram documentation block   ================ !
 !                                                                       !
 ! subprogram:   GFS_rrtmg_setup_init - a subprogram to initialize radiation !
@@ -169,8 +169,8 @@ subroutine GFS_rrtmg_setup_init (                          &
       integer, intent(in) :: iflip
       logical, intent(in) :: do_RRTMGP, lalw1bd
       integer, intent(in) :: me
-      character(len=26),intent(in)  :: aeros_file
-      real(kind_phys),  intent(in)  :: con_pi,con_t0c,con_c,con_boltz,con_plnk
+      character(len=26),intent(in)  :: aeros_file, solar_file
+      real(kind_phys),  intent(in)  :: con_pi,con_t0c,con_c,con_boltz,con_plnk,con_solr_2008,con_solr_2002
       character(len=*), intent(out) :: errmsg
       integer,          intent(out) :: errflg
       integer,          intent(out) :: iaermdl, iaerflg
@@ -187,7 +187,6 @@ subroutine GFS_rrtmg_setup_init (                          &
         return
       end if
 
-      isolar = isol                     ! solar constant control flag
       ictmflg= ictm                     ! data ic time/date control flag
       ico2flg= ico2                     ! co2 data source control flag
       ioznflg= ntoz                     ! ozone data source control flag
@@ -246,7 +245,7 @@ subroutine GFS_rrtmg_setup_init (                          &
 !  ---  inputs:
      &     ( si, levr, imp_physics, me, iaermdl, iaerflg, lalw1bd,      &
      &       aeros_file, con_pi, con_t0c, con_c, con_boltz, con_plnk,   &
-     &       errmsg, errflg )
+     &       isol, solar_file, con_solr_2008, con_solr_2002, errmsg, errflg )
 !  ---  outputs:
 !          ( none )
 
@@ -267,7 +266,7 @@ end subroutine GFS_rrtmg_setup_init
 !!
    subroutine GFS_rrtmg_setup_timestep_init (      &
           idate, jdate, deltsw, deltim, lsswr, me, iaermdl, &
-          iaerflg, aeros_file, slag, sdec, cdec, solcon, errmsg, errflg)
+          iaerflg, isol, aeros_file, slag, sdec, cdec, solcon, con_pi, errmsg, errflg)
 
       implicit none
 
@@ -276,9 +275,10 @@ subroutine GFS_rrtmg_setup_timestep_init (      &
       integer,              intent(in)  :: jdate(:)
       real(kind=kind_phys), intent(in)  :: deltsw
       real(kind=kind_phys), intent(in)  :: deltim
+      real(kind=kind_phys), intent(in)  :: con_pi
       logical,              intent(in)  :: lsswr
       integer,              intent(in)  :: me
-      integer,              intent(in)  :: iaermdl, iaerflg
+      integer,              intent(in)  :: iaermdl, iaerflg, isol
       character(len=26),    intent(in)  :: aeros_file
       real(kind=kind_phys), intent(out) :: slag
       real(kind=kind_phys), intent(out) :: sdec
@@ -299,7 +299,7 @@ subroutine GFS_rrtmg_setup_timestep_init (      &
       errflg = 0
 
       call radupdate(idate,jdate,deltsw,deltim,lsswr,me,iaermdl,&
-           iaerflg,aeros_file,slag,sdec,cdec,solcon,errflg,errmsg)
+           iaerflg,isol,aeros_file,slag,sdec,cdec,solcon,con_pi,errflg,errmsg)
 
    end subroutine GFS_rrtmg_setup_timestep_init
 
@@ -330,7 +330,8 @@ end subroutine GFS_rrtmg_setup_finalize
 
 
    subroutine radinit( si, NLAY, imp_physics, me, iaermdl, iaerflg, lalw1bd, &
-        aeros_file, con_pi, con_t0c, con_c, con_boltz, con_plnk, errmsg, errflg)
+        aeros_file, con_pi, con_t0c, con_c, con_boltz, con_plnk, isol,       &
+        solar_file, con_solr_2008, con_solr_2002, errmsg, errflg)
 !...................................
 
 !  ---  inputs:
@@ -443,10 +444,11 @@ subroutine radinit( si, NLAY, imp_physics, me, iaermdl, iaerflg, lalw1bd, &
       implicit none
 
 !  ---  inputs:
-      integer, intent(in) :: NLAY, me, imp_physics, iaermdl, iaerflg
+      integer, intent(in) :: NLAY, me, imp_physics, iaermdl, iaerflg, isol
       logical, intent(in) :: lalw1bd
-      real (kind=kind_phys), intent(in) :: si(:), con_pi,con_t0c, con_c, con_boltz, con_plnk
-      character(len=26), intent(in) :: aeros_file
+      real (kind=kind_phys), intent(in) :: si(:), con_pi,con_t0c, con_c, &
+           con_boltz, con_plnk, con_solr_2008, con_solr_2002
+      character(len=26), intent(in) :: aeros_file, solar_file
 
 !  ---  outputs: (ccpp error handling)
       character(len=*),     intent(out) :: errmsg
@@ -469,7 +471,7 @@ subroutine radinit( si, NLAY, imp_physics, me, iaermdl, iaerflg, lalw1bd, &
      &          '  May 01 2007'
         print *, VTAGRAD                !print out version tag
         print *,' - Selected Control Flag settings: ICTMflg=',ictmflg,  &
-     &    ' ISOLar =',isolar, ' ICO2flg=',ico2flg,' IAERflg=',iaerflg,  &
+     &    ' ISOLar =',isol, ' ICO2flg=',ico2flg,' IAERflg=',iaerflg,  &
      &    ' ICLDflg=',icldflg,                                          &
      &    ' IMP_PHYSICS=',imp_physics,' IOZNflg=',ioznflg
         print *,' IVFLIP=',ivflip,' IOVR=',iovrRad,                     &
@@ -533,7 +535,7 @@ subroutine radinit( si, NLAY, imp_physics, me, iaermdl, iaerflg, lalw1bd, &
 !! call module_radsw_main::rswinit()
 !     Initialization
 
-      call sol_init ( me )          !  --- ...  astronomy initialization routine
+      call sol_init ( me, isol, solar_file, con_solr_2008, con_solr_2002, con_pi )          !  --- ...  astronomy initialization routine
 
       call aer_init ( NLAY, me, iaermdl, iaerflg, lalw1bd, aeros_file, con_pi, &
            con_t0c, con_c, con_boltz, con_plnk, errflg, errmsg)    !  --- ...  aerosols initialization routine
@@ -573,8 +575,8 @@ end subroutine radinit
 !> @{
 !-----------------------------------
       subroutine radupdate( idate,jdate,deltsw,deltim,lsswr,me, iaermdl,&
-     &                      iaerflg, aeros_file, slag,sdec,cdec,solcon, &
-     &                      errflg,errmsg)
+     &                      iaerflg, isol, aeros_file, slag,sdec,cdec,solcon, &
+     &                      con_pi, errflg,errmsg)
 !...................................
 
 ! =================   subprogram documentation block   ================ !
@@ -607,7 +609,7 @@ subroutine radupdate( idate,jdate,deltsw,deltim,lsswr,me, iaermdl,&
 !   solcon         : sun-earth distance adjusted solar constant (w/m2)  !
 !                                                                       !
 !  external module variables:                                           !
-!   isolar   : solar constant cntrl  (in module physparam)              !
+!   iso   : solar constant cntrl  (in module physparam)                 !
 !              = 0: use the old fixed solar constant in "physcon"       !
 !              =10: use the new fixed solar constant in "physcon"       !
 !              = 1: use noaa ann-mean tsi tbl abs-scale with cycle apprx!
@@ -642,11 +644,11 @@ subroutine radupdate( idate,jdate,deltsw,deltim,lsswr,me, iaermdl,&
       implicit none
 
 !  ---  inputs:
-      integer, intent(in) :: idate(:), jdate(:), me, iaermdl, iaerflg
+      integer, intent(in) :: idate(:), jdate(:), me, iaermdl, iaerflg, isol
       logical, intent(in) :: lsswr
       character(len=26),intent(in) :: aeros_file
 
-      real (kind=kind_phys), intent(in) :: deltsw, deltim
+      real (kind=kind_phys), intent(in) :: deltsw, deltim, con_pi
 
 !  ---  outputs:
       real (kind=kind_phys), intent(out) :: slag, sdec, cdec, solcon
@@ -702,12 +704,12 @@ subroutine radupdate( idate,jdate,deltsw,deltim,lsswr,me, iaermdl,&
 !! time interpolation.
       if (lsswr) then
 
-        if ( isolar == 0 .or. isolar == 10 ) then
+        if ( isol == 0 .or. isol == 10 ) then
           lsol_chg = .false.
         elseif ( iyear0 /= iyear ) then
           lsol_chg = .true.
         else
-          lsol_chg = ( isolar==4 .and. lmon_chg )
+          lsol_chg = ( isol==4 .and. lmon_chg )
         endif
         iyear0 = iyear
 
@@ -715,7 +717,7 @@ subroutine radupdate( idate,jdate,deltsw,deltim,lsswr,me, iaermdl,&
 !  ---  inputs:
      &     ( jdate,kyear,deltsw,deltim,lsol_chg, me,                    &
 !  ---  outputs:
-     &       slag,sdec,cdec,solcon                                      &
+     &       slag,sdec,cdec,solcon,con_pi,errmsg,errflg                 &
      &     )
 
       endif  ! end_if_lsswr_block
diff --git a/physics/GFS_rrtmg_setup.meta b/physics/GFS_rrtmg_setup.meta
index 6ca7552cc..71f1e2ff7 100644
--- a/physics/GFS_rrtmg_setup.meta
+++ b/physics/GFS_rrtmg_setup.meta
@@ -37,6 +37,30 @@
   dimensions = ()
   type = integer
   intent = in
+[solar_file]
+  standard_name = solar_constant_file
+  long_name = external solar constant data table file
+  units = none
+  dimensions =  ()
+  type = character
+  kind = len=26
+  intent = in
+[con_solr_2008]
+  standard_name = solar_constant_2008
+  long_name = solar constant Tim 2008
+  units = W m-2
+  dimensions = ()
+  type = real
+  kind = kind_phys
+  intent = in
+[con_solr_2002]
+  standard_name = solar_constant_2002
+  long_name= solar constant Liu 2002
+  units = W m-2
+  dimensions = ()
+  type = real
+  kind = kind_phys
+  intent = in
 [ico2]
   standard_name = control_for_co2
   long_name = prescribed global mean value (old opernl)
@@ -310,6 +334,13 @@
   dimensions = ()
   type = integer
   intent = in
+[isol]
+  standard_name = control_for_solar_constant
+  long_name = use prescribed solar constant
+  units = flag
+  dimensions = ()
+  type = integer
+  intent = in
 [aeros_file]
   standard_name = aerosol_data_file
   long_name = aerosol data file
@@ -318,6 +349,14 @@
   type = character
   kind = len=26
   intent = in
+[con_pi]
+  standard_name = pi
+  long_name = ratio of a circle's circumference to its diameter
+  units = none
+  dimensions = ()
+  type = real
+  kind = kind_phys
+  intent = in
 [slag]
   standard_name = equation_of_time
   long_name = equation of time (radian)
diff --git a/physics/GFS_rrtmgp_setup.F90 b/physics/GFS_rrtmgp_setup.F90
index 3339d64ae..0cec892ba 100644
--- a/physics/GFS_rrtmgp_setup.F90
+++ b/physics/GFS_rrtmgp_setup.F90
@@ -8,7 +8,7 @@ module GFS_rrtmgp_setup
   !  use GFS_cloud_diagnostics,      only : hml_cloud_diagnostics_initialize
   ! *NOTE* These parameters below are required radiation_****** modules. They are not
   !        directly used by the RRTMGP routines.
-  use physparam,                  only : isolar,  ictmflg, ico2flg, ioznflg, ivflip
+  use physparam,                  only : ictmflg, ico2flg, ioznflg, ivflip
   implicit none
   
   public GFS_rrtmgp_setup_init, GFS_rrtmgp_setup_timestep_init, GFS_rrtmgp_setup_finalize
@@ -43,7 +43,8 @@ subroutine GFS_rrtmgp_setup_init(do_RRTMGP, imp_physics, imp_physics_fer_hires,
        imp_physics_zhao_carr_pdf, imp_physics_mg,  si, levr, ictm, isol, ico2, iaer,     &
        ntcw, num_p3d,  ntoz, iovr, isubc_sw, isubc_lw, icliq_sw, crick_proof, ccnorm,    &
        norad_precip, lalw1bd, idate, iflip, me, aeros_file, iaermdl, iaerflg, con_pi,    &
-       con_t0c, con_c, con_boltz, con_plnk, errmsg, errflg)
+       con_t0c, con_c, con_boltz, con_plnk, solar_file, con_solr_2008, con_solr_2002,    &
+       errmsg, errflg)
 
     ! Inputs
     logical, intent(in) :: do_RRTMGP
@@ -57,7 +58,7 @@ subroutine GFS_rrtmgp_setup_init(do_RRTMGP, imp_physics, imp_physics_fer_hires,
          imp_physics_zhao_carr_pdf, & ! Flag for zhao-carr+PDF scheme
          imp_physics_mg               ! Flag for MG scheme
     real(kind_phys), intent(in) :: &
-         con_pi, con_t0c, con_c, con_boltz, con_plnk
+         con_pi, con_t0c, con_c, con_boltz, con_plnk, con_solr_2008, con_solr_2002
     real(kind_phys), dimension(:), intent(in) :: &
          si
     integer, intent(in) :: levr, ictm, isol, ico2, iaer, & 
@@ -67,7 +68,7 @@ subroutine GFS_rrtmgp_setup_init(do_RRTMGP, imp_physics, imp_physics_fer_hires,
          crick_proof, ccnorm, norad_precip, lalw1bd
     integer, intent(in), dimension(:) :: &
          idate
-    character(len=26),intent(in) :: aeros_file
+    character(len=26),intent(in) :: aeros_file, solar_file
 
     ! Outputs
     character(len=*), intent(out) :: errmsg
@@ -88,7 +89,6 @@ subroutine GFS_rrtmgp_setup_init(do_RRTMGP, imp_physics, imp_physics_fer_hires,
     end if
 
     ! Set radiation parameters
-    isolar  = isol                     ! solar constant control flag
     ictmflg = ictm                     ! data ic time/date control flag
     ico2flg = ico2                     ! co2 data source control flag
     ioznflg = ntoz                     ! ozone data source control flag
@@ -131,7 +131,7 @@ subroutine GFS_rrtmgp_setup_init(do_RRTMGP, imp_physics, imp_physics_fer_hires,
     monthd = 0
 
     ! Call initialization routines..
-    call sol_init ( me )
+    call sol_init ( me, isol, solar_file, con_solr_2008, con_solr_2002, con_pi )
     call aer_init ( levr, me, iaermdl, iaerflg, lalw1bd, aeros_file, con_pi, con_t0c,    &
          con_c, con_boltz, con_plnk, errflg, errmsg)
     call gas_init ( me )
@@ -156,16 +156,17 @@ end subroutine GFS_rrtmgp_setup_init
 !! \htmlinclude GFS_rrtmgp_setup_timestep_init.html
 !!
   subroutine GFS_rrtmgp_setup_timestep_init (idate, jdate, deltsw, deltim, lsswr, me, iaermdl,&
-       aeros_file, slag, sdec, cdec, solcon, errmsg, errflg)
+       aeros_file, isol, slag, sdec, cdec, solcon, con_pi, errmsg, errflg)
      
     ! Inputs
     integer,         intent(in)  :: idate(:)
     integer,         intent(in)  :: jdate(:)
     real(kind_phys), intent(in)  :: deltsw
     real(kind_phys), intent(in)  :: deltim
+    real(kind_phys), intent(in)  :: con_pi
     logical,         intent(in)  :: lsswr
     integer,         intent(in)  :: me
-    integer,         intent(in)  :: iaermdl
+    integer,         intent(in)  :: iaermdl,isol
     character(len=26), intent(in) :: aeros_file
 
     ! Outputs
@@ -224,15 +225,15 @@ subroutine GFS_rrtmgp_setup_timestep_init (idate, jdate, deltsw, deltim, lsswr,
 
     ! Update solar forcing...
     if (lsswr) then
-       if ( isolar == 0 .or. isolar == 10 ) then
+       if ( isol == 0 .or. isol == 10 ) then
           lsol_chg = .false.
        elseif ( iyear0 /= iyear ) then
           lsol_chg = .true.
        else
-          lsol_chg = ( isolar==4 .and. lmon_chg )
+          lsol_chg = ( isol==4 .and. lmon_chg )
        endif
        iyear0 = iyear
-       call sol_update(jdate, kyear, deltsw, deltim, lsol_chg, me, slag, sdec, cdec, solcon)
+       call sol_update(jdate, kyear, deltsw, deltim, lsol_chg, me, slag, sdec, cdec, solcon, con_pi, errmsg, errflg)
     endif
 
     ! Update aerosols...
diff --git a/physics/GFS_rrtmgp_setup.meta b/physics/GFS_rrtmgp_setup.meta
index 028495f14..6e8d296e3 100644
--- a/physics/GFS_rrtmgp_setup.meta
+++ b/physics/GFS_rrtmgp_setup.meta
@@ -101,6 +101,30 @@
   dimensions = ()
   type = integer
   intent = in
+[solar_file]
+  standard_name = solar_constant_file
+  long_name = external solar constant data table file
+  units = none
+  dimensions =  ()
+  type = character
+  kind = len=26
+  intent = in
+[con_solr_2008]
+  standard_name = solar_constant_2008
+  long_name = solar constant Tim 2008
+  units = W m-2
+  dimensions = ()
+  type = real
+  kind = kind_phys
+  intent = in
+[con_solr_2002]
+  standard_name = solar_constant_2002
+  long_name= solar constant Liu 2002
+  units = W m-2
+  dimensions = ()
+  type = real
+  kind = kind_phys
+  intent = in
 [ico2]
   standard_name = control_for_co2
   long_name = prescribed global mean value (old opernl)
@@ -354,6 +378,21 @@
   dimensions = ()
   type = integer
   intent = in
+[isol]
+  standard_name = control_for_solar_constant
+  long_name = use prescribed solar constant
+  units = flag
+  dimensions = ()
+  type = integer
+  intent = in
+[con_pi]
+  standard_name = pi
+  long_name = ratio of a circle's circumference to its diameter
+  units = none
+  dimensions = ()
+  type = real
+  kind = kind_phys
+  intent = in
 [slag]
   standard_name = equation_of_time
   long_name = equation of time (radian)
diff --git a/physics/physparam.f b/physics/physparam.f
index b6dd84c99..b84bdd42f 100644
--- a/physics/physparam.f
+++ b/physics/physparam.f
@@ -125,25 +125,6 @@ module physparam
 !       (may be adjusted at run time based on namelist input or run condition)
 !==================================================================================
 
-! ............................................. !
-!>\name  2.1 For module radiation_astronomy
-! ............................................. !
-
-!> solar constant scheme control flag
-!!\n =0:fixed value=1366.0\f$W/m^2\f$(old standard)
-!!\n =10:fixed value=1360.8\f$W/m^2\f$(new standard)
-!!\n =1:NOAA ABS-scale TSI table (yearly) w 11-yr cycle approx
-!!\n =2:NOAA TIM-scale TSI table (yearly) w 11-yr cycle approx
-!!\n =3:CMIP5 TIM-scale TSI table (yearly) w 11-yr cycle approx
-!!\n =4:CMIP5 TIM-scale TSI table (monthly) w 11-yr cycle approx
-!!\n see ISOL in run scripts: Opr GFS=2; Opr CFS=1
-      integer, save :: isolar  = 0
-
-!> external solar constant data table,solarconstant_noaa_a0.txt
-      character, save :: solar_file*26
-!     data solar_file   / 'solarconstantdata.txt     ' /
-      data solar_file   / 'solarconstant_noaa_a0.txt ' /
-
 ! ............................................. !
 !> \name  2.3 For module radiation_gases
 ! ............................................. !
diff --git a/physics/radiation_astronomy.f b/physics/radiation_astronomy.f
index f1651ca84..693274009 100644
--- a/physics/radiation_astronomy.f
+++ b/physics/radiation_astronomy.f
@@ -21,7 +21,7 @@
 !         input:                                                       !
 !           ( jdate,kyear,deltsw,deltim,lsol_chg, me )                 !
 !         output:                                                      !
-!           ( slag,sdec,cdec,solcon )                                  !
+!           ( slag,sdec,cdec,solcon,errmsg,errflg)                     !
 !                                                                      !
 !      'coszmn'     -- compute cosin of zenith angles                  !
 !         input:                                                       !
@@ -29,11 +29,6 @@
 !         output:                                                      !
 !           ( coszen,coszdg )                                          !
 !                                                                      !
-!                                                                      !
-!   external modules referenced:                                       !
-!       'module physparam'                  in 'physparam.f'           !
-!       'module physcons'                   in 'physcons.f'            !
-!                                                                      !
 !   program history log:                                               !
 !   - a collection of programs to track solar-earth position           !
 !     may  1977  ---  ray orzol    (gfdl) created program compjd to    !
@@ -93,8 +88,7 @@
 !> This module sets up astronomy quantities for solar radiation calculations.
       module module_radiation_astronomy  
 !
-      use physparam,         only : isolar, solar_file, kind_phys
-      use physcons,          only : con_solr, con_solr_old, con_pi
+      use machine,           only : kind_phys 
       use module_iounitdef,  only : NIRADSF
 !
       implicit   none
@@ -107,17 +101,17 @@ module module_radiation_astronomy
 !    &   VTAGAST='NCEP-Radiation_astronomy v5.1  Nov 2012 '
 
 ! Parameter constants
-      real (kind=kind_phys), parameter :: degrad = 180.0/con_pi
-      real (kind=kind_phys), parameter :: tpi    = 2.0 * con_pi
-      real (kind=kind_phys), parameter :: hpi    = 0.5 * con_pi
+      real (kind=kind_phys) :: degrad
+      real (kind=kind_phys) :: tpi
+      real (kind=kind_phys) :: hpi
+      real (kind=kind_phys) :: pid12
       real (kind=kind_phys), parameter :: f12    = 12.0
       real (kind=kind_phys), parameter :: f3600  = 3600.0
       real (kind=kind_phys), parameter :: czlimt = 0.0001      ! ~ cos(89.99427)
-      real (kind=kind_phys), parameter :: pid12  = con_pi/f12  ! angle per hour
 !     real (kind=kind_phys), parameter :: pid12  = (2.0*asin(1.0))/f12
 
 ! Module variable (to be set in module_radiation_astronomy::sol_init):
-      real (kind=kind_phys), public    :: solc0 = con_solr
+      real (kind=kind_phys), public    :: solc0
       integer   :: isolflg = 10
       character(26) :: solar_fname = ' '
 
@@ -133,7 +127,6 @@ module module_radiation_astronomy
       real (kind=kind_phys) :: anginc=0.0
 ! saved monthly solar constants (isolflg=4 only)
       real (kind=kind_phys) :: smon_sav(12)
-      data smon_sav(1:12) / 12*con_solr /
 
 ! saved year  of data used
       integer               :: iyr_sav =0
@@ -154,7 +147,7 @@ module module_radiation_astronomy
 !>\section sol_init_gen sol_init General Algorithm
 !! @{
       subroutine sol_init                                               &
-     &     ( me ) !  ---  inputs
+     &     ( me, isolar, solar_file, con_solr, con_solr_old, con_pi ) !  ---  inputs
 !  ---  outputs: ( none )
 
 !  ===================================================================  !
@@ -163,18 +156,16 @@ subroutine sol_init                                               &
 !                                                                       !
 !  inputs:                                                              !
 !     me      - print message control flag                              !
-!                                                                       !
-!  outputs:  (to module variable)                                       !
-!     ( none )                                                          !
-!                                                                       !
-!  external module variable: (in physparam)                             !
-!   isolar    - = 0: use the old fixed solar constant in "physcon"      !
-!               =10: use the new fixed solar constant in "physcon"      !
+!     isolar  - = 0: use the old fixed solar constant in "GFS_typedefs" !
+!               =10: use the new fixed solar constant in "GFS_typedefs" !
 !               = 1: use noaa ann-mean tsi tbl abs-scale with cyc apprx !
 !               = 2: use noaa ann-mean tsi tbl tim-scale with cyc apprx !
 !               = 3: use cmip5 ann-mean tsi tbl tim-scale with cyc apprx!
 !               = 4: use cmip5 mon-mean tsi tbl tim-scale with cyc apprx!
-!   solar_file- external solar constant data table                      !
+!      solar_file - external solar constant data table                  !
+!                                                                       !
+!  outputs:  (to module variable)                                       !
+!     ( none )                                                          !
 !                                                                       !
 !  internal module variable:                                            !
 !   isolflg   - internal solar constant scheme control flag             !
@@ -191,23 +182,33 @@ subroutine sol_init                                               &
       implicit none
 
 !  ---  input:
-      integer,  intent(in) :: me
-
+      integer,  intent(in) :: me, isolar
+      character(len=26), intent(in) :: solar_file
+      real(kind=kind_phys), intent(in) :: con_solr, con_solr_old, con_pi
 !  ---  output: ( none )
 
 !  ---  local:
       logical :: file_exist
+      integer :: imonth
 !
 !===>  ...  begin here
 !
       if ( me == 0 ) print *, VTAGAST    !print out version tag
 
+      degrad = 180.0/con_pi
+      tpi    = 2.0 * con_pi
+      hpi    = 0.5 * con_pi
+      pid12  = con_pi/f12  
+
 !  ---  initialization
       isolflg = isolar
       solc0   = con_solr
       solar_fname = solar_file
       iyr_sav = 0
       nstp    = 6
+      do imonth = 1,12
+         smon_sav(imonth) = con_solr
+      enddo
 
       if ( isolar == 0 ) then
         solc0   = con_solr_old
@@ -331,7 +332,7 @@ end subroutine sol_init
 !-----------------------------------
       subroutine sol_update                                             &
      &     ( jdate,kyear,deltsw,deltim,lsol_chg, me,                    &     !  ---  inputs
-     &       slag, sdec, cdec, solcon                                   &     !  ---  outputs
+     &       slag, sdec, cdec, solcon, con_pi, errmsg, errflg           &     !  ---  outputs
      &      )
 
 !  ===================================================================  !
@@ -353,6 +354,8 @@ subroutine sol_update                                             &
 !    slag          - equation of time in radians                        !
 !    sdec, cdec    - sin and cos of the solar declination angle         !
 !    solcon        - sun-earth distance adjusted solar constant (w/m2)  !
+!    errmsg        - CCPP error message                                 !
+!    errflg        - CCPP error flag                                    !
 !                                                                       !
 !                                                                       !
 !  module variable:                                                     !
@@ -386,10 +389,12 @@ subroutine sol_update                                             &
       integer, intent(in) :: jdate(:), kyear, me
       logical, intent(in) :: lsol_chg
 
-      real (kind=kind_phys), intent(in) :: deltsw, deltim
+      real (kind=kind_phys), intent(in) :: deltsw, deltim, con_pi
 
 !  ---  output:
       real (kind=kind_phys), intent(out) :: slag, sdec, cdec, solcon
+      character(len=*), intent(out) :: errmsg
+      integer,          intent(out) :: errflg
 
 !  ---  locals:
       real (kind=kind_phys), parameter :: hrday = 1.0/24.0    ! frc day/hour
@@ -408,6 +413,10 @@ subroutine sol_update                                             &
 !
 !===>  ...  begin here
 !
+! Initialize the CCPP error handling variables
+      errmsg = ''
+      errflg = 0
+
 !  --- ...  forecast time
       iyear = jdate(1)
       imon  = jdate(2)
@@ -430,7 +439,10 @@ subroutine sol_update                                             &
           inquire (file=solar_fname, exist=file_exist)
           if ( .not. file_exist ) then
             print *,' !!! ERROR! Can not find solar constant file!!!'
-            stop
+            errflg = 1
+            errmsg = "ERROR(radiation_astronomy): solar constant file"//&
+     &           " not found"
+            return
           else
             iyr = iyear
 
@@ -585,7 +597,7 @@ subroutine sol_update                                             &
 !> -# Call solar()
       call solar                                                        &
 !  ---  inputs:
-     &     ( jd, fjd,                                                   &
+     &     ( jd, fjd, con_pi,                                           &
 !  ---  outputs:
      &       r1, dlt, alp                                               &
      &     )
@@ -652,7 +664,7 @@ end subroutine sol_update
 !! @{
 !-----------------------------------
       subroutine solar                                                  &
-     &     ( jd, fjd,                                                   &       !  ---  inputs
+     &     ( jd, fjd, con_pi,                                           &       !  ---  inputs
      &       r1, dlt, alp                                               &       !  ---  outputs
      &     )
 
@@ -684,7 +696,7 @@ subroutine solar                                                  &
       implicit none
 
 !  ---  inputs:
-      real (kind=kind_phys), intent(in) :: fjd
+      real (kind=kind_phys), intent(in) :: fjd, con_pi
       integer,               intent(in) :: jd
 
 !  ---  outputs:

From da57e02e35d74e14993360d3ce4ddcc7aec470cb Mon Sep 17 00:00:00 2001
From: Dustin Swales <dustin.swales@noaa.gov>
Date: Mon, 15 Aug 2022 16:22:52 -0600
Subject: [PATCH 008/115] Replaced stop statements with ccpp error handling

---
 physics/GFS_phys_time_vary.fv3.F90 |  2 +-
 physics/GFS_phys_time_vary.scm.F90 |  2 +-
 physics/GFS_rrtmg_setup.F90        |  6 +--
 physics/GFS_rrtmgp_setup.F90       |  4 +-
 physics/cires_ugwpv1_oro.F90       |  4 +-
 physics/lsm_noah.f                 |  5 +-
 physics/noahmpdrv.F90              |  2 +-
 physics/radiation_clouds.f         | 30 +++++++----
 physics/radiation_gases.f          | 87 ++++++++++++++++++++----------
 physics/set_soilveg.f              | 22 +++++---
 physics/sfc_diff.f                 |  4 +-
 physics/sflx.f                     | 36 ++++++++++---
 12 files changed, 138 insertions(+), 66 deletions(-)

diff --git a/physics/GFS_phys_time_vary.fv3.F90 b/physics/GFS_phys_time_vary.fv3.F90
index 2803212b7..e3d95e5a3 100644
--- a/physics/GFS_phys_time_vary.fv3.F90
+++ b/physics/GFS_phys_time_vary.fv3.F90
@@ -288,7 +288,7 @@ subroutine GFS_phys_time_vary_init (
 
 !$OMP section
 !> - Initialize soil vegetation (needed for sncovr calculation further down)
-         call set_soilveg(me, isot, ivegsrc, nlunit)
+         call set_soilveg(me, isot, ivegsrc, nlunit, errmsg, errflg)
 
 !$OMP end sections
 
diff --git a/physics/GFS_phys_time_vary.scm.F90 b/physics/GFS_phys_time_vary.scm.F90
index c70e3232a..74b34e974 100644
--- a/physics/GFS_phys_time_vary.scm.F90
+++ b/physics/GFS_phys_time_vary.scm.F90
@@ -264,7 +264,7 @@ subroutine GFS_phys_time_vary_init (
          endif
 
 !> - Initialize soil vegetation (needed for sncovr calculation further down)
-         call set_soilveg(me, isot, ivegsrc, nlunit)
+         call set_soilveg(me, isot, ivegsrc, nlunit, errmsg, errflg)
 
 !> - Call setindxoz() to initialize ozone data
          if (ntoz > 0) then
diff --git a/physics/GFS_rrtmg_setup.F90 b/physics/GFS_rrtmg_setup.F90
index 1960ff11e..331ecbd1e 100644
--- a/physics/GFS_rrtmg_setup.F90
+++ b/physics/GFS_rrtmg_setup.F90
@@ -540,9 +540,9 @@ subroutine radinit( si, NLAY, imp_physics, me, iaermdl, iaerflg, lalw1bd, &
       call aer_init ( NLAY, me, iaermdl, iaerflg, lalw1bd, aeros_file, con_pi, &
            con_t0c, con_c, con_boltz, con_plnk, errflg, errmsg)    !  --- ...  aerosols initialization routine
 
-      call gas_init ( me )          !  --- ...  co2 and other gases initialization routine
+      call gas_init ( me, errflg, errmsg )          !  --- ...  co2 and other gases initialization routine
 
-      call cld_init ( si, NLAY, imp_physics, me) !  --- ...  cloud initialization routine
+      call cld_init ( si, NLAY, imp_physics, me, errflg, errmsg) !  --- ...  cloud initialization routine
 
       call rlwinit ( me )           !  --- ...  lw radiation initialization routine
 
@@ -737,7 +737,7 @@ subroutine radupdate( idate,jdate,deltsw,deltim,lsswr,me, iaermdl,&
         lco2_chg = .false.
       endif
 
-      call gas_update ( kyear,kmon,kday,khour,loz1st,lco2_chg, me )
+      call gas_update ( kyear,kmon,kday,khour,loz1st,lco2_chg, me, errflg, errmsg )
 
       if ( loz1st ) loz1st = .false.
 
diff --git a/physics/GFS_rrtmgp_setup.F90 b/physics/GFS_rrtmgp_setup.F90
index 0cec892ba..517e88d85 100644
--- a/physics/GFS_rrtmgp_setup.F90
+++ b/physics/GFS_rrtmgp_setup.F90
@@ -134,7 +134,7 @@ subroutine GFS_rrtmgp_setup_init(do_RRTMGP, imp_physics, imp_physics_fer_hires,
     call sol_init ( me, isol, solar_file, con_solr_2008, con_solr_2002, con_pi )
     call aer_init ( levr, me, iaermdl, iaerflg, lalw1bd, aeros_file, con_pi, con_t0c,    &
          con_c, con_boltz, con_plnk, errflg, errmsg)
-    call gas_init ( me )
+    call gas_init ( me, errflg, errmsg )
     !call hml_cloud_diagnostics_initialize(imp_physics, imp_physics_fer_hires,           &
     !     imp_physics_gfdl, imp_physics_thompson, imp_physics_wsm6,                      &
     !     imp_physics_zhao_carr, imp_physics_zhao_carr_pdf, imp_physics_mg, levr, me, si,&
@@ -248,7 +248,7 @@ subroutine GFS_rrtmgp_setup_timestep_init (idate, jdate, deltsw, deltim, lsswr,
     else
        lco2_chg = .false.
     endif
-    call gas_update (kyear, kmon, kday, khour, loz1st, lco2_chg, me )
+    call gas_update (kyear, kmon, kday, khour, loz1st, lco2_chg, me, errflg, errmsg )
     
     if ( loz1st ) loz1st = .false.
 
diff --git a/physics/cires_ugwpv1_oro.F90 b/physics/cires_ugwpv1_oro.F90
index 959bbd6c5..7e050fc83 100644
--- a/physics/cires_ugwpv1_oro.F90
+++ b/physics/cires_ugwpv1_oro.F90
@@ -999,7 +999,9 @@ subroutine orogw_v1 (im, km,  imx,   me,  master, dtp, kdt, do_tofd,   &
 !    
           enddo
           print *
-          stop
+          errflg = 1
+          errmsg = 'ERROR(orogw_v1): '
+          return
         endif
        endif
        
diff --git a/physics/lsm_noah.f b/physics/lsm_noah.f
index 7a8e17bf8..d99b9d39d 100644
--- a/physics/lsm_noah.f
+++ b/physics/lsm_noah.f
@@ -62,7 +62,7 @@ subroutine lsm_noah_init(lsm, lsm_noah, me, isot, ivegsrc, nlunit,
       end if
       
       !--- initialize soil vegetation
-      call set_soilveg(me, isot, ivegsrc, nlunit)
+      call set_soilveg(me, isot, ivegsrc, nlunit, errmsg, errflg)
 
       pores (:) = maxsmc (:)
       resid (:) = drysmc (:)
@@ -544,7 +544,8 @@ subroutine lsm_noah_run                                           &
      &       edir, et, ett, esnow, drip, dew, beta, etp, ssoil,         &
      &       flx1, flx2, flx3, runoff1, runoff2, runoff3,               &
      &       snomlt, sncovr, rc, pc, rsmin, xlai, rcs, rct, rcq,        &
-     &       rcsoil, soilw, soilm, smcwlt, smcdry, smcref, smcmax)
+     &       rcsoil, soilw, soilm, smcwlt, smcdry, smcref, smcmax,      &
+     &       errmsg, errflg )
 
 !> - Noah LSM: prepare variables for return to parent model and unit conversion.
 !>  -   6. output (o):
diff --git a/physics/noahmpdrv.F90 b/physics/noahmpdrv.F90
index a4f5b5226..faa6eb5d7 100644
--- a/physics/noahmpdrv.F90
+++ b/physics/noahmpdrv.F90
@@ -93,7 +93,7 @@ subroutine noahmpdrv_init(lsm, lsm_noahmp, me, isot, ivegsrc, &
 
 
         !--- initialize soil vegetation
-        call set_soilveg(me, isot, ivegsrc, nlunit)
+        call set_soilveg(me, isot, ivegsrc, nlunit, errmsg, errflg)
 
 
         ! initialize psih and psim 
diff --git a/physics/radiation_clouds.f b/physics/radiation_clouds.f
index 16ea93d26..d77b39735 100644
--- a/physics/radiation_clouds.f
+++ b/physics/radiation_clouds.f
@@ -16,7 +16,7 @@
 !          inputs:                                                     !
 !           ( si, NLAY, imp_physics,  me )                             !
 !          outputs:                                                    !
-!           ( none )                                                   !
+!           ( errflg, errmsg )                                         !
 !                                                                      !
 !       'radiation_clouds_prop'         --- radiation cloud properties !
 !            obtained from various cloud schemes                       !
@@ -278,10 +278,7 @@ module module_radiation_clouds
 !>\section cld_init General Algorithm
 !! @{
       subroutine cld_init                                               &
-     &     ( si, NLAY, imp_physics, me ) !  ---  inputs
-!  ---  outputs:
-!          ( none )
-
+     &     ( si, NLAY, imp_physics, me, errflg, errmsg )
 !  ===================================================================  !
 !                                                                       !
 ! abstract: cld_init is an initialization program for cloud-radiation   !
@@ -294,8 +291,9 @@ subroutine cld_init                                               &
 !   imp_physics     : MP identifier                                     !
 !   me              : print control flag                                !
 !                                                                       !
-!  outputs: (none)                                                      !
-!           to module variables                                         !
+!  outputs:                                                             !
+!   errflg          : CCPP error flag                                   !
+!   errmsg          : CCPP error message                                !
 !                                                                       !
 !  external module variables: (in physparam)                            !
 !   icldflg         : cloud optical property scheme control flag        !
@@ -331,7 +329,9 @@ subroutine cld_init                                               &
 
       real (kind=kind_phys), intent(in) :: si(:)
 
-!  ---  outputs: (none)
+!  ---  outputs:
+      integer,          intent(out) :: errflg
+      character(len=*), intent(out) :: errmsg
 
 !  ---  locals:
       integer :: k, kl, ier
@@ -339,14 +339,20 @@ subroutine cld_init                                               &
 !
 !===> ...  begin here
 !
+! Initialize CCPP error handling variables
+      errmsg = ''
+      errflg = 0
+
 !  ---  set up module variables
 
       if (me == 0) print *, VTAGCLD      !print out version tag
 
       if ( icldflg == 0 ) then
         print *,' - Diagnostic Cloud Method has been discontinued'
-        stop
-
+        errflg = 1
+        errmsg = 'ERROR(cld_init): Diagnostic Cloud Method has been '// &
+     &       'discontinued'
+        return
       else
         if (me == 0) then
           print *,' - Using Prognostic Cloud Method'
@@ -369,6 +375,10 @@ subroutine cld_init                                               &
           else
             print *,'  !!! ERROR in cloud microphysc specification!!!', &
      &              '  imp_physics (NP3D) =',imp_physics
+            errflg = 1
+            errmsg = 'ERROR(cld_init): cloud mp specification is not'// &
+     &       ' valid'
+            return
             stop
           endif
         endif
diff --git a/physics/radiation_gases.f b/physics/radiation_gases.f
index 157da8e09..d015c1ac9 100644
--- a/physics/radiation_gases.f
+++ b/physics/radiation_gases.f
@@ -19,13 +19,13 @@
 !         input:                                                       !
 !           ( me )                                                     !
 !         output:                                                      !
-!           ( none )                                                   !
+!           ( errflg, errmsg )                                         !
 !                                                                      !
 !      'gas_update' -- read in data and update with time               !
 !         input:                                                       !
 !           ( iyear, imon, iday, ihour, loz1st, ldoco2, me )           !
 !         output:                                                      !
-!           ( none )                                                   !
+!           ( errflg, errmsg )                                         !
 !                                                                      !
 !      'getozn'     -- setup climatological ozone profile              !
 !         input:                                                       !
@@ -232,8 +232,7 @@ module module_radiation_gases
 !! @{
 !-----------------------------------
       subroutine gas_init                                               &
-     &     ( me )!  ---  inputs:
-!  ---  outputs: ( none )
+     &     ( me , errflg, errmsg)
 
 !  ===================================================================  !
 !                                                                       !
@@ -243,8 +242,8 @@ subroutine gas_init                                               &
 !  inputs:                                               dimemsion      !
 !     me      - print message control flag                  1           !
 !                                                                       !
-!  outputs: (to the module variables)                                   !
-!    ( none )                                                           !
+!  outputs: (CCPP error handling)                                       !
+!    (errflg, errmsg)                                                   !
 !                                                                       !
 !  external module variables:  (in physparam)                           !
 !     ico2flg    - co2 data source control flag                         !
@@ -285,7 +284,9 @@ subroutine gas_init                                               &
 !  ---  inputs:
       integer, intent(in) :: me
 
-!  ---  output: ( none )
+!  ---  output:
+      character(len=*), intent(out) :: errmsg
+      integer,          intent(out) :: errflg
 
 !  ---  locals:
       real (kind=kind_phys), dimension(IMXCO2,JMXCO2) :: co2dat
@@ -301,6 +302,11 @@ subroutine gas_init                                               &
 !
 !===>  ...  begin here
 !
+
+! Initialize the CCPP error handling variables
+      errmsg = ''
+      errflg = 0
+
       if ( me == 0 ) print *, VTAGGAS    ! print out version tag
 
       kyrsav  = 0
@@ -317,7 +323,10 @@ subroutine gas_init                                               &
           print *,' - Using climatology ozone distribution'
           print *,' timeozc=',timeozc, ' is not monthly mean',          &
      &            ' - job aborting in subroutin gas_init!!!'
-          stop
+          errflg = 1
+          errmsg = 'ERROR(gas_init): Climatological o3 distribution '// &
+     &         'is not monthly mean'
+          return
         endif
 
         allocate (pkstr(LOZ), o3r(JMR,LOZ,12))
@@ -392,9 +401,10 @@ subroutine gas_init                                               &
 
           inquire (file=co2usr_file, exist=file_exist)
           if ( .not. file_exist ) then
-            print *,'   Can not find user CO2 data file: ',co2usr_file, &
-     &              ' - Stopped in subroutine gas_init !!'
-            stop
+            print *,'   Can not find user CO2 data file: ',co2usr_file
+            errflg = 1
+            errmsg = 'ERROR(gas_init): Can not find user CO2 data file'
+            return
           else
             close (NICO2CN)
             open(NICO2CN,file=co2usr_file,form='formatted',status='old')
@@ -435,9 +445,10 @@ subroutine gas_init                                               &
                 enddo
               endif
             else
-              print *,' ICO2=',ico2flg,' is not a valid selection',     &
-     &                ' - Stoped in subroutine gas_init!!!'
-              stop
+              print *,' ICO2=',ico2flg,' is not a valid selection'
+              errflg = 1
+              errmsg = 'ERROR(gas_init): ICO2 is not valid'
+              return
             endif    ! endif_ico2flg_block
 
             close (NICO2CN)
@@ -456,9 +467,10 @@ subroutine gas_init                                               &
               print *,' - Using observed co2 monthly 2-d data'
             endif
           else
-            print *,' ICO2=',ico2flg,' is not a valid selection',       &
-     &              ' - Stoped in subroutine gas_init!!!'
-            stop
+            print *,' ICO2=',ico2flg,' is not a valid selection'
+            errflg = 1
+            errmsg = 'ERROR(gas_init): ICO2 is not valid'
+            return
           endif
 
           if ( ictmflg == -2 ) then
@@ -466,9 +478,12 @@ subroutine gas_init                                               &
             if ( .not. file_exist ) then
               if ( me == 0 ) then
                 print *,'   Can not find seasonal cycle CO2 data: ',    &
-     &               co2cyc_file,' - Stopped in subroutine gas_init !!'
+     &               co2cyc_file
               endif
-              stop
+              errflg = 1
+              errmsg = 'ERROR(gas_init): Can not find seasonal cycle '//&
+     &             'CO2 data'
+              return
             else
               allocate( co2cyc_sav(IMXCO2,JMXCO2,12) )
 
@@ -531,8 +546,8 @@ end subroutine gas_init
 !! @{
 !-----------------------------------
       subroutine gas_update                                             &
-     &     ( iyear, imon, iday, ihour, loz1st, ldoco2, me )!  ---  inputs
-!  ---  outputs: ( none )
+     &     ( iyear, imon, iday, ihour, loz1st, ldoco2, me,              &
+     &     errflg, errmsg )
 
 !  ===================================================================  !
 !                                                                       !
@@ -549,7 +564,8 @@ subroutine gas_update                                             &
 !     me      - print message control flag                  1           !
 !                                                                       !
 !  outputs: (to the module variables)                                   !
-!    ( none )                                                           !
+!    errflg   - CCPP error flag                                         !
+!    errmsg   - CCPP error message                                      !
 !                                                                       !
 !  external module variables:  (in physparam)                           !
 !     ico2flg    - co2 data source control flag                         !
@@ -597,7 +613,9 @@ subroutine gas_update                                             &
 
       logical, intent(in) :: loz1st, ldoco2
 
-!  ---  output: ( none )
+!  ---  output:
+      character(len=*), intent(out) :: errmsg
+      integer,          intent(out) :: errflg
 
 !  ---  locals:
       real (kind=kind_phys), dimension(IMXCO2,JMXCO2) :: co2dat, co2ann
@@ -614,6 +632,10 @@ subroutine gas_update                                             &
 !
 !===>  ...  begin here
 !
+! Initialize the CCPP error handling variables
+      errmsg = ''
+      errflg = 0
+
 !> - Ozone data section
 
       if ( ioznflg == 0 ) then
@@ -684,8 +706,11 @@ subroutine gas_update                                             &
         inquire (file=co2gbl_file, exist=file_exist)
         if ( .not. file_exist ) then
           print *,'   Requested co2 data file "',co2gbl_file,           &
-     &            '" not found - Stopped in subroutine gas_update!!'
-          stop
+     &            '" not found'
+          errflg = 1
+          errmsg = 'ERROR(gas_update): Requested co2 data file not '//  &
+     &         'found'
+          return
         else
           close(NICO2CN)
           open (NICO2CN,file=co2gbl_file,form='formatted',status='old')
@@ -752,9 +777,11 @@ subroutine gas_update                                             &
             if ( me == 0 ) then
               print *,'   Specified co2 data for year',idyr,            &
      &               ' not found !!  Need to change namelist ICTM !!'
-              print *,'   *** Stopped in subroutine gas_update !!'
             endif
-            stop
+            errflg = 1
+            errmsg = 'ERROR(gas_update): Specified co2 data for year '//&
+     &           'not found'
+            return
           else Lab_if_ictm                        ! looking for latest available data
             if ( me == 0 ) then
               print *,'   Requested co2 data for year',idyr,            &
@@ -778,9 +805,11 @@ subroutine gas_update                                             &
             if ( .not. file_exist ) then
               if ( me == 0 ) then
                 print *,'   Can not find co2 data source file'
-                print *,'   *** Stopped in subroutine gas_update !!'
               endif
-              stop
+              errflg = 1
+              errmsg = 'ERROR(gas_update): Can not find co2 data '//    &
+     &             'source file'
+              return
             endif
           endif  Lab_if_ictm
         endif   ! end if_file_exist_block
diff --git a/physics/set_soilveg.f b/physics/set_soilveg.f
index efef0f24b..37f2c2a73 100644
--- a/physics/set_soilveg.f
+++ b/physics/set_soilveg.f
@@ -13,11 +13,13 @@ module set_soilveg_mod
 
 !> \ingroup Noah_LSM
 !! This subroutine initializes soil and vegetation.
-      subroutine set_soilveg(me,isot,ivet,nlunit)
+      subroutine set_soilveg(me,isot,ivet,nlunit,errmsg,errflg)
       use namelist_soilveg
       implicit none
 
       integer, intent(in) :: me,isot,ivet,nlunit
+      character(len=*), intent(out) :: errmsg
+      integer,          intent(out) :: errflg
 !my begin locals
 !for 20 igbp veg type and 19 stasgo soil type
       integer i
@@ -385,16 +387,22 @@ subroutine set_soilveg(me,isot,ivet,nlunit)
 !         CLOSE(59)
 
          IF (DEFINED_SOIL .GT. MAX_SOILTYP) THEN
-            WRITE(0,*) 'Warning: DEFINED_SOIL too large in namelist'
-            STOP 222
+            errflg = 222
+            errmsg = 'ERROR(set_soilveg): DEFINED_SOIL too large in '// &
+     &           'namelist'
+            return
          ENDIF
          IF (DEFINED_VEG .GT. MAX_VEGTYP) THEN
-            WRITE(0,*) 'Warning: DEFINED_VEG too large in namelist'
-            STOP 222
+            errflg = 222
+            errmsg = 'ERROR(set_soilveg): DEFINED_VEG too large in '//  &
+     &           'namelist'
+            return
          ENDIF
          IF (DEFINED_SLOPE .GT. MAX_SLOPETYP) THEN
-            WRITE(0,*) 'Warning: DEFINED_SLOPE too large in namelist'
-            STOP 222
+            errflg = 222
+            errmsg = 'ERROR(set_soilveg): DEFINED_SLOPE too large in '//&
+     &           'namelist'
+            return
          ENDIF
          
          SMLOW  = SMLOW_DATA
diff --git a/physics/sfc_diff.f b/physics/sfc_diff.f
index 59c6d2d60..150735106 100644
--- a/physics/sfc_diff.f
+++ b/physics/sfc_diff.f
@@ -383,7 +383,9 @@ subroutine sfc_diff_run (im,rvrdm1,eps,epsm1,grav,                &  !intent(in)
               call znot_t_v7(wind10m, ztmax_wat(i))   ! 10-m wind,m/s, ztmax(m)
             else if (sfc_z0_type > 0) then
               write(0,*)'no option for sfc_z0_type=',sfc_z0_type
-              stop
+              errflg = 1
+              errmsg = 'ERROR(sfc_diff_run): no option for sfc_z0_type'
+              return
             endif
 !
             call stability
diff --git a/physics/sflx.f b/physics/sflx.f
index 026e2b854..cd1adfe75 100644
--- a/physics/sflx.f
+++ b/physics/sflx.f
@@ -124,7 +124,8 @@ subroutine gfssflx                                                &!  ---  input
      &       edir, et, ett, esnow, drip, dew, beta, etp, ssoil,         &
      &       flx1, flx2, flx3, runoff1, runoff2, runoff3,               &
      &       snomlt, sncovr, rc, pc, rsmin, xlai, rcs, rct, rcq,        &
-     &       rcsoil, soilw, soilm, smcwlt, smcdry, smcref, smcmax)
+     &       rcsoil, soilw, soilm, smcwlt, smcdry, smcref, smcmax,      &
+     &       errmsg, errflg )
 
 ! ===================================================================== !
 !  description:                                                         !
@@ -328,6 +329,8 @@ subroutine gfssflx                                                &!  ---  input
      &       runoff1, runoff2, runoff3, rc, pc, rsmin, xlai, rcs,       &
      &       rct, rcq, rcsoil, soilw, soilm, smcwlt, smcdry, smcref,    &
      &       smcmax
+      character(len=*),     intent(out) :: errmsg
+      integer,              intent(out) :: errflg
 
 !  ---  locals:
 !     real (kind=kind_phys) ::  df1h,
@@ -347,6 +350,10 @@ subroutine gfssflx                                                &!  ---  input
 !
 !===> ...  begin here
 !
+! Initialize CCPP error-handling
+      errflg = 0
+      errmsg = ''
+
 !  --- ...  initialization
 
       runoff1 = 0.0
@@ -412,7 +419,7 @@ subroutine gfssflx                                                &!  ---  input
 
 !> - Call redprm() to set the land-surface paramters,
 !! including soil-type and veg-type dependent parameters.
-      call redprm
+      call redprm(errmsg, errflg)
         if(ivegsrc == 1) then
 !only igbp type has urban
 !urban
@@ -1673,7 +1680,7 @@ end subroutine penman
 !> This subroutine internally sets default values or optionally read-in
 !! via namelist i/o, all soil and vegetation parateters requied for the execusion
 !! of the Noah LSM.
-      subroutine redprm
+      subroutine redprm(errmsg, errflg)
 !...................................
 !  ---  inputs:
 !    &     ( nsoil, vegtyp, soiltyp, slopetyp, sldpth, zsoil,              &
@@ -1860,7 +1867,8 @@ subroutine redprm
 !    &       frzx, psisat, slope, snup, salp, bexp, dksat, dwsat,       &
 !    &       smcmax, smcwlt, smcref, smcdry, f1, quartz, fxexp, z0,     &
 !    &       czil, xlai, csoil, rtdis(nsoil)
-
+      character(len=*),     intent(out) :: errmsg
+      integer,              intent(out) :: errflg
 !     integer, intent(out) :: nroot
 
 !  ---  locals:
@@ -1871,20 +1879,30 @@ subroutine redprm
 !
 !===> ...  begin here
 !
+! Initialize CCPP error-handling
+      errflg = 0
+      errmsg = ''
+
       if (soiltyp > defined_soil) then
         write(*,*) 'warning: too many soil types,soiltyp=',soiltyp,     &
      &   'defined_soil=',defined_soil
-        stop 333
+        errflg = 1
+        errmsg = 'ERROR(sflx.f): too many soil types'
+        return
       endif
 
       if (vegtyp > defined_veg) then
         write(*,*) 'warning: too many veg types'
-        stop 333
+        errflg = 1
+        errmsg = 'ERROR(sflx.f): too many veg types'
+        return
       endif
 
       if (slopetyp > defined_slope) then
         write(*,*) 'warning: too many slope types'
-        stop 333
+        errflg = 1
+        errmsg = 'ERROR(sflx.f): too many slope types'
+        return
       endif
 
 !  --- ...  set-up universal parameters (not dependent on soiltyp, vegtyp
@@ -1941,7 +1959,9 @@ subroutine redprm
 
       if (nroot > nsoil) then
         write(*,*) 'warning: too many root layers'
-        stop 333
+        errflg = 1
+        errmsg = 'ERROR(sflx.f): too many root layers'
+        return
       endif
 
 !  --- ...  calculate root distribution.  present version assumes uniform

From 1dbed67e964bf108ac4f5c7b8544497fad074973 Mon Sep 17 00:00:00 2001
From: Dustin Swales <dustin.swales@noaa.gov>
Date: Tue, 16 Aug 2022 11:31:22 -0600
Subject: [PATCH 009/115] Replaced all remaing stop statements with ccpp error
 handling.

---
 physics/GFS_phys_time_vary.fv3.F90      |  2 +-
 physics/GFS_rrtmg_setup.F90             | 30 +++++++++++++------------
 physics/gcycle.F90                      | 14 ++++++++++--
 physics/gfdl_cloud_microphys.F90        |  2 +-
 physics/gfdl_sfc_layer.F90              |  6 ++---
 physics/lsm_ruc.F90                     |  8 ++++---
 physics/m_micro.F90                     |  4 +++-
 physics/module_SF_JSFC.F90              | 23 +++++++++++++++----
 physics/module_gfdl_cloud_microphys.F90 | 13 +++++++++--
 physics/module_sf_exchcoef.f90          | 13 +++++++++--
 physics/module_sf_mynn.F90              | 21 ++++++++++++++---
 physics/module_sf_ruclsm.F90            | 29 +++++++++++++++++-------
 physics/radiation_clouds.f              |  1 -
 physics/radlw_main.F90                  | 28 +++++++++++++++++------
 physics/radsw_main.F90                  | 23 ++++++++++++++-----
 physics/set_soilveg_ruc.F90             | 20 +++++++++++++----
 16 files changed, 176 insertions(+), 61 deletions(-)

diff --git a/physics/GFS_phys_time_vary.fv3.F90 b/physics/GFS_phys_time_vary.fv3.F90
index e3d95e5a3..8ffd56b0e 100644
--- a/physics/GFS_phys_time_vary.fv3.F90
+++ b/physics/GFS_phys_time_vary.fv3.F90
@@ -901,7 +901,7 @@ subroutine GFS_phys_time_vary_timestep_init (
                  tsfco, tisfc, hice, fice, facsf, facwf, alvsf, alvwf, alnsf, alnwf,         &
                  zorli, zorll, zorlo, weasd, slope, snoalb, canopy, vfrac, vtype,            &
                  stype, shdmin, shdmax, snowd, cv, cvb, cvt, oro, oro_uf,                    &
-                 xlat_d, xlon_d, slmsk, imap, jmap)
+                 xlat_d, xlon_d, slmsk, imap, jmap, errmsg, errflg)
            endif
          endif
 
diff --git a/physics/GFS_rrtmg_setup.F90 b/physics/GFS_rrtmg_setup.F90
index 331ecbd1e..eb6a94578 100644
--- a/physics/GFS_rrtmg_setup.F90
+++ b/physics/GFS_rrtmg_setup.F90
@@ -199,7 +199,9 @@ subroutine GFS_rrtmg_setup_init (                          &
       iaermdl = iaer/1000               ! control flag for aerosol scheme selection
       if ( iaermdl < 0 .or.  (iaermdl>2 .and. iaermdl/=5) ) then
          print *, ' Error -- IAER flag is incorrect, Abort'
-         stop 7777
+         errflg = 1
+         errmsg = 'ERROR(GFS_rrtmg_setup): IAER flag is incorrect'
+         return
       endif
 
 !     if ( ntcw > 0 ) then
@@ -496,7 +498,9 @@ subroutine radinit( si, NLAY, imp_physics, me, iaermdl, iaerflg, lalw1bd, &
         else
           print *,' - ERROR!!! ISUBCLW=',isubclw,' is not a ',          &
      &            'valid option '
-          stop
+          errflg = 1
+          errmsg = 'ERROR(GFS_rrtmg_setup): ISUBCLW flag is invalid'
+          return
         endif
 
         if ( isubcsw == 0 ) then
@@ -511,7 +515,9 @@ subroutine radinit( si, NLAY, imp_physics, me, iaermdl, iaerflg, lalw1bd, &
         else
           print *,' - ERROR!!! ISUBCSW=',isubcsw,' is not a ',          &
      &            'valid option '
-          stop
+          errflg = 1
+          errmsg = 'ERROR(GFS_rrtmg_setup): ISUBCSW flag is invalid'
+          return
         endif
 
         if ( isubcsw /= isubclw ) then
@@ -535,18 +541,14 @@ subroutine radinit( si, NLAY, imp_physics, me, iaermdl, iaerflg, lalw1bd, &
 !! call module_radsw_main::rswinit()
 !     Initialization
 
-      call sol_init ( me, isol, solar_file, con_solr_2008, con_solr_2002, con_pi )          !  --- ...  astronomy initialization routine
-
+      call sol_init ( me, isol, solar_file, con_solr_2008, con_solr_2002,&
+           con_pi )                                              ! astronomy initialization routine
       call aer_init ( NLAY, me, iaermdl, iaerflg, lalw1bd, aeros_file, con_pi, &
-           con_t0c, con_c, con_boltz, con_plnk, errflg, errmsg)    !  --- ...  aerosols initialization routine
-
-      call gas_init ( me, errflg, errmsg )          !  --- ...  co2 and other gases initialization routine
-
-      call cld_init ( si, NLAY, imp_physics, me, errflg, errmsg) !  --- ...  cloud initialization routine
-
-      call rlwinit ( me )           !  --- ...  lw radiation initialization routine
-
-      call rswinit ( me )           !  --- ...  sw radiation initialization routine
+           con_t0c, con_c, con_boltz, con_plnk, errflg, errmsg)  ! aerosols initialization routine
+      call gas_init ( me, errflg, errmsg )                       ! co2 and other gases initialization routine
+      call cld_init ( si, NLAY, imp_physics, me, errflg, errmsg) ! cloud initialization routine
+      call rlwinit ( me, errflg, errmsg )                        ! lw RRTMG initialization routine
+      call rswinit ( me, errflg, errmsg )                        ! sw RRTMG initialization routine
 !
       return
 !
diff --git a/physics/gcycle.F90 b/physics/gcycle.F90
index 7e301c480..16e446b27 100644
--- a/physics/gcycle.F90
+++ b/physics/gcycle.F90
@@ -22,7 +22,7 @@ subroutine gcycle (me, nthrds, nx, ny, isc, jsc, nsst, tile_num, nlunit, fn_nml,
       tsfco, tisfc, hice, fice, facsf, facwf, alvsf, alvwf, alnsf, alnwf,          &
       zorli, zorll, zorlo, weasd, slope, snoalb, canopy, vfrac, vtype,             &
       stype, shdmin, shdmax, snowd, cv, cvb, cvt, oro, oro_uf,                     &
-      xlat_d, xlon_d, slmsk, imap, jmap)
+      xlat_d, xlon_d, slmsk, imap, jmap, errmsg, errflg)
 !
 !
     use machine,      only: kind_phys, kind_io8
@@ -78,6 +78,9 @@ subroutine gcycle (me, nthrds, nx, ny, isc, jsc, nsst, tile_num, nlunit, fn_nml,
                                            slope(:)
 
     integer,              intent(in)    :: imap(:), jmap(:)
+    character(len=*),     intent(out)   :: errmsg
+    integer,              intent(out)   :: errflg
+
 !
 !     Local variables
 !     ---------------
@@ -104,6 +107,11 @@ subroutine gcycle (me, nthrds, nx, ny, isc, jsc, nsst, tile_num, nlunit, fn_nml,
     real(kind=kind_phys) :: sig1t
     integer              :: npts, nb, ix, jx, ls, ios, ll
     logical              :: exists
+
+    ! Initialize CCPP error handling variables
+    errmsg = ''
+    errflg = 0
+
 !
 !@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 !
@@ -214,7 +222,9 @@ subroutine gcycle (me, nthrds, nx, ny, isc, jsc, nsst, tile_num, nlunit, fn_nml,
       inquire (file=trim(fn_nml),exist=exists)
       if (.not. exists) then
         write(6,*) 'gcycle:: namelist file: ',trim(fn_nml),' does not exist'
-        stop
+        errflg = 1
+        errmsg = 'ERROR(gcycle): namelist file: ',trim(fn_nml),' does not exist.'
+        return
       else
         open (unit=nlunit, file=trim(fn_nml), action='READ', status='OLD', iostat=ios)
         rewind (nlunit)
diff --git a/physics/gfdl_cloud_microphys.F90 b/physics/gfdl_cloud_microphys.F90
index 309cbac92..e2c71c960 100644
--- a/physics/gfdl_cloud_microphys.F90
+++ b/physics/gfdl_cloud_microphys.F90
@@ -63,7 +63,7 @@ subroutine gfdl_cloud_microphys_init (me, master, nlunit, input_nml_file, loguni
            return
        endif
 
-       call gfdl_cloud_microphys_mod_init(me, master, nlunit, input_nml_file, logunit, fn_nml)
+       call gfdl_cloud_microphys_mod_init(me, master, nlunit, input_nml_file, logunit, fn_nml, errmsg, errflg)
 
        is_initialized = .true.
 
diff --git a/physics/gfdl_sfc_layer.F90 b/physics/gfdl_sfc_layer.F90
index 379c9c856..44e2fa254 100644
--- a/physics/gfdl_sfc_layer.F90
+++ b/physics/gfdl_sfc_layer.F90
@@ -1140,7 +1140,7 @@ SUBROUTINE MFLUX2( fxh,fxe,fxmx,fxmy,cdm,rib,xxfh,zoc,mzoc,tstrc,        &    !m
           land(i) = 0.0
           windmks=wind10p(i)*.01
           if ( iwavecpl .eq. 1 ) then
-            call znot_wind10m(windmks,znott,znotm,icoef_sf)
+            call znot_wind10m(windmks,znott,znotm,icoef_sf,errmsg,errflg)
             !Check if Charnock parameter ratio is received in a proper range.
             if ( alpha(i) .ge. 0.2 .and. alpha(i) .le. 5. ) then
               znotm = znotm*alpha(i)
@@ -1148,7 +1148,7 @@ SUBROUTINE MFLUX2( fxh,fxe,fxmx,fxmy,cdm,rib,xxfh,zoc,mzoc,tstrc,        &    !m
             zoc(i)  = -100.*znotm
             zot(i) =  -100* znott
           else
-            call znot_wind10m(windmks,znott,znotm,icoef_sf)
+            call znot_wind10m(windmks,znott,znotm,icoef_sf,errmsg,errflg)
             zoc(i)  = -100.*znotm
             zot(i) =  -100* znott
           endif
@@ -1785,7 +1785,7 @@ SUBROUTINE MFLUX2( fxh,fxe,fxmx,fxmy,cdm,rib,xxfh,zoc,mzoc,tstrc,        &    !m
 !!!
         if ( iwavecpl .eq. 1 .and. zoc(i) .le. 0.0 ) then
           windmks = wind10(i) * 0.01
-          call znot_wind10m(windmks,znott,znotm,icoef_sf)
+          call znot_wind10m(windmks,znott,znotm,icoef_sf,errmsg,errflg)
           !Check if Charnock parameter ratio is received in a proper range.
           if ( alpha(i) .ge. 0.2 .and. alpha(i) .le. 5. ) then
             znotm = znotm*alpha(i)
diff --git a/physics/lsm_ruc.F90 b/physics/lsm_ruc.F90
index 3ca78ad04..48bb281da 100644
--- a/physics/lsm_ruc.F90
+++ b/physics/lsm_ruc.F90
@@ -159,7 +159,7 @@ subroutine lsm_ruc_init (me, master, isot, ivegsrc, nlunit,               &
       endif
 
       !--- initialize soil vegetation
-      call set_soilveg_ruc(me, isot, ivegsrc, nlunit)
+      call set_soilveg_ruc(me, isot, ivegsrc, nlunit, errmsg, errflg)
 
       pores (:) = maxsmc (:)
       resid (:) = drysmc (:)
@@ -1135,7 +1135,8 @@ subroutine lsm_ruc_run                                            & ! inputs
      &          smfrsoil(i,:,j),keepfrsoil(i,:,j), .false.,                  &
      &          shdmin1d(i,j), shdmax1d(i,j), rdlai2d,                       &
      &          ims,ime, jms,jme, kms,kme,                                   &
-     &          its,ite, jts,jte, kts,kte                                    )
+     &          its,ite, jts,jte, kts,kte,                                   &
+     &          errmsg, errflg)
         if(debug_print) then
           write (0,*)'after LSMRUC for land'
           write (0,*)'after sneqv(i,j) =',i,j,sneqv_lnd(i,j)
@@ -1396,7 +1397,8 @@ subroutine lsm_ruc_run                                            & ! inputs
      &          smfrice(i,:,j),keepfrice(i,:,j), .false.,                    &
      &          shdmin1d(i,j), shdmax1d(i,j), rdlai2d,                       &
      &          ims,ime, jms,jme, kms,kme,                                   &
-     &          its,ite, jts,jte, kts,kte                                    )
+     &          its,ite, jts,jte, kts,kte,                                   &
+     &          errmsg, errflg)
 
         ! Interstitial
         evap_ice(i)   = qfx_ice(i,j) / rho(i)           ! kinematic
diff --git a/physics/m_micro.F90 b/physics/m_micro.F90
index 15e30b0a6..200f906ee 100644
--- a/physics/m_micro.F90
+++ b/physics/m_micro.F90
@@ -123,7 +123,9 @@ subroutine m_micro_init(imp_physics, imp_physics_mg, fprcp, gravit, rair, rh2o,
                             mg_ngcons,      mg_ngnst)
     else
       write(0,*)' fprcp = ',fprcp,' is not a valid option - aborting'
-      stop
+      errflg = 1
+      errmsg = 'ERROR(m_micro_init): fprcp is not a valid option'
+      return
     endif
     call aer_cloud_init ()
 
diff --git a/physics/module_SF_JSFC.F90 b/physics/module_SF_JSFC.F90
index 8d67a81cd..fdf188b96 100644
--- a/physics/module_SF_JSFC.F90
+++ b/physics/module_SF_JSFC.F90
@@ -122,7 +122,7 @@ SUBROUTINE JSFC(FLAG_ITER,ITER,ME                                &
      &               ,A1U,A1T,A1Q                                      &
      &               ,IDS,IDE,JDS,JDE,KDS,KDE                          &
      &               ,IMS,IME,JMS,JME,KMS,KME                          &
-     &               ,ITS,ITE,JTS,JTE,KTS,LM)
+     &               ,ITS,ITE,JTS,JTE,KTS,LM,errmsg,errflg)
 !
 !-----------------------------------------------------------------------
 !      SUBROUTINE JSFC(NTSD,EPSQ2,HT,DZ                                 &
@@ -182,6 +182,8 @@ SUBROUTINE JSFC(FLAG_ITER,ITER,ME                                &
       REAL(kind=kfpt),DIMENSION(IMS:IME,JMS:JME),INTENT(OUT) :: CM,CH,STRESS,FFM  &
      &                                              ,FFH,WIND,FM10,FH2 &
      &                                              ,A1U,A1T,A1Q
+      character(len=*),intent(out) :: errmsg
+      integer,         intent(out) :: errflg
 !
 !      REAL(kind=kfpt),DIMENSION(IMS:IME,JMS:JME),INTENT(OUT) :: CHS,CHS2,CQS2     &
 !     &                                              ,CPM,CT,FLHC,FLQC  &
@@ -215,6 +217,9 @@ SUBROUTINE JSFC(FLAG_ITER,ITER,ME                                &
 !
 !----------------------------------------------------------------------
 !**********************************************************************
+      ! Initialize error-handling
+      errflg = 0
+      errmsg = ''
 !----------------------------------------------------------------------
 !
 !***  MAKE PREPARATIONS
@@ -390,7 +395,8 @@ SUBROUTINE JSFC(FLAG_ITER,ITER,ME                                &
      &               ,A1U(I,J),A1T(I,J),A1Q(I,J)                       &
      &               ,IDS,IDE,JDS,JDE,KDS,KDE                          &
      &               ,IMS,IME,JMS,JME,KMS,KME                          &
-     &               ,ITS,ITE,JTS,JTE,KTS,LM,I,J,ZHK(LMH+1),RIB(I,J))   ! Added Bulk Richardson No.
+     &               ,ITS,ITE,JTS,JTE,KTS,LM,I,J,ZHK(LMH+1),RIB(I,J)   & ! Added Bulk Richardson No.
+     &               ,errmsg, errflg)
 !
 !***  REMOVE SUPERATURATION AT 2M AND 10M
 !
@@ -454,7 +460,8 @@ SUBROUTINE SFCDIF(NTSD,SEAMASK,THS,QS,PSFC                       &
      &                 ,FFM,FFH,FM10,FH2,A1U,A1T,A1Q                   &
      &                 ,IDS,IDE,JDS,JDE,KDS,KDE                        &
      &                 ,IMS,IME,JMS,JME,KMS,KME                        &
-     &                 ,ITS,ITE,JTS,JTE,KTS,LM,I,J,ZSFC,RIB)            ! Added Bulk Richardson No.
+     &                 ,ITS,ITE,JTS,JTE,KTS,LM,I,J,ZSFC,RIB            & ! Added Bulk Richardson No.
+     &                 ,errmsg, errflg) 
 !     ****************************************************************
 !     *                                                              *
 !     *                       SURFACE LAYER                          *
@@ -481,6 +488,8 @@ SUBROUTINE SFCDIF(NTSD,SEAMASK,THS,QS,PSFC                       &
       REAL(kind=kfpt),INTENT(OUT) :: FFM,FFH,FM10,FH2,A1U,A1T,A1Q
 !
       REAL(kind=kfpt),INTENT(INOUT) :: AKHS,AKMS,QZ0,THZ0,USTAR,UZ0,VZ0,Z0,QS
+      character(len=*), intent(out) :: errmsg
+      integer,          intent(out) :: errflg
 !----------------------------------------------------------------------
 !***
 !***  LOCAL VARIABLES
@@ -507,6 +516,10 @@ SUBROUTINE SFCDIF(NTSD,SEAMASK,THS,QS,PSFC                       &
 !----------------------------------------------------------------------
 !**********************************************************************
 !----------------------------------------------------------------------
+      ! Initialize error-handling
+      errflg = 0
+      errmsg = ''
+
       RDZ=1./ZSL
       CXCHL=EXCML*RDZ
       CXCHS=EXCMS*RDZ
@@ -701,7 +714,9 @@ SUBROUTINE SFCDIF(NTSD,SEAMASK,THS,QS,PSFC                       &
               print*,'PSIH1(1,2),RDZT=',PSIH1(K+1),PSIH1(K+2),RDZT
               print*,'ZSLU,ZSLT,RLMO,ZU,ZT=',ZSLU,ZSLT,RLMO,ZU,ZT
               print*,'A,B,DTHV,DU2,RIB=',A,B,DTHV,DU2,RIB
-              stop
+              errflg = 1
+              errmsg = 'ERROR(SFCDIF): '
+              return
             end if
 
 
diff --git a/physics/module_gfdl_cloud_microphys.F90 b/physics/module_gfdl_cloud_microphys.F90
index 7f00d9bca..ebd3b93ff 100644
--- a/physics/module_gfdl_cloud_microphys.F90
+++ b/physics/module_gfdl_cloud_microphys.F90
@@ -3575,7 +3575,8 @@ end subroutine setupm
 !>\ingroup mod_gfdl_cloud_mp
 !! The subroutine 'gfdl_cloud_microphys_init' initializes the GFDL
 !! cloud microphysics.
-subroutine gfdl_cloud_microphys_mod_init (me, master, nlunit, input_nml_file, logunit, fn_nml)
+subroutine gfdl_cloud_microphys_mod_init (me, master, nlunit, input_nml_file, logunit, &
+     fn_nml, errmsg, errflg)
 
     implicit none
 
@@ -3586,6 +3587,8 @@ subroutine gfdl_cloud_microphys_mod_init (me, master, nlunit, input_nml_file, lo
 
     character (len = 64), intent (in) :: fn_nml
     character (len = *),  intent (in) :: input_nml_file(:)
+    character(len=*),     intent(out) :: errmsg
+    integer,              intent(out) :: errflg
 
     integer :: ios
     logical :: exists
@@ -3600,13 +3603,19 @@ subroutine gfdl_cloud_microphys_mod_init (me, master, nlunit, input_nml_file, lo
 
     ! master = (mpp_pe () .eq.mpp_root_pe ())
 
+    ! Initialize CCPP error-handling
+    errflg = 0
+    errmsg = ''
+
 #ifdef INTERNAL_FILE_NML
     read (input_nml_file, nml = gfdl_cloud_microphysics_nml)
 #else
     inquire (file = trim (fn_nml), exist = exists)
     if (.not. exists) then
         write (6, *) 'gfdl - mp :: namelist file: ', trim (fn_nml), ' does not exist'
-        stop
+        errflg = 1
+        errmsg = 'ERROR(gfdl_cloud_microphys_mod_init): namelist file '//trim (fn_nml)//' does not exist'
+        return
     else
         open (unit = nlunit, file = fn_nml, action = 'read' , status = 'old', iostat = ios)
     endif
diff --git a/physics/module_sf_exchcoef.f90 b/physics/module_sf_exchcoef.f90
index 0e3dae80c..6ec9ed835 100644
--- a/physics/module_sf_exchcoef.f90
+++ b/physics/module_sf_exchcoef.f90
@@ -636,7 +636,7 @@ SUBROUTINE znot_t_v8(uref,znott)
 
   END SUBROUTINE znot_t_v8
 
-   SUBROUTINE znot_wind10m(w10m,znott,znotm,icoef_sf)
+   SUBROUTINE znot_wind10m(w10m,znott,znotm,icoef_sf,errmsg,errflg)
    IMPLICIT NONE
 
 ! w10m(m/s)   :   10-m wind speed
@@ -647,8 +647,15 @@ SUBROUTINE znot_wind10m(w10m,znott,znotm,icoef_sf)
      REAL, INTENT(IN) :: w10m
      INTEGER, INTENT(IN) :: icoef_sf
      REAL, INTENT(OUT):: znott, znotm
+     character(len=*),intent(out) :: errmsg
+     integer,         intent(out) :: errflg
 
      real :: zm,zt,windmks, zlev,z10, tmp, zlevt, aaa, zm1,zt1
+
+     ! Initialize error-handling
+     errflg = 0
+     errmsg = ''
+
         zlev=20.0
         zlevt=10.0
         z10=10.0
@@ -722,7 +729,9 @@ SUBROUTINE znot_wind10m(w10m,znott,znotm,icoef_sf)
               call  znot_t_v8(windmks,zt1)
            else
              write(0,*)'stop, icoef_sf must be one of 0,1,2,3,4,5,6,7,8'
-             stop
+             errflg = 1
+             errmsg = 'ERROR(znot_wind10m): icoef_sf must be one of 0,1,2,3,4,5,6,7,8'
+             return
           endif
           znott=zt1
           znotm=zm1
diff --git a/physics/module_sf_mynn.F90 b/physics/module_sf_mynn.F90
index 0d81e145a..a6f32430d 100644
--- a/physics/module_sf_mynn.F90
+++ b/physics/module_sf_mynn.F90
@@ -378,6 +378,10 @@ SUBROUTINE SFCLAY_mynn(                           &
       INTEGER ::  I,J,K,itf,ktf
 !-----------------------------------------------------------
 
+      ! Initialize error-handling
+      errflg = 0
+      errmsg = ''
+
       IF (debug_code >= 1) THEN
         write(*,*)"======= printing of constants:"
         write(*,*)"cp=", cp," g=",     g    
@@ -671,6 +675,9 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
       REAL    ::  FLUXC,VSGD
       REAL    ::  restar,VISC,DQG,OLDUST,OLDTST
 
+      ! Initialize error-handling
+      errflg = 0
+      errmsg = ''
 !-------------------------------------------------------------------
       DO I=its,ite
 
@@ -1179,7 +1186,7 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
              ENDIF
           ELSEIF ( ISFTCFLX .EQ. 4 ) THEN
              !GFS zt formulation
-             CALL GFS_zt_wat(ZT_wat(i),ZNTstoch_wat(i),restar,WSPD(i),ZA(i),sfc_z0_type)
+             CALL GFS_zt_wat(ZT_wat(i),ZNTstoch_wat(i),restar,WSPD(i),ZA(i),sfc_z0_type,errmsg,errflg)
              ZQ_wat(i)=ZT_wat(i)
           ENDIF
        ELSE
@@ -2749,14 +2756,20 @@ SUBROUTINE GFS_z0_wat(z0rl_wat,ustar_wat,WSPD,z1,sfc_z0_type,redrag)
     END SUBROUTINE GFS_z0_wat
 !--------------------------------------------------------------------
 !>\ingroup mynn_sfc
-    SUBROUTINE GFS_zt_wat(ztmax,z0rl_wat,restar,WSPD,z1,sfc_z0_type)
+    SUBROUTINE GFS_zt_wat(ztmax,z0rl_wat,restar,WSPD,z1,sfc_z0_type,errmsg,errflg)
 
         REAL, INTENT(OUT)  :: ztmax
         REAL, INTENT(IN)   :: wspd,z1,z0rl_wat,restar
         INTEGER, INTENT(IN):: sfc_z0_type
+        character(len=*), intent(out) :: errmsg
+        integer,          intent(out) :: errflg
         REAL :: z0,z0max,wind10m,rat,ustar_wat
         REAL, PARAMETER    :: charnock = 0.014, z0s_max=.317e-2
 
+        ! Initialize error-handling
+        errflg = 0
+        errmsg = ''
+
 !            z0           = 0.01 * z0rl_wat
 !Already converted to meters in the wrapper
             z0           = z0rl_wat
@@ -2786,7 +2799,9 @@ SUBROUTINE GFS_zt_wat(ztmax,z0rl_wat,restar,WSPD,z1,sfc_z0_type)
               call znot_t_v7(wind10m, ztmax)   ! 10-m wind,m/s, ztmax(m)
             else if (sfc_z0_type > 0) then
               write(0,*)'no option for sfc_z0_type=',sfc_z0_type
-              stop
+              errflg = 1
+              errmsg = 'ERROR(GFS_zt_wat): sfc_z0_type not valid.'
+              return
             endif
 
     END SUBROUTINE GFS_zt_wat
diff --git a/physics/module_sf_ruclsm.F90 b/physics/module_sf_ruclsm.F90
index 0cf820303..f86eb54fe 100644
--- a/physics/module_sf_ruclsm.F90
+++ b/physics/module_sf_ruclsm.F90
@@ -81,7 +81,8 @@ SUBROUTINE LSMRUC(                                           &
                    SMFR3D,KEEPFR3DFLAG,                          &
                    myj,shdmin,shdmax,rdlai2d,                    &
                    ims,ime, jms,jme, kms,kme,                    &
-                   its,ite, jts,jte, kts,kte                     )
+                   its,ite, jts,jte, kts,kte,                    &
+                   errmsg, errflg)
 !-----------------------------------------------------------------
    IMPLICIT NONE
 !-----------------------------------------------------------------
@@ -334,7 +335,6 @@ SUBROUTINE LSMRUC(                                           &
                                                            KICE, &
                                                             KWT
 
-
    REAL,     DIMENSION(1:NSL)                ::          ZSMAIN, &
                                                          ZSHALF, &
                                                          DTDZS2
@@ -390,9 +390,14 @@ SUBROUTINE LSMRUC(                                           &
    INTEGER   ::  I,J,K,NZS,NZS1,NDDZS
    INTEGER   ::  k1,k2
    logical :: debug_print
-
+   character(len=*), intent(out) :: errmsg
+   integer,          intent(out) :: errflg
 !-----------------------------------------------------------------
 !   
+     ! Initialize error-handling
+     errflg = 0
+     errmsg = ''
+
      debug_print = .false.
 !
          rovcp = rd/cp
@@ -713,7 +718,7 @@ SUBROUTINE LSMRUC(                                           &
                        soilfrac,nscat,shdmin(i,j),shdmax(i,j),mosaic_lu, mosaic_soil,&
                        NLCAT,ILAND,ISOIL,iswater,MYJ,IFOREST,lufrac,VEGFRA(I,J),     &
                        EMISSL(I,J),PC(I,J),ZNT(I,J),LAI(I,J),RDLAI2D,                &
-                       QWRTZ,RHOCS,BCLH,DQM,KSAT,PSIS,QMIN,REF,WILT,i,j )
+                       QWRTZ,RHOCS,BCLH,DQM,KSAT,PSIS,QMIN,REF,WILT,i,j,errmsg, errflg)
 
        !-- update background emissivity for land points, can have vegetation mosaic effect
        EMISBCK(I,J) = EMISSL(I,J)
@@ -6557,7 +6562,8 @@ SUBROUTINE SOILVEGIN  ( debug_print,                            &
                              mosaic_lu, mosaic_soil,                 &
                      NLCAT,IVGTYP,ISLTYP,iswater,MYJ,                &
                      IFOREST,lufrac,vegfrac,EMISS,PC,ZNT,LAI,RDLAI2D,&
-                     QWRTZ,RHOCS,BCLH,DQM,KSAT,PSIS,QMIN,REF,WILT,I,J)
+                     QWRTZ,RHOCS,BCLH,DQM,KSAT,PSIS,QMIN,REF,WILT,I,J,&
+                     errmsg, errflg)
 
 !************************************************************************
 !  Set-up soil and vegetation Parameters in the case when
@@ -6819,7 +6825,8 @@ SUBROUTINE SOILVEGIN  ( debug_print,                            &
                                                             REF, &
                                                            WILT
    INTEGER, INTENT (  OUT)   ::                         iforest
-
+   character(len=*),intent(out) :: errmsg
+   integer,         intent(out) :: errflg
 !   INTEGER, DIMENSION( 1:(lucats) )                          , &
 !            INTENT (  OUT)            ::                iforest
 
@@ -6840,7 +6847,11 @@ SUBROUTINE SOILVEGIN  ( debug_print,                            &
 !             iforest(k)=if1(k)
 !          enddo
 
-        iforest = IFORTBL(IVGTYP)
+   ! Initialize error-handling
+   errflg = 0
+   errmsg = ''
+
+   iforest = IFORTBL(IVGTYP)
 
     IF (debug_print ) THEN
         print *,'ifortbl(ivgtyp),ivgtyp,laitbl(ivgtyp),z0tbl(ivgtyp)', &
@@ -6914,7 +6925,9 @@ SUBROUTINE SOILVEGIN  ( debug_print,                            &
        if (area.gt.1.) area=1.
        if (area <= 0.) then
           print *,'Bad area of grid box', area
-          stop
+          errflg = 1
+          errmsg = 'ERROR(SOILVEGIN): Bad area of grid box'
+          return
        endif
 
     IF (debug_print ) THEN
diff --git a/physics/radiation_clouds.f b/physics/radiation_clouds.f
index d77b39735..dc6535e3d 100644
--- a/physics/radiation_clouds.f
+++ b/physics/radiation_clouds.f
@@ -379,7 +379,6 @@ subroutine cld_init                                               &
             errmsg = 'ERROR(cld_init): cloud mp specification is not'// &
      &       ' valid'
             return
-            stop
           endif
         endif
       endif
diff --git a/physics/radlw_main.F90 b/physics/radlw_main.F90
index aeb626007..2f51b09f4 100644
--- a/physics/radlw_main.F90
+++ b/physics/radlw_main.F90
@@ -1325,8 +1325,7 @@ end subroutine rrtmg_lw_finalize
 !!\section rlwinit_gen rlwinit General Algorithm
 !! @{
       subroutine rlwinit                                                &
-     &     ( me ) !  ---  inputs
-!  ---  outputs: (none)
+     &     ( me, errflg, errmsg )
 
 !  ===================  program usage description  ===================  !
 !                                                                       !
@@ -1397,7 +1396,9 @@ subroutine rlwinit                                                &
 !  ---  inputs:
       integer, intent(in) :: me
 
-!  ---  outputs: none
+!  ---  outputs:
+      character(len=*), intent(out) :: errmsg
+      integer,          intent(out) :: errflg
 
 !  ---  locals:
       real (kind=kind_phys), parameter :: expeps = 1.e-20
@@ -1409,10 +1410,16 @@ subroutine rlwinit                                                &
 !
 !===> ... begin here
 !
+      ! Initialize error-handling
+      errflg = 0
+      errmsg = ''
+
       if ( iovr<0 .or. iovr>5 ) then
         print *,'  *** Error in specification of cloud overlap flag',   &
      &          ' IOVR=',iovr,' in RLWINIT !!'
-        stop
+        errflg = 1
+        errmsg = 'ERROR(rlwinit): cloud-overlap (iovr) scheme selected not valid.'
+        return
       elseif ( (iovr==2 .or. iovr==3) .and. isubclw==0 ) then
         if (me == 0) then
           print *,'  *** IOVR=',iovr,' is not available for',           &
@@ -1446,7 +1453,9 @@ subroutine rlwinit                                                &
         else
           print *,'  *** Error in specification of sub-column cloud ',  &
      &            ' control flag isubclw =',isubclw,' !!'
-          stop
+          errflg = 1
+          errmsg = 'ERROR(rlwinit): sub-column scheme (isubclw) selected not valid.'
+          return
         endif
       endif
 
@@ -1456,7 +1465,10 @@ subroutine rlwinit                                                &
      &    (icldflg == 1 .and. ilwcliq == 0)) then
         print *,'  *** Model cloud scheme inconsistent with LW',        &
      &          ' radiation cloud radiative property setup !!'
-        stop
+        errflg = 1
+        errmsg = 'ERROR(rlwinit): Model cloud scheme inconsistent with LW'//&
+     &          ' radiation cloud radiative property setup'
+        return
       endif
 
 !> -# Setup default surface emissivity for each band.
@@ -7668,7 +7680,9 @@ subroutine cldprmc(nlayers, inflag, iceflag, liqflag, cldfmc,     &
                return
 
             elseif(inflag .eq. 1) then
-                stop 'INFLAG = 1 OPTION NOT AVAILABLE WITH MCICA'
+                errflg = 1
+                errmsg = 'ERROR(rlwinit): INFLAG = 1 OPTION NOT AVAILABLE WITH MCICA'
+                return
 !               cwp = ciwpmc(ig,lay) + clwpmc(ig,lay)
 !               taucmc(ig,lay) = abscld1 * cwp
 
diff --git a/physics/radsw_main.F90 b/physics/radsw_main.F90
index 5d7d62dcc..f6c6b9a1e 100644
--- a/physics/radsw_main.F90
+++ b/physics/radsw_main.F90
@@ -1397,7 +1397,7 @@ end subroutine rrtmg_sw_finalize
 !! @{
 !-----------------------------------
       subroutine rswinit                                                &
-     &     ( me ) !  ---  inputs:
+     &     ( me, errflg, errmsg ) !  ---  inputs:
 !  ---  outputs: (none)
 
 !  ===================  program usage description  ===================  !
@@ -1457,7 +1457,9 @@ subroutine rswinit                                                &
 !  ---  inputs:
       integer, intent(in) :: me
 
-!  ---  outputs: none
+!  ---  outputs:
+      character(len=*), intent(out) :: errmsg
+      integer,          intent(out) :: errflg
 
 !  ---  locals:
       real (kind=kind_phys), parameter :: expeps = 1.e-20
@@ -1469,10 +1471,16 @@ subroutine rswinit                                                &
 !
 !===> ... begin here
 !
+      ! Initialize error-handling
+      errflg = 0
+      errmsg = ''
+
       if ( iovr<0 .or. iovr>5 ) then
         print *,'  *** Error in specification of cloud overlap flag',   &
      &          ' IOVR=',iovr,' in RSWINIT !!'
-        stop
+        errflg = 1
+        errmsg = 'ERROR(rswinit): cloud-overlap (iovr) scheme selected not valid.'
+        return
       endif
 
       if (me == 0) then
@@ -1505,7 +1513,9 @@ subroutine rswinit                                                &
         else
           print *,'  *** Error in specification of sub-column cloud ',  &
      &            ' control flag isubcsw =',isubcsw,' !!'
-          stop
+          errflg = 1
+          errmsg = 'ERROR(rswinit): sub-column scheme (isubcsw) selected not valid.'
+          return
         endif
       endif
 
@@ -1515,7 +1525,10 @@ subroutine rswinit                                                &
      &    (icldflg == 1 .and. iswcliq == 0)) then
         print *,'  *** Model cloud scheme inconsistent with SW',        &
      &          ' radiation cloud radiative property setup !!'
-        stop
+        errflg = 1
+        errmsg = 'ERROR(rswinit): Model cloud scheme inconsistent with SW'//&
+     &          ' radiation cloud radiative property setup'
+        return
       endif
 
       if ( isubcsw==0 .and. iovr>2 ) then
diff --git a/physics/set_soilveg_ruc.F90 b/physics/set_soilveg_ruc.F90
index cac4fd1e7..c03e6fc5f 100644
--- a/physics/set_soilveg_ruc.F90
+++ b/physics/set_soilveg_ruc.F90
@@ -17,9 +17,11 @@ module set_soilveg_ruc_mod
 !>\ingroup lsm_ruc_group
 !! This subroutine specifies vegetation and soil parameters for a given
 !! soil and land-use classification.
-      subroutine set_soilveg_ruc(me,isot,ivet,nlunit)
+      subroutine set_soilveg_ruc(me,isot,ivet,nlunit,errmsg,errflg)
 
       integer, intent(in) :: isot,ivet,nlunit
+      character(len=*), intent(out) :: errmsg
+      integer,          intent(out) :: errflg
       integer me
 
       integer i
@@ -35,6 +37,10 @@ subroutine set_soilveg_ruc(me,isot,ivet,nlunit)
      &  WLTSMC, QTZ, mosaic_soil, mosaic_lu,                            &
      &  REFSMCnoah, WLTSMCnoah, MAXSMCnoah
 
+      ! Initialize error-handling
+      errflg = 0
+      errmsg = ''
+
       if(ivet.eq.2) then
 ! Using umd veg classification
       slope_data =(/0.1,  0.6, 1.0, 0.35, 0.55, 0.8,            &
@@ -415,15 +421,21 @@ subroutine set_soilveg_ruc(me,isot,ivet,nlunit)
 
          IF (DEFINED_SOIL .GT. MAX_SOILTYP) THEN
             WRITE(0,*) 'Warning: DEFINED_SOIL too large in namelist'
-            STOP 222
+            errflg = 1
+            errmsg = 'ERROR(set_soilveg_ruc):  DEFINED_SOIL too large in namelist'
+            return
          ENDIF
          IF (DEFINED_VEG .GT. MAX_VEGTYP) THEN
             WRITE(0,*) 'Warning: DEFINED_VEG too large in namelist'
-            STOP 222
+            errflg = 1
+            errmsg = 'ERROR(set_soilveg_ruc):  DEFINED_VEG too large in namelist'
+            return
          ENDIF
          IF (DEFINED_SLOPE .GT. MAX_SLOPETYP) THEN
             WRITE(0,*) 'Warning: DEFINED_SLOPE too large in namelist'
-            STOP 222
+            errflg = 1
+            errmsg = 'ERROR(set_soilveg_ruc):  DEFINED_SLOPE too large in namelist'
+            return
          ENDIF
          
 !       if (me == 0) write(6,soil_veg_ruc)

From e02f1dde91715f1fcb4937f43ee58d35c0c0db74 Mon Sep 17 00:00:00 2001
From: Dustin Swales <dustin.swales@noaa.gov>
Date: Tue, 16 Aug 2022 18:19:28 +0000
Subject: [PATCH 010/115] Bug fix in html include location.

---
 physics/drag_suite.F90 | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/physics/drag_suite.F90 b/physics/drag_suite.F90
index c1c6fc8f4..5bb90b5e0 100644
--- a/physics/drag_suite.F90
+++ b/physics/drag_suite.F90
@@ -9,8 +9,12 @@ module drag_suite
 !> \defgroup gfs_drag_suite_mod GSL drag_suite Module
 !> This module contains the CCPP-compliant GSL orographic gravity wave dray scheme.
 !> @{
+!!
+!> \brief This subroutine initializes the orographic gravity wave drag scheme.
+!!
 !> \section arg_table_drag_suite_init Argument Table
-!! \htmlinclude drag_suite_init.html 
+!! \htmlinclude drag_suite_init.html
+!!
       subroutine drag_suite_init(gwd_opt, errmsg, errflg)
 
       integer,          intent(in)  :: gwd_opt

From f885b9cdc92b78765afbdae66c04ca48603607a7 Mon Sep 17 00:00:00 2001
From: Dustin Swales <dustin.swales@noaa.gov>
Date: Wed, 17 Aug 2022 10:32:10 -0600
Subject: [PATCH 011/115]  Remove dependency on physcons and physparam in
 radiation_surface.f. Provided as ccpp interstitials.

---
 CMakeLists.txt                          |  2 +-
 physics/GFS_cloud_diagnostics.F90       |  1 -
 physics/GFS_cloud_diagnostics.meta      |  1 +
 physics/GFS_radiation_surface.F90       | 20 +++++------
 physics/GFS_radiation_surface.meta      | 31 +++++++++++++++++
 physics/GFS_surface_composites_pre.F90  |  1 -
 physics/GFS_surface_composites_pre.meta |  2 +-
 physics/physparam.f                     | 19 ----------
 physics/radiation_surface.f             | 46 ++++++++++++-------------
 9 files changed, 66 insertions(+), 57 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index d14778b06..242275411 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -195,7 +195,7 @@ set_target_properties(ccpp_physics PROPERTIES VERSION ${PROJECT_VERSION}
 target_include_directories(ccpp_physics PUBLIC
                            $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>)
 
-target_link_libraries(ccpp_physics PUBLIC w3emc::w3emc_d NetCDF::NetCDF_Fortran)
+target_link_libraries(ccpp_physics PUBLIC w3nco::w3nco_d NetCDF::NetCDF_Fortran)
 
 # Define where to install the library
 install(TARGETS ccpp_physics
diff --git a/physics/GFS_cloud_diagnostics.F90 b/physics/GFS_cloud_diagnostics.F90
index 0e3f730e5..01ecd7452 100644
--- a/physics/GFS_cloud_diagnostics.F90
+++ b/physics/GFS_cloud_diagnostics.F90
@@ -3,7 +3,6 @@
 
 module GFS_cloud_diagnostics
   use machine,                 only: kind_phys
-  use physparam,               only: icldflg
   use module_radiation_clouds, only: gethml
 
   ! Module parameters (imported directly from radiation_cloud.f)
diff --git a/physics/GFS_cloud_diagnostics.meta b/physics/GFS_cloud_diagnostics.meta
index dd88bbc46..ded38a1e7 100644
--- a/physics/GFS_cloud_diagnostics.meta
+++ b/physics/GFS_cloud_diagnostics.meta
@@ -1,6 +1,7 @@
 [ccpp-table-properties]
   name = GFS_cloud_diagnostics
   type = scheme
+  dependencies = machine.F
 
 ########################################################################
 [ccpp-arg-table]
diff --git a/physics/GFS_radiation_surface.F90 b/physics/GFS_radiation_surface.F90
index ec7795c10..01c37156d 100644
--- a/physics/GFS_radiation_surface.F90
+++ b/physics/GFS_radiation_surface.F90
@@ -17,14 +17,15 @@ module GFS_radiation_surface
 !> \section arg_table_GFS_radiation_surface_init Argument Table
 !! \htmlinclude GFS_radiation_surface_init.html
 !!
-      subroutine GFS_radiation_surface_init (me, ialb, iems, errmsg, errflg)
+      subroutine GFS_radiation_surface_init (me, ialb, iems, semis_file, con_pi, errmsg, errflg)
 
-      use physparam,                only: ialbflg, iemsflg
       use module_radiation_surface, only: sfc_init
 
       implicit none
 
       integer,                              intent(in)  :: me, ialb, iems
+      character(len=26),                    intent(in)  :: semis_file
+      real(kind_phys),                      intent(in)  :: con_pi
       character(len=*),                     intent(out) :: errmsg
       integer,                              intent(out) :: errflg
 
@@ -32,16 +33,13 @@ subroutine GFS_radiation_surface_init (me, ialb, iems, errmsg, errflg)
       errmsg = ''
       errflg = 0
 
-      ialbflg= ialb                     ! surface albedo control flag
-      iemsflg= iems                     ! surface emissivity control flag
-
       if ( me == 0 ) then
         print *,'In GFS_radiation_surface_init, before calling sfc_init'
         print *,'ialb=',ialb,' iems=',iems
       end if
 
       ! Call surface initialization routine
-      call sfc_init ( me, errmsg, errflg )
+      call sfc_init ( me, ialb, iems, semis_file, con_pi, errmsg, errflg )
 
       end subroutine GFS_radiation_surface_init
 
@@ -50,13 +48,13 @@ end subroutine GFS_radiation_surface_init
 !! \htmlinclude GFS_radiation_surface_run.html
 !!
       subroutine GFS_radiation_surface_run (                            &
-        im, frac_grid, lslwr, lsswr, lsm, lsm_noahmp, lsm_ruc,          &
+        ialb, im, frac_grid, lslwr, lsswr, lsm, lsm_noahmp, lsm_ruc,    &
         xlat, xlon, slmsk, lndp_type, n_var_lndp, sfc_alb_pert,         &
         lndp_var_list, lndp_prt_list, landfrac, snodl, snodi, sncovr,   &
         sncovr_ice, fice, zorl, hprime, tsfg, tsfa, tisfc, coszen,      &
         cplice, min_seaice, min_lakeice, lakefrac, use_flake,           &
         alvsf, alnsf, alvwf, alnwf, facsf, facwf,                       &
-        semis_lnd, semis_ice, semis_wat, snoalb, use_cice_alb,          &
+        semis_lnd, semis_ice, semis_wat, snoalb, use_cice_alb, con_ttp, &
         albdvis_lnd, albdnir_lnd, albivis_lnd, albinir_lnd,             &
         albdvis_ice, albdnir_ice, albivis_ice, albinir_ice,             &
         semisbase, semis, sfcalb, sfc_alb_dif, errmsg, errflg)
@@ -67,10 +65,10 @@ subroutine GFS_radiation_surface_run (                            &
 
       implicit none
 
-      integer,               intent(in) :: im
+      integer,               intent(in) :: im, ialb
       logical,               intent(in) :: frac_grid, lslwr, lsswr, use_cice_alb, cplice
       integer,               intent(in) :: lsm, lsm_noahmp, lsm_ruc, lndp_type, n_var_lndp
-      real(kind=kind_phys),  intent(in) :: min_seaice, min_lakeice
+      real(kind=kind_phys),  intent(in) :: min_seaice, min_lakeice, con_ttp
       logical, dimension(:), intent(in) :: use_flake
 
       real(kind=kind_phys), dimension(:),   intent(in)  :: xlat, xlon, slmsk,           &
@@ -184,7 +182,7 @@ subroutine GFS_radiation_surface_run (                            &
                      alvsf, alnsf, alvwf, alnwf, facsf, facwf, fice, tisfc,                    &
                      albdvis_lnd, albdnir_lnd, albivis_lnd, albinir_lnd,                       &
                      albdvis_ice, albdnir_ice, albivis_ice, albinir_ice,                       &
-                     IM, sfc_alb_pert, lndp_alb, fracl, fraco, fraci, icy,                     & !  ---  inputs
+                     IM, sfc_alb_pert, lndp_alb, fracl, fraco, fraci, icy, ialb, con_ttp,      & !  ---  inputs
                      sfcalb )                                                                    !  ---  outputs
 
 !> -# Approximate mean surface albedo from vis- and nir- diffuse values.
diff --git a/physics/GFS_radiation_surface.meta b/physics/GFS_radiation_surface.meta
index 3fd851a40..8ad848446 100644
--- a/physics/GFS_radiation_surface.meta
+++ b/physics/GFS_radiation_surface.meta
@@ -28,6 +28,22 @@
   dimensions = ()
   type = integer
   intent = in
+[semis_file]
+  standard_name = surface_emissivity_data_file
+  long_name = surface emissivity data file for radiation
+  units = none
+  dimensions =  ()
+  type = character
+  kind = len=26
+  intent = in
+[con_pi]
+  standard_name = pi
+  long_name = ratio of a circle's circumference to its diameter
+  units = none
+  dimensions = ()
+  type = real
+  kind = kind_phys
+  intent = in
 [errmsg]
   standard_name = ccpp_error_message
   long_name = error message for error handling in CCPP
@@ -55,6 +71,13 @@
   dimensions = ()
   type = integer
   intent = in
+[ialb]
+  standard_name = control_for_surface_albedo
+  long_name = flag for using climatology alb, based on sfc type
+  units = flag
+  dimensions = ()
+  type = integer
+  intent = in
 [frac_grid]
   standard_name = flag_for_fractional_landmask
   long_name = flag for fractional grid
@@ -380,6 +403,14 @@
   dimensions = ()
   type = logical
   intent = in
+[con_ttp]
+  standard_name = triple_point_temperature_of_water
+  long_name = triple point temperature of water
+  units = K
+  dimensions = ()
+  type = real
+  kind = kind_phys
+  intent = in
 [albdvis_lnd]
   standard_name = surface_albedo_direct_visible_over_land
   long_name = direct surface albedo visible band over land
diff --git a/physics/GFS_surface_composites_pre.F90 b/physics/GFS_surface_composites_pre.F90
index 734f1965b..a8b0a3112 100644
--- a/physics/GFS_surface_composites_pre.F90
+++ b/physics/GFS_surface_composites_pre.F90
@@ -4,7 +4,6 @@
 module GFS_surface_composites_pre
 
    use machine, only: kind_phys
-   use physparam, only : iemsflg
 
    implicit none
 
diff --git a/physics/GFS_surface_composites_pre.meta b/physics/GFS_surface_composites_pre.meta
index e87af3e28..a0e30055f 100644
--- a/physics/GFS_surface_composites_pre.meta
+++ b/physics/GFS_surface_composites_pre.meta
@@ -1,7 +1,7 @@
 [ccpp-table-properties]
   name = GFS_surface_composites_pre
   type = scheme
-  dependencies = machine.F,physparam.f
+  dependencies = machine.F
   
 ########################################################################
 [ccpp-arg-table]
diff --git a/physics/physparam.f b/physics/physparam.f
index b84bdd42f..880ed47f3 100644
--- a/physics/physparam.f
+++ b/physics/physparam.f
@@ -211,25 +211,6 @@ module physparam
 !> shallow convetion flag
       logical, save :: lsashal =.false.
 
-! ............................................. !
-!>\name  2.5 For module radiation_surface
-! ............................................. !
-
-!> surface albedo scheme control flag
-!!\n =0:vegetation type based climatological albedo scheme
-!!\n =1:seasonal albedo derived from MODIS measurements
-      integer, save :: ialbflg = 0
-
-!> surface emissivity scheme control flag
-!!\n =0:black-body surface emissivity(=1.0)
-!!\n =1:vegetation type based climatology emissivity(<1.0)
-!!\n Opr GFS/CFS=1; see IEMS in run scripts
-      integer, save :: iemsflg = 0
-
-!> external sfc emissivity data table: sfc_emissivity_idx.txt
-      character, save :: semis_file*26
-      data semis_file   / 'sfc_emissivity_idx.txt    ' /
-
 ! ............................................. !
 !> \name  2.6 general purpose
 ! ............................................. !
diff --git a/physics/radiation_surface.f b/physics/radiation_surface.f
index 664e7d453..dba4450e2 100644
--- a/physics/radiation_surface.f
+++ b/physics/radiation_surface.f
@@ -107,9 +107,7 @@ module module_radiation_surface
 !! \section arg_table_module_radiation_surface
 !! \htmlinclude module_radiation_surface.html
 !!
-      use physparam,         only : ialbflg, iemsflg, semis_file,       &
-     &                              kind_phys
-      use physcons,          only : con_t0c, con_ttp, con_pi, con_tice
+      use machine,           only : kind_phys
       use module_iounitdef,  only : NIRADSF
       use surface_perturbation, only : ppfbet
 !
@@ -129,7 +127,7 @@ module module_radiation_surface
       real (kind=kind_phys), parameter :: f_zero = 0.0
       real (kind=kind_phys), parameter :: f_one  = 1.0
       real (kind=kind_phys), parameter :: epsln  = 1.0e-6
-      real (kind=kind_phys), parameter :: rad2dg = 180.0 / con_pi
+      real (kind=kind_phys) :: rad2dg
       integer, allocatable  ::  idxems(:,:)         ! global surface emissivity index array
       integer :: iemslw = 1                         ! global surface emissivity control flag set up in 'sfc_init'
 !
@@ -146,7 +144,7 @@ module module_radiation_surface
 !>\section gen_sfc_init sfc_init General Algorithm
 !-----------------------------------
       subroutine sfc_init                                               &
-     &     ( me, errmsg, errflg )!  ---  inputs/outputs:
+     &     ( me, ialbflg, iemsflg, semis_file, con_pi, errmsg, errflg )!  ---  inputs/outputs:
 !
 !  ===================================================================  !
 !                                                                       !
@@ -160,11 +158,7 @@ subroutine sfc_init                                               &
 !  ====================  defination of variables  ====================  !
 !                                                                       !
 !  inputs:                                                              !
-!      me           - print control flag                                !
-!                                                                       !
-!  outputs: (none) to module variables only                             !
-!                                                                       !
-!  external module variables:                                           !
+!     me            - print control flag                                !
 !     ialbflg       - control flag for surface albedo schemes           !
 !                     =1: use modis based surface albedo                !
 !                     =2: use surface albedo from land model            !
@@ -174,13 +168,18 @@ subroutine sfc_init                                               &
 !                     b:=1 use varying climtology sfc emiss (veg based) !
 !                       =2 use surface emissivity from land model       !
 !                                                                       !
+!  outputs: (CCPP error handling)                                       !
+!     errmsg        - CCPP error message                                !
+!     errflg        - CCPP error flag                                   !
+!                                                                       !
 !  ====================    end of description    =====================  !
 !
       implicit none
 
 !  ---  inputs:
-      integer, intent(in) :: me
-
+      integer, intent(in) :: me, ialbflg, iemsflg
+      real(kind=kind_phys), intent(in) :: con_pi
+      character(len=26), intent(in) :: semis_file
 !  ---  outputs: ( none )
       character(len=*), intent(out) :: errmsg
       integer,          intent(out) :: errflg
@@ -196,10 +195,13 @@ subroutine sfc_init                                               &
       errmsg = ''
       errflg = 0
 !
+      ! Module
+      rad2dg = 180.0 / con_pi
+
       if ( me == 0 ) print *, VTAGSFC   ! print out version tag
 
 !> - Initialization of surface albedo section
-!! \n physparam::ialbflg
+!! \n GFS_typedefs::ialbflg
 !!  - = 1: using MODIS based land surface albedo for SW
 !!  - = 2: using albedo from land model
 
@@ -224,7 +226,7 @@ subroutine sfc_init                                               &
       endif    ! end if_ialbflg_block
 
 !> - Initialization of surface emissivity section
-!! \n physparam::iemsflg
+!! \n GFS_typedefs::iemsflg
 !!  - = 1: input SFC emissivity type map from "semis_file"
 !!  - = 2: input SFC emissivity from land model
 
@@ -339,8 +341,8 @@ subroutine setalb                                                 &
      &       alvsf,alnsf,alvwf,alnwf,facsf,facwf,fice,tisfc,            &
      &       lsmalbdvis, lsmalbdnir, lsmalbivis, lsmalbinir,            &
      &       icealbdvis, icealbdnir, icealbivis, icealbinir,            &
-     &       IMAX, albPpert, pertalb, fracl, fraco, fraci, icy,         &
-     &       sfcalb                                                     & !  ---  outputs:
+     &       IMAX, albPpert, pertalb, fracl, fraco, fraci, icy, ialbflg,&
+     &       con_ttp, sfcalb                                            & !  ---  outputs:
      &     )
 
 !  ===================================================================  !
@@ -387,6 +389,9 @@ subroutine setalb                                                 &
 !     fice  (IMAX)  - sea-ice fraction                                  !
 !     tisfc (IMAX)  - sea-ice surface temperature                       !
 !     IMAX          - array horizontal dimension                        !
+!     ialbflg       - control flag for surface albedo schemes           !
+!                     =1: use modis based surface albedo                !
+!                     =2: use surface albedo from land model            !
 !                                                                       !
 !  outputs:                                                             !
 !     sfcalb(IMAX,NF_ALBD)                                              !
@@ -395,17 +400,12 @@ subroutine setalb                                                 &
 !           ( :, 3) -     uv+vis direct beam albedo                     !
 !           ( :, 4) -     uv+vis diffused albedo                        !
 !                                                                       !
-!  module internal control variables:                                   !
-!     ialbflg       - =0 use the default climatology surface albedo     !
-!                     =1 use modis retrieved albedo and input snow cover!
-!                        for land areas                                 !
-!                                                                       !
 !  ====================    end of description    =====================  !
 !
       implicit none
 
 !  ---  inputs
-      integer, intent(in) :: IMAX
+      integer, intent(in) :: IMAX, ialbflg
       integer, intent(in) :: lsm, lsm_noahmp, lsm_ruc
       logical, intent(in) :: use_cice_alb, frac_grid
 
@@ -415,7 +415,7 @@ subroutine setalb                                                 &
      &       alvsf, alnsf, alvwf, alnwf, facsf, facwf, fice, tisfc,     &
      &       icealbdvis, icealbdnir, icealbivis, icealbinir,            &
      &       sncovr, sncovr_ice, snoalb, albPpert           ! sfc-perts, mgehne
-      real (kind=kind_phys),  intent(in) :: pertalb         ! sfc-perts, mgehne
+      real (kind=kind_phys),  intent(in) :: pertalb, con_ttp! sfc-perts, mgehne
       real (kind=kind_phys), dimension(:), intent(in) ::                &
      &       fracl, fraco, fraci
       real (kind=kind_phys), dimension(:),intent(inout) ::              &

From 9f9ed2ab0f4c4ab054b8999697f57beff4af6219 Mon Sep 17 00:00:00 2001
From: Dustin Swales <dustin.swales@noaa.gov>
Date: Wed, 17 Aug 2022 13:56:02 -0600
Subject: [PATCH 012/115] Remove dependency on physcons and physparam in
 radiation_gases.f. Provided as ccpp interstitials.

---
 physics/GFS_rrtmg_pre.F90     |  13 +--
 physics/GFS_rrtmg_pre.meta    |   7 ++
 physics/GFS_rrtmg_setup.F90   |  85 ++++++++-------
 physics/GFS_rrtmg_setup.meta  |  53 ++++++++++
 physics/GFS_rrtmgp_pre.F90    |  10 +-
 physics/GFS_rrtmgp_pre.meta   |  15 +++
 physics/GFS_rrtmgp_setup.F90  |  29 +++---
 physics/GFS_rrtmgp_setup.meta |  53 ++++++++++
 physics/physparam.f           |  13 ---
 physics/radiation_gases.f     | 188 ++++++----------------------------
 10 files changed, 228 insertions(+), 238 deletions(-)

diff --git a/physics/GFS_rrtmg_pre.F90 b/physics/GFS_rrtmg_pre.F90
index 9fd2a092c..57e0b4347 100644
--- a/physics/GFS_rrtmg_pre.F90
+++ b/physics/GFS_rrtmg_pre.F90
@@ -45,7 +45,7 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp,        &
         clouds9, cldsa, cldfra, cldfra2d, lwp_ex,iwp_ex, lwp_fc,iwp_fc,        &
         faersw1, faersw2, faersw3, faerlw1, faerlw2, faerlw3, alpha,           &
         aero_dir_fdb, smoke_ext, dust_ext,                                     &
-        spp_wts_rad, spp_rad, rrfs_smoke_band, top_at_1, errmsg, errflg)
+        spp_wts_rad, spp_rad, rrfs_smoke_band, top_at_1, ico2, errmsg, errflg)
 
       use machine,                   only: kind_phys
 
@@ -111,7 +111,8 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp,        &
          idcor_con,                        &
          idcor_hogan,                      &
          idcor_oreopoulos,                 &
-         rrfs_smoke_band                     ! Band number for rrfs-smoke dust and smoke
+         rrfs_smoke_band,                  & ! Band number for rrfs-smoke dust and smoke
+         ico2                                ! Flag for co2 source used in radiation
 
       integer, intent(in) :: ntdu1, ntdu2, ntdu3, ntdu4, ntdu5, ntss1, ntss2, ntss3,  &
                              ntss4, ntss5, ntsu, ntbcb, ntbcl, ntocb, ntocl, ntchm
@@ -422,8 +423,8 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp,        &
           enddo
         enddo
       else                                ! climatological ozone
-        call getozn (prslk1, xlat, im, lmk,    &     !  ---  inputs
-                     olyr)                           !  ---  outputs
+        call getozn (prslk1, xlat, im, lmk, top_at_1,    &     !  ---  inputs
+                     olyr)                                     !  ---  outputs
       endif                               ! end_if_ntoz
 
 !> - Call coszmn(), to compute cosine of zenith angle (only when SW is called)
@@ -447,8 +448,8 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp,        &
 
 !  --- ...  set up non-prognostic gas volume mixing ratioes
 
-      call getgases (plvl, xlon, xlat, IM, LMK, & !  --- inputs
-                     gasvmr)                      !  --- outputs
+      call getgases (plvl, xlon, xlat, IM, LMK, ico2, top_at_1,& !  --- inputs
+                     con_pi, gasvmr)                             !  --- outputs
 
 !CCPP: re-assign gasvmr(:,:,NF_VGAS) to gasvmr_X(:,:)
       do k = 1, LMK
diff --git a/physics/GFS_rrtmg_pre.meta b/physics/GFS_rrtmg_pre.meta
index 0c2240720..8fa020ec5 100644
--- a/physics/GFS_rrtmg_pre.meta
+++ b/physics/GFS_rrtmg_pre.meta
@@ -1343,6 +1343,13 @@
   dimensions = ()
   type = logical
   intent = out
+[ico2]
+  standard_name = control_for_co2
+  long_name = prescribed global mean value (old opernl)
+  units = flag
+  dimensions = ()
+  type = integer
+  intent = in
 [aero_dir_fdb]
   standard_name = do_smoke_aerosol_direct_feedback
   long_name = flag for smoke and dust radiation feedback
diff --git a/physics/GFS_rrtmg_setup.F90 b/physics/GFS_rrtmg_setup.F90
index a8d829e12..f83f53f01 100644
--- a/physics/GFS_rrtmg_setup.F90
+++ b/physics/GFS_rrtmg_setup.F90
@@ -6,7 +6,7 @@
 !> @{
 module GFS_rrtmg_setup
 
-   use physparam, only : ictmflg, ico2flg, ioznflg, icldflg, &
+   use physparam, only : icldflg, &
    &             iovrRad=>iovr, lcrick , lcnorm , lnoprec,            &
    &             isubcsw, isubclw, ivflip , ipsd0,                    &
    &             iswcliq
@@ -34,7 +34,7 @@ module GFS_rrtmg_setup
 
    !> control flag for the first time of reading climatological ozone data
    !! (set/reset in subroutines radinit/radupdate, it is used only if the
-   !! control parameter ioznflg=0)
+   !! control parameter ntoz=0)
    logical :: loz1st = .true.
 
    contains
@@ -50,7 +50,8 @@ subroutine GFS_rrtmg_setup_init (                          &
           norad_precip, idate, iflip,                         &
           do_RRTMGP, me, lalw1bd, iaermdl, iaerflg,           &
           aeros_file, con_pi, con_t0c, con_c, con_boltz,      &
-          con_plnk, con_solr_2008, con_solr_2002, errmsg, errflg)
+          con_plnk, con_solr_2008, con_solr_2002, co2usr_file,&
+          co2cyc_file, errmsg, errflg)
 ! =================   subprogram documentation block   ================ !
 !                                                                       !
 ! subprogram:   GFS_rrtmg_setup_init - a subprogram to initialize radiation !
@@ -171,7 +172,7 @@ subroutine GFS_rrtmg_setup_init (                          &
       integer, intent(in) :: iflip
       logical, intent(in) :: do_RRTMGP, lalw1bd
       integer, intent(in) :: me
-      character(len=26),intent(in)  :: aeros_file, solar_file
+      character(len=26),intent(in)  :: aeros_file, solar_file, co2usr_file, co2cyc_file
       real(kind_phys),  intent(in)  :: con_pi,con_t0c,con_c,con_boltz,con_plnk,con_solr_2008,con_solr_2002
       character(len=*), intent(out) :: errmsg
       integer,          intent(out) :: errflg
@@ -189,10 +190,6 @@ subroutine GFS_rrtmg_setup_init (                          &
         return
       end if
 
-      ictmflg= ictm                     ! data ic time/date control flag
-      ico2flg= ico2                     ! co2 data source control flag
-      ioznflg= ntoz                     ! ozone data source control flag
-
       if ( ictm==0 .or. ictm==-2 ) then
         iaerflg = mod(iaer, 100)        ! no volcanic aerosols for clim hindcast
       else
@@ -246,12 +243,11 @@ subroutine GFS_rrtmg_setup_init (                          &
       endif
 
       call radinit                                                      &
-!  ---  inputs:
      &     ( si, levr, imp_physics, me, iaermdl, iaerflg, lalw1bd,      &
      &       aeros_file, con_pi, con_t0c, con_c, con_boltz, con_plnk,   &
-     &       isol, solar_file, con_solr_2008, con_solr_2002, errmsg, errflg )
-!  ---  outputs:
-!          ( none )
+     &       isol, solar_file, con_solr_2008, con_solr_2002,            &
+     &       co2usr_file, co2cyc_file, ico2, ictm, ntoz, errmsg, errflg )
+
 
       if ( me == 0 ) then
         print *,'  Radiation sub-cloud initial seed =',ipsd0,           &
@@ -268,9 +264,9 @@ end subroutine GFS_rrtmg_setup_init
 !> \section arg_table_GFS_rrtmg_setup_timestep_init Argument Table
 !! \htmlinclude GFS_rrtmg_setup_timestep_init.html
 !!
-   subroutine GFS_rrtmg_setup_timestep_init (      &
-          idate, jdate, deltsw, deltim, lsswr, me, iaermdl, &
-          iaerflg, isol, aeros_file, slag, sdec, cdec, solcon, con_pi, errmsg, errflg)
+   subroutine GFS_rrtmg_setup_timestep_init (idate, jdate, deltsw, deltim, &
+        lsswr, me, iaermdl, iaerflg, isol, aeros_file, slag, sdec, cdec,   &
+        solcon, con_pi, co2dat_file, co2gbl_file, ictm, ico2, ntoz, errmsg, errflg)
 
       implicit none
 
@@ -282,8 +278,8 @@ subroutine GFS_rrtmg_setup_timestep_init (      &
       real(kind=kind_phys), intent(in)  :: con_pi
       logical,              intent(in)  :: lsswr
       integer,              intent(in)  :: me
-      integer,              intent(in)  :: iaermdl, iaerflg, isol
-      character(len=26),    intent(in)  :: aeros_file
+      integer,              intent(in)  :: iaermdl, iaerflg, isol, ictm, ico2, ntoz
+      character(len=26),    intent(in)  :: aeros_file, co2dat_file, co2gbl_file
       real(kind=kind_phys), intent(out) :: slag
       real(kind=kind_phys), intent(out) :: sdec
       real(kind=kind_phys), intent(out) :: cdec
@@ -302,8 +298,8 @@ subroutine GFS_rrtmg_setup_timestep_init (      &
       errmsg = ''
       errflg = 0
 
-      call radupdate(idate,jdate,deltsw,deltim,lsswr,me,iaermdl,&
-           iaerflg,isol,aeros_file,slag,sdec,cdec,solcon,con_pi,errflg,errmsg)
+      call radupdate(idate,jdate,deltsw,deltim,lsswr,me,iaermdl, iaerflg,isol,aeros_file,&
+           slag,sdec,cdec,solcon,con_pi,co2dat_file,co2gbl_file,ictm,ico2,ntoz,errflg,errmsg)
 
    end subroutine GFS_rrtmg_setup_timestep_init
 
@@ -335,7 +331,8 @@ end subroutine GFS_rrtmg_setup_finalize
 
    subroutine radinit( si, NLAY, imp_physics, me, iaermdl, iaerflg, lalw1bd, &
         aeros_file, con_pi, con_t0c, con_c, con_boltz, con_plnk, isol,       &
-        solar_file, con_solr_2008, con_solr_2002, errmsg, errflg)
+        solar_file, con_solr_2008, con_solr_2002, co2usr_file, co2cyc_file,  &
+        ico2, ictm, ntoz, errmsg, errflg)
 !...................................
 
 !  ---  inputs:
@@ -379,11 +376,11 @@ subroutine radinit( si, NLAY, imp_physics, me, iaermdl, iaerflg, lalw1bd, &
 !                =2 compute tropspheric aero in multi bands for lw      !
 !              c:=0 no topospheric aerosol in sw radiation              !
 !                =1 include tropspheric aerosols for sw                 !
-!   ico2flg  : co2 data source control flag                             !
+!   ico2     : co2 data source control flag                             !
 !              =0: use prescribed global mean co2 (old  oper)           !
 !              =1: use observed co2 annual mean value only              !
 !              =2: use obs co2 monthly data with 2-d variation          !
-!   ictmflg  : =yyyy#, external data ic time/date control flag          !
+!   ictm     : =yyyy#, external data ic time/date control flag          !
 !              =   -2: same as 0, but superimpose seasonal cycle        !
 !                      from climatology data set.                       !
 !              =   -1: use user provided external data for the          !
@@ -448,11 +445,11 @@ subroutine radinit( si, NLAY, imp_physics, me, iaermdl, iaerflg, lalw1bd, &
       implicit none
 
 !  ---  inputs:
-      integer, intent(in) :: NLAY, me, imp_physics, iaermdl, iaerflg, isol
+      integer, intent(in) :: NLAY, me, imp_physics, iaermdl, iaerflg, isol, ico2, ictm, ntoz
       logical, intent(in) :: lalw1bd
       real (kind=kind_phys), intent(in) :: si(:), con_pi,con_t0c, con_c, &
            con_boltz, con_plnk, con_solr_2008, con_solr_2002
-      character(len=26), intent(in) :: aeros_file, solar_file
+      character(len=26), intent(in) :: aeros_file, solar_file,co2usr_file, co2cyc_file
 
 !  ---  outputs: (ccpp error handling)
       character(len=*),     intent(out) :: errmsg
@@ -464,7 +461,7 @@ subroutine radinit( si, NLAY, imp_physics, me, iaermdl, iaerflg, lalw1bd, &
 !
 !> -# Set up control variables and external module variables in
 !!    module physparam
-      loz1st = (ioznflg == 0)           ! first-time clim ozone data read flag
+      loz1st = (ntoz == 0)           ! first-time clim ozone data read flag
       month0 = 0
       iyear0 = 0
       monthd = 0
@@ -474,16 +471,16 @@ subroutine radinit( si, NLAY, imp_physics, me, iaermdl, iaerflg, lalw1bd, &
         print *,' NEW RADIATION PROGRAM STRUCTURES BECAME OPER. ',      &
      &          '  May 01 2007'
         print *, VTAGRAD                !print out version tag
-        print *,' - Selected Control Flag settings: ICTMflg=',ictmflg,  &
-     &    ' ISOLar =',isol, ' ICO2flg=',ico2flg,' IAERflg=',iaerflg,  &
+        print *,' - Selected Control Flag settings: ICTMflg=',ictm,     &
+     &    ' ISOLar =',isol, ' ICO2flg=',ico2,' IAERflg=',iaerflg,  &
      &    ' ICLDflg=',icldflg,                                          &
-     &    ' IMP_PHYSICS=',imp_physics,' IOZNflg=',ioznflg
+     &    ' IMP_PHYSICS=',imp_physics,' IOZNflg=',ntoz
         print *,' IVFLIP=',ivflip,' IOVR=',iovrRad,                     &
      &    ' ISUBCSW=',isubcsw,' ISUBCLW=',isubclw
         print *,' LCRICK=',lcrick,' LCNORM=',lcnorm,' LNOPREC=',lnoprec
         print *,' LTP =',ltp,', add extra top layer =',lextop
 
-        if ( ictmflg==0 .or. ictmflg==-2 ) then
+        if ( ictm==0 .or. ictm==-2 ) then
           print *,'   Data usage is limited by initial condition!'
           print *,'   No volcanic aerosols'
         endif
@@ -544,13 +541,14 @@ subroutine radinit( si, NLAY, imp_physics, me, iaermdl, iaerflg, lalw1bd, &
 !     Initialization
 
       call sol_init ( me, isol, solar_file, con_solr_2008, con_solr_2002,&
-           con_pi )                                              ! astronomy initialization routine
+           con_pi )                                               ! astronomy initialization routine
       call aer_init ( NLAY, me, iaermdl, iaerflg, lalw1bd, aeros_file, con_pi, &
-           con_t0c, con_c, con_boltz, con_plnk, errflg, errmsg)  ! aerosols initialization routine
-      call gas_init ( me, errflg, errmsg )                       ! co2 and other gases initialization routine
-      call cld_init ( si, NLAY, imp_physics, me, errflg, errmsg) ! cloud initialization routine
-      call rlwinit ( me, errflg, errmsg )                        ! lw RRTMG initialization routine
-      call rswinit ( me, errflg, errmsg )                        ! sw RRTMG initialization routine
+           con_t0c, con_c, con_boltz, con_plnk, errflg, errmsg)   ! aerosols initialization routine
+      call gas_init ( me, co2usr_file, co2cyc_file, ico2, ictm, ntoz, con_pi, &
+           errflg, errmsg)                                        ! co2 and other gases initialization routine
+      call cld_init ( si, NLAY, imp_physics, me, errflg, errmsg)  ! cloud initialization routine
+      call rlwinit ( me, errflg, errmsg )                         ! lw RRTMG initialization routine
+      call rswinit ( me, errflg, errmsg )                         ! sw RRTMG initialization routine
 !
       return
 !
@@ -578,8 +576,8 @@ end subroutine radinit
 !> \section gen_radupdate General Algorithm
 !-----------------------------------
       subroutine radupdate( idate,jdate,deltsw,deltim,lsswr,me, iaermdl,&
-     &                      iaerflg, isol, aeros_file, slag,sdec,cdec,solcon, &
-     &                      con_pi, errflg,errmsg)
+           iaerflg, isol, aeros_file, slag,sdec,cdec,solcon, con_pi,    &
+           co2dat_file,co2gbl_file, ictm, ico2, ntoz, errflg, errmsg)
 !...................................
 
 ! =================   subprogram documentation block   ================ !
@@ -619,7 +617,7 @@ subroutine radupdate( idate,jdate,deltsw,deltim,lsswr,me, iaermdl,&
 !              = 2: use noaa ann-mean tsi tbl tim-scale with cycle apprx!
 !              = 3: use cmip5 ann-mean tsi tbl tim-scale with cycl apprx!
 !              = 4: use cmip5 mon-mean tsi tbl tim-scale with cycl apprx!
-!   ictmflg  : =yyyy#, external data ic time/date control flag          !
+!   ictm     : =yyyy#, external data ic time/date control flag          !
 !              =   -2: same as 0, but superimpose seasonal cycle        !
 !                      from climatology data set.                       !
 !              =   -1: use user provided external data for the          !
@@ -647,9 +645,9 @@ subroutine radupdate( idate,jdate,deltsw,deltim,lsswr,me, iaermdl,&
       implicit none
 
 !  ---  inputs:
-      integer, intent(in) :: idate(:), jdate(:), me, iaermdl, iaerflg, isol
+      integer, intent(in) :: idate(:), jdate(:), me, iaermdl, iaerflg, isol, ictm, ntoz, ico2
       logical, intent(in) :: lsswr
-      character(len=26),intent(in) :: aeros_file
+      character(len=26),intent(in) :: aeros_file,co2dat_file,co2gbl_file
 
       real (kind=kind_phys), intent(in) :: deltsw, deltim, con_pi
 
@@ -684,7 +682,7 @@ subroutine radupdate( idate,jdate,deltsw,deltim,lsswr,me, iaermdl,&
 
 !  --- ...  set up time stamp used for green house gases (** currently co2 only)
 
-      if ( ictmflg==0 .or. ictmflg==-2 ) then  ! get external data at initial condition time
+      if ( ictm==0 .or. ictm==-2 ) then  ! get external data at initial condition time
         kyear = idate(1)
         kmon  = idate(2)
         kday  = idate(3)
@@ -694,7 +692,7 @@ subroutine radupdate( idate,jdate,deltsw,deltim,lsswr,me, iaermdl,&
         kmon  = imon
         kday  = iday
         khour = ihour
-      endif   ! end if_ictmflg_block
+      endif   ! end if_ictm_block
 
       if ( month0 /= imon ) then
         lmon_chg = .true.
@@ -740,7 +738,8 @@ subroutine radupdate( idate,jdate,deltsw,deltim,lsswr,me, iaermdl,&
         lco2_chg = .false.
       endif
 
-      call gas_update ( kyear,kmon,kday,khour,loz1st,lco2_chg, me, errflg, errmsg )
+      call gas_update ( kyear,kmon,kday,khour,loz1st,lco2_chg, me, co2dat_file, &
+           co2gbl_file, ictm, ico2, ntoz, errflg, errmsg )
 
       if ( loz1st ) loz1st = .false.
 
diff --git a/physics/GFS_rrtmg_setup.meta b/physics/GFS_rrtmg_setup.meta
index 71f1e2ff7..e65795887 100644
--- a/physics/GFS_rrtmg_setup.meta
+++ b/physics/GFS_rrtmg_setup.meta
@@ -195,6 +195,22 @@
   type = character
   kind = len=26
   intent = in
+[co2usr_file]
+  standard_name = co2_user_data_table_file
+  long_name =  co2 user defined data table file
+  units = none
+  dimensions =  ()
+  type = character
+  kind = len=26
+  intent = in
+[co2cyc_file]
+  standard_name = co2_clim_monthly_cycle_data_table_file
+  long_name = co2 climotological monthly cycle data table file
+  units = none
+  dimensions =  ()
+  type = character
+  kind = len=26
+  intent = in
 [con_pi]
   standard_name = pi
   long_name = ratio of a circle's circumference to its diameter
@@ -349,6 +365,43 @@
   type = character
   kind = len=26
   intent = in
+[co2dat_file]
+  standard_name = co2_monthly_obs_data_table_file
+  long_name = co2 monthly observation data table
+  units = none
+  dimensions =  ()
+  type = character
+  kind = len=26
+  intent = in
+[co2gbl_file]
+  standard_name = co2_global_annual_mean_data_table_file
+  long_name = co2 global annual mean data file
+  units = none
+  dimensions =  ()
+  type = character
+  kind = len=26
+  intent = in
+[ictm]
+  standard_name = flag_for_initial_time_date_control
+  long_name = flag for initial conditions and forcing
+  units = flag
+  dimensions = ()
+  type = integer
+  intent = in
+[ico2]
+  standard_name = control_for_co2
+  long_name = prescribed global mean value (old opernl)
+  units = flag
+  dimensions = ()
+  type = integer
+  intent = in
+[ntoz]
+  standard_name = index_of_ozone_mixing_ratio_in_tracer_concentration_array
+  long_name = tracer index for ozone mixing ratio
+  units = index
+  dimensions = ()
+  type = integer
+  intent = in
 [con_pi]
   standard_name = pi
   long_name = ratio of a circle's circumference to its diameter
diff --git a/physics/GFS_rrtmgp_pre.F90 b/physics/GFS_rrtmgp_pre.F90
index 755b977b3..9822aaf74 100644
--- a/physics/GFS_rrtmgp_pre.F90
+++ b/physics/GFS_rrtmgp_pre.F90
@@ -116,14 +116,15 @@ subroutine GFS_rrtmgp_pre_run(me, nCol, nLev, nTracers, i_o3, lsswr, lslwr, fhsw
        con_eps, con_epsm1, con_fvirt, con_epsqs, solhr, minGPpres, maxGPpres, minGPtemp,    &
        maxGPtemp, raddt, p_lay, t_lay, p_lev, t_lev, tsfg, tsfa, qs_lay, q_lay, tv_lay,     &
        relhum, tracer, deltaZ, deltaZc, deltaP, active_gases_array, gas_concentrations,     &
-       tsfc_radtime, coszen, coszdg, top_at_1, iSFC, iTOA, errmsg, errflg)
+       tsfc_radtime, coszen, coszdg, top_at_1, iSFC, iTOA, ico2, con_pi, errmsg, errflg)
     
     ! Inputs   
     integer, intent(in)    :: &
          nCol,              & ! Number of horizontal grid points
          nLev,              & ! Number of vertical layers
          nTracers,          & ! Number of tracers from model. 
-         i_o3                 ! Index into tracer array for ozone
+         i_o3,              & ! Index into tracer array for ozone
+         ico2                 ! Flag for co2 radiation scheme
     logical, intent(in) :: &
     	 lsswr,             & ! Call SW radiation?
     	 lslwr                ! Call LW radiation
@@ -141,6 +142,7 @@ subroutine GFS_rrtmgp_pre_run(me, nCol, nLev, nTracers, i_o3, lsswr, lslwr, fhsw
          con_epsm1,         & ! Physical constant: Epsilon (Rd/Rv) minus one
          con_fvirt,         & ! Physical constant: Inverse of epsilon minus one
          con_epsqs,         & ! Physical constant: Minimum saturation mixing-ratio (kg/kg)
+         con_pi,            & ! Physical constant: Pi
          solhr                ! Time in hours after 00z at the current timestep 
     real(kind_phys), dimension(:), intent(in) :: & 
     	 xlon,              & ! Longitude
@@ -350,14 +352,14 @@ subroutine GFS_rrtmgp_pre_run(me, nCol, nLev, nTracers, i_o3, lsswr, lslwr, fhsw
        enddo
     ! OR Use climatological ozone data
     else                               
-       call getozn (prslk(1:NCOL,:), xlat, nCol, nLev, o3_lay)
+       call getozn (prslk(1:NCOL,:), xlat, nCol, nLev, top_at_1, o3_lay)
     endif
 
     ! #######################################################################################
     ! Set gas concentrations for RRTMGP
     ! #######################################################################################
     ! Call getgases(), to set up non-prognostic gas volume mixing ratios (gas_vmr).
-    call getgases (p_lev/100., xlon, xlat, nCol, nLev, gas_vmr)
+    call getgases (p_lev/100., xlon, xlat, nCol, nLev, ico2, top_at_1, con_pi, gas_vmr)
 
     ! Compute volume mixing-ratios for ozone (mmr) and specific-humidity.
     vmr_h2o = merge((q_lay/(1-q_lay))*amdw, 0., q_lay  .ne. 1.)
diff --git a/physics/GFS_rrtmgp_pre.meta b/physics/GFS_rrtmgp_pre.meta
index 88face855..86645cb1a 100644
--- a/physics/GFS_rrtmgp_pre.meta
+++ b/physics/GFS_rrtmgp_pre.meta
@@ -252,6 +252,14 @@
   type = real
   kind = kind_phys
   intent = in
+[con_pi]
+  standard_name = pi
+  long_name = ratio of a circle's circumference to its diameter
+  units = none
+  dimensions = ()
+  type = real
+  kind = kind_phys
+  intent = in
 [minGPpres]
   standard_name = minimum_pressure_in_RRTMGP
   long_name = minimum pressure allowed in RRTMGP
@@ -284,6 +292,13 @@
   type = real
   kind = kind_phys
   intent = in
+[ico2]
+  standard_name = control_for_co2
+  long_name = prescribed global mean value (old opernl)
+  units = flag
+  dimensions = ()
+  type = integer
+  intent = in
 [raddt]
   standard_name = time_step_for_radiation
   long_name = radiation time step
diff --git a/physics/GFS_rrtmgp_setup.F90 b/physics/GFS_rrtmgp_setup.F90
index baaf2fcdc..935500739 100644
--- a/physics/GFS_rrtmgp_setup.F90
+++ b/physics/GFS_rrtmgp_setup.F90
@@ -9,7 +9,7 @@ module GFS_rrtmgp_setup
   !  use GFS_cloud_diagnostics,      only : hml_cloud_diagnostics_initialize
   ! *NOTE* These parameters below are required radiation_****** modules. They are not
   !        directly used by the RRTMGP routines.
-  use physparam,                  only : ictmflg, ico2flg, ioznflg, ivflip
+  use physparam,                  only : ivflip
   implicit none
   
   public GFS_rrtmgp_setup_init, GFS_rrtmgp_setup_timestep_init, GFS_rrtmgp_setup_finalize
@@ -27,7 +27,7 @@ module GFS_rrtmgp_setup
        is_initialized = .false.
   ! Control flag for the first time of reading climatological ozone data
   ! (set/reset in subroutines GFS_rrtmgp_setup_init/GFS_rrtmgp_setup_timestep_init, it is used only if 
-  ! the control parameter ioznflg=0)
+  ! the control parameter ntoz=0)
   logical :: loz1st = .true.
   
 contains
@@ -42,7 +42,7 @@ subroutine GFS_rrtmgp_setup_init(do_RRTMGP, imp_physics, imp_physics_fer_hires,
        ntcw, num_p3d,  ntoz, iovr, isubc_sw, isubc_lw, icliq_sw, crick_proof, ccnorm,    &
        norad_precip, lalw1bd, idate, iflip, me, aeros_file, iaermdl, iaerflg, con_pi,    &
        con_t0c, con_c, con_boltz, con_plnk, solar_file, con_solr_2008, con_solr_2002,    &
-       errmsg, errflg)
+       co2usr_file, co2cyc_file, errmsg, errflg)
 
     ! Inputs
     logical, intent(in) :: do_RRTMGP
@@ -66,7 +66,7 @@ subroutine GFS_rrtmgp_setup_init(do_RRTMGP, imp_physics, imp_physics_fer_hires,
          crick_proof, ccnorm, norad_precip, lalw1bd
     integer, intent(in), dimension(:) :: &
          idate
-    character(len=26),intent(in) :: aeros_file, solar_file
+    character(len=26),intent(in) :: aeros_file, solar_file, co2usr_file, co2cyc_file
 
     ! Outputs
     character(len=*), intent(out) :: errmsg
@@ -87,9 +87,6 @@ subroutine GFS_rrtmgp_setup_init(do_RRTMGP, imp_physics, imp_physics_fer_hires,
     end if
 
     ! Set radiation parameters
-    ictmflg = ictm                     ! data ic time/date control flag
-    ico2flg = ico2                     ! co2 data source control flag
-    ioznflg = ntoz                     ! ozone data source control flag
     ivflip  = iflip                    ! vertical index direction control flag
     
     if ( ictm==0 .or. ictm==-2 ) then
@@ -123,7 +120,7 @@ subroutine GFS_rrtmgp_setup_init(do_RRTMGP, imp_physics, imp_physics_fer_hires,
                ' me       = ',me
     endif
     
-    loz1st = (ioznflg == 0)           ! first-time clim ozone data read flag
+    loz1st = (ntoz == 0)           ! first-time clim ozone data read flag
     month0 = 0
     iyear0 = 0
     monthd = 0
@@ -140,7 +137,7 @@ subroutine GFS_rrtmgp_setup_init(do_RRTMGP, imp_physics, imp_physics_fer_hires,
     call sol_init ( me, isol, solar_file, con_solr_2008, con_solr_2002, con_pi )
     call aer_init ( levr, me, iaermdl, iaerflg, lalw1bd, aeros_file, con_pi, con_t0c,    &
          con_c, con_boltz, con_plnk, errflg, errmsg)
-    call gas_init ( me, errflg, errmsg )
+    call gas_init ( me, co2usr_file, co2cyc_file, ictm, ntoz, ico2, con_pi, errflg, errmsg )
     !call hml_cloud_diagnostics_initialize(imp_physics, imp_physics_fer_hires,           &
     !     imp_physics_gfdl, imp_physics_thompson, imp_physics_wsm6,                      &
     !     imp_physics_zhao_carr, imp_physics_zhao_carr_pdf, imp_physics_mg, levr, me, si,&
@@ -161,8 +158,9 @@ end subroutine GFS_rrtmgp_setup_init
 !> \section arg_table_GFS_rrtmgp_setup_timestep_init
 !! \htmlinclude GFS_rrtmgp_setup_timestep_init.html
 !!
-  subroutine GFS_rrtmgp_setup_timestep_init (idate, jdate, deltsw, deltim, lsswr, me, iaermdl,&
-       aeros_file, isol, slag, sdec, cdec, solcon, con_pi, errmsg, errflg)
+  subroutine GFS_rrtmgp_setup_timestep_init (idate, jdate, deltsw, deltim, lsswr, me,       &
+       iaermdl, aeros_file, isol, slag, sdec, cdec, solcon, con_pi, co2dat_file,            &
+       co2gbl_file, ictm, ico2, ntoz, errmsg, errflg)
      
     ! Inputs
     integer,         intent(in)  :: idate(:)
@@ -172,8 +170,8 @@ subroutine GFS_rrtmgp_setup_timestep_init (idate, jdate, deltsw, deltim, lsswr,
     real(kind_phys), intent(in)  :: con_pi
     logical,         intent(in)  :: lsswr
     integer,         intent(in)  :: me
-    integer,         intent(in)  :: iaermdl,isol
-    character(len=26), intent(in) :: aeros_file
+    integer,         intent(in)  :: iaermdl,isol,ictm,ico2,ntoz
+    character(len=26), intent(in) :: aeros_file,co2dat_file,co2gbl_file
 
     ! Outputs
     real(kind_phys), intent(out) :: slag
@@ -209,7 +207,7 @@ subroutine GFS_rrtmgp_setup_timestep_init (idate, jdate, deltsw, deltim, lsswr,
 
     ! Set up time stamp used for green house gases (** currently co2 only)
     ! get external data at initial condition time 
-    if ( ictmflg==0 .or. ictmflg==-2 ) then 
+    if ( ictm==0 .or. ictm==-2 ) then 
        kyear = idate(1)
        kmon  = idate(2)
        kday  = idate(3)
@@ -254,7 +252,8 @@ subroutine GFS_rrtmgp_setup_timestep_init (idate, jdate, deltsw, deltim, lsswr,
     else
        lco2_chg = .false.
     endif
-    call gas_update (kyear, kmon, kday, khour, loz1st, lco2_chg, me, errflg, errmsg )
+    call gas_update (kyear, kmon, kday, khour, loz1st, lco2_chg, me, co2dat_file,           &
+         co2gbl_file, ictm, ico2, ntoz, errflg, errmsg )
     
     if ( loz1st ) loz1st = .false.
 
diff --git a/physics/GFS_rrtmgp_setup.meta b/physics/GFS_rrtmgp_setup.meta
index 6e8d296e3..4f8fe1db4 100644
--- a/physics/GFS_rrtmgp_setup.meta
+++ b/physics/GFS_rrtmgp_setup.meta
@@ -285,6 +285,22 @@
   type = real
   kind = kind_phys
   intent = in
+[co2usr_file]
+  standard_name = co2_user_data_table_file
+  long_name =  co2 user defined data table file
+  units = none
+  dimensions =  ()
+  type = character
+  kind = len=26
+  intent = in
+[co2cyc_file]
+  standard_name = co2_clim_monthly_cycle_data_table_file
+  long_name = co2 climotological monthly cycle data table file
+  units = none
+  dimensions =  ()
+  type = character
+  kind = len=26
+  intent = in
 [iaermdl]
   standard_name = flag_for_aerosol_radiation_scheme
   long_name = flag for aerosol scheme to use in radiation
@@ -371,6 +387,43 @@
   type = character
   kind = len=26
   intent = in
+[co2dat_file]
+  standard_name = co2_monthly_obs_data_table_file
+  long_name = co2 monthly observation data table
+  units = none
+  dimensions =  ()
+  type = character
+  kind = len=26
+  intent = in
+[co2gbl_file]
+  standard_name = co2_global_annual_mean_data_table_file
+  long_name = co2 global annual mean data file
+  units = none
+  dimensions =  ()
+  type = character
+  kind = len=26
+  intent = in
+[ictm]
+  standard_name = flag_for_initial_time_date_control
+  long_name = flag for initial conditions and forcing
+  units = flag
+  dimensions = ()
+  type = integer
+  intent = in
+[ico2]
+  standard_name = control_for_co2
+  long_name = prescribed global mean value (old opernl)
+  units = flag
+  dimensions = ()
+  type = integer
+  intent = in
+[ntoz]
+  standard_name = index_of_ozone_mixing_ratio_in_tracer_concentration_array
+  long_name = tracer index for ozone mixing ratio
+  units = index
+  dimensions = ()
+  type = integer
+  intent = in
 [iaermdl]
   standard_name = flag_for_aerosol_radiation_scheme
   long_name = flag for aerosol scheme to use in radiation
diff --git a/physics/physparam.f b/physics/physparam.f
index 880ed47f3..0dd53a304 100644
--- a/physics/physparam.f
+++ b/physics/physparam.f
@@ -153,19 +153,6 @@ module physparam
 !!      variable at initial time)
       integer, save :: ioznflg = 1
 
-!> external co2 2d monthly obsv data table: co2historicaldata_2004.txt
-      character, save :: co2dat_file*26
-!> external co2 global annual mean data tb: co2historicaldata_glob.txt
-      character, save :: co2gbl_file*26
-!> external co2 user defined data table: co2userdata.txt
-      character, save :: co2usr_file*26
-!> external co2 clim monthly cycle data tb: co2monthlycyc.txt
-      character, save :: co2cyc_file*26
-      data co2dat_file   / 'co2historicaldata_2004.txt' /   !year is run-time selected
-      data co2gbl_file   / 'co2historicaldata_glob.txt' /
-      data co2usr_file   / 'co2userdata.txt           ' /
-      data co2cyc_file   / 'co2monthlycyc.txt         ' /
-
 ! ............................................. !
 !>\name  2.4 For module radiation_clouds
 ! ............................................. !
diff --git a/physics/radiation_gases.f b/physics/radiation_gases.f
index 01048c5eb..b5eb8ffb9 100644
--- a/physics/radiation_gases.f
+++ b/physics/radiation_gases.f
@@ -44,7 +44,6 @@
 !   external modules referenced:                                       !
 !       'module machine'                    in 'machine.f'             !
 !       'module funcphys'                   in 'funcphys.f'            !
-!       'module physcons'                   in 'physcons.f             !
 !       'module module_iounitdef'           in 'iounitdef.f'           !
 !                                                                      !
 !   unit used for radiative active gases:                              !
@@ -141,13 +140,8 @@
 !> This module sets up ozone climatological profiles and other constant gas
 !! profiles, such as co2, ch4, n2o, o2, and those of cfc gases.
       module module_radiation_gases      
-!
-      use physparam,         only : ico2flg, ictmflg, ioznflg, ivflip,  &
-     &                              co2dat_file, co2gbl_file,           &
-     &                              co2usr_file, co2cyc_file,           &
-     &                              kind_phys, kind_io4
+      use machine,           only : kind_phys, kind_io4
       use funcphys,          only : fpkapx
-      use physcons,          only : con_pi
       use ozne_def,          only : JMR => latsozc, LOZ => levozc,      &
      &                              blte => blatc, dlte=> dphiozc,      &
      &                              timeozc => timeozc
@@ -168,9 +162,9 @@ module module_radiation_gases
       integer, parameter         :: MINYEAR = 1957 ! earlist year 2D CO2 data available
 
       real (kind=kind_phys), parameter :: resco2=15.0            ! horizontal resolution in degree
-      real (kind=kind_phys), parameter :: raddeg=180.0/con_pi    ! rad->deg conversion
       real (kind=kind_phys), parameter :: prsco2=788.0           ! pressure limitation for 2D CO2 (mb)
-      real (kind=kind_phys), parameter :: hfpi  =0.5*con_pi      ! half of pi
+      real (kind=kind_phys)  :: raddeg                           ! rad->deg conversion
+      real (kind=kind_phys)  :: hfpi                             ! half of pi
 
       real (kind=kind_phys), parameter :: co2vmr_def = 350.0e-6  ! parameter constant for CO2 volume mixing ratio
       real (kind=kind_phys), parameter :: n2ovmr_def = 0.31e-6   ! parameter constant for N2O volume mixing ratio
@@ -230,45 +224,22 @@ module module_radiation_gases
 !!\param me         print message control flag
 !>\section gas_init_gen gas_init General Algorithm
 !-----------------------------------
-      subroutine gas_init                                               &
-     &     ( me , errflg, errmsg)
+      subroutine gas_init( me, co2usr_file, co2cyc_file, ico2flg,       &
+     &     ictmflg, ioznflg, con_pi, errflg, errmsg)
 
 !  ===================================================================  !
 !                                                                       !
 !  gas_init sets up ozone, co2, etc. parameters.  if climatology ozone  !
 !  then read in monthly ozone data.                                     !
 !                                                                       !
-!  inputs:                                               dimemsion      !
-!     me      - print message control flag                  1           !
+!  inputs:                                                              !
+!     me           - print message control flag                         !
+!     co2usr_file  - external co2 user defined data table               !
+!     co2cyc_file  - external co2 climotology monthly cycle data table  ! 
 !                                                                       !
 !  outputs: (CCPP error handling)                                       !
 !    (errflg, errmsg)                                                   !
 !                                                                       !
-!  external module variables:  (in physparam)                           !
-!     ico2flg    - co2 data source control flag                         !
-!                   =0: use prescribed co2 global mean value            !
-!                   =1: use input global mean co2 value (co2_glb)       !
-!                   =2: use input 2-d monthly co2 value (co2vmr_sav)    !
-!     ictmflg    - =yyyy#, data ic time/date control flag               !
-!                  =   -2: same as 0, but superimpose seasonal cycle    !
-!                          from climatology data set.                   !
-!                  =   -1: use user provided external data for the fcst !
-!                          time, no extrapolation.                      !
-!                  =    0: use data at initial cond time, if not existed!
-!                          then use latest, without extrapolation.      !
-!                  =    1: use data at the forecast time, if not existed!
-!                          then use latest and extrapolate to fcst time.!
-!                  =yyyy0: use yyyy data for the forecast time, no      !
-!                          further data extrapolation.                  !
-!                  =yyyy1: use yyyy data for the fcst. if needed, do    !
-!                          extrapolation to match the fcst time.        !
-!     ioznflg    - ozone data control flag                              !
-!                   =0: use climatological ozone profile                !
-!                   >0: use interactive ozone profile                   !
-!     ivflip     - vertical profile indexing flag                       !
-!     co2usr_file- external co2 user defined data table                 !
-!     co2cyc_file- external co2 climotology monthly cycle data table    !
-!                                                                       !
 !  internal module variables:                                           !
 !     pkstr, o3r - arrays for climatology ozone data                    !
 !                                                                       !
@@ -281,8 +252,9 @@ subroutine gas_init                                               &
       implicit none
 
 !  ---  inputs:
-      integer, intent(in) :: me
-
+      integer, intent(in) :: me, ictmflg, ioznflg, ico2flg
+      character(len=26),intent(in) :: co2usr_file,co2cyc_file
+      real(kind=kind_phys), intent(in) :: con_pi
 !  ---  output:
       character(len=*), intent(out) :: errmsg
       integer,          intent(out) :: errflg
@@ -306,6 +278,10 @@ subroutine gas_init                                               &
       errmsg = ''
       errflg = 0
 
+! Initiailize module parameters
+      raddeg = 180.0/con_pi
+      hfpi   = 0.5*con_pi
+
       if ( me == 0 ) print *, VTAGGAS    ! print out version tag
 
       kyrsav  = 0
@@ -541,8 +517,8 @@ end subroutine gas_init
 !!\param me         print message control flag
 !>\section gen_gas_update gas_update General Algorithm
 !-----------------------------------
-      subroutine gas_update                                             &
-     &     ( iyear, imon, iday, ihour, loz1st, ldoco2, me,              &
+      subroutine gas_update(iyear, imon, iday, ihour, loz1st, ldoco2,   &
+     &     me, co2dat_file, co2gbl_file, ictmflg, ico2flg, ioznflg,     &
      &     errflg, errmsg )
 
 !  ===================================================================  !
@@ -550,52 +526,6 @@ subroutine gas_update                                             &
 !  gas_update reads in 2-d monthly co2 data set for a specified year.   !
 !  data are in a 15 degree lat/lon horizontal resolution.               !
 !                                                                       !
-!  inputs:                                               dimemsion      !
-!     iyear   - year of the requested data for fcst         1           !
-!     imon    - month of the year                           1           !
-!     iday    - day of the month                            1           !
-!     ihour   - hour of the day                             1           !
-!     loz1st  - clim ozone 1st time update control flag     1           !
-!     ldoco2  - co2 update control flag                     1           !
-!     me      - print message control flag                  1           !
-!                                                                       !
-!  outputs: (to the module variables)                                   !
-!    errflg   - CCPP error flag                                         !
-!    errmsg   - CCPP error message                                      !
-!                                                                       !
-!  external module variables:  (in physparam)                           !
-!     ico2flg    - co2 data source control flag                         !
-!                   =0: use prescribed co2 global mean value            !
-!                   =1: use input global mean co2 value (co2_glb)       !
-!                   =2: use input 2-d monthly co2 value (co2vmr_sav)    !
-!     ictmflg    - =yyyy#, data ic time/date control flag               !
-!                  =   -2: same as 0, but superimpose seasonal cycle    !
-!                          from climatology data set.                   !
-!                  =   -1: use user provided external data for the fcst !
-!                          time, no extrapolation.                      !
-!                  =    0: use data at initial cond time, if not existed!
-!                          then use latest, without extrapolation.      !
-!                  =    1: use data at the forecast time, if not existed!
-!                          then use latest and extrapolate to fcst time.!
-!                  =yyyy0: use yyyy data for the forecast time, no      !
-!                          further data extrapolation.                  !
-!                  =yyyy1: use yyyy data for the fcst. if needed, do    !
-!                          extrapolation to match the fcst time.        !
-!     ioznflg    - ozone data control flag                              !
-!                   =0: use climatological ozone profile                !
-!                   >0: use interactive ozone profile                   !
-!     ivflip     - vertical profile indexing flag                       !
-!     co2dat_file- external co2 2d monthly obsv data table              !
-!     co2gbl_file- external co2 global annual mean data table           !
-!                                                                       !
-!  internal module variables:                                           !
-!     co2vmr_sav - monthly co2 volume mixing ratio     IMXCO2*JMXCO2*12 !
-!     co2cyc_sav - monthly cycle co2 vol mixing ratio  IMXCO2*JMXCO2*12 !
-!     co2_glb    - global annual mean co2 mixing ratio                  !
-!     gco2cyc    - global monthly mean co2 variation       12           !
-!     k1oz,k2oz,facoz                                                   !
-!                - climatology ozone parameters             1           !
-!                                                                       !
 !  usage:    call gas_update                                            !
 !                                                                       !
 !  subprograms called:  none                                            !
@@ -605,8 +535,9 @@ subroutine gas_update                                             &
       implicit none
 
 !  ---  inputs:
-      integer, intent(in) :: iyear, imon, iday, ihour, me
-
+      integer, intent(in) :: iyear,imon,iday,ihour,me,ictmflg,ico2flg
+      integer, intent(in) :: ioznflg
+      character(len=26),intent(in) :: co2dat_file, co2gbl_file
       logical, intent(in) :: loz1st, ldoco2
 
 !  ---  output:
@@ -760,6 +691,7 @@ subroutine gas_update                                             &
 
 !  --- ...  set up input data file name
 
+         print*,"co2dat_file: ",co2dat_file
         cfile1 = co2dat_file
         write(cfile1(19:22),34) idyr
   34    format(i4.4)
@@ -948,11 +880,8 @@ end subroutine gas_update
 !!\n                    (:,:,10)          - cfc113
 !>\section gen_getgases getgases General Algorithm
 !-----------------------------------
-      subroutine getgases                                               &
-     &     ( plvl, xlon, xlat,                                          & ! ---  inputs
-     &       IMAX, LMAX,                                                &
-     &       gasdat                                                     & ! ---  outputs
-     &      )
+      subroutine getgases( plvl, xlon, xlat, IMAX, LMAX, ico2flg,       &
+     &     top_at_1, con_pi, gasdat)
 !  ===================================================================  !
 !                                                                       !
 !  getgases set up global distribution of radiation absorbing  gases    !
@@ -960,45 +889,6 @@ subroutine getgases                                               &
 !  observed values, all other gases are asigned to the climatological   !
 !  values.                                                              !
 !                                                                       !
-!  inputs:                                                              !
-!     plvl(IMAX,LMAX+1)- pressure at model layer interfaces (mb)        !
-!     xlon(IMAX)       - grid longitude in radians, ok both 0->2pi or   !
-!                        -pi -> +pi arrangements                        !
-!     xlat(IMAX)       - grid latitude in radians, default range to     !
-!                        pi/2 -> -pi/2, otherwise see in-line comment   !
-!     IMAX, LMAX       - horiz, vert dimensions for output data         !
-!                                                                       !
-!  outputs:                                                             !
-!     gasdat(IMAX,LMAX,NF_VGAS) - gases volume mixing ratioes           !
-!               (:,:,1)           - co2                                 !
-!               (:,:,2)           - n2o                                 !
-!               (:,:,3)           - ch4                                 !
-!               (:,:,4)           - o2                                  !
-!               (:,:,5)           - co                                  !
-!               (:,:,6)           - cfc11                               !
-!               (:,:,7)           - cfc12                               !
-!               (:,:,8)           - cfc22                               !
-!               (:,:,9)           - ccl4                                !
-!               (:,:,10)          - cfc113                              !
-!                                                                       !
-!> - External module variables:  (in physparam)
-!!\n     ico2flg    - co2 data source control flag
-!!\n                   =0: use prescribed co2 global mean value
-!!\n                   =1: use input global mean co2 value (co2_glb)
-!!\n                   =2: use input 2-d monthly co2 value (co2vmr_sav)
-!!\n     ivflip     - vertical profile indexing flag
-!!
-!> - Internal module variables :
-!!\n     co2vmr_sav - saved monthly co2 concentration from sub gas_update
-!!\n     co2_glb    - saved global annual mean co2 value from  gas_update
-!!\n     gco2cyc    - saved global seasonal variation of co2 climatology
-!!                  in 12-month form
-!note: for lower atmos co2vmr_sav may have clim monthly deviations !
-!           superimposed on init-cond co2 value, while co2_glb only     !
-!           contains the global mean value, thus needs to add the       !
-!           monthly dglobal mean deviation gco2cyc at upper atmos. for  !
-!           ictmflg/=-2, this value will be zero.                       !
-!                                                                       !
 !  usage:    call getgases                                              !
 !                                                                       !
 !  subprograms called:  none                                            !
@@ -1008,8 +898,10 @@ subroutine getgases                                               &
       implicit none
 
 !  ---  input:
-      integer,  intent(in)  :: IMAX, LMAX
+      integer,  intent(in)  :: IMAX, LMAX, ico2flg
       real (kind=kind_phys), intent(in) :: plvl(:,:), xlon(:), xlat(:)
+      logical, intent(in) :: top_at_1
+      real(kind=kind_phys), intent(in) :: con_pi
 
 !  ---  output:
       real (kind=kind_phys), intent(out) :: gasdat(:,:,:)
@@ -1063,7 +955,7 @@ subroutine getgases                                               &
           ilon = min( IMXCO2, int( xlon1*tmp + 1 ))
           ilat = min( JMXCO2, int( xlat1*tmp + 1 ))
 
-          if ( ivflip == 0 ) then         ! index from toa to sfc
+          if (top_at_1) then         ! index from toa to sfc
             do k = 1, LMAX
               if ( plvl(i,k) >= prsco2 ) then
                 gasdat(i,k,1) = co2vmr_sav(ilon,ilat,kmonsav)
@@ -1099,11 +991,7 @@ end subroutine getgases
 !!                   ratio (g/g)
 !>\section getozn_gen getozn General Algorithm
 !-----------------------------------
-      subroutine getozn                                                 &
-     &     ( prslk,xlat,                                                &                    !  ---  inputs
-     &       IMAX, LM,                                                  &
-     &       o3mmr                                                      &                    !  ---  outputs
-     &     )
+      subroutine getozn( prslk,xlat, IMAX, LM, top_at_1, o3mmr)
 
 !  ===================================================================  !
 !                                                                       !
@@ -1111,20 +999,6 @@ subroutine getozn                                                 &
 !                                                                       !
 !  this code is originally written By Shrinivas Moorthi                 !
 !                                                                       !
-!  inputs:                                                              !
-!     prslk (IMAX,LM)  - exner function = (p/p0)**rocp                  !
-!     xlat  (IMAX)     - latitude in radians, default to pi/2 -> -pi/2  !
-!                        range, otherwise see in-line comment           !
-!     IMAX, LM         - horizontal and vertical dimensions             !
-!                                                                       !
-!  outputs:                                                             !
-!     o3mmr (IMAX,LM)  - output ozone profile in mass mixing ratio (g/g)!
-!                                                                       !
-!  module variables:                                                    !
-!     k1oz, k2oz       - ozone data interpolation indices               !
-!     facoz            - ozone data interpolation factor                !
-!     ivflip           - control flag for direction of vertical index   !
-!                                                                       !
 !  usage:    call getozn                                                !
 !                                                                       !
 !  ===================================================================  !
@@ -1133,7 +1007,7 @@ subroutine getozn                                                 &
 
 !  ---  inputs:
       integer,  intent(in) :: IMAX, LM
-
+      logical,  intent(in) :: top_at_1
       real (kind=kind_phys), intent(in) :: prslk(:,:), xlat(:)
 
 !  ---  outputs:
@@ -1177,7 +1051,7 @@ subroutine getozn                                                 &
 
       do l = 1, LM
         ll = l
-        if (ivflip == 1) ll = LM -l + 1
+        if (.not. top_at_1) ll = LM -l + 1
 
         do i = 1, IMAX
           wk1(i) = prslk(i,ll)

From c0d2d20b4f5c50a9766dc4d4fb5e95c805b7b716 Mon Sep 17 00:00:00 2001
From: Dustin Swales <dustin.swales@noaa.gov>
Date: Thu, 18 Aug 2022 11:51:14 -0600
Subject: [PATCH 013/115] Remove dependency on physparam in
 radlw_main/radsw_main.F90. Provided as ccpp interstitials.

---
 physics/GFS_radiation_surface.meta  |   2 +-
 physics/GFS_rrtmg_setup.F90         |  74 ++++-----
 physics/GFS_rrtmg_setup.meta        |  39 ++++-
 physics/radiation_cloud_overlap.F90 |   2 +-
 physics/radiation_clouds.f          |  42 ++---
 physics/radlw_datatb.f              |  38 ++---
 physics/radlw_main.F90              | 169 ++++++++------------
 physics/radlw_main.meta             |  42 +++++
 physics/radlw_param.f               |   2 +-
 physics/radsw_datatb.f              |  34 ++--
 physics/radsw_main.F90              | 234 +++++++++++-----------------
 physics/radsw_main.meta             |  51 +++++-
 physics/radsw_param.f               |   2 +-
 13 files changed, 363 insertions(+), 368 deletions(-)

diff --git a/physics/GFS_radiation_surface.meta b/physics/GFS_radiation_surface.meta
index 8ad848446..56303f995 100644
--- a/physics/GFS_radiation_surface.meta
+++ b/physics/GFS_radiation_surface.meta
@@ -1,7 +1,7 @@
 [ccpp-table-properties]
   name = GFS_radiation_surface
   type = scheme
-  dependencies = iounitdef.f,machine.F,physparam.f,radiation_surface.f,set_soilveg_ruc.F90,namelist_soilveg_ruc.F90
+  dependencies = iounitdef.f,machine.F,radiation_surface.f,set_soilveg_ruc.F90,namelist_soilveg_ruc.F90
 
 ########################################################################
 [ccpp-arg-table]
diff --git a/physics/GFS_rrtmg_setup.F90 b/physics/GFS_rrtmg_setup.F90
index f83f53f01..6891b0f24 100644
--- a/physics/GFS_rrtmg_setup.F90
+++ b/physics/GFS_rrtmg_setup.F90
@@ -6,10 +6,9 @@
 !> @{
 module GFS_rrtmg_setup
 
-   use physparam, only : icldflg, &
-   &             iovrRad=>iovr, lcrick , lcnorm , lnoprec,            &
-   &             isubcsw, isubclw, ivflip , ipsd0,                    &
-   &             iswcliq
+   use physparam, only : lcrick , lcnorm , lnoprec,            &
+   &             ivflip , ipsd0,                    &
+   &             iswcliq,iovrRad=>iovr
    use machine, only:  kind_phys
    use radcons, only: ltp, lextop
 
@@ -44,14 +43,15 @@ module GFS_rrtmg_setup
 !!
    subroutine GFS_rrtmg_setup_init (                          &
           si, levr, ictm, isol, solar_file, ico2, iaer, ntcw, &
-          num_p3d, npdf3d, ntoz, iovr, isubc_sw, isubc_lw,    &
+          num_p3d, npdf3d, ntoz, iovr,                        &
           icliq_sw, crick_proof, ccnorm,                      &
           imp_physics,                                        &
           norad_precip, idate, iflip,                         &
           do_RRTMGP, me, lalw1bd, iaermdl, iaerflg,           &
           aeros_file, con_pi, con_t0c, con_c, con_boltz,      &
           con_plnk, con_solr_2008, con_solr_2002, co2usr_file,&
-          co2cyc_file, errmsg, errflg)
+          co2cyc_file, rad_hr_units, inc_minor_gas, ilwcliq,  &
+          iswcliq, isubcsw, isubclw, iswmode, errmsg, errflg)
 ! =================   subprogram documentation block   ================ !
 !                                                                       !
 ! subprogram:   GFS_rrtmg_setup_init - a subprogram to initialize radiation !
@@ -128,8 +128,8 @@ subroutine GFS_rrtmg_setup_init (                          &
 !                     =1: max/ran overlapping clouds                    !
 !                     =2: maximum overlap clouds       (mcica only)     !
 !                     =3: decorrelation-length overlap (mcica only)     !
-!                     =4: exponential overlap clouds
-!   isubc_sw/isubc_lw: sub-column cloud approx control flag (sw/lw rad) !
+!                     =4: exponential overlap clouds                    !
+!   isubcsw/isubclw: sub-column cloud approx control flag (sw/lw rad)   !
 !                     =0: with out sub-column cloud approximation       !
 !                     =1: mcica sub-col approx. prescribed random seed  !
 !                     =2: mcica sub-col approx. provided random seed    !
@@ -161,8 +161,6 @@ subroutine GFS_rrtmg_setup_init (                          &
       integer, intent(in) :: npdf3d
       integer, intent(in) :: ntoz
       integer, intent(in) :: iovr
-      integer, intent(in) :: isubc_sw
-      integer, intent(in) :: isubc_lw
       integer, intent(in) :: icliq_sw
       logical, intent(in) :: crick_proof
       logical, intent(in) :: ccnorm
@@ -170,10 +168,13 @@ subroutine GFS_rrtmg_setup_init (                          &
       logical, intent(in) :: norad_precip
       integer, intent(in) :: idate(:)
       integer, intent(in) :: iflip
-      logical, intent(in) :: do_RRTMGP, lalw1bd
-      integer, intent(in) :: me
-      character(len=26),intent(in)  :: aeros_file, solar_file, co2usr_file, co2cyc_file
-      real(kind_phys),  intent(in)  :: con_pi,con_t0c,con_c,con_boltz,con_plnk,con_solr_2008,con_solr_2002
+      logical, intent(in) :: do_RRTMGP, lalw1bd, inc_minor_gas
+      integer, intent(in) :: me, rad_hr_units, ilwcliq, iswcliq, isubcsw,  &
+           isubclw, iswmode
+      character(len=26),intent(in)  :: aeros_file, solar_file, co2usr_file,&
+           co2cyc_file
+      real(kind_phys),  intent(in)  :: con_pi, con_t0c, con_c, con_boltz,  &
+           con_plnk, con_solr_2008, con_solr_2002
       character(len=*), intent(out) :: errmsg
       integer,          intent(out) :: errflg
       integer,          intent(out) :: iaermdl, iaerflg
@@ -203,28 +204,14 @@ subroutine GFS_rrtmg_setup_init (                          &
          return
       endif
 
-!     if ( ntcw > 0 ) then
-        icldflg = 1                     ! prognostic cloud optical prop scheme
-!     else
-!       icldflg = 0                     ! no support for diag cloud opt prop scheme
-!     endif
-
-      iswcliq = icliq_sw                ! optical property for liquid clouds for sw
-
-      ! iovr comes from the model. In the RRTMG implementation this is stored in phyrparam.f,
-      ! it comes in from the host-model and is set here. 
-      ! In GP, iovr is passed directly into the routines.
       iovrRAD = iovr
       lcrick  = crick_proof             ! control flag for eliminating CRICK 
       lcnorm  = ccnorm                  ! control flag for in-cld condensate 
       lnoprec = norad_precip            ! precip effect on radiation flag (ferrier microphysics)
-      isubcsw = isubc_sw                ! sub-column cloud approx flag in sw radiation
-      isubclw = isubc_lw                ! sub-column cloud approx flag in lw radiation
-
       ivflip = iflip                    ! vertical index direction control flag
 
 !  ---  assign initial permutation seed for mcica cloud-radiation
-      if ( isubc_sw>0 .or. isubc_lw>0 ) then
+      if ( isubcsw>0 .or. isubclw>0 ) then
 !       ipsd0 = 17*idate(1)+43*idate(2)+37*idate(3)+23*idate(4) + ipsd0
         ipsd0 = 17*idate(1)+43*idate(2)+37*idate(3)+23*idate(4)
       endif
@@ -235,8 +222,8 @@ subroutine GFS_rrtmg_setup_init (                          &
         print *,' levr=',levr,' ictm=',ictm,' isol=',isol,' ico2=',ico2,&
      &          ' iaermdl=',iaermdl,' iaerflg=',iaerflg
         print *,' np3d=',num_p3d,' ntoz=',ntoz,                         &
-     &          ' iovr=',iovr,' isubc_sw=',isubc_sw,                    &
-     &          ' isubc_lw=',isubc_lw,' icliq_sw=',icliq_sw,            &
+     &          ' iovr=',iovr,' isubcsw=',isubcsw,                      &
+     &          ' isubclw=',isubclw,' icliq_sw=',icliq_sw,              &
      &          ' iflip=',iflip,'  me=',me
         print *,' crick_proof=',crick_proof,                            &
      &          ' ccnorm=',ccnorm,' norad_precip=',norad_precip
@@ -246,7 +233,9 @@ subroutine GFS_rrtmg_setup_init (                          &
      &     ( si, levr, imp_physics, me, iaermdl, iaerflg, lalw1bd,      &
      &       aeros_file, con_pi, con_t0c, con_c, con_boltz, con_plnk,   &
      &       isol, solar_file, con_solr_2008, con_solr_2002,            &
-     &       co2usr_file, co2cyc_file, ico2, ictm, ntoz, errmsg, errflg )
+     &       co2usr_file, co2cyc_file, ico2, ictm, ntoz, rad_hr_units,  &
+     &       inc_minor_gas, ilwcliq, iswcliq, isubcsw, isubclw, iovr,   &
+     &       iswmode, errmsg, errflg )
 
 
       if ( me == 0 ) then
@@ -332,7 +321,8 @@ end subroutine GFS_rrtmg_setup_finalize
    subroutine radinit( si, NLAY, imp_physics, me, iaermdl, iaerflg, lalw1bd, &
         aeros_file, con_pi, con_t0c, con_c, con_boltz, con_plnk, isol,       &
         solar_file, con_solr_2008, con_solr_2002, co2usr_file, co2cyc_file,  &
-        ico2, ictm, ntoz, errmsg, errflg)
+        ico2, ictm, rad_hr_units, ntoz, inc_minor_gas, ilwcliq, iswcliq,     &
+        isubcsw, isubclw, iovr, iswmode, errmsg, errflg)
 !...................................
 
 !  ---  inputs:
@@ -396,9 +386,6 @@ subroutine radinit( si, NLAY, imp_physics, me, iaermdl, iaerflg, lalw1bd, &
 !   ioznflg  : ozone data source control flag                           !
 !              =0: use climatological ozone profile                     !
 !              =1: use interactive ozone profile                        !
-!   icldflg  : cloud optical property scheme control flag               !
-!              =0: use diagnostic cloud scheme                          !
-!              =1: use prognostic cloud scheme (default)                !
 !   imp_physics  : cloud microphysics scheme control flag               !
 !              =99 zhao/carr/sundqvist microphysics scheme              !
 !              =98 zhao/carr/sundqvist microphysics+pdf cloud&cnvc,cnvw !
@@ -445,8 +432,10 @@ subroutine radinit( si, NLAY, imp_physics, me, iaermdl, iaerflg, lalw1bd, &
       implicit none
 
 !  ---  inputs:
-      integer, intent(in) :: NLAY, me, imp_physics, iaermdl, iaerflg, isol, ico2, ictm, ntoz
-      logical, intent(in) :: lalw1bd
+      integer, intent(in) :: NLAY, me, imp_physics, iaermdl, iaerflg,    &
+           isol, ico2, ictm, ntoz, rad_hr_units, ilwcliq, iswcliq, isubcsw,&
+           isubclw, iovr, iswmode
+      logical, intent(in) :: lalw1bd, inc_minor_gas
       real (kind=kind_phys), intent(in) :: si(:), con_pi,con_t0c, con_c, &
            con_boltz, con_plnk, con_solr_2008, con_solr_2002
       character(len=26), intent(in) :: aeros_file, solar_file,co2usr_file, co2cyc_file
@@ -472,10 +461,9 @@ subroutine radinit( si, NLAY, imp_physics, me, iaermdl, iaerflg, lalw1bd, &
      &          '  May 01 2007'
         print *, VTAGRAD                !print out version tag
         print *,' - Selected Control Flag settings: ICTMflg=',ictm,     &
-     &    ' ISOLar =',isol, ' ICO2flg=',ico2,' IAERflg=',iaerflg,  &
-     &    ' ICLDflg=',icldflg,                                          &
+     &    ' ISOLar =',isol, ' ICO2flg=',ico2,' IAERflg=',iaerflg,       &
      &    ' IMP_PHYSICS=',imp_physics,' IOZNflg=',ntoz
-        print *,' IVFLIP=',ivflip,' IOVR=',iovrRad,                     &
+        print *,' IVFLIP=',ivflip,' IOVR=',iovr,                        &
      &    ' ISUBCSW=',isubcsw,' ISUBCLW=',isubclw
         print *,' LCRICK=',lcrick,' LCNORM=',lcnorm,' LNOPREC=',lnoprec
         print *,' LTP =',ltp,', add extra top layer =',lextop
@@ -547,8 +535,8 @@ subroutine radinit( si, NLAY, imp_physics, me, iaermdl, iaerflg, lalw1bd, &
       call gas_init ( me, co2usr_file, co2cyc_file, ico2, ictm, ntoz, con_pi, &
            errflg, errmsg)                                        ! co2 and other gases initialization routine
       call cld_init ( si, NLAY, imp_physics, me, errflg, errmsg)  ! cloud initialization routine
-      call rlwinit ( me, errflg, errmsg )                         ! lw RRTMG initialization routine
-      call rswinit ( me, errflg, errmsg )                         ! sw RRTMG initialization routine
+      call rlwinit ( me, rad_hr_units, inc_minor_gas, ilwcliq, isubcsw, iovr, errflg, errmsg )           ! lw RRTMG initialization routine
+      call rswinit ( me, rad_hr_units, inc_minor_gas, iswcliq, isubclw, iovr, iswmode, errflg, errmsg )  ! sw RRTMG initialization routine
 !
       return
 !
diff --git a/physics/GFS_rrtmg_setup.meta b/physics/GFS_rrtmg_setup.meta
index e65795887..2355b91c2 100644
--- a/physics/GFS_rrtmg_setup.meta
+++ b/physics/GFS_rrtmg_setup.meta
@@ -110,20 +110,27 @@
   dimensions = ()
   type = integer
   intent = in
-[isubc_sw]
+[isubcsw]
   standard_name = flag_for_sw_clouds_grid_approximation
   long_name = flag for sw clouds sub-grid approximation
   units = flag
   dimensions = ()
   type = integer
   intent = in
-[isubc_lw]
+[isubclw]
   standard_name = flag_for_lw_clouds_sub_grid_approximation
   long_name = flag for lw clouds sub-grid approximation
   units = flag
   dimensions = ()
   type = integer
   intent = in
+[iswmode]
+  standard_name = flag_for_sw_scattering_choice
+  long_name = flag for rrtmg shortwave scattering choice
+  units = flag
+  dimensions = ()
+  type = integer
+  intent = in
 [icliq_sw]
   standard_name = control_for_shortwave_radiation_liquid_clouds
   long_name = sw optical property for liquid clouds
@@ -211,6 +218,34 @@
   type = character
   kind = len=26
   intent = in
+[rad_hr_units]
+  standard_name = flag_for_radiation_heating_rate_units
+  long_name = flag to control heating rate units
+  units = count
+  dimensions =  ()
+  type = integer
+  intent = in
+[inc_minor_gas]
+  standard_name = flag_to_include_minor_gases_in_rrtmg
+  long_name = flag to include minor trace gases	in rrtmg
+  units = flag
+  dimensions = ()
+  type = logical
+  intent = in
+[ilwcliq]
+  standard_name = flag_for_rrtmg_lw_cloud_optics
+  long_name = flag for rrtmg longwave cloud optics
+  units = flag
+  dimensions =  ()
+  type = integer
+  intent = in
+[iswcliq]
+  standard_name = flag_for_rrtmg_sw_cloud_optics
+  long_name = flag for rrtmg shortwave cloud optics
+  units = flag
+  dimensions =  ()
+  type = integer
+  intent = in
 [con_pi]
   standard_name = pi
   long_name = ratio of a circle's circumference to its diameter
diff --git a/physics/radiation_cloud_overlap.F90 b/physics/radiation_cloud_overlap.F90
index d6169b3e5..737b9be61 100644
--- a/physics/radiation_cloud_overlap.F90
+++ b/physics/radiation_cloud_overlap.F90
@@ -4,7 +4,7 @@
 !>\defgroup rad_cld_ovr_mod Radiation Cloud Overlap Module
 !! This module contains the calculation of cloud overlap parameters for both RRTMG and RRTMGP. 
 module module_radiation_cloud_overlap
-  use physparam,        only : kind_phys
+  use machine, only : kind_phys
   implicit none
   public :: cmp_dcorr_lgth
   
diff --git a/physics/radiation_clouds.f b/physics/radiation_clouds.f
index 4b75cb4c0..ee7922c99 100644
--- a/physics/radiation_clouds.f
+++ b/physics/radiation_clouds.f
@@ -173,7 +173,7 @@
 !> This module computes cloud related quantities for radiation computations.
       module module_radiation_clouds
 !
-      use physparam,           only : icldflg, iovr, idcor,             &
+      use physparam,           only : iovr, idcor,                      &
      &                                lcrick, lcnorm, lnoprec,          &
      &                                ivflip
       use physcons,            only : con_fvirt, con_ttp, con_rocp,     &
@@ -287,9 +287,6 @@ subroutine cld_init                                               &
 !   errmsg          : CCPP error message                                !
 !                                                                       !
 !  external module variables: (in physparam)                            !
-!   icldflg         : cloud optical property scheme control flag        !
-!                     =0: abort! diagnostic cloud method discontinued   !
-!                     =1: model use prognostic cloud method             !
 !   imp_physics         : cloud microphysics scheme control flag        !
 !                     =99: zhao/carr/sundqvist microphysics cloud       !
 !                     =98: zhao/carr/sundqvist microphysics cloud+pdfcld!
@@ -334,44 +331,33 @@ subroutine cld_init                                               &
       errmsg = ''
       errflg = 0
 
-!  ---  set up module variables
-
-      if (me == 0) print *, VTAGCLD      !print out version tag
-
-      if ( icldflg == 0 ) then
-        print *,' - Diagnostic Cloud Method has been discontinued'
-        errflg = 1
-        errmsg = 'ERROR(cld_init): Diagnostic Cloud Method has been '// &
-     &       'discontinued'
-        return
-      else
-        if (me == 0) then
-          print *,' - Using Prognostic Cloud Method'
-          if (imp_physics == 99) then
+      if (me == 0) then
+         print *, VTAGCLD       !print out version tag
+         print *,' - Using Prognostic Cloud Method'
+         if (imp_physics == 99) then
             print *,'   --- Zhao/Carr/Sundqvist microphysics'
-          elseif (imp_physics == 98) then
+         elseif (imp_physics == 98) then
             print *,'   --- zhao/carr/sundqvist + pdf cloud'
-          elseif (imp_physics == 11) then
+         elseif (imp_physics == 11) then
             print *,'   --- GFDL Lin cloud microphysics'
-          elseif (imp_physics == 8) then
+         elseif (imp_physics == 8) then
             print *,'   --- Thompson cloud microphysics'
-          elseif (imp_physics == 6) then
+         elseif (imp_physics == 6) then
             print *,'   --- WSM6 cloud microphysics'
-          elseif (imp_physics == 10) then
+         elseif (imp_physics == 10) then
             print *,'   --- MG cloud microphysics'
-          elseif (imp_physics == 15) then
+         elseif (imp_physics == 15) then
             print *,'   --- Ferrier-Aligo cloud microphysics'
-          elseif (imp_physics == 17) then
+         elseif (imp_physics == 17) then
             print *,'   --- NSSL cloud microphysics'
-          else
+         else
             print *,'  !!! ERROR in cloud microphysc specification!!!', &
      &              '  imp_physics (NP3D) =',imp_physics
             errflg = 1
             errmsg = 'ERROR(cld_init): cloud mp specification is not'// &
      &       ' valid'
             return
-          endif
-        endif
+         endif
       endif
 
 !> - Compute the top of BL cld (llyr), which is the topmost non
diff --git a/physics/radlw_datatb.f b/physics/radlw_datatb.f
index f297c8e4c..da0f5eaa3 100644
--- a/physics/radlw_datatb.f
+++ b/physics/radlw_datatb.f
@@ -66,7 +66,7 @@
       module module_radlw_avplank        !
 !........................................!
 !
-      use physparam,               only : kind_phys
+      use machine,                 only : kind_phys
       use module_radlw_parameters, only : NPLNK, NBANDS
 !
       implicit none
@@ -747,7 +747,7 @@ end module module_radlw_avplank    !
       module module_radlw_ref            !
 !........................................!
 !
-      use physparam,               only : kind_phys
+      use machine,               only : kind_phys
 !
       implicit none
 !
@@ -924,7 +924,7 @@ end module module_radlw_ref        !
       module module_radlw_cldprlw        !
 !........................................!
 !
-      use physparam,               only : kind_phys
+      use machine,                 only : kind_phys
       use module_radlw_parameters, only : NBANDS
 !
       implicit none
@@ -1607,7 +1607,7 @@ end module module_radlw_cldprlw    !
       module module_radlw_kgb01          !
 !........................................!
 !
-      use physparam,               only : kind_phys
+      use machine,                 only : kind_phys
       use module_radlw_parameters, only : NG01
 !
       implicit none
@@ -2421,7 +2421,7 @@ end module module_radlw_kgb01      !
       module module_radlw_kgb02          !
 !........................................!
 !
-      use physparam,               only : kind_phys
+      use machine,                 only : kind_phys
       use module_radlw_parameters, only : NG02
 !
       implicit none
@@ -3278,7 +3278,7 @@ end module module_radlw_kgb02      !
       module module_radlw_kgb03          !
 !........................................!
 !
-      use physparam,               only : kind_phys
+      use machine,                 only : kind_phys
       use module_radlw_parameters, only : NG03
 !
       implicit none
@@ -10152,7 +10152,7 @@ end module module_radlw_kgb03      !
       module module_radlw_kgb04          !
 !........................................!
 !
-      use physparam,               only : kind_phys
+      use machine,                 only : kind_phys
       use module_radlw_parameters, only : NG04
 !
       implicit none
@@ -15352,7 +15352,7 @@ end module module_radlw_kgb04      !
       module module_radlw_kgb05          !
 !........................................!
 !
-      use physparam,               only : kind_phys
+      use machine,                 only : kind_phys
       use module_radlw_parameters, only : NG05
 !
       implicit none
@@ -21849,7 +21849,7 @@ end module module_radlw_kgb05      !
       module module_radlw_kgb06          !
 !........................................!
 !
-      use physparam,               only : kind_phys
+      use machine,                 only : kind_phys
       use module_radlw_parameters, only : NG06
 !
       implicit none
@@ -22109,7 +22109,7 @@ end module module_radlw_kgb06      !
       module module_radlw_kgb07          !
 !........................................!
 !
-      use physparam,               only : kind_phys
+      use machine,                 only : kind_phys
       use module_radlw_parameters, only : NG07
 !
       implicit none
@@ -24756,7 +24756,7 @@ end module module_radlw_kgb07      !
       module module_radlw_kgb08          !
 !........................................!
 !
-      use physparam,               only : kind_phys
+      use machine,                 only : kind_phys
       use module_radlw_parameters, only : NG08
 !
       implicit none
@@ -25553,7 +25553,7 @@ end module module_radlw_kgb08      !
       module module_radlw_kgb09          !
 !........................................!
 !
-      use physparam,               only : kind_phys
+      use machine,                 only : kind_phys
       use module_radlw_parameters, only : NG09
 !
       implicit none
@@ -28231,7 +28231,7 @@ end module module_radlw_kgb09      !
       module module_radlw_kgb10          !
 !........................................!
 !
-      use physparam,               only : kind_phys
+      use machine,                 only : kind_phys
       use module_radlw_parameters, only : NG10
 !
       implicit none
@@ -28705,7 +28705,7 @@ end module module_radlw_kgb10      !
       module module_radlw_kgb11          !
 !........................................!
 !
-      use physparam,               only : kind_phys
+      use machine,                 only : kind_phys
       use module_radlw_parameters, only : NG11
 !
       implicit none
@@ -29404,7 +29404,7 @@ end module module_radlw_kgb11      !
       module module_radlw_kgb12          !
 !........................................!
 !
-      use physparam,               only : kind_phys
+      use machine,                 only : kind_phys
       use module_radlw_parameters, only : NG12
 !
       implicit none
@@ -30475,7 +30475,7 @@ end module module_radlw_kgb12      !
       module module_radlw_kgb13          !
 !........................................!
 !
-      use physparam,               only : kind_phys
+      use machine,                 only : kind_phys
       use module_radlw_parameters, only : NG13
 !
       implicit none
@@ -31381,7 +31381,7 @@ end module module_radlw_kgb13      !
       module module_radlw_kgb14          !
 !........................................!
 !
-      use physparam,               only : kind_phys
+      use machine,                 only : kind_phys
       use module_radlw_parameters, only : NG14
 !
       implicit none
@@ -31605,7 +31605,7 @@ end module module_radlw_kgb14      !
       module module_radlw_kgb15          !
 !........................................!
 !
-      use physparam,               only : kind_phys
+      use machine,                 only : kind_phys
       use module_radlw_parameters, only : NG15
 !
       implicit none
@@ -32010,7 +32010,7 @@ end module module_radlw_kgb15      !
       module module_radlw_kgb16          !
 !........................................!
 !
-      use physparam,               only : kind_phys
+      use machine,                 only : kind_phys
       use module_radlw_parameters, only : NG16
 !
       implicit none
diff --git a/physics/radlw_main.F90 b/physics/radlw_main.F90
index 8612e33db..341ca47ed 100644
--- a/physics/radlw_main.F90
+++ b/physics/radlw_main.F90
@@ -79,7 +79,6 @@
 !                                                                          !
 !    external modules referenced:                                          !
 !                                                                          !
-!       'module physparam'                                                 !
 !       'module physcons'                                                  !
 !       'mersenne_twister'                                                 !
 !                                                                          !
@@ -278,8 +277,6 @@
 !! rrtmg-lw radiation code from aer inc.
       module rrtmg_lw 
 !
-      use physparam,        only : ilwrate, ilwrgas, ilwcliq, ilwcice,  &
-     &                             isubclw, icldflg, iovr,  ivflip
       use physcons,         only : con_g, con_cp, con_avgd, con_amd,    &
      &                             con_amw, con_amo3
       use mersenne_twister, only : random_setseed, random_number,       &
@@ -425,7 +422,8 @@ subroutine rrtmg_lw_run                                           &
      &       gasvmr_cfc12, gasvmr_cfc22, gasvmr_ccl4,                   &
      &       icseed,aeraod,aerssa,sfemis,sfgtmp,                        &
      &       dzlyr,delpin,de_lgth,alpha,                                &
-     &       npts, nlay, nlp1, lprnt, cld_cf, lslwr,                    &
+     &       npts, nlay, nlp1, lprnt, cld_cf, lslwr, top_at_1, iovr,    &
+     &       inc_minor_gas, ilwcliq, ilwcice, isubclw,                  &
      &       hlwc,topflx,sfcflx,cldtau,                                 &   !  ---  outputs
      &       HLW0,HLWB,FLXPRF,                                          &   !  ---  optional
      &       cld_lwp, cld_ref_liq, cld_iwp, cld_ref_ice,                &
@@ -483,6 +481,27 @@ subroutine rrtmg_lw_run                                           &
 !     npts           : total number of horizontal points                !
 !     nlay, nlp1     : total number of vertical layers, levels          !
 !     lprnt          : cntl flag for diagnostic print out               !
+!   inc_minor_gas - control flag for rare gases (ch4,n2o,o2,cfcs, etc.) !
+!           =0: do not include rare gases                               !
+!           >0: include all rare gases                                  !
+!   ilwcliq - control flag for liq-cloud optical properties             !
+!           =1: input cld liqp & reliq, hu & stamnes (1993)             !
+!           =2: not used                                                !
+!   ilwcice - control flag for ice-cloud optical properties             !
+!           =1: input cld icep & reice, ebert & curry (1997)            !
+!           =2: input cld icep & reice, streamer (1996)                 !
+!           =3: input cld icep & reice, fu (1998)                       !
+!   isubclw - sub-column cloud approximation control flag               !
+!           =0: no sub-col cld treatment, use grid-mean cld quantities  !
+!           =1: mcica sub-col, prescribed seeds to get random numbers   !
+!           =2: mcica sub-col, providing array icseed for random numbers!
+!   iovr  - cloud overlapping control flag                              !
+!           =0: random overlapping clouds                               !
+!           =1: maximum/random overlapping clouds                       !
+!           =2: maximum overlap cloud (used for isubclw>0 only)         !
+!           =3: decorrelation-length overlap (for isubclw>0 only)       !
+!           =4: exponential cloud overlap (AER)                         !
+!           =5: exponential-random cloud overlap (AER)                  !  
 !                                                                       !
 !  output variables:                                                    !
 !     hlwc  (npts,nlay): total sky heating rate (k/day or k/sec)        !
@@ -508,32 +527,6 @@ subroutine rrtmg_lw_run                                           &
 !        upfx0           - clear sky upward flux                        !
 !        dnfx0           - clear sky dnward flux                        !
 !                                                                       !
-!  external module variables:  (in physparam)                           !
-!   ilwrgas - control flag for rare gases (ch4,n2o,o2,cfcs, etc.)       !
-!           =0: do not include rare gases                               !
-!           >0: include all rare gases                                  !
-!   ilwcliq - control flag for liq-cloud optical properties             !
-!           =1: input cld liqp & reliq, hu & stamnes (1993)             !
-!           =2: not used                                                !
-!   ilwcice - control flag for ice-cloud optical properties             !
-!           =1: input cld icep & reice, ebert & curry (1997)            !
-!           =2: input cld icep & reice, streamer (1996)                 !
-!           =3: input cld icep & reice, fu (1998)                       !
-!   isubclw - sub-column cloud approximation control flag               !
-!           =0: no sub-col cld treatment, use grid-mean cld quantities  !
-!           =1: mcica sub-col, prescribed seeds to get random numbers   !
-!           =2: mcica sub-col, providing array icseed for random numbers!
-!   iovr  - cloud overlapping control flag                              !
-!           =0: random overlapping clouds                               !
-!           =1: maximum/random overlapping clouds                       !
-!           =2: maximum overlap cloud (used for isubclw>0 only)         !
-!           =3: decorrelation-length overlap (for isubclw>0 only)       !
-!           =4: exponential cloud overlap (AER)                         !
-!           =5: exponential-random cloud overlap (AER)                  !
-!   ivflip  - control flag for vertical index direction                 !
-!           =0: vertical index from toa to surface                      !
-!           =1: vertical index from surface to toa                      !
-!                                                                       !
 !  module parameters, control variables:                                !
 !     nbands           - number of longwave spectral bands              !
 !     maxgas           - maximum number of absorbing gaseous            !
@@ -605,10 +598,11 @@ subroutine rrtmg_lw_run                                           &
 !  ======================    end of definitions    ===================  !
 
 !  ---  inputs:
-      integer, intent(in) :: npts, nlay, nlp1
+      integer, intent(in) :: npts, nlay, nlp1, ilwcliq, ilwcice,        &
+           isubclw, iovr
       integer, intent(in) :: icseed(npts)
 
-      logical,  intent(in) :: lprnt
+      logical,  intent(in) :: lprnt, inc_minor_gas
 
       real (kind=kind_phys), dimension(:,:), intent(in) :: plvl,        &
      &       tlvl
@@ -631,6 +625,7 @@ subroutine rrtmg_lw_run                                           &
 
       real (kind=kind_phys), dimension(:,:,:),intent(in)::              &
      &       aeraod, aerssa
+      logical, intent(in) :: lslwr, top_at_1
 
 !  ---  outputs:
       real (kind=kind_phys), dimension(:,:), intent(inout) :: hlwc
@@ -650,7 +645,6 @@ subroutine rrtmg_lw_run                                           &
      &       intent(inout) :: hlw0
       type (proflw_type),    dimension(:,:),       optional,            &
      &       intent(inout) :: flxprf
-      logical, intent(in) :: lslwr
 
 !  ---  locals:
       real (kind=kind_phys), dimension(0:nlp1) :: cldfrc
@@ -801,7 +795,7 @@ subroutine rrtmg_lw_run                                           &
 !           layer pressure thickness (in mb), based on the hydrostatic equation
 !  --- ...  and includes a correction to account for h2o in the layer.
 
-        if (ivflip == 0) then       ! input from toa to sfc
+        if (top_at_1) then       ! input from toa to sfc
 
           tem1 = 100.0 * con_g
           tem2 = 1.0e-20 * 1.0e3 * con_avgd
@@ -841,7 +835,7 @@ subroutine rrtmg_lw_run                                           &
 !!    cf22, convert from volume mixing ratio to molec/cm2 based on
 !!    coldry (scaled to 1.0e-20).
 
-          if (ilwrgas > 0) then
+          if (inc_minor_gas) then
             do k = 1, nlay
               k1 = nlp1 - k
               colamt(k,4)=max(temcol(k), coldry(k)*gasvmr_n2o(iplon,k1))  ! n2o
@@ -952,7 +946,7 @@ subroutine rrtmg_lw_run                                           &
 !  --- ...  set up col amount for rare gases, convert from volume mixing ratio
 !           to molec/cm2 based on coldry (scaled to 1.0e-20)
 
-          if (ilwrgas > 0) then
+          if (inc_minor_gas) then
             do k = 1, nlay
               colamt(k,4)=max(temcol(k), coldry(k)*gasvmr_n2o(iplon,k))  ! n2o
               colamt(k,5)=max(temcol(k), coldry(k)*gasvmr_ch4(iplon,k))  ! ch4
@@ -1021,7 +1015,7 @@ subroutine rrtmg_lw_run                                           &
           tem0 = 10.0 * tem2 / (amdw * tem1 * con_g)
           pwvcm = tem0 * plvl(iplon,1)
 
-        endif                       ! if_ivflip
+        endif                       ! top_at_1
 
 !> -# Compute column amount for broadening gases.
 
@@ -1078,6 +1072,7 @@ subroutine rrtmg_lw_run                                           &
 !  ---  inputs:
      &     ( cldfrc,clwp,relw,ciwp,reiw,cda1,cda2,cda3,cda4,            &
      &       nlay, nlp1, ipseed(iplon), dz, delgth, iovr, alph,         &
+     &       ilwcliq, ilwcice, isubclw,                                 &
 !  ---  outputs:
      &       cldfmc, taucld                                             &
      &     )
@@ -1085,7 +1080,7 @@ subroutine rrtmg_lw_run                                           &
 !  --- ...  save computed layer cloud optical depth for output
 !           rrtm band-7 is apprx 10mu channel (or use spectral mean of bands 6-8)
 
-          if (ivflip == 0) then       ! input from toa to sfc
+          if (top_at_1) then       ! input from toa to sfc
             do k = 1, nlay
               k1 = nlp1 - k
               cldtau(iplon,k1) = taucld( 7,k)
@@ -1094,7 +1089,7 @@ subroutine rrtmg_lw_run                                           &
             do k = 1, nlay
               cldtau(iplon,k) = taucld( 7,k)
             enddo
-          endif                       ! end if_ivflip_block
+          endif                       ! end if_top_at_1_block
 
         else
           cldfmc = f_zero
@@ -1229,7 +1224,7 @@ subroutine rrtmg_lw_run                                           &
         sfcflx(iplon)%dnfxc = totdflux(0)
         sfcflx(iplon)%dnfx0 = totdclfl(0)
 
-        if (ivflip == 0) then       ! output from toa to sfc
+        if (top_at_1) then       ! output from toa to sfc
 
 !! --- ...  optional fluxes
           if ( lflxprf ) then
@@ -1297,7 +1292,7 @@ subroutine rrtmg_lw_run                                           &
             enddo
           endif
 
-        endif                       ! if_ivflip
+        endif                       ! if_top_at_1
 
       enddo  lab_do_iplon
 
@@ -1315,8 +1310,8 @@ end subroutine rrtmg_lw_run
 !! spectral band are reduced from 256 g-point intervals to 140.
 !!\param me        print control for parallel process
 !!\section rlwinit_gen rlwinit General Algorithm
-      subroutine rlwinit                                                &
-     &     ( me, errflg, errmsg )
+      subroutine rlwinit( me, rad_hr_units, inc_minor_gas, ilwcliq,     &
+           isubclw, iovr, errflg, errmsg )
 
 !  ===================  program usage description  ===================  !
 !                                                                       !
@@ -1328,17 +1323,9 @@ subroutine rlwinit                                                &
 !  ====================  defination of variables  ====================  !
 !                                                                       !
 !  inputs:                                                              !
-!    me       - print control for parallel process                      !
-!                                                                       !
-!  outputs: (none)                                                      !
-!                                                                       !
-!  external module variables:  (in physparam)                            !
-!   ilwrate - heating rate unit selections                              !
-!           =1: output in k/day                                         !
-!           =2: output in k/second                                      !
-!   ilwrgas - control flag for rare gases (ch4,n2o,o2,cfcs, etc.)       !
-!           =0: do not include rare gases                               !
-!           >0: include all rare gases                                  !
+!   me            - print control for parallel process                  !
+!   rad_hr_units  - 1 for heating rates in units K/day. 2 for K/s       !
+!   inc_minor_gas - flag to turn on/off minor gases in rrtmg            !
 !   ilwcliq - liquid cloud optical properties contrl flag               !
 !           =0: input cloud opt depth from diagnostic scheme            !
 !           >0: input cwp,rew, and other cloud content parameters       !
@@ -1346,9 +1333,6 @@ subroutine rlwinit                                                &
 !           =0: no sub-col cld treatment, use grid-mean cld quantities  !
 !           =1: mcica sub-col, prescribed seeds to get random numbers   !
 !           =2: mcica sub-col, providing array icseed for random numbers!
-!   icldflg - cloud scheme control flag                                 !
-!           =0: diagnostic scheme gives cloud tau, omiga, and g.        !
-!           =1: prognostic scheme gives cloud liq/ice path, etc.        !
 !   iovr  - clouds vertical overlapping control flag                    !
 !           =0: random overlapping clouds                               !
 !           =1: maximum/random overlapping clouds                       !
@@ -1357,6 +1341,10 @@ subroutine rlwinit                                                &
 !           =4: exponential cloud overlap (AER)                         !
 !           =5: exponential-random cloud overlap (AER)                  !
 !                                                                       !
+!  outputs:                                                             !
+!   errflg  - error flag                                                !
+!   errmsg  - error message                                             !
+!                                                                       !
 !  *******************************************************************  !
 !  original code description                                            !
 !                                                                       !
@@ -1385,7 +1373,8 @@ subroutine rlwinit                                                &
 !  ======================  end of description block  =================  !
 
 !  ---  inputs:
-      integer, intent(in) :: me
+      integer, intent(in) :: me, rad_hr_units, ilwcliq, isubclw, iovr
+      logical, intent(in) :: inc_minor_gas
 
 !  ---  outputs:
       character(len=*), intent(out) :: errmsg
@@ -1405,27 +1394,10 @@ subroutine rlwinit                                                &
       errflg = 0
       errmsg = ''
 
-      if ( iovr<0 .or. iovr>5 ) then
-        print *,'  *** Error in specification of cloud overlap flag',   &
-     &          ' IOVR=',iovr,' in RLWINIT !!'
-        errflg = 1
-        errmsg = 'ERROR(rlwinit): cloud-overlap (iovr) scheme selected not valid.'
-        return
-      elseif ( (iovr==2 .or. iovr==3) .and. isubclw==0 ) then
-        if (me == 0) then
-          print *,'  *** IOVR=',iovr,' is not available for',           &
-     &          ' ISUBCLW=0 setting!!'
-          print *,'      The program uses maximum/random overlap',      &
-     &          ' instead.'
-        endif
-
-        iovr = 1
-      endif
-
       if (me == 0) then
         print *,' - Using AER Longwave Radiation, Version: ', VTAGLW
 
-        if (ilwrgas > 0) then
+        if (inc_minor_gas) then
           print *,'   --- Include rare gases N2O, CH4, O2, CFCs ',      &
      &            'absorptions in LW'
         else
@@ -1441,27 +1413,9 @@ subroutine rlwinit                                                &
         elseif ( isubclw == 2 ) then
           print *,'   --- Using MCICA sub-colum clouds approximation ', &
      &            'with provided input array of permutation seeds'
-        else
-          print *,'  *** Error in specification of sub-column cloud ',  &
-     &            ' control flag isubclw =',isubclw,' !!'
-          errflg = 1
-          errmsg = 'ERROR(rlwinit): sub-column scheme (isubclw) selected not valid.'
-          return
         endif
       endif
 
-!> -# Check cloud flags for consistency.
-
-      if ((icldflg == 0 .and. ilwcliq /= 0) .or.                        &
-     &    (icldflg == 1 .and. ilwcliq == 0)) then
-        print *,'  *** Model cloud scheme inconsistent with LW',        &
-     &          ' radiation cloud radiative property setup !!'
-        errflg = 1
-        errmsg = 'ERROR(rlwinit): Model cloud scheme inconsistent with LW'//&
-     &          ' radiation cloud radiative property setup'
-        return
-      endif
-
 !> -# Setup default surface emissivity for each band.
 
       semiss0(:) = f_one
@@ -1473,7 +1427,7 @@ subroutine rlwinit                                                &
       fluxfac = pival * 2.0d4
 !     fluxfac = 62831.85307179586                   ! = 2 * pi * 1.0e4
 
-      if (ilwrate == 1) then
+      if (rad_hr_units == 1) then
 !       heatfac = 8.4391
 !       heatfac = con_g * 86400. * 1.0e-2 / con_cp  !   (in k/day)
         heatfac = con_g * 864.0 / con_cp            !   (in k/day)
@@ -1559,8 +1513,8 @@ end subroutine rlwinit
 !!\section gen_cldprop cldprop General Algorithm
       subroutine cldprop                                                &
      &     ( cfrac,cliqp,reliq,cicep,reice,cdat1,cdat2,cdat3,cdat4,     & !  ---  inputs
-     &       nlay, nlp1, ipseed, dz, de_lgth, iovr, alpha,              &
-     &       cldfmc, taucld                                             & !  ---  outputs
+     &       nlay, nlp1, ipseed, dz, de_lgth, iovr, alpha, ilwcliq,     &
+     &       ilwcice, isubclw, cldfmc, taucld                           & !  ---  outputs
      &     )
 
 !  ===================  program usage description  ===================  !
@@ -1660,7 +1614,8 @@ subroutine cldprop                                                &
       use module_radlw_cldprlw
 
 !  ---  inputs:
-      integer, intent(in) :: nlay, nlp1, ipseed, iovr
+      integer, intent(in) :: nlay, nlp1, ipseed, iovr, ilwcliq, ilwcice,&
+           isubclw
 
       real (kind=kind_phys), dimension(0:nlp1), intent(in) :: cfrac
       real (kind=kind_phys), dimension(nlay),   intent(in) :: cliqp,    &
@@ -1825,7 +1780,7 @@ subroutine cldprop                                                &
 
       endif  lab_if_ilwcliq
 
-!> -# if physparam::isubclw > 0, call mcica_subcol() to distribute
+!> -# if GFS_typedefs::isubclw > 0, call mcica_subcol() to distribute
 !!    cloud properties to each g-point.
 
       if ( isubclw > 0 ) then      ! mcica sub-col clouds approx
@@ -1841,7 +1796,7 @@ subroutine cldprop                                                &
 
         call mcica_subcol                                               &
 !  ---  inputs:
-     &     ( cldf, nlay, ipseed, dz, de_lgth, alpha,                    &
+     &     ( cldf, nlay, ipseed, dz, de_lgth, alpha, iovr,              &
 !  ---  output:
      &       lcloudy                                                    &
      &     )
@@ -1874,7 +1829,7 @@ end subroutine cldprop
 !!\param lcloudy     sub-colum cloud profile flag array
 !!\section mcica_subcol_gen mcica_subcol General Algorithm
       subroutine mcica_subcol                                           &
-     &    ( cldf, nlay, ipseed, dz, de_lgth, alpha,                     & !  ---  inputs
+     &    ( cldf, nlay, ipseed, dz, de_lgth, alpha, iovr,               & !  ---  inputs
      &      lcloudy                                                     & !  ---  outputs
      &    )
 
@@ -1889,22 +1844,20 @@ subroutine mcica_subcol                                           &
 !              for lw and sw, use values differ by the number of g-pts. !
 !   dz      - real, layer thickness (km)                           nlay !
 !   de_lgth - real, layer cloud decorrelation length (km)            1  !
-!    alpha  - real, EXP/ER decorrelation parameter                 nlay !
+!   alpha   - real, EXP/ER decorrelation parameter                 nlay !
+!   iovr    - control flag for cloud overlapping method              1  !
+!                 =0:random; =1:maximum/random: =2:maximum; =3:decorr   !
+!                 =4:exponential; =5:exponential-random                 !
 !                                                                       !
 !  output variables:                                                    !
 !   lcloudy - logical, sub-colum cloud profile flag array    ngptlw*nlay!
 !                                                                       !
-!  other control flags from module variables:                           !
-!     iovr    : control flag for cloud overlapping method               !
-!                 =0:random; =1:maximum/random: =2:maximum; =3:decorr   !
-!                 =4:exponential; =5:exponential-random                 !
-!                                                                       !
 !  =====================    end of definitions    ====================  !
 
       implicit none
 
 !  ---  inputs:
-      integer, intent(in) :: nlay, ipseed
+      integer, intent(in) :: nlay, ipseed, iovr
 
       real (kind=kind_phys), dimension(nlay), intent(in) :: cldf, dz
       real (kind=kind_phys),                  intent(in) :: de_lgth
diff --git a/physics/radlw_main.meta b/physics/radlw_main.meta
index 9286c45cb..8dc1db046 100644
--- a/physics/radlw_main.meta
+++ b/physics/radlw_main.meta
@@ -241,6 +241,48 @@
   dimensions = ()
   type = logical
   intent = in
+[top_at_1]
+  standard_name = flag_for_vertical_ordering_in_RRTMGP
+  long_name = flag for vertical ordering in RRTMGP
+  units = flag
+  dimensions = ()
+  type = logical
+  intent = in
+[iovr]
+  standard_name = flag_for_cloud_overlap_method_for_radiation
+  long_name = flag for cloud overlap method
+  units = flag
+  dimensions = ()
+  type = integer
+  intent = in
+[inc_minor_gas]
+  standard_name = flag_to_include_minor_gases_in_rrtmg
+  long_name = flag to include minor trace gases	in rrtmg
+  units = flag
+  dimensions = ()
+  type = logical
+  intent = in
+[ilwcliq]
+  standard_name = flag_for_rrtmg_lw_cloud_optics
+  long_name = flag for rrtmg longwave cloud optics
+  units = flag
+  dimensions =  ()
+  type = integer
+  intent = in
+[ilwcice]
+  standard_name = flag_for_rrtmg_lw_ice_cloud_optics
+  long_name = flag for rrtmg longwave ice cloud optics
+  units = flag
+  dimensions =  ()
+  type = integer
+  intent = in
+[isubclw]
+  standard_name = flag_for_lw_clouds_sub_grid_approximation
+  long_name = flag for lw clouds sub-grid approximation
+  units = flag
+  dimensions = ()
+  type = integer
+  intent = in
 [hlwc]
   standard_name = tendency_of_air_temperature_due_to_longwave_heating_on_radiation_time_step_and_radiation_levels
   long_name = longwave total sky heating rate
diff --git a/physics/radlw_param.f b/physics/radlw_param.f
index fa7ceecb0..bc2aae224 100644
--- a/physics/radlw_param.f
+++ b/physics/radlw_param.f
@@ -65,7 +65,7 @@ module module_radlw_parameters     !
 !! \htmlinclude module_radlw_parameters.html
 !!
 
-      use physparam,               only : kind_phys
+      use machine,               only : kind_phys
 
       implicit none
 !
diff --git a/physics/radsw_datatb.f b/physics/radsw_datatb.f
index 6d88f1989..e0bb651e9 100644
--- a/physics/radsw_datatb.f
+++ b/physics/radsw_datatb.f
@@ -73,7 +73,7 @@
       module module_radsw_ref            !
 !........................................!
 !
-      use physparam,               only : kind_phys
+      use machine,               only : kind_phys
 !
       implicit none
 !
@@ -217,7 +217,7 @@ module module_radsw_cldprtb        !
 !                                                                      !
 ! *************************  end description  ************************ !
 
-      use physparam,               only : kind_phys
+      use machine,                 only : kind_phys
       use module_radsw_parameters, only : nblow, nbhgh
 !
       implicit none
@@ -2503,7 +2503,7 @@ module module_radsw_sflux          !
 !                                                                      !
 ! *************************  end description  ************************ !
 !
-      use physparam,               only : kind_phys
+      use machine,                 only : kind_phys
       use module_radsw_parameters, only : NGMAX, NG16, NG17, NG18, NG19,&
      &                                    NG20, NG21, NG22, NG23, NG24, &
      &                                    NG25, NG26, NG27, NG28, NG29, &
@@ -2838,7 +2838,7 @@ module module_radsw_kgb16          !
 !                                                                     !
 ! ************************  end description  ************************ !
 !
-      use physparam,               only : kind_phys
+      use machine,                 only : kind_phys
       use module_radsw_parameters, only : NG16
 
 !
@@ -4031,7 +4031,7 @@ module module_radsw_kgb17          !
 !                                                                     !
 ! *********    *********    end description    *********    ********* !
 !
-      use physparam,               only : kind_phys
+      use machine,                 only : kind_phys
       use module_radsw_parameters, only : NG17
 
 !
@@ -8640,7 +8640,7 @@ module module_radsw_kgb18          !
 !                                                                     !
 ! *********    *********    end description    *********    ********* !
 !
-      use physparam,               only : kind_phys
+      use machine,                 only : kind_phys
       use module_radsw_parameters, only : NG18
 
 !
@@ -10158,7 +10158,7 @@ module module_radsw_kgb19          !
 !                                                                     !
 ! *********    *********    end description    *********    ********* !
 !
-      use physparam,               only : kind_phys
+      use machine,                 only : kind_phys
       use module_radsw_parameters, only : NG19
 
 !
@@ -11677,7 +11677,7 @@ module module_radsw_kgb20          !
 !                                                                     !
 ! *********    *********    end description    *********    ********* !
 !
-      use physparam,               only : kind_phys
+      use machine,                 only : kind_phys
       use module_radsw_parameters, only : NG20
 
 !
@@ -12461,7 +12461,7 @@ module module_radsw_kgb21          !
 !                                                                     !
 ! *********    *********    end description    *********    ********* !
 !
-      use physparam,               only : kind_phys
+      use machine,                 only : kind_phys
       use module_radsw_parameters, only : NG21
 
 !
@@ -16319,7 +16319,7 @@ module module_radsw_kgb22          !
 !                                                                     !
 ! *********    *********    end description    *********    ********* !
 !
-      use physparam,               only : kind_phys
+      use machine,                 only : kind_phys
       use module_radsw_parameters, only : NG22
 
 !
@@ -16766,7 +16766,7 @@ module module_radsw_kgb23          !
 !                                                                     !
 ! *********    *********    end description    *********    ********* !
 !
-      use physparam,               only : kind_phys
+      use machine,                 only : kind_phys
       use module_radsw_parameters, only : NG23
 
 !
@@ -17023,7 +17023,7 @@ module module_radsw_kgb24          !
 !                                                                     !
 ! *********    *********    end description    *********    ********* !
 !
-      use physparam,               only : kind_phys
+      use machine,                 only : kind_phys
       use module_radsw_parameters, only : NG24
 
 !
@@ -18588,7 +18588,7 @@ module module_radsw_kgb25          !
 !                                                                     !
 ! *********    *********    end description    *********    ********* !
 !
-      use physparam,               only : kind_phys
+      use machine,                 only : kind_phys
       use module_radsw_parameters, only : NG25
 
 !
@@ -18748,7 +18748,7 @@ module module_radsw_kgb26          !
 !                                                                     !
 ! *********    *********    end description    *********    ********* !
 !
-      use physparam,               only : kind_phys
+      use machine,                 only : kind_phys
       use module_radsw_parameters, only : NG26
 
 !
@@ -18784,7 +18784,7 @@ module module_radsw_kgb27          !
 !                                                                     !
 ! *********    *********    end description    *********    ********* !
 !
-      use physparam,               only : kind_phys
+      use machine,                 only : kind_phys
       use module_radsw_parameters, only : NG27
 
 !
@@ -19387,7 +19387,7 @@ module module_radsw_kgb28          !
 !                                                                     !
 ! *********    *********    end description    *********    ********* !
 !
-      use physparam,               only : kind_phys
+      use machine,                 only : kind_phys
       use module_radsw_parameters, only : NG28
 
 !
@@ -21701,7 +21701,7 @@ module module_radsw_kgb29          !
 !                                                                     !
 ! *********    *********    end description    *********    ********* !
 !
-      use physparam,               only : kind_phys
+      use machine,                 only : kind_phys
       use module_radsw_parameters, only : NG29
 
 !
diff --git a/physics/radsw_main.F90 b/physics/radsw_main.F90
index f24dcff86..cf6c37346 100644
--- a/physics/radsw_main.F90
+++ b/physics/radsw_main.F90
@@ -90,7 +90,6 @@
 !                                                                          !
 !   external modules referenced:                                           !
 !                                                                          !
-!       'module physparam'                                                 !
 !       'module physcons'                                                  !
 !       'mersenne_twister'                                                 !
 !                                                                          !
@@ -304,9 +303,6 @@
 !! rrtmg-sw radiation code from aer inc.     
       module rrtmg_sw 
 !
-      use physparam,        only : iswrate, iswrgas, iswcliq, iswcice,  &
-     &                             isubcsw, icldflg, iovr,  ivflip,     &
-     &                             iswmode
       use physcons,         only : con_g, con_cp, con_avgd, con_amd,    &
      &                             con_amw, con_amo3
       use machine,          only : rb => kind_phys, im => kind_io4,     &
@@ -503,7 +499,8 @@ subroutine rrtmg_sw_run                                           &
      &       sfcalb_uvis_dir, sfcalb_uvis_dif,                          &
      &       dzlyr,delpin,de_lgth,alpha,                                &
      &       cosz,solcon,NDAY,idxday,                                   &
-     &       npts, nlay, nlp1, lprnt,                                   &
+     &       npts, nlay, nlp1, lprnt, inc_minor_gas, iswcliq, iswcice,  &
+     &       isubcsw, iovr, top_at_1, iswmode,                          &
      &       cld_cf, lsswr,                                             &
      &       hswc,topflx,sfcflx,cldtau,                                 &   !  ---  outputs
      &       HSW0,HSWB,FLXPRF,FDNCMP,                                   &   ! ---  optional
@@ -570,6 +567,30 @@ subroutine rrtmg_sw_run                                           &
 !   npts             : number of horizontal points                      !
 !   nlay,nlp1        : vertical layer/lavel numbers                     !
 !   lprnt            : logical check print flag                         !
+!   iswcliq - control flag for liq-cloud optical properties             !
+!           =0: input cloud optical depth, fixed ssa, asy               !
+!           =1: use hu and stamnes(1993) method for liq cld             !
+!           =2: use updated coeffs for hu and stamnes scheme            !
+!   iswcice - control flag for ice-cloud optical properties             !
+!           *** if iswcliq==0, iswcice is ignored                       !
+!           =1: use ebert and curry (1992) scheme for ice clouds        !
+!           =2: use streamer v3.0 (2001) method for ice clouds          !
+!           =3: use fu's method (1996) for ice clouds                   !
+!   iswmode - control flag for 2-stream transfer scheme                 !
+!           =1; delta-eddington    (joseph et al., 1976)                !
+!           =2: pifm               (zdunkowski et al., 1980)            !
+!           =3: discrete ordinates (liou, 1973)                         !
+!   isubcsw - sub-column cloud approximation control flag               !
+!           =0: no sub-col cld treatment, use grid-mean cld quantities  !
+!           =1: mcica sub-col, prescribed seeds to get random numbers   !
+!           =2: mcica sub-col, providing array icseed for random numbers!
+!   iovr    - cloud overlapping control flag                            !
+!           =0: random overlapping clouds                               !
+!           =1: maximum/random overlapping clouds                       !
+!           =2: maximum overlap cloud                                   !
+!           =3: decorrelation-length overlap clouds                     !
+!           =4: exponential cloud overlap (AER)                         !
+!           =5: exponential-random cloud overlap (AER)                  !   
 !                                                                       !
 !  output variables:                                                    !
 !   hswc  (npts,nlay): total sky heating rates (k/sec or k/day)         !
@@ -604,38 +625,6 @@ subroutine rrtmg_sw_run                                           &
 !     visbm            - downward surface uv+vis direct beam flux       !
 !     visdf            - downward surface uv+vis diffused flux          !
 !                                                                       !
-!  external module variables:  (in physparam)                           !
-!   iswrgas - control flag for rare gases (ch4,n2o,o2, etc.)            !
-!           =0: do not include rare gases                               !
-!           >0: include all rare gases                                  !
-!   iswcliq - control flag for liq-cloud optical properties             !
-!           =0: input cloud optical depth, fixed ssa, asy               !
-!           =1: use hu and stamnes(1993) method for liq cld             !
-!           =2: use updated coeffs for hu and stamnes scheme            !
-!   iswcice - control flag for ice-cloud optical properties             !
-!           *** if iswcliq==0, iswcice is ignored                       !
-!           =1: use ebert and curry (1992) scheme for ice clouds        !
-!           =2: use streamer v3.0 (2001) method for ice clouds          !
-!           =3: use fu's method (1996) for ice clouds                   !
-!   iswmode - control flag for 2-stream transfer scheme                 !
-!           =1; delta-eddington    (joseph et al., 1976)                !
-!           =2: pifm               (zdunkowski et al., 1980)            !
-!           =3: discrete ordinates (liou, 1973)                         !
-!   isubcsw - sub-column cloud approximation control flag               !
-!           =0: no sub-col cld treatment, use grid-mean cld quantities  !
-!           =1: mcica sub-col, prescribed seeds to get random numbers   !
-!           =2: mcica sub-col, providing array icseed for random numbers!
-!   iovr    - cloud overlapping control flag                            !
-!           =0: random overlapping clouds                               !
-!           =1: maximum/random overlapping clouds                       !
-!           =2: maximum overlap cloud                                   !
-!           =3: decorrelation-length overlap clouds                     !
-!           =4: exponential cloud overlap (AER)                         !
-!           =5: exponential-random cloud overlap (AER)                  !
-!   ivflip  - control flg for direction of vertical index               !
-!           =0: index from toa to surface                               !
-!           =1: index from surface to toa                               !
-!                                                                       !
 !  module parameters, control variables:                                !
 !     nblow,nbhgh      - lower and upper limits of spectral bands       !
 !     maxgas           - maximum number of absorbing gaseous            !
@@ -690,11 +679,12 @@ subroutine rrtmg_sw_run                                           &
 !  =====================    end of definitions    ====================  !
 
 !  ---  inputs:
-      integer, intent(in) :: npts, nlay, nlp1, NDAY
+      integer, intent(in) :: npts, nlay, nlp1, NDAY, iswcliq, iswcice,  &
+           isubcsw, iovr, iswmode
 
       integer, dimension(:), intent(in) :: idxday, icseed
 
-      logical, intent(in) :: lprnt, lsswr
+      logical, intent(in) :: lprnt, lsswr, inc_minor_gas, top_at_1
 
       real (kind=kind_phys), dimension(:,:), intent(in) ::              &
      &       plvl, tlvl
@@ -910,7 +900,7 @@ subroutine rrtmg_sw_run                                           &
 !> - Prepare atmospheric profile for use in rrtm.
 !           the vertical index of internal array is from surface to top
 
-        if (ivflip == 0) then       ! input from toa to sfc
+        if (top_at_1) then       ! input from toa to sfc
 
           tem1 = 100.0 * con_g
           tem2 = 1.0e-20 * 1.0e3 * con_avgd
@@ -950,7 +940,7 @@ subroutine rrtmg_sw_run                                           &
 !  --- ...  set up gas column amount, convert from volume mixing ratio
 !           to molec/cm2 based on coldry (scaled to 1.0e-20)
 
-          if (iswrgas > 0) then
+          if (inc_minor_gas) then
             do k = 1, nlay
               kk = nlp1 - k
              colamt(k,4) = max(temcol(k), coldry(k)*gasvmr_n2o(j1,kk)) ! n2o
@@ -1047,7 +1037,7 @@ subroutine rrtmg_sw_run                                           &
 !  --- ...  set up gas column amount, convert from volume mixing ratio
 !           to molec/cm2 based on coldry (scaled to 1.0e-20)
 
-          if (iswrgas > 0) then
+          if (inc_minor_gas) then
             do k = 1, nlay
             colamt(k,4) = max(temcol(k), coldry(k)*gasvmr_n2o(j1,k))  ! n2o
             colamt(k,5) = max(temcol(k), coldry(k)*gasvmr_ch4(j1,k))  ! ch4
@@ -1094,7 +1084,7 @@ subroutine rrtmg_sw_run                                           &
             enddo
           endif                    ! end if_iswcliq
 
-        endif                       ! if_ivflip
+        endif                       ! if_top_at_1
 
 !> - Compute fractions of clear sky view:
 !!    - random overlapping
@@ -1135,7 +1125,8 @@ subroutine rrtmg_sw_run                                           &
           call cldprop                                                  &
 !  ---  inputs:
      &     ( cfrac,cliqp,reliq,cicep,reice,cdat1,cdat2,cdat3,cdat4,     &
-     &       zcf1, nlay, ipseed(j1), dz, delgth, alph,                  &
+     &       zcf1, nlay, ipseed(j1), dz, delgth, alph, iswcliq, iswcice,&
+     &       isubcsw, iovr,                                             &
 !  ---  outputs:
      &       taucw, ssacw, asycw, cldfrc, cldfmc                        &
      &     )
@@ -1143,7 +1134,7 @@ subroutine rrtmg_sw_run                                           &
 !  --- ...  save computed layer cloud optical depth for output
 !           rrtm band 10 is approx to the 0.55 mu spectrum
 
-          if (ivflip == 0) then       ! input from toa to sfc
+          if (top_at_1) then       ! input from toa to sfc
             do k = 1, nlay
               kk = nlp1 - k
               cldtau(j1,kk) = taucw(k,10)
@@ -1152,7 +1143,7 @@ subroutine rrtmg_sw_run                                           &
             do k = 1, nlay
               cldtau(j1,k) = taucw(k,10)
             enddo
-          endif                       ! end if_ivflip_block
+          endif                       ! end if_top_at_1_block
 
         else                        ! clear sky column
           cldfrc(:)  = f_zero
@@ -1187,9 +1178,9 @@ subroutine rrtmg_sw_run                                           &
      &     )
 
 !> - Call the 2-stream radiation transfer model:
-!!    - if physparam::isubcsw .le.0, using standard cloud scheme,
+!!    - if GFS_typedefs::isubcsw .le.0, using standard cloud scheme,
 !!      call spcvrtc().
-!!    - if physparam::isubcsw .gt.0, using mcica cloud scheme,
+!!    - if GFS_typedefs::isubcsw .gt.0, using mcica cloud scheme,
 !!      call spcvrtm().
 
         if ( isubcsw <= 0 ) then     ! use standard cloud scheme
@@ -1198,7 +1189,7 @@ subroutine rrtmg_sw_run                                           &
 !  ---  inputs:
      &     ( ssolar,cosz1,sntz1,albbm,albdf,sfluxzen,cldfrc,            &
      &       zcf1,zcf0,taug,taur,tauae,ssaae,asyae,taucw,ssacw,asycw,   &
-     &       nlay, nlp1,                                                &
+     &       nlay, nlp1, iswmode,                                       &
 !  ---  outputs:
      &       fxupc,fxdnc,fxup0,fxdn0,                                   &
      &       ftoauc,ftoau0,ftoadc,fsfcuc,fsfcu0,fsfcdc,fsfcd0,          &
@@ -1211,7 +1202,7 @@ subroutine rrtmg_sw_run                                           &
 !  ---  inputs:
      &     ( ssolar,cosz1,sntz1,albbm,albdf,sfluxzen,cldfmc,            &
      &       zcf1,zcf0,taug,taur,tauae,ssaae,asyae,taucw,ssacw,asycw,   &
-     &       nlay, nlp1,                                                &
+     &       nlay, nlp1, iswmode,                                       &
 !  ---  outputs:
      &       fxupc,fxdnc,fxup0,fxdn0,                                   &
      &       ftoauc,ftoau0,ftoadc,fsfcuc,fsfcu0,fsfcdc,fsfcd0,          &
@@ -1276,7 +1267,7 @@ subroutine rrtmg_sw_run                                           &
         sfcflx(j1)%upfx0 = fsfcu0
         sfcflx(j1)%dnfx0 = fsfcd0
 
-        if (ivflip == 0) then       ! output from toa to sfc
+        if (top_at_1) then       ! output from toa to sfc
 
 !  --- ...  compute heating rates
 
@@ -1372,7 +1363,7 @@ subroutine rrtmg_sw_run                                           &
             enddo
           endif
 
-        endif                       ! if_ivflip
+        endif                       ! if_top_at_1
 
       enddo   lab_do_ipt
 
@@ -1387,9 +1378,8 @@ end subroutine rrtmg_sw_run
 !!\param me             print control for parallel process
 !>\section rswinit_gen rswinit General Algorithm
 !-----------------------------------
-      subroutine rswinit                                                &
-     &     ( me, errflg, errmsg ) !  ---  inputs:
-!  ---  outputs: (none)
+      subroutine rswinit( me, rad_hr_units, inc_minor_gas, iswcliq,     &
+           isubcsw, iovr, iswmode, errflg, errmsg )
 
 !  ===================  program usage description  ===================  !
 !                                                                       !
@@ -1401,17 +1391,8 @@ subroutine rswinit                                                &
 !  ====================  defination of variables  ====================  !
 !                                                                       !
 !  inputs:                                                              !
-!    me       - print control for parallel process                      !
-!                                                                       !
-!  outputs: (none)                                                      !
-!                                                                       !
-!  external module variables:  (in physparam)                           !
-!   iswrate - heating rate unit selections                              !
-!           =1: output in k/day                                         !
-!           =2: output in k/second                                      !
-!   iswrgas - control flag for rare gases (ch4,n2o,o2, etc.)            !
-!           =0: do not include rare gases                               !
-!           >0: include all rare gases                                  !
+!   me           - print control for parallel process                   !
+!   rad_hr_units -                                                      !
 !   iswcliq - liquid cloud optical properties contrl flag               !
 !           =0: input cloud opt depth from diagnostic scheme            !
 !           >0: input cwp,rew, and other cloud content parameters       !
@@ -1419,9 +1400,6 @@ subroutine rswinit                                                &
 !           =0: no sub-col cld treatment, use grid-mean cld quantities  !
 !           =1: mcica sub-col, prescribed seeds to get random numbers   !
 !           =2: mcica sub-col, providing array icseed for random numbers!
-!   icldflg - cloud scheme control flag                                 !
-!           =0: diagnostic scheme gives cloud tau, omiga, and g.        !
-!           =1: prognostic scheme gives cloud liq/ice path, etc.        !
 !   iovr    - clouds vertical overlapping control flag                  !
 !           =0: random overlapping clouds                               !
 !           =1: maximum/random overlapping clouds                       !
@@ -1434,6 +1412,9 @@ subroutine rswinit                                                &
 !           =2: pifm               (zdunkowski et al., 1980)            !
 !           =3: discrete ordinates (liou, 1973)                         !
 !                                                                       !
+!  outputs:                                                             !
+!   errflg - error flag                                                 !
+!   errmsg - error message                                              !
 !  *******************************************************************  !
 !                                                                       !
 ! definitions:                                                          !
@@ -1446,8 +1427,9 @@ subroutine rswinit                                                &
 !  ======================  end of description block  =================  !
 
 !  ---  inputs:
-      integer, intent(in) :: me
-
+      integer, intent(in) :: me, rad_hr_units, iswcliq, isubcsw, iovr,  &
+           iswmode
+      logical, intent(in) :: inc_minor_gas
 !  ---  outputs:
       character(len=*), intent(out) :: errmsg
       integer,          intent(out) :: errflg
@@ -1466,14 +1448,6 @@ subroutine rswinit                                                &
       errflg = 0
       errmsg = ''
 
-      if ( iovr<0 .or. iovr>5 ) then
-        print *,'  *** Error in specification of cloud overlap flag',   &
-     &          ' IOVR=',iovr,' in RSWINIT !!'
-        errflg = 1
-        errmsg = 'ERROR(rswinit): cloud-overlap (iovr) scheme selected not valid.'
-        return
-      endif
-
       if (me == 0) then
         print *,' - Using AER Shortwave Radiation, Version: ',VTAGSW
 
@@ -1485,7 +1459,7 @@ subroutine rswinit                                                &
           print *,'   --- Discrete ordinates 2-stream transfer scheme'
         endif
 
-        if (iswrgas <= 0) then
+        if (.not. inc_minor_gas) then
           print *,'   --- Rare gases absorption is NOT included in SW'
         else
           print *,'   --- Include rare gases N2O, CH4, O2, absorptions',&
@@ -1501,42 +1475,13 @@ subroutine rswinit                                                &
         elseif ( isubcsw == 2 ) then
           print *,'   --- Using MCICA sub-colum clouds approximation ', &
      &            'with provided input array of permutation seeds'
-        else
-          print *,'  *** Error in specification of sub-column cloud ',  &
-     &            ' control flag isubcsw =',isubcsw,' !!'
-          errflg = 1
-          errmsg = 'ERROR(rswinit): sub-column scheme (isubcsw) selected not valid.'
-          return
         endif
       endif
 
-!> - Check cloud flags for consistency.
-
-      if ((icldflg == 0 .and. iswcliq /= 0) .or.                        &
-     &    (icldflg == 1 .and. iswcliq == 0)) then
-        print *,'  *** Model cloud scheme inconsistent with SW',        &
-     &          ' radiation cloud radiative property setup !!'
-        errflg = 1
-        errmsg = 'ERROR(rswinit): Model cloud scheme inconsistent with SW'//&
-     &          ' radiation cloud radiative property setup'
-        return
-      endif
-
-      if ( isubcsw==0 .and. iovr>2 ) then
-        if (me == 0) then
-          print *,'  *** IOVR=',iovr,' is not available for',           &
-     &            ' ISUBCSW=0 setting!!'
-          print *,'      The program will use maximum/random overlap',  &
-     &            ' instead.'
-        endif
-
-        iovr = 1
-      endif
-
 !> - Setup constant factors for heating rate
 !! the 1.0e-2 is to convert pressure from mb to \f$N/m^2\f$ .
 
-      if (iswrate == 1) then
+      if (rad_hr_units == 1) then
 !       heatfac = 8.4391
 !       heatfac = con_g * 86400. * 1.0e-2 / con_cp  !   (in k/day)
         heatfac = con_g * 864.0 / con_cp            !   (in k/day)
@@ -1573,7 +1518,7 @@ end subroutine rswinit
 !> This subroutine computes the cloud optical properties for each
 !! cloudy layer and g-point interval.
 !!\param cfrac          layer cloud fraction
-!!\n for  physparam::iswcliq > 0 (prognostic cloud scheme)  - - -
+!!\n for  GFS_typedefs::iswcliq > 0 (prognostic cloud scheme)  - - -
 !!\param cliqp          layer in-cloud liq water path (\f$g/m^2\f$)
 !!\param reliq          mean eff radius for liq cloud (micron)
 !!\param cicep          layer in-cloud ice water path (\f$g/m^2\f$)
@@ -1582,7 +1527,7 @@ end subroutine rswinit
 !!\param cdat2          effective radius for rain drop (micron)
 !!\param cdat3          layer snow flake water path(\f$g/m^2\f$)
 !!\param cdat4          mean eff radius for snow flake(micron)
-!!\n for physparam::iswcliq = 0  (diagnostic cloud scheme)  - - -
+!!\n for GFS_typedefs::iswcliq = 0  (diagnostic cloud scheme)  - - -
 !!\param cliqp          not used
 !!\param cicep          not used
 !!\param reliq          not used
@@ -1609,8 +1554,8 @@ end subroutine rswinit
 !-----------------------------------
       subroutine cldprop                                                &
      &     ( cfrac,cliqp,reliq,cicep,reice,cdat1,cdat2,cdat3,cdat4,     &   !  ---  inputs
-     &       cf1, nlay, ipseed, dz, delgth, alpha,                      &
-     &       taucw, ssacw, asycw, cldfrc, cldfmc                        &   !  ---  output
+     &       cf1, nlay, ipseed, dz, delgth, alpha, iswcliq, iswcice,    &
+     &       isubcsw, iovr, taucw, ssacw, asycw, cldfrc, cldfmc         &   !  ---  output
      &     )
 
 !  ===================  program usage description  ===================  !
@@ -1661,7 +1606,7 @@ subroutine cldprop                                                &
 !                                                                       !
 !                                                                       !
 !  explanation of the method for each value of iswcliq, and iswcice.    !
-!  set up in module "physparam"                                         !
+!  provided by host-model                                               !
 !                                                                       !
 !     iswcliq=0  : input cloud optical property (tau, ssa, asy).        !
 !                  (used for diagnostic cloud method)                   !
@@ -1696,7 +1641,8 @@ subroutine cldprop                                                &
       use module_radsw_cldprtb
 
 !  ---  inputs:
-      integer, intent(in) :: nlay, ipseed
+      integer, intent(in) :: nlay, ipseed, iswcliq, iswcice, isubcsw,   &
+           iovr
       real (kind=kind_phys), intent(in) :: cf1, delgth
 
       real (kind=kind_phys), dimension(nlay), intent(in) :: cliqp,      &
@@ -1954,7 +1900,7 @@ subroutine cldprop                                                &
 
         call mcica_subcol                                               &
 !  ---  inputs:
-     &     ( cldf, nlay, ipseed, dz, delgth, alpha,                     &
+     &     ( cldf, nlay, ipseed, dz, delgth, alpha, iovr,               &
 !  ---  outputs:
      &       lcloudy                                                    &
      &     )
@@ -1993,7 +1939,7 @@ end subroutine cldprop
 !!\section mcica_sw_gen mcica_subcol General Algorithm
 ! ----------------------------------
       subroutine mcica_subcol                                           &
-     &    ( cldf, nlay, ipseed, dz, de_lgth, alpha,                     &       !  ---  inputs
+     &    ( cldf, nlay, ipseed, dz, de_lgth, alpha, iovr,               &       !  ---  inputs
      &      lcloudy                                                     &       !  ---  outputs
      &    )
 
@@ -2006,15 +1952,10 @@ subroutine mcica_subcol                                           &
 !    ** note : if the cloud generator is called multiple times, need    !
 !              to permute the seed between each call; if between calls  !
 !              for lw and sw, use values differ by the number of g-pts. !
-!    dz    - real, layer thickness (km)                            nlay !
-!    de_lgth-real, layer cloud decorrelation length (km)            1   !
-!    alpha  - real, EXP/ER decorrelation parameter                 nlay !
-!                                                                       !
-!  output variables:                                                    !
-!   lcloudy - logical, sub-colum cloud profile flag array    nlay*ngptsw!
-!                                                                       !
-!  other control flags from module variables:                           !
-!     iovr      : control flag for cloud overlapping method             !
+!    dz      - real, layer thickness (km)                          nlay !
+!    de_lgth - real, layer cloud decorrelation length (km)          1   !
+!    alpha   - real, EXP/ER decorrelation parameter                nlay !
+!    iovr    - control flag for cloud overlapping method            1   !
 !                 =0: random                                            !
 !                 =1: maximum/random overlapping clouds                 !
 !                 =2: maximum overlap cloud                             !
@@ -2022,12 +1963,15 @@ subroutine mcica_subcol                                           &
 !                 =4: exponential cloud overlap method (AER)            !
 !                 =5: exponential-random cloud overlap method (AER)     !
 !                                                                       !
+!  output variables:                                                    !
+!   lcloudy - logical, sub-colum cloud profile flag array    nlay*ngptsw!
+!                                                                       !
 !  =====================    end of definitions    ====================  !
 
       implicit none
 
 !  ---  inputs:
-      integer, intent(in) :: nlay, ipseed
+      integer, intent(in) :: nlay, ipseed, iovr
 
       real (kind=kind_phys), dimension(nlay), intent(in) :: cldf, dz
       real (kind=kind_phys), intent(in) :: de_lgth
@@ -2477,7 +2421,7 @@ end subroutine setcoef
       subroutine spcvrtc                                                &
      &     ( ssolar,cosz,sntz,albbm,albdf,sfluxzen,cldfrc,              &  !  ---  inputs
      &       cf1,cf0,taug,taur,tauae,ssaae,asyae,taucw,ssacw,asycw,     &
-     &       nlay, nlp1,                                                &
+     &       nlay, nlp1, iswmode,                                       &
      &       fxupc,fxdnc,fxup0,fxdn0,                                   &  !  ---  outputs
      &       ftoauc,ftoau0,ftoadc,fsfcuc,fsfcu0,fsfcdc,fsfcd0,          &
      &       sfbmc,sfdfc,sfbm0,sfdf0,suvbfc,suvbf0                      &
@@ -2539,7 +2483,7 @@ subroutine spcvrtc                                                &
 !    zldbt   - real, layer beam transmittance for clear/cloudy    nlp1  !
 !    ztdbt   - real, lev total beam transmittance for clr/cld     nlp1  !
 !                                                                       !
-!  control parameters in module "physparam"                             !
+!  control parameters in module "GFS_typedefs"                          !
 !    iswmode - control flag for 2-stream transfer schemes               !
 !              = 1 delta-eddington    (joseph et al., 1976)             !
 !              = 2 pifm               (zdunkowski et al., 1980)         !
@@ -2580,7 +2524,7 @@ subroutine spcvrtc                                                &
       real (kind=kind_phys), parameter :: eps1  = 1.0e-8
 
 !  ---  inputs:
-      integer, intent(in) :: nlay, nlp1
+      integer, intent(in) :: nlay, nlp1, iswmode
 
       real (kind=kind_phys), dimension(nlay,ngptsw), intent(in) ::      &
      &       taug, taur
@@ -2685,7 +2629,7 @@ subroutine spcvrtc                                                &
 !!    transmittance.
 !    - Set up toa direct beam and surface values (beam and diff).
 !    - Delta scaling for clear-sky condition.
-!    - General two-stream expressions for physparam::iswmode .
+!    - General two-stream expressions.
 !    - Compute homogeneous reflectance and transmittance for both
 !      conservative and non-conservative scattering.
 !    - Pre-delta-scaling clear and cloudy direct beam transmittance.
@@ -2717,7 +2661,7 @@ subroutine spcvrtc                                                &
           zasy3 = 0.75 * zasy1
 
 !>  - Perform general two-stream expressions:
-!!\n  control parameters in module "physparam"                             
+!!\n  control parameters provided by host-model                             
 !!\n    iswmode - control flag for 2-stream transfer schemes               
 !!\n              = 1 delta-eddington    (joseph et al., 1976)             
 !!\n              = 2 pifm               (zdunkowski et al., 1980)         
@@ -2911,7 +2855,7 @@ subroutine spcvrtc                                                &
 !!    transmittance.
 !    - Set up toa direct beam and surface values (beam and diff)
 !    - Delta scaling for total-sky condition
-!    - General two-stream expressions for physparam::iswmode
+!    - General two-stream expressions
 !    - Compute homogeneous reflectance and transmittance for
 !      conservative scattering and non-conservative scattering
 !    - Pre-delta-scaling clear and cloudy direct beam transmittance
@@ -2946,7 +2890,7 @@ subroutine spcvrtc                                                &
               zasy3 = 0.75 * zasy1
 
 !>  - Perform general two-stream expressions:
-!!\n  control parameters in module "physparam"
+!!\n  control parameters provided by host-model
 !!\n    iswmode - control flag for 2-stream transfer schemes
 !!\n              = 1 delta-eddington    (joseph et al., 1976)
 !!\n              = 2 pifm               (zdunkowski et al., 1980)
@@ -3273,7 +3217,7 @@ end subroutine spcvrtc
       subroutine spcvrtm                                                &
      &     ( ssolar,cosz,sntz,albbm,albdf,sfluxzen,cldfmc,              &   !  ---  inputs
      &       cf1,cf0,taug,taur,tauae,ssaae,asyae,taucw,ssacw,asycw,     &
-     &       nlay, nlp1,                                                &
+     &       nlay, nlp1, iswmode,                                       &
      &       fxupc,fxdnc,fxup0,fxdn0,                                   &   !  ---  outputs
      &       ftoauc,ftoau0,ftoadc,fsfcuc,fsfcu0,fsfcdc,fsfcd0,          &
      &       sfbmc,sfdfc,sfbm0,sfdf0,suvbfc,suvbf0                      &
@@ -3309,6 +3253,10 @@ subroutine spcvrtm                                                &
 !    ssacw   - real, weighted cloud single scat albedo       nlay*nbdsw !
 !    asycw   - real, weighted cloud asymmetry factor         nlay*nbdsw !
 !    nlay,nlp1 - integer,  number of layers/levels                 1    !
+!    iswmode - control flag for 2-stream transfer schemes               !
+!              = 1 delta-eddington    (joseph et al., 1976)             !
+!              = 2 pifm               (zdunkowski et al., 1980)         !
+!              = 3 discrete ordinates (liou, 1973)                      ! 
 !                                                                       !
 !  output variables:                                                    !
 !    fxupc   - real, tot sky upward flux                     nlp1*nbdsw !
@@ -3337,12 +3285,6 @@ subroutine spcvrtm                                                &
 !    zldbt   - real, layer beam transmittance for clear/cloudy    nlp1  !
 !    ztdbt   - real, lev total beam transmittance for clr/cld     nlp1  !
 !                                                                       !
-!  control parameters in module "physparam"                             !
-!    iswmode - control flag for 2-stream transfer schemes               !
-!              = 1 delta-eddington    (joseph et al., 1976)             !
-!              = 2 pifm               (zdunkowski et al., 1980)         !
-!              = 3 discrete ordinates (liou, 1973)                      !
-!                                                                       !
 !  *******************************************************************  !
 !  original code description                                            !
 !                                                                       !
@@ -3378,7 +3320,7 @@ subroutine spcvrtm                                                &
       real (kind=kind_phys), parameter :: eps1  = 1.0e-8
 
 !  ---  inputs:
-      integer, intent(in) :: nlay, nlp1
+      integer, intent(in) :: nlay, nlp1, iswmode
 
       real (kind=kind_phys), dimension(nlay,ngptsw), intent(in) ::      &
      &       taug, taur, cldfmc
@@ -3482,7 +3424,7 @@ subroutine spcvrtm                                                &
 !!    transmittance.
 !    - Set up toa direct beam and surface values (beam and diff)
 !    - Delta scaling for clear-sky condition
-!    - General two-stream expressions for physparam::iswmode
+!    - General two-stream expressions
 !    - Compute homogeneous reflectance and transmittance for both
 !      conservative and non-conservative scattering
 !    - Pre-delta-scaling clear and cloudy direct beam transmittance
@@ -3513,7 +3455,7 @@ subroutine spcvrtm                                                &
           zasy3 = 0.75 * zasy1
 
 !>  - Perform general two-stream expressions:
-!!\n control parameters in module "physparam" 
+!!\n control parameters provided by host-model 
 !!\n iswmode - control flag for 2-stream transfer schemes 
 !!\n           = 1 delta-eddington (joseph et al., 1976) 
 !!\n           = 2 pifm (zdunkowski et al., 1980) 
@@ -3706,7 +3648,7 @@ subroutine spcvrtm                                                &
 !!    transmittance.
 !    - Set up toa direct beam and surface values (beam and diff)
 !    - Delta scaling for total-sky condition
-!    - General two-stream expressions for physparam::iswmode
+!    - General two-stream expressions
 !    - Compute homogeneous reflectance and transmittance for
 !      conservative scattering and non-conservative scattering
 !    - Pre-delta-scaling clear and cloudy direct beam transmittance
diff --git a/physics/radsw_main.meta b/physics/radsw_main.meta
index 506e2edf0..222f3ce9e 100644
--- a/physics/radsw_main.meta
+++ b/physics/radsw_main.meta
@@ -1,7 +1,7 @@
 [ccpp-table-properties]
   name = rrtmg_sw
   type = scheme
-  dependencies = machine.F,mersenne_twister.f,physcons.F90,physparam.f,radsw_datatb.f,radsw_param.f
+  dependencies = machine.F,mersenne_twister.f,physcons.F90,radsw_datatb.f,radsw_param.f
 
 ########################################################################
 [ccpp-arg-table]
@@ -280,6 +280,55 @@
   dimensions = ()
   type = logical
   intent = in
+[inc_minor_gas]
+  standard_name = flag_to_include_minor_gases_in_rrtmg
+  long_name = flag to include minor trace gases in rrtmg
+  units = flag
+  dimensions = ()
+  type = logical
+  intent = in
+[top_at_1]
+  standard_name = flag_for_vertical_ordering_in_RRTMGP
+  long_name = flag for vertical ordering in RRTMGP
+  units = flag
+  dimensions = ()
+  type = logical
+  intent = in
+[iswcice]
+  standard_name = flag_for_rrtmg_sw_ice_cloud_optics
+  long_name = flag for rrtmg shortwave ice cloud optics
+  units = flag
+  dimensions =  ()
+  type = integer
+  intent = in
+[iswcliq]
+  standard_name = flag_for_rrtmg_sw_cloud_optics
+  long_name = flag for rrtmg shortwave cloud optics
+  units = flag
+  dimensions =  ()
+  type = integer
+  intent = in
+[isubcsw]
+  standard_name = flag_for_sw_clouds_grid_approximation
+  long_name = flag for sw clouds sub-grid approximation
+  units = flag
+  dimensions = ()
+  type = integer
+  intent = in
+[iovr]
+  standard_name = flag_for_cloud_overlap_method_for_radiation
+  long_name = max-random overlap clouds
+  units = flag
+  dimensions = ()
+  type = integer
+  intent = in
+[iswmode]
+  standard_name = flag_for_sw_scattering_choice
+  long_name = flag for rrtmg shortwave scattering choice
+  units = flag
+  dimensions = ()
+  type = integer
+  intent = in
 [cld_cf]
   standard_name = total_cloud_fraction
   long_name = total cloud fraction
diff --git a/physics/radsw_param.f b/physics/radsw_param.f
index 69c8c2446..2086f5df8 100644
--- a/physics/radsw_param.f
+++ b/physics/radsw_param.f
@@ -66,7 +66,7 @@ module module_radsw_parameters     !
 !! \htmlinclude module_radsw_parameters.html
 !!
 
-      use physparam,                only : kind_phys
+      use machine,                only : kind_phys
 
       implicit   none
 !

From 98cf6d2e6b68e4717f6e56889c6e7b0fd41ad7dd Mon Sep 17 00:00:00 2001
From: Dustin Swales <dustin.swales@noaa.gov>
Date: Thu, 18 Aug 2022 16:29:01 -0600
Subject: [PATCH 014/115] Adios physparam.f

---
 physics/GFS_cloud_diagnostics.F90    |  21 +-
 physics/GFS_cloud_diagnostics.meta   |  22 ++
 physics/GFS_rad_time_vary.fv3.F90    |   8 +-
 physics/GFS_rad_time_vary.fv3.meta   |  16 +-
 physics/GFS_rad_time_vary.scm.F90    |   8 +-
 physics/GFS_rad_time_vary.scm.meta   |  16 +-
 physics/GFS_rrtmg_pre.F90            |  38 +--
 physics/GFS_rrtmg_pre.meta           |  59 ++++
 physics/GFS_rrtmg_setup.F90          | 341 +++-------------------
 physics/GFS_rrtmg_setup.meta         |  15 +-
 physics/GFS_rrtmgp_cloud_overlap.F90 |   1 -
 physics/GFS_rrtmgp_setup.F90         |  20 +-
 physics/GFS_rrtmgp_setup.meta        |   2 +-
 physics/physparam.f                  | 214 --------------
 physics/radiation_clouds.f           | 415 +++++++++++----------------
 physics/radiation_gases.f            |   2 +-
 physics/radlw_main.meta              |   2 +-
 17 files changed, 368 insertions(+), 832 deletions(-)
 delete mode 100644 physics/physparam.f

diff --git a/physics/GFS_cloud_diagnostics.F90 b/physics/GFS_cloud_diagnostics.F90
index 01ecd7452..49cb992de 100644
--- a/physics/GFS_cloud_diagnostics.F90
+++ b/physics/GFS_cloud_diagnostics.F90
@@ -18,10 +18,6 @@ module GFS_cloud_diagnostics
                       
   ! Version tag and last revision date
   character(40), parameter :: VTAGCLD='UFS-cloud-diagnostics    vX.x May 2020 '
-  
-  ! Module variables
-  integer :: &
-       llyr    = 2            ! Upper limit of boundary layer clouds
      
   public GFS_cloud_diagnostics_run
 
@@ -35,10 +31,10 @@ module GFS_cloud_diagnostics
 !> \section arg_table_GFS_cloud_diagnostics_run
 !! \htmlinclude GFS_cloud_diagnostics_run.html
 !!  
-  subroutine GFS_cloud_diagnostics_run(nCol, nLev, iovr_rand, iovr_maxrand, iovr_max,    & 
-       iovr_dcorr, iovr_exp, iovr_exprand, lsswr, lslwr, lat, de_lgth, p_lay,            &
+  subroutine GFS_cloud_diagnostics_run(nCol, nLev, iovr, iovr_rand, iovr_maxrand,        &
+       iovr_max, iovr_dcorr, iovr_exp, iovr_exprand, lsswr, lslwr, lat, de_lgth, p_lay,  &
        cld_frac, p_lev, deltaZ, cloud_overlap_param, precip_overlap_param, con_pi,       &
-       mtopa, mbota, cldsa, errmsg, errflg)
+       top_at_1, si, mtopa, mbota, cldsa, errmsg, errflg)
     implicit none
      
     ! Inputs 
@@ -46,6 +42,7 @@ subroutine GFS_cloud_diagnostics_run(nCol, nLev, iovr_rand, iovr_maxrand, iovr_m
          nCol,                             & ! Number of horizontal grid-points
          nLev                                ! Number of vertical-layers
     integer, intent(in) ::                 &
+         iovr,                             & !
          iovr_rand,                        & ! Flag for random cloud overlap method
          iovr_maxrand,                     & ! Flag for maximum-random cloud overlap method
          iovr_max,                         & ! Flag for maximum cloud overlap method
@@ -54,12 +51,14 @@ subroutine GFS_cloud_diagnostics_run(nCol, nLev, iovr_rand, iovr_maxrand, iovr_m
          iovr_exprand                        ! Flag for exponential-random cloud overlap method
     logical, intent(in) :: &
     	 lsswr,                            & ! Call SW radiation?
-    	 lslwr                               ! Call LW radiation 
+    	 lslwr,                            & ! Call LW radiation 
+         top_at_1
     real(kind_phys), intent(in) ::         &
          con_pi                              ! Physical constant: pi  
     real(kind_phys), dimension(:), intent(in) ::   &
          lat,                                      & ! Latitude       
-         de_lgth                                     ! Decorrelation length     
+         de_lgth,                                  & ! Decorrelation length     
+         si
     real(kind_phys), dimension(:,:), intent(in) :: &
          p_lay,                                    & ! Pressure at model-layer
          cld_frac                                    ! Total cloud fraction
@@ -110,8 +109,8 @@ subroutine GFS_cloud_diagnostics_run(nCol, nLev, iovr_rand, iovr_maxrand, iovr_m
     ! defined by ptopc. The cloud overlapping method is defined by control flag 'iovr', which may
     ! be different for lw and sw radiation programs.
     call gethml(p_lay*0.01, ptop1, cld_frac, cldcnv, deltaZ, de_lgth, cloud_overlap_param,&
-         nCol, nLev, iovr_rand, iovr_maxrand, iovr_max, iovr_dcorr, iovr_exp,             &
-         iovr_exprand, cldsa, mtopa, mbota)	
+         nCol, nLev, iovr, iovr_rand, iovr_maxrand, iovr_max, iovr_dcorr, iovr_exp,       &
+         iovr_exprand, top_at_1, si, cldsa, mtopa, mbota)
     
   end subroutine GFS_cloud_diagnostics_run
 !> @}
diff --git a/physics/GFS_cloud_diagnostics.meta b/physics/GFS_cloud_diagnostics.meta
index ded38a1e7..2408397d6 100644
--- a/physics/GFS_cloud_diagnostics.meta
+++ b/physics/GFS_cloud_diagnostics.meta
@@ -21,6 +21,13 @@
   dimensions = ()
   type = integer
   intent = in
+[iovr]
+  standard_name = flag_for_cloud_overlap_method_for_radiation
+  long_name = max-random overlap clouds
+  units = flag
+  dimensions = ()
+  type = integer
+  intent = in
 [iovr_rand]
   standard_name = flag_for_random_cloud_overlap_method
   long_name = choice of random cloud overlap method
@@ -149,6 +156,21 @@
   type = real
   kind = kind_phys
   intent = in
+[top_at_1]
+  standard_name = flag_for_vertical_ordering_in_RRTMGP
+  long_name = flag for vertical ordering in RRTMGP
+  units = flag
+  dimensions = ()
+  type = logical
+  intent = in
+[si]
+  standard_name = sigma_pressure_hybrid_vertical_coordinate
+  long_name = vertical sigma coordinate for radiation initialization
+  units = none
+  dimensions = (vertical_interface_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
 [mtopa]
   standard_name = model_layer_number_at_cloud_top
   long_name = vertical indices for low, middle and high cloud tops
diff --git a/physics/GFS_rad_time_vary.fv3.F90 b/physics/GFS_rad_time_vary.fv3.F90
index 61685e74f..c2f3540a6 100644
--- a/physics/GFS_rad_time_vary.fv3.F90
+++ b/physics/GFS_rad_time_vary.fv3.F90
@@ -18,10 +18,10 @@ module GFS_rad_time_vary
 !!
       subroutine GFS_rad_time_vary_timestep_init (                                     &
               lslwr, lsswr, isubc_lw, isubc_sw, icsdsw, icsdlw, cnx, cny, isc, jsc,    &
-              imap, jmap, sec, kdt, imp_physics, imp_physics_zhao_carr, ps_2delt,      &
-              ps_1delt, t_2delt, t_1delt, qv_2delt, qv_1delt, t, qv, ps, errmsg, errflg)
+              imap, jmap, sec, kdt, imp_physics, imp_physics_zhao_carr, ipsd0, ipsdlim,&
+              ps_2delt, ps_1delt, t_2delt, t_1delt, qv_2delt, qv_1delt, t, qv, ps,     &
+              errmsg, errflg)
 
-         use physparam,                 only: ipsd0, ipsdlim
          use mersenne_twister,          only: random_setseed, random_index, random_stat
          use machine,                   only: kind_phys
          use radcons,                   only: qmin, con_100
@@ -30,7 +30,7 @@ subroutine GFS_rad_time_vary_timestep_init (
 
          ! Interface variables
          integer,                intent(in)    :: isubc_lw, isubc_sw, cnx, cny, isc, jsc, kdt
-         integer,                intent(in)    :: imp_physics, imp_physics_zhao_carr
+         integer,                intent(in)    :: imp_physics, imp_physics_zhao_carr, ipsd0, ipsdlim
          logical,                intent(in)    :: lslwr, lsswr
          integer,                intent(inout) :: icsdsw(:), icsdlw(:)
          integer,                intent(in)    :: imap(:), jmap(:)
diff --git a/physics/GFS_rad_time_vary.fv3.meta b/physics/GFS_rad_time_vary.fv3.meta
index 0e7c7c024..561b2ade0 100644
--- a/physics/GFS_rad_time_vary.fv3.meta
+++ b/physics/GFS_rad_time_vary.fv3.meta
@@ -1,7 +1,7 @@
 [ccpp-table-properties]
   name = GFS_rad_time_vary
   type = scheme
-  dependencies = machine.F,mersenne_twister.f,physparam.f,radcons.f90
+  dependencies = machine.F,mersenne_twister.f,radcons.f90
 
 ########################################################################
 [ccpp-arg-table]
@@ -120,6 +120,20 @@
   dimensions = ()
   type = integer
   intent = in
+[ipsd0]
+  standard_name = initial_seed_for_mcica
+  long_name = initial permutaion seed for mcica radiation
+  units = none
+  dimensions =  ()
+  type = integer
+  intent = in
+[ipsdlim]
+  standard_name = limit_for_initial_seed_for_mcica
+  long_name = limit for initial permutaion seed for mcica radiation
+  units = none
+  dimensions =  ()
+  type = integer
+  intent = in
 [ps_2delt]
   standard_name = surface_air_pressure_two_timesteps_back
   long_name = surface air pressure two timesteps back
diff --git a/physics/GFS_rad_time_vary.scm.F90 b/physics/GFS_rad_time_vary.scm.F90
index db1e7e290..c8e782ebb 100644
--- a/physics/GFS_rad_time_vary.scm.F90
+++ b/physics/GFS_rad_time_vary.scm.F90
@@ -17,10 +17,10 @@ module GFS_rad_time_vary
 !!
       subroutine GFS_rad_time_vary_timestep_init (                                     &
               lslwr, lsswr, isubc_lw, isubc_sw, icsdsw, icsdlw, cnx, cny, isc, jsc,    &
-              imap, jmap, sec, kdt, imp_physics, imp_physics_zhao_carr, ps_2delt,      &
-              ps_1delt, t_2delt, t_1delt, qv_2delt, qv_1delt, t, qv, ps, errmsg, errflg)
+              imap, jmap, sec, kdt, imp_physics, imp_physics_zhao_carr, ipsd0, ipsdlim,&
+              ps_2delt, ps_1delt, t_2delt, t_1delt, qv_2delt, qv_1delt, t, qv, ps,     &
+              errmsg, errflg)
 
-         use physparam,                 only: ipsd0, ipsdlim
          use mersenne_twister,          only: random_setseed, random_index, random_stat
          use machine,                   only: kind_phys
          use radcons,                   only: qmin, con_100
@@ -29,7 +29,7 @@ subroutine GFS_rad_time_vary_timestep_init (
 
          ! Interface variables
          integer,                intent(in)    :: isubc_lw, isubc_sw, cnx, cny, isc, jsc, kdt
-         integer,                intent(in)    :: imp_physics, imp_physics_zhao_carr
+         integer,                intent(in)    :: imp_physics, imp_physics_zhao_carr, ipsd0, ipsdlim
          logical,                intent(in)    :: lslwr, lsswr
          integer,                intent(inout) :: icsdsw(:), icsdlw(:)
          integer,                intent(in)    :: imap(:), jmap(:)
diff --git a/physics/GFS_rad_time_vary.scm.meta b/physics/GFS_rad_time_vary.scm.meta
index 0e7c7c024..561b2ade0 100644
--- a/physics/GFS_rad_time_vary.scm.meta
+++ b/physics/GFS_rad_time_vary.scm.meta
@@ -1,7 +1,7 @@
 [ccpp-table-properties]
   name = GFS_rad_time_vary
   type = scheme
-  dependencies = machine.F,mersenne_twister.f,physparam.f,radcons.f90
+  dependencies = machine.F,mersenne_twister.f,radcons.f90
 
 ########################################################################
 [ccpp-arg-table]
@@ -120,6 +120,20 @@
   dimensions = ()
   type = integer
   intent = in
+[ipsd0]
+  standard_name = initial_seed_for_mcica
+  long_name = initial permutaion seed for mcica radiation
+  units = none
+  dimensions =  ()
+  type = integer
+  intent = in
+[ipsdlim]
+  standard_name = limit_for_initial_seed_for_mcica
+  long_name = limit for initial permutaion seed for mcica radiation
+  units = none
+  dimensions =  ()
+  type = integer
+  intent = in
 [ps_2delt]
   standard_name = surface_air_pressure_two_timesteps_back
   long_name = surface air pressure two timesteps back
diff --git a/physics/GFS_rrtmg_pre.F90 b/physics/GFS_rrtmg_pre.F90
index 57e0b4347..9de3cb16c 100644
--- a/physics/GFS_rrtmg_pre.F90
+++ b/physics/GFS_rrtmg_pre.F90
@@ -27,15 +27,15 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp,        &
         imp_physics,imp_physics_nssl, nssl_ccn_on, nssl_invertccn,             &
         imp_physics_thompson, imp_physics_gfdl, imp_physics_zhao_carr,         &
         imp_physics_zhao_carr_pdf, imp_physics_mg, imp_physics_wsm6,           &
-        imp_physics_fer_hires, iovr_rand, iovr_maxrand, iovr_max, iovr_dcorr,  &
-        iovr_exp, iovr_exprand, idcor_con, idcor_hogan, idcor_oreopoulos,      & 
-        julian, yearlen, lndp_var_list, lsswr, lslwr,                          &
-        ltaerosol, lgfdlmprad, uni_cld, effr_in, do_mynnedmf, lmfshal,         &
-        lmfdeep2, fhswr, fhlwr, solhr, sup, con_eps, epsm1, fvirt,             &
-        rog, rocp, con_rd, xlat_d, xlat, xlon, coslat, sinlat, tsfc, slmsk,    &
-        prsi, prsl, prslk, tgrs, sfc_wts, mg_cld, effrr_in, pert_clds,         &
+        imp_physics_fer_hires, iovr, iovr_rand, iovr_maxrand, iovr_max,        &
+        iovr_dcorr, iovr_exp, iovr_exprand, idcor, idcor_con, idcor_hogan,     &
+        idcor_oreopoulos, dcorr_con, julian, yearlen, lndp_var_list, lsswr,    &
+        lslwr, ltaerosol, lgfdlmprad, uni_cld, effr_in, do_mynnedmf, lmfshal,  &
+        lcnorm, lmfdeep2, lcrick, fhswr, fhlwr, solhr, sup, con_eps, epsm1,    &
+        fvirt, rog, rocp, con_rd, xlat_d, xlat, xlon, coslat, sinlat, tsfc,    &
+        slmsk, prsi, prsl, prslk, tgrs, sfc_wts, mg_cld, effrr_in, pert_clds,  &
         sppt_wts, sppt_amp, cnvw_in, cnvc_in, qgrs, aer_nm, dx, icloud,        & 
-        iaermdl, iaerflg, con_pi, con_g,                                       & !inputs from here and above
+        iaermdl, iaerflg, con_pi, con_g, con_ttp, con_thgni, si,               & !inputs from here and above
         coszen, coszdg, effrl_inout, effri_inout, effrs_inout,                 &
         clouds1, clouds2, clouds3, clouds4, clouds5, qci_conv,                 & !in/out from here and above
         kd, kt, kb, mtopa, mbota, raddt, tsfg, tsfa, de_lgth, alb1d, delp, dz, & !output from here and below
@@ -102,6 +102,7 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp,        &
                                            yearlen, icloud, iaermdl, iaerflg
 
       integer,              intent(in)  ::                                     &
+         iovr,                             & ! choice of cloud-overlap method
          iovr_rand,                        & ! Flag for random cloud overlap method
          iovr_maxrand,                     & ! Flag for maximum-random cloud overlap method
          iovr_max,                         & ! Flag for maximum cloud overlap method
@@ -109,6 +110,7 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp,        &
          iovr_exp,                         & ! Flag for exponential cloud overlap method
          iovr_exprand,                     & ! Flag for exponential-random cloud overlap method
          idcor_con,                        &
+         idcor,                            &
          idcor_hogan,                      &
          idcor_oreopoulos,                 &
          rrfs_smoke_band,                  & ! Band number for rrfs-smoke dust and smoke
@@ -121,7 +123,8 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp,        &
 
       logical,              intent(in) :: lsswr, lslwr, ltaerosol, lgfdlmprad, &
                                           uni_cld, effr_in, do_mynnedmf,       &
-                                          lmfshal, lmfdeep2, pert_clds
+                                          lmfshal, lmfdeep2, pert_clds, lcrick,&
+                                          lcnorm
       logical,              intent(in) :: aero_dir_fdb
       real(kind=kind_phys), dimension(:,:), intent(in) :: smoke_ext, dust_ext
 
@@ -129,12 +132,12 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp,        &
       integer,              intent(in) :: spp_rad
       real(kind_phys),      intent(in) :: spp_wts_rad(:,:)
 
-      real(kind=kind_phys), intent(in) :: fhswr, fhlwr, solhr, sup, julian, sppt_amp
-      real(kind=kind_phys), intent(in) :: con_eps, epsm1, fvirt, rog, rocp, con_rd, con_pi, con_g
+      real(kind=kind_phys), intent(in) :: fhswr, fhlwr, solhr, sup, julian, sppt_amp, dcorr_con
+      real(kind=kind_phys), intent(in) :: con_eps, epsm1, fvirt, rog, rocp, con_rd, con_pi, con_g, con_ttp, con_thgni
 
       real(kind=kind_phys), dimension(:), intent(in) :: xlat_d, xlat, xlon,    &
                                                         coslat, sinlat, tsfc,  &
-                                                        slmsk, dx
+                                                        slmsk, dx, si
 
       real(kind=kind_phys), dimension(:,:), intent(in) :: prsi, prsl, prslk,   &
                                                           tgrs, sfc_wts,       &
@@ -951,20 +954,21 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp,        &
      &     ( plyr, plvl, tlyr, tvly, qlyr, qstl, rhly,                  &    !  ---  inputs:
      &       ccnd, ncndl, cnvw, cnvc, tracer1,                          &
      &       xlat, xlon, slmsk, dz, delp, IM, LM, LMK, LMP,             &
-     &       deltaq, sup, me, icloud, kdt,                              &
+     &       deltaq, sup, dcorr_con, me, icloud, kdt,                   &
      &       ntrac, ntcw, ntiw, ntrw, ntsw, ntgl, ntclamt,              &
      &       imp_physics, imp_physics_nssl, imp_physics_fer_hires,      &
      &       imp_physics_gfdl, imp_physics_thompson, imp_physics_wsm6,  &
      &       imp_physics_zhao_carr, imp_physics_zhao_carr_pdf,          &
-     &       imp_physics_mg, iovr_rand, iovr_maxrand, iovr_max,         &
-     &       iovr_dcorr, iovr_exp, iovr_exprand, idcor_con,             &
-     &       idcor_hogan, idcor_oreopoulos,                             &
+     &       imp_physics_mg, iovr, iovr_rand, iovr_maxrand, iovr_max,   &
+     &       iovr_dcorr, iovr_exp, iovr_exprand, idcor, idcor_con,      &
+     &       idcor_hogan, idcor_oreopoulos, lcrick, lcnorm,             &
      &       imfdeepcnv, imfdeepcnv_gf, do_mynnedmf, lgfdlmprad,        &
      &       uni_cld, lmfshal, lmfdeep2, cldcov, clouds1,               &
      &       effrl, effri, effrr, effrs, effr_in,                       &
      &       effrl_inout, effri_inout, effrs_inout,                     &
      &       lwp_ex, iwp_ex, lwp_fc, iwp_fc,                            &
-     &       dzb, xlat_d, julian, yearlen, gridkm,                      &
+     &       dzb, xlat_d, julian, yearlen, gridkm, top_at_1, si,        &
+     &       con_ttp, con_pi, con_g, con_rd, con_thgni,                 &
      &       cld_frac, cld_lwp, cld_reliq, cld_iwp, cld_reice,          &    !  ---  outputs:
      &       cld_rwp, cld_rerain, cld_swp, cld_resnow,                  &    !  ---  outputs:
      &       cldsa, mtopa, mbota, de_lgth, alpha                        &    !  ---  outputs:
diff --git a/physics/GFS_rrtmg_pre.meta b/physics/GFS_rrtmg_pre.meta
index 8fa020ec5..cb158346a 100644
--- a/physics/GFS_rrtmg_pre.meta
+++ b/physics/GFS_rrtmg_pre.meta
@@ -450,6 +450,13 @@
   dimensions = ()
   type = integer
   intent = in
+[iovr]
+  standard_name = flag_for_cloud_overlap_method_for_radiation
+  long_name = max-random overlap clouds
+  units = flag
+  dimensions = ()
+  type = integer
+  intent = in
 [iovr_rand]
   standard_name = flag_for_random_cloud_overlap_method
   long_name = choice of random cloud overlap method
@@ -492,6 +499,20 @@
   dimensions = ()
   type = integer
   intent = in
+[dcorr_con]
+  standard_name = decorrelation_length_used_by_overlap_method
+  long_name = decorrelation length (default) used by cloud overlap method (iovr)
+  units = km
+  dimensions = ()
+  type = real
+  intent = in
+[idcor]
+  standard_name = flag_for_decorrelation_length_method
+  long_name = flag for decorrelation length method used in cloud overlap method (iovr)
+  units = flag
+  dimensions = ()
+  type = integer
+  intent = in
 [idcor_con]
   standard_name = flag_for_constant_decorrelation_length_method
   long_name = choice of decorrelation length computation (costant)
@@ -599,6 +620,20 @@
   dimensions = ()
   type = logical
   intent = in
+[lcrick]
+  standard_name = flag_for_CRICK_proof_cloud_water
+  long_name = flag for CRICK-Proof cloud water
+  units = flag
+  dimensions = ()
+  type = logical
+  intent = in
+[lcnorm]
+  standard_name = flag_for_in_cloud_condensate
+  long_name = flag for cloud condensate normalized by cloud cover
+  units = flag
+  dimensions = ()
+  type = logical
+  intent = in
 [fhswr]
   standard_name = period_of_shortwave_radiation_calls
   long_name = frequency for shortwave radiation
@@ -663,6 +698,22 @@
   type = real
   kind = kind_phys
   intent = in
+[con_ttp]
+  standard_name = triple_point_temperature_of_water
+  long_name = triple point temperature of water
+  units = K
+  dimensions = ()
+  type = real
+  kind = kind_phys
+  intent = in
+[con_thgni]
+  standard_name	= temperature_ice_nucleation_starts
+  long_name = temperature the H.G.Nuc. ice starts
+  units = K
+  dimensions = ()
+  type = real
+  kind = kind_phys
+  intent = in
 [epsm1]
   standard_name = ratio_of_dry_air_to_water_vapor_gas_constants_minus_one
   long_name = (rd/rv) - 1
@@ -1343,6 +1394,14 @@
   dimensions = ()
   type = logical
   intent = out
+[si]
+  standard_name = sigma_pressure_hybrid_vertical_coordinate
+  long_name = vertical sigma coordinate for radiation initialization
+  units = none
+  dimensions = (vertical_interface_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
 [ico2]
   standard_name = control_for_co2
   long_name = prescribed global mean value (old opernl)
diff --git a/physics/GFS_rrtmg_setup.F90 b/physics/GFS_rrtmg_setup.F90
index 6891b0f24..543776e80 100644
--- a/physics/GFS_rrtmg_setup.F90
+++ b/physics/GFS_rrtmg_setup.F90
@@ -6,9 +6,6 @@
 !> @{
 module GFS_rrtmg_setup
 
-   use physparam, only : lcrick , lcnorm , lnoprec,            &
-   &             ivflip , ipsd0,                    &
-   &             iswcliq,iovrRad=>iovr
    use machine, only:  kind_phys
    use radcons, only: ltp, lextop
 
@@ -26,7 +23,7 @@ module GFS_rrtmg_setup
    !    &   VTAGRAD='NCEP-Radiation_driver    v5.1  Nov 2012 '
    !    &   VTAGRAD='NCEP-Radiation_driver    v5.0  Aug 2012 '
 
-   !> new data input control variables (set/reset in subroutines radinit/radupdate):
+   !> new data input control variables (set/reset in subroutine radupdate):
    integer :: month0 = 0
    integer :: iyear0 = 0
    integer :: monthd = 0
@@ -41,17 +38,13 @@ module GFS_rrtmg_setup
 !> \section arg_table_GFS_rrtmg_setup_init Argument Table
 !! \htmlinclude GFS_rrtmg_setup_init.html
 !!
-   subroutine GFS_rrtmg_setup_init (                          &
-          si, levr, ictm, isol, solar_file, ico2, iaer, ntcw, &
-          num_p3d, npdf3d, ntoz, iovr,                        &
-          icliq_sw, crick_proof, ccnorm,                      &
-          imp_physics,                                        &
-          norad_precip, idate, iflip,                         &
-          do_RRTMGP, me, lalw1bd, iaermdl, iaerflg,           &
-          aeros_file, con_pi, con_t0c, con_c, con_boltz,      &
-          con_plnk, con_solr_2008, con_solr_2002, co2usr_file,&
-          co2cyc_file, rad_hr_units, inc_minor_gas, ilwcliq,  &
-          iswcliq, isubcsw, isubclw, iswmode, errmsg, errflg)
+   subroutine GFS_rrtmg_setup_init ( si, levr, ictm, isol, solar_file, ico2, &
+        iaer, ntcw, num_p3d, npdf3d, ntoz, iovr, icliq_sw, lcrick, lcnorm,   &
+        imp_physics, lnoprec, idate, iflip, do_RRTMGP, me, lalw1bd, iaermdl, &
+        iaerflg, aeros_file, con_pi, con_t0c, con_c, con_boltz, con_plnk,    &
+        con_solr_2008, con_solr_2002, co2usr_file, co2cyc_file, rad_hr_units,&
+        inc_minor_gas, ilwcliq, iswcliq, isubcsw, isubclw, iswmode, ipsd0,   &
+        errmsg, errflg)
 ! =================   subprogram documentation block   ================ !
 !                                                                       !
 ! subprogram:   GFS_rrtmg_setup_init - a subprogram to initialize radiation !
@@ -133,9 +126,9 @@ subroutine GFS_rrtmg_setup_init (                          &
 !                     =0: with out sub-column cloud approximation       !
 !                     =1: mcica sub-col approx. prescribed random seed  !
 !                     =2: mcica sub-col approx. provided random seed    !
-!   crick_proof      : control flag for eliminating CRICK               !
-!   ccnorm           : control flag for in-cloud condensate mixing ratio!
-!   norad_precip     : control flag for not using precip in radiation   !
+!   lcrick           : control flag for eliminating CRICK               !
+!   lcnorm           : control flag for in-cloud condensate mixing ratio!
+!   lnoprec          : control flag for not using precip in radiation   !
 !   idate(4)         : ncep absolute date and time of initial condition !
 !                      (hour, month, day, year)                         !
 !   iflip            : control flag for direction of vertical index     !
@@ -147,34 +140,27 @@ subroutine GFS_rrtmg_setup_init (                          &
 !                                                                       !
 !  ===================================================================  !
 !
+      use module_radiation_astronomy, only : sol_init
+      use module_radiation_aerosols,  only : aer_init
+      use module_radiation_gases,     only : gas_init
+      use module_radiation_clouds,    only : cld_init
+      use rrtmg_lw,                   only : rlwinit
+      use rrtmg_sw,                   only : rswinit
       implicit none
 
       ! interface variables
       real (kind=kind_phys), intent(in) :: si(:)
-      integer, intent(in) :: levr
-      integer, intent(in) :: ictm
-      integer, intent(in) :: isol
-      integer, intent(in) :: ico2
-      integer, intent(in) :: iaer
-      integer, intent(in) :: ntcw
-      integer, intent(in) :: num_p3d
-      integer, intent(in) :: npdf3d
-      integer, intent(in) :: ntoz
-      integer, intent(in) :: iovr
-      integer, intent(in) :: icliq_sw
-      logical, intent(in) :: crick_proof
-      logical, intent(in) :: ccnorm
-      integer, intent(in) :: imp_physics
-      logical, intent(in) :: norad_precip
+      integer, intent(in) :: levr, ictm, isol, ico2, iaer, ntcw, num_p3d, &
+           npdf3d, ntoz, iovr, icliq_sw, imp_physics, iflip,  me,         &
+           rad_hr_units, ilwcliq, iswcliq, isubcsw,  isubclw, iswmode
       integer, intent(in) :: idate(:)
-      integer, intent(in) :: iflip
-      logical, intent(in) :: do_RRTMGP, lalw1bd, inc_minor_gas
-      integer, intent(in) :: me, rad_hr_units, ilwcliq, iswcliq, isubcsw,  &
-           isubclw, iswmode
+      logical, intent(in) :: lcrick, lcnorm, lnoprec, do_RRTMGP, lalw1bd, &
+           inc_minor_gas
       character(len=26),intent(in)  :: aeros_file, solar_file, co2usr_file,&
            co2cyc_file
       real(kind_phys),  intent(in)  :: con_pi, con_t0c, con_c, con_boltz,  &
            con_plnk, con_solr_2008, con_solr_2002
+      integer,          intent(inout) :: ipsd0
       character(len=*), intent(out) :: errmsg
       integer,          intent(out) :: errflg
       integer,          intent(out) :: iaermdl, iaerflg
@@ -204,12 +190,6 @@ subroutine GFS_rrtmg_setup_init (                          &
          return
       endif
 
-      iovrRAD = iovr
-      lcrick  = crick_proof             ! control flag for eliminating CRICK 
-      lcnorm  = ccnorm                  ! control flag for in-cld condensate 
-      lnoprec = norad_precip            ! precip effect on radiation flag (ferrier microphysics)
-      ivflip = iflip                    ! vertical index direction control flag
-
 !  ---  assign initial permutation seed for mcica cloud-radiation
       if ( isubcsw>0 .or. isubclw>0 ) then
 !       ipsd0 = 17*idate(1)+43*idate(2)+37*idate(3)+23*idate(4) + ipsd0
@@ -225,18 +205,19 @@ subroutine GFS_rrtmg_setup_init (                          &
      &          ' iovr=',iovr,' isubcsw=',isubcsw,                      &
      &          ' isubclw=',isubclw,' icliq_sw=',icliq_sw,              &
      &          ' iflip=',iflip,'  me=',me
-        print *,' crick_proof=',crick_proof,                            &
-     &          ' ccnorm=',ccnorm,' norad_precip=',norad_precip
+        print *,' lcrick=',lcrick,                            &
+     &          ' lcnorm=',lcnorm,' lnoprec=',lnoprec
       endif
 
-      call radinit                                                      &
-     &     ( si, levr, imp_physics, me, iaermdl, iaerflg, lalw1bd,      &
-     &       aeros_file, con_pi, con_t0c, con_c, con_boltz, con_plnk,   &
-     &       isol, solar_file, con_solr_2008, con_solr_2002,            &
-     &       co2usr_file, co2cyc_file, ico2, ictm, ntoz, rad_hr_units,  &
-     &       inc_minor_gas, ilwcliq, iswcliq, isubcsw, isubclw, iovr,   &
-     &       iswmode, errmsg, errflg )
-
+      call sol_init ( me, isol, solar_file, con_solr_2008, con_solr_2002,&
+           con_pi )                                               ! astronomy initialization routine
+      call aer_init ( levr, me, iaermdl, iaerflg, lalw1bd, aeros_file, con_pi, &
+           con_t0c, con_c, con_boltz, con_plnk, errflg, errmsg)   ! aerosols initialization routine
+      call gas_init ( me, co2usr_file, co2cyc_file, ico2, ictm, ntoz, con_pi, &
+           errflg, errmsg)                                        ! co2 and other gases initialization routine
+      call cld_init ( si, levr, imp_physics, me, errflg, errmsg)  ! cloud initialization routine
+      call rlwinit ( me, rad_hr_units, inc_minor_gas, ilwcliq, isubcsw, iovr, errflg, errmsg )           ! lw RRTMG initialization routine
+      call rswinit ( me, rad_hr_units, inc_minor_gas, iswcliq, isubclw, iovr, iswmode, errflg, errmsg )  ! sw RRTMG initialization routine
 
       if ( me == 0 ) then
         print *,'  Radiation sub-cloud initial seed =',ipsd0,           &
@@ -314,235 +295,6 @@ subroutine GFS_rrtmg_setup_finalize (errmsg, errflg)
 
    end subroutine GFS_rrtmg_setup_finalize
 
-
-! Private functions
-
-
-   subroutine radinit( si, NLAY, imp_physics, me, iaermdl, iaerflg, lalw1bd, &
-        aeros_file, con_pi, con_t0c, con_c, con_boltz, con_plnk, isol,       &
-        solar_file, con_solr_2008, con_solr_2002, co2usr_file, co2cyc_file,  &
-        ico2, ictm, rad_hr_units, ntoz, inc_minor_gas, ilwcliq, iswcliq,     &
-        isubcsw, isubclw, iovr, iswmode, errmsg, errflg)
-!...................................
-
-!  ---  inputs:
-!     &     ( si, NLAY, imp_physics, me, iaermdl, iaerflg)
-!  ---  outputs:
-!          ( errmsg, errflg )
-
-! =================   subprogram documentation block   ================ !
-!                                                                       !
-! subprogram:   radinit     initialization of radiation calculations    !
-!                                                                       !
-! usage:        call radinit                                            !
-!                                                                       !
-! attributes:                                                           !
-!   language:  fortran 90                                               !
-!   machine:   wcoss                                                    !
-!                                                                       !
-!  ====================  definition of variables  ====================  !
-!                                                                       !
-! input parameters:                                                     !
-!   si               : model vertical sigma interface                   !
-!   NLAY             : number of model vertical layers                  !
-!   imp_physics      : MP identifier                                    !
-!   me               : print control flag                               !
-!                                                                       !
-!  outputs: (none)                                                      !
-!                                                                       !
-!  external module variables:  (in module physparam)                     !
-!   isolar   : solar constant cntrol flag                               !
-!              = 0: use the old fixed solar constant in "physcon"       !
-!              =10: use the new fixed solar constant in "physcon"       !
-!              = 1: use noaa ann-mean tsi tbl abs-scale with cycle apprx!
-!              = 2: use noaa ann-mean tsi tbl tim-scale with cycle apprx!
-!              = 3: use cmip5 ann-mean tsi tbl tim-scale with cycl apprx!
-!              = 4: use cmip5 mon-mean tsi tbl tim-scale with cycl apprx!
-!   iaerflg  : 3-digit aerosol flag (abc for volc, lw, sw)              !
-!              a:=0 use background stratospheric aerosol                !
-!                =1 include stratospheric vocanic aeros                 !
-!              b:=0 no topospheric aerosol in lw radiation              !
-!                =1 compute tropspheric aero in 1 broad band for lw     !
-!                =2 compute tropspheric aero in multi bands for lw      !
-!              c:=0 no topospheric aerosol in sw radiation              !
-!                =1 include tropspheric aerosols for sw                 !
-!   ico2     : co2 data source control flag                             !
-!              =0: use prescribed global mean co2 (old  oper)           !
-!              =1: use observed co2 annual mean value only              !
-!              =2: use obs co2 monthly data with 2-d variation          !
-!   ictm     : =yyyy#, external data ic time/date control flag          !
-!              =   -2: same as 0, but superimpose seasonal cycle        !
-!                      from climatology data set.                       !
-!              =   -1: use user provided external data for the          !
-!                      forecast time, no extrapolation.                 !
-!              =    0: use data at initial cond time, if not            !
-!                      available, use latest, no extrapolation.         !
-!              =    1: use data at the forecast time, if not            !
-!                      available, use latest and extrapolation.         !
-!              =yyyy0: use yyyy data for the forecast time,             !
-!                      no further data extrapolation.                   !
-!              =yyyy1: use yyyy data for the fcst. if needed, do        !
-!                      extrapolation to match the fcst time.            !
-!   ioznflg  : ozone data source control flag                           !
-!              =0: use climatological ozone profile                     !
-!              =1: use interactive ozone profile                        !
-!   imp_physics  : cloud microphysics scheme control flag               !
-!              =99 zhao/carr/sundqvist microphysics scheme              !
-!              =98 zhao/carr/sundqvist microphysics+pdf cloud&cnvc,cnvw !
-!              =11 GFDL cloud microphysics                              !
-!              =8 Thompson microphysics scheme                          !
-!              =6 WSM6 microphysics scheme                              !
-!              =10 MG microphysics scheme                               !
-!   iovr     : control flag for cloud overlap in radiation              !
-!              =0: random overlapping clouds                            !
-!              =1: max/ran overlapping clouds                           !
-!   isubcsw  : sub-column cloud approx control flag in sw radiation     !
-!   isubclw  : sub-column cloud approx control flag in lw radiation     !
-!              =0: with out sub-column cloud approximation              !
-!              =1: mcica sub-col approx. prescribed random seed         !
-!              =2: mcica sub-col approx. provided random seed           !
-!   lcrick   : control flag for eliminating CRICK                       !
-!              =t: apply layer smoothing to eliminate CRICK             !
-!              =f: do not apply layer smoothing                         !
-!   lcnorm   : control flag for in-cld condensate                       !
-!              =t: normalize cloud condensate                           !
-!              =f: not normalize cloud condensate                       !
-!   lnoprec  : precip effect in radiation flag (ferrier microphysics)   !
-!              =t: snow/rain has no impact on radiation                 !
-!              =f: snow/rain has impact on radiation                    !
-!   ivflip   : vertical index direction control flag                    !
-!              =0: index from toa to surface                            !
-!              =1: index from surface to toa                            !
-!                                                                       !
-!  subroutines called: sol_init, aer_init, gas_init, cld_init,          !
-!                      rlwinit, rswinit                                 !
-!                                                                       !
-!  usage:       call radinit                                            !
-!                                                                       !
-!  ===================================================================  !
-!
-
-      use module_radiation_astronomy, only : sol_init
-      use module_radiation_aerosols,  only : aer_init
-      use module_radiation_gases,     only : gas_init
-      use module_radiation_clouds,    only : cld_init
-      use rrtmg_lw,                   only : rlwinit
-      use rrtmg_sw,                   only : rswinit
-
-      implicit none
-
-!  ---  inputs:
-      integer, intent(in) :: NLAY, me, imp_physics, iaermdl, iaerflg,    &
-           isol, ico2, ictm, ntoz, rad_hr_units, ilwcliq, iswcliq, isubcsw,&
-           isubclw, iovr, iswmode
-      logical, intent(in) :: lalw1bd, inc_minor_gas
-      real (kind=kind_phys), intent(in) :: si(:), con_pi,con_t0c, con_c, &
-           con_boltz, con_plnk, con_solr_2008, con_solr_2002
-      character(len=26), intent(in) :: aeros_file, solar_file,co2usr_file, co2cyc_file
-
-!  ---  outputs: (ccpp error handling)
-      character(len=*),     intent(out) :: errmsg
-      integer,              intent(out) :: errflg
-!  ---  locals:
-
-!
-!===> ...  begin here
-!
-!> -# Set up control variables and external module variables in
-!!    module physparam
-      loz1st = (ntoz == 0)           ! first-time clim ozone data read flag
-      month0 = 0
-      iyear0 = 0
-      monthd = 0
-
-      if (me == 0) then
-!       print *,' NEW RADIATION PROGRAM STRUCTURES -- SEP 01 2004'
-        print *,' NEW RADIATION PROGRAM STRUCTURES BECAME OPER. ',      &
-     &          '  May 01 2007'
-        print *, VTAGRAD                !print out version tag
-        print *,' - Selected Control Flag settings: ICTMflg=',ictm,     &
-     &    ' ISOLar =',isol, ' ICO2flg=',ico2,' IAERflg=',iaerflg,       &
-     &    ' IMP_PHYSICS=',imp_physics,' IOZNflg=',ntoz
-        print *,' IVFLIP=',ivflip,' IOVR=',iovr,                        &
-     &    ' ISUBCSW=',isubcsw,' ISUBCLW=',isubclw
-        print *,' LCRICK=',lcrick,' LCNORM=',lcnorm,' LNOPREC=',lnoprec
-        print *,' LTP =',ltp,', add extra top layer =',lextop
-
-        if ( ictm==0 .or. ictm==-2 ) then
-          print *,'   Data usage is limited by initial condition!'
-          print *,'   No volcanic aerosols'
-        endif
-
-        if ( isubclw == 0 ) then
-          print *,' - ISUBCLW=',isubclw,' No McICA, use grid ',         &
-     &            'averaged cloud in LW radiation'
-        elseif ( isubclw == 1 ) then
-          print *,' - ISUBCLW=',isubclw,' Use McICA with fixed ',       &
-     &            'permutation seeds for LW random number generator'
-        elseif ( isubclw == 2 ) then
-          print *,' - ISUBCLW=',isubclw,' Use McICA with random ',      &
-     &            'permutation seeds for LW random number generator'
-        else
-          print *,' - ERROR!!! ISUBCLW=',isubclw,' is not a ',          &
-     &            'valid option '
-          errflg = 1
-          errmsg = 'ERROR(GFS_rrtmg_setup): ISUBCLW flag is invalid'
-          return
-        endif
-
-        if ( isubcsw == 0 ) then
-          print *,' - ISUBCSW=',isubcsw,' No McICA, use grid ',         &
-     &            'averaged cloud in SW radiation'
-        elseif ( isubcsw == 1 ) then
-          print *,' - ISUBCSW=',isubcsw,' Use McICA with fixed ',       &
-     &            'permutation seeds for SW random number generator'
-        elseif ( isubcsw == 2 ) then
-          print *,' - ISUBCSW=',isubcsw,' Use McICA with random ',      &
-     &            'permutation seeds for SW random number generator'
-        else
-          print *,' - ERROR!!! ISUBCSW=',isubcsw,' is not a ',          &
-     &            'valid option '
-          errflg = 1
-          errmsg = 'ERROR(GFS_rrtmg_setup): ISUBCSW flag is invalid'
-          return
-        endif
-
-        if ( isubcsw /= isubclw ) then
-          print *,' - *** Notice *** ISUBCSW /= ISUBCLW !!!',           &
-     &            isubcsw, isubclw
-        endif
-      endif
-
-!> -# Initialization
-!! - astronomy initialization routine:
-!! call module_radiation_astronomy::sol_init()
-!! - aerosols initialization routine:
-!! call module_radiation_aerosols::aer_init()
-!! - CO2 and other gases intialization routine:
-!! call module_radiation_gases::gas_init()
-!! - cloud initialization routine:
-!! call module_radiation_clouds::cld_init()
-!! - LW radiation initialization routine:
-!! call module_radlw_main::rlwinit()
-!! - SW radiation initialization routine:
-!! call module_radsw_main::rswinit()
-!     Initialization
-
-      call sol_init ( me, isol, solar_file, con_solr_2008, con_solr_2002,&
-           con_pi )                                               ! astronomy initialization routine
-      call aer_init ( NLAY, me, iaermdl, iaerflg, lalw1bd, aeros_file, con_pi, &
-           con_t0c, con_c, con_boltz, con_plnk, errflg, errmsg)   ! aerosols initialization routine
-      call gas_init ( me, co2usr_file, co2cyc_file, ico2, ictm, ntoz, con_pi, &
-           errflg, errmsg)                                        ! co2 and other gases initialization routine
-      call cld_init ( si, NLAY, imp_physics, me, errflg, errmsg)  ! cloud initialization routine
-      call rlwinit ( me, rad_hr_units, inc_minor_gas, ilwcliq, isubcsw, iovr, errflg, errmsg )           ! lw RRTMG initialization routine
-      call rswinit ( me, rad_hr_units, inc_minor_gas, iswcliq, isubclw, iovr, iswmode, errflg, errmsg )  ! sw RRTMG initialization routine
-!
-      return
-!
-      end subroutine radinit
-      !-----------------------------------
-
 !> This subroutine checks and updates time sensitive data used by
 !! radiation computations. This subroutine needs to be placed inside
 !! the time advancement loop but outside of the horizontal grid loop.
@@ -597,31 +349,6 @@ subroutine radupdate( idate,jdate,deltsw,deltim,lsswr,me, iaermdl,&
 !   sdec, cdec     : sin and cos of the solar declination angle         !
 !   solcon         : sun-earth distance adjusted solar constant (w/m2)  !
 !                                                                       !
-!  external module variables:                                           !
-!   iso   : solar constant cntrl  (in module physparam)                 !
-!              = 0: use the old fixed solar constant in "physcon"       !
-!              =10: use the new fixed solar constant in "physcon"       !
-!              = 1: use noaa ann-mean tsi tbl abs-scale with cycle apprx!
-!              = 2: use noaa ann-mean tsi tbl tim-scale with cycle apprx!
-!              = 3: use cmip5 ann-mean tsi tbl tim-scale with cycl apprx!
-!              = 4: use cmip5 mon-mean tsi tbl tim-scale with cycl apprx!
-!   ictm     : =yyyy#, external data ic time/date control flag          !
-!              =   -2: same as 0, but superimpose seasonal cycle        !
-!                      from climatology data set.                       !
-!              =   -1: use user provided external data for the          !
-!                      forecast time, no extrapolation.                 !
-!              =    0: use data at initial cond time, if not            !
-!                      available, use latest, no extrapolation.         !
-!              =    1: use data at the forecast time, if not            !
-!                      available, use latest and extrapolation.         !
-!              =yyyy0: use yyyy data for the forecast time,             !
-!                      no further data extrapolation.                   !
-!              =yyyy1: use yyyy data for the fcst. if needed, do        !
-!                      extrapolation to match the fcst time.            !
-!                                                                       !
-!  module variables:                                                    !
-!   loz1st   : first-time clim ozone data read flag                     !
-!                                                                       !
 !  subroutines called: sol_update, aer_update, gas_update               !
 !                                                                       !
 !  ===================================================================  !
diff --git a/physics/GFS_rrtmg_setup.meta b/physics/GFS_rrtmg_setup.meta
index 2355b91c2..b6d3520bf 100644
--- a/physics/GFS_rrtmg_setup.meta
+++ b/physics/GFS_rrtmg_setup.meta
@@ -1,7 +1,7 @@
 [ccpp-table-properties]
   name = GFS_rrtmg_setup
   type = scheme
-  dependencies = iounitdef.f,module_bfmicrophysics.f,physparam.f,radcons.f90,radiation_aerosols.f,radiation_astronomy.f,radiation_clouds.f
+  dependencies = iounitdef.f,module_bfmicrophysics.f,radcons.f90,radiation_aerosols.f,radiation_astronomy.f,radiation_clouds.f
   dependencies = module_mp_thompson.F90,radiation_gases.f,radlw_main.F90,radlw_param.f,radsw_main.F90,radsw_param.f,machine.F
 
 ########################################################################
@@ -138,14 +138,14 @@
   dimensions = ()
   type = integer
   intent = in
-[crick_proof]
+[lcrick]
   standard_name = flag_for_CRICK_proof_cloud_water
   long_name = flag for CRICK-Proof cloud water
   units = flag
   dimensions = ()
   type = logical
   intent = in
-[ccnorm]
+[lcnorm]
   standard_name = flag_for_in_cloud_condensate
   long_name = flag for cloud condensate normalized by cloud cover
   units = flag
@@ -159,7 +159,7 @@
   dimensions = ()
   type = integer
   intent = in
-[norad_precip]
+[lnoprec]
   standard_name = flag_for_turning_off_precipitation_radiative_effect
   long_name = radiation precip flag for Ferrier/Moorthi
   units = flag
@@ -293,6 +293,13 @@
   dimensions = ()
   type = logical
   intent = in
+[ipsd0]
+  standard_name = initial_seed_for_mcica
+  long_name = initial permutaion seed for mcica radiation
+  units = none
+  dimensions =  ()
+  type = integer
+  intent = inout
 [iaermdl]
   standard_name = flag_for_aerosol_radiation_scheme
   long_name = flag for aerosol scheme to use in radiation
diff --git a/physics/GFS_rrtmgp_cloud_overlap.F90 b/physics/GFS_rrtmgp_cloud_overlap.F90
index b294b4a99..28c925600 100644
--- a/physics/GFS_rrtmgp_cloud_overlap.F90
+++ b/physics/GFS_rrtmgp_cloud_overlap.F90
@@ -127,7 +127,6 @@ subroutine GFS_rrtmgp_cloud_overlap_run(nCol, nLev, yearlen, doSWrad, doLWrad,
        if (iovr_convcld == iovr_dcorr .or. iovr_convcld == iovr_exp .or. iovr_convcld == iovr_exprand) then
           call get_alpha_exper(nCol, nLev, iovr_convcld, iovr_exprand, deltaZc*0.001, de_lgth, cld_cnv_frac, cnv_cloud_overlap_param)
        else
-          de_lgth(:)                   = 0.
           cnv_cloud_overlap_param(:,:) = 0.
        endif
     endif
diff --git a/physics/GFS_rrtmgp_setup.F90 b/physics/GFS_rrtmgp_setup.F90
index 935500739..842d8e983 100644
--- a/physics/GFS_rrtmgp_setup.F90
+++ b/physics/GFS_rrtmgp_setup.F90
@@ -6,10 +6,6 @@ module GFS_rrtmgp_setup
   use module_radiation_astronomy, only : sol_init, sol_update
   use module_radiation_aerosols,  only : aer_init, aer_update
   use module_radiation_gases,     only : gas_init, gas_update
-  !  use GFS_cloud_diagnostics,      only : hml_cloud_diagnostics_initialize
-  ! *NOTE* These parameters below are required radiation_****** modules. They are not
-  !        directly used by the RRTMGP routines.
-  use physparam,                  only : ivflip
   implicit none
   
   public GFS_rrtmgp_setup_init, GFS_rrtmgp_setup_timestep_init, GFS_rrtmgp_setup_finalize
@@ -87,8 +83,6 @@ subroutine GFS_rrtmgp_setup_init(do_RRTMGP, imp_physics, imp_physics_fer_hires,
     end if
 
     ! Set radiation parameters
-    ivflip  = iflip                    ! vertical index direction control flag
-    
     if ( ictm==0 .or. ictm==-2 ) then
        iaerflg = mod(iaer, 100)        ! no volcanic aerosols for clim hindcast
     else
@@ -125,23 +119,11 @@ subroutine GFS_rrtmgp_setup_init(do_RRTMGP, imp_physics, imp_physics_fer_hires,
     iyear0 = 0
     monthd = 0
 
-!> -# Initialization
-!! - astronomy initialization routine:
-!! call module_radiation_astronomy::sol_init()
-!! - aerosols initialization routine:
-!! call module_radiation_aerosols::aer_init()
-!! - CO2 and other gases intialization routine:
-!! call module_radiation_gases::gas_init()
-
     ! Call initialization routines..
     call sol_init ( me, isol, solar_file, con_solr_2008, con_solr_2002, con_pi )
     call aer_init ( levr, me, iaermdl, iaerflg, lalw1bd, aeros_file, con_pi, con_t0c,    &
          con_c, con_boltz, con_plnk, errflg, errmsg)
-    call gas_init ( me, co2usr_file, co2cyc_file, ictm, ntoz, ico2, con_pi, errflg, errmsg )
-    !call hml_cloud_diagnostics_initialize(imp_physics, imp_physics_fer_hires,           &
-    !     imp_physics_gfdl, imp_physics_thompson, imp_physics_wsm6,                      &
-    !     imp_physics_zhao_carr, imp_physics_zhao_carr_pdf, imp_physics_mg, levr, me, si,&
-    !     errflg)
+    call gas_init ( me, co2usr_file, co2cyc_file, ico2, ntoz, ictm, con_pi, errflg, errmsg )
 
     if ( me == 0 ) then
        print *,' return from rad_initialize (GFS_rrtmgp_setup_init) - after calling radinit'
diff --git a/physics/GFS_rrtmgp_setup.meta b/physics/GFS_rrtmgp_setup.meta
index 4f8fe1db4..8a9fd4ef6 100644
--- a/physics/GFS_rrtmgp_setup.meta
+++ b/physics/GFS_rrtmgp_setup.meta
@@ -1,7 +1,7 @@
 [ccpp-table-properties]
   name = GFS_rrtmgp_setup
   type = scheme
-  dependencies = iounitdef.f,machine.F,module_bfmicrophysics.f,physparam.f,radiation_aerosols.f,radiation_astronomy.f
+  dependencies = iounitdef.f,machine.F,module_bfmicrophysics.f,radiation_aerosols.f,radiation_astronomy.f
   dependencies = module_mp_thompson.F90,radiation_clouds.f,radiation_gases.f
 
 ########################################################################
diff --git a/physics/physparam.f b/physics/physparam.f
deleted file mode 100644
index 0dd53a304..000000000
--- a/physics/physparam.f
+++ /dev/null
@@ -1,214 +0,0 @@
-!> \file physparam.f
-!! This file contains module physparam.
-
-!  ==========================================================  !!!!!
-!                    module physparam description              !!!!!
-!  ==========================================================  !!!!!
-!                                                                      !
-!     This module defines commonly used control variables/parameters   !
-!     in physics related programs.                                     !
-!                                                                      !
-!     Section 1 contains control variables defined in the form of      !
-!     parameter. They are pre-determined choices and not adjustable    !
-!     during model's run-time.                                         !
-!                                                                      !
-!     Section 2 contains control variables defined as module variables.!
-!     They are more flexible to be changed during run-time by either   !
-!     through input namelist, or through model environment condition.  !
-!     They are preassigned here as the default values.                 !
-!                                                                      !
-!!!!!  ==========================================================  !!!!!
-
-!> \defgroup phy_sparam GFS Physics Parameter Module
-!! Those variables are grouped  together in accordance with functionaity
-!! and are given brief descriptions and value specifications. There are
-!! two types of attributes (parameters vs. save) designated for the
-!! control variables. Those with a "parameter" attribute are prescribed
-!! with a preferred option value, while the ones with a "save" attribute
-!! are given a default value but could be changed at the model's
-!! execution-time (usually through an input of name-list file or through
-!! run scripts).
-
-!> This module defines commonly used control variables and parameters
-!! in physics related programs.
-      module physparam            
-!
-!     implicit   none
-
-!  --- ...  define kind parameters here
-
-!   ** if already exist, use the module containing kind definitions
-      use machine
-
-!   ** otherwise, define kind parameter here
-!     implicit   none
-!     integer, public, parameter :: kind_io4 = 4
-!     integer, public, parameter :: kind_io8 = 8
-!     integer, public, parameter :: kind_phys= selected_real_kind(13,60) ! the '60' maps to 64-bit real
-!      .....
-
-!     implicit   none
-!
-      public
-
-!==================================================================================
-!  Section - 1 -
-!     control flags are pre-set as run-time non-adjuztable parameters.
-!==================================================================================
-
-! ............................................. !
-!> \name  1.1 Control flags for SW radiation
-! ............................................. !
-
-!> SW heating rate unit control flag: =1:k/day; =2:k/second.
-      integer,parameter :: iswrate = 2
-
-!> SW minor gases effect control flag (CH4 and O2): =0:no; =1:yes.
-!!\n =0: minor gases' effects are not included in calculations
-!!\n =1: minor gases' effects are included in calculations
-      integer,parameter :: iswrgas = 1
-
-!> SW optical property for liquid clouds
-!!\n =0:input cld opt depth, ignoring iswcice setting
-!!\n =1:cloud optical property scheme based on Hu and Stamnes(1993) \cite hu_and_stamnes_1993 method
-!!\n =2:cloud optical property scheme based on Hu and Stamnes(1993) -updated
-      integer,save      :: iswcliq = 1
-
-!> SW optical property for ice clouds (only iswcliq>0)
-!!\n =1:optical property scheme based on Ebert and Curry (1992)
-!!      \cite ebert_and_curry_1992 method
-!!\n =2:optical property scheme based on Streamer v3.0
-!!      \cite key_2002 method
-!!\n =3:optical property scheme based on Fu's method (1996)
-!!      \cite fu_1996 method
-      integer,save      :: iswcice = 3
-
-!> SW control flag for scattering process approximation
-!!\n =1:two-stream delta-eddington    (Joseph et al. 1976
-!!                         \cite joseph_et_al_1976)
-!!\n =2:two-stream PIFM               (Zdunkowski et al. 1980
-!!                         \cite zdunkowski_et_al_1980)
-!!\n =3:discrete ordinates (Liou, 1973
-!!                         \cite liou_1973)
-      integer,parameter :: iswmode = 2
-
-! ............................................. !
-!> \name  1.2 Control flags for LW radiation
-! ............................................. !
-
-!> LW heating rate unit: =1:k/day; =2:k/second.
-      integer,parameter :: ilwrate = 2
-
-!> LW minor gases effect control flag (CH4,N2O,O2,and some CFCs):
-!!\n =0: minor gases' effects are not included in calculations
-!!\n =1: minor gases' effects are included in calculations
-      integer,parameter :: ilwrgas = 1
-
-!> LW optical property scheme for liquid clouds
-!!\n =0:input cloud optical properties directly, not computed within
-!!\n =1:input cwp,rew, use Hu and Stamnes(1993)
-!!      \cite hu_and_stamnes_1993 method
-      integer,save      :: ilwcliq = 1
-
-!> LW optical property scheme for ice clouds (only ilwcliq>0)
-!!\n =1:optical property scheme based on Ebert and Curry (1992)
-!!      \cite ebert_and_curry_1992 method
-!!\n =2:optical property scheme based on Streamer v3
-!!      \cite key_2002 method
-!!\n =3:optical property scheme use Fu's method (1998)
-!!      \cite fu_et_al_1998 method
-      integer,save      :: ilwcice = 3
-
-!==================================================================================
-!  Section - 2 -
-!     values of control flags might be re-set in initialization subroutines
-!       (may be adjusted at run time based on namelist input or run condition)
-!==================================================================================
-
-! ............................................. !
-!> \name  2.3 For module radiation_gases
-! ............................................. !
-
-!> co2 data source control flag
-!!\n =0:prescribed value(380 ppmv)
-!!\n =1:yearly global averaged annual mean from observations
-!!\n =2:monthly 15 degree horizontal resolution from observations
-!!\n Opr GFS/CFS=2; see ICO2 in run scripts
-      integer, save :: ico2flg = 0
-
-!> controls external data at initial time and data usage during
-!! forecast time
-!!\n =-2:as in 0,but superimpose with seasonal climatology cycle
-!!\n =-1:use user data,no extrapolation in overtime
-!!\n =0:use IC time to select data,no extrapolation in overtime
-!!\n =1:use forecast time to select data,extrapolate when necessary
-!!\n =yyyy0:use yyyy year of data, no extrapolation
-!!\n =yyyy1:use yyyy year of data, extrapolate when necessary
-!!\n Opr GFS/CFS=1; see ICTM in run scripts
-      integer, save :: ictmflg = 0
-
-!> ozone data source control flag
-!!\n =0:use seasonal climatology ozone data
-!!\n >0:use prognostic ozone scheme (also depend on other model control
-!!      variable at initial time)
-      integer, save :: ioznflg = 1
-
-! ............................................. !
-!>\name  2.4 For module radiation_clouds
-! ............................................. !
-
-!> cloud optical property scheme control flag
-!!\n =0:use diagnostic cloud scheme for cloud cover and mean optical properties
-!!\n =1:use prognostic cloud scheme for cloud cover and cloud properties
-      integer, save :: icldflg = 1
-
-!> cloud overlapping control flag for Radiation
-!!\n =0:use random cloud overlapping method
-!!\n =1:use maximum-random cloud overlapping method
-!!\n =2:use maximum cloud overlapping method
-!!\n =3:use decorrelation length overlapping method
-!!\n =4:use exponential overlapping method
-!!\n =5:use exponential-random overlapping method
-!!\n Opr GFS/CFS=1; see IOVR in run scripts
-      integer, save :: iovr  = 1
-!!\n Decorrelation length type for iovr = 4 or 5
-!!\n =0:use constant decorrelation length defined by decorr_con (in module physcons)
-!!\n =1:use day-of-year and latitude-varying decorrelation length
-      integer, save :: idcor   = 1
-
-!> sub-column cloud approx flag in SW radiation
-!!\n =0:no McICA approximation in SW radiation
-!!\n =1:use McICA with precribed permutation seeds (test mode)
-!!\n =2:use McICA with randomly generated permutation seeds
-!!\n Opr GFS/CFS=2; see ISUBC_SW in run scripts
-      integer, save :: isubcsw = 0
-!> sub-column cloud approx flag in LW radiation
-!!\n =0:no McICA approximation in LW radiation
-!!\n =1:use McICA with prescribed permutation seeds (test mode)
-!!\n =2:use McICA with randomly generatedo
-!!\n Opr GFS/CFS=2; see ISUBC_LW in run scripts
-      integer, save :: isubclw = 0
-
-!> eliminating CRICK control flag
-      logical, save :: lcrick  =.false.
-!> in-cld condensate control flag
-      logical, save :: lcnorm  =.false.
-!> precip effect on radiation flag (Ferrier microphysics)
-      logical, save :: lnoprec =.false.
-!> shallow convetion flag
-      logical, save :: lsashal =.false.
-
-! ............................................. !
-!> \name  2.6 general purpose
-! ............................................. !
-
-!> vertical profile indexing flag
-      integer, save :: ivflip  = 1
-
-!> initial permutaion seed for mcica radiation
-      integer, save :: ipsd0   = 0
-      integer, save :: ipsdlim = 1e8
-!
-!...................................!
-      end module physparam          !
-!===================================!
diff --git a/physics/radiation_clouds.f b/physics/radiation_clouds.f
index ee7922c99..2266dca09 100644
--- a/physics/radiation_clouds.f
+++ b/physics/radiation_clouds.f
@@ -29,8 +29,8 @@
 !            imp_physics, imp_physics_nssl, imp_physics_fer_hires,     !
 !            imp_physics_gfdl, imp_physics_thompson, imp_physics_wsm6, !
 !            imp_physics_zhao_carr, imp_physics_zhao_carr_pdf,         !
-!            imp_physics_mg, iovr_rand, iovr_maxrand, iovr_max,        !
-!            iovr_dcorr, iovr_exp, iovr_exprand, idcor_con,            !
+!            imp_physics_mg, iovr, iovr_rand, iovr_maxrand, iovr_max,  !
+!            iovr_dcorr, iovr_exp, iovr_exprand, idcor, idcor_con,     !
 !            idcor_hogan, idcor_oreopoulos,                            !
 !            imfdeepcnv, imfdeepcnv_gf, do_mynnedmf, lgfdlmprad,       !
 !            uni_cld, lmfshal, lmfdeep2, cldcov, clouds1,              !
@@ -68,12 +68,8 @@
 !   ** fu's scheme need to be normalized by snow density (g/m**3/1.0e6)!
 !                                                                      !
 !    external modules referenced:                                      !
-!                                                                      !
-!       'module physparam'           in 'physparam.f'                  !
-!       'module physcons'            in 'physcons.f'                   !
 !       'module module_microphysics' in 'module_bfmicrophysics.f'      !
 !                                                                      !
-!                                                                      !
 ! program history log:                                                 !
 !      nov 1992,   y.h., k.a.c, a.k. - cloud parameterization          !
 !        'cldjms' patterned after slingo and slingo's work (jgr,       !
@@ -173,13 +169,6 @@
 !> This module computes cloud related quantities for radiation computations.
       module module_radiation_clouds
 !
-      use physparam,           only : iovr, idcor,                      &
-     &                                lcrick, lcnorm, lnoprec,          &
-     &                                ivflip
-      use physcons,            only : con_fvirt, con_ttp, con_rocp,     &
-     &                                con_t0c, con_pi, con_g, con_rd,   &
-     &                                con_thgni, decorr_con
-      use module_microphysics, only : rsipath2
       use module_iounitdef,    only : NICLTUN
       use module_radiation_cloud_overlap, only: cmp_dcorr_lgth,         &
      &                                          get_alpha_exper
@@ -195,9 +184,7 @@ module module_radiation_clouds
 !    &   VTAGCLD='NCEP-Radiation_clouds    v5.0  Aug 2012 '
 
 !  ---  set constant parameters
-      real (kind=kind_phys), parameter :: gfac=1.0e5/con_g              &
-     &,                                   gord=con_g/con_rd
-
+      real (kind=kind_phys) :: gfac,gord
 
       integer, parameter, public :: NF_CLDS = 9          !< number of fields in cloud array
       integer, parameter, public :: NK_CLDS = 3          !< number of cloud vertical domains
@@ -281,29 +268,12 @@ subroutine cld_init                                               &
 !   NLAY            : vertical layer number                             !
 !   imp_physics     : MP identifier                                     !
 !   me              : print control flag                                !
+!   imp_physics         : cloud microphysics scheme control flag        !
 !                                                                       !
 !  outputs:                                                             !
 !   errflg          : CCPP error flag                                   !
 !   errmsg          : CCPP error message                                !
 !                                                                       !
-!  external module variables: (in physparam)                            !
-!   imp_physics         : cloud microphysics scheme control flag        !
-!                     =99: zhao/carr/sundqvist microphysics cloud       !
-!                     =98: zhao/carr/sundqvist microphysics cloud+pdfcld!
-!                     =11: GFDL microphysics cloud                      !
-!                     =8: Thompson microphysics                         !
-!                     =6: WSM6 microphysics                             !
-!                     =10: MG microphysics                              !
-!   iovr            : control flag for cloud overlapping scheme         !
-!                     =0: random overlapping clouds                     !
-!                     =1: max/ran overlapping clouds                    !
-!                     =2: maximum overlap clouds       (mcica only)     !
-!                     =3: decorrelation-length overlap (mcica only)     !
-!                     =4: exponential cloud overlap  (AER; mcica only)  !
-!                     =5: exponential-random overlap (AER; mcica only)  !
-!   ivflip          : control flag for direction of vertical index      !
-!                     =0: index from toa to surface                     !
-!                     =1: index from surface to toa                     !
 !  usage:       call cld_init                                           !
 !                                                                       !
 !  subroutines called:    rhtable                                       !
@@ -321,9 +291,6 @@ subroutine cld_init                                               &
       integer,          intent(out) :: errflg
       character(len=*), intent(out) :: errmsg
 
-!  ---  locals:
-      integer :: k, kl, ier
-
 !
 !===> ...  begin here
 !
@@ -359,27 +326,6 @@ subroutine cld_init                                               &
             return
          endif
       endif
-
-!> - Compute the top of BL cld (llyr), which is the topmost non
-!!    cld(low) layer for stratiform (at or above lowest 0.1 of the
-!!     atmosphere).
-
-      if ( ivflip == 0 ) then    ! data from toa to sfc
-        lab_do_k0 : do k = NLAY, 2, -1
-          kl = k
-          if (si(k) < 0.9e0) exit lab_do_k0
-        enddo  lab_do_k0
-
-        llyr = kl
-      else                      ! data from sfc to top
-        lab_do_k1 : do k = 2, NLAY
-          kl = k
-          if (si(k) < 0.9e0) exit lab_do_k1
-        enddo  lab_do_k1
-
-        llyr = kl - 1
-      endif                     ! end_if_ivflip
-
 !
       return
 !...................................
@@ -393,20 +339,21 @@ subroutine radiation_clouds_prop                                  &
      &     ( plyr, plvl, tlyr, tvly, qlyr, qstl, rhly,                  &    !  ---  inputs:
      &       ccnd, ncndl, cnvw, cnvc, tracer1,                          &
      &       xlat, xlon, slmsk, dz, delp, IX, LM, NLAY, NLP1,           &
-     &       deltaq, sup, me, icloud, kdt,                              &
+     &       deltaq, sup, dcorr_con, me, icloud, kdt,                   &
      &       ntrac, ntcw, ntiw, ntrw, ntsw, ntgl, ntclamt,              &
      &       imp_physics, imp_physics_nssl, imp_physics_fer_hires,      &
      &       imp_physics_gfdl, imp_physics_thompson, imp_physics_wsm6,  &
      &       imp_physics_zhao_carr, imp_physics_zhao_carr_pdf,          &
-     &       imp_physics_mg, iovr_rand, iovr_maxrand, iovr_max,         &
-     &       iovr_dcorr, iovr_exp, iovr_exprand, idcor_con,             &
-     &       idcor_hogan, idcor_oreopoulos,                             &
+     &       imp_physics_mg, iovr, iovr_rand, iovr_maxrand, iovr_max,   &
+     &       iovr_dcorr, iovr_exp, iovr_exprand, idcor, idcor_con,      &
+     &       idcor_hogan, idcor_oreopoulos, lcrick, lcnorm,             &
      &       imfdeepcnv, imfdeepcnv_gf, do_mynnedmf, lgfdlmprad,        &
      &       uni_cld, lmfshal, lmfdeep2, cldcov, clouds1,               &
      &       effrl, effri, effrr, effrs, effr_in,                       &
      &       effrl_inout, effri_inout, effrs_inout,                     &
      &       lwp_ex, iwp_ex, lwp_fc, iwp_fc,                            &
-     &       dzlay, latdeg, julian, yearlen, gridkm,                    &
+     &       dzlay, latdeg, julian, yearlen, gridkm, top_at_1, si,      &
+     &       con_ttp, con_pi, con_g, con_rd, con_thgni,                 &
      &       cld_frac, cld_lwp, cld_reliq, cld_iwp, cld_reice,          &    !  ---  outputs:
      &       cld_rwp, cld_rerain, cld_swp, cld_resnow,                  &    
      &       clds, mtop, mbot, de_lgth, alpha                           &    
@@ -489,15 +436,17 @@ subroutine radiation_clouds_prop                                  &
 !   imp_physics_zhao_carr     : Zhao-Carr microphysics scheme           !
 !   imp_physics_zhao_carr_pdf : Zhao-Carr microphysics scheme with PDF clouds
 !   imp_physics_mg  :  Morrison-Gettelman microphysics scheme           !
-!   iovr_rand       :  choice of cloud-overlap: random (=0)
-!   iovr_maxrand    :  choice of cloud-overlap: maximum random (=1)
-!   iovr_max        :  choice of cloud-overlap: maximum (=2)
-!   iovr_dcorr      :  choice of cloud-overlap: decorrelation length (=3)
-!   iovr_exp        :  choice of cloud-overlap: exponential (=4)
-!   iovr_exprand    :  choice of cloud-overlap: exponential random (=5)
-!   idcor_con       :  choice for decorrelation-length: Use constant value (=0)
-!   idcor_hogan     :  choice for decorrelation-length: (=1)
-!   idcor_oreopoulos:  choice for decorrelation-length: (=2)
+!   iovr            : choice of cloud-overlap                           !
+!   iovr_rand       : flag of cloud-overlap: random (=0)                !
+!   iovr_maxrand    : flag of cloud-overlap: maximum random (=1)        !
+!   iovr_max        : flag of cloud-overlap: maximum (=2)               !
+!   iovr_dcorr      : flag of cloud-overlap: decorrelation length(=3)   !
+!   iovr_exp        : flag of cloud-overlap: exponential (=4)           !
+!   iovr_exprand    : flag of cloud-overlap: exponential random (=5)    !
+!   idcor           : choice for decorrelation-length                   !
+!   idcor_con       : flag for decorrelation-length: Use constant value (=0)
+!   idcor_hogan     : flag for decorrelation-length: (=1)               !
+!   idcor_oreopoulos: flag for decorrelation-length: (=2)               !
 !   imfdeepcnv      :  flag for mass-flux deep convection scheme        !
 !   imfdeepcnv_gf   :  flag for scale- & aerosol-aware Grell-Freitas scheme (GSD)
 !   do_mynnedmf     :  flag for MYNN-EDMF                               !
@@ -505,6 +454,7 @@ subroutine radiation_clouds_prop                                  &
 !   uni_cld         : logical - true for cloud fraction from shoc       !
 !   lmfshal         : logical - true for mass flux shallow convection   !
 !   lmfdeep2        : logical - true for mass flux deep convection      !
+!   top_at_1        : logical - true if ordered from toa-2-sfc          !
 !   cldcov          : layer cloud fraction (used when uni_cld=.true.    !
 !   clouds1         : layer total cloud fraction
 !   effrl,          : effective radius for liquid water
@@ -523,7 +473,15 @@ subroutine radiation_clouds_prop                                  &
 !   latdeg(ix)      : latitude (in degrees 90 -> -90)                   !
 !   julian          : day of the year (fractional julian day)           !
 !   yearlen         : current length of the year (365/366 days)         !
-!   gridkm          : grid length in km
+!   gridkm          : grid length in km                                 !
+!   lmfshal         : mass-flux shallow conv scheme flag                !
+!   lmfdeep2        : scale-aware mass-flux deep conv scheme flag       !
+!   lcrick          : control flag for eliminating CRICK                !
+!                     =t: apply layer smoothing to eliminate CRICK      !
+!                     =f: do not apply layer smoothing                  !
+!   lcnorm          : control flag for in-cld condensate                !
+!                     =t: normalize cloud condensate                    !
+!                     =f: not normalize cloud condensate                !
 !                                                                       !
 ! output variables:                                                     !
 !   cloud profiles:                                                     !
@@ -541,20 +499,7 @@ subroutine radiation_clouds_prop                                  &
 !   mtop  (IX,3)    : vertical indices for low, mid, hi cloud tops      !
 !   mbot  (IX,3)    : vertical indices for low, mid, hi cloud bases     !
 !   de_lgth(ix)     : clouds decorrelation length (km)                  !
-!   alpha(ix,nlay)  : alpha decorrelation parameter
-!                                                                       !
-! module variables:                                                     !
-!   ivflip          : control flag of vertical index direction          !
-!                     =0: index from toa to surface                     !
-!                     =1: index from surface to toa                     !
-!   lmfshal         : mass-flux shallow conv scheme flag                !
-!   lmfdeep2        : scale-aware mass-flux deep conv scheme flag       !
-!   lcrick          : control flag for eliminating CRICK                !
-!                     =t: apply layer smoothing to eliminate CRICK      !
-!                     =f: do not apply layer smoothing                  !
-!   lcnorm          : control flag for in-cld condensate                !
-!                     =t: normalize cloud condensate                    !
-!                     =f: not normalize cloud condensate                !
+!   alpha(ix,nlay)  : alpha decorrelation parameter                     !
 !                                                                       !
 !  ====================    end of description    =====================  !
       implicit none
@@ -576,19 +521,21 @@ subroutine radiation_clouds_prop                                  &
      &     imp_physics_mg               ! Flag for MG scheme
 
       integer,              intent(in)  ::                               &
+     &     iovr,                         !
      &     iovr_rand,                    ! Flag for random cloud overlap method
      &     iovr_maxrand,                 ! Flag for maximum-random cloud overlap method
      &     iovr_max,                     ! Flag for maximum cloud overlap method
      &     iovr_dcorr,                   ! Flag for decorrelation-length cloud overlap method
      &     iovr_exp,                     ! Flag for exponential cloud overlap method
      &     iovr_exprand,                 ! Flag for exponential-random cloud overlap method
+     &     idcor,
      &     idcor_con,                   
      &     idcor_hogan,                 
      &     idcor_oreopoulos
 
 
-      logical, intent(in)  :: uni_cld, lmfshal, lmfdeep2, effr_in
-      logical, intent(in)  :: do_mynnedmf, lgfdlmprad
+      logical, intent(in)  :: uni_cld, lmfshal, lmfdeep2, effr_in,      &
+     &     do_mynnedmf, lgfdlmprad, top_at_1, lcrick, lcnorm
 
       real (kind=kind_phys), dimension(:,:,:), intent(in) :: ccnd,      &
      &                                                       tracer1
@@ -596,9 +543,10 @@ subroutine radiation_clouds_prop                                  &
      &       tlyr,  tvly,  qlyr,  qstl, rhly, cnvw, cnvc, cldcov,       &
      &       delp, dz, effrl, effri, effrr, effrs, dzlay, clouds1
 
-      real (kind=kind_phys), intent(in) :: sup
+      real (kind=kind_phys), intent(in) :: sup, dcorr_con, con_ttp,     &
+     &     con_pi, con_g, con_rd, con_thgni 
       real (kind=kind_phys), dimension(:),   intent(in) :: xlat, xlon,  &
-     &       slmsk
+     &       slmsk, si
 
       real(kind=kind_phys), dimension(:), intent(in) :: latdeg, gridkm
       real(kind=kind_phys), intent(in) :: julian
@@ -644,6 +592,10 @@ subroutine radiation_clouds_prop                                  &
           print*, 'in radiation_clouds_prop=', imp_physics, uni_cld,     &
      &           ncndl, lgfdlmprad, do_mynnedmf, imfdeepcnv, kdt
       end if
+      
+      !
+      gfac = 1.0e5/con_g 
+      gord = con_g/con_rd
 
       do k = 1, NLAY
         do i = 1, IX
@@ -676,7 +628,7 @@ subroutine radiation_clouds_prop                                  &
      &                     IX, NLAY, NLP1, cldcov,                      &
      &                     effrl, effri, effrr, effrs, effr_in,         &
      &                     dzlay,                                       & 
-     &                     cldtot, cldcnv,                              & ! inout
+     &                     cldtot, cldcnv, lcrick, lcnorm, con_ttp,     & ! inout
      &                     cld_frac, cld_lwp, cld_reliq, cld_iwp,       & !  ---  outputs
      &                     cld_reice,cld_rwp, cld_rerain,cld_swp,       &  
      &                     cld_resnow)
@@ -687,7 +639,7 @@ subroutine radiation_clouds_prop                                  &
      &                    lmfshal, lmfdeep2,                            &
      &                    cldcov, effrl, effri, effrr, effrs, effr_in,  &
      &                    dzlay,                                        &
-     &                    cldtot, cldcnv,                               & ! inout
+     &                    cldtot, cldcnv, lcrick, lcnorm, con_ttp,      & ! inout
      &                    cld_frac, cld_lwp, cld_reliq, cld_iwp,        & !  ---  outputs
      &                    cld_reice,cld_rwp, cld_rerain,cld_swp,        & 
      &                    cld_resnow)
@@ -699,8 +651,8 @@ subroutine radiation_clouds_prop                                  &
      &                 qstl, rhly, ccnd(1:IX,1:NLAY,1), cnvw, cnvc,     &
      &                 xlat, xlon, slmsk, dz, delp, IX, NLAY, NLP1,     &
      &                 deltaq, sup, kdt, me, dzlay,                     & 
-     &                 cldtot, cldcnv,                                  &  ! inout
-     &                 cld_frac, cld_lwp, cld_reliq, cld_iwp,           &  !  ---  outputs
+     &                 cldtot, cldcnv, lcrick, lcnorm, con_thgni,       &  ! inout
+     &                 con_ttp, cld_frac, cld_lwp, cld_reliq, cld_iwp,  &  !  ---  outputs
      &                 cld_reice,cld_rwp, cld_rerain,cld_swp,           & 
      &                 cld_resnow)
 
@@ -711,7 +663,7 @@ subroutine radiation_clouds_prop                                  &
      &                    qstl, rhly, ccnd(1:IX,1:NLAY,1), cnvw, cnvc,  &
      &                    xlat, xlon, slmsk, cldcov, dz, delp,          &
      &                    IX, NLAY, NLP1, dzlay,                        &
-     &                    cldtot, cldcnv,                               &  ! inout
+     &                    cldtot, cldcnv, lcrick, lcnorm, con_ttp,      &  ! inout
      &                    cld_frac, cld_lwp, cld_reliq, cld_iwp,        &  !  ---  outputs
      &                    cld_reice,cld_rwp, cld_rerain,cld_swp,        &
      &                    cld_resnow)
@@ -721,7 +673,7 @@ subroutine radiation_clouds_prop                                  &
      &                   xlon, slmsk, dz,delp, IX, NLAY, NLP1, cldcov,  &
      &                   effrl, effri, effrr, effrs, effr_in,           &
      &                   dzlay,                                         &
-     &                   cldtot, cldcnv,                                &  ! inout
+     &                   cldtot, cldcnv, lcrick, lcnorm, con_ttp,       &  ! inout
      &                   cld_frac, cld_lwp, cld_reliq, cld_iwp,         & !  ---  outputs
      &                   cld_reice,cld_rwp, cld_rerain,cld_swp,         & 
      &                   cld_resnow)
@@ -743,7 +695,7 @@ subroutine radiation_clouds_prop                                  &
      &                    cldcov(:,1:NLAY),effrl_inout(:,:),            &
      &                    effri_inout(:,:), effrs_inout(:,:),           &
      &                    dzlay,                                        &
-     &                    cldtot, cldcnv,                               &  ! inout
+     &                    cldtot, cldcnv, lcnorm,                       &  ! inout
      &                    cld_frac, cld_lwp, cld_reliq, cld_iwp,        & !  ---  outputs
      &                    cld_reice,cld_rwp, cld_rerain,cld_swp,        & 
      &                    cld_resnow)
@@ -766,7 +718,7 @@ subroutine radiation_clouds_prop                                  &
      &                   cld_frac,                                      &
      &                   effrl, effri, effrr, effrs, effr_in ,          &
      &                   dzlay,                                         &
-     &                   cldtot, cldcnv,                                &  ! inout
+     &                   cldtot, cldcnv, lcrick, lcnorm, con_ttp,       &  ! inout
      &                   cld_frac, cld_lwp, cld_reliq, cld_iwp,         & !  ---  outputs
      &                   cld_reice,cld_rwp, cld_rerain,cld_swp,         &
      &                   cld_resnow)
@@ -781,7 +733,7 @@ subroutine radiation_clouds_prop                                  &
      &                   effri_inout, effrs_inout,                      &
      &                   lwp_ex, iwp_ex, lwp_fc, iwp_fc,                &
      &                   dzlay,                                         &
-     &                   cldtot, cldcnv,                                &  ! inout
+     &                   cldtot, cldcnv, lcnorm,                        &  ! inout
      &                   cld_frac, cld_lwp, cld_reliq, cld_iwp,         & !  ---  outputs
      &                   cld_reice,cld_rwp, cld_rerain,cld_swp,         &
      &                   cld_resnow)
@@ -799,7 +751,7 @@ subroutine radiation_clouds_prop                                  &
      &                    IX, LM, NLP1, uni_cld, lmfshal, lmfdeep2,     &
      &                    cldcov(:,1:LM), effrl, effri, effrs,          &
      &                    lwp_ex, iwp_ex, lwp_fc, iwp_fc,               &
-     &                    dzlay,  gridkm,                               &
+     &                    dzlay,  gridkm, top_at_1,                     &
      &                    cldtot, cldcnv,                               &  ! inout
      &                    cld_frac, cld_lwp, cld_reliq, cld_iwp,        & !  ---  outputs
      &                    cld_reice,cld_rwp, cld_rerain,cld_swp,        & 
@@ -821,7 +773,7 @@ subroutine radiation_clouds_prop                                  &
      &                   cld_frac,                                      &
      &                   effrl, effri, effrr, effrs, effr_in ,          &
      &                   dzlay,                                         &
-     &                   cldtot, cldcnv,                                &  ! inout
+     &                   cldtot, cldcnv, lcrick, lcnorm, con_ttp,       &  ! inout
      &                   cld_frac, cld_lwp, cld_reliq, cld_iwp,         & !  ---  outputs
      &                   cld_reice,cld_rwp, cld_rerain,cld_swp,         & 
      &                   cld_resnow)
@@ -838,7 +790,7 @@ subroutine radiation_clouds_prop                                  &
      &                   IX, LM, NLP1, uni_cld, lmfshal, lmfdeep2,      &
      &                   cldcov(:,1:LM), effrl, effri, effrs,           &
      &                   lwp_ex, iwp_ex, lwp_fc, iwp_fc,                &
-     &                   dzlay,  gridkm,                                &
+     &                   dzlay,  gridkm, top_at_1,                      &
      &                   cldtot, cldcnv,                                &  ! inout
      &                   cld_frac, cld_lwp, cld_reliq, cld_iwp,         & !  ---  outputs
      &                   cld_reice,cld_rwp, cld_rerain,cld_swp,         & 
@@ -853,7 +805,7 @@ subroutine radiation_clouds_prop                                  &
      &                   cldcov(:,1:NLAY), cnvw, effrl, effri, effrs,   &
      &                   lwp_ex, iwp_ex, lwp_fc, iwp_fc,                &
      &                   dzlay,                                         &
-     &                   cldtot, cldcnv,                                &  ! inout
+     &                   cldtot, cldcnv, lcnorm,                        &  ! inout
      &                   cld_frac, cld_lwp, cld_reliq, cld_iwp,         & !  ---  outputs
      &                   cld_reice,cld_rwp, cld_rerain,cld_swp,         & 
      &                   cld_resnow)
@@ -888,7 +840,7 @@ subroutine radiation_clouds_prop                                  &
         call cmp_dcorr_lgth(ix, latdeg, julian, yearlen, de_lgth)
       endif
       if (idcor == idcor_con) then
-         de_lgth(:) = decorr_con
+         de_lgth(:) = dcorr_con
       endif
 
       ! Call subroutine get_alpha_exper to define alpha parameter for exponential cloud overlap options
@@ -913,8 +865,8 @@ subroutine radiation_clouds_prop                                  &
       call gethml                                                       &
 !  ---  inputs:
      &     ( plyr, ptop1, cldtot, cldcnv, dz, de_lgth, alpha,           &
-     &       IX, NLAY, iovr_rand, iovr_maxrand, iovr_max,               &
-     &       iovr_dcorr, iovr_exp, iovr_exprand,                        &
+     &       IX, NLAY, iovr, iovr_rand, iovr_maxrand, iovr_max,         &
+     &       iovr_dcorr, iovr_exp, iovr_exprand, top_at_1, si,          &
 !  ---  outputs:
      &       clds, mtop, mbot                                           &
      &     )
@@ -931,7 +883,7 @@ subroutine progcld_zhao_carr                                      &
      &       xlat,xlon,slmsk,dz,delp, IX, NLAY, NLP1,                   &
      &       uni_cld, lmfshal, lmfdeep2, cldcov,                        &
      &       effrl,effri,effrr,effrs,effr_in,                           &
-     &       dzlay, cldtot, cldcnv,                                     &
+     &       dzlay, cldtot, cldcnv, lcrick, lcnorm, con_ttp,            &
      &       cld_frac, cld_lwp, cld_reliq, cld_iwp,                     & !  ---  outputs
      &       cld_reice,cld_rwp, cld_rerain,cld_swp, cld_resnow          &
      &      )
@@ -948,9 +900,7 @@ subroutine progcld_zhao_carr                                      &
 !   top and base.  the three vertical cloud domains are set up in the   !
 !   initial subroutine "cld_init".                                      !
 !                                                                       !
-! usage:         call progcld_zhao_carr                                          !
-!                                                                       !
-! subprograms called:   gethml                                          !
+! usage:         call progcld_zhao_carr                                 !
 !                                                                       !
 ! attributes:                                                           !
 !   language:   fortran 90                                              !
@@ -986,6 +936,14 @@ subroutine progcld_zhao_carr                                      &
 !   effrs           : effective radius for snow water
 !   effr_in         : logical, if .true. use input effective radii
 !   dzlay(ix,nlay)  : thickness between model layer centers (km)        !
+!   lmfshal         : mass-flux shallow conv scheme flag                !
+!   lmfdeep2        : scale-aware mass-flux deep conv scheme flag       !
+!   lcrick          : control flag for eliminating CRICK                !
+!                     =t: apply layer smoothing to eliminate CRICK      !
+!                     =f: do not apply layer smoothing                  !
+!   lcnorm          : control flag for in-cld condensate                !
+!                     =t: normalize cloud condensate                    !
+!                     =f: not normalize cloud condensate                !
 !                                                                       !
 ! output variables:                                                     !
 !   cloud profiles:                                                     !
@@ -999,19 +957,6 @@ subroutine progcld_zhao_carr                                      &
 !  *** cld_swp   (:,:) - layer snow flake water path      not assigned  !
 !      cld_resnow(:,:) - mean eff radius for snow flake   (micron)      !
 !                                                                       !
-! module variables:                                                     !
-!   ivflip          : control flag of vertical index direction          !
-!                     =0: index from toa to surface                     !
-!                     =1: index from surface to toa                     !
-!   lmfshal         : mass-flux shallow conv scheme flag                !
-!   lmfdeep2        : scale-aware mass-flux deep conv scheme flag       !
-!   lcrick          : control flag for eliminating CRICK                !
-!                     =t: apply layer smoothing to eliminate CRICK      !
-!                     =f: do not apply layer smoothing                  !
-!   lcnorm          : control flag for in-cld condensate                !
-!                     =t: normalize cloud condensate                    !
-!                     =f: not normalize cloud condensate                !
-!                                                                       !
 !  ====================    end of description    =====================  !
 !
       implicit none
@@ -1019,7 +964,8 @@ subroutine progcld_zhao_carr                                      &
 !  ---  inputs
       integer,  intent(in) :: IX, NLAY, NLP1
 
-      logical, intent(in)  :: uni_cld, lmfshal, lmfdeep2, effr_in
+      logical, intent(in)  :: uni_cld, lmfshal, lmfdeep2, effr_in,      &
+     &     lcrick, lcnorm
 
       real (kind=kind_phys), dimension(:,:), intent(in) :: plvl, plyr,  &
      &       tlyr,  tvly,  qlyr,  qstl, rhly, clw, cldcov, delp, dz,    &
@@ -1027,6 +973,7 @@ subroutine progcld_zhao_carr                                      &
 
       real (kind=kind_phys), dimension(:),   intent(in) :: xlat, xlon,  &
      &       slmsk
+      real (kind=kind_phys), intent(in) :: con_ttp
 
 !  --- inputs/outputs
 
@@ -1235,7 +1182,7 @@ subroutine progcld_zhao_carr_pdf                                  &
      &       xlat,xlon,slmsk, dz, delp,                                 &
      &       ix, nlay, nlp1,                                            &
      &       deltaq,sup,kdt,me,                                         &
-     &       dzlay, cldtot, cldcnv,                                     &
+     &       dzlay, cldtot, cldcnv, lcrick, lcnorm, con_thgni, con_ttp, &
      &       cld_frac, cld_lwp, cld_reliq, cld_iwp,                     & !  ---  outputs
      &       cld_reice,cld_rwp, cld_rerain,cld_swp, cld_resnow          &
      &      )
@@ -1252,9 +1199,7 @@ subroutine progcld_zhao_carr_pdf                                  &
 !   top and base.  the three vertical cloud domains are set up in the   !
 !   initial subroutine "cld_init".                                      !
 !                                                                       !
-! usage:         call progcld_zhao_carr_pdf                                          !
-!                                                                       !
-! subprograms called:   gethml                                          !
+! usage:         call progcld_zhao_carr_pdf                             !
 !                                                                       !
 ! attributes:                                                           !
 !   language:   fortran 90                                              !
@@ -1285,6 +1230,12 @@ subroutine progcld_zhao_carr_pdf                                  &
 !   deltaq(ix,nlay) : half total water distribution width               !
 !   sup             : supersaturation                                   !
 !   dzlay(ix,nlay)  : thickness between model layer centers (km)        !
+!   lcrick          : control flag for eliminating crick                !
+!                     =t: apply layer smoothing to eliminate crick      !
+!                     =f: do not apply layer smoothing                  !
+!   lcnorm          : control flag for in-cld condensate                !
+!                     =t: normalize cloud condensate                    !
+!                     =f: not normalize cloud condensate                !
 !                                                                       !
 ! output variables:                                                     !
 !   cloud profiles:                                                     !
@@ -1298,28 +1249,18 @@ subroutine progcld_zhao_carr_pdf                                  &
 !  *** cld_swp   (:,:) - layer snow flake water path      not assigned  !
 !      cld_resnow(:,:) - mean eff radius for snow flake   (micron)      !
 !                                                                       !
-! module variables:                                                     !
-!   ivflip          : control flag of vertical index direction          !
-!                     =0: index from toa to surface                     !
-!                     =1: index from surface to toa                     !
-!   lcrick          : control flag for eliminating crick                !
-!                     =t: apply layer smoothing to eliminate crick      !
-!                     =f: do not apply layer smoothing                  !
-!   lcnorm          : control flag for in-cld condensate                !
-!                     =t: normalize cloud condensate                    !
-!                     =f: not normalize cloud condensate                !
-!                                                                       !
 !  ====================    end of description    =====================  !
 !
       implicit none
 
 !  ---  inputs
       integer,  intent(in) :: ix, nlay, nlp1,kdt
-
+      logical,  intent(in) :: lcrick, lcnorm
       real (kind=kind_phys), dimension(:,:), intent(in) :: plvl, plyr,    &
      &       tlyr, tvly, qlyr, qstl, rhly, clw, dz, delp, dzlay
 !     &       tlyr, tvly, qlyr, qstl, rhly, clw, cnvw, cnvc
 !      real (kind=kind_phys), dimension(:,:), intent(in) :: deltaq
+      real (kind=kind_phys), intent(in) :: con_thgni, con_ttp
       real (kind=kind_phys), dimension(:,:) :: deltaq, cnvw, cnvc
       real (kind=kind_phys) qtmp,qsc,rhs
       real (kind=kind_phys), intent(in) :: sup
@@ -1415,7 +1356,7 @@ subroutine progcld_zhao_carr_pdf                                  &
           do k = 1, nlay
           do i = 1, ix
             tem1 = tlyr(i,k) - 273.16
-            if(tem1 < con_thgni) then  ! for pure ice, has to be consistent with gscond
+            if(tem1 < (con_thgni - 273.16)) then  ! for pure ice, has to be consistent with gscond
               qsc = sup * qstl(i,k)
               rhs = sup
             else
@@ -1535,7 +1476,7 @@ subroutine progcld_gfdl_lin                                       &
      &     ( plyr,plvl,tlyr,tvly,qlyr,qstl,rhly,clw,cnvw,cnvc,          & !  ---  inputs:
      &       xlat,xlon,slmsk,cldtot, dz, delp,                          &
      &       IX, NLAY, NLP1,                                            &
-     &       dzlay, cldtot1, cldcnv,                                    &
+     &       dzlay, cldtot1, cldcnv, lcrick, lcnorm, con_ttp,           &
      &       cld_frac, cld_lwp, cld_reliq, cld_iwp,                     & !  ---  outputs
      &       cld_reice,cld_rwp, cld_rerain,cld_swp, cld_resnow          &
      &      )
@@ -1552,9 +1493,7 @@ subroutine progcld_gfdl_lin                                       &
 !   top and base.  the three vertical cloud domains are set up in the   !
 !   initial subroutine "cld_init".                                      !
 !                                                                       !
-! usage:         call progcld_gfdl_lin                                          !
-!                                                                       !
-! subprograms called:   gethml                                          !
+! usage:         call progcld_gfdl_lin                                  !
 !                                                                       !
 ! attributes:                                                           !
 !   language:   fortran 90                                              !
@@ -1583,6 +1522,12 @@ subroutine progcld_gfdl_lin                                       &
 !   IX              : horizontal dimention                              !
 !   NLAY,NLP1       : vertical layer/level dimensions                   !
 !   dzlay(ix,nlay)  : thickness between model layer centers (km)        !
+!   lcrick          : control flag for eliminating CRICK                !
+!                     =t: apply layer smoothing to eliminate CRICK      !
+!                     =f: do not apply layer smoothing                  !
+!   lcnorm          : control flag for in-cld condensate                !
+!                     =t: normalize cloud condensate                    !
+!                     =f: not normalize cloud condensate                ! 
 !                                                                       !
 ! output variables:                                                     !
 !   cloud profiles:                                                     !
@@ -1596,28 +1541,17 @@ subroutine progcld_gfdl_lin                                       &
 !  *** cld_swp   (:,:) - layer snow flake water path      not assigned  !
 !      cld_resnow(:,:) - mean eff radius for snow flake   (micron)      !
 !                                                                       !
-! module variables:                                                     !
-!   ivflip          : control flag of vertical index direction          !
-!                     =0: index from toa to surface                     !
-!                     =1: index from surface to toa                     !
-!   lsashal         : control flag for shallow convection               !
-!   lcrick          : control flag for eliminating CRICK                !
-!                     =t: apply layer smoothing to eliminate CRICK      !
-!                     =f: do not apply layer smoothing                  !
-!   lcnorm          : control flag for in-cld condensate                !
-!                     =t: normalize cloud condensate                    !
-!                     =f: not normalize cloud condensate                !
-!                                                                       !
 !  ====================    end of description    =====================  !
 !
       implicit none
 
 !  ---  inputs
       integer,  intent(in) :: IX, NLAY, NLP1
-
+      logical,  intent(in) :: lcrick, lcnorm
       real (kind=kind_phys), dimension(:,:), intent(in) :: plvl, plyr,  &
      &       tlyr, tvly, qlyr, qstl, rhly, clw, cldtot, cnvw, cnvc,     &
      &       delp, dz, dzlay
+      real (kind=kind_phys) :: con_ttp
 
       real (kind=kind_phys), dimension(:),   intent(in) :: xlat, xlon,  &
      &       slmsk
@@ -1785,7 +1719,7 @@ subroutine progcld_fer_hires                                      &
      &       IX, NLAY, NLP1, icloud,                                    &
      &       uni_cld, lmfshal, lmfdeep2, cldcov,                        &
      &       re_cloud,re_ice,re_snow,                                   &
-     &       dzlay, cldtot, cldcnv,                                     &
+     &       dzlay, cldtot, cldcnv, lcnorm,                             &
      &       cld_frac, cld_lwp, cld_reliq, cld_iwp,                     & !  ---  outputs
      &       cld_reice,cld_rwp, cld_rerain,cld_swp, cld_resnow          &
      &      )
@@ -1802,9 +1736,7 @@ subroutine progcld_fer_hires                                      &
 !   top and base.  the three vertical cloud domains are set up in the   !
 !   initial subroutine "cld_init".                                      !
 !                                                                       !
-! usage:         call progcld_fer_hires                                          !
-!                                                                       !
-! subprograms called:   gethml                                          !
+! usage:         call progcld_fer_hires                                 !
 !                                                                       !
 ! attributes:                                                           !
 !   language:   fortran 90                                              !
@@ -1836,6 +1768,14 @@ subroutine progcld_fer_hires                                      &
 !   lmfdeep2        : logical - true for mass flux deep convection      !
 !   cldcov          : layer cloud fraction (used when uni_cld=.true.    !
 !   dzlay(ix,nlay)  : thickness between model layer centers (km)        !
+!   lmfshal         : mass-flux shallow conv scheme flag                !
+!   lmfdeep2        : scale-aware mass-flux deep conv scheme flag       !
+!   lcrick          : control flag for eliminating CRICK                !
+!                     =t: apply layer smoothing to eliminate CRICK      !
+!                     =f: do not apply layer smoothing                  !
+!   lcnorm          : control flag for in-cld condensate                !
+!                     =t: normalize cloud condensate                    !
+!                     =f: not normalize cloud condensate                !
 !                                                                       !
 ! output variables:                                                     !
 !   cloud profiles:                                                     !
@@ -1849,19 +1789,6 @@ subroutine progcld_fer_hires                                      &
 !  *** cld_swp   (:,:) - layer snow flake water path      not assigned  !
 !      cld_resnow(:,:) - mean eff radius for snow flake   (micron)      !
 !                                                                       !
-! module variables:                                                     !
-!   ivflip          : control flag of vertical index direction          !
-!                     =0: index from toa to surface                     !
-!                     =1: index from surface to toa                     !
-!   lmfshal         : mass-flux shallow conv scheme flag                !
-!   lmfdeep2        : scale-aware mass-flux deep conv scheme flag       !
-!   lcrick          : control flag for eliminating CRICK                !
-!                     =t: apply layer smoothing to eliminate CRICK      !
-!                     =f: do not apply layer smoothing                  !
-!   lcnorm          : control flag for in-cld condensate                !
-!                     =t: normalize cloud condensate                    !
-!                     =f: not normalize cloud condensate                !
-!                                                                       !
 !  ====================    end of description    =====================  !
 !
       implicit none
@@ -1870,7 +1797,7 @@ subroutine progcld_fer_hires                                      &
       integer,  intent(in) :: IX, NLAY, NLP1, ICLOUD
       integer,  intent(in) :: ntrac, ntcw, ntiw, ntrw
 
-      logical, intent(in)  :: uni_cld, lmfshal, lmfdeep2
+      logical, intent(in)  :: uni_cld, lmfshal, lmfdeep2, lcnorm
 
       real (kind=kind_phys), dimension(:,:), intent(in) :: plvl, plyr,  &
      &       tlyr, tvly, qlyr, qstl, rhly, cldcov, delp, dz, dzlay
@@ -2040,7 +1967,7 @@ subroutine progcld_thompson_wsm6                                  &
      &       uni_cld, lmfshal, lmfdeep2, cldcov, cnvw,                  &
      &       re_cloud,re_ice,re_snow,                                   &
      &       lwp_ex, iwp_ex, lwp_fc, iwp_fc,                            &
-     &       dzlay, cldtot, cldcnv,                                     &
+     &       dzlay, cldtot, cldcnv, lcnorm,                             &
      &       cld_frac, cld_lwp, cld_reliq, cld_iwp,                     & !  ---  outputs
      &       cld_reice,cld_rwp, cld_rerain,cld_swp, cld_resnow          &
      &      )
@@ -2058,9 +1985,7 @@ subroutine progcld_thompson_wsm6                                  &
 !   top and base.  the three vertical cloud domains are set up in the   !
 !   initial subroutine "cld_init".                                      !
 !                                                                       !
-! usage:         call progcld_thompson_wsm6                                          !
-!                                                                       !
-! subprograms called:   gethml                                          !
+! usage:         call progcld_thompson_wsm6                             !
 !                                                                       !
 ! attributes:                                                           !
 !   language:   fortran 90                                              !
@@ -2091,6 +2016,14 @@ subroutine progcld_thompson_wsm6                                  &
 !   lmfshal         : logical - true for mass flux shallow convection   !
 !   lmfdeep2        : logical - true for mass flux deep convection      !
 !   cldcov          : layer cloud fraction (used when uni_cld=.true.    !
+!   lmfshal         : mass-flux shallow conv scheme flag                !
+!   lmfdeep2        : scale-aware mass-flux deep conv scheme flag       !
+!   lcrick          : control flag for eliminating CRICK                !
+!                     =t: apply layer smoothing to eliminate CRICK      !
+!                     =f: do not apply layer smoothing                  !
+!   lcnorm          : control flag for in-cld condensate                !
+!                     =t: normalize cloud condensate                    !
+!                     =f: not normalize cloud condensate                !  
 !                                                                       !
 ! output variables:                                                     !
 !   cloud profiles:                                                     !
@@ -2109,19 +2042,6 @@ subroutine progcld_thompson_wsm6                                  &
 !   mbot  (IX,3)    : vertical indices for low, mid, hi cloud bases     !
 !   de_lgth(ix)     : clouds decorrelation length (km)                  !
 !                                                                       !
-! module variables:                                                     !
-!   ivflip          : control flag of vertical index direction          !
-!                     =0: index from toa to surface                     !
-!                     =1: index from surface to toa                     !
-!   lmfshal         : mass-flux shallow conv scheme flag                !
-!   lmfdeep2        : scale-aware mass-flux deep conv scheme flag       !
-!   lcrick          : control flag for eliminating CRICK                !
-!                     =t: apply layer smoothing to eliminate CRICK      !
-!                     =f: do not apply layer smoothing                  !
-!   lcnorm          : control flag for in-cld condensate                !
-!                     =t: normalize cloud condensate                    !
-!                     =f: not normalize cloud condensate                !
-!                                                                       !
 !  ====================    end of description    =====================  !
 !
       implicit none
@@ -2130,7 +2050,7 @@ subroutine progcld_thompson_wsm6                                  &
       integer,  intent(in) :: IX, NLAY, NLP1
       integer,  intent(in) :: ntrac, ntcw, ntiw, ntrw, ntsw, ntgl
 
-      logical, intent(in)  :: uni_cld, lmfshal, lmfdeep2
+      logical, intent(in)  :: uni_cld, lmfshal, lmfdeep2, lcnorm
 
       real (kind=kind_phys), dimension(:,:), intent(in) :: plvl, plyr,  &
      &       tlyr, qlyr, qstl, rhly, cldcov, delp, dz, dzlay,           &
@@ -2335,7 +2255,7 @@ subroutine progcld_thompson                                       &
      &       uni_cld, lmfshal, lmfdeep2, cldcov,                        &
      &       re_cloud,re_ice,re_snow,                                   &
      &       lwp_ex, iwp_ex, lwp_fc, iwp_fc,                            &
-     &       dzlay,  gridkm, cldtot, cldcnv,                            &
+     &       dzlay,  gridkm, top_at_1, cldtot, cldcnv,                  &
      &       cld_frac, cld_lwp, cld_reliq, cld_iwp,                     & !  ---  outputs
      &       cld_reice,cld_rwp, cld_rerain,cld_swp, cld_resnow          &
      &      )
@@ -2354,8 +2274,6 @@ subroutine progcld_thompson                                       &
 !                                                                       !
 ! usage:         call progcld_thompson                                  !
 !                                                                       !
-! subprograms called:   gethml                                          !
-!                                                                       !
 ! attributes:                                                           !
 !   language:   fortran 90                                              !
 !   machine:    ibm-sp, sgi                                             !
@@ -2385,7 +2303,16 @@ subroutine progcld_thompson                                       &
 !   uni_cld         : logical - true for cloud fraction from shoc       !
 !   lmfshal         : logical - true for mass flux shallow convection   !
 !   lmfdeep2        : logical - true for mass flux deep convection      !
+!   top_at_1        : logical - true if vertical ordereing is toa-2-sfc !
 !   cldcov          : layer cloud fraction (used when uni_cld=.true.    !
+!   lmfshal         : mass-flux shallow conv scheme flag                !
+!   lmfdeep2        : scale-aware mass-flux deep conv scheme flag       !
+!   lcrick          : control flag for eliminating CRICK                !
+!                     =t: apply layer smoothing to eliminate CRICK      !
+!                     =f: do not apply layer smoothing                  !
+!   lcnorm          : control flag for in-cld condensate                !
+!                     =t: normalize cloud condensate                    !
+!                     =f: not normalize cloud condensate                !
 !                                                                       !
 ! output variables:                                                     !
 !   cloud profiles:                                                     !
@@ -2399,19 +2326,6 @@ subroutine progcld_thompson                                       &
 !  *** cld_swp   (:,:) - layer snow flake water path      not assigned  !
 !      cld_resnow(:,:) - mean eff radius for snow flake   (micron)      !
 !                                                                       !
-! module variables:                                                     !
-!   ivflip          : control flag of vertical index direction          !
-!                     =0: index from toa to surface                     !
-!                     =1: index from surface to toa                     !
-!   lmfshal         : mass-flux shallow conv scheme flag                !
-!   lmfdeep2        : scale-aware mass-flux deep conv scheme flag       !
-!   lcrick          : control flag for eliminating CRICK                !
-!                     =t: apply layer smoothing to eliminate CRICK      !
-!                     =f: do not apply layer smoothing                  !
-!   lcnorm          : control flag for in-cld condensate                !
-!                     =t: normalize cloud condensate                    !
-!                     =f: not normalize cloud condensate                !
-!                                                                       !
 !  ====================    end of description    =====================  !
 !
       implicit none
@@ -2420,7 +2334,7 @@ subroutine progcld_thompson                                       &
       integer,  intent(in) :: IX, NLAY, NLP1
       integer,  intent(in) :: ntrac, ntcw, ntiw, ntrw, ntsw, ntgl
 
-      logical, intent(in)  :: uni_cld, lmfshal, lmfdeep2
+      logical, intent(in)  :: uni_cld, lmfshal, lmfdeep2, top_at_1
 
       real (kind=kind_phys), dimension(:,:), intent(in) :: plvl, plyr,  &
      &       tlyr, qlyr, qstl, rhly, cldcov, delp, dz, dzlay,           &
@@ -2524,7 +2438,7 @@ subroutine progcld_thompson                                       &
 
          cldfra1d(:) = 0.0
 
-         if (ivflip .eq. 1) then
+         if (.not. top_at_1) then
             do k = 1, NLAY
                qv1d(k) = qlyr(i,k)
                qc1d(k) = max(0.0, clw(i,k,ntcw))
@@ -2618,7 +2532,7 @@ subroutine progclduni                                             &
      &     ( plyr,plvl,tlyr,tvly,ccnd,ncnd,                             &    !  ---  inputs:
      &       xlat,xlon,slmsk,dz,delp, IX, NLAY, NLP1, cldtot,           &
      &       effrl,effri,effrr,effrs,effr_in,                           &
-     &       dzlay, cldtot1, cldcnv,                                     &
+     &       dzlay, cldtot1, cldcnv, lcrick, lcnorm, con_ttp,           &
      &       cld_frac, cld_lwp, cld_reliq, cld_iwp,                     & !  ---  outputs
      &       cld_reice,cld_rwp, cld_rerain,cld_swp, cld_resnow          &
      &      )
@@ -2640,8 +2554,6 @@ subroutine progclduni                                             &
 !                                                                       !
 ! usage:         call progclduni                                        !
 !                                                                       !
-! subprograms called:   gethml                                          !
-!                                                                       !
 ! attributes:                                                           !
 !   language:   fortran 90                                              !
 !   machine:    ibm-sp, sgi                                             !
@@ -2672,6 +2584,14 @@ subroutine progclduni                                             &
 !   dz    (ix,nlay)      : layer thickness (km)                              !
 !   delp  (ix,nlay)      : model layer pressure thickness in mb (100Pa)      !
 !   dzlay(ix,nlay)  : thickness between model layer centers (km)        !
+!   lmfshal         : mass-flux shallow conv scheme flag                !
+!   lmfdeep2        : scale-aware mass-flux deep conv scheme flag       !
+!   lcrick          : control flag for eliminating CRICK                !
+!                     =t: apply layer smoothing to eliminate CRICK      !
+!                     =f: do not apply layer smoothing                  !
+!   lcnorm          : control flag for in-cld condensate                !
+!                     =t: normalize cloud condensate                    !
+!                     =f: not normalize cloud condensate                !
 !                                                                       !
 ! output variables:                                                     !
 !   cloud profiles:                                                     !
@@ -2689,20 +2609,7 @@ subroutine progclduni                                             &
 !   mtop  (IX,3)    : vertical indices for low, mid, hi cloud tops      !
 !   mbot  (IX,3)    : vertical indices for low, mid, hi cloud bases     !
 !   de_lgth(ix)     : clouds decorrelation length (km)                  !
-!   alpha(ix,nlay)  : alpha decorrelation parameter
-!                                                                       !
-! module variables:                                                     !
-!   ivflip          : control flag of vertical index direction          !
-!                     =0: index from toa to surface                     !
-!                     =1: index from surface to toa                     !
-!   lmfshal         : mass-flux shallow conv scheme flag                !
-!   lmfdeep2        : scale-aware mass-flux deep conv scheme flag       !
-!   lcrick          : control flag for eliminating CRICK                !
-!                     =t: apply layer smoothing to eliminate CRICK      !
-!                     =f: do not apply layer smoothing                  !
-!   lcnorm          : control flag for in-cld condensate                !
-!                     =t: normalize cloud condensate                    !
-!                     =f: not normalize cloud condensate                !
+!   alpha(ix,nlay)  : alpha decorrelation parameter                     !
 !                                                                       !
 !  ====================    end of description    =====================  !
 !
@@ -2710,8 +2617,9 @@ subroutine progclduni                                             &
 
 !  ---  inputs
       integer,  intent(in) :: IX, NLAY, NLP1, ncnd
-      logical,  intent(in) :: effr_in
+      logical,  intent(in) :: effr_in, lcrick, lcnorm
 
+      real (kind=kind_phys), intent(in) :: con_ttp
       real (kind=kind_phys), dimension(:,:,:), intent(in) :: ccnd
       real (kind=kind_phys), dimension(:,:),   intent(in) :: plvl, plyr,&
      &       tlyr, tvly, cldtot, effrl, effri, effrr, effrs, dz, delp,  &
@@ -2923,8 +2831,8 @@ end subroutine progclduni
 !>\section detail Detailed Algorithm
       subroutine gethml                                                 &
      &     ( plyr, ptop1, cldtot, cldcnv, dz, de_lgth, alpha,           &       !  ---  inputs:
-     &       IX, NLAY, iovr_rand, iovr_maxrand, iovr_max,               &
-     &       iovr_dcorr, iovr_exp, iovr_exprand,                        &
+     &       IX, NLAY, iovr, iovr_rand, iovr_maxrand, iovr_max,         &
+     &       iovr_dcorr, iovr_exp, iovr_exprand, top_at_1, si,          &
      &       clds, mtop, mbot                                           &       !  ---  outputs:
      &     )
 
@@ -2962,13 +2870,7 @@ subroutine gethml                                                 &
 ! output variables:                                                     !
 !   clds  (IX,5)    : fraction of clouds for low, mid, hi, tot, bl      !
 !   mtop  (IX,3)    : vertical indices for low, mid, hi cloud tops      !
-!   mbot  (IX,3)    : vertical indices for low, mid, hi cloud bases     !
-!                                                                       !
-! external module variables:  (in physparam)                            !
-!   ivflip          : control flag of vertical index direction          !
-!                     =0: index from toa to surface                     !
-!                     =1: index from surface to toa                     !
-!                                                                       !
+!   mbot  (IX,3)    : vertical indices for low, mid, hi cloud bases     !                                                              !
 ! internal module variables:                                            !
 !   iovr            : control flag for cloud overlap                    !
 !                     =0 random overlapping clouds                      !
@@ -2983,8 +2885,10 @@ subroutine gethml                                                 &
       implicit none!
 
 !  ---  inputs:
+      logical, intent(in) :: top_at_1
       integer, intent(in) :: IX, NLAY
       integer, intent(in) ::                                            &
+     &     iovr,                         !
      &     iovr_rand,                    ! Flag for random cloud overlap method
      &     iovr_maxrand,                 ! Flag for maximum-random cloud overlap method
      &     iovr_max,                     ! Flag for maximum cloud overlap method
@@ -2994,7 +2898,7 @@ subroutine gethml                                                 &
 
       real (kind=kind_phys), dimension(:,:), intent(in) :: plyr, ptop1, &
      &       cldtot, cldcnv, dz
-      real (kind=kind_phys), dimension(:),   intent(in) :: de_lgth
+      real (kind=kind_phys), dimension(:),   intent(in) :: de_lgth, si
       real (kind=kind_phys), dimension(:,:), intent(in) :: alpha
 
 !  ---  outputs
@@ -3007,11 +2911,30 @@ subroutine gethml                                                 &
       real (kind=kind_phys) :: pcur, pnxt, ccur, cnxt, alfa
 
       integer, dimension(IX):: idom, kbt1, kth1, kbt2, kth2
-      integer :: i, k, id, id1, kstr, kend, kinc
+      integer :: i, k, id, id1, kstr, kend, kinc,kl
 
 !
 !===> ... begin here
 !
+!> - Compute the top of BL cld (llyr), which is the topmost non
+!!    cld(low) layer for stratiform (at or above lowest 0.1 of the
+!!     atmosphere).
+
+      if (top_at_1) then    ! data from toa to sfc
+        lab_do_k0 : do k = NLAY, 2, -1
+          kl = k
+          if (si(k) < 0.9e0) exit lab_do_k0
+        enddo  lab_do_k0
+        llyr = kl
+      else                      ! data from sfc to top
+        lab_do_k1 : do k = 2, NLAY
+          kl = k
+          if (si(k) < 0.9e0) exit lab_do_k1
+        enddo  lab_do_k1
+
+        llyr = kl - 1
+      endif                     ! end_if_top_at_1
+
       clds(:,:) = 0.0
 
       do i = 1, IX
@@ -3025,7 +2948,7 @@ subroutine gethml                                                 &
 !> - Calculate total and BL cloud fractions (maximum-random cloud
 !!    overlapping is operational).
 
-      if ( ivflip == 0 ) then                   ! input data from toa to sfc
+      if (top_at_1) then                   ! input data from toa to sfc
         kstr = NLAY
         kend = 1
         kinc = -1
@@ -3033,7 +2956,7 @@ subroutine gethml                                                 &
         kstr = 1
         kend = NLAY
         kinc = 1
-      endif                                     ! end_if_ivflip
+      endif                                     ! end_if_top_at_1
 
       if ( iovr == iovr_rand ) then                     ! random overlap
 
@@ -3167,7 +3090,7 @@ subroutine gethml                                                 &
 
 !> - Calculte high, mid, low cloud fractions and vertical indices of
 !!    cloud tops/bases.
-      if ( ivflip == 0 ) then                   ! input data from toa to sfc
+      if (top_at_1) then                   ! input data from toa to sfc
 
         do i = 1, IX
           cl1 (i) = 0.0
@@ -3331,7 +3254,7 @@ subroutine gethml                                                 &
           enddo       ! end_do_i_loop
         enddo         ! end_do_k_loop
 
-      endif                                     ! end_if_ivflip
+      endif                                     ! end_if_top_at_1
 
 !
       return
diff --git a/physics/radiation_gases.f b/physics/radiation_gases.f
index b5eb8ffb9..85204e5ab 100644
--- a/physics/radiation_gases.f
+++ b/physics/radiation_gases.f
@@ -80,7 +80,7 @@
 !     nov 2008 - y-t hou     fix bugs in superimposing climatology     !
 !                  seasonal cycle calculations                         !
 !     aug 2011 - y-t hou     fix a bug in subr getgases doing vertical !
-!                  co2 mapping. (for iflip=0 case, not affact opr).    !
+!                  co2 mapping. (for top_at_1 case, not affact opr).   !
 !     aug 2012 - y-t hou     modified subr getozn.  moved the if-first !
 !                  block to subr gas_init to ensure threading safe in  !
 !                  climatology ozone applications. (not affect gfs)    !
diff --git a/physics/radlw_main.meta b/physics/radlw_main.meta
index 8dc1db046..e336e6011 100644
--- a/physics/radlw_main.meta
+++ b/physics/radlw_main.meta
@@ -1,7 +1,7 @@
 [ccpp-table-properties]
   name = rrtmg_lw
   type = scheme
-  dependencies = machine.F,mersenne_twister.f,physcons.F90,physparam.f,radlw_datatb.f,radlw_param.f
+  dependencies = machine.F,mersenne_twister.f,physcons.F90,radlw_datatb.f,radlw_param.f
 
 ########################################################################
 [ccpp-arg-table]

From 1d8998d80035d36e3250810c546e6a01fb696939 Mon Sep 17 00:00:00 2001
From: Dustin Swales <dustin.swales@noaa.gov>
Date: Wed, 31 Aug 2022 16:19:42 +0000
Subject: [PATCH 015/115] Revert change to CMakeLists.txt

---
 CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 242275411..d14778b06 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -195,7 +195,7 @@ set_target_properties(ccpp_physics PROPERTIES VERSION ${PROJECT_VERSION}
 target_include_directories(ccpp_physics PUBLIC
                            $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>)
 
-target_link_libraries(ccpp_physics PUBLIC w3nco::w3nco_d NetCDF::NetCDF_Fortran)
+target_link_libraries(ccpp_physics PUBLIC w3emc::w3emc_d NetCDF::NetCDF_Fortran)
 
 # Define where to install the library
 install(TARGETS ccpp_physics

From 82bcd677c7c54efab29bbbb32099519ee687a6b3 Mon Sep 17 00:00:00 2001
From: Dustin Swales <dustin.swales@noaa.gov>
Date: Tue, 6 Sep 2022 20:25:14 +0000
Subject: [PATCH 016/115] Omission from previous commit

---
 physics/physcons.F90 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/physics/physcons.F90 b/physics/physcons.F90
index 41d37491a..7b7a71c98 100644
--- a/physics/physcons.F90
+++ b/physics/physcons.F90
@@ -53,8 +53,8 @@ module physcons
   real(kind=kind_phys),parameter:: con_omega  =7.2921e-5_kind_phys                 !< ang vel of earth (\f$s^{-1}\f$)
   real(kind=kind_phys),parameter:: con_p0     =1.01325e5_kind_phys                 !< standard atmospheric pressure (\f$Pa\f$)
 ! real(kind=kind_phys),parameter:: con_solr   =1.36822e+3_kind_phys                ! solar constant    (W/m2)-aer(2001)
-  real(kind=kind_phys),parameter:: con_solr_old =1.3660e+3_kind_phys               !< solar constant (\f$W/m^{2}\f$)-Liu(2002)
-  real(kind=kind_phys),parameter:: con_solr   =1.3608e+3_kind_phys                 !< solar constant (\f$W/m^{2}\f$)-nasa-sorce Tim(2008)
+  real(kind=kind_phys),parameter:: con_solr_2002 =1.3660e+3_kind_phys              !< solar constant (\f$W/m^{2}\f$)-Liu(2002)
+  real(kind=kind_phys),parameter:: con_solr_2008 =1.3608e+3_kind_phys              !< solar constant (\f$W/m^{2}\f$)-nasa-sorce Tim(2008)
 ! real(kind=kind_phys),parameter:: con_solr   =1.36742732e+3_kind_phys             ! solar constant    (W/m2)-gfdl(1989) - OPR as of Jan 2006
   ! Selected geophysics/astronomy constants with kind=kind_dyn
   real(kind=kind_dyn), parameter:: con_g_dyn  =9.80665e+0_kind_dyn                 !< gravity (\f$m/s^{2}\f$)

From 2f9e6041743ae32e8a3c446c1dfd5a5b6cc76d50 Mon Sep 17 00:00:00 2001
From: Dustin Swales <dustin.swales@noaa.gov>
Date: Wed, 7 Sep 2022 14:15:50 -0600
Subject: [PATCH 017/115] Adress reviewers comments

---
 physics/GFS_cloud_diagnostics.F90     |  68 +++++------
 physics/GFS_cloud_diagnostics.meta    |   6 +-
 physics/GFS_rrtmg_pre.meta            |   4 +-
 physics/GFS_rrtmg_setup.F90           |  65 +++++-----
 physics/GFS_rrtmg_setup.meta          |  42 +++++++
 physics/GFS_rrtmgp_cloud_overlap.meta |   4 +-
 physics/GFS_rrtmgp_pre.meta           |   4 +-
 physics/radiation_gases.f             | 165 +++++++++++++++++++++++---
 physics/radlw_main.F90                |  63 +++++++---
 physics/radlw_main.meta               |  46 ++++++-
 physics/radsw_main.F90                |  70 +++++++----
 physics/radsw_main.meta               |  46 ++++++-
 physics/rrtmgp_aerosol_optics.meta    |   4 +-
 physics/rrtmgp_lw_rte.meta            |   4 +-
 physics/rrtmgp_sw_rte.meta            |   4 +-
 15 files changed, 457 insertions(+), 138 deletions(-)

diff --git a/physics/GFS_cloud_diagnostics.F90 b/physics/GFS_cloud_diagnostics.F90
index 49cb992de..86dc2b518 100644
--- a/physics/GFS_cloud_diagnostics.F90
+++ b/physics/GFS_cloud_diagnostics.F90
@@ -38,47 +38,47 @@ subroutine GFS_cloud_diagnostics_run(nCol, nLev, iovr, iovr_rand, iovr_maxrand,
     implicit none
      
     ! Inputs 
-    integer, intent(in) ::                 &
-         nCol,                             & ! Number of horizontal grid-points
-         nLev                                ! Number of vertical-layers
-    integer, intent(in) ::                 &
-         iovr,                             & !
-         iovr_rand,                        & ! Flag for random cloud overlap method
-         iovr_maxrand,                     & ! Flag for maximum-random cloud overlap method
-         iovr_max,                         & ! Flag for maximum cloud overlap method
-         iovr_dcorr,                       & ! Flag for decorrelation-length cloud overlap method
-         iovr_exp,                         & ! Flag for exponential cloud overlap method
-         iovr_exprand                        ! Flag for exponential-random cloud overlap method
-    logical, intent(in) :: &
-    	 lsswr,                            & ! Call SW radiation?
-    	 lslwr,                            & ! Call LW radiation 
-         top_at_1
-    real(kind_phys), intent(in) ::         &
-         con_pi                              ! Physical constant: pi  
+    integer, intent(in) ::     &
+         nCol,                 & ! Number of horizontal grid-points
+         nLev                    ! Number of vertical-layers
+    integer, intent(in) ::     &
+         iovr,                 & ! Choice of cloud-overlap method
+         iovr_rand,            & ! Flag for random cloud overlap method
+         iovr_maxrand,         & ! Flag for maximum-random cloud overlap method
+         iovr_max,             & ! Flag for maximum cloud overlap method
+         iovr_dcorr,           & ! Flag for decorrelation-length cloud overlap method
+         iovr_exp,             & ! Flag for exponential cloud overlap method
+         iovr_exprand            ! Flag for exponential-random cloud overlap method
+    logical, intent(in) ::     &
+    	 lsswr,                & ! Call SW radiation?
+    	 lslwr,                & ! Call LW radiation?
+         top_at_1                ! Vertical ordering flag
+    real(kind_phys), intent(in) :: &
+         con_pi                  ! Physical constant: pi
     real(kind_phys), dimension(:), intent(in) ::   &
-         lat,                                      & ! Latitude       
-         de_lgth,                                  & ! Decorrelation length     
-         si
+         lat,                  & ! Latitude
+         de_lgth,              & ! Decorrelation length
+         si                      ! Vertical sigma coordinate
     real(kind_phys), dimension(:,:), intent(in) :: &
-         p_lay,                                    & ! Pressure at model-layer
-         cld_frac                                    ! Total cloud fraction
+         p_lay,                & ! Pressure at model-layer
+         cld_frac                ! Total cloud fraction
     real(kind_phys), dimension(:,:), intent(in) :: &
-         p_lev                                       ! Pressure at model interfaces         
+         p_lev                   ! Pressure at model interfaces         
     real(kind_phys), dimension(:,:), intent(in) :: &
-    	 deltaZ,                                   & ! Layer thickness (m)
-         cloud_overlap_param,                      & ! Cloud-overlap parameter
-         precip_overlap_param                        ! Precipitation overlap parameter
+    	 deltaZ,               & ! Layer thickness (m)
+         cloud_overlap_param,  & ! Cloud-overlap parameter
+         precip_overlap_param    ! Precipitation overlap parameter
     
     ! Outputs
-    character(len=*), intent(out) ::               &
-         errmsg                                      ! Error message
-    integer, intent(out) ::                        &  
-         errflg                                      ! Error flag
-    integer,dimension(:,:),intent(out) ::          &
-         mbota,                                    & ! Vertical indices for cloud tops
-         mtopa                                       ! Vertical indices for cloud bases
+    character(len=*), intent(out) :: &
+         errmsg                  ! Error message
+    integer, intent(out) :: &  
+         errflg                  ! Error flag
+    integer,dimension(:,:),intent(out) :: &
+         mbota,                & ! Vertical indices for cloud tops
+         mtopa                   ! Vertical indices for cloud bases
     real(kind_phys),dimension(:,:), intent(out) :: &
-         cldsa                                       ! Fraction of clouds for low, middle, high, total and BL 
+         cldsa                   ! Fraction of clouds for low, middle, high, total and BL 
     
     ! Local variables
     integer i,id,iCol,iLay,icld
diff --git a/physics/GFS_cloud_diagnostics.meta b/physics/GFS_cloud_diagnostics.meta
index 2408397d6..53d1552e6 100644
--- a/physics/GFS_cloud_diagnostics.meta
+++ b/physics/GFS_cloud_diagnostics.meta
@@ -1,7 +1,7 @@
 [ccpp-table-properties]
   name = GFS_cloud_diagnostics
   type = scheme
-  dependencies = machine.F
+  dependencies = machine.F,radiation_clouds.f
 
 ########################################################################
 [ccpp-arg-table]
@@ -157,8 +157,8 @@
   kind = kind_phys
   intent = in
 [top_at_1]
-  standard_name = flag_for_vertical_ordering_in_RRTMGP
-  long_name = flag for vertical ordering in RRTMGP
+  standard_name = flag_for_vertical_ordering_in_radiation
+  long_name = flag for vertical ordering in radiation
   units = flag
   dimensions = ()
   type = logical
diff --git a/physics/GFS_rrtmg_pre.meta b/physics/GFS_rrtmg_pre.meta
index cb158346a..228b73f20 100644
--- a/physics/GFS_rrtmg_pre.meta
+++ b/physics/GFS_rrtmg_pre.meta
@@ -1388,8 +1388,8 @@
   kind = kind_phys
   intent = out
 [top_at_1]
-  standard_name = flag_for_vertical_ordering_in_RRTMGP
-  long_name = flag for vertical ordering in RRTMGP
+  standard_name = flag_for_vertical_ordering_in_radiation
+  long_name = flag for vertical ordering in radiation
   units = flag
   dimensions = ()
   type = logical
diff --git a/physics/GFS_rrtmg_setup.F90 b/physics/GFS_rrtmg_setup.F90
index 543776e80..5ad446985 100644
--- a/physics/GFS_rrtmg_setup.F90
+++ b/physics/GFS_rrtmg_setup.F90
@@ -39,12 +39,14 @@ module GFS_rrtmg_setup
 !! \htmlinclude GFS_rrtmg_setup_init.html
 !!
    subroutine GFS_rrtmg_setup_init ( si, levr, ictm, isol, solar_file, ico2, &
-        iaer, ntcw, num_p3d, npdf3d, ntoz, iovr, icliq_sw, lcrick, lcnorm,   &
-        imp_physics, lnoprec, idate, iflip, do_RRTMGP, me, lalw1bd, iaermdl, &
-        iaerflg, aeros_file, con_pi, con_t0c, con_c, con_boltz, con_plnk,    &
-        con_solr_2008, con_solr_2002, co2usr_file, co2cyc_file, rad_hr_units,&
-        inc_minor_gas, ilwcliq, iswcliq, isubcsw, isubclw, iswmode, ipsd0,   &
-        errmsg, errflg)
+        iaer, ntcw, num_p3d, npdf3d, ntoz, iovr, iovr_rand, iovr_maxrand,    &
+        iovr_max, iovr_dcorr, iovr_exp, iovr_exprand, icliq_sw, lcrick,      &
+        lcnorm, imp_physics, lnoprec, idate, iflip, do_RRTMGP, me, lalw1bd,  &
+        iaermdl, iaerflg, aeros_file, con_pi, con_t0c, con_c, con_boltz,     &
+        con_plnk, con_solr_2008, con_solr_2002, co2usr_file, co2cyc_file,    &
+        rad_hr_units, inc_minor_gas, ilwcliq, iswcliq, isubcsw, isubclw,     &
+        iswmode, ipsd0, errmsg, errflg)
+
 ! =================   subprogram documentation block   ================ !
 !                                                                       !
 ! subprogram:   GFS_rrtmg_setup_init - a subprogram to initialize radiation !
@@ -151,8 +153,10 @@ subroutine GFS_rrtmg_setup_init ( si, levr, ictm, isol, solar_file, ico2, &
       ! interface variables
       real (kind=kind_phys), intent(in) :: si(:)
       integer, intent(in) :: levr, ictm, isol, ico2, iaer, ntcw, num_p3d, &
-           npdf3d, ntoz, iovr, icliq_sw, imp_physics, iflip,  me,         &
-           rad_hr_units, ilwcliq, iswcliq, isubcsw,  isubclw, iswmode
+           npdf3d, ntoz, iovr, iovr_rand, iovr_maxrand, iovr_max,         &
+           iovr_dcorr, iovr_exp, iovr_exprand, icliq_sw, imp_physics,     &
+           iflip, me, rad_hr_units, ilwcliq, iswcliq, isubcsw, isubclw,   &
+           iswmode
       integer, intent(in) :: idate(:)
       logical, intent(in) :: lcrick, lcnorm, lnoprec, do_RRTMGP, lalw1bd, &
            inc_minor_gas
@@ -197,32 +201,37 @@ subroutine GFS_rrtmg_setup_init ( si, levr, ictm, isol, solar_file, ico2, &
       endif
 
       if ( me == 0 ) then
-        print *,'  In rad_initialize (GFS_rrtmg_setup_init), before calling radinit'
-        print *,' si =',si
-        print *,' levr=',levr,' ictm=',ictm,' isol=',isol,' ico2=',ico2,&
-     &          ' iaermdl=',iaermdl,' iaerflg=',iaerflg
-        print *,' np3d=',num_p3d,' ntoz=',ntoz,                         &
-     &          ' iovr=',iovr,' isubcsw=',isubcsw,                      &
-     &          ' isubclw=',isubclw,' icliq_sw=',icliq_sw,              &
-     &          ' iflip=',iflip,'  me=',me
-        print *,' lcrick=',lcrick,                            &
-     &          ' lcnorm=',lcnorm,' lnoprec=',lnoprec
+         print *,' In rad_initialize (GFS_rrtmg_setup_init), before calling RRTMG initialization'
+         print *,' si =',si
+         print *,' levr=',levr,' ictm=',ictm,' isol=',isol,' ico2=',ico2,&
+                 ' iaermdl=',iaermdl,' iaerflg=',iaerflg
+         print *,' np3d=',num_p3d,' ntoz=',ntoz,                         &
+                 ' iovr=',iovr,' isubcsw=',isubcsw,                      &
+                 ' isubclw=',isubclw,' icliq_sw=',icliq_sw,              &
+                 ' iflip=',iflip,'  me=',me
+         print *,' lcrick=',lcrick,                                      &
+                 ' lcnorm=',lcnorm,' lnoprec=',lnoprec
       endif
 
-      call sol_init ( me, isol, solar_file, con_solr_2008, con_solr_2002,&
-           con_pi )                                               ! astronomy initialization routine
-      call aer_init ( levr, me, iaermdl, iaerflg, lalw1bd, aeros_file, con_pi, &
-           con_t0c, con_c, con_boltz, con_plnk, errflg, errmsg)   ! aerosols initialization routine
-      call gas_init ( me, co2usr_file, co2cyc_file, ico2, ictm, ntoz, con_pi, &
-           errflg, errmsg)                                        ! co2 and other gases initialization routine
-      call cld_init ( si, levr, imp_physics, me, errflg, errmsg)  ! cloud initialization routine
-      call rlwinit ( me, rad_hr_units, inc_minor_gas, ilwcliq, isubcsw, iovr, errflg, errmsg )           ! lw RRTMG initialization routine
-      call rswinit ( me, rad_hr_units, inc_minor_gas, iswcliq, isubclw, iovr, iswmode, errflg, errmsg )  ! sw RRTMG initialization routine
+      ! Call initialization routines
+      call sol_init ( me, isol, solar_file, con_solr_2008,con_solr_2002,&
+           con_pi )
+      call aer_init ( levr, me, iaermdl, iaerflg, lalw1bd, aeros_file,  &
+           con_pi, con_t0c, con_c, con_boltz, con_plnk, errflg, errmsg)
+      call gas_init ( me, co2usr_file, co2cyc_file, ico2, ictm, ntoz,   &
+           con_pi, errflg, errmsg)
+      call cld_init ( si, levr, imp_physics, me, errflg, errmsg)
+      call rlwinit ( me, rad_hr_units, inc_minor_gas, ilwcliq, isubcsw, &
+           iovr, iovr_rand, iovr_maxrand, iovr_max, iovr_dcorr,         &
+           iovr_exp, iovr_exprand, errflg, errmsg )
+      call rswinit ( me, rad_hr_units, inc_minor_gas, iswcliq, isubclw, &
+           iovr, iovr_rand, iovr_maxrand, iovr_max, iovr_dcorr,         &
+           iovr_exp, iovr_exprand,iswmode, errflg, errmsg )
 
       if ( me == 0 ) then
         print *,'  Radiation sub-cloud initial seed =',ipsd0,           &
      &          ' IC-idate =',idate
-        print *,' return from rad_initialize (GFS_rrtmg_setup_init) - after calling radinit'
+        print *,' return from rad_initialize (GFS_rrtmg_setup_init) - after calling RRTMG initialization'
       endif
 !
       is_initialized = .true.
diff --git a/physics/GFS_rrtmg_setup.meta b/physics/GFS_rrtmg_setup.meta
index b6d3520bf..40da39a1c 100644
--- a/physics/GFS_rrtmg_setup.meta
+++ b/physics/GFS_rrtmg_setup.meta
@@ -110,6 +110,48 @@
   dimensions = ()
   type = integer
   intent = in
+[iovr_exp]
+  standard_name = flag_for_exponential_cloud_overlap_method
+  long_name = choice of exponential cloud overlap method
+  units         = flag
+  dimensions = ()
+  type = integer
+  intent = in
+[iovr_exprand]
+  standard_name = flag_for_exponential_random_cloud_overlap_method
+  long_name = choice of exponential-random cloud overlap method
+  units     = flag
+  dimensions = ()
+  type = integer
+  intent = in
+[iovr_max]
+  standard_name = flag_for_maximum_cloud_overlap_method
+  long_name = choice of maximum cloud overlap method
+  units = flag
+  dimensions = ()
+  type = integer
+  intent = in
+[iovr_rand]
+  standard_name = flag_for_random_cloud_overlap_method
+  long_name = choice of random cloud overlap method
+  units = flag
+  dimensions = ()
+  type = integer
+  intent = in
+[iovr_maxrand]
+  standard_name = flag_for_maximum_random_cloud_overlap_method
+  long_name = choice of maximum-random cloud overlap method
+  units = flag
+  dimensions = ()
+  type = integer
+  intent = in
+[iovr_dcorr]
+  standard_name = flag_for_decorrelation_length_cloud_overlap_method
+  long_name = choice of decorrelation-length cloud overlap method
+  units         = flag
+  dimensions = ()
+  type = integer
+  intent = in
 [isubcsw]
   standard_name = flag_for_sw_clouds_grid_approximation
   long_name = flag for sw clouds sub-grid approximation
diff --git a/physics/GFS_rrtmgp_cloud_overlap.meta b/physics/GFS_rrtmgp_cloud_overlap.meta
index f7d12bed5..cf6a05217 100644
--- a/physics/GFS_rrtmgp_cloud_overlap.meta
+++ b/physics/GFS_rrtmgp_cloud_overlap.meta
@@ -210,8 +210,8 @@
   kind = kind_phys
   intent = in
 [top_at_1]
-  standard_name = flag_for_vertical_ordering_in_RRTMGP
-  long_name = flag for vertical ordering in RRTMGP
+  standard_name = flag_for_vertical_ordering_in_radiation
+  long_name = flag for vertical ordering in radiation
   units = flag
   dimensions = ()
   type = logical
diff --git a/physics/GFS_rrtmgp_pre.meta b/physics/GFS_rrtmgp_pre.meta
index 86645cb1a..ff6e262cc 100644
--- a/physics/GFS_rrtmgp_pre.meta
+++ b/physics/GFS_rrtmgp_pre.meta
@@ -364,8 +364,8 @@
   kind = kind_phys
   intent = inout
 [top_at_1]
-  standard_name = flag_for_vertical_ordering_in_RRTMGP
-  long_name = flag for vertical ordering in RRTMGP
+  standard_name = flag_for_vertical_ordering_in_radiation
+  long_name = flag for vertical ordering in radiation
   units = flag
   dimensions = ()
   type = logical
diff --git a/physics/radiation_gases.f b/physics/radiation_gases.f
index 85204e5ab..797028d97 100644
--- a/physics/radiation_gases.f
+++ b/physics/radiation_gases.f
@@ -221,7 +221,15 @@ module module_radiation_gases
 
 !> This subroutine sets up ozone, co2, etc. parameters. If climatology
 !! ozone then read in monthly ozone data.
-!!\param me         print message control flag
+!!\param me           print message control flag
+!!\param co2usr_file  co2 user defined data table
+!!\param co2cyc_file  co2 climotology monthly cycle data table
+!!\param ictmflg      data ic time/date control flag
+!!\param ico2flg      co2 data source control flag
+!!\param ioznflg      ozone data control flag
+!!\param con_pi       physical constant Pi
+!!\param errflg       error flag
+!!\param errmsg       error message
 !>\section gas_init_gen gas_init General Algorithm
 !-----------------------------------
       subroutine gas_init( me, co2usr_file, co2cyc_file, ico2flg,       &
@@ -233,12 +241,34 @@ subroutine gas_init( me, co2usr_file, co2cyc_file, ico2flg,       &
 !  then read in monthly ozone data.                                     !
 !                                                                       !
 !  inputs:                                                              !
-!     me           - print message control flag                         !
-!     co2usr_file  - external co2 user defined data table               !
-!     co2cyc_file  - external co2 climotology monthly cycle data table  ! 
+!     me          - print message control flag                          !
+!     ico2flg     - co2 data source control flag                        !
+!                   =0: use prescribed co2 global mean value            !
+!                   =1: use input global mean co2 value (co2_glb)       !
+!                   =2: use input 2-d monthly co2 value (co2vmr_sav)    !
+!     ictmflg     - =yyyy#, data ic time/date control flag              !
+!                   =-2: same as 0, but superimpose seasonal cycle      !
+!                        from climatology data set.                     !
+!                   =-1: use user provided external data for the fcst   !
+!                        time, no extrapolation.                        !
+!                   =0: use data at initial cond time, if not existed   !
+!                       then use latest, without extrapolation.         !
+!                   =1: use data at the forecast time, if not existed   !
+!                       then use latest and extrapolate to fcst time.   !
+!                   =yyyy0: use yyyy data for the forecast time, no     !
+!                           further data extrapolation.                 !
+!                   =yyyy1: use yyyy data for the fcst. if needed, do   !
+!                           extrapolation to match the fcst time.       !
+!     ioznflg     - ozone data control flag                             !
+!                   =0: use climatological ozone profile                !
+!                   >0: use interactive ozone profile                   ! 
+!     co2usr_file - external co2 user defined data table                !
+!     co2cyc_file - external co2 climotology monthly cycle data table   ! 
+!     con_pi      - physical constant Pi                                !
 !                                                                       !
 !  outputs: (CCPP error handling)                                       !
-!    (errflg, errmsg)                                                   !
+!     errflg      - error flag                                          !
+!     errmsg      - error message                                       !
 !                                                                       !
 !  internal module variables:                                           !
 !     pkstr, o3r - arrays for climatology ozone data                    !
@@ -508,13 +538,20 @@ end subroutine gas_init
 
 !> This subroutine reads in 2-d monthly co2 data set for a specified
 !! year. Data are in a 15 degree lat/lon horizontal resolution.
-!!\param iyear      year of the requested data for fcst
-!!\param imon       month of the year
-!!\param iday       day of the month
-!!\param ihour      hour of the day
-!!\param loz1st     clim ozone 1st time update control flag
-!!\param ldoco2     co2 update control flag
-!!\param me         print message control flag
+!!\param iyear       year of the requested data for fcst
+!!\param imon        month of the year
+!!\param iday        day of the month
+!!\param ihour       hour of the day
+!!\param loz1st      clim ozone 1st time update control flag
+!!\param ldoco2      co2 update control flag
+!!\param me          print message control flag
+!!\param co2dat_file co2 2d monthly obsv data table
+!!\param co2gbl_file co2 global annual mean data table 
+!!\param ictmflg     data ic time/date control flag
+!!\param ico2flg     co2 data source control flag
+!!\param ioznflg     ozone data control flag
+!!\param errflg      error flag
+!!\param errmsg      error message
 !>\section gen_gas_update gas_update General Algorithm
 !-----------------------------------
       subroutine gas_update(iyear, imon, iday, ihour, loz1st, ldoco2,   &
@@ -526,6 +563,50 @@ subroutine gas_update(iyear, imon, iday, ihour, loz1st, ldoco2,   &
 !  gas_update reads in 2-d monthly co2 data set for a specified year.   !
 !  data are in a 15 degree lat/lon horizontal resolution.               !
 !                                                                       !
+!  inputs:                                               dimemsion      !
+!     iyear       - year of the requested data for fcst     1           !
+!     imon        - month of the year                       1           !
+!     iday        - day of the month                        1           !
+!     ihour       - hour of the day                         1           !
+!     loz1st      - clim ozone 1st time update control flag 1           !
+!     ldoco2      - co2 update control flag                 1           !
+!     me          - print message control flag              1           !
+!     ico2flg     - co2 data source control flag                        !
+!                   =0: use prescribed co2 global mean value            !
+!                   =1: use input global mean co2 value (co2_glb)       !
+!                   =2: use input 2-d monthly co2 value (co2vmr_sav)    !
+!     ictmflg     - =yyyy#, data ic time/date control flag              !
+!                   =-2: same as 0, but superimpose seasonal cycle      !
+!                        from climatology data set.                     !
+!                   =-1: use user provided external data for the fcst   !
+!                        time, no extrapolation.                        !
+!                   =0: use data at initial cond time, if not existed   !
+!                       then use latest, without extrapolation.         !
+!                   =1: use data at the forecast time, if not existed   !
+!                       then use latest and extrapolate to fcst time.   !
+!                   =yyyy0: use yyyy data for the forecast time, no     !
+!                           further data extrapolation.                 !
+!                   =yyyy1: use yyyy data for the fcst. if needed, do   !
+!                           extrapolation to match the fcst time.       !
+!     ioznflg     - ozone data control flag                             !
+!                   =0: use climatological ozone profile                !
+!                   >0: use interactive ozone profile                   !
+!     ivflip      - vertical profile indexing flag                      !
+!     co2dat_file - external co2 2d monthly obsv data table             !
+!     co2gbl_file - external co2 global annual mean data table          !
+!                                                                       !
+!  outputs: (CCPP error handling)                                       ! 
+!     errflg      - error flag                                          !
+!     errmsg      - error message                                       !
+!                                                                       !
+!  internal module variables:                                           !
+!     co2vmr_sav - monthly co2 volume mixing ratio     IMXCO2*JMXCO2*12 !
+!     co2cyc_sav - monthly cycle co2 vol mixing ratio  IMXCO2*JMXCO2*12 !
+!     co2_glb    - global annual mean co2 mixing ratio                  !
+!     gco2cyc    - global monthly mean co2 variation       12           !
+!     k1oz,k2oz,facoz                                                   !
+!                - climatology ozone parameters             1           !
+!                                                                       !
 !  usage:    call gas_update                                            !
 !                                                                       !
 !  subprograms called:  none                                            !
@@ -691,7 +772,6 @@ subroutine gas_update(iyear, imon, iday, ihour, loz1st, ldoco2,   &
 
 !  --- ...  set up input data file name
 
-         print*,"co2dat_file: ",co2dat_file
         cfile1 = co2dat_file
         write(cfile1(19:22),34) idyr
   34    format(i4.4)
@@ -867,6 +947,9 @@ end subroutine gas_update
 !!\param xlat       (IMAX), grid latitude in radians, default range to
 !!                  pi/2 -> -pi/2, otherwise see in-line comment
 !!\param IMAX, LMAX      horizontal/vertical dimensions for output data
+!!\param ico2flg    (1), co2 data source control flag
+!!\param top_at_1   (1), vertical ordering flag
+!!\param con_pi     (1), physical constant Pi
 !!\param gasdat     (IMAX,LMAX,NF_VGAS) - gases volume mixing ratioes
 !!\n                    (:,:,1)           - co2
 !!\n                    (:,:,2)           - n2o
@@ -878,6 +961,12 @@ end subroutine gas_update
 !!\n                    (:,:,8)           - cfc22
 !!\n                    (:,:,9)           - ccl4
 !!\n                    (:,:,10)          - cfc113
+!!\n
+!> - Internal module variables :
+!!\n     co2vmr_sav - saved monthly co2 concentration from sub gas_update
+!!\n     co2_glb    - saved global annual mean co2 value from  gas_update
+!!\n     gco2cyc    - saved global seasonal variation of co2 climatology
+!!                    in 12-month form
 !>\section gen_getgases getgases General Algorithm
 !-----------------------------------
       subroutine getgases( plvl, xlon, xlat, IMAX, LMAX, ico2flg,       &
@@ -889,6 +978,39 @@ subroutine getgases( plvl, xlon, xlat, IMAX, LMAX, ico2flg,       &
 !  observed values, all other gases are asigned to the climatological   !
 !  values.                                                              !
 !                                                                       !
+!  inputs:                                                              !
+!     plvl(IMAX,LMAX+1)- pressure at model layer interfaces (mb)        !
+!     xlon(IMAX)       - grid longitude in radians, ok both 0->2pi or   !
+!                        -pi -> +pi arrangements                        !
+!     xlat(IMAX)       - grid latitude in radians, default range to     !
+!                        pi/2 -> -pi/2, otherwise see in-line comment   !
+!     IMAX, LMAX       - horiz, vert dimensions for output data         !
+!     ico2flg          - co2 data source control flag                   !
+!                       =0: use prescribed co2 global mean value        !
+!                       =1: use input global mean co2 value (co2_glb)   !
+!                       =2: use input 2-d monthly co2 value (co2vmr_sav)!
+!     top_at_1         - vertical profile indexing flag                 !
+!     con_pi           - physical constant Pi                           !
+!                                                                       !
+!  outputs:                                                             !
+!     gasdat(IMAX,LMAX,NF_VGAS) - gases volume mixing ratioes           !
+!               (:,:,1)           - co2                                 !
+!               (:,:,2)           - n2o                                 !
+!               (:,:,3)           - ch4                                 !
+!               (:,:,4)           - o2                                  !
+!               (:,:,5)           - co                                  !
+!               (:,:,6)           - cfc11                               !
+!               (:,:,7)           - cfc12                               !
+!               (:,:,8)           - cfc22                               !
+!               (:,:,9)           - ccl4                                !
+!               (:,:,10)          - cfc113                              !
+!                                                                       !
+!     note: for lower atmos co2vmr_sav may have clim monthly deviations !
+!           superimposed on init-cond co2 value, while co2_glb only     !
+!           contains the global mean value, thus needs to add the       !
+!           monthly dglobal mean deviation gco2cyc at upper atmos. for  !
+!           ictmflg/=-2, this value will be zero.                       !
+!                                                                       !
 !  usage:    call getgases                                              !
 !                                                                       !
 !  subprograms called:  none                                            !
@@ -986,7 +1108,8 @@ end subroutine getgases
 !!\param prslk       (IMAX,LM), exner function = \f$(p/p0)^{rocp}\f$
 !!\param xlat        (IMAX), latitude in radians, default to pi/2 ->
 !!                    -pi/2 range, otherwise see in-line comment
-!!\param IMAX, LM    horizontal and vertical dimensions
+!!\param IMAX, LM    (1), horizontal and vertical dimensions
+!!\param top_at_1    (1), vertical profile indexing flag
 !!\param o3mmr       (IMAX,LM), output ozone profile in mass mixing
 !!                   ratio (g/g)
 !>\section getozn_gen getozn General Algorithm
@@ -999,6 +1122,20 @@ subroutine getozn( prslk,xlat, IMAX, LM, top_at_1, o3mmr)
 !                                                                       !
 !  this code is originally written By Shrinivas Moorthi                 !
 !                                                                       !
+!  inputs:                                                              !
+!     prslk (IMAX,LM)  - exner function = (p/p0)**rocp                  !
+!     xlat  (IMAX)     - latitude in radians, default to pi/2 -> -pi/2  !
+!                        range, otherwise see in-line comment           !
+!     IMAX, LM         - horizontal and vertical dimensions             !
+!     top_at_1         - vertical profile indexing flag                 !
+!                                                                       !
+!  outputs:                                                             !
+!     o3mmr (IMAX,LM)  - output ozone profile in mass mixing ratio (g/g)!
+!                                                                       !
+!  module variables:                                                    !
+!     k1oz, k2oz       - ozone data interpolation indices               !
+!     facoz            - ozone data interpolation factor                !
+!                                                                       !
 !  usage:    call getozn                                                !
 !                                                                       !
 !  ===================================================================  !
diff --git a/physics/radlw_main.F90 b/physics/radlw_main.F90
index 341ca47ed..34db600e5 100644
--- a/physics/radlw_main.F90
+++ b/physics/radlw_main.F90
@@ -423,6 +423,8 @@ subroutine rrtmg_lw_run                                           &
      &       icseed,aeraod,aerssa,sfemis,sfgtmp,                        &
      &       dzlyr,delpin,de_lgth,alpha,                                &
      &       npts, nlay, nlp1, lprnt, cld_cf, lslwr, top_at_1, iovr,    &
+     &       iovr_rand, iovr_maxrand, iovr_max, iovr_dcorr, iovr_exp,   &
+     &       iovr_exprand,                                              &
      &       inc_minor_gas, ilwcliq, ilwcice, isubclw,                  &
      &       hlwc,topflx,sfcflx,cldtau,                                 &   !  ---  outputs
      &       HLW0,HLWB,FLXPRF,                                          &   !  ---  optional
@@ -495,13 +497,19 @@ subroutine rrtmg_lw_run                                           &
 !           =0: no sub-col cld treatment, use grid-mean cld quantities  !
 !           =1: mcica sub-col, prescribed seeds to get random numbers   !
 !           =2: mcica sub-col, providing array icseed for random numbers!
-!   iovr  - cloud overlapping control flag                              !
-!           =0: random overlapping clouds                               !
-!           =1: maximum/random overlapping clouds                       !
-!           =2: maximum overlap cloud (used for isubclw>0 only)         !
-!           =3: decorrelation-length overlap (for isubclw>0 only)       !
-!           =4: exponential cloud overlap (AER)                         !
-!           =5: exponential-random cloud overlap (AER)                  !  
+!   iovr  - clouds vertical overlapping control flag                    !
+!           =iovr_rand                                                  !
+!           =iovr_maxrand                                               !
+!           =iovr_max                                                   !
+!           =iovr_dcorr                                                 !
+!           =iovr_exp                                                   !
+!           =iovr_exprand                                               !
+!   iovr_rand    - choice of cloud-overlap: random                      !
+!   iovr_maxrand - choice of cloud-overlap: maximum random              !
+!   iovr_max     - choice of cloud-overlap: maximum                     !
+!   iovr_dcorr   - choice of cloud-overlap: decorrelation length        !
+!   iovr_exp     - choice of cloud-overlap: exponential                 !
+!   iovr_exprand - choice of cloud-overlap: exponential random          !
 !                                                                       !
 !  output variables:                                                    !
 !     hlwc  (npts,nlay): total sky heating rate (k/day or k/sec)        !
@@ -599,7 +607,8 @@ subroutine rrtmg_lw_run                                           &
 
 !  ---  inputs:
       integer, intent(in) :: npts, nlay, nlp1, ilwcliq, ilwcice,        &
-           isubclw, iovr
+           isubclw, iovr, iovr_dcorr, iovr_exp, iovr_exprand, iovr_rand,&
+           iovr_maxrand, iovr_max
       integer, intent(in) :: icseed(npts)
 
       logical,  intent(in) :: lprnt, inc_minor_gas
@@ -784,7 +793,7 @@ subroutine rrtmg_lw_run                                           &
         endif
 
         stemp = sfgtmp(iplon)          ! surface ground temp
-        if (iovr == 3) delgth= de_lgth(iplon)    ! clouds decorr-length
+        if (iovr == iovr_dcorr) delgth= de_lgth(iplon)    ! clouds decorr-length
 
 !> -# Prepare atmospheric profile for use in rrtm.
 !           the vertical index of internal array is from surface to top
@@ -808,7 +817,7 @@ subroutine rrtmg_lw_run                                           &
             tavel(k)= tlyr(iplon,k1)
             tz(k)   = tlvl(iplon,k1)
             dz(k)   = dzlyr(iplon,k1)
-            if (iovr == 4 .or. iovr == 5) alph(k) = alpha(iplon,k) ! alpha decorrelation
+            if (iovr == iovr_exp .or. iovr == iovr_exprand) alph(k) = alpha(iplon,k) ! alpha decorrelation
 
 !> -# Set absorber amount for h2o, co2, and o3.
 
@@ -921,7 +930,7 @@ subroutine rrtmg_lw_run                                           &
             tavel(k)= tlyr(iplon,k)
             tz(k)   = tlvl(iplon,k+1)
             dz(k)   = dzlyr(iplon,k)
-            if (iovr == 4 .or. iovr == 5) alph(k) = alpha(iplon,k) ! alpha decorrelation
+            if (iovr == iovr_exp .or. iovr == iovr_exprand) alph(k) = alpha(iplon,k) ! alpha decorrelation
 
 !  --- ...  set absorber amount
 !test use
@@ -1311,7 +1320,8 @@ end subroutine rrtmg_lw_run
 !!\param me        print control for parallel process
 !!\section rlwinit_gen rlwinit General Algorithm
       subroutine rlwinit( me, rad_hr_units, inc_minor_gas, ilwcliq,     &
-           isubclw, iovr, errflg, errmsg )
+           isubclw, iovr, iovr_rand, iovr_maxrand, iovr_max, iovr_dcorr,&
+           iovr_exp, iovr_exprand, errflg, errmsg )
 
 !  ===================  program usage description  ===================  !
 !                                                                       !
@@ -1334,12 +1344,18 @@ subroutine rlwinit( me, rad_hr_units, inc_minor_gas, ilwcliq,     &
 !           =1: mcica sub-col, prescribed seeds to get random numbers   !
 !           =2: mcica sub-col, providing array icseed for random numbers!
 !   iovr  - clouds vertical overlapping control flag                    !
-!           =0: random overlapping clouds                               !
-!           =1: maximum/random overlapping clouds                       !
-!           =2: maximum overlap cloud (isubcol>0 only)                  !
-!           =3: decorrelation-length overlap (for isubclw>0 only)       !
-!           =4: exponential cloud overlap (AER)                         !
-!           =5: exponential-random cloud overlap (AER)                  !
+!           =iovr_rand                                                  !
+!           =iovr_maxrand                                               !
+!           =iovr_max                                                   !
+!           =iovr_dcorr                                                 !
+!           =iovr_exp                                                   !
+!           =iovr_exprand                                               !
+!   iovr_rand    - choice of cloud-overlap: random                      !
+!   iovr_maxrand - choice of cloud-overlap: maximum random              !
+!   iovr_max     - choice of cloud-overlap: maximum                     !
+!   iovr_dcorr   - choice of cloud-overlap: decorrelation length        !
+!   iovr_exp     - choice of cloud-overlap: exponential                 !
+!   iovr_exprand - choice of cloud-overlap: exponential random          !
 !                                                                       !
 !  outputs:                                                             !
 !   errflg  - error flag                                                !
@@ -1373,7 +1389,9 @@ subroutine rlwinit( me, rad_hr_units, inc_minor_gas, ilwcliq,     &
 !  ======================  end of description block  =================  !
 
 !  ---  inputs:
-      integer, intent(in) :: me, rad_hr_units, ilwcliq, isubclw, iovr
+      integer, intent(in) :: me, rad_hr_units, ilwcliq, isubclw, iovr,  &
+           iovr_rand, iovr_maxrand, iovr_max, iovr_dcorr, iovr_exp,     &
+           iovr_exprand
       logical, intent(in) :: inc_minor_gas
 
 !  ---  outputs:
@@ -1394,6 +1412,13 @@ subroutine rlwinit( me, rad_hr_units, inc_minor_gas, ilwcliq,     &
       errflg = 0
       errmsg = ''
 
+      if ((iovr .ne. iovr_rand) .and. (iovr .ne. iovr_maxrand) .and.    &
+          (iovr .ne. iovr_max)  .and. (iovr .ne. iovr_dcorr)   .and.    &
+          (iovr .ne. iovr_exp)  .and. (iovr .ne. iovr_exprand)) then
+         errflg = 1
+         errmsg = 'ERROR(rlwinit): Error in specification of cloud overlap flag'
+      endif
+
       if (me == 0) then
         print *,' - Using AER Longwave Radiation, Version: ', VTAGLW
 
diff --git a/physics/radlw_main.meta b/physics/radlw_main.meta
index e336e6011..406f773e3 100644
--- a/physics/radlw_main.meta
+++ b/physics/radlw_main.meta
@@ -242,8 +242,8 @@
   type = logical
   intent = in
 [top_at_1]
-  standard_name = flag_for_vertical_ordering_in_RRTMGP
-  long_name = flag for vertical ordering in RRTMGP
+  standard_name = flag_for_vertical_ordering_in_radiation
+  long_name = flag for vertical ordering in radiation
   units = flag
   dimensions = ()
   type = logical
@@ -255,6 +255,48 @@
   dimensions = ()
   type = integer
   intent = in
+[iovr_exp]
+  standard_name = flag_for_exponential_cloud_overlap_method
+  long_name = choice of exponential cloud overlap method
+  units         = flag
+  dimensions = ()
+  type = integer
+  intent = in
+[iovr_exprand]
+  standard_name = flag_for_exponential_random_cloud_overlap_method
+  long_name = choice of exponential-random cloud overlap method
+  units     = flag
+  dimensions = ()
+  type = integer
+  intent = in
+[iovr_max]
+  standard_name = flag_for_maximum_cloud_overlap_method
+  long_name = choice of maximum cloud overlap method
+  units = flag
+  dimensions = ()
+  type = integer
+  intent = in
+[iovr_rand]
+  standard_name = flag_for_random_cloud_overlap_method
+  long_name = choice of random cloud overlap method
+  units = flag
+  dimensions = ()
+  type = integer
+  intent = in
+[iovr_maxrand]
+  standard_name = flag_for_maximum_random_cloud_overlap_method
+  long_name = choice of maximum-random cloud overlap method
+  units = flag
+  dimensions = ()
+  type = integer
+  intent = in
+[iovr_dcorr]
+  standard_name = flag_for_decorrelation_length_cloud_overlap_method
+  long_name = choice of decorrelation-length cloud overlap method
+  units         = flag
+  dimensions = ()
+  type = integer
+  intent = in
 [inc_minor_gas]
   standard_name = flag_to_include_minor_gases_in_rrtmg
   long_name = flag to include minor trace gases	in rrtmg
diff --git a/physics/radsw_main.F90 b/physics/radsw_main.F90
index cf6c37346..602fa3ae3 100644
--- a/physics/radsw_main.F90
+++ b/physics/radsw_main.F90
@@ -500,8 +500,8 @@ subroutine rrtmg_sw_run                                           &
      &       dzlyr,delpin,de_lgth,alpha,                                &
      &       cosz,solcon,NDAY,idxday,                                   &
      &       npts, nlay, nlp1, lprnt, inc_minor_gas, iswcliq, iswcice,  &
-     &       isubcsw, iovr, top_at_1, iswmode,                          &
-     &       cld_cf, lsswr,                                             &
+     &       isubcsw, iovr, top_at_1, iswmode, cld_cf, lsswr, iovr_rand,&
+     &       iovr_maxrand, iovr_max, iovr_dcorr, iovr_exp, iovr_exprand,&
      &       hswc,topflx,sfcflx,cldtau,                                 &   !  ---  outputs
      &       HSW0,HSWB,FLXPRF,FDNCMP,                                   &   ! ---  optional
      &       cld_lwp, cld_ref_liq, cld_iwp, cld_ref_ice,                &
@@ -584,13 +584,19 @@ subroutine rrtmg_sw_run                                           &
 !           =0: no sub-col cld treatment, use grid-mean cld quantities  !
 !           =1: mcica sub-col, prescribed seeds to get random numbers   !
 !           =2: mcica sub-col, providing array icseed for random numbers!
-!   iovr    - cloud overlapping control flag                            !
-!           =0: random overlapping clouds                               !
-!           =1: maximum/random overlapping clouds                       !
-!           =2: maximum overlap cloud                                   !
-!           =3: decorrelation-length overlap clouds                     !
-!           =4: exponential cloud overlap (AER)                         !
-!           =5: exponential-random cloud overlap (AER)                  !   
+!   iovr  - clouds vertical overlapping control flag                    !
+!           =iovr_rand                                                  !
+!           =iovr_maxrand                                               !
+!           =iovr_max                                                   !
+!           =iovr_dcorr                                                 !
+!           =iovr_exp                                                   !
+!           =iovr_exprand                                               !
+!   iovr_rand    - choice of cloud-overlap: random                      !
+!   iovr_maxrand - choice of cloud-overlap: maximum random              !
+!   iovr_max     - choice of cloud-overlap: maximum                     !
+!   iovr_dcorr   - choice of cloud-overlap: decorrelation length        !
+!   iovr_exp     - choice of cloud-overlap: exponential                 !
+!   iovr_exprand - choice of cloud-overlap: exponential random          !   
 !                                                                       !
 !  output variables:                                                    !
 !   hswc  (npts,nlay): total sky heating rates (k/sec or k/day)         !
@@ -680,7 +686,8 @@ subroutine rrtmg_sw_run                                           &
 
 !  ---  inputs:
       integer, intent(in) :: npts, nlay, nlp1, NDAY, iswcliq, iswcice,  &
-           isubcsw, iovr, iswmode
+           isubcsw, iovr, iswmode, iovr_dcorr, iovr_exp, iovr_exprand,  &
+           iovr_rand, iovr_maxrand, iovr_max
 
       integer, dimension(:), intent(in) :: idxday, icseed
 
@@ -889,7 +896,7 @@ subroutine rrtmg_sw_run                                           &
         cosz1  = cosz(j1)
         sntz1  = f_one / cosz(j1)
         ssolar = s0fac * cosz(j1)
-        if (iovr == 3) delgth = de_lgth(j1) ! clouds decorr-length
+        if (iovr == iovr_dcorr) delgth = de_lgth(j1) ! clouds decorr-length
 
 !> - Prepare surface albedo: bm,df - dir,dif; 1,2 - nir,uvv.
         albbm(1) = sfcalb_nir_dir(j1)
@@ -911,7 +918,7 @@ subroutine rrtmg_sw_run                                           &
             tavel(k) = tlyr(j1,kk)
             delp (k) = delpin(j1,kk)
             dz   (k) = dzlyr (j1,kk)
-            if (iovr == 4 .or. iovr == 5) alph(k) = alpha(j1,k) ! alpha decorrelation
+            if (iovr == iovr_exp .or. iovr == iovr_exprand) alph(k) = alpha(j1,k) ! alpha decorrelation
 
 !> - Set absorber and gas column amount, convert from volume mixing
 !!    ratio to molec/cm2 based on coldry (scaled to 1.0e-20)
@@ -1002,7 +1009,7 @@ subroutine rrtmg_sw_run                                           &
             tavel(k) = tlyr(j1,k)
             delp (k) = delpin(j1,k)
             dz   (k) = dzlyr (j1,k)
-            if (iovr == 4 .or. iovr == 5) alph(k) = alpha(j1,k)   ! alpha decorrelation
+            if (iovr == iovr_exp .or. iovr == iovr_exprand) alph(k) = alpha(j1,k)   ! alpha decorrelation
 
 !  --- ...  set absorber amount
 !test use
@@ -1093,11 +1100,11 @@ subroutine rrtmg_sw_run                                           &
 
         zcf0   = f_one
         zcf1   = f_one
-        if (iovr == 0) then                    ! random overlapping
+        if (iovr == iovr_rand) then                    ! random overlapping
           do k = 1, nlay
             zcf0 = zcf0 * (f_one - cfrac(k))
           enddo
-        else if (iovr == 1) then ! max/ran/exp overlapping
+        else if (iovr == iovr_maxrand) then ! max/ran/exp overlapping
           do k = 1, nlay
             if (cfrac(k) > ftiny) then                ! cloudy layer
               zcf1 = min ( zcf1, f_one-cfrac(k) )
@@ -1379,7 +1386,8 @@ end subroutine rrtmg_sw_run
 !>\section rswinit_gen rswinit General Algorithm
 !-----------------------------------
       subroutine rswinit( me, rad_hr_units, inc_minor_gas, iswcliq,     &
-           isubcsw, iovr, iswmode, errflg, errmsg )
+           isubcsw, iovr, iovr_rand, iovr_maxrand, iovr_max, iovr_dcorr,&
+           iovr_exp, iovr_exprand, iswmode, errflg, errmsg )
 
 !  ===================  program usage description  ===================  !
 !                                                                       !
@@ -1400,13 +1408,19 @@ subroutine rswinit( me, rad_hr_units, inc_minor_gas, iswcliq,     &
 !           =0: no sub-col cld treatment, use grid-mean cld quantities  !
 !           =1: mcica sub-col, prescribed seeds to get random numbers   !
 !           =2: mcica sub-col, providing array icseed for random numbers!
-!   iovr    - clouds vertical overlapping control flag                  !
-!           =0: random overlapping clouds                               !
-!           =1: maximum/random overlapping clouds                       !
-!           =2: maximum overlap cloud                                   !
-!           =3: decorrelation-length overlap clouds                     !
-!           =4: exponential cloud overlap (AER)                         !
-!           =5: exponential-random cloud overlap (AER)                  !
+!   iovr  - clouds vertical overlapping control flag                    !
+!           =iovr_rand                                                  !
+!           =iovr_maxrand                                               !
+!           =iovr_max                                                   !
+!           =iovr_dcorr                                                 !
+!           =iovr_exp                                                   !
+!           =iovr_exprand                                               !
+!   iovr_rand    - choice of cloud-overlap: random                      !
+!   iovr_maxrand - choice of cloud-overlap: maximum random              !
+!   iovr_max     - choice of cloud-overlap: maximum                     !
+!   iovr_dcorr   - choice of cloud-overlap: decorrelation length        !
+!   iovr_exp     - choice of cloud-overlap: exponential                 !
+!   iovr_exprand - choice of cloud-overlap: exponential random          !
 !   iswmode - control flag for 2-stream transfer scheme                 !
 !           =1; delta-eddington    (joseph et al., 1976)                !
 !           =2: pifm               (zdunkowski et al., 1980)            !
@@ -1428,7 +1442,8 @@ subroutine rswinit( me, rad_hr_units, inc_minor_gas, iswcliq,     &
 
 !  ---  inputs:
       integer, intent(in) :: me, rad_hr_units, iswcliq, isubcsw, iovr,  &
-           iswmode
+           iswmode, iovr_rand, iovr_maxrand, iovr_max, iovr_dcorr,      &
+           iovr_exp, iovr_exprand
       logical, intent(in) :: inc_minor_gas
 !  ---  outputs:
       character(len=*), intent(out) :: errmsg
@@ -1448,6 +1463,13 @@ subroutine rswinit( me, rad_hr_units, inc_minor_gas, iswcliq,     &
       errflg = 0
       errmsg = ''
 
+      if ((iovr .ne. iovr_rand) .and. (iovr .ne. iovr_maxrand) .and.    &
+          (iovr .ne. iovr_max)  .and. (iovr .ne. iovr_dcorr)   .and.    &
+          (iovr .ne. iovr_exp)  .and. (iovr .ne. iovr_exprand)) then
+         errflg = 1
+         errmsg = 'ERROR(rswinit): Error in specification of cloud overlap flag'
+      endif
+
       if (me == 0) then
         print *,' - Using AER Shortwave Radiation, Version: ',VTAGSW
 
diff --git a/physics/radsw_main.meta b/physics/radsw_main.meta
index 222f3ce9e..85e446498 100644
--- a/physics/radsw_main.meta
+++ b/physics/radsw_main.meta
@@ -288,8 +288,8 @@
   type = logical
   intent = in
 [top_at_1]
-  standard_name = flag_for_vertical_ordering_in_RRTMGP
-  long_name = flag for vertical ordering in RRTMGP
+  standard_name = flag_for_vertical_ordering_in_radiation
+  long_name = flag for vertical ordering in radiation
   units = flag
   dimensions = ()
   type = logical
@@ -322,6 +322,48 @@
   dimensions = ()
   type = integer
   intent = in
+[iovr_exp]
+  standard_name = flag_for_exponential_cloud_overlap_method
+  long_name = choice of exponential cloud overlap method
+  units         = flag
+  dimensions = ()
+  type = integer
+  intent = in
+[iovr_exprand]
+  standard_name = flag_for_exponential_random_cloud_overlap_method
+  long_name = choice of exponential-random cloud overlap method
+  units     = flag
+  dimensions = ()
+  type = integer
+  intent = in
+[iovr_max]
+  standard_name = flag_for_maximum_cloud_overlap_method
+  long_name = choice of maximum cloud overlap method
+  units = flag
+  dimensions = ()
+  type = integer
+  intent = in
+[iovr_rand]
+  standard_name = flag_for_random_cloud_overlap_method
+  long_name = choice of random cloud overlap method
+  units = flag
+  dimensions = ()
+  type = integer
+  intent = in
+[iovr_maxrand]
+  standard_name = flag_for_maximum_random_cloud_overlap_method
+  long_name = choice of maximum-random cloud overlap method
+  units = flag
+  dimensions = ()
+  type = integer
+  intent = in
+[iovr_dcorr]
+  standard_name = flag_for_decorrelation_length_cloud_overlap_method
+  long_name = choice of decorrelation-length cloud overlap method
+  units         = flag
+  dimensions = ()
+  type = integer
+  intent = in
 [iswmode]
   standard_name = flag_for_sw_scattering_choice
   long_name = flag for rrtmg shortwave scattering choice
diff --git a/physics/rrtmgp_aerosol_optics.meta b/physics/rrtmgp_aerosol_optics.meta
index f2fc09be6..5f5946afa 100644
--- a/physics/rrtmgp_aerosol_optics.meta
+++ b/physics/rrtmgp_aerosol_optics.meta
@@ -22,8 +22,8 @@
   type = logical
   intent = in
 [top_at_1]
-  standard_name = flag_for_vertical_ordering_in_RRTMGP
-  long_name = flag for vertical ordering in RRTMGP
+  standard_name = flag_for_vertical_ordering_in_radiation
+  long_name = flag for vertical ordering in radiation
   units = flag
   dimensions = ()
   type = logical
diff --git a/physics/rrtmgp_lw_rte.meta b/physics/rrtmgp_lw_rte.meta
index 0ad0754b5..15dbc1062 100644
--- a/physics/rrtmgp_lw_rte.meta
+++ b/physics/rrtmgp_lw_rte.meta
@@ -72,8 +72,8 @@
   type = integer
   intent = in
 [top_at_1]
-  standard_name = flag_for_vertical_ordering_in_RRTMGP
-  long_name = flag for vertical ordering in RRTMGP
+  standard_name = flag_for_vertical_ordering_in_radiation
+  long_name = flag for vertical ordering in radiation
   units = flag
   dimensions = ()
   type = logical
diff --git a/physics/rrtmgp_sw_rte.meta b/physics/rrtmgp_sw_rte.meta
index 9ab24c8b3..3f5bf2b3c 100644
--- a/physics/rrtmgp_sw_rte.meta
+++ b/physics/rrtmgp_sw_rte.meta
@@ -67,8 +67,8 @@
   kind = kind_phys
   intent = in
 [top_at_1]
-  standard_name = flag_for_vertical_ordering_in_RRTMGP
-  long_name = flag for vertical ordering in RRTMGP
+  standard_name = flag_for_vertical_ordering_in_radiation
+  long_name = flag for vertical ordering in radiation
   units = flag
   dimensions = ()
   type = logical

From 0650bae3ed02503c904a0e94d05b98c21eb3d725 Mon Sep 17 00:00:00 2001
From: dustinswales <dswales@ucar.edu>
Date: Mon, 12 Sep 2022 15:45:26 -0600
Subject: [PATCH 018/115] Fix bug in metadata.

---
 physics/GFS_rrtmg_setup.F90  | 11 +++++------
 physics/GFS_rrtmg_setup.meta | 15 ++++-----------
 physics/radlw_main.meta      | 12 ++++++------
 physics/radsw_main.meta      | 12 ++++++------
 4 files changed, 21 insertions(+), 29 deletions(-)

diff --git a/physics/GFS_rrtmg_setup.F90 b/physics/GFS_rrtmg_setup.F90
index 5ad446985..c61ce358e 100644
--- a/physics/GFS_rrtmg_setup.F90
+++ b/physics/GFS_rrtmg_setup.F90
@@ -44,8 +44,8 @@ subroutine GFS_rrtmg_setup_init ( si, levr, ictm, isol, solar_file, ico2, &
         lcnorm, imp_physics, lnoprec, idate, iflip, do_RRTMGP, me, lalw1bd,  &
         iaermdl, iaerflg, aeros_file, con_pi, con_t0c, con_c, con_boltz,     &
         con_plnk, con_solr_2008, con_solr_2002, co2usr_file, co2cyc_file,    &
-        rad_hr_units, inc_minor_gas, ilwcliq, iswcliq, isubcsw, isubclw,     &
-        iswmode, ipsd0, errmsg, errflg)
+        rad_hr_units, inc_minor_gas, icliq_lw, isubcsw, isubclw, iswmode,    &
+        ipsd0, errmsg, errflg)
 
 ! =================   subprogram documentation block   ================ !
 !                                                                       !
@@ -155,8 +155,7 @@ subroutine GFS_rrtmg_setup_init ( si, levr, ictm, isol, solar_file, ico2, &
       integer, intent(in) :: levr, ictm, isol, ico2, iaer, ntcw, num_p3d, &
            npdf3d, ntoz, iovr, iovr_rand, iovr_maxrand, iovr_max,         &
            iovr_dcorr, iovr_exp, iovr_exprand, icliq_sw, imp_physics,     &
-           iflip, me, rad_hr_units, ilwcliq, iswcliq, isubcsw, isubclw,   &
-           iswmode
+           iflip, me, rad_hr_units, icliq_lw, isubcsw, isubclw, iswmode
       integer, intent(in) :: idate(:)
       logical, intent(in) :: lcrick, lcnorm, lnoprec, do_RRTMGP, lalw1bd, &
            inc_minor_gas
@@ -221,10 +220,10 @@ subroutine GFS_rrtmg_setup_init ( si, levr, ictm, isol, solar_file, ico2, &
       call gas_init ( me, co2usr_file, co2cyc_file, ico2, ictm, ntoz,   &
            con_pi, errflg, errmsg)
       call cld_init ( si, levr, imp_physics, me, errflg, errmsg)
-      call rlwinit ( me, rad_hr_units, inc_minor_gas, ilwcliq, isubcsw, &
+      call rlwinit ( me, rad_hr_units, inc_minor_gas, icliq_lw, isubcsw, &
            iovr, iovr_rand, iovr_maxrand, iovr_max, iovr_dcorr,         &
            iovr_exp, iovr_exprand, errflg, errmsg )
-      call rswinit ( me, rad_hr_units, inc_minor_gas, iswcliq, isubclw, &
+      call rswinit ( me, rad_hr_units, inc_minor_gas, icliq_sw, isubclw, &
            iovr, iovr_rand, iovr_maxrand, iovr_max, iovr_dcorr,         &
            iovr_exp, iovr_exprand,iswmode, errflg, errmsg )
 
diff --git a/physics/GFS_rrtmg_setup.meta b/physics/GFS_rrtmg_setup.meta
index 40da39a1c..bf323676d 100644
--- a/physics/GFS_rrtmg_setup.meta
+++ b/physics/GFS_rrtmg_setup.meta
@@ -274,18 +274,11 @@
   dimensions = ()
   type = logical
   intent = in
-[ilwcliq]
-  standard_name = flag_for_rrtmg_lw_cloud_optics
-  long_name = flag for rrtmg longwave cloud optics
+[icliq_lw]
+  standard_name = flag_for_optical_property_for_liquid_clouds_for_longwave_radiation
+  long_name = lw optical property for liquid clouds
   units = flag
-  dimensions =  ()
-  type = integer
-  intent = in
-[iswcliq]
-  standard_name = flag_for_rrtmg_sw_cloud_optics
-  long_name = flag for rrtmg shortwave cloud optics
-  units = flag
-  dimensions =  ()
+  dimensions = ()
   type = integer
   intent = in
 [con_pi]
diff --git a/physics/radlw_main.meta b/physics/radlw_main.meta
index 406f773e3..3dccc97b3 100644
--- a/physics/radlw_main.meta
+++ b/physics/radlw_main.meta
@@ -305,17 +305,17 @@
   type = logical
   intent = in
 [ilwcliq]
-  standard_name = flag_for_rrtmg_lw_cloud_optics
-  long_name = flag for rrtmg longwave cloud optics
+  standard_name = flag_for_optical_property_for_liquid_clouds_for_longwave_radiation
+  long_name = lw optical property for liquid clouds
   units = flag
-  dimensions =  ()
+  dimensions = ()
   type = integer
   intent = in
 [ilwcice]
-  standard_name = flag_for_rrtmg_lw_ice_cloud_optics
-  long_name = flag for rrtmg longwave ice cloud optics
+  standard_name = flag_for_optical_property_for_ice_clouds_for_longwave_radiation
+  long_name = lw optical property for ice clouds
   units = flag
-  dimensions =  ()
+  dimensions = ()
   type = integer
   intent = in
 [isubclw]
diff --git a/physics/radsw_main.meta b/physics/radsw_main.meta
index 85e446498..eff5cdca3 100644
--- a/physics/radsw_main.meta
+++ b/physics/radsw_main.meta
@@ -295,17 +295,17 @@
   type = logical
   intent = in
 [iswcice]
-  standard_name = flag_for_rrtmg_sw_ice_cloud_optics
-  long_name = flag for rrtmg shortwave ice cloud optics
+  standard_name = flag_for_optical_property_for_ice_clouds_for_shortwave_radiation
+  long_name = sw optical property for ice clouds
   units = flag
-  dimensions =  ()
+  dimensions = ()
   type = integer
   intent = in
 [iswcliq]
-  standard_name = flag_for_rrtmg_sw_cloud_optics
-  long_name = flag for rrtmg shortwave cloud optics
+  standard_name = control_for_shortwave_radiation_liquid_clouds
+  long_name = sw optical property for liquid clouds
   units = flag
-  dimensions =  ()
+  dimensions = ()
   type = integer
   intent = in
 [isubcsw]

From 2fe654eddc9e559b91c555f14b1645385cb9128d Mon Sep 17 00:00:00 2001
From: dustinswales <dswales@ucar.edu>
Date: Wed, 21 Sep 2022 11:08:26 -0600
Subject: [PATCH 019/115] Address reviewers comments. Bug found in seeding for
 cloud-sampling in RRTMGP.

---
 physics/GFS_rrtmg_pre.F90            | 10 ++----
 physics/GFS_rrtmg_pre.meta           |  2 +-
 physics/GFS_rrtmgp_cloud_overlap.F90 |  2 +-
 physics/GFS_rrtmgp_pre.F90           | 50 ++++++++++-----------------
 physics/GFS_rrtmgp_pre.meta          |  8 ++---
 physics/GFS_rrtmgp_setup.F90         | 42 +++++++++++++----------
 physics/GFS_rrtmgp_setup.meta        | 51 +++++-----------------------
 physics/myjsfc_wrapper.F90           |  2 +-
 8 files changed, 59 insertions(+), 108 deletions(-)

diff --git a/physics/GFS_rrtmg_pre.F90 b/physics/GFS_rrtmg_pre.F90
index 9de3cb16c..d5540a043 100644
--- a/physics/GFS_rrtmg_pre.F90
+++ b/physics/GFS_rrtmg_pre.F90
@@ -19,7 +19,7 @@ module GFS_rrtmg_pre
 !>\section rrtmg_pre_gen General Algorithm
       subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp,        &
         imfdeepcnv, imfdeepcnv_gf, me, ncnd, ntrac, num_p3d, npdf3d, ncnvcld3d,&
-        ntqv, ntcw,ntiw, ntlnc, ntinc, ntrnc, ntsnc, ntccn,                    &
+        ntqv, ntcw,ntiw, ntlnc, ntinc, ntrnc, ntsnc, ntccn, top_at_1,          &
         ntrw, ntsw, ntgl, nthl, ntwa, ntoz,                                    &
         ntclamt, nleffr, nieffr, nseffr, lndp_type, kdt,                       &
         ntdu1, ntdu2, ntdu3, ntdu4, ntdu5, ntss1, ntss2,                       &
@@ -45,7 +45,7 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp,        &
         clouds9, cldsa, cldfra, cldfra2d, lwp_ex,iwp_ex, lwp_fc,iwp_fc,        &
         faersw1, faersw2, faersw3, faerlw1, faerlw2, faerlw3, alpha,           &
         aero_dir_fdb, smoke_ext, dust_ext,                                     &
-        spp_wts_rad, spp_rad, rrfs_smoke_band, top_at_1, ico2, errmsg, errflg)
+        spp_wts_rad, spp_rad, rrfs_smoke_band, ico2, errmsg, errflg)
 
       use machine,                   only: kind_phys
 
@@ -124,7 +124,7 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp,        &
       logical,              intent(in) :: lsswr, lslwr, ltaerosol, lgfdlmprad, &
                                           uni_cld, effr_in, do_mynnedmf,       &
                                           lmfshal, lmfdeep2, pert_clds, lcrick,&
-                                          lcnorm
+                                          lcnorm, top_at_1
       logical,              intent(in) :: aero_dir_fdb
       real(kind=kind_phys), dimension(:,:), intent(in) :: smoke_ext, dust_ext
 
@@ -203,7 +203,6 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp,        &
                                                              faerlw2,&
                                                              faerlw3
       real(kind=kind_phys), dimension(:,:),   intent(out) :: alpha
-      logical, intent(out) :: top_at_1
       character(len=*), intent(out) :: errmsg
       integer,          intent(out) :: errflg
 
@@ -260,9 +259,6 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp,        &
       errmsg = ''
       errflg = 0
 
-      ! Vertical ordering
-      top_at_1 = (prsi(1,1) .lt.  prsi(1, LMP))
-      
       if (.not. (lsswr .or. lslwr)) return
 
       !--- set commonly used integers
diff --git a/physics/GFS_rrtmg_pre.meta b/physics/GFS_rrtmg_pre.meta
index 228b73f20..752a6e1ed 100644
--- a/physics/GFS_rrtmg_pre.meta
+++ b/physics/GFS_rrtmg_pre.meta
@@ -1393,7 +1393,7 @@
   units = flag
   dimensions = ()
   type = logical
-  intent = out
+  intent = in
 [si]
   standard_name = sigma_pressure_hybrid_vertical_coordinate
   long_name = vertical sigma coordinate for radiation initialization
diff --git a/physics/GFS_rrtmgp_cloud_overlap.F90 b/physics/GFS_rrtmgp_cloud_overlap.F90
index 28c925600..0094f8165 100644
--- a/physics/GFS_rrtmgp_cloud_overlap.F90
+++ b/physics/GFS_rrtmgp_cloud_overlap.F90
@@ -100,6 +100,7 @@ subroutine GFS_rrtmgp_cloud_overlap_run(nCol, nLev, yearlen, doSWrad, doLWrad,
     !
     ! Cloud decorrelation length
     !
+    de_lgth(:) = 0.
     if (idcor == idcor_hogan) then
        call cmp_dcorr_lgth(nCol, lat, con_pi, de_lgth)
     endif
@@ -116,7 +117,6 @@ subroutine GFS_rrtmgp_cloud_overlap_run(nCol, nLev, yearlen, doSWrad, doLWrad,
     if (iovr == iovr_dcorr .or. iovr == iovr_exp .or. iovr == iovr_exprand) then
        call get_alpha_exper(nCol, nLev, iovr, iovr_exprand, deltaZc*0.001, de_lgth, cld_frac, cloud_overlap_param)
     else
-       de_lgth(:)               = 0.
        cloud_overlap_param(:,:) = 0.
     endif
 
diff --git a/physics/GFS_rrtmgp_pre.F90 b/physics/GFS_rrtmgp_pre.F90
index 9822aaf74..f68cdf000 100644
--- a/physics/GFS_rrtmgp_pre.F90
+++ b/physics/GFS_rrtmgp_pre.F90
@@ -5,19 +5,14 @@
 !! \brief This module contains code to prepare model fields for use by the RRTMGP 
 !! radiation scheme.  
 module GFS_rrtmgp_pre
-  use machine, only: &
-       kind_phys                   !< Working type
-  use funcphys, only:            &
-       fpvs                        !< Function ot compute sat. vapor pressure over liq.
-  use module_radiation_astronomy, only: &
-       coszmn 
-  use module_radiation_gases,    only: &
-       NF_VGAS,                  & !< Number of active gas species
-       getgases,                 & !< Routine to setup trace gases
-       getozn                      !< Routine to setup ozone
-  ! RRTMGP types
-  use mo_gas_concentrations, only: ty_gas_concs
-  use radiation_tools,       only: check_error_msg,cmp_tlev
+  use machine,                    only: kind_phys
+  use funcphys,                   only: fpvs
+  use module_radiation_astronomy, only: coszmn 
+  use module_radiation_gases,     only: NF_VGAS, getgases, getozn
+  use mo_gas_concentrations,      only: ty_gas_concs
+  use radiation_tools,            only: check_error_msg,cmp_tlev
+
+  implicit none
 
   real(kind_phys), parameter :: &
        amd   = 28.9644_kind_phys,  & !< Molecular weight of dry-air     (g/mol)
@@ -120,12 +115,16 @@ subroutine GFS_rrtmgp_pre_run(me, nCol, nLev, nTracers, i_o3, lsswr, lslwr, fhsw
     
     ! Inputs   
     integer, intent(in)    :: &
+         me,                & ! Current MPI rank
          nCol,              & ! Number of horizontal grid points
          nLev,              & ! Number of vertical layers
          nTracers,          & ! Number of tracers from model. 
          i_o3,              & ! Index into tracer array for ozone
-         ico2                 ! Flag for co2 radiation scheme
+         ico2,              & ! Flag for co2 radiation scheme
+         iSFC,              & ! Vertical index for surface
+         iTOA                 ! Vertical index for TOA
     logical, intent(in) :: &
+         top_at_1,          & ! Vertical ordering flag 
     	 lsswr,             & ! Call SW radiation?
     	 lslwr                ! Call LW radiation
     real(kind_phys), intent(in) :: &
@@ -164,11 +163,7 @@ subroutine GFS_rrtmgp_pre_run(me, nCol, nLev, nTracers, i_o3, lsswr, lslwr, fhsw
     character(len=*), intent(out) :: &
          errmsg               ! Error message
     integer, intent(out) :: &  
-         errflg,            & ! Error flag
-         iSFC,              & ! Vertical index for surface
-         iTOA                 ! Vertical index for TOA
-    logical, intent(out) :: &
-         top_at_1             ! Vertical ordering flag
+         errflg               ! Error flag
     real(kind_phys), intent(inout) :: &
          raddt                ! Radiation time-step
     real(kind_phys), dimension(:), intent(inout) :: &
@@ -209,20 +204,6 @@ subroutine GFS_rrtmgp_pre_run(me, nCol, nLev, nTracers, i_o3, lsswr, lslwr, fhsw
     errflg = 0
     
     if (.not. (lsswr .or. lslwr)) return
-        
-    ! #######################################################################################
-    ! What is vertical ordering?
-    ! #######################################################################################
-    top_at_1 = (prsi(1,1) .lt.  prsi(1, nLev))
-    if (top_at_1) then 
-       iSFC = nLev
-       iTOA = 1
-       iSFC_ilev = iSFC + 1
-    else
-       iSFC = 1
-       iTOA = nLev
-       iSFC_ilev = 1
-    endif
 
     ! #######################################################################################
     ! Compute some fields needed by RRTMGP
@@ -384,6 +365,9 @@ subroutine GFS_rrtmgp_pre_run(me, nCol, nLev, nTracers, i_o3, lsswr, lslwr, fhsw
     ! #######################################################################################
     ! Setup surface ground temperature and ground/air skin temperature if required.
     ! #######################################################################################
+    iSFC_ilev = 1
+    if (top_at_1) iSFC_ilev = iSFC + 1
+    
     tsfg(1:NCOL) = t_lev(1:NCOL,iSFC_ilev)
     tsfa(1:NCOL) = t_lay(1:NCOL,iSFC)
 
diff --git a/physics/GFS_rrtmgp_pre.meta b/physics/GFS_rrtmgp_pre.meta
index ff6e262cc..1c269af0f 100644
--- a/physics/GFS_rrtmgp_pre.meta
+++ b/physics/GFS_rrtmgp_pre.meta
@@ -2,7 +2,7 @@
   name = GFS_rrtmgp_pre
   type = scheme
   dependencies = funcphys.f90,iounitdef.f,machine.F,module_bfmicrophysics.f,physcons.F90,radcons.f90,radiation_aerosols.f
-  dependencies = radiation_astronomy.f,radiation_clouds.f,radiation_gases.f,radiation_tools.F90,rrtmg_lw_cloud_optics.F90
+  dependencies = radiation_astronomy.f,radiation_gases.f,radiation_tools.F90,rrtmg_lw_cloud_optics.F90
 
 ########################################################################
 [ccpp-arg-table]
@@ -369,21 +369,21 @@
   units = flag
   dimensions = ()
   type = logical
-  intent = out
+  intent = in
 [iSFC]
   standard_name = vertical_index_for_surface_in_RRTMGP
   long_name = index for	surface	layer in RRTMGP
   units = flag
   dimensions = ()
   type = integer
-  intent = out
+  intent = in
 [iTOA]
   standard_name = vertical_index_for_TOA_in_RRTMGP
   long_name = index for TOA layer in RRTMGP
   units = flag
   dimensions = ()
   type = integer
-  intent = out
+  intent = in
 [tsfc_radtime]
   standard_name = surface_skin_temperature_on_radiation_timestep
   long_name = surface skin temperature on radiation timestep
diff --git a/physics/GFS_rrtmgp_setup.F90 b/physics/GFS_rrtmgp_setup.F90
index 842d8e983..ad1d05cf8 100644
--- a/physics/GFS_rrtmgp_setup.F90
+++ b/physics/GFS_rrtmgp_setup.F90
@@ -9,7 +9,9 @@ module GFS_rrtmgp_setup
   implicit none
   
   public GFS_rrtmgp_setup_init, GFS_rrtmgp_setup_timestep_init, GFS_rrtmgp_setup_finalize
-  
+
+  private
+
   ! Version tag and last revision date
   character(40), parameter ::                                       &
        VTAGRAD='NCEP-RRTMGP_driver       v1.0  Sep 2019 '
@@ -35,10 +37,9 @@ module GFS_rrtmgp_setup
   subroutine GFS_rrtmgp_setup_init(do_RRTMGP, imp_physics, imp_physics_fer_hires,        &
        imp_physics_gfdl, imp_physics_thompson, imp_physics_wsm6, imp_physics_zhao_carr,  &
        imp_physics_zhao_carr_pdf, imp_physics_mg,  si, levr, ictm, isol, ico2, iaer,     &
-       ntcw, num_p3d,  ntoz, iovr, isubc_sw, isubc_lw, icliq_sw, crick_proof, ccnorm,    &
-       norad_precip, lalw1bd, idate, iflip, me, aeros_file, iaermdl, iaerflg, con_pi,    &
-       con_t0c, con_c, con_boltz, con_plnk, solar_file, con_solr_2008, con_solr_2002,    &
-       co2usr_file, co2cyc_file, errmsg, errflg)
+       ntcw, ntoz, iovr, isubc_sw, isubc_lw, lalw1bd, idate, me, aeros_file,             &
+       iaermdl, iaerflg, con_pi, con_t0c, con_c, con_boltz, con_plnk, solar_file,        &
+       con_solr_2008, con_solr_2002, co2usr_file, co2cyc_file, ipsd0, errmsg, errflg)
 
     ! Inputs
     logical, intent(in) :: do_RRTMGP
@@ -56,18 +57,19 @@ subroutine GFS_rrtmgp_setup_init(do_RRTMGP, imp_physics, imp_physics_fer_hires,
     real(kind_phys), dimension(:), intent(in) :: &
          si
     integer, intent(in) :: levr, ictm, isol, ico2, iaer, & 
-         ntcw, num_p3d, ntoz, iovr, isubc_sw, isubc_lw,  &
-         icliq_sw, iflip, me
+         ntcw, ntoz, iovr, isubc_sw, isubc_lw,  &
+         me
     logical, intent(in) :: &
-         crick_proof, ccnorm, norad_precip, lalw1bd
+         lalw1bd
     integer, intent(in), dimension(:) :: &
          idate
     character(len=26),intent(in) :: aeros_file, solar_file, co2usr_file, co2cyc_file
 
     ! Outputs
-    character(len=*), intent(out) :: errmsg
-    integer,          intent(out) :: errflg
-    integer,          intent(out) :: iaermdl, iaerflg
+    character(len=*), intent(out)   :: errmsg
+    integer,          intent(out)   :: errflg
+    integer,          intent(inout) :: ipsd0
+    integer,          intent(out)   :: iaermdl, iaerflg
     
     ! Initialize the CCPP error handling variables
     errmsg = ''
@@ -94,6 +96,11 @@ subroutine GFS_rrtmgp_setup_init(do_RRTMGP, imp_physics, imp_physics_fer_hires,
        errflg = 1
        return
     endif
+
+    ! Assign initial permutation seed for mcica cloud-radiation
+    if ( isubc_sw>0 .or. isubc_lw>0 ) then
+       ipsd0 = 17*idate(1)+43*idate(2)+37*idate(3)+23*idate(4)
+    endif
     
     if ( me == 0 ) then
        print *,'  In rad_initialize (GFS_rrtmgp_setup_init), before calling radinit'
@@ -102,18 +109,17 @@ subroutine GFS_rrtmgp_setup_init(do_RRTMGP, imp_physics, imp_physics_fer_hires,
                ' ictm     = ',ictm,      &
                ' isol     = ',isol,      &
                ' ico2     = ',ico2,      &
-               ' iaer     = ',iaer,      &
-               ' ntcw     = ',ntcw
-       print *,' np3d     = ',num_p3d,   &
+               ' iaermdl  = ',iaermdl,   &
+               ' iaerflg  = ',iaerflg,   &
+               ' ntcw     = ',ntcw,      &
                ' ntoz     = ',ntoz,      &
                ' iovr     = ',iovr,      &
                ' isubc_sw = ',isubc_sw,  &
                ' isubc_lw = ',isubc_lw,  &
-               ' icliq_sw = ',icliq_sw,  &
-               ' iflip    = ',iflip,     &
+               ' ipsd0    = ',ipsd0,     &
                ' me       = ',me
     endif
-    
+
     loz1st = (ntoz == 0)           ! first-time clim ozone data read flag
     month0 = 0
     iyear0 = 0
@@ -123,7 +129,7 @@ subroutine GFS_rrtmgp_setup_init(do_RRTMGP, imp_physics, imp_physics_fer_hires,
     call sol_init ( me, isol, solar_file, con_solr_2008, con_solr_2002, con_pi )
     call aer_init ( levr, me, iaermdl, iaerflg, lalw1bd, aeros_file, con_pi, con_t0c,    &
          con_c, con_boltz, con_plnk, errflg, errmsg)
-    call gas_init ( me, co2usr_file, co2cyc_file, ico2, ntoz, ictm, con_pi, errflg, errmsg )
+    call gas_init ( me, co2usr_file, co2cyc_file, ico2, ictm, ntoz, con_pi, errflg, errmsg )
 
     if ( me == 0 ) then
        print *,' return from rad_initialize (GFS_rrtmgp_setup_init) - after calling radinit'
diff --git a/physics/GFS_rrtmgp_setup.meta b/physics/GFS_rrtmgp_setup.meta
index 8a9fd4ef6..d47aadb93 100644
--- a/physics/GFS_rrtmgp_setup.meta
+++ b/physics/GFS_rrtmgp_setup.meta
@@ -2,7 +2,7 @@
   name = GFS_rrtmgp_setup
   type = scheme
   dependencies = iounitdef.f,machine.F,module_bfmicrophysics.f,radiation_aerosols.f,radiation_astronomy.f
-  dependencies = module_mp_thompson.F90,radiation_clouds.f,radiation_gases.f
+  dependencies = module_mp_thompson.F90,radiation_gases.f
 
 ########################################################################
 [ccpp-arg-table]
@@ -146,13 +146,6 @@
   dimensions = ()
   type = integer
   intent = in
-[num_p3d]
-  standard_name = number_of_microphysics_variables_in_xyz_dimensioned_restart_array
-  long_name = number of 3D arrays needed for microphysics
-  units = count
-  dimensions = ()
-  type = integer
-  intent = in
 [ntoz]
   standard_name = index_of_ozone_mixing_ratio_in_tracer_concentration_array
   long_name = tracer index for ozone mixing ratio
@@ -181,34 +174,6 @@
   dimensions = ()
   type = integer
   intent = in
-[icliq_sw]
-  standard_name = control_for_shortwave_radiation_liquid_clouds
-  long_name = sw optical property for liquid clouds
-  units = flag
-  dimensions = ()
-  type = integer
-  intent = in
-[crick_proof]
-  standard_name = flag_for_CRICK_proof_cloud_water
-  long_name = flag for CRICK-Proof cloud water
-  units = flag
-  dimensions = ()
-  type = logical
-  intent = in
-[ccnorm]
-  standard_name = flag_for_in_cloud_condensate
-  long_name = flag for cloud condensate normalized by cloud cover
-  units = flag
-  dimensions = ()
-  type = logical
-  intent = in
-[norad_precip]
-  standard_name = flag_for_turning_off_precipitation_radiative_effect
-  long_name = radiation precip flag for Ferrier/Moorthi
-  units = flag
-  dimensions = ()
-  type = logical
-  intent = in
 [lalw1bd]
   standard_name = flag_for_longwave_aerosol_band_properties
   long_name = flag for band or multiband longwave aerosol properties
@@ -223,13 +188,6 @@
   dimensions = (4)
   type = integer
   intent = in
-[iflip]
-  standard_name = control_for_vertical_index_direction
-  long_name = flag for vertical index direction control
-  units = flag
-  dimensions = ()
-  type = integer
-  intent = in
 [me]
   standard_name = mpi_rank
   long_name = current MPI-rank
@@ -301,6 +259,13 @@
   type = character
   kind = len=26
   intent = in
+[ipsd0]
+  standard_name = initial_seed_for_mcica
+  long_name = initial permutaion seed for mcica radiation
+  units = none
+  dimensions =  ()
+  type = integer
+  intent = inout
 [iaermdl]
   standard_name = flag_for_aerosol_radiation_scheme
   long_name = flag for aerosol scheme to use in radiation
diff --git a/physics/myjsfc_wrapper.F90 b/physics/myjsfc_wrapper.F90
index 81cb36765..cebd2a9f1 100644
--- a/physics/myjsfc_wrapper.F90
+++ b/physics/myjsfc_wrapper.F90
@@ -334,7 +334,7 @@ SUBROUTINE myjsfc_wrapper_run(                    &
      &         ,phy_f2d_myj(1:im,13)                         &
      &         ,1,im,1,1,1,levs                              &
      &         ,1,im,1,1,1,levs                              &
-     &         ,1,im,1,1,1,levs)
+     &         ,1,im,1,1,1,levs, errmsg, errflg)
 
       do i = 1, im
          if(flag_iter(i))then

From 51b9243107a4c886e35b270768cd501f602d4534 Mon Sep 17 00:00:00 2001
From: dustinswales <dswales@ucar.edu>
Date: Thu, 22 Sep 2022 10:52:18 -0600
Subject: [PATCH 020/115] Update CODEOWNERS file

---
 CODEOWNERS | 170 ++++++++++++++++++++++++++---------------------------
 1 file changed, 85 insertions(+), 85 deletions(-)

diff --git a/CODEOWNERS b/CODEOWNERS
index cf7a886aa..a8cbf59ca 100644
--- a/CODEOWNERS
+++ b/CODEOWNERS
@@ -4,127 +4,127 @@
 
 # Default codeowners for files that don't have specific owners:
 
-*           @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
+*           @grantfirl @ChunxiZhang-NOAA @dustinswales @mzhangw
 
 
 # The following lines are from the CCPP Primary Schemes Points of Contact
 #   https://docs.google.com/spreadsheets/d/14y0Th_sSpCqlssEMNfSZ_Ni9wrpPqfpPY0kRG7jCZB8/edit#gid=0
 # (Internal NOAA document.)
 
-smoke/*                                        @haiqinli                            @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
+smoke/*                                        @haiqinli                            @grantfirl @ChunxiZhang-NOAA @dustinswales
 
-physics/cs_conv_aw_adj.*                       @AnningCheng-NOAA                    @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
-physics/cs_conv.*                              @AnningCheng-NOAA                    @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
-physics/cu_gf*                                 @hannahcbarnes @haiqinli             @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
-physics/sascnvn.*                              @JongilHan66                         @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
-physics/cu_ntiedtke*                           @ChunxiZhang-NOAA                    @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich
-physics/rascnv.*                               @SMoorthi-emc                        @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
+physics/cs_conv_aw_adj.*                       @AnningCheng-NOAA                    @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/cs_conv.*                              @AnningCheng-NOAA                    @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/cu_gf*                                 @hannahcbarnes @haiqinli             @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/sascnvn.*                              @JongilHan66                         @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/cu_ntiedtke*                           @ChunxiZhang-NOAA                    @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/rascnv.*                               @SMoorthi-emc                        @grantfirl @ChunxiZhang-NOAA @dustinswales
 
-physics/samfdeepcnv.*                          @JongilHan66                         @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
-physics/samfshalcnv.*                          @JongilHan66                         @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
-physics/samfaerosols.*                         @JongilHan66                         @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
+physics/samfdeepcnv.*                          @JongilHan66                         @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/samfshalcnv.*                          @JongilHan66                         @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/samfaerosols.*                         @JongilHan66                         @grantfirl @ChunxiZhang-NOAA @dustinswales
 
-physics/shalcnv.*                              @JongilHan66                         @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
-physics/unified_ugwp*                          @mdtoyNOAA                           @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
-physics/ugwp_driver_v0.F                       @mdtoyNOAA                           @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
-physics/cires_ugwp*                            @mdtoyNOAA @ValeryYudin-NOAA         @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
-physics/drag_suite.*                           @mdtoyNOAA                           @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
+physics/shalcnv.*                              @JongilHan66                         @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/unified_ugwp*                          @mdtoyNOAA                           @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/ugwp_driver_v0.F                       @mdtoyNOAA                           @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/cires_ugwp*                            @mdtoyNOAA @ValeryYudin-NOAA         @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/drag_suite.*                           @mdtoyNOAA                           @grantfirl @ChunxiZhang-NOAA @dustinswales
 
-physics/gwdc.*                                 @Songyou184                          @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
-physics/gwdps.*                                @Songyou184                          @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
+physics/gwdc.*                                 @Songyou184                          @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/gwdps.*                                @Songyou184                          @grantfirl @ChunxiZhang-NOAA @dustinswales
 
-physics/gfdl_fv_sat_adj.*                      @RuiyuSun                            @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
-physics/gfdl_cloud_microphys.*                 @RuiyuSun                            @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
+physics/gfdl_fv_sat_adj.*                      @RuiyuSun                            @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/gfdl_cloud_microphys.*                 @RuiyuSun                            @grantfirl @ChunxiZhang-NOAA @dustinswales
 
-physics/module_gfdl_cloud_microphys.*          @RuiyuSun                            @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
-physics/multi_gases.F90                        @RuiyuSun                            @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
+physics/module_gfdl_cloud_microphys.*          @RuiyuSun                            @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/multi_gases.F90                        @RuiyuSun                            @grantfirl @ChunxiZhang-NOAA @dustinswales
 
-physics/mp_fer_hires.*                         @ericaligo-NOAA                      @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
-physics/module_MP_FER_HIRES.*                  @ericaligo-NOAA                      @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
+physics/mp_fer_hires.*                         @ericaligo-NOAA                      @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/module_MP_FER_HIRES.*                  @ericaligo-NOAA                      @grantfirl @ChunxiZhang-NOAA @dustinswales
 
-physics/module_mp_thompson*                    @gthompsnWRF @RuiyuSun               @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
-physics/module_mp_radar.*                      @gthompsnWRF @RuiyuSun               @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
-physics/mp_thompson*                           @gthompsnWRF @RuiyuSun               @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
+physics/module_mp_thompson*                    @gthompsnWRF @RuiyuSun               @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/module_mp_radar.*                      @gthompsnWRF @RuiyuSun               @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/mp_thompson*                           @gthompsnWRF @RuiyuSun               @grantfirl @ChunxiZhang-NOAA @dustinswales
 
-physics/precpd.*                               @RuiyuSun                            @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
-physics/gscond.*                               @RuiyuSun                            @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
+physics/precpd.*                               @RuiyuSun                            @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/gscond.*                               @RuiyuSun                            @grantfirl @ChunxiZhang-NOAA @dustinswales
 
-physics/m_micro*                               @AnningCheng-NOAA @andrewgettelman   @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
-physics/aer_cloud.F                            @AnningCheng-NOAA @andrewgettelman   @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
-physics/aerclm_def.F                           @AnningCheng-NOAA @andrewgettelman   @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
-physics/cldmacro.F                             @AnningCheng-NOAA @andrewgettelman   @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
-physics/cldwat2m_micro.F                       @AnningCheng-NOAA @andrewgettelman   @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
-physics/wv_saturation.F                        @AnningCheng-NOAA @andrewgettelman   @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
-physics/micro_mg*                              @AnningCheng-NOAA @andrewgettelman   @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
+physics/m_micro*                               @AnningCheng-NOAA @andrewgettelman   @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/aer_cloud.F                            @AnningCheng-NOAA @andrewgettelman   @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/aerclm_def.F                           @AnningCheng-NOAA @andrewgettelman   @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/cldmacro.F                             @AnningCheng-NOAA @andrewgettelman   @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/cldwat2m_micro.F                       @AnningCheng-NOAA @andrewgettelman   @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/wv_saturation.F                        @AnningCheng-NOAA @andrewgettelman   @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/micro_mg*                              @AnningCheng-NOAA @andrewgettelman   @grantfirl @ChunxiZhang-NOAA @dustinswales
 
-physics/ozphys*                                @AlexBelochitski-NOAA                @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
+physics/ozphys*                                @AlexBelochitski-NOAA                @grantfirl @ChunxiZhang-NOAA @dustinswales
 
-physics/satmedmfvdif.*                         @JongilHan66                         @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
-physics/satmedmfvdifq.*                        @JongilHan66                         @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
-physics/mfpbl.f                                @JongilHan66                         @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
-physics/mfscu.f                                @JongilHan66                         @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
-physics/mfpbltq.f                              @JongilHan66                         @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
-physics/mfscuq.f                               @JongilHan66                         @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
+physics/satmedmfvdif.*                         @JongilHan66                         @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/satmedmfvdifq.*                        @JongilHan66                         @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/mfpbl.f                                @JongilHan66                         @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/mfscu.f                                @JongilHan66                         @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/mfpbltq.f                              @JongilHan66                         @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/mfscuq.f                               @JongilHan66                         @grantfirl @ChunxiZhang-NOAA @dustinswales
 
-physics/shinhongvdif.*                         @ChunxiZhang-NOAA                    @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich
-physics/ysuvdif.*                              @ChunxiZhang-NOAA                    @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich
+physics/shinhongvdif.*                         @ChunxiZhang-NOAA                    @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/ysuvdif.*                              @ChunxiZhang-NOAA                    @grantfirl @ChunxiZhang-NOAA @dustinswales
 
-physics/tridi.f                                @JongilHan66 @ChunxiZhang-NOAA @JongilHan66 @WeiguoWang-NOAA @AlexBelochitski-NOAA       @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich
+physics/tridi.f                                @JongilHan66 @ChunxiZhang-NOAA @JongilHan66 @WeiguoWang-NOAA @AlexBelochitski-NOAA       @grantfirl @ChunxiZhang-NOAA @dustinswales
 
-physics/moninedmf.*                            @JongilHan66 @WeiguoWang-NOAA        @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
+physics/moninedmf.*                            @JongilHan66 @WeiguoWang-NOAA        @grantfirl @ChunxiZhang-NOAA @dustinswales
 
-physics/module_BL_MYJPBL.*                     @Qingfu-Liu                          @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
-physics/module_MYJPBL_wrapper.*                @Qingfu-Liu                          @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
+physics/module_BL_MYJPBL.*                     @Qingfu-Liu                          @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/module_MYJPBL_wrapper.*                @Qingfu-Liu                          @grantfirl @ChunxiZhang-NOAA @dustinswales
 
-physics/module_bl_mynn.*                       @joeolson42                          @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
-physics/module_MYNNPBL_wrapper.*               @joeolson42                          @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
+physics/module_bl_mynn.*                       @joeolson42                          @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/module_MYNNPBL_wrapper.*               @joeolson42                          @grantfirl @ChunxiZhang-NOAA @dustinswales
 
-physics/gcm_shoc.*                             @AlexBelochitski-NOAA                @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
-physics/moninshoc.*                            @AlexBelochitski-NOAA                @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
+physics/gcm_shoc.*                             @AlexBelochitski-NOAA                @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/moninshoc.*                            @AlexBelochitski-NOAA                @grantfirl @ChunxiZhang-NOAA @dustinswales
 
-physics/rte-rrtmgp                             @dustinswales @Qingfu-Liu            @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
-physics/radiation_tools.*                      @dustinswales @Qingfu-Liu            @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
-physics/rrtmgp_lw_rte.met*                     @dustinswales @Qingfu-Liu            @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
-physics/rrtmgp_sw_rte.met*                     @dustinswales @Qingfu-Liu            @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
+physics/rte-rrtmgp                             @dustinswales @Qingfu-Liu            @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/radiation_tools.*                      @dustinswales @Qingfu-Liu            @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/rrtmgp_lw_rte.*                        @dustinswales @Qingfu-Liu            @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/rrtmgp_sw_rte.*                        @dustinswales @Qingfu-Liu            @grantfirl @ChunxiZhang-NOAA @dustinswales
 
-physics/radlw_main.*                           @mjiacono @Qingfu-Liu                @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
-physics/HWRF_mcica_random_numbers.F90          @mjiacono @Qingfu-Liu                @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
-physics/HWRF_mersenne_twister.F90              @mjiacono @Qingfu-Liu                @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
-physics/radlw_datatb.f                         @mjiacono @Qingfu-Liu                @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
-physics/radsw_datatb.*                         @mjiacono @Qingfu-Liu                @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
-physics/radsw_main.*                           @mjiacono @Qingfu-Liu                @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
+physics/radlw_main.*                           @mjiacono @Qingfu-Liu                @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/HWRF_mcica_random_numbers.F90          @mjiacono @Qingfu-Liu                @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/HWRF_mersenne_twister.F90              @mjiacono @Qingfu-Liu                @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/radlw_datatb.f                         @mjiacono @Qingfu-Liu                @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/radsw_datatb.*                         @mjiacono @Qingfu-Liu                @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/radsw_main.*                           @mjiacono @Qingfu-Liu                @grantfirl @ChunxiZhang-NOAA @dustinswales
 
-physics/radsw_param.f                          @dustinswales @Qingfu-Liu @mjiacono  @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
+physics/radsw_param.f                          @dustinswales @Qingfu-Liu @mjiacono  @grantfirl @ChunxiZhang-NOAA @dustinswales
 
-physics/rayleigh_damp.*                        @yangfanglin                         @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
-physics/GFS_stochastics.*                      @pjpegion @lisa-bengtsson            @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
-physics/flake*                                 @YihuaWu-NOAA                        @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
+physics/rayleigh_damp.*                        @yangfanglin                         @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/GFS_stochastics.*                      @pjpegion @lisa-bengtsson            @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/flake*                                 @YihuaWu-NOAA                        @grantfirl @ChunxiZhang-NOAA @dustinswales
 
-physics/sfc_drv.*                              @HelinWei-NOAA                       @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
-physics/sflx.f                                 @HelinWei-NOAA                       @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
-physics/surface_perturbation.*                 @HelinWei-NOAA                       @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
+physics/sfc_drv.*                              @HelinWei-NOAA                       @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/sflx.f                                 @HelinWei-NOAA                       @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/surface_perturbation.*                 @HelinWei-NOAA                       @grantfirl @ChunxiZhang-NOAA @dustinswales
 
-physics/*noahmp*                               @barlage @cenlinhe                   @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
+physics/*noahmp*                               @barlage @cenlinhe                   @grantfirl @ChunxiZhang-NOAA @dustinswales
 
-physics/set_soilveg.*                          @HelinWei-NOAA @barlage @cenlinhe    @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
-physics/namelist_soilveg.*                     @HelinWei-NOAA @barlage @cenlinhe    @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
+physics/set_soilveg.*                          @HelinWei-NOAA @barlage @cenlinhe    @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/namelist_soilveg.*                     @HelinWei-NOAA @barlage @cenlinhe    @grantfirl @ChunxiZhang-NOAA @dustinswales
 
-physics/namelist_soilveg_ruc.*                 @tanyasmirnova                       @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
-physics/set_soilveg_ruc.*                      @tanyasmirnova                       @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
-physics/module_sf_ruclsm.*                     @tanyasmirnova                       @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
-physics/module_soil_pre.*                      @tanyasmirnova                       @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
-physics/sfc_drv_ruc.*                          @tanyasmirnova                       @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
+physics/namelist_soilveg_ruc.*                 @tanyasmirnova                       @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/set_soilveg_ruc.*                      @tanyasmirnova                       @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/module_sf_ruclsm.*                     @tanyasmirnova                       @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/module_soil_pre.*                      @tanyasmirnova                       @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/sfc_drv_ruc.*                          @tanyasmirnova                       @grantfirl @ChunxiZhang-NOAA @dustinswales
 
-physics/date_def.f                             @XuLi-NOAA                           @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
-physics/*nst*                                  @XuLi-NOAA                           @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
+physics/date_def.f                             @XuLi-NOAA                           @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/*nst*                                  @XuLi-NOAA                           @grantfirl @ChunxiZhang-NOAA @dustinswales
 
-physics/sfc_ocean.*                            @HelinWei-NOAA                       @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
-physics/sfc_diff.*                             @JongilHan66                         @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
+physics/sfc_ocean.*                            @HelinWei-NOAA                       @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/sfc_diff.*                             @JongilHan66                         @grantfirl @ChunxiZhang-NOAA @dustinswales
 
-physics/h2ophys.*                              @AlexBelochitski-NOAA                @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
+physics/h2ophys.*                              @AlexBelochitski-NOAA                @grantfirl @ChunxiZhang-NOAA @dustinswales
 
-physics/sfc_sice.*                             @wd20xw                              @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
-physics/sfc_cice.*                             @wd20xw                              @climbfuji @SamuelTrahanNOAA @grantfirl @mzhangw @panll @mkavulich @ChunxiZhang-NOAA
+physics/sfc_sice.*                             @wd20xw                              @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/sfc_cice.*                             @wd20xw                              @grantfirl @ChunxiZhang-NOAA @dustinswales
 
 ########################################################################
 

From f5ca603e55d705b0fdcddfafb096da0d643f8a44 Mon Sep 17 00:00:00 2001
From: dustinswales <dswales@ucar.edu>
Date: Thu, 22 Sep 2022 14:34:52 -0600
Subject: [PATCH 021/115] Update CODEOWNERS

---
 CODEOWNERS | 262 ++++++++++++++++++++++++++++++++++-------------------
 1 file changed, 167 insertions(+), 95 deletions(-)

diff --git a/CODEOWNERS b/CODEOWNERS
index a8cbf59ca..55373ae36 100644
--- a/CODEOWNERS
+++ b/CODEOWNERS
@@ -12,119 +12,191 @@
 # (Internal NOAA document.)
 
 smoke/*                                        @haiqinli                            @grantfirl @ChunxiZhang-NOAA @dustinswales
-
+physics/aerclm_def.F                           @AnningCheng-NOAA @andrewgettelman   @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/aer_cloud.F                            @AnningCheng-NOAA @andrewgettelman   @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/aerinterp.F90                          @AnningCheng-NOAA @andrewgettelman   @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/bl_mynn_common.f90                     @joeolson42                          @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/calpreciptype.f90                                                           @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/cires_orowam2017.f                                                          @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/cires_tauamf_data.F90                                                       @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/cires_ugwp*                            @mdtoyNOAA @ValeryYudin-NOAA         @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/cldmacro.F                             @AnningCheng-NOAA @andrewgettelman   @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/cldwat2m_micro.F                       @AnningCheng-NOAA @andrewgettelman   @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/cnvc90.*                                                                    @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/cs_conv_aw_adj.*                       @AnningCheng-NOAA                    @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/cs_conv.*                              @AnningCheng-NOAA                    @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/cu_gf*                                 @hannahcbarnes @haiqinli             @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/sascnvn.*                              @JongilHan66                         @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/cu_ntiedtke*                           @ChunxiZhang-NOAA                    @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/rascnv.*                               @SMoorthi-emc                        @grantfirl @ChunxiZhang-NOAA @dustinswales
-
-physics/samfdeepcnv.*                          @JongilHan66                         @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/samfshalcnv.*                          @JongilHan66                         @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/samfaerosols.*                         @JongilHan66                         @grantfirl @ChunxiZhang-NOAA @dustinswales
-
-physics/shalcnv.*                              @JongilHan66                         @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/unified_ugwp*                          @mdtoyNOAA                           @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/ugwp_driver_v0.F                       @mdtoyNOAA                           @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/cires_ugwp*                            @mdtoyNOAA @ValeryYudin-NOAA         @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/date_def.f                             @XuLi-NOAA                           @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/dcyc2t3.*                              @Qingfu-Liu @dustinswales            @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/drag_suite.*                           @mdtoyNOAA                           @grantfirl @ChunxiZhang-NOAA @dustinswales
-
+physics/flake*                                 @YihuaWu-NOAA                        @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/funcphys.f90                                                                @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/fv_sat_adj.*                           @RuiyuSun                            @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/gcycle.F90                                                                  @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/get_phi_fv3.*                                                               @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/get_prs_fv3.*                                                               @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/gfdl_cloud_microphys.*                 @RuiyuSun                            @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/GFDL_parse_tracers.F90                                                      @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/gfdl_sfc_layer.*                                                            @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/GFS_cloud_diagnostics.*                @dustinswales                        @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/GFS_DCNV_generic_post.*                                                     @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/GFS_DCNV_generic_pre.*                                                      @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/GFS_debug.*                                                                 @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/GFS_GWD_generic_post.*                                                      @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/GFS_GWD_generic_pre.*                                                       @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/GFS_MP_generic_post.*                                                       @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/GFS_MP_generic_pre.*                                                        @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/GFS_PBL_generic_common.F90                                                  @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/GFS_PBL_generic_post.*                                                      @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/GFS_PBL_generic_pre.*                                                       @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/GFS_phys_time_vary.fv3.*                                                    @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/GFS_phys_time_vary.scm.*                                                    @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/gfs_phy_tracer_config.F                                                     @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/GFS_radiation_surface.*                                                     @grantfirl @ChunxiZhang-NOAA @dustinswales 
+physics/GFS_rad_time_vary.fv3.*                                                     @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/GFS_rad_time_vary.scm.*                                                     @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/GFS_rrtmgp_cloud_mp.*                  @dustinswales @Qingfu-Liu            @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/GFS_rrtmgp_cloud_overlap.*             @dustinswales @Qingfu-Liu            @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/GFS_rrtmgp_lw_post.*                   @dustinswales @Qingfu-Liu            @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/GFS_rrtmg_post.*                       @Qingfu-Liu @dustinswales            @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/GFS_rrtmgp_pre.*                       @dustinswales @Qingfu-Liu            @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/GFS_rrtmg_pre.*                        @Qingfu-Liu @dustinswales            @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/GFS_rrtmgp_setup.*                     @dustinswales @Qingfu-Liu            @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/GFS_rrtmgp_sw_post.*                   @dustinswales @Qingfu-Liu            @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/GFS_rrtmgp_sw_pre.*                    @dustinswales @Qingfu-Liu            @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/GFS_rrtmg_setup.*                      @Qingfu-Liu @dustinswales            @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/GFS_SCNV_generic_post.*                                                     @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/GFS_SCNV_generic_pre.*                                                      @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/GFS_stochastics.*                      @pjpegion @lisa-bengtsson            @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/GFS_suite_interstitial_1.*                                                  @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/GFS_suite_interstitial_2.*                                                  @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/GFS_suite_interstitial_3.*                                                  @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/GFS_suite_interstitial_4.*                                                  @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/GFS_suite_interstitial_5.*                                                  @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/GFS_suite_interstitial_phys_reset.*                                         @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/GFS_suite_interstitial_rad_reset.*                                          @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/GFS_suite_stateout_reset.*                                                  @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/GFS_suite_stateout_update.*                                                 @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/GFS_surface_composites_inter.*                                              @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/GFS_surface_composites_post.*                                               @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/GFS_surface_composites_pre.*                                                @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/GFS_surface_generic_post.*                                                  @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/GFS_surface_generic_pre.*                                                   @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/GFS_surface_loop_control_part1.*                                            @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/GFS_surface_loop_control_part2.*                                            @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/GFS_time_vary_pre.fv3.*                                                     @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/GFS_time_vary_pre.scm.*                                                     @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/gocart_tracer_config_stub.f                                                 @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/gwdc.*                                 @Songyou184                          @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/gwdps.*                                @Songyou184                          @grantfirl @ChunxiZhang-NOAA @dustinswales
-
-physics/gfdl_fv_sat_adj.*                      @RuiyuSun                            @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/gfdl_cloud_microphys.*                 @RuiyuSun                            @grantfirl @ChunxiZhang-NOAA @dustinswales
-
-physics/module_gfdl_cloud_microphys.*          @RuiyuSun                            @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/multi_gases.F90                        @RuiyuSun                            @grantfirl @ChunxiZhang-NOAA @dustinswales
-
-physics/mp_fer_hires.*                         @ericaligo-NOAA                      @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/module_MP_FER_HIRES.*                  @ericaligo-NOAA                      @grantfirl @ChunxiZhang-NOAA @dustinswales
-
-physics/module_mp_thompson*                    @gthompsnWRF @RuiyuSun               @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/module_mp_radar.*                      @gthompsnWRF @RuiyuSun               @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/mp_thompson*                           @gthompsnWRF @RuiyuSun               @grantfirl @ChunxiZhang-NOAA @dustinswales
-
-physics/precpd.*                               @RuiyuSun                            @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/gscond.*                               @RuiyuSun                            @grantfirl @ChunxiZhang-NOAA @dustinswales
-
-physics/m_micro*                               @AnningCheng-NOAA @andrewgettelman   @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/aer_cloud.F                            @AnningCheng-NOAA @andrewgettelman   @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/aerclm_def.F                           @AnningCheng-NOAA @andrewgettelman   @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/cldmacro.F                             @AnningCheng-NOAA @andrewgettelman   @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/cldwat2m_micro.F                       @AnningCheng-NOAA @andrewgettelman   @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/wv_saturation.F                        @AnningCheng-NOAA @andrewgettelman   @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/micro_mg*                              @AnningCheng-NOAA @andrewgettelman   @grantfirl @ChunxiZhang-NOAA @dustinswales
-
-physics/ozphys*                                @AlexBelochitski-NOAA                @grantfirl @ChunxiZhang-NOAA @dustinswales
-
-physics/satmedmfvdif.*                         @JongilHan66                         @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/satmedmfvdifq.*                        @JongilHan66                         @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/h2o_def.*                                                                   @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/h2ointerp.f90                                                               @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/h2ophys.*                              @AlexBelochitski-NOAA                @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/hedmf.*                                @JongilHan66 @WeiguoWang-NOAA        @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/iccn_def.F                                                                  @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/iccninterp.F90                                                              @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/iounitdef.f                                                                 @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/lsm_noah.*                             @HelinWei-NOAA                       @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/lsm_ruc.*                              @tanyasmirnova                       @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/machine.*                                                                   @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/maximum_hourly_diagnostics.*                                                @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/mersenne_twister.f                                                          @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/mfpbl.f                                @JongilHan66                         @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/mfscu.f                                @JongilHan66                         @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/mfpblt.f                                                                    @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/mfpbltq.f                              @JongilHan66                         @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/mfscu.f                                @JongilHan66                         @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/mfscuq.f                               @JongilHan66                         @grantfirl @ChunxiZhang-NOAA @dustinswales
-
-physics/shinhongvdif.*                         @ChunxiZhang-NOAA                    @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/ysuvdif.*                              @ChunxiZhang-NOAA                    @grantfirl @ChunxiZhang-NOAA @dustinswales
-
-physics/tridi.f                                @JongilHan66 @ChunxiZhang-NOAA @JongilHan66 @WeiguoWang-NOAA @AlexBelochitski-NOAA       @grantfirl @ChunxiZhang-NOAA @dustinswales
-
-physics/moninedmf.*                            @JongilHan66 @WeiguoWang-NOAA        @grantfirl @ChunxiZhang-NOAA @dustinswales
-
+physics/micro_mg*                              @AnningCheng-NOAA @andrewgettelman   @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/m_micro*                               @AnningCheng-NOAA @andrewgettelman   @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/module_bfmicrophysics.f                                                     @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/module_BL_MYJPBL.*                     @Qingfu-Liu                          @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/module_MYJPBL_wrapper.*                @Qingfu-Liu                          @grantfirl @ChunxiZhang-NOAA @dustinswales
-
 physics/module_bl_mynn.*                       @joeolson42                          @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/module_MYNNPBL_wrapper.*               @joeolson42                          @grantfirl @ChunxiZhang-NOAA @dustinswales
-
-physics/gcm_shoc.*                             @AlexBelochitski-NOAA                @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/module_gfdl_cloud_microphys.*          @RuiyuSun                            @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/module_MP_FER_HIRES.*                  @ericaligo-NOAA                      @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/module_mp_nssl_2mom.F90                                                     @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/module_mp_radar.*                      @gthompsnWRF @RuiyuSun               @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/module_mp_thompson*                    @gthompsnWRF @RuiyuSun               @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/module_nst*                            @XuLi-NOAA                           @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/module_sf_exchcoef.f90                                                      @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/module_SF_JSFC.F90                                                          @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/module_sf_mynn.F90                     @joeolson42                          @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/module_sf_ruclsm.*                     @tanyasmirnova                       @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/module_soil_pre.*                      @tanyasmirnova                       @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/moninshoc.*                            @AlexBelochitski-NOAA                @grantfirl @ChunxiZhang-NOAA @dustinswales
-
-physics/rte-rrtmgp                             @dustinswales @Qingfu-Liu            @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/radiation_tools.*                      @dustinswales @Qingfu-Liu            @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/rrtmgp_lw_rte.*                        @dustinswales @Qingfu-Liu            @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/rrtmgp_sw_rte.*                        @dustinswales @Qingfu-Liu            @grantfirl @ChunxiZhang-NOAA @dustinswales
-
-physics/radlw_main.*                           @mjiacono @Qingfu-Liu                @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/HWRF_mcica_random_numbers.F90          @mjiacono @Qingfu-Liu                @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/HWRF_mersenne_twister.F90              @mjiacono @Qingfu-Liu                @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/radlw_datatb.f                         @mjiacono @Qingfu-Liu                @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/radsw_datatb.*                         @mjiacono @Qingfu-Liu                @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/radsw_main.*                           @mjiacono @Qingfu-Liu                @grantfirl @ChunxiZhang-NOAA @dustinswales
-
-physics/radsw_param.f                          @dustinswales @Qingfu-Liu @mjiacono  @grantfirl @ChunxiZhang-NOAA @dustinswales
-
-physics/rayleigh_damp.*                        @yangfanglin                         @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/GFS_stochastics.*                      @pjpegion @lisa-bengtsson            @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/flake*                                 @YihuaWu-NOAA                        @grantfirl @ChunxiZhang-NOAA @dustinswales
-
-physics/sfc_drv.*                              @HelinWei-NOAA                       @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/sflx.f                                 @HelinWei-NOAA                       @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/surface_perturbation.*                 @HelinWei-NOAA                       @grantfirl @ChunxiZhang-NOAA @dustinswales
-
-physics/*noahmp*                               @barlage @cenlinhe                   @grantfirl @ChunxiZhang-NOAA @dustinswales
-
-physics/set_soilveg.*                          @HelinWei-NOAA @barlage @cenlinhe    @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/mp_fer_hires.*                         @ericaligo-NOAA                      @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/mp_nssl.*                                                                   @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/mp_thompson*                           @gthompsnWRF @RuiyuSun               @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/multi_gases.F90                        @RuiyuSun                            @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/myjpbl_wrapper.*                       @Qingfu-Liu                          @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/myjsfc_wrapper.*                       @Qingfu-Liu                          @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/mynnedmf_wrapper.*                     @joeolson42                          @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/mynnsfc_wrapper.*                      @joeolson42                          @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/namelist_soilveg.*                     @HelinWei-NOAA @barlage @cenlinhe    @grantfirl @ChunxiZhang-NOAA @dustinswales
-
 physics/namelist_soilveg_ruc.*                 @tanyasmirnova                       @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/*noahmp*                               @barlage @cenlinhe                   @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/ozinterp.f90                                                                @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/ozne_def.*                                                                  @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/ozphys*                                @AlexBelochitski-NOAA                @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/physcons.F90                                                                @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/physparam.f                                                                 @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/phys_tend.*                                                                 @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/progsigma_calc.f90                     @lisa-bengtsson                      @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/radcons.f90                            @Qingfu-Liu @dustinswales            @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/radiation_aerosols.f                   @Qingfu-Liu @dustinswales            @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/radiation_astronomy.f                  @Qingfu-Liu @dustinswales            @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/radiation_cloud_overlap.F90            @dustinswales @mjiacono              @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/radiation_clouds.f                     @Qingfu-Liu @dustinswales            @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/radiation_gases.f                      @Qingfu-Liu @dustinswales            @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/radiation_surface.*                    @Qingfu-Liu @dustinswales            @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/radiation_tools.F90                    @Qingfu-Liu @dustinswales            @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/radlw_*                                @mjiacono @Qingfu-Liu                @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/radsw_*                                @mjiacono @Qingfu-Liu                @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/rad_sw_pre.*                           @dustinswales @Qingfu-Liu            @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/rascnv.*                               @SMoorthi-emc                        @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/rayleigh_damp.*                        @yangfanglin                         @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/rrtmg_lw_cloud_optics.F90              @dustinswales                        @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/rrtmg_lw_post.*                        @Qingfu-Liu @dustinswales            @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/rrtmg_lw_pre.*                         @Qingfu-Liu @dustinswales            @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/rrtmgp_aerosol_optics.*                @dustinswales                        @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/rrtmgp_lw_*                            @dustinswales                        @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/rrtmgp_sw_*                            @dustinswales                        @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/rrtmg_sw_cloud_optics.F90              @dustinswales                        @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/rrtmg_sw_post.*                        @Qingfu-Liu @dustinswales            @grantfirl @ChunxiZhang-NOAA @dustinswales 
+physics/rte-rrtmgp                             @RobertPincus @dustinswales          @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/samfdeepcnv.*                          @JongilHan66                         @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/samfshalcnv.*                          @JongilHan66                         @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/samfaerosols.*                         @JongilHan66                         @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/sascnvn.*                              @JongilHan66                         @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/satmedmfvdif.*                         @JongilHan66                         @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/satmedmfvdifq.*                        @JongilHan66                         @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/scm_sfc_flux_spec.*                    @grantfirl                           @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/set_soilveg.*                          @HelinWei-NOAA @barlage @cenlinhe    @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/set_soilveg_ruc.*                      @tanyasmirnova                       @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/module_sf_ruclsm.*                     @tanyasmirnova                       @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/module_soil_pre.*                      @tanyasmirnova                       @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/sfc_drv_ruc.*                          @tanyasmirnova                       @grantfirl @ChunxiZhang-NOAA @dustinswales
-
-physics/date_def.f                             @XuLi-NOAA                           @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/*nst*                                  @XuLi-NOAA                           @grantfirl @ChunxiZhang-NOAA @dustinswales
-
-physics/sfc_ocean.*                            @HelinWei-NOAA                       @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/sfc_cice.*                             @wd20xw                              @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/sfc_diag.*							            @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/sfc_diag_post.*							            @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/sfc_diff.*                             @JongilHan66                         @grantfirl @ChunxiZhang-NOAA @dustinswales
-
-physics/h2ophys.*                              @AlexBelochitski-NOAA                @grantfirl @ChunxiZhang-NOAA @dustinswales
-
+physics/sfc_nst*                               @XuLi-NOAA                           @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/sfc_ocean.*                            @HelinWei-NOAA                       @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/sfc_sice.*                             @wd20xw                              @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/sfc_cice.*                             @wd20xw                              @grantfirl @ChunxiZhang-NOAA @dustinswales
+#physics/sfcsub.F                                                                   @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/sflx.f                                 @HelinWei-NOAA                       @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/sgscloud_radpost.*                                                          @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/sgscloud_radpre.*                                                           @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/shalcnv.*                              @JongilHan66                         @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/shinhongvdif.*                         @ChunxiZhang-NOAA                    @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/shoc.*                                 @AlexBelochitski-NOAA                @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/surface_perturbation.*                 @HelinWei-NOAA                       @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/tridi.f                                @JongilHan66 @ChunxiZhang-NOAA @WeiguoWang-NOAA @AlexBelochitski-NOAA       @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/ugwp_driver_v0.F                       @mdtoyNOAA                           @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/ugwpv1_gsldrag.*                                                            @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/ugwpv1_gsldrag_post.*                                                       @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/unified_ugwp*                          @mdtoyNOAA                           @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/wv_saturation.F                        @AnningCheng-NOAA @andrewgettelman   @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/ysuvdif.*                              @ChunxiZhang-NOAA                    @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/zhaocarr_gscond.*                      @RuiyuSun                            @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/zhaocarr_precpd.*                      @RuiyuSun                            @grantfirl @ChunxiZhang-NOAA @dustinswales
 
 ########################################################################
 

From d0d7d509c5e1c013093f09b2c44b05ab5eb9488b Mon Sep 17 00:00:00 2001
From: Dustin Swales <dustin.swales@noaa.gov>
Date: Mon, 17 Oct 2022 21:47:45 +0000
Subject: [PATCH 022/115] Update CODEOWNERS

---
 CODEOWNERS | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/CODEOWNERS b/CODEOWNERS
index 55373ae36..3cf17b8bb 100644
--- a/CODEOWNERS
+++ b/CODEOWNERS
@@ -19,7 +19,7 @@ physics/bl_mynn_common.f90                     @joeolson42
 physics/calpreciptype.f90                                                           @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/cires_orowam2017.f                                                          @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/cires_tauamf_data.F90                                                       @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/cires_ugwp*                            @mdtoyNOAA @ValeryYudin-NOAA         @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/cires_ugwp*                            @ValeryYudin-NOAA @mdtoyNOAA         @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/cldmacro.F                             @AnningCheng-NOAA @andrewgettelman   @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/cldwat2m_micro.F                       @AnningCheng-NOAA @andrewgettelman   @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/cnvc90.*                                                                    @grantfirl @ChunxiZhang-NOAA @dustinswales
@@ -38,7 +38,7 @@ physics/get_phi_fv3.*
 physics/get_prs_fv3.*                                                               @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/gfdl_cloud_microphys.*                 @RuiyuSun                            @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/GFDL_parse_tracers.F90                                                      @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/gfdl_sfc_layer.*                                                            @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/gfdl_sfc_layer.*                       @ZhanZhang-NOAA                      @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/GFS_cloud_diagnostics.*                @dustinswales                        @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/GFS_DCNV_generic_post.*                                                     @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/GFS_DCNV_generic_pre.*                                                      @grantfirl @ChunxiZhang-NOAA @dustinswales
@@ -92,7 +92,7 @@ physics/gwdc.*                                 @Songyou184
 physics/gwdps.*                                @Songyou184                          @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/h2o_def.*                                                                   @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/h2ointerp.f90                                                               @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/h2ophys.*                              @AlexBelochitski-NOAA                @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/h2ophys.*                              @SMoorthi-emc                        @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/hedmf.*                                @JongilHan66 @WeiguoWang-NOAA        @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/iccn_def.F                                                                  @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/iccninterp.F90                                                              @grantfirl @ChunxiZhang-NOAA @dustinswales
@@ -103,7 +103,7 @@ physics/machine.*
 physics/maximum_hourly_diagnostics.*                                                @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/mersenne_twister.f                                                          @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/mfpbl.f                                @JongilHan66                         @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/mfpblt.f                                                                    @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/mfpblt.f                               @JongilHan66                         @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/mfpbltq.f                              @JongilHan66                         @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/mfscu.f                                @JongilHan66                         @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/mfscuq.f                               @JongilHan66                         @grantfirl @ChunxiZhang-NOAA @dustinswales
@@ -119,11 +119,11 @@ physics/module_mp_radar.*                      @gthompsnWRF @RuiyuSun
 physics/module_mp_thompson*                    @gthompsnWRF @RuiyuSun               @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/module_nst*                            @XuLi-NOAA                           @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/module_sf_exchcoef.f90                                                      @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/module_SF_JSFC.F90                                                          @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/module_SF_JSFC.F90                     @Qingfu-Liu                          @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/module_sf_mynn.F90                     @joeolson42                          @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/module_sf_ruclsm.*                     @tanyasmirnova                       @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/module_soil_pre.*                      @tanyasmirnova                       @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/moninshoc.*                            @AlexBelochitski-NOAA                @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/moninshoc.*                            @SMoorthi-emc                        @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/mp_fer_hires.*                         @ericaligo-NOAA                      @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/mp_nssl.*                                                                   @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/mp_thompson*                           @gthompsnWRF @RuiyuSun               @grantfirl @ChunxiZhang-NOAA @dustinswales
@@ -137,13 +137,12 @@ physics/namelist_soilveg_ruc.*                 @tanyasmirnova
 physics/*noahmp*                               @barlage @cenlinhe                   @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/ozinterp.f90                                                                @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/ozne_def.*                                                                  @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/ozphys*                                @AlexBelochitski-NOAA                @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/ozphys*                                @SMoorthi-emc                        @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/physcons.F90                                                                @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/physparam.f                                                                 @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/phys_tend.*                                                                 @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/progsigma_calc.f90                     @lisa-bengtsson                      @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/radcons.f90                            @Qingfu-Liu @dustinswales            @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/radiation_aerosols.f                   @Qingfu-Liu @dustinswales            @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/radiation_aerosols.f                   @Qingfu-Liu @dustinswales @AnningCheng-NOAA           @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/radiation_astronomy.f                  @Qingfu-Liu @dustinswales            @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/radiation_cloud_overlap.F90            @dustinswales @mjiacono              @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/radiation_clouds.f                     @Qingfu-Liu @dustinswales            @grantfirl @ChunxiZhang-NOAA @dustinswales
@@ -186,11 +185,11 @@ physics/sgscloud_radpost.*
 physics/sgscloud_radpre.*                                                           @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/shalcnv.*                              @JongilHan66                         @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/shinhongvdif.*                         @ChunxiZhang-NOAA                    @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/shoc.*                                 @AlexBelochitski-NOAA                @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/shoc.*                                 @SMoorthi-emc                        @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/surface_perturbation.*                 @HelinWei-NOAA                       @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/tridi.f                                @JongilHan66 @ChunxiZhang-NOAA @WeiguoWang-NOAA @AlexBelochitski-NOAA       @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/tridi.f                                @JongilHan66 @ChunxiZhang-NOAA @WeiguoWang-NOAA       @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/ugwp_driver_v0.F                       @mdtoyNOAA                           @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/ugwpv1_gsldrag.*                                                            @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/ugwpv1_gsldrag.*                       @mdtoyNOAA                           @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/ugwpv1_gsldrag_post.*                                                       @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/unified_ugwp*                          @mdtoyNOAA                           @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/wv_saturation.F                        @AnningCheng-NOAA @andrewgettelman   @grantfirl @ChunxiZhang-NOAA @dustinswales

From 469ef08b05e7dd74fd4d1adc557d9d18241a63ad Mon Sep 17 00:00:00 2001
From: dustinswales <dswales@ucar.edu>
Date: Thu, 27 Oct 2022 13:10:24 -0600
Subject: [PATCH 023/115] Update CODEOWNERS

---
 CODEOWNERS | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/CODEOWNERS b/CODEOWNERS
index 3cf17b8bb..15821a791 100644
--- a/CODEOWNERS
+++ b/CODEOWNERS
@@ -163,8 +163,8 @@ physics/rrtmgp_sw_*                            @dustinswales
 physics/rrtmg_sw_cloud_optics.F90              @dustinswales                        @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/rrtmg_sw_post.*                        @Qingfu-Liu @dustinswales            @grantfirl @ChunxiZhang-NOAA @dustinswales 
 physics/rte-rrtmgp                             @RobertPincus @dustinswales          @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/samfdeepcnv.*                          @JongilHan66                         @grantfirl @ChunxiZhang-NOAA @dustinswales
-physics/samfshalcnv.*                          @JongilHan66                         @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/samfdeepcnv.*                          @JongilHan66 @lisa-bengtsson         @grantfirl @ChunxiZhang-NOAA @dustinswales
+physics/samfshalcnv.*                          @JongilHan66 @lisa-bengtsson         @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/samfaerosols.*                         @JongilHan66                         @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/sascnvn.*                              @JongilHan66                         @grantfirl @ChunxiZhang-NOAA @dustinswales
 physics/satmedmfvdif.*                         @JongilHan66                         @grantfirl @ChunxiZhang-NOAA @dustinswales

From 6d74eafffee0b1a5e3763a1dd1fb01b17d896078 Mon Sep 17 00:00:00 2001
From: dustinswales <dswales@ucar.edu>
Date: Thu, 27 Oct 2022 14:36:24 -0600
Subject: [PATCH 024/115] Changes to metadata to accommodate standard_name
 rules.

---
 physics/GFS_phys_time_vary.fv3.meta |  6 ++---
 physics/GFS_rad_time_vary.fv3.meta  |  4 +--
 physics/GFS_rad_time_vary.scm.meta  |  4 +--
 physics/GFS_rrtmg_pre.meta          | 12 ++++-----
 physics/GFS_rrtmg_setup.meta        | 38 ++++++++++++++---------------
 physics/GFS_rrtmgp_setup.meta       | 24 +++++++++---------
 physics/radsw_main.meta             |  6 ++---
 7 files changed, 47 insertions(+), 47 deletions(-)

diff --git a/physics/GFS_phys_time_vary.fv3.meta b/physics/GFS_phys_time_vary.fv3.meta
index 36ac38ab9..ce8c6c54b 100644
--- a/physics/GFS_phys_time_vary.fv3.meta
+++ b/physics/GFS_phys_time_vary.fv3.meta
@@ -45,9 +45,9 @@
   type = logical
   intent = in
 [iaermdl]
-  standard_name = flag_for_aerosol_radiation_scheme
-  long_name = flag for aerosol scheme to use in	radiation
-  units = flag
+  standard_name = control_for_aerosol_radiation_scheme
+  long_name = control of aerosol scheme in radiation
+  units = 1
   dimensions = ()
   type = integer
   intent = in
diff --git a/physics/GFS_rad_time_vary.fv3.meta b/physics/GFS_rad_time_vary.fv3.meta
index 387625796..19eb41dc2 100644
--- a/physics/GFS_rad_time_vary.fv3.meta
+++ b/physics/GFS_rad_time_vary.fv3.meta
@@ -137,14 +137,14 @@
 [ipsd0]
   standard_name = initial_seed_for_mcica
   long_name = initial permutaion seed for mcica radiation
-  units = none
+  units = 1
   dimensions =  ()
   type = integer
   intent = in
 [ipsdlim]
   standard_name = limit_for_initial_seed_for_mcica
   long_name = limit for initial permutaion seed for mcica radiation
-  units = none
+  units = 1
   dimensions =  ()
   type = integer
   intent = in
diff --git a/physics/GFS_rad_time_vary.scm.meta b/physics/GFS_rad_time_vary.scm.meta
index 387625796..19eb41dc2 100644
--- a/physics/GFS_rad_time_vary.scm.meta
+++ b/physics/GFS_rad_time_vary.scm.meta
@@ -137,14 +137,14 @@
 [ipsd0]
   standard_name = initial_seed_for_mcica
   long_name = initial permutaion seed for mcica radiation
-  units = none
+  units = 1
   dimensions =  ()
   type = integer
   intent = in
 [ipsdlim]
   standard_name = limit_for_initial_seed_for_mcica
   long_name = limit for initial permutaion seed for mcica radiation
-  units = none
+  units = 1
   dimensions =  ()
   type = integer
   intent = in
diff --git a/physics/GFS_rrtmg_pre.meta b/physics/GFS_rrtmg_pre.meta
index 34aade056..53f05225b 100644
--- a/physics/GFS_rrtmg_pre.meta
+++ b/physics/GFS_rrtmg_pre.meta
@@ -220,16 +220,16 @@
   type = integer
   intent = in
 [iaermdl]
-  standard_name = flag_for_aerosol_radiation_scheme
-  long_name = flag for aerosol scheme to use in radiation
-  units = flag
+  standard_name = control_for_aerosol_radiation_scheme
+  long_name = control of aerosol scheme in radiation
+  units = 1
   dimensions = ()
   type = integer
   intent = in
 [iaerflg]
-  standard_name = flag_for_aerosol_effects_in_radiation
-  long_name = flag for aerosol effects to include in radiation
-  units = flag
+  standard_name = control_for_aerosol_effects_in_radiation
+  long_name = control of aerosol effects in radiation
+  units = 1
   dimensions = ()
   type = integer
   intent = in
diff --git a/physics/GFS_rrtmg_setup.meta b/physics/GFS_rrtmg_setup.meta
index d6f0b0e7a..5821de33f 100644
--- a/physics/GFS_rrtmg_setup.meta
+++ b/physics/GFS_rrtmg_setup.meta
@@ -167,9 +167,9 @@
   type = integer
   intent = in
 [iswmode]
-  standard_name = flag_for_sw_scattering_choice
-  long_name = flag for rrtmg shortwave scattering choice
-  units = flag
+  standard_name = control_for_sw_scattering_choice
+  long_name = control of rrtmg shortwave scattering choice
+  units = 1
   dimensions = ()
   type = integer
   intent = in
@@ -261,9 +261,9 @@
   kind = len=26
   intent = in
 [rad_hr_units]
-  standard_name = flag_for_radiation_heating_rate_units
-  long_name = flag to control heating rate units
-  units = count
+  standard_name = control_for_radiation_heating_rate_units
+  long_name = control of heating rate units
+  units = 1
   dimensions =  ()
   type = integer
   intent = in
@@ -322,9 +322,9 @@
   kind = kind_phys
   intent = in
 [lalw1bd]
-  standard_name = flag_for_longwave_aerosol_band_properties
-  long_name = flag for band or multiband longwave aerosol properties
-  units = flag
+  standard_name = do_longwave_aerosol_band_properties
+  long_name = control of band or multiband longwave aerosol properties
+  units = 1
   dimensions = ()
   type = logical
   intent = in
@@ -345,21 +345,21 @@
 [ipsd0]
   standard_name = initial_seed_for_mcica
   long_name = initial permutaion seed for mcica radiation
-  units = none
+  units = 1
   dimensions =  ()
   type = integer
   intent = inout
 [iaermdl]
-  standard_name = flag_for_aerosol_radiation_scheme
-  long_name = flag for aerosol scheme to use in radiation
-  units = flag
+  standard_name = control_for_aerosol_radiation_scheme
+  long_name = control of aerosol scheme in radiation
+  units = 1
   dimensions = ()
   type = integer
   intent = out
 [iaerflg]
-  standard_name = flag_for_aerosol_effects_in_radiation
-  long_name = flag for aerosol effects to include in radiation
-  units = flag
+  standard_name = control_for_aerosol_effects_in_radiation
+  long_name = control of aerosol effects in radiation
+  units = 1
   dimensions = ()
   type = integer
   intent = out
@@ -428,9 +428,9 @@
   type = integer
   intent = in
 [iaermdl]
-  standard_name = flag_for_aerosol_radiation_scheme
-  long_name = flag for aerosol scheme to use in radiation
-  units = flag
+  standard_name = control_for_aerosol_radiation_scheme
+  long_name = control of aerosol scheme in radiation
+  units = 1
   dimensions = ()
   type = integer
   intent = in
diff --git a/physics/GFS_rrtmgp_setup.meta b/physics/GFS_rrtmgp_setup.meta
index d47aadb93..ad4a8a765 100644
--- a/physics/GFS_rrtmgp_setup.meta
+++ b/physics/GFS_rrtmgp_setup.meta
@@ -175,9 +175,9 @@
   type = integer
   intent = in
 [lalw1bd]
-  standard_name = flag_for_longwave_aerosol_band_properties
-  long_name = flag for band or multiband longwave aerosol properties
-  units = flag
+  standard_name = do_longwave_aerosol_band_properties
+  long_name = control of band or multiband longwave aerosol properties
+  units = 1
   dimensions = ()
   type = logical
   intent = in
@@ -267,16 +267,16 @@
   type = integer
   intent = inout
 [iaermdl]
-  standard_name = flag_for_aerosol_radiation_scheme
-  long_name = flag for aerosol scheme to use in radiation
-  units = flag
+  standard_name = control_for_aerosol_radiation_scheme
+  long_name = control of aerosol scheme in radiation
+  units = 1
   dimensions = ()
   type = integer
   intent = out
 [iaerflg]
-  standard_name = flag_for_aerosol_effects_in_radiation
-  long_name = flag for aerosol effects to include in radiation
-  units = flag
+  standard_name = control_for_aerosol_effects_in_radiation
+  long_name = control of aerosol effects in radiation
+  units = 1
   dimensions = ()
   type = integer
   intent = out
@@ -390,9 +390,9 @@
   type = integer
   intent = in
 [iaermdl]
-  standard_name = flag_for_aerosol_radiation_scheme
-  long_name = flag for aerosol scheme to use in radiation
-  units = flag
+  standard_name = control_for_aerosol_radiation_scheme
+  long_name = control of aerosol scheme in radiation
+  units = 1
   dimensions = ()
   type = integer
   intent = in
diff --git a/physics/radsw_main.meta b/physics/radsw_main.meta
index eff5cdca3..1edb6fcac 100644
--- a/physics/radsw_main.meta
+++ b/physics/radsw_main.meta
@@ -365,9 +365,9 @@
   type = integer
   intent = in
 [iswmode]
-  standard_name = flag_for_sw_scattering_choice
-  long_name = flag for rrtmg shortwave scattering choice
-  units = flag
+  standard_name = control_for_sw_scattering_choice
+  long_name = control of rrtmg shortwave scattering choice
+  units = 1
   dimensions = ()
   type = integer
   intent = in

From 4900b309c9a15c9544c64ae42b343458f203031e Mon Sep 17 00:00:00 2001
From: dustinswales <dswales@ucar.edu>
Date: Wed, 2 Nov 2022 10:02:34 -0600
Subject: [PATCH 025/115] Omission from previous commit.

---
 physics/GFS_rrtmg_setup.meta       |  6 +++---
 physics/rrtmgp_aerosol_optics.meta | 12 ++++++------
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/physics/GFS_rrtmg_setup.meta b/physics/GFS_rrtmg_setup.meta
index 5821de33f..93319fe75 100644
--- a/physics/GFS_rrtmg_setup.meta
+++ b/physics/GFS_rrtmg_setup.meta
@@ -435,9 +435,9 @@
   type = integer
   intent = in
 [iaerflg]
-  standard_name = flag_for_aerosol_effects_in_radiation
-  long_name = flag for aerosol effects to include in radiation
-  units = flag
+  standard_name = control_for_aerosol_effects_in_radiation
+  long_name = control of aerosol effects in radiation
+  units = 1
   dimensions = ()
   type = integer
   intent = in
diff --git a/physics/rrtmgp_aerosol_optics.meta b/physics/rrtmgp_aerosol_optics.meta
index 5f5946afa..74c0f4f70 100644
--- a/physics/rrtmgp_aerosol_optics.meta
+++ b/physics/rrtmgp_aerosol_optics.meta
@@ -175,16 +175,16 @@
   kind = kind_phys
   intent = in
 [iaermdl]
-  standard_name = flag_for_aerosol_radiation_scheme
-  long_name = flag for aerosol scheme to use in radiation
-  units = flag
+  standard_name = control_for_aerosol_radiation_scheme
+  long_name = control of aerosol scheme in radiation
+  units = 1
   dimensions = ()
   type = integer
   intent = in
 [iaerflg]
-  standard_name = flag_for_aerosol_effects_in_radiation
-  long_name = flag for aerosol effects to include in radiation
-  units = flag
+  standard_name = control_for_aerosol_effects_in_radiation
+  long_name = control of aerosol effects in radiation
+  units = 1
   dimensions = ()
   type = integer
   intent = in

From 786cd2083f7e77fa3c5597ad1fabd63cd833ba56 Mon Sep 17 00:00:00 2001
From: dustinswales <dswales@ucar.edu>
Date: Tue, 22 Nov 2022 11:11:09 -0700
Subject: [PATCH 026/115] Omission from previous commit

---
 physics/GFS_rrtmgp_setup.meta | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/physics/GFS_rrtmgp_setup.meta b/physics/GFS_rrtmgp_setup.meta
index ad4a8a765..2bba14506 100644
--- a/physics/GFS_rrtmgp_setup.meta
+++ b/physics/GFS_rrtmgp_setup.meta
@@ -262,7 +262,7 @@
 [ipsd0]
   standard_name = initial_seed_for_mcica
   long_name = initial permutaion seed for mcica radiation
-  units = none
+  units = 1
   dimensions =  ()
   type = integer
   intent = inout

From fb6fdb9914cb3e9c2cbed4b91c32d7de3e868ba8 Mon Sep 17 00:00:00 2001
From: dustinswales <dswales@ucar.edu>
Date: Tue, 22 Nov 2022 15:43:49 -0700
Subject: [PATCH 027/115] Move declaration to init.

---
 physics/GFS_rrtmg_setup.F90  | 10 +++++-----
 physics/GFS_rrtmg_setup.meta | 16 ++++++++++++++++
 physics/radiation_clouds.f   | 12 ++++++------
 3 files changed, 27 insertions(+), 11 deletions(-)

diff --git a/physics/GFS_rrtmg_setup.F90 b/physics/GFS_rrtmg_setup.F90
index addd847a2..384d5252d 100644
--- a/physics/GFS_rrtmg_setup.F90
+++ b/physics/GFS_rrtmg_setup.F90
@@ -42,9 +42,9 @@ subroutine GFS_rrtmg_setup_init ( si, levr, ictm, isol, solar_file, ico2, &
         iovr_max, iovr_dcorr, iovr_exp, iovr_exprand, icliq_sw, lcrick,      &
         lcnorm, imp_physics, lnoprec, idate, iflip, do_RRTMGP, me, lalw1bd,  &
         iaermdl, iaerflg, aeros_file, con_pi, con_t0c, con_c, con_boltz,     &
-        con_plnk, con_solr_2008, con_solr_2002, co2usr_file, co2cyc_file,    &
-        rad_hr_units, inc_minor_gas, icliq_lw, isubcsw, isubclw, iswmode,    &
-        ipsd0, ltp, lextop, errmsg, errflg)
+        con_plnk, con_solr_2008, con_solr_2002, con_g, con_rd, co2usr_file,  &
+        co2cyc_file, rad_hr_units, inc_minor_gas, icliq_lw, isubcsw, isubclw,&
+        iswmode, ipsd0, ltp, lextop, errmsg, errflg)
 ! =================   subprogram documentation block   ================ !
 !                                                                       !
 ! subprogram:   GFS_rrtmg_setup_init - a subprogram to initialize radiation !
@@ -162,7 +162,7 @@ subroutine GFS_rrtmg_setup_init ( si, levr, ictm, isol, solar_file, ico2, &
       character(len=26),intent(in)  :: aeros_file, solar_file, co2usr_file,&
            co2cyc_file
       real(kind_phys),  intent(in)  :: con_pi, con_t0c, con_c, con_boltz,  &
-           con_plnk, con_solr_2008, con_solr_2002
+           con_plnk, con_solr_2008, con_solr_2002, con_g, con_rd
       integer,          intent(inout) :: ipsd0
       character(len=*), intent(out) :: errmsg
       integer,          intent(out) :: errflg
@@ -220,7 +220,7 @@ subroutine GFS_rrtmg_setup_init ( si, levr, ictm, isol, solar_file, ico2, &
            con_pi, con_t0c, con_c, con_boltz, con_plnk, errflg, errmsg)
       call gas_init ( me, co2usr_file, co2cyc_file, ico2, ictm, ntoz,   &
            con_pi, errflg, errmsg)
-      call cld_init ( si, levr, imp_physics, me, errflg, errmsg)
+      call cld_init ( si, levr, imp_physics, me, con_g, con_rd, errflg, errmsg)
       call rlwinit ( me, rad_hr_units, inc_minor_gas, icliq_lw, isubcsw, &
            iovr, iovr_rand, iovr_maxrand, iovr_max, iovr_dcorr,         &
            iovr_exp, iovr_exprand, errflg, errmsg )
diff --git a/physics/GFS_rrtmg_setup.meta b/physics/GFS_rrtmg_setup.meta
index 93319fe75..adf6d8750 100644
--- a/physics/GFS_rrtmg_setup.meta
+++ b/physics/GFS_rrtmg_setup.meta
@@ -321,6 +321,22 @@
   type = real
   kind = kind_phys
   intent = in
+[con_rd]
+  standard_name = gas_constant_of_dry_air
+  long_name = ideal gas constant for dry air
+  units = J kg-1 K-1
+  dimensions = ()
+  type = real
+  kind = kind_phys
+  intent = in
+[con_g]
+  standard_name = gravitational_acceleration
+  long_name = gravitational acceleration
+  units = m s-2
+  dimensions = ()
+  type = real
+  kind = kind_phys
+  intent = in
 [lalw1bd]
   standard_name = do_longwave_aerosol_band_properties
   long_name = control of band or multiband longwave aerosol properties
diff --git a/physics/radiation_clouds.f b/physics/radiation_clouds.f
index 0b7fba648..bb851c607 100644
--- a/physics/radiation_clouds.f
+++ b/physics/radiation_clouds.f
@@ -252,7 +252,7 @@ module module_radiation_clouds
 !!\param me              print control flag
 !>\section cld_init General Algorithm
       subroutine cld_init                                               &
-     &     ( si, NLAY, imp_physics, me, errflg, errmsg )
+     &     ( si, NLAY, imp_physics, me, con_g, con_rd, errflg, errmsg )
 !  ===================================================================  !
 !                                                                       !
 ! abstract: cld_init is an initialization program for cloud-radiation   !
@@ -281,7 +281,7 @@ subroutine cld_init                                               &
 !  ---  inputs:
       integer, intent(in) :: NLAY, me, imp_physics
 
-      real (kind=kind_phys), intent(in) :: si(:)
+      real (kind=kind_phys), intent(in) :: si(:), con_g, con_rd
 
 !  ---  outputs:
       integer,          intent(out) :: errflg
@@ -294,6 +294,10 @@ subroutine cld_init                                               &
       errmsg = ''
       errflg = 0
 
+      ! Initialze module parameters
+      gfac = 1.0e5/con_g
+      gord = con_g/con_rd
+
       if (me == 0) then
          print *, VTAGCLD       !print out version tag
          print *,' - Using Prognostic Cloud Method'
@@ -588,10 +592,6 @@ subroutine radiation_clouds_prop                                  &
           print*, 'in radiation_clouds_prop=', imp_physics, uni_cld,     &
      &           ncndl, lgfdlmprad, do_mynnedmf, imfdeepcnv, kdt
       end if
-      
-      !
-      gfac = 1.0e5/con_g 
-      gord = con_g/con_rd
 
       do k = 1, NLAY
         do i = 1, IX

From 7a5b0818c4eb38082c32eadaa7f8baf479f24adf Mon Sep 17 00:00:00 2001
From: Grant Firl <grant.firl@noaa.gov>
Date: Tue, 22 Nov 2022 09:40:39 -0500
Subject: [PATCH 028/115] Merge pull request #9 from
 dustinswales/add_cnvcldcnd_mp2rad_cplng

Couple convective cloud to radiation
---
 physics/GFS_rrtmgp_cloud_mp.F90  | 49 +++++++++++++++++++++++---------
 physics/GFS_rrtmgp_cloud_mp.meta | 15 ++++++++++
 physics/radiation_clouds.f       | 16 ++++++-----
 3 files changed, 59 insertions(+), 21 deletions(-)

diff --git a/physics/GFS_rrtmgp_cloud_mp.F90 b/physics/GFS_rrtmgp_cloud_mp.F90
index 2acf8b4da..c76f40da1 100644
--- a/physics/GFS_rrtmgp_cloud_mp.F90
+++ b/physics/GFS_rrtmgp_cloud_mp.F90
@@ -50,11 +50,12 @@ subroutine GFS_rrtmgp_cloud_mp_run(nCol, nLev, nTracers, ncnd, i_cldliq, i_cldic
        relhum, lsmask, xlon, xlat, dx, tv_lay, effrin_cldliq, effrin_cldice,             &
        effrin_cldrain, effrin_cldsnow, tracer, cnv_mixratio, cld_cnv_frac, qci_conv,     &
        deltaZ, deltaZc, deltaP, qc_mynn, qi_mynn, cld_pbl_frac, con_g, con_rd, con_eps,  &
-       con_ttp, doGP_cldoptics_PADE, doGP_cldoptics_LUT, cld_frac, cld_lwp, cld_reliq,   &
+       con_ttp, doGP_cldoptics_PADE, doGP_cldoptics_LUT, doGP_smearclds,                 &
+       cld_frac, cld_lwp, cld_reliq,                                                     &
        cld_iwp, cld_reice, cld_swp, cld_resnow, cld_rwp, cld_rerain, precip_frac,        &
        cld_cnv_lwp, cld_cnv_reliq, cld_cnv_iwp, cld_cnv_reice, cld_pbl_lwp,              &
        cld_pbl_reliq, cld_pbl_iwp, cld_pbl_reice, lwp_ex, iwp_ex, lwp_fc, iwp_fc,        &
-       errmsg, errflg)
+       cldfra2d, errmsg, errflg)
     implicit none
 
     ! Inputs   
@@ -92,7 +93,8 @@ subroutine GFS_rrtmgp_cloud_mp_run(nCol, nLev, nTracers, ncnd, i_cldliq, i_cldic
          uni_cld,                   & ! Flag for unified cloud scheme
          lmfdeep2,                  & ! Flag for mass flux deep convection 
          doGP_cldoptics_LUT,        & ! Flag to do GP cloud-optics (LUTs)
-         doGP_cldoptics_PADE          !                            (PADE approximation)
+         doGP_cldoptics_PADE,       & !                            (PADE approximation)
+         doGP_smearclds               ! If true, add sgs clouds to gridmean clouds
     real(kind_phys), intent(in) :: &
          con_g,                     & ! Physical constant: gravitational constant
          con_rd,                    & ! Physical constant: gas-constant for dry air
@@ -135,6 +137,8 @@ subroutine GFS_rrtmgp_cloud_mp_run(nCol, nLev, nTracers, ncnd, i_cldliq, i_cldic
          iwp_ex,                    & ! Total ice    water path from explicit microphysics
          lwp_fc,                    & ! Total liquid water path from cloud fraction scheme
          iwp_fc                       ! Total ice    water path from cloud fraction scheme
+    real(kind_phys), dimension(:), intent(out) :: &
+         cldfra2d                     ! Instantaneous 2D (max-in-column) cloud fraction
     real(kind_phys), dimension(:,:),intent(inout) :: &
          cld_frac,                  & ! Cloud-fraction for   stratiform   clouds
          cld_lwp,                   & ! Water path for       stratiform   liquid cloud-particles
@@ -267,8 +271,9 @@ subroutine GFS_rrtmgp_cloud_mp_run(nCol, nLev, nTracers, ncnd, i_cldliq, i_cldic
        endif
        call cloud_mp_thompson(nCol, nLev, nTracers, ncnd, i_cldliq, i_cldice, i_cldrain,&
             i_cldsnow, i_cldgrpl, p_lev, p_lay, tv_lay, t_lay, tracer, qs_lay, q_lay,   &
-            relhum, con_g, con_rd, con_eps, alpha0, lwp_ex, iwp_ex, lwp_fc, iwp_fc,     &
-            cld_frac, cld_lwp, cld_iwp, cld_swp, cld_rwp, cond_cfrac_onRH = .true.)
+            relhum, con_ttp, con_g, con_rd, con_eps, alpha0, cnv_mixratio, lwp_ex,      &
+            iwp_ex, lwp_fc, iwp_fc, cld_frac, cld_lwp, cld_iwp, cld_swp, cld_rwp,       &
+            cond_cfrac_onRH = .true., doGP_smearclds = doGP_smearclds)
     endif
 
     ! Bound effective radii for RRTMGP, LUT's for cloud-optics go from
@@ -293,6 +298,14 @@ subroutine GFS_rrtmgp_cloud_mp_run(nCol, nLev, nTracers, ncnd, i_cldliq, i_cldic
        endif
     endif
 
+    ! Instantaneous 2D (max-in-column) cloud fraction
+    do iCol = 1, nCol
+       cldfra2d(iCol) = 0._kind_phys
+       do iLay = 1, nLev-1
+          cldfra2d(iCol) = max(cldfra2d(iCol), cld_frac(iCol,iLay))
+       enddo
+    enddo
+
     precip_frac(1:nCol,1:nLev) = cld_frac(1:nCol,1:nLev)
 
   end subroutine GFS_rrtmgp_cloud_mp_run
@@ -659,13 +672,14 @@ end subroutine cloud_mp_uni
 !! \section cloud_mp_thompson_gen General Algorithm
   subroutine cloud_mp_thompson(nCol, nLev, nTracers, ncnd, i_cldliq, i_cldice, i_cldrain,&
        i_cldsnow, i_cldgrpl, p_lev, p_lay, tv_lay, t_lay, tracer, qs_lay, q_lay, relhum, &
-       con_g, con_rd, con_eps, alpha0, lwp_ex, iwp_ex, lwp_fc, iwp_fc, cld_frac, cld_lwp,&
-       cld_iwp, cld_swp, cld_rwp, cond_cfrac_onRH)
+       con_ttp, con_g, con_rd, con_eps, alpha0, cnv_mixratio, lwp_ex, iwp_ex, lwp_fc,    &
+       iwp_fc, cld_frac, cld_lwp, cld_iwp, cld_swp, cld_rwp, cond_cfrac_onRH, doGP_smearclds)
     implicit none
 
     ! Inputs
     logical, intent(in), optional :: &
-         cond_cfrac_onRH
+         cond_cfrac_onRH,   & ! If true, cloud-fracion set to unity when rh>99%
+         doGP_smearclds       ! If true, add sgs clouds to gridmean clouds
     integer, intent(in)    :: &
          nCol,              & ! Number of horizontal grid points
          nLev,              & ! Number of vertical layers
@@ -677,6 +691,7 @@ subroutine cloud_mp_thompson(nCol, nLev, nTracers, ncnd, i_cldliq, i_cldice, i_c
          i_cldsnow,         & !                             cloud snow amount.
          i_cldgrpl            !                             cloud groupel amount.
     real(kind_phys), intent(in) :: &
+         con_ttp,           & ! Triple point temperature of water (K)  
          con_g,             & ! Physical constant: gravitational constant
          con_rd,            & ! Physical constant: gas-constant for dry air
          con_eps,           & ! Physical constant: gas constant air / gas constant H2O
@@ -687,7 +702,8 @@ subroutine cloud_mp_thompson(nCol, nLev, nTracers, ncnd, i_cldliq, i_cldice, i_c
          qs_lay,            & ! Saturation vapor pressure (Pa)
          q_lay,             & ! water-vapor mixing ratio (kg/kg)
          relhum,            & ! Relative humidity
-         p_lay                ! Pressure at model-layers (Pa)
+         p_lay,             & ! Pressure at model-layers (Pa)
+         cnv_mixratio         ! Convective cloud mixing-ratio (kg/kg) 
     real(kind_phys), dimension(:,:), intent(in) :: &
          p_lev                ! Pressure at model-level interfaces (Pa)
     real(kind_phys), dimension(:,:,:),intent(in) :: &
@@ -707,16 +723,15 @@ subroutine cloud_mp_thompson(nCol, nLev, nTracers, ncnd, i_cldliq, i_cldice, i_c
          cld_rwp              ! Cloud rain water path
 
     ! Local variables
-    real(kind_phys) :: tem1, pfac, cld_mr, deltaP
+    real(kind_phys) :: tem1, pfac, cld_mr, deltaP, tem2
     real(kind_phys), dimension(nCol, nLev, min(4,ncnd)) :: cld_condensate
     integer :: iCol,iLay,l
 
     ! Cloud condensate
     cld_condensate(1:nCol,1:nLev,1) = tracer(1:nCol,1:nLev,i_cldliq)     ! -liquid water
     cld_condensate(1:nCol,1:nLev,2) = tracer(1:nCol,1:nLev,i_cldice)     ! -ice water
-    cld_condensate(1:nCol,1:nLev,3) = tracer(1:nCol,1:nLev,i_cldrain)    ! -rain water
-    cld_condensate(1:nCol,1:nLev,4) = tracer(1:nCol,1:nLev,i_cldsnow) + &! -snow + grapuel
-                                      tracer(1:nCol,1:nLev,i_cldgrpl)
+    cld_condensate(1:nCol,1:nLev,3) = tracer(1:nCol,1:nLev,i_cldrain)    ! -rain hydrometeors
+    cld_condensate(1:nCol,1:nLev,4) = tracer(1:nCol,1:nLev,i_cldsnow)    ! -snow hydrometeors
 
     cld_lwp(:,:) = 0.0
     cld_iwp(:,:) = 0.0
@@ -726,6 +741,12 @@ subroutine cloud_mp_thompson(nCol, nLev, nTracers, ncnd, i_cldliq, i_cldice, i_c
     tem1 = 1.0e5/con_g
     do iLay = 1, nLev-1
        do iCol = 1, nCol
+          ! Add convective cloud to gridmean cloud?
+          if (doGP_smearclds) then
+             tem2 = min(1.0, max(0.0, (con_ttp-t_lay(iCol,iLay))*0.05))
+             cld_condensate(iCol,iLay,1) = cld_condensate(iCol,iLay,1) + cnv_mixratio(iCol,iLay)*(1._kind_phys - tem2)
+             cld_condensate(iCol,iLay,2) = cld_condensate(iCol,iLay,2) + cnv_mixratio(iCol,iLay)*tem2
+          endif
           ! Compute liquid/ice condensate path from mixing ratios (kg/kg)->(g/m2)
           deltaP              = abs(p_lev(iCol,iLay+1)-p_lev(iCol,iLay))*0.01
           cld_lwp(iCol,iLay)  = max(0., cld_condensate(iCol,iLay,1) * tem1 * deltaP)
@@ -738,7 +759,7 @@ subroutine cloud_mp_thompson(nCol, nLev, nTracers, ncnd, i_cldliq, i_cldice, i_c
              cld_frac(iCol,iLay) = 1._kind_phys
           else
              cld_mr = cld_condensate(iCol,iLay,1) + cld_condensate(iCol,iLay,2) +  &
-                  cld_condensate(iCol,iLay,4)
+                  cld_condensate(iCol,iLay,3) + cld_condensate(iCol,iLay,4)
              cld_frac(iCol,iLay) = cld_frac_XuRandall(p_lay(iCol,iLay),            &
                   qs_lay(iCol,iLay), relhum(iCol,iLay), cld_mr, alpha0)
           endif
diff --git a/physics/GFS_rrtmgp_cloud_mp.meta b/physics/GFS_rrtmgp_cloud_mp.meta
index 4f48d53ef..1eb870da8 100644
--- a/physics/GFS_rrtmgp_cloud_mp.meta
+++ b/physics/GFS_rrtmgp_cloud_mp.meta
@@ -462,6 +462,13 @@
   dimensions = ()
   type = logical
   intent = in
+[doGP_smearclds]
+  standard_name = flag_for_implicit_sgs_cloud_in_RRTMGP
+  long_name = logical flag to impicit SGS cloud in RRTMGP
+  units = flag
+  dimensions = ()
+  type = logical
+  intent = in
 [cld_frac]
   standard_name = total_cloud_fraction
   long_name = layer total cloud fraction
@@ -646,6 +653,14 @@
   type = real
   kind = kind_phys
   intent = inout
+[cldfra2d]
+  standard_name = max_in_column_cloud_fraction
+  long_name = instantaneous 2D (max-in-column) cloud fraction
+  units = frac
+  dimensions = (horizontal_loop_extent)
+  type = real
+  kind = kind_phys
+  intent = out
 [errmsg]
   standard_name = ccpp_error_message
   long_name = error message for error handling in CCPP
diff --git a/physics/radiation_clouds.f b/physics/radiation_clouds.f
index 47b9b79fa..bf255ce00 100644
--- a/physics/radiation_clouds.f
+++ b/physics/radiation_clouds.f
@@ -2160,7 +2160,7 @@ subroutine progcld_thompson_wsm6                                  &
       integer :: i, k, id, nf
 
 !  ---  constant values
-      real (kind=kind_phys), parameter :: xrc3 = 200.
+      real (kind=kind_phys), parameter :: xrc3 = 100.
 
 !
 !===> ... begin here
@@ -2177,7 +2177,7 @@ subroutine progcld_thompson_wsm6                                  &
           rei   (i,k) = re_ice(i,k)
           rer   (i,k) = rrain_def            ! default rain radius to 1000 micron
           res   (i,k) = re_snow(i,K)
-!         tem2d (i,k) = min( 1.0, max( 0.0, (con_ttp-tlyr(i,k))*0.05 ) )
+          tem2d (i,k) = min( 1.0, max( 0.0, (con_ttp-tlyr(i,k))*0.05 ) )
           clwf(i,k)   = 0.0
         enddo
       enddo
@@ -2208,12 +2208,14 @@ subroutine progcld_thompson_wsm6                                  &
           enddo
         enddo
 
-!> - Compute cloud liquid/ice condensate path in \f$ g/m^2 \f$ .
-
+!> - Compute total-cloud liquid/ice condensate path in \f$ g/m^2 \f$.
+!>   The total condensate includes convective condensate.
         do k = 1, NLAY-1
           do i = 1, IX
-            cwp(i,k) = max(0.0, clw(i,k,ntcw) * gfac * delp(i,k))
-            cip(i,k) = max(0.0, clw(i,k,ntiw) * gfac * delp(i,k))
+            cwp(i,k) = max(0.0, (clw(i,k,ntcw)+cnvw(i,k)*
+     &                  (1.-tem2d(i,k))) * gfac * delp(i,k))
+            cip(i,k) = max(0.0, (clw(i,k,ntiw) + cnvw(i,k)*
+     &                  tem2d(i,k)) *gfac * delp(i,k))
             crp(i,k) = max(0.0, clw(i,k,ntrw) * gfac * delp(i,k))
             csp(i,k) = max(0.0, clw(i,k,ntsw) * gfac * delp(i,k))
           enddo
@@ -3902,7 +3904,7 @@ subroutine cloud_fraction_mass_flx_2                              &
         clwmin = 0.0
         do k = 1, NLAY-1
         do i = 1, IX
-          clwt = 1.0e-10 * (plyr(i,k)*0.001)
+          clwt = 1.0e-6 * (plyr(i,k)*0.001)
 
           if (clwf(i,k) > clwt) then
             if(rhly(i,k) > 0.99) then

From d083f87f42f0adafbd37add81b79440e3e166ed7 Mon Sep 17 00:00:00 2001
From: dustinswales <dswales@ucar.edu>
Date: Mon, 19 Dec 2022 17:12:20 -0700
Subject: [PATCH 029/115] Bugfox in argument list

---
 physics/radiation_clouds.f | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/physics/radiation_clouds.f b/physics/radiation_clouds.f
index 07ef01a1a..81a845fd2 100644
--- a/physics/radiation_clouds.f
+++ b/physics/radiation_clouds.f
@@ -723,7 +723,7 @@ subroutine radiation_clouds_prop                                  &
               call progcld_thompson_wsm6 (plyr,plvl,tlyr,qlyr,qstl,     & !  --- inputs
      &                   rhly,tracer1,xlat,xlon,slmsk,dz,delp,          &
      &                   ntrac-1, ntcw-1,ntiw-1,ntrw-1,                 &
-     &                   ntsw-1,ntgl-1,                                 &
+     &                   ntsw-1,ntgl-1,con_ttp,                         &
      &                   IX, NLAY, NLP1, uni_cld, lmfshal, lmfdeep2,    &
      &                   cldcov(:,1:NLAY), cnvw, effrl_inout,           &
      &                   effri_inout, effrs_inout,                      &
@@ -796,7 +796,7 @@ subroutine radiation_clouds_prop                                  &
               call progcld_thompson_wsm6 (plyr,plvl,tlyr,qlyr,qstl,     & !  --- inputs
      &                   rhly,tracer1,xlat,xlon,slmsk,dz,delp,          &
      &                   ntrac-1, ntcw-1,ntiw-1,ntrw-1,                 &
-     &                   ntsw-1,ntgl-1,                                 &
+     &                   ntsw-1,ntgl-1,con_ttp,                         &
      &                   IX, NLAY, NLP1, uni_cld, lmfshal, lmfdeep2,    &
      &                   cldcov(:,1:NLAY), cnvw, effrl, effri, effrs,   &
      &                   lwp_ex, iwp_ex, lwp_fc, iwp_fc,                &
@@ -1958,7 +1958,7 @@ end subroutine progcld_fer_hires
       subroutine progcld_thompson_wsm6                                  &
      &     ( plyr,plvl,tlyr,qlyr,qstl,rhly,clw,                         &    !  ---  inputs:
      &       xlat,xlon,slmsk,dz,delp,                                   &
-     &       ntrac,ntcw,ntiw,ntrw,ntsw,ntgl,                            &
+     &       ntrac,ntcw,ntiw,ntrw,ntsw,ntgl,con_ttp,                    &
      &       IX, NLAY, NLP1,                                            &
      &       uni_cld, lmfshal, lmfdeep2, cldcov, cnvw,                  &
      &       re_cloud,re_ice,re_snow,                                   &
@@ -2058,7 +2058,7 @@ subroutine progcld_thompson_wsm6                                  &
 
       real (kind=kind_phys), dimension(:),   intent(in) :: xlat, xlon,  &
      &       slmsk
-
+      real (kind=kind_phys), intent(in) :: con_ttp
 !  --- inputs/outputs
 
       real (kind=kind_phys), dimension(:,:), intent(inout) ::            &

From 2ffa0f547335fe127be678d72509b8bbeed63e21 Mon Sep 17 00:00:00 2001
From: ChunxiZhang-NOAA <49283036+ChunxiZhang-NOAA@users.noreply.github.com>
Date: Tue, 7 Feb 2023 09:49:16 -0500
Subject: [PATCH 030/115] Merge pull request #34 from
 dustinswales/rrtmgp_refactor

RRTMGP refactoring
---
 .gitmodules                                   |   2 +-
 CMakeLists.txt                                |  12 -
 physics/GFS_rrtmgp_cloud_mp.F90               |  48 +-
 physics/GFS_rrtmgp_cloud_mp.meta              |   6 +-
 physics/GFS_rrtmgp_lw_post.F90                | 188 -----
 physics/GFS_rrtmgp_lw_post.meta               | 253 -------
 physics/GFS_rrtmgp_post.F90                   | 394 ++++++++++
 ...tmgp_sw_post.meta => GFS_rrtmgp_post.meta} | 191 ++++-
 physics/GFS_rrtmgp_pre.F90                    | 118 +--
 physics/GFS_rrtmgp_pre.meta                   | 136 ++--
 physics/GFS_rrtmgp_setup.F90                  |   6 +-
 physics/GFS_rrtmgp_setup.meta                 |   2 +-
 physics/GFS_rrtmgp_sw_post.F90                | 286 --------
 physics/GFS_rrtmgp_sw_pre.F90                 |  95 ---
 physics/GFS_rrtmgp_sw_pre.meta                | 124 ----
 physics/rrtmgp_aerosol_optics.F90             |  66 +-
 physics/rrtmgp_aerosol_optics.meta            |  80 +-
 physics/rrtmgp_lw_cloud_optics.F90            | 218 +-----
 physics/rrtmgp_lw_cloud_optics.meta           | 412 -----------
 physics/rrtmgp_lw_cloud_sampling.F90          | 170 -----
 physics/rrtmgp_lw_cloud_sampling.meta         | 226 ------
 physics/rrtmgp_lw_gas_optics.F90              | 121 +---
 physics/rrtmgp_lw_gas_optics.meta             | 203 ------
 physics/rrtmgp_lw_main.F90                    | 611 ++++++++++++++++
 physics/rrtmgp_lw_main.meta                   | 641 ++++++++++++++++
 physics/rrtmgp_lw_pre.F90                     |  61 --
 physics/rrtmgp_lw_pre.meta                    |  47 --
 physics/rrtmgp_lw_rte.F90                     | 208 ------
 physics/rrtmgp_lw_rte.meta                    | 208 ------
 physics/rrtmgp_sw_cloud_optics.F90            | 244 +------
 physics/rrtmgp_sw_cloud_optics.meta           | 393 ----------
 physics/rrtmgp_sw_cloud_sampling.F90          | 174 -----
 physics/rrtmgp_sw_cloud_sampling.meta         | 240 ------
 physics/rrtmgp_sw_gas_optics.F90              | 137 +---
 physics/rrtmgp_sw_gas_optics.meta             | 201 ------
 physics/rrtmgp_sw_main.F90                    | 683 ++++++++++++++++++
 physics/rrtmgp_sw_main.meta                   | 664 +++++++++++++++++
 physics/rrtmgp_sw_rte.F90                     | 219 ------
 physics/rrtmgp_sw_rte.meta                    | 240 ------
 physics/rte-rrtmgp                            |   2 +-
 40 files changed, 3470 insertions(+), 4860 deletions(-)
 delete mode 100644 physics/GFS_rrtmgp_lw_post.F90
 delete mode 100644 physics/GFS_rrtmgp_lw_post.meta
 create mode 100644 physics/GFS_rrtmgp_post.F90
 rename physics/{GFS_rrtmgp_sw_post.meta => GFS_rrtmgp_post.meta} (71%)
 delete mode 100644 physics/GFS_rrtmgp_sw_post.F90
 delete mode 100644 physics/GFS_rrtmgp_sw_pre.F90
 delete mode 100644 physics/GFS_rrtmgp_sw_pre.meta
 delete mode 100644 physics/rrtmgp_lw_cloud_optics.meta
 delete mode 100644 physics/rrtmgp_lw_cloud_sampling.F90
 delete mode 100644 physics/rrtmgp_lw_cloud_sampling.meta
 delete mode 100644 physics/rrtmgp_lw_gas_optics.meta
 create mode 100644 physics/rrtmgp_lw_main.F90
 create mode 100644 physics/rrtmgp_lw_main.meta
 delete mode 100644 physics/rrtmgp_lw_pre.F90
 delete mode 100644 physics/rrtmgp_lw_pre.meta
 delete mode 100644 physics/rrtmgp_lw_rte.F90
 delete mode 100644 physics/rrtmgp_lw_rte.meta
 delete mode 100644 physics/rrtmgp_sw_cloud_optics.meta
 delete mode 100644 physics/rrtmgp_sw_cloud_sampling.F90
 delete mode 100644 physics/rrtmgp_sw_cloud_sampling.meta
 delete mode 100644 physics/rrtmgp_sw_gas_optics.meta
 create mode 100644 physics/rrtmgp_sw_main.F90
 create mode 100644 physics/rrtmgp_sw_main.meta
 delete mode 100644 physics/rrtmgp_sw_rte.F90
 delete mode 100644 physics/rrtmgp_sw_rte.meta

diff --git a/.gitmodules b/.gitmodules
index 75e5ea836..8758980ec 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,4 +1,4 @@
 [submodule "physics/rte-rrtmgp"]
   path = physics/rte-rrtmgp
   url = https://github.com/earth-system-radiation/rte-rrtmgp
-  branch = dtc/ccpp
+  branch = main
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d14778b06..482081614 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -81,14 +81,10 @@ get_filename_component(LOCAL_CURRENT_SOURCE_DIR ${FULL_PATH_TO_CMAKELISTS} DIREC
 # List of files that need to be compiled without OpenMP
 set(SCHEMES_OPENMP_OFF ${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/rrtmgp/mo_gas_optics.F90
                        ${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/rrtmgp/mo_rrtmgp_constants.F90
-                       ${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/rrtmgp/mo_rrtmgp_util_reorder.F90
                        ${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/rrtmgp/mo_gas_concentrations.F90
                        ${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/rrtmgp/mo_rrtmgp_util_string.F90
                        ${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/rrtmgp/kernels/mo_gas_optics_kernels.F90
-                       ${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/rrtmgp/kernels/mo_rrtmgp_util_reorder_kernels.F90
                        ${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/rrtmgp/mo_gas_optics_rrtmgp.F90
-                       ${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/tests/mo_testing_io.F90
-                       ${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/tests/clear_sky_regression.F90
                        ${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/extensions/mo_rrtmgp_clr_all_sky.F90
                        ${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/extensions/mo_fluxes_byband.F90
                        ${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/extensions/solar_variability/mo_solar_variability.F90
@@ -97,14 +93,6 @@ set(SCHEMES_OPENMP_OFF ${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/rrtmgp/mo_
                        ${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/extensions/mo_compute_bc.F90
                        ${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/extensions/cloud_optics/mo_cloud_sampling.F90
                        ${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/extensions/cloud_optics/mo_cloud_optics.F90
-                       ${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/examples/mo_load_coefficients.F90
-                       ${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/examples/rfmip-clear-sky/rrtmgp_rfmip_sw.F90
-                       ${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/examples/rfmip-clear-sky/mo_rfmip_io.F90
-                       ${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/examples/rfmip-clear-sky/rrtmgp_rfmip_lw.F90
-                       ${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/examples/mo_simple_netcdf.F90
-                       ${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/examples/all-sky/rrtmgp_allsky.F90
-                       ${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/examples/all-sky/mo_load_cloud_coefficients.F90
-                       ${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/examples/all-sky/mo_garand_atmos_io.F90
                        ${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/rte/mo_rte_config.F90
                        ${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/rte/mo_source_functions.F90
                        ${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/rte/mo_rte_sw.F90
diff --git a/physics/GFS_rrtmgp_cloud_mp.F90 b/physics/GFS_rrtmgp_cloud_mp.F90
index 9ca340763..32104b7f8 100644
--- a/physics/GFS_rrtmgp_cloud_mp.F90
+++ b/physics/GFS_rrtmgp_cloud_mp.F90
@@ -27,7 +27,7 @@ module GFS_rrtmgp_cloud_mp
        reice_min  = 10.0,       & ! Minimum ice size allowed by GFDL MP scheme
        reice_max  = 150.0         ! Maximum ice size allowed by GFDL MP scheme  
   
-  public GFS_rrtmgp_cloud_mp_run
+  public GFS_rrtmgp_cloud_mp_init, GFS_rrtmgp_cloud_mp_run, GFS_rrtmgp_cloud_mp_finalize
 
 contains  
 
@@ -45,7 +45,7 @@ module GFS_rrtmgp_cloud_mp
   subroutine GFS_rrtmgp_cloud_mp_run(nCol, nLev, nTracers, ncnd, i_cldliq, i_cldice,     &
        i_cldrain, i_cldsnow, i_cldgrpl, i_cldtot, i_cldliq_nc, i_cldice_nc, i_twa, kdt,  &
        imfdeepcnv, imfdeepcnv_gf, imfdeepcnv_samf, doSWrad, doLWrad, effr_in, lmfshal,   &
-       ltaerosol,mraerosol, icloud, imp_physics, imp_physics_thompson, imp_physics_gfdl,           &
+       ltaerosol,mraerosol, icloud, imp_physics, imp_physics_thompson, imp_physics_gfdl, &
        lgfdlmprad, do_mynnedmf, uni_cld, lmfdeep2, p_lev, p_lay, t_lay, qs_lay, q_lay,   &
        relhum, lsmask, xlon, xlat, dx, tv_lay, effrin_cldliq, effrin_cldice,             &
        effrin_cldrain, effrin_cldsnow, tracer, cnv_mixratio, cld_cnv_frac, qci_conv,     &
@@ -462,6 +462,7 @@ subroutine cloud_mp_MYNN(nCol, nLev, lsmask, t_lay, p_lev, p_lay, qs_lay, relhum
     enddo
   end subroutine cloud_mp_MYNN
 
+
 !> \ingroup GFS_rrtmgp_cloud_mp 
 !! Compute cloud radiative properties for SAMF convective cloud scheme.
 !!
@@ -484,47 +485,48 @@ subroutine cloud_mp_SAMF(nCol, nLev, t_lay, p_lev, p_lay, qs_lay, relhum,
          nCol,          & ! Number of horizontal grid points
          nLev             ! Number of vertical layers
     real(kind_phys), intent(in) :: &
-         con_g,         & ! Physical constant: gravitational constant 
-         con_ttp,       & ! Triple point temperature of water (K)
+         con_g,         & ! Physical constant: gravity         (m s-2)
+         con_ttp,       & ! Triple point temperature of water  (K)
          alpha0           !
     real(kind_phys), dimension(:,:),intent(in) :: &
-         t_lay,         & ! Temperature at layer centers (K)
-         p_lev,         & ! Pressure at layer interfaces (Pa)
-         p_lay,         & !
-         qs_lay,        & !
-         relhum,        & !
-         cnv_mixratio     ! Convective cloud mixing-ratio (kg/kg)
+         t_lay,         & ! Temperature at layer-centers       (K)
+         p_lev,         & ! Pressure at layer-interfaces       (Pa)
+         p_lay,         & ! Presure at layer-centers           (Pa)
+         qs_lay,        & ! Specific-humidity at layer-centers (kg/kg)
+         relhum,        & ! Relative-humidity                  (1)
+         cnv_mixratio     ! Convective cloud mixing-ratio      (kg/kg)
     ! Outputs
     real(kind_phys), dimension(:,:),intent(inout) :: &
          cld_cnv_lwp,   & ! Convective cloud liquid water path
          cld_cnv_reliq, & ! Convective cloud liquid effective radius
          cld_cnv_iwp,   & ! Convective cloud ice water path
          cld_cnv_reice, & ! Convective cloud ice effecive radius
-         cld_cnv_frac     ! Convective cloud-fraction (1)
+         cld_cnv_frac     ! Convective cloud-fraction
     ! Local
     integer :: iCol, iLay
-    real(kind_phys) :: tem1, deltaP, clwc
+    real(kind_phys) :: tem0, tem1, deltaP, clwc
 
+    tem0 = 1.0e5/con_g
     do iLay = 1, nLev
        do iCol = 1, nCol
           if (cnv_mixratio(iCol,iLay) > 0._kind_phys) then
              tem1   = min(1.0, max(0.0, (con_ttp-t_lay(iCol,iLay))*0.05))
              deltaP = abs(p_lev(iCol,iLay+1)-p_lev(iCol,iLay))*0.01
-             clwc   = max(0.0, cnv_mixratio(iCol,iLay)) * con_g * deltaP
-             cld_cnv_iwp(iCol,iLay) = clwc * tem1
-             cld_cnv_lwp(iCol,iLay) = clwc - cld_cnv_iwp(iCol,iLay)
+             clwc   = max(0.0, cnv_mixratio(iCol,iLay)) * tem0 * deltaP
+             cld_cnv_iwp(iCol,iLay)   = clwc * tem1
+             cld_cnv_lwp(iCol,iLay)   = clwc - cld_cnv_iwp(iCol,iLay)
              cld_cnv_reliq(iCol,iLay) = reliq_def
              cld_cnv_reice(iCol,iLay) = reice_def
 
              ! Xu-Randall (1996) cloud-fraction.
-             cld_cnv_frac(iCol,iLay) = cld_frac_XuRandall(p_lay(iCol,iLay),            &
+             cld_cnv_frac(iCol,iLay) = cld_frac_XuRandall(p_lay(iCol,iLay),              &
                qs_lay(iCol,iLay), relhum(iCol,iLay), cnv_mixratio(iCol,iLay), alpha0)
           endif
        enddo
     enddo
 
   end subroutine cloud_mp_SAMF
- 
+
 !> \ingroup GFS_rrtmgp_cloud_mp 
 !! This routine computes the cloud radiative properties for a "unified cloud".
 !! - "unified cloud" implies that the cloud-fraction is PROVIDED.
@@ -656,7 +658,6 @@ subroutine cloud_mp_uni(nCol, nLev, nTracers, ncnd, i_cldliq, i_cldice, i_cldrai
     enddo       ! nLev
 
   end subroutine cloud_mp_uni
-
 !> \ingroup GFS_rrtmgp_cloud_mp 
 !! This routine computes the cloud radiative properties for the Thompson cloud micro-
 !! physics scheme.
@@ -834,11 +835,11 @@ function cld_frac_XuRandall(p_lay, qs_lay, relhum, cld_mr, alpha)
     return
   end function
 
-!> \ingroup GFS_rrtmgp_cloud_mp 
-!! This routine is a wrapper to update the Thompson effective particle sizes used by the
-!! RRTMGP radiation scheme.
-!!
-!! \section cmp_reff_Thompson_gen General Algorithm
+  ! ######################################################################################
+  ! This routine is a wrapper to update the Thompson effective particle sizes used by the
+  ! RRTMGP radiation scheme.
+  !
+  ! ######################################################################################
   subroutine cmp_reff_Thompson(nLev, nCol, i_cldliq, i_cldice, i_cldsnow, i_cldice_nc,   &
        i_cldliq_nc, i_twa, q_lay, p_lay, t_lay, tracer, con_eps, con_rd, ltaerosol,      &
        mraerosol, lsmask, effrin_cldliq, effrin_cldice, effrin_cldsnow)
@@ -922,4 +923,5 @@ subroutine cmp_reff_Thompson(nLev, nCol, i_cldliq, i_cldice, i_cldsnow, i_cldice
     enddo
 
   end subroutine cmp_reff_Thompson
+
 end module GFS_rrtmgp_cloud_mp
diff --git a/physics/GFS_rrtmgp_cloud_mp.meta b/physics/GFS_rrtmgp_cloud_mp.meta
index 1eb870da8..b782e73b4 100644
--- a/physics/GFS_rrtmgp_cloud_mp.meta
+++ b/physics/GFS_rrtmgp_cloud_mp.meta
@@ -345,9 +345,9 @@
   kind = kind_phys  
   intent = inout
 [tracer]
-  standard_name = chemical_tracers
-  long_name = chemical tracers
-  units = g g-1
+  standard_name = tracer_concentration
+  long_name = model layer mean tracer concentration
+  units = kg kg-1
   dimensions = (horizontal_loop_extent,vertical_layer_dimension,number_of_tracers)
   type = real
   kind = kind_phys
diff --git a/physics/GFS_rrtmgp_lw_post.F90 b/physics/GFS_rrtmgp_lw_post.F90
deleted file mode 100644
index afd56dcf1..000000000
--- a/physics/GFS_rrtmgp_lw_post.F90
+++ /dev/null
@@ -1,188 +0,0 @@
-!> \file GFS_rrtmgp_lw_post.F90
-!!
-!> \defgroup GFS_rrtmgp_lw_post GFS_rrtmgp_lw_post.F90
-!!
-!! \brief RRTMGP Longwave post-processing routine.
-!!
-module GFS_rrtmgp_lw_post
-  use machine,                   only: kind_phys
-  use module_radlw_parameters,   only: topflw_type, sfcflw_type
-  use mo_heating_rates,          only: compute_heating_rate
-  use radiation_tools,           only: check_error_msg
-  implicit none
-
-  public GFS_rrtmgp_lw_post_run
-
-contains
-
-!>\defgroup gfs_rrtmgp_lw_post_mod GFS RRTMGP-LW Post Module
-!> \section arg_table_GFS_rrtmgp_lw_post_run
-!! \htmlinclude GFS_rrtmgp_lw_post.html
-!!
-!! \ingroup GFS_rrtmgp_lw_post
-!!
-!! \brief The all-sky longwave radiation tendency is computed, the clear-sky tendency is computed 
-!! if requested.
-!!
-!! RRTMGP surface and TOA fluxes are copied to fields that persist between radiation/physics
-!! calls.
-!! 
-!! (optional) Save additional diagnostics.
-!!
-!! \section GFS_rrtmgp_lw_post_run
- ! ######################################################################################## 
-  subroutine GFS_rrtmgp_lw_post_run (nCol, nLev, lslwr, do_lw_clrsky_hr, save_diag, fhlwr, &
-       p_lev, t_lay, tsfa, fluxlwUP_allsky, fluxlwDOWN_allsky, fluxlwUP_clrsky, iSFC, iTOA,&
-       fluxlwDOWN_clrsky, raddt, cldsa, mtopa, mbota, cld_frac, cldtaulw, fluxr, sfcdlw,   &
-       sfculw, sfcflw, tsflw, htrlw, htrlwu, topflw, htrlwc, errmsg, errflg)
-
-    ! Inputs
-    integer, intent(in) ::  &
-         nCol,              & ! Horizontal loop extent 
-         nLev,              & ! Number of vertical layers
-         iSFC,              & ! Vertical index for surface level
-         iTOA                 ! Vertical index for TOA level
-    logical, intent(in) :: & 
-         lslwr,             & ! Logical flags for lw radiation calls
-         do_lw_clrsky_hr,   & ! Output clear-sky SW heating-rate?
-         save_diag            ! Output radiation diagnostics?
-    real(kind_phys), intent(in) :: &
-         fhlwr                ! Frequency for SW radiation
-    real(kind_phys), dimension(nCol), intent(in) ::  &
-         tsfa                 ! Lowest model layer air temperature for radiation (K)
-    real(kind_phys), dimension(nCol, nLev), intent(in) :: &
-         t_lay                ! Temperature @ model layer centers (K)
-    real(kind_phys), dimension(nCol, nLev+1), intent(in) :: &
-         p_lev,             & ! Pressure @ model layer-interfaces    (Pa)
-         fluxlwUP_allsky,   & ! RRTMGP longwave all-sky flux (W/m2)
-         fluxlwDOWN_allsky, & ! RRTMGP longwave all-sky flux (W/m2)
-         fluxlwUP_clrsky,   & ! RRTMGP longwave clear-sky flux (W/m2)
-         fluxlwDOWN_clrsky    ! RRTMGP longwave clear-sky flux (W/m2)
-    real(kind_phys), intent(in) :: &
-         raddt                ! Radiation time step
-    real(kind_phys), dimension(nCol,5), intent(in) :: &
-         cldsa                ! Fraction of clouds for low, middle, high, total and BL
-    integer,         dimension(nCol,3), intent(in) ::&
-         mbota,             & ! vertical indices for low, middle and high cloud tops 
-         mtopa                ! vertical indices for low, middle and high cloud bases
-    real(kind_phys), dimension(nCol,nLev), intent(in) :: &
-         cld_frac,          & ! Total cloud fraction in each layer
-         cldtaulw             ! approx 10.mu band layer cloud optical depth
-
-    real(kind=kind_phys), dimension(:,:), intent(inout) :: fluxr
-
-    ! Outputs (mandatory)
-    real(kind_phys), dimension(nCol), intent(inout) :: &
-         sfcdlw,            & ! Total sky sfc downward lw flux (W/m2)
-         sfculw,            & ! Total sky sfc upward lw flux (W/m2)
-         tsflw                ! surface air temp during lw calculation (K)
-    type(sfcflw_type), dimension(nCol), intent(inout) :: &
-         sfcflw               ! LW radiation fluxes at sfc
-    real(kind_phys), dimension(nCol,nLev), intent(inout) :: &
-         htrlw,             & ! LW all-sky heating rate
-         htrlwu               ! Heating-rate updated in-between radiation calls.
-    type(topflw_type), dimension(nCol), intent(out) :: &
-         topflw               ! lw_fluxes_top_atmosphere
-    character(len=*), intent(out) :: &
-         errmsg
-    integer, intent(out) :: &
-         errflg
-
-    ! Outputs (optional)
-    real(kind_phys),dimension(nCol, nLev),intent(inout),optional  :: &
-         htrlwc               ! Longwave clear-sky heating-rate (K/sec)
-
-    ! Local variables
-    integer :: i, j, k, itop, ibtc
-    real(kind_phys) :: tem0d, tem1, tem2
-    real(kind_phys),dimension(nCol,nLev) :: hlwc
-
-    ! Initialize CCPP error handling variables
-    errmsg = ''
-    errflg = 0
-
-    if (.not. lslwr) return
-    ! #######################################################################################
-    ! Compute LW heating-rates.
-    ! #######################################################################################
-    ! Clear-sky heating-rate (optional)
-    if (do_lw_clrsky_hr) then
-        call check_error_msg('GFS_rrtmgp_post',compute_heating_rate(  &
-            fluxlwUP_clrsky,   & ! IN  - RRTMGP upward longwave clear-sky flux profiles (W/m2)
-            fluxlwDOWN_clrsky, & ! IN  - RRTMGP downward longwave clear-sky flux profiles (W/m2)
-            p_lev,             & ! IN  - Pressure @ layer-interfaces (Pa)
-            htrlwc))               ! OUT - Longwave clear-sky heating rate (K/sec)
-    endif
-
-    ! All-sky heating-rate (mandatory)
-    call check_error_msg('GFS_rrtmgp_post',compute_heating_rate(     &
-        fluxlwUP_allsky,      & ! IN  - RRTMGP upward longwave all-sky flux profiles (W/m2)
-        fluxlwDOWN_allsky,    & ! IN  - RRTMGP downward longwave all-sky flux profiles (W/m2)
-        p_lev,                & ! IN  - Pressure @ layer-interfaces (Pa)
-        htrlw))                 ! OUT - Longwave all-sky heating rate (K/sec)
-
-    ! #######################################################################################
-    ! Save LW outputs.
-    ! (Copy fluxes from RRTMGP types into model radiation types.)
-    ! #######################################################################################
-    ! TOA fluxes
-    topflw(:)%upfxc = fluxlwUP_allsky(:,iTOA)
-    topflw(:)%upfx0 = fluxlwUP_clrsky(:,iTOA)
-
-    ! Surface fluxes
-    sfcflw(:)%upfxc = fluxlwUP_allsky(:,iSFC)
-    sfcflw(:)%upfx0 = fluxlwUP_clrsky(:,iSFC)
-    sfcflw(:)%dnfxc = fluxlwDOWN_allsky(:,iSFC)
-    sfcflw(:)%dnfx0 = fluxlwDOWN_clrsky(:,iSFC)
-
-    ! Save surface air temp for diurnal adjustment at model t-steps
-    tsflw (:) = tsfa(:)
-
-    ! Radiation fluxes for other physics processes
-    sfcdlw(:) = sfcflw(:)%dnfxc
-    sfculw(:) = sfcflw(:)%upfxc
-
-    ! Heating-rate at radiation timestep, used for adjustment between radiation calls.
-    htrlwu = htrlw
-
-    ! #######################################################################################
-    ! Save LW diagnostics
-    ! - For time averaged output quantities (including total-sky and clear-sky SW and LW
-    !   fluxes at TOA and surface; conventional 3-domain cloud amount, cloud top and base
-    !   pressure, and cloud top temperature; aerosols AOD, etc.), store computed results in
-    !   corresponding slots of array fluxr with appropriate time weights.
-    ! - Collect the fluxr data for wrtsfc
-    ! #######################################################################################
-    if (save_diag) then
-          do i=1,nCol
-             ! LW all-sky fluxes
-             fluxr(i,1 ) = fluxr(i,1 ) + fhlwr * fluxlwUP_allsky(  i,iTOA)   ! total sky top lw up
-             fluxr(i,19) = fluxr(i,19) + fhlwr * fluxlwDOWN_allsky(i,iSFC)   ! total sky sfc lw dn
-             fluxr(i,20) = fluxr(i,20) + fhlwr * fluxlwUP_allsky(  i,iSFC)   ! total sky sfc lw up
-             ! LW clear-sky fluxes
-             fluxr(i,28) = fluxr(i,28) + fhlwr * fluxlwUP_clrsky(  i,iTOA)   ! clear sky top lw up
-             fluxr(i,30) = fluxr(i,30) + fhlwr * fluxlwDOWN_clrsky(i,iSFC)   ! clear sky sfc lw dn
-             fluxr(i,33) = fluxr(i,33) + fhlwr * fluxlwUP_clrsky(  i,iSFC)   ! clear sky sfc lw up
-          enddo
-
-          ! Save cld frac,toplyr,botlyr and top temp, note that the order of h,m,l cloud is reversed for 
-          ! the fluxr output. save interface pressure (pa) of top/bot
-          do j = 1, 3
-             do i = 1, nCol
-                tem0d = raddt * cldsa(i,j)
-                itop  = mtopa(i,j)
-                ibtc  = mbota(i,j)
-                
-                ! Add optical depth and emissivity output
-                tem2 = 0.
-                do k=ibtc,itop
-                   tem2 = tem2 + cldtaulw(i,k)      ! approx 10. mu channel
-                enddo
-                fluxr(i,46-j) = fluxr(i,46-j) + tem0d * (1.0-exp(-tem2))
-             enddo
-          enddo
-    endif
-
-  end subroutine GFS_rrtmgp_lw_post_run
-
-end module GFS_rrtmgp_lw_post
diff --git a/physics/GFS_rrtmgp_lw_post.meta b/physics/GFS_rrtmgp_lw_post.meta
deleted file mode 100644
index d458b25f3..000000000
--- a/physics/GFS_rrtmgp_lw_post.meta
+++ /dev/null
@@ -1,253 +0,0 @@
-[ccpp-table-properties]
-  name = GFS_rrtmgp_lw_post
-  type = scheme
-  dependencies = iounitdef.f,machine.F,radiation_aerosols.f,radlw_param.f,rte-rrtmgp/extensions/mo_fluxes_byband.F90,radiation_tools.F90,rte-rrtmgp/rte/mo_fluxes.F90,rte-rrtmgp/rte/kernels/mo_fluxes_broadband_kernels.F90,rte-rrtmgp/extensions/mo_heating_rates.F90
-
-########################################################################
-[ccpp-arg-table]
-  name = GFS_rrtmgp_lw_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
-[iSFC]
-  standard_name = vertical_index_for_surface_in_RRTMGP
-  long_name = index for surface layer in RRTMGP
-  units = flag
-  dimensions = ()
-  type = integer
-  intent = in
-[iTOA]
-  standard_name = vertical_index_for_TOA_in_RRTMGP
-  long_name = index for TOA layer in RRTMGP
-  units = flag
-  dimensions = ()
-  type = integer
-  intent = in
-[lslwr]
-  standard_name = flag_for_calling_longwave_radiation
-  long_name = logical flags for lw radiation calls
-  units = flag
-  dimensions = ()
-  type = logical
-  intent = in
-[do_lw_clrsky_hr]
-  standard_name = flag_for_output_of_tendency_of_air_temperature_due_to_longwave_heating_on_radiation_timestep_assuming_clear_sky
-  long_name = flag to output lw heating rate
-  units = flag
-  dimensions = ()
-  type = logical
-  intent = in
-[save_diag]
-  standard_name = flag_for_diagnostics
-  long_name = logical flag for storing diagnostics
-  units = flag
-  dimensions = ()
-  type = logical
-  intent = in
-[fhlwr]
-  standard_name = period_of_longwave_radiation_calls
-  long_name = frequency for longwave radiation
-  units = s
-  dimensions = ()
-  type = real
-  kind = kind_phys
-  intent = in
-[tsfa]
-  standard_name = surface_air_temperature_for_radiation
-  long_name = lowest model layer air temperature for radiation
-  units = K
-  dimensions = (horizontal_loop_extent)
-  type = real
-  kind = kind_phys
-  intent = in
-[t_lay]
-  standard_name = air_temperature_at_layer_for_RRTMGP
-  long_name = air temperature at vertical layer for radiation calculation
-  units = K
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[p_lev]
-  standard_name = air_pressure_at_interface_for_RRTMGP
-  long_name = air pressure level
-  units = Pa
-  dimensions = (horizontal_loop_extent,vertical_interface_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[fluxlwUP_allsky]
-  standard_name = RRTMGP_lw_flux_profile_upward_allsky
-  long_name = RRTMGP upward longwave all-sky flux profile
-  units = W m-2
-  dimensions = (horizontal_loop_extent,vertical_interface_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[fluxlwDOWN_allsky]
-  standard_name = RRTMGP_lw_flux_profile_downward_allsky
-  long_name = RRTMGP downward longwave all-sky flux profile
-  units = W m-2
-  dimensions = (horizontal_loop_extent,vertical_interface_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[fluxlwUP_clrsky]
-  standard_name = RRTMGP_lw_flux_profile_upward_clrsky
-  long_name = RRTMGP upward longwave clr-sky flux profile
-  units = W m-2
-  dimensions = (horizontal_loop_extent,vertical_interface_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[fluxlwDOWN_clrsky]
-  standard_name = RRTMGP_lw_flux_profile_downward_clrsky
-  long_name = RRTMGP downward longwave clr-sky flux profile
-  units = W m-2
-  dimensions = (horizontal_loop_extent,vertical_interface_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[raddt]
-  standard_name = time_step_for_radiation
-  long_name = radiation time step
-  units = s
-  dimensions = ()
-  type = real
-  kind = kind_phys
-  intent = in
-[cldsa]
-  standard_name = cloud_area_fraction_for_radiation
-  long_name = fraction of clouds for low, middle, high, total and BL
-  units = frac
-  dimensions = (horizontal_loop_extent,5)
-  type = real
-  kind = kind_phys
-  intent = in
-[mtopa]
-  standard_name = model_layer_number_at_cloud_top
-  long_name = vertical indices for low, middle and high cloud tops
-  units = index
-  dimensions = (horizontal_loop_extent,3)
-  type = integer
-  intent = in
-[mbota]
-  standard_name = model_layer_number_at_cloud_base
-  long_name = vertical indices for low, middle and high cloud bases
-  units = index
-  dimensions = (horizontal_loop_extent,3)
-  type = integer
-  intent = in
-[cld_frac]
-  standard_name = total_cloud_fraction
-  long_name = layer total cloud fraction
-  units = frac
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[cldtaulw]
-  standard_name = cloud_optical_depth_layers_at_10mu_band
-  long_name = approx 10mu band layer cloud optical depth
-  units = none
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[fluxr]
-  standard_name = cumulative_radiation_diagnostic
-  long_name = time-accumulated 2D radiation-related diagnostic fields
-  units = mixed
-  dimensions = (horizontal_loop_extent,number_of_diagnostics_variables_for_radiation)
-  type = real
-  kind = kind_phys
-  intent = inout
-[sfcdlw]
-  standard_name = surface_downwelling_longwave_flux_on_radiation_timestep
-  long_name = total sky sfc downward lw flux
-  units = W m-2
-  dimensions = (horizontal_loop_extent)
-  type = real
-  kind = kind_phys
-  intent = inout  
-[sfculw]
-  standard_name = surface_upwelling_longwave_flux_on_radiation_timestep
-  long_name = total sky sfc upward lw flux
-  units = W m-2
-  dimensions = (horizontal_loop_extent)
-  type = real
-  kind = kind_phys
-  intent = inout
-[sfcflw]
-  standard_name = surface_lw_fluxes_assuming_total_and_clear_sky_on_radiation_timestep
-  long_name = lw radiation fluxes at sfc
-  units = W m-2
-  dimensions = (horizontal_loop_extent)
-  type = sfcflw_type
-  intent = inout  
-[tsflw]
-  standard_name = air_temperature_at_surface_adjacent_layer_on_radiation_timestep
-  long_name = surface air temp during lw calculation
-  units = K
-  dimensions = (horizontal_loop_extent)
-  type = real
-  kind = kind_phys
-  intent = inout  
-[htrlw]
-  standard_name = tendency_of_air_temperature_due_to_longwave_heating_on_radiation_timestep
-  long_name = total sky lw heating rate
-  units = K s-1
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = inout  
-[htrlwu]
-  standard_name = updated_tendency_of_air_temperature_due_to_longwave_heating_on_physics_timestep
-  long_name = total sky longwave heating rate on physics time step
-  units = K s-1
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = inout
-[topflw]
-  standard_name = lw_fluxes_top_atmosphere
-  long_name = lw radiation fluxes at top
-  units = W m-2
-  dimensions = (horizontal_loop_extent)
-  type = topflw_type
-  intent = out  
-[htrlwc]
-  standard_name = tendency_of_air_temperature_due_to_longwave_heating_assuming_clear_sky_on_radiation_timestep
-  long_name = longwave clear sky heating rate
-  units = K s-1
-  dimensions = (horizontal_loop_extent,adjusted_vertical_layer_dimension_for_radiation)
-  type = real
-  kind = kind_phys
-  intent = inout
-[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
diff --git a/physics/GFS_rrtmgp_post.F90 b/physics/GFS_rrtmgp_post.F90
new file mode 100644
index 000000000..22fe2fc21
--- /dev/null
+++ b/physics/GFS_rrtmgp_post.F90
@@ -0,0 +1,394 @@
+!> \file GFS_rrtmgp_post.F90
+!!
+!> \defgroup GFS_rrtmgp_post GFS_rrtmgp_post.F90
+!!
+!! \brief RRTMGP post-processing routine.
+!!
+module GFS_rrtmgp_post
+  use machine,                   only: kind_phys
+  use module_radlw_parameters,   only: topflw_type, sfcflw_type
+  use module_radsw_parameters,   only: topfsw_type, sfcfsw_type, cmpfsw_type
+  use mo_heating_rates,          only: compute_heating_rate
+  use radiation_tools,           only: check_error_msg
+  implicit none
+
+  public GFS_rrtmgp_post_run
+
+contains
+  ! ######################################################################################## 
+!>\defgroup gfs_rrtmgp_post_mod GFS RRTMGP Post Module
+!> \section arg_table_GFS_rrtmgp_post_run
+!! \htmlinclude GFS_rrtmgp_post.html
+!!
+!! \ingroup GFS_rrtmgp_post
+!!
+!! \brief The all-sky radiation tendency is computed, the clear-sky tendency is computed 
+!! if requested.
+!!
+!! RRTMGP surface and TOA fluxes are copied to fields that persist between radiation/physics
+!! calls.
+!! 
+!! (optional) Save additional diagnostics.
+!!
+!! \section GFS_rrtmgp_post_run
+  ! ######################################################################################## 
+  subroutine GFS_rrtmgp_post_run (nCol, nLev, nDay, iSFC, iTOA, idxday, doLWrad, doSWrad,  &
+       do_lw_clrsky_hr, do_sw_clrsky_hr, save_diag, fhlwr, fhswr, sfc_alb_nir_dir,         &
+       sfc_alb_nir_dif, sfc_alb_uvvis_dir, sfc_alb_uvvis_dif, p_lev, tsfa, coszen, coszdg, &
+       fluxlwDOWN_clrsky, fluxlwUP_allsky, fluxlwDOWN_allsky, fluxlwUP_clrsky,             &
+       fluxswDOWN_clrsky, fluxswUP_allsky, fluxswDOWN_allsky, fluxswUP_clrsky,             &
+       raddt, aerodp, cldsa, mtopa, mbota, cld_frac, cldtaulw, cldtausw, scmpsw, fluxr,    &
+       sfcdlw, sfculw, sfcflw, tsflw, htrlw, htrlwu, topflw, nirbmdi, nirdfdi, visbmdi,    &
+       visdfdi, nirbmui, nirdfui, visbmui, visdfui, sfcnsw, sfcdsw, htrsw, sfcfsw, topfsw, &
+       htrswc, htrlwc, errmsg, errflg)
+
+    ! Inputs
+    integer, intent(in) ::  &
+         nCol,              & ! Horizontal loop extent 
+         nLev,              & ! Number of vertical layers
+         nDay,              & ! Number of daylit columns
+         iSFC,              & ! Vertical index for surface level
+         iTOA                 ! Vertical index for TOA level
+    integer, intent(in), dimension(:) :: &
+         idxday               ! Index array for daytime points
+    integer, intent(in), dimension(:,:) :: &
+         mbota,             & ! Vertical indices for low, middle and high cloud tops
+         mtopa                ! ertical indices for low, middle and high cloud bases
+    logical, intent(in) :: & 
+         doLWrad,           & ! Logical flags for lw radiation calls
+         doSWrad,           & ! Logical flags for sw radiation calls
+         do_lw_clrsky_hr,   & ! Output clear-sky LW heating-rate?
+         do_sw_clrsky_hr,   & ! Output clear-sky SW heating-rate? 
+         save_diag            ! Output radiation diagnostics?
+    real(kind_phys), intent(in) :: &
+         fhlwr,             & ! Frequency for LW radiation calls
+         fhswr                ! Frequency for SW radiation calls
+    real(kind_phys), dimension(:), intent(in) ::  &
+         tsfa,              & ! Lowest model layer air temperature for radiation (K)
+         coszen,            & ! Cosine(SZA)
+         coszdg,            & ! Cosine(SZA), daytime
+         sfc_alb_nir_dir,   & ! Surface albedo (direct) 
+         sfc_alb_nir_dif,   & ! Surface albedo (diffuse)
+         sfc_alb_uvvis_dir, & ! Surface albedo (direct)
+         sfc_alb_uvvis_dif    ! Surface albedo (diffuse)
+    real(kind_phys), dimension(:,:), intent(in) :: &
+         p_lev,             & ! Pressure @ model layer-interfaces (Pa)
+         fluxlwUP_allsky,   & ! RRTMGP longwave all-sky flux      (W/m2)
+         fluxlwDOWN_allsky, & ! RRTMGP longwave all-sky flux      (W/m2)
+         fluxlwUP_clrsky,   & ! RRTMGP longwave clear-sky flux    (W/m2)
+         fluxlwDOWN_clrsky, & ! RRTMGP longwave clear-sky flux    (W/m2)
+         fluxswUP_allsky,   & ! RRTMGP shortwave all-sky flux     (W/m2)
+         fluxswDOWN_allsky, & ! RRTMGP shortwave all-sky flux     (W/m2)
+         fluxswUP_clrsky,   & ! RRTMGP shortwave clear-sky flux   (W/m2)
+         fluxswDOWN_clrsky    ! RRTMGP shortwave clear-sky flux   (W/m2)
+    real(kind_phys), intent(in) :: &
+         raddt                ! Radiation time step
+    real(kind_phys), dimension(:,:), intent(in) :: &
+         aerodp,            & ! Vertical integrated optical depth for various aerosol species
+         cldsa,             & ! Fraction of clouds for low, middle, high, total and BL
+         cld_frac,          & ! Total cloud fraction in each layer
+         cldtaulw,          & ! approx 10.mu band layer cloud optical depth
+         cldtausw             ! approx .55mu band layer cloud optical depth
+    type(cmpfsw_type), dimension(:), intent(in) :: &
+         scmpsw               ! 2D surface fluxes, components:
+                              ! uvbfc - total sky downward uv-b flux at  (W/m2)
+                              ! uvbf0 - clear sky downward uv-b flux at  (W/m2)
+                              ! nirbm - downward nir direct beam flux    (W/m2)
+                              ! nirdf - downward nir diffused flux       (W/m2)
+                              ! visbm - downward uv+vis direct beam flux (W/m2)
+                              ! visdf - downward uv+vis diffused flux    (W/m2)
+
+
+    real(kind=kind_phys), dimension(:,:), intent(inout) :: fluxr
+
+    ! Outputs (mandatory)
+    real(kind_phys), dimension(:), intent(inout) :: &
+         tsflw,             & ! LW sfc air temp during calculation (K)
+         sfcdlw,            & ! LW sfc all-sky     downward flux   (W/m2)
+         sfculw,            & ! LW sfc all-sky     upward   flux   (W/m2)
+         nirbmdi,           & ! SW sfc nir    beam downward flux   (W/m2)
+         nirdfdi,           & ! SW sfc nir    diff downward flux   (W/m2)
+         visbmdi,           & ! SW sfc uv+vis beam downward flux   (W/m2)
+         visdfdi,           & ! SW sfc uv+vis diff downward flux   (W/m2)
+         nirbmui,           & ! SW sfc nir    beam upward   flux   (W/m2)
+         nirdfui,           & ! SW sfc nir    diff upward   flux   (W/m2)
+         visbmui,           & ! SW sfc uv+vis beam upward   flux   (W/m2)
+         visdfui,           & ! SW sfc uv+vis diff upward   flux   (W/m2)
+         sfcnsw,            & ! SW sfc all-sky     net      flux   (W/m2) flux into ground
+         sfcdsw               ! SW sfc all-sky     downward flux   (W/m2)
+    real(kind_phys), dimension(:,:), intent(inout) :: &
+         htrlw,             & ! LW all-sky heating rate (K/s)
+         htrsw,             & ! SW all-sky heating rate (K/s)
+         htrlwu               ! LW all-sky heating-rate updated in-between radiation calls.
+    type(sfcflw_type), dimension(:), intent(inout) :: &
+         sfcflw               ! LW radiation fluxes at sfc
+    type(sfcfsw_type), dimension(:), intent(inout) :: &
+         sfcfsw               ! SW radiation fluxes at sfc
+    type(topfsw_type), dimension(:), intent(inout) :: &
+         topfsw               ! SW fluxes at top atmosphere
+    type(topflw_type), dimension(:), intent(inout) :: &
+         topflw               ! LW  fluxes at top atmosphere
+    character(len=*), intent(out) :: &
+         errmsg               ! CCPP error message
+    integer, intent(out) :: &
+         errflg               ! CCPP error code
+
+    ! Outputs (optional)
+    real(kind_phys),dimension(:,:),intent(inout),optional  :: &
+         htrlwc,            & ! LW clear-sky heating-rate (K/s)
+         htrswc               ! SW clear-sky heating rate (K/s)
+
+    ! Local variables
+    integer :: i, j, k, itop, ibtc
+    real(kind_phys) :: tem0d, tem1, tem2
+    real(kind_phys), dimension(nDay, nLev) :: thetaTendClrSky, thetaTendAllSky
+
+    ! Initialize CCPP error handling variables
+    errmsg = ''
+    errflg = 0
+
+    if (.not. (doLWrad .or. doSWrad)) return
+
+    if (doLWRad) then
+       ! #######################################################################################
+       ! Compute LW heating-rates.
+       ! #######################################################################################
+
+       ! Clear-sky heating-rate (optional)
+       if (do_lw_clrsky_hr) then
+          call check_error_msg('GFS_rrtmgp_post',compute_heating_rate(  &
+               fluxlwUP_clrsky,   & ! IN  - RRTMGP upward longwave clear-sky flux profiles (W/m2)
+               fluxlwDOWN_clrsky, & ! IN  - RRTMGP downward longwave clear-sky flux profiles (W/m2)
+               p_lev,             & ! IN  - Pressure @ layer-interfaces (Pa)
+               htrlwc))             ! OUT - Longwave clear-sky heating rate (K/sec)
+       endif
+
+       ! All-sky heating-rate (mandatory)
+       call check_error_msg('GFS_rrtmgp_post',compute_heating_rate(     &
+            fluxlwUP_allsky,      & ! IN  - RRTMGP upward longwave all-sky flux profiles (W/m2)
+            fluxlwDOWN_allsky,    & ! IN  - RRTMGP downward longwave all-sky flux profiles (W/m2)
+            p_lev,                & ! IN  - Pressure @ layer-interfaces (Pa)
+            htrlw))                 ! OUT - Longwave all-sky heating rate (K/sec)
+
+       ! #######################################################################################
+       ! Save LW outputs.
+       ! (Copy fluxes from RRTMGP types into model radiation types.)
+       ! #######################################################################################
+       ! TOA fluxes
+
+       topflw(:)%upfxc = fluxlwUP_allsky(:,iTOA)
+       topflw(:)%upfx0 = fluxlwUP_clrsky(:,iTOA)
+       
+       ! Surface fluxes
+       sfcflw(:)%upfxc = fluxlwUP_allsky(:,iSFC)
+       sfcflw(:)%upfx0 = fluxlwUP_clrsky(:,iSFC)
+       sfcflw(:)%dnfxc = fluxlwDOWN_allsky(:,iSFC)
+       sfcflw(:)%dnfx0 = fluxlwDOWN_clrsky(:,iSFC)
+       
+       ! Save surface air temp for diurnal adjustment at model t-steps
+       tsflw (:) = tsfa(:)
+       
+       ! Radiation fluxes for other physics processes
+       sfcdlw(:) = sfcflw(:)%dnfxc
+       sfculw(:) = sfcflw(:)%upfxc
+       
+       ! Heating-rate at radiation timestep, used for adjustment between radiation calls.
+       htrlwu = htrlw
+       
+       ! #######################################################################################
+       ! Save LW diagnostics
+       ! - For time averaged output quantities (including total-sky and clear-sky SW and LW
+       !   fluxes at TOA and surface; conventional 3-domain cloud amount, cloud top and base
+       !   pressure, and cloud top temperature; aerosols AOD, etc.), store computed results in
+       !   corresponding slots of array fluxr with appropriate time weights.
+       ! - Collect the fluxr data for wrtsfc
+       ! #######################################################################################
+       if (save_diag) then
+          do i=1,nCol
+             ! LW all-sky fluxes
+             fluxr(i,1 ) = fluxr(i,1 ) + fhlwr * fluxlwUP_allsky(  i,iTOA)   ! total sky top lw up
+             fluxr(i,19) = fluxr(i,19) + fhlwr * fluxlwDOWN_allsky(i,iSFC)   ! total sky sfc lw dn
+             fluxr(i,20) = fluxr(i,20) + fhlwr * fluxlwUP_allsky(  i,iSFC)   ! total sky sfc lw up
+             ! LW clear-sky fluxes
+             fluxr(i,28) = fluxr(i,28) + fhlwr * fluxlwUP_clrsky(  i,iTOA)   ! clear sky top lw up
+             fluxr(i,30) = fluxr(i,30) + fhlwr * fluxlwDOWN_clrsky(i,iSFC)   ! clear sky sfc lw dn
+             fluxr(i,33) = fluxr(i,33) + fhlwr * fluxlwUP_clrsky(  i,iSFC)   ! clear sky sfc lw up
+          enddo
+          
+          ! Save cld frac,toplyr,botlyr and top temp, note that the order of h,m,l cloud is reversed for 
+          ! the fluxr output. save interface pressure (pa) of top/bot
+          do j = 1, 3
+             do i = 1, nCol
+                tem0d = raddt * cldsa(i,j)
+                itop  = mtopa(i,j)
+                ibtc  = mbota(i,j)
+                
+                ! Add optical depth and emissivity output
+                tem2 = 0.
+                do k=ibtc,itop
+                   tem2 = tem2 + cldtaulw(i,k)      ! approx 10. mu channel
+                enddo
+                fluxr(i,46-j) = fluxr(i,46-j) + tem0d * (1.0-exp(-tem2))
+             enddo
+          enddo
+       endif
+    endif
+    ! #######################################################################################
+    ! #######################################################################################
+    ! #######################################################################################
+    ! #######################################################################################
+    ! #######################################################################################
+    ! #######################################################################################
+    if (doSWRad) then
+       if (nDay .gt. 0) then
+          ! #################################################################################
+          ! Compute SW heating-rates
+          ! #################################################################################
+
+          ! Clear-sky heating-rate (optional)
+          if (do_sw_clrsky_hr) then
+             htrswc(:,:) = 0._kind_phys
+             call check_error_msg('GFS_rrtmgp_post',compute_heating_rate( &
+                  fluxswUP_clrsky(idxday(1:nDay),:),   & ! IN  - Shortwave upward clear-sky flux profiles (W/m2)
+                  fluxswDOWN_clrsky(idxday(1:nDay),:), & ! IN  - Shortwave downward clear-sky flux profiles (W/m2)
+                  p_lev(idxday(1:nDay),:),             & ! IN  - Pressure at model-interface (Pa)
+                  thetaTendClrSky))                      ! OUT - Clear-sky heating-rate (K/sec)
+             htrswc(idxday(1:nDay),:)=thetaTendClrSky !**NOTE** GP doesn't use radiation levels, it uses the model fields. Not sure if this is necessary
+          endif
+          
+          ! All-sky heating-rate (mandatory)
+          htrsw(:,:) = 0._kind_phys
+          call check_error_msg('GFS_rrtmgp_post',compute_heating_rate(    &
+               fluxswUP_allsky(idxday(1:nDay),:),      & ! IN  - Shortwave upward all-sky flux profiles (W/m2)
+               fluxswDOWN_allsky(idxday(1:nDay),:),    & ! IN  - Shortwave downward all-sky flux profiles (W/m2)
+               p_lev(idxday(1:nDay),:),                & ! IN  - Pressure at model-interface (Pa)
+               thetaTendAllSky))                         ! OUT - All-sky heating-rate (K/sec)
+          htrsw(idxday(1:nDay),:) = thetaTendAllSky
+          
+          ! #################################################################################
+          ! Save SW outputs
+          ! (Copy fluxes from RRTMGP types into model radiation types.)
+          ! #################################################################################
+          
+          ! TOA fluxes
+          topfsw(:)%upfxc = fluxswUP_allsky(:,iTOA)
+          topfsw(:)%upfx0 = fluxswUP_clrsky(:,iTOA)
+          topfsw(:)%dnfxc = fluxswDOWN_allsky(:,iTOA)
+          
+          ! Surface fluxes
+          sfcfsw(:)%upfxc = fluxswUP_allsky(:,iSFC)
+          sfcfsw(:)%upfx0 = fluxswUP_clrsky(:,iSFC)
+          sfcfsw(:)%dnfxc = fluxswDOWN_allsky(:,iSFC)
+          sfcfsw(:)%dnfx0 = fluxswDOWN_clrsky(:,iSFC)
+          
+          ! Surface down and up spectral component fluxes
+          ! - Save two spectral bands' surface downward and upward fluxes for output.
+          do i=1,nCol
+             nirbmdi(i) = scmpsw(i)%nirbm
+             nirdfdi(i) = scmpsw(i)%nirdf
+             visbmdi(i) = scmpsw(i)%visbm
+             visdfdi(i) = scmpsw(i)%visdf
+             nirbmui(i) = scmpsw(i)%nirbm * sfc_alb_nir_dir(i)
+             nirdfui(i) = scmpsw(i)%nirdf * sfc_alb_nir_dif(i)
+             visbmui(i) = scmpsw(i)%visbm * sfc_alb_uvvis_dir(i)
+             visdfui(i) = scmpsw(i)%visdf * sfc_alb_uvvis_dif(i)
+          enddo
+       else                   ! if_nday_block
+          ! #################################################################################
+          ! Dark everywhere
+          ! #################################################################################
+          htrsw(:,:) = 0.0
+          sfcfsw     = sfcfsw_type( 0.0, 0.0, 0.0, 0.0 )
+          topfsw     = topfsw_type( 0.0, 0.0, 0.0 )
+          do i=1,nCol
+             nirbmdi(i) = 0.0
+             nirdfdi(i) = 0.0
+             visbmdi(i) = 0.0
+             visdfdi(i) = 0.0
+             nirbmui(i) = 0.0
+             nirdfui(i) = 0.0
+             visbmui(i) = 0.0
+             visdfui(i) = 0.0
+          enddo
+          
+          if (do_sw_clrsky_hr) then
+             htrswc(:,:) = 0
+          endif
+       endif                  ! end_if_nday
+       
+       ! Radiation fluxes for other physics processes
+       do i=1,nCol
+          sfcnsw(i) = sfcfsw(i)%dnfxc - sfcfsw(i)%upfxc
+          sfcdsw(i) = sfcfsw(i)%dnfxc
+       enddo
+       
+       ! #################################################################################
+       ! Save SW diagnostics
+       ! - For time averaged output quantities (including total-sky and clear-sky SW and LW 
+       !   fluxes at TOA and surface; conventional 3-domain cloud amount, cloud top and base 
+       !   pressure, and cloud top temperature; aerosols AOD, etc.), store computed results in
+       !   corresponding slots of array fluxr with appropriate time weights.
+       ! - Collect the fluxr data for wrtsfc
+       ! #################################################################################
+       if (save_diag) then
+          do i=1,nCol
+             fluxr(i,34) = aerodp(i,1)  ! total aod at 550nm
+             fluxr(i,35) = aerodp(i,2)  ! DU aod at 550nm
+             fluxr(i,36) = aerodp(i,3)  ! BC aod at 550nm
+             fluxr(i,37) = aerodp(i,4)  ! OC aod at 550nm
+             fluxr(i,38) = aerodp(i,5)  ! SU aod at 550nm
+             fluxr(i,39) = aerodp(i,6)  ! SS aod at 550nm
+             if (coszen(i) > 0.) then
+                ! SW all-sky fluxes
+                tem0d = fhswr * coszdg(i) / coszen(i)
+                fluxr(i,2 ) = fluxr(i,2)  + topfsw(i)%upfxc * tem0d  ! total sky top sw up
+                fluxr(i,3 ) = fluxr(i,3)  + sfcfsw(i)%upfxc * tem0d  
+                fluxr(i,4 ) = fluxr(i,4)  + sfcfsw(i)%dnfxc * tem0d  ! total sky sfc sw dn
+                ! SW uv-b fluxes
+                fluxr(i,21) = fluxr(i,21) + scmpsw(i)%uvbfc * tem0d  ! total sky uv-b sw dn
+                fluxr(i,22) = fluxr(i,22) + scmpsw(i)%uvbf0 * tem0d  ! clear sky uv-b sw dn
+                ! SW TOA incoming fluxes
+                fluxr(i,23) = fluxr(i,23) + topfsw(i)%dnfxc * tem0d  ! top sw dn 
+                ! SW SFC flux components
+                fluxr(i,24) = fluxr(i,24) + visbmdi(i) * tem0d       ! uv/vis beam sw dn
+                fluxr(i,25) = fluxr(i,25) + visdfdi(i) * tem0d       ! uv/vis diff sw dn
+                fluxr(i,26) = fluxr(i,26) + nirbmdi(i) * tem0d       ! nir beam sw dn
+                fluxr(i,27) = fluxr(i,27) + nirdfdi(i) * tem0d       ! nir diff sw dn
+                ! SW clear-sky fluxes
+                fluxr(i,29) = fluxr(i,29) + topfsw(i)%upfx0 * tem0d
+                fluxr(i,31) = fluxr(i,31) + sfcfsw(i)%upfx0 * tem0d
+                fluxr(i,32) = fluxr(i,32) + sfcfsw(i)%dnfx0 * tem0d
+             endif
+          enddo
+          
+          ! Save total and boundary-layer clouds
+          do i=1,nCol
+             fluxr(i,17) = fluxr(i,17) + raddt * cldsa(i,4)
+             fluxr(i,18) = fluxr(i,18) + raddt * cldsa(i,5)
+          enddo
+          
+          ! Save cld frac,toplyr,botlyr and top temp, note that the order of h,m,l cloud 
+          ! is reversed for the fluxr output. save interface pressure (pa) of top/bot
+          do j = 1, 3
+             do i = 1, nCol
+                tem0d = raddt * cldsa(i,j)
+                itop  = mtopa(i,j)
+                ibtc  = mbota(i,j)
+                fluxr(i, 8-j) = fluxr(i, 8-j) + tem0d
+                fluxr(i,11-j) = fluxr(i,11-j) + tem0d * p_lev(i,itop)
+                fluxr(i,14-j) = fluxr(i,14-j) + tem0d * p_lev(i,ibtc)
+                fluxr(i,17-j) = fluxr(i,17-j) + tem0d * p_lev(i,itop)
+                
+                ! Add optical depth and emissivity output
+                tem1 = 0.
+                do k=ibtc,itop
+                   tem1 = tem1 + cldtausw(i,k)      ! approx .55 mu channel
+                enddo
+                fluxr(i,43-j) = fluxr(i,43-j) + tem0d * tem1
+             enddo
+          enddo
+       endif
+    endif
+
+  end subroutine GFS_rrtmgp_post_run
+end module GFS_rrtmgp_post
diff --git a/physics/GFS_rrtmgp_sw_post.meta b/physics/GFS_rrtmgp_post.meta
similarity index 71%
rename from physics/GFS_rrtmgp_sw_post.meta
rename to physics/GFS_rrtmgp_post.meta
index 7da3b10b0..e4bc3e5dc 100644
--- a/physics/GFS_rrtmgp_sw_post.meta
+++ b/physics/GFS_rrtmgp_post.meta
@@ -1,14 +1,13 @@
 [ccpp-table-properties]
-  name = GFS_rrtmgp_sw_post
+  name = GFS_rrtmgp_post
   type = scheme
-  dependencies = iounitdef.f,machine.F,radiation_aerosols.f,radsw_param.f,rte-rrtmgp/extensions/mo_fluxes_byband.F90
-  dependencies = rte-rrtmgp/rte/mo_fluxes.F90,rte-rrtmgp/rte/kernels/mo_fluxes_broadband_kernels.F90,rte-rrtmgp/extensions/mo_heating_rates.F90,radiation_tools.F90
+  dependencies = iounitdef.f,machine.F,radiation_aerosols.f,radlw_param.f,radiation_tools.F90,rte-rrtmgp/extensions/mo_heating_rates.F90
 
 ########################################################################
 [ccpp-arg-table]
-  name = GFS_rrtmgp_sw_post_run
+  name = GFS_rrtmgp_post_run
   type = scheme
-[ncol]
+[nCol]
   standard_name = horizontal_loop_extent
   long_name = horizontal loop extent
   units = count
@@ -50,7 +49,7 @@
   dimensions = (horizontal_loop_extent)
   type = integer
   intent = in
-[lsswr]
+[doSWrad]
   standard_name = flag_for_calling_shortwave_radiation
   long_name = logical flags for sw radiation calls
   units = flag
@@ -64,6 +63,20 @@
   dimensions = ()
   type = logical
   intent = in
+[doLWrad]
+  standard_name = flag_for_calling_longwave_radiation
+  long_name = logical flags for lw radiation calls
+  units = flag
+  dimensions = ()
+  type = logical
+  intent = in
+[do_lw_clrsky_hr]
+  standard_name = flag_for_output_of_tendency_of_air_temperature_due_to_longwave_heating_on_radiation_timestep_assuming_clear_sky
+  long_name = flag to output lw heating rate
+  units = flag
+  dimensions = ()
+  type = logical
+  intent = in
 [save_diag]
   standard_name = flag_for_diagnostics
   long_name = logical flag for storing diagnostics
@@ -71,6 +84,14 @@
   dimensions = ()
   type = logical
   intent = in
+[fhlwr]
+  standard_name = period_of_longwave_radiation_calls
+  long_name = frequency for longwave radiation
+  units = s
+  dimensions = ()
+  type = real
+  kind = kind_phys
+  intent = in
 [fhswr]
   standard_name = period_of_shortwave_radiation_calls
   long_name = frequency for shortwave radiation
@@ -95,22 +116,6 @@
   type = real
   kind = kind_phys
   intent = in
-[t_lay]
-  standard_name = air_temperature_at_layer_for_RRTMGP
-  long_name = air temperature at vertical layer for radiation calculation
-  units = K
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[p_lev]
-  standard_name = air_pressure_at_interface_for_RRTMGP
-  long_name = air pressure level
-  units = Pa
-  dimensions = (horizontal_loop_extent,vertical_interface_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
 [sfc_alb_nir_dir]
   standard_name = surface_albedo_due_to_near_IR_direct
   long_name = surface albedo due to near IR direct beam
@@ -143,6 +148,54 @@
   type = real
   kind = kind_phys
   intent = in
+[tsfa]
+  standard_name = surface_air_temperature_for_radiation
+  long_name = lowest model layer air temperature for radiation
+  units = K
+  dimensions = (horizontal_loop_extent)
+  type = real
+  kind = kind_phys
+  intent = in
+[p_lev]
+  standard_name = air_pressure_at_interface_for_RRTMGP
+  long_name = air pressure level
+  units = Pa
+  dimensions = (horizontal_loop_extent,vertical_interface_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[fluxlwUP_allsky]
+  standard_name = RRTMGP_lw_flux_profile_upward_allsky
+  long_name = RRTMGP upward longwave all-sky flux profile
+  units = W m-2
+  dimensions = (horizontal_loop_extent,vertical_interface_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[fluxlwDOWN_allsky]
+  standard_name = RRTMGP_lw_flux_profile_downward_allsky
+  long_name = RRTMGP downward longwave all-sky flux profile
+  units = W m-2
+  dimensions = (horizontal_loop_extent,vertical_interface_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[fluxlwUP_clrsky]
+  standard_name = RRTMGP_lw_flux_profile_upward_clrsky
+  long_name = RRTMGP upward longwave clr-sky flux profile
+  units = W m-2
+  dimensions = (horizontal_loop_extent,vertical_interface_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[fluxlwDOWN_clrsky]
+  standard_name = RRTMGP_lw_flux_profile_downward_clrsky
+  long_name = RRTMGP downward longwave clr-sky flux profile
+  units = W m-2
+  dimensions = (horizontal_loop_extent,vertical_interface_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
 [fluxswUP_allsky]
   standard_name = RRTMGP_sw_flux_profile_upward_allsky
   long_name = RRTMGP upward shortwave all-sky flux profile
@@ -199,16 +252,16 @@
   type = real
   kind = kind_phys
   intent = in
-[mbota]
-  standard_name = model_layer_number_at_cloud_base
-  long_name = vertical indices for low, middle and high cloud bases
+[mtopa]
+  standard_name = model_layer_number_at_cloud_top
+  long_name = vertical indices for low, middle and high cloud tops
   units = index
   dimensions = (horizontal_loop_extent,3)
   type = integer
   intent = in
-[mtopa]
-  standard_name = model_layer_number_at_cloud_top
-  long_name = vertical indices for low, middle and high cloud tops
+[mbota]
+  standard_name = model_layer_number_at_cloud_base
+  long_name = vertical indices for low, middle and high cloud bases
   units = index
   dimensions = (horizontal_loop_extent,3)
   type = integer
@@ -221,6 +274,14 @@
   type = real
   kind = kind_phys
   intent = in
+[cldtaulw]
+  standard_name = cloud_optical_depth_layers_at_10mu_band
+  long_name = approx 10mu band layer cloud optical depth
+  units = none
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
 [cldtausw]
   standard_name = cloud_optical_depth_layers_at_0p55mu_band
   long_name = approx .55mu band layer cloud optical depth
@@ -229,6 +290,13 @@
   type = real
   kind = kind_phys
   intent = in
+[scmpsw]
+  standard_name = components_of_surface_downward_shortwave_fluxes
+  long_name = derived type for special components of surface downward shortwave fluxes
+  units = W m-2
+  dimensions = (horizontal_loop_extent)
+  type = cmpfsw_type
+  intent = in
 [fluxr]
   standard_name = cumulative_radiation_diagnostic
   long_name = time-accumulated 2D radiation-related diagnostic fields
@@ -237,6 +305,60 @@
   type = real
   kind = kind_phys
   intent = inout
+[sfcdlw]
+  standard_name = surface_downwelling_longwave_flux_on_radiation_timestep
+  long_name = total sky sfc downward lw flux
+  units = W m-2
+  dimensions = (horizontal_loop_extent)
+  type = real
+  kind = kind_phys
+  intent = inout  
+[sfculw]
+  standard_name = surface_upwelling_longwave_flux_on_radiation_timestep
+  long_name = total sky sfc upward lw flux
+  units = W m-2
+  dimensions = (horizontal_loop_extent)
+  type = real
+  kind = kind_phys
+  intent = inout
+[sfcflw]
+  standard_name = surface_lw_fluxes_assuming_total_and_clear_sky_on_radiation_timestep
+  long_name = lw radiation fluxes at sfc
+  units = W m-2
+  dimensions = (horizontal_loop_extent)
+  type = sfcflw_type
+  intent = inout  
+[tsflw]
+  standard_name = air_temperature_at_surface_adjacent_layer_on_radiation_timestep
+  long_name = surface air temp during lw calculation
+  units = K
+  dimensions = (horizontal_loop_extent)
+  type = real
+  kind = kind_phys
+  intent = inout  
+[htrlw]
+  standard_name = tendency_of_air_temperature_due_to_longwave_heating_on_radiation_timestep
+  long_name = total sky lw heating rate
+  units = K s-1
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = inout  
+[htrlwu]
+  standard_name = updated_tendency_of_air_temperature_due_to_longwave_heating_on_physics_timestep
+  long_name = total sky longwave heating rate on physics time step
+  units = K s-1
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = inout
+[topflw]
+  standard_name = lw_fluxes_top_atmosphere
+  long_name = lw radiation fluxes at top
+  units = W m-2
+  dimensions = (horizontal_loop_extent)
+  type = topflw_type
+  intent = inout
 [nirbmdi]
   standard_name = surface_downwelling_direct_nir_shortwave_flux_on_radiation_timestep
   long_name = sfc nir beam sw downward flux
@@ -347,12 +469,13 @@
   type = real
   kind = kind_phys
   intent = inout
-[scmpsw]
-  standard_name = components_of_surface_downward_shortwave_fluxes
-  long_name = derived type for special components of surface downward shortwave fluxes
-  units = W m-2
-  dimensions = (horizontal_loop_extent)
-  type = cmpfsw_type
+[htrlwc]
+  standard_name = tendency_of_air_temperature_due_to_longwave_heating_assuming_clear_sky_on_radiation_timestep
+  long_name = longwave clear sky heating rate
+  units = K s-1
+  dimensions = (horizontal_loop_extent,adjusted_vertical_layer_dimension_for_radiation)
+  type = real
+  kind = kind_phys
   intent = inout
 [errmsg]
   standard_name = ccpp_error_message
diff --git a/physics/GFS_rrtmgp_pre.F90 b/physics/GFS_rrtmgp_pre.F90
index 755b977b3..8e115b774 100644
--- a/physics/GFS_rrtmgp_pre.F90
+++ b/physics/GFS_rrtmgp_pre.F90
@@ -15,9 +15,9 @@ module GFS_rrtmgp_pre
        NF_VGAS,                  & !< Number of active gas species
        getgases,                 & !< Routine to setup trace gases
        getozn                      !< Routine to setup ozone
-  ! RRTMGP types
-  use mo_gas_concentrations, only: ty_gas_concs
   use radiation_tools,       only: check_error_msg,cmp_tlev
+  use rrtmgp_lw_gas_optics,  only: lw_gas_props  
+  implicit none
 
   real(kind_phys), parameter :: &
        amd   = 28.9644_kind_phys,  & !< Molecular weight of dry-air     (g/mol)
@@ -25,6 +25,9 @@ module GFS_rrtmgp_pre
        amo3  = 47.9982_kind_phys,  & !< Modelular weight of ozone       (g/mol)
        amdw  = amd/amw,            & !< Molecular weight of dry air / water vapor
        amdo3 = amd/amo3              !< Molecular weight of dry air / ozone
+  real(kind_phys), parameter :: eps      = 1.0e-6_kind_phys
+  real(kind_phys), parameter :: oneminus = 1.0_kind_phys - eps
+  real(kind_phys), parameter :: ftiny    = 1.0e-12_kind_phys
 
   ! Save trace gas indices.
   integer :: iStr_h2o, iStr_co2, iStr_o3, iStr_n2o, iStr_ch4, iStr_o2, iStr_ccl4, &
@@ -111,27 +114,25 @@ end subroutine GFS_rrtmgp_pre_init
 !!
 !! \section GFS_rrtmgp_pre_run
   ! ######################################################################################### 
-  subroutine GFS_rrtmgp_pre_run(me, nCol, nLev, nTracers, i_o3, lsswr, lslwr, fhswr, fhlwr, &
+  subroutine GFS_rrtmgp_pre_run(me, nCol, nLev, i_o3, doSWrad, doLWrad, fhswr, fhlwr,       &
        xlat, xlon,  prsl, tgrs, prslk, prsi, qgrs, tsfc, coslat, sinlat, con_g, con_rd,     &
-       con_eps, con_epsm1, con_fvirt, con_epsqs, solhr, minGPpres, maxGPpres, minGPtemp,    &
-       maxGPtemp, raddt, p_lay, t_lay, p_lev, t_lev, tsfg, tsfa, qs_lay, q_lay, tv_lay,     &
-       relhum, tracer, deltaZ, deltaZc, deltaP, active_gases_array, gas_concentrations,     &
-       tsfc_radtime, coszen, coszdg, top_at_1, iSFC, iTOA, errmsg, errflg)
+       con_eps, con_epsm1, con_fvirt, con_epsqs, solhr, raddt, p_lay, t_lay, p_lev, t_lev,  &
+       vmr_o2, vmr_h2o, vmr_o3, vmr_ch4,                                                    &
+       vmr_n2o, vmr_co2, tsfg, tsfa, qs_lay, q_lay, tv_lay,                                 &
+       relhum, deltaZ, deltaZc, deltaP, active_gases_array,                                 &
+       tsfc_radtime, coszen, coszdg, top_at_1, iSFC, iTOA, nDay, idxday, semis,             &
+       sfc_emiss_byband, errmsg, errflg)
     
     ! Inputs   
     integer, intent(in)    :: &
+         me,                & ! MPI rank
          nCol,              & ! Number of horizontal grid points
          nLev,              & ! Number of vertical layers
-         nTracers,          & ! Number of tracers from model. 
          i_o3                 ! Index into tracer array for ozone
     logical, intent(in) :: &
-    	 lsswr,             & ! Call SW radiation?
-    	 lslwr                ! Call LW radiation
+    	 doSWrad,           & ! Call SW radiation?
+    	 doLWrad              ! Call LW radiation
     real(kind_phys), intent(in) :: &
-         minGPtemp,         & ! Minimum temperature allowed in RRTMGP.
-         maxGPtemp,         & ! Maximum ...
-         minGPpres,         & ! Minimum pressure allowed in RRTMGP.
-         maxGPpres,         & ! Maximum pressure allowed in RRTMGP. 
          fhswr,             & ! Frequency of SW radiation call.
          fhlwr                ! Frequency of LW radiation call.
     real(kind_phys), intent(in) :: &
@@ -147,7 +148,8 @@ subroutine GFS_rrtmgp_pre_run(me, nCol, nLev, nTracers, i_o3, lsswr, lslwr, fhsw
     	 xlat,              & ! Latitude
     	 tsfc,              & ! Surface skin temperature (K)
          coslat,            & ! Cosine(latitude)
-         sinlat               ! Sine(latitude) 
+         sinlat,            & ! Sine(latitude) 
+         semis
     real(kind_phys), dimension(:,:), intent(in) :: & 
          prsl,              & ! Pressure at model-layer centers (Pa)
          tgrs,              & ! Temperature at model-layer centers (K)
@@ -163,9 +165,11 @@ subroutine GFS_rrtmgp_pre_run(me, nCol, nLev, nTracers, i_o3, lsswr, lslwr, fhsw
          errmsg               ! Error message
     integer, intent(out) :: &  
          errflg,            & ! Error flag
+         nDay
+    integer, intent(inout) :: &
          iSFC,              & ! Vertical index for surface
          iTOA                 ! Vertical index for TOA
-    logical, intent(out) :: &
+    logical, intent(inout) :: &
          top_at_1             ! Vertical ordering flag
     real(kind_phys), intent(inout) :: &
          raddt                ! Radiation time-step
@@ -175,6 +179,8 @@ subroutine GFS_rrtmgp_pre_run(me, nCol, nLev, nTracers, i_o3, lsswr, lslwr, fhsw
          tsfc_radtime,      & ! Surface temperature at radiation timestep
          coszen,            & ! Cosine of SZA
          coszdg               ! Cosine of SZA, daytime
+    integer, dimension(:), intent(inout) ::  &
+         idxday               ! Indices for daylit points 
     real(kind_phys), dimension(:,:), intent(inout) :: &
          p_lay,             & ! Pressure at model-layer
          t_lay,             & ! Temperature at model layer
@@ -186,15 +192,12 @@ subroutine GFS_rrtmgp_pre_run(me, nCol, nLev, nTracers, i_o3, lsswr, lslwr, fhsw
          deltaZc,           & ! Layer thickness (m) (between layer centers)
          deltaP,            & ! Layer thickness (Pa)
          p_lev,             & ! Pressure at model-interface
-         t_lev                ! Temperature at model-interface
-    real(kind_phys), dimension(:,:,:),intent(inout) :: &
-         tracer               ! Array containing trace gases
-    type(ty_gas_concs), intent(inout) :: &
-         gas_concentrations   ! RRTMGP DDT: gas volumne mixing ratios
+         sfc_emiss_byband,  & !
+         t_lev,             & ! Temperature at model-interface
+         vmr_o2, vmr_h2o, vmr_o3, vmr_ch4, vmr_n2o, vmr_co2
 
     ! Local variables
     integer :: i, j, iCol, iBand, iLay, iLev, iSFC_ilev
-    real(kind_phys),dimension(nCol,nLev) :: vmr_o3, vmr_h2o
     real(kind_phys) :: es, tem1, tem2, pfac
     real(kind_phys), dimension(nLev+1) :: hgtb
     real(kind_phys), dimension(nLev)   :: hgtc
@@ -206,7 +209,9 @@ subroutine GFS_rrtmgp_pre_run(me, nCol, nLev, nTracers, i_o3, lsswr, lslwr, fhsw
     errmsg = ''
     errflg = 0
     
-    if (.not. (lsswr .or. lslwr)) return
+    nday   = 0
+    idxday = 0
+    if (.not. (doSWrad .or. doLWrad)) return
         
     ! #######################################################################################
     ! What is vertical ordering?
@@ -242,27 +247,29 @@ subroutine GFS_rrtmgp_pre_run(me, nCol, nLev, nTracers, i_o3, lsswr, lslwr, fhsw
     ! Bound temperature/pressure at layer centers.
     do iLay=1,nLev
        do iCol=1,NCOL
-          if (t_lay(iCol,iLay) .le. minGPtemp) then
-             t_lay(iCol,iLay) = minGPtemp + epsilon(minGPtemp)
+          if (t_lay(iCol,iLay) .le. lw_gas_props%get_temp_min()) then
+             t_lay(iCol,iLay) = lw_gas_props%get_temp_min() + epsilon(lw_gas_props%get_temp_min())
           endif
-          if (p_lay(iCol,iLay) .le. minGPpres) then
-             p_lay(iCol,iLay) = minGPpres + epsilon(minGPpres)
+          if (p_lay(iCol,iLay) .le. lw_gas_props%get_press_min()) then
+             p_lay(iCol,iLay) = lw_gas_props%get_press_min() + epsilon(lw_gas_props%get_press_min())
           endif
-          if (t_lay(iCol,iLay) .ge. maxGPtemp) then
-             t_lay(iCol,iLay) = maxGPtemp - epsilon(maxGPtemp)
+          if (t_lay(iCol,iLay) .ge. lw_gas_props%get_temp_max()) then
+             t_lay(iCol,iLay) = lw_gas_props%get_temp_max() - epsilon(lw_gas_props%get_temp_max())
           endif
-          if (p_lay(iCol,iLay) .ge. maxGPpres) then
-             p_lay(iCol,iLay) = maxGPpres - epsilon(maxGPpres)
+          if (p_lay(iCol,iLay) .ge. lw_gas_props%get_press_max()) then
+             p_lay(iCol,iLay) = lw_gas_props%get_press_max() - epsilon(lw_gas_props%get_press_max())
           endif
        enddo
     enddo
 
     ! Temperature at layer-interfaces          
-    call cmp_tlev(nCol,nLev,minGPpres,p_lay,t_lay,p_lev,tsfc,t_lev)
+    call cmp_tlev(nCol,nLev,lw_gas_props%get_press_min(),p_lay,t_lay,p_lev,tsfc,t_lev)
     do iLev=1,nLev+1
        do iCol=1,nCol
-          if (t_lev(iCol,iLev) .le. minGPtemp) t_lev(iCol,iLev) = minGPtemp + epsilon(minGPtemp)
-          if (t_lev(iCol,iLev) .ge. maxGPtemp) t_lev(iCol,iLev) = maxGPtemp - epsilon(maxGPtemp)
+          if (t_lev(iCol,iLev) .le. lw_gas_props%get_temp_min()) t_lev(iCol,iLev) = &
+               lw_gas_props%get_temp_min() + epsilon(lw_gas_props%get_temp_min())
+          if (t_lev(iCol,iLev) .ge. lw_gas_props%get_temp_max()) t_lev(iCol,iLev) = &
+               lw_gas_props%get_temp_max() - epsilon(lw_gas_props%get_temp_max())
        enddo
     enddo
 
@@ -336,16 +343,11 @@ subroutine GFS_rrtmgp_pre_run(me, nCol, nLev, nTracers, i_o3, lsswr, lslwr, fhsw
     ! #######################################################################################
     ! Get layer ozone mass mixing ratio 
     ! #######################################################################################
-    ! First recast remaining all tracers (except sphum) forcing them all to be positive
-    do j = 2, nTracers
-       tracer(1:NCOL,:,j) = qgrs(1:NCOL,:,j)
-       where(tracer(:,:,j) .lt. 0.0) tracer(:,:,j) = 0._kind_phys
-    enddo
 
     if (i_o3 > 0) then 
        do iLay=1,nlev
           do iCol=1,NCOL
-             o3_lay(iCol,iLay) = max( con_epsqs, tracer(iCol,iLay,i_o3) )
+             o3_lay(iCol,iLay) = max( con_epsqs, qgrs(iCol,iLay,i_o3) )
           enddo
        enddo
     ! OR Use climatological ozone data
@@ -358,21 +360,14 @@ subroutine GFS_rrtmgp_pre_run(me, nCol, nLev, nTracers, i_o3, lsswr, lslwr, fhsw
     ! #######################################################################################
     ! Call getgases(), to set up non-prognostic gas volume mixing ratios (gas_vmr).
     call getgases (p_lev/100., xlon, xlat, nCol, nLev, gas_vmr)
+    vmr_o2  = gas_vmr(:,:,4)
+    vmr_ch4 = gas_vmr(:,:,3)
+    vmr_n2o = gas_vmr(:,:,2)
+    vmr_co2 = gas_vmr(:,:,1)
 
     ! Compute volume mixing-ratios for ozone (mmr) and specific-humidity.
     vmr_h2o = merge((q_lay/(1-q_lay))*amdw, 0., q_lay  .ne. 1.)
     vmr_o3  = merge(o3_lay*amdo3,           0., o3_lay .gt. 0.)
-    
-    ! Populate RRTMGP DDT w/ gas-concentrations
-    gas_concentrations%ncol                       = nCol
-    gas_concentrations%nlay                       = nLev
-    gas_concentrations%gas_name(:)                = active_gases_array(:)
-    gas_concentrations%concs(istr_o2)%conc(:,:)   = gas_vmr(:,:,4)
-    gas_concentrations%concs(istr_co2)%conc(:,:)  = gas_vmr(:,:,1)
-    gas_concentrations%concs(istr_ch4)%conc(:,:)  = gas_vmr(:,:,3)
-    gas_concentrations%concs(istr_n2o)%conc(:,:)  = gas_vmr(:,:,2)
-    gas_concentrations%concs(istr_h2o)%conc(:,:)  = vmr_h2o(:,:)
-    gas_concentrations%concs(istr_o3)%conc(:,:)   = vmr_o3(:,:)
 
     ! #######################################################################################
     ! Radiation time step (output) (Is this really needed?) (Used by some diagnostics)
@@ -388,10 +383,29 @@ subroutine GFS_rrtmgp_pre_run(me, nCol, nLev, nTracers, i_o3, lsswr, lslwr, fhsw
     ! #######################################################################################
     ! Compute cosine of zenith angle (only when SW is called)
     ! #######################################################################################
-    if (lsswr) then
+    if (doSWrad) then
        call coszmn (xlon, sinlat, coslat, solhr, nCol, me, coszen, coszdg)
+       ! For SW gather daylit points
+       nday   = 0
+       idxday = 0
+       do iCol = 1, nCol
+          if (coszen(iCol) >= 0.0001) then
+             nday = nday + 1
+             idxday(nday) = iCol
+          endif
+       enddo
+    else
+       nday   = 0
+       idxday = 0
     endif
 
+    ! #######################################################################################
+    ! Surface emissivity
+    ! #######################################################################################
+    do iBand=1,lw_gas_props%get_nband()
+       sfc_emiss_byband(iBand,:) = semis
+    enddo
+
   end subroutine GFS_rrtmgp_pre_run
   
 end module GFS_rrtmgp_pre
diff --git a/physics/GFS_rrtmgp_pre.meta b/physics/GFS_rrtmgp_pre.meta
index 88face855..455010e58 100644
--- a/physics/GFS_rrtmgp_pre.meta
+++ b/physics/GFS_rrtmgp_pre.meta
@@ -72,21 +72,14 @@
   dimensions = ()
   type = integer
   intent = in
-[nTracers]
-  standard_name = number_of_tracers
-  long_name = number of tracers
-  units = count
-  dimensions = ()
-  type = integer
-  intent = in
-[lsswr]
+[doSWrad]
   standard_name = flag_for_calling_shortwave_radiation
   long_name = logical flags for sw radiation calls
   units = flag
   dimensions = ()
   type = logical
   intent = in
-[lslwr]
+[doLWrad]
   standard_name = flag_for_calling_longwave_radiation
   long_name = logical flags for lw radiation calls
   units = flag
@@ -252,38 +245,6 @@
   type = real
   kind = kind_phys
   intent = in
-[minGPpres]
-  standard_name = minimum_pressure_in_RRTMGP
-  long_name = minimum pressure allowed in RRTMGP
-  units = Pa
-  dimensions = ()
-  type = real
-  kind = kind_phys
-  intent = in
-[maxGPpres]
-  standard_name = maximum_pressure_in_RRTMGP
-  long_name = maximum pressure allowed in RRTMGP
-  units = Pa
-  dimensions = ()
-  type = real
-  kind = kind_phys
-  intent = in
-[minGPtemp]
-  standard_name = minimum_temperature_in_RRTMGP
-  long_name = minimum temperature allowed in RRTMGP
-  units = K
-  dimensions = ()
-  type = real
-  kind = kind_phys
-  intent = in
-[maxGPtemp]
-  standard_name = maximum_temperature_in_RRTMGP
-  long_name = maximum temperature allowed in RRTMGP
-  units = K
-  dimensions = ()
-  type = real
-  kind = kind_phys
-  intent = in
 [raddt]
   standard_name = time_step_for_radiation
   long_name = radiation time step
@@ -354,21 +315,21 @@
   units = flag
   dimensions = ()
   type = logical
-  intent = out
+  intent = inout
 [iSFC]
   standard_name = vertical_index_for_surface_in_RRTMGP
   long_name = index for	surface	layer in RRTMGP
   units = flag
   dimensions = ()
   type = integer
-  intent = out
+  intent = inout
 [iTOA]
   standard_name = vertical_index_for_TOA_in_RRTMGP
   long_name = index for TOA layer in RRTMGP
   units = flag
   dimensions = ()
   type = integer
-  intent = out
+  intent = inout
 [tsfc_radtime]
   standard_name = surface_skin_temperature_on_radiation_timestep
   long_name = surface skin temperature on radiation timestep
@@ -425,11 +386,51 @@
   type = real
   kind = kind_phys
   intent = inout
-[tracer]
-  standard_name = chemical_tracers
-  long_name = chemical tracers
-  units = g g-1
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension,number_of_tracers)
+[vmr_o2]
+  standard_name = volume_mixing_ratio_for_o2
+  long_name = molar mixing ratio of o2 in with respect to dry air
+  units = 1
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = inout
+[vmr_h2o]
+  standard_name = volume_mixing_ratio_for_h2o
+  long_name = molar mixing ratio of h2o in with respect to dry air
+  units = 1
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = inout
+[vmr_o3]
+  standard_name = volume_mixing_ratio_for_o3
+  long_name = molar mixing ratio of o3 in with respect to dry air
+  units = 1
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = inout
+[vmr_ch4]
+  standard_name = volume_mixing_ratio_for_ch4
+  long_name = molar mixing ratio of ch4 in with respect to dry air
+  units = 1
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = inout
+[vmr_n2o]
+  standard_name = volume_mixing_ratio_for_n2o
+  long_name = molar mixing ratio of n2o in with respect to dry air
+  units = 1
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = inout
+[vmr_co2]
+  standard_name = volume_mixing_ratio_for_co2
+  long_name = molar mixing ratio of co2 in with respect to dry air
+  units = 1
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
   type = real
   kind = kind_phys
   intent = inout
@@ -441,13 +442,6 @@
   type = character
   kind = len=*
   intent = in
-[gas_concentrations]
-  standard_name = Gas_concentrations_for_RRTMGP_suite
-  long_name = DDT containing gas concentrations for RRTMGP radiation scheme
-  units = DDT
-  dimensions = ()
-  type = ty_gas_concs
-  intent = inout
 [coszdg]
   standard_name = cosine_of_solar_zenith_angle_on_radiation_timestep
   long_name = daytime mean cosz over rad call period
@@ -464,6 +458,36 @@
   type = real
   kind = kind_phys
   intent = inout
+[semis]
+  standard_name = surface_longwave_emissivity
+  long_name = surface lw emissivity in fraction
+  units = frac
+  dimensions = (horizontal_loop_extent)
+  type = real
+  kind = kind_phys
+  intent = in
+[sfc_emiss_byband]
+  standard_name = surface_emissivity_in_each_RRTMGP_LW_band
+  long_name = surface emissivity in each RRTMGP LW band
+  units = none
+  dimensions = (number_of_longwave_bands,horizontal_loop_extent)
+  type = real
+  kind = kind_phys
+  intent = inout
+[nday]
+  standard_name = daytime_points_dimension
+  long_name = daytime points dimension
+  units = count
+  dimensions = ()
+  type = integer
+  intent = inout
+[idxday]
+  standard_name = daytime_points
+  long_name = daytime points
+  units = index
+  dimensions = (horizontal_loop_extent)
+  type = integer
+  intent = inout
 [errmsg]
   standard_name = ccpp_error_message
   long_name = error message for error handling in CCPP
diff --git a/physics/GFS_rrtmgp_setup.F90 b/physics/GFS_rrtmgp_setup.F90
index 3cd8af019..f028acca2 100644
--- a/physics/GFS_rrtmgp_setup.F90
+++ b/physics/GFS_rrtmgp_setup.F90
@@ -156,7 +156,7 @@ end subroutine GFS_rrtmgp_setup_init
 !> \section arg_table_GFS_rrtmgp_setup_timestep_init
 !! \htmlinclude GFS_rrtmgp_setup_timestep_init.html
 !!
-  subroutine GFS_rrtmgp_setup_timestep_init (idate, jdate, deltsw, deltim, lsswr, me, &
+  subroutine GFS_rrtmgp_setup_timestep_init (idate, jdate, deltsw, deltim, doSWrad, me, &
                                              slag, sdec, cdec, solcon, errmsg, errflg)
      
     ! Inputs
@@ -164,7 +164,7 @@ subroutine GFS_rrtmgp_setup_timestep_init (idate, jdate, deltsw, deltim, lsswr,
     integer,         intent(in)  :: jdate(:)
     real(kind_phys), intent(in)  :: deltsw
     real(kind_phys), intent(in)  :: deltim
-    logical,         intent(in)  :: lsswr
+    logical,         intent(in)  :: doSWrad
     integer,         intent(in)  :: me
 
     ! Outputs
@@ -222,7 +222,7 @@ subroutine GFS_rrtmgp_setup_timestep_init (idate, jdate, deltsw, deltim, lsswr,
     endif
 
     ! Update solar forcing...
-    if (lsswr) then
+    if (doSWrad) then
        if ( isolar == 0 .or. isolar == 10 ) then
           lsol_chg = .false.
        elseif ( iyear0 /= iyear ) then
diff --git a/physics/GFS_rrtmgp_setup.meta b/physics/GFS_rrtmgp_setup.meta
index 41bf63ac8..160430765 100644
--- a/physics/GFS_rrtmgp_setup.meta
+++ b/physics/GFS_rrtmgp_setup.meta
@@ -256,7 +256,7 @@
   type = real
   kind = kind_phys
   intent = in
-[lsswr]
+[doSWrad]
   standard_name = flag_for_calling_shortwave_radiation
   long_name = logical flags for sw radiation calls
   units = flag
diff --git a/physics/GFS_rrtmgp_sw_post.F90 b/physics/GFS_rrtmgp_sw_post.F90
deleted file mode 100644
index 87ddc719b..000000000
--- a/physics/GFS_rrtmgp_sw_post.F90
+++ /dev/null
@@ -1,286 +0,0 @@
-!> \file GFS_rrtmgp_sw_post.F90
-!!
-!> \defgroup GFS_rrtmgp_sw_post GFS_rrtmgp_sw_post.F90
-!!
-!! \brief RRTMGP Shortwave post-processing routine.
-!!
-module GFS_rrtmgp_sw_post
-  use machine,                   only: kind_phys
-  use module_radiation_aerosols, only: NSPC1
-  use module_radsw_parameters,   only: topfsw_type, sfcfsw_type, cmpfsw_type
-  use mo_heating_rates,          only: compute_heating_rate
-  use radiation_tools,           only: check_error_msg
-  use rrtmgp_sw_gas_optics,      only: sw_gas_props
-  implicit none
-
-  public GFS_rrtmgp_sw_post_run
-
-contains
-
-!>\defgroup gfs_rrtmgp_sw_post_mod GFS RRTMGP-SW Post Module
-!> \section arg_table_GFS_rrtmgp_sw_post_run
-!! \htmlinclude GFS_rrtmgp_sw_post_run.html
-!!
-!> \ingroup GFS_rrtmgp_sw_post
-!! RRTMGP Shortwave post-processing routine.
-!!
-!! \brief The all-sky shortwave radiation tendency is computed, the clear-sky tendency is 
-!! computed if requested.
-!!
-!! RRTMGP surface and TOA fluxes are copied to fields that persist between radiation/physics
-!! calls.
-!!
-!! (optional) Save additional diagnostics.
-!!
-!! \section GFS_rrtmgp_sw_post_run
- ! #########################################################################################
-  subroutine GFS_rrtmgp_sw_post_run (nCol, nLev, nDay, idxday, lsswr, do_sw_clrsky_hr,      &
-       save_diag, fhswr,  coszen, coszdg, t_lay, p_lev, sfc_alb_nir_dir, sfc_alb_nir_dif,   &
-       sfc_alb_uvvis_dir, sfc_alb_uvvis_dif, fluxswUP_allsky,                               &
-       fluxswDOWN_allsky, fluxswUP_clrsky, fluxswDOWN_clrsky, raddt, aerodp, cldsa, mbota,  &
-       mtopa, cld_frac, cldtausw, fluxr, iSFC, iTOA,                                        &
-       nirbmdi, nirdfdi, visbmdi, visdfdi, nirbmui, nirdfui, visbmui, visdfui, sfcnsw,      &
-       sfcdsw, htrsw, sfcfsw, topfsw, htrswc, scmpsw, errmsg, errflg)
-
-    ! Inputs
-    integer, intent(in) ::  &
-         nCol,              & ! Horizontal loop extent
-         nLev,              & ! Number of vertical layers
-         nDay,              & ! Number of daylit columns
-         iSFC,              & ! Vertical index for surface level
-         iTOA                 ! Vertical index for TOA level
-    integer, intent(in), dimension(nday) :: &
-         idxday               ! Index array for daytime points
-    logical, intent(in) ::  &
-         lsswr,             & ! Call SW radiation?
-         do_sw_clrsky_hr,   & ! Output clear-sky SW heating-rate?
-         save_diag            ! Output radiation diagnostics?
-    real(kind_phys), intent(in) :: &
-         fhswr                ! Frequency for SW radiation
-    real(kind_phys), dimension(nCol), intent(in) :: &
-         t_lay,             & ! Temperature at model layer centers (K)
-         coszen,            & ! Cosine(SZA)
-         coszdg               ! Cosine(SZA), daytime
-    real(kind_phys), dimension(nCol, nLev+1), intent(in) :: &
-         p_lev                ! Pressure @ model layer-interfaces    (Pa)
-    real(kind_phys), dimension(ncol), intent(in) :: &
-         sfc_alb_nir_dir,   & ! Surface albedo (direct) 
-         sfc_alb_nir_dif,   & ! Surface albedo (diffuse)
-         sfc_alb_uvvis_dir, & ! Surface albedo (direct)
-         sfc_alb_uvvis_dif    ! Surface albedo (diffuse)
-    real(kind_phys), dimension(nCol, nLev+1), intent(in) :: &
-         fluxswUP_allsky,   & ! SW All-sky flux                    (W/m2)
-         fluxswDOWN_allsky, & ! SW All-sky flux                    (W/m2)
-         fluxswUP_clrsky,   & ! SW Clear-sky flux                  (W/m2)
-         fluxswDOWN_clrsky    ! SW All-sky flux                    (W/m2)
-    real(kind_phys), intent(in) :: &
-         raddt                ! Radiation time step
-    real(kind_phys), dimension(nCol,NSPC1), intent(in) :: &
-         aerodp               ! Vertical integrated optical depth for various aerosol species
-    real(kind_phys), dimension(nCol,5), intent(in) :: &
-         cldsa                ! Fraction of clouds for low, middle, high, total and BL
-    integer,         dimension(nCol,3), intent(in) ::&
-         mbota,             & ! vertical indices for low, middle and high cloud tops 
-         mtopa                ! vertical indices for low, middle and high cloud bases
-    real(kind_phys), dimension(nCol,nLev), intent(in) :: &
-         cld_frac,          & ! Total cloud fraction in each layer
-         cldtausw             ! approx .55mu band layer cloud optical depth
-    type(cmpfsw_type), dimension(nCol), intent(in) :: &
-         scmpsw           ! 2D surface fluxes, components:
-                          ! uvbfc - total sky downward uv-b flux at  (W/m2)
-                          ! uvbf0 - clear sky downward uv-b flux at  (W/m2)
-                          ! nirbm - downward nir direct beam flux    (W/m2)
-                          ! nirdf - downward nir diffused flux       (W/m2)
-                          ! visbm - downward uv+vis direct beam flux (W/m2)
-                          ! visdf - downward uv+vis diffused flux    (W/m2)
-
-    real(kind=kind_phys), dimension(:,:), intent(inout) :: fluxr
-
-    ! Outputs (mandatory)
-    real(kind_phys), dimension(nCol), intent(inout) :: &
-         nirbmdi,           & ! sfc nir beam sw downward flux    (W/m2)
-         nirdfdi,           & ! sfc nir diff sw downward flux    (W/m2)
-         visbmdi,           & ! sfc uv+vis beam sw downward flux (W/m2)
-         visdfdi,           & ! sfc uv+vis diff sw downward flux (W/m2)
-         nirbmui,           & ! sfc nir beam sw upward flux      (W/m2)
-         nirdfui,           & ! sfc nir diff sw upward flux      (W/m2)
-         visbmui,           & ! sfc uv+vis beam sw upward flux   (W/m2)
-         visdfui,           & ! sfc uv+vis diff sw upward flux   (W/m2)
-         sfcnsw,            & ! total sky sfc netsw flx into ground
-         sfcdsw               !
-    real(kind_phys), dimension(nCol,nLev), intent(inout) :: &
-         htrsw                ! SW all-sky heating rate
-    type(sfcfsw_type), dimension(nCol), intent(inout) :: &
-         sfcfsw               ! sw radiation fluxes at sfc
-    type(topfsw_type), dimension(nCol), intent(inout) :: &
-         topfsw               ! sw_fluxes_top_atmosphere
-    character(len=*), intent(out) :: &
-         errmsg
-    integer, intent(out) :: &
-         errflg
-
-    ! Outputs (optional)
-    real(kind_phys),dimension(nCol, nLev),intent(inout),optional :: &
-         htrswc           ! Clear-sky heating rate (K/s)
-
-    ! Local variables
-    integer :: i, j, k, itop, ibtc
-    real(kind_phys) :: tem0d, tem1, tem2
-    real(kind_phys), dimension(nDay, nLev) :: thetaTendClrSky, thetaTendAllSky
-
-    ! Initialize CCPP error handling variables
-    errmsg = ''
-    errflg = 0
-
-    if (.not. lsswr) return
-    if (nDay .gt. 0) then
-
-       ! #######################################################################################
-       ! Compute SW heating-rates
-       ! #######################################################################################
-       ! Clear-sky heating-rate (optional)
-       if (do_sw_clrsky_hr) then
-          htrswc(:,:) = 0._kind_phys
-          call check_error_msg('GFS_rrtmgp_post',compute_heating_rate( &
-               fluxswUP_clrsky(idxday(1:nDay),:),   & ! IN  - Shortwave upward clear-sky flux profiles (W/m2)
-               fluxswDOWN_clrsky(idxday(1:nDay),:), & ! IN  - Shortwave downward clear-sky flux profiles (W/m2)
-               p_lev(idxday(1:nDay),:),             & ! IN  - Pressure at model-interface (Pa)
-               thetaTendClrSky))                      ! OUT - Clear-sky heating-rate (K/sec)
-          htrswc(idxday(1:nDay),:)=thetaTendClrSky !**NOTE** GP doesn't use radiation levels, it uses the model fields. Not sure if this is necessary
-       endif
-
-       ! All-sky heating-rate (mandatory)
-       htrsw(:,:) = 0._kind_phys
-       call check_error_msg('GFS_rrtmgp_post',compute_heating_rate(    &
-            fluxswUP_allsky(idxday(1:nDay),:),      & ! IN  - Shortwave upward all-sky flux profiles (W/m2)
-            fluxswDOWN_allsky(idxday(1:nDay),:),    & ! IN  - Shortwave downward all-sky flux profiles (W/m2)
-            p_lev(idxday(1:nDay),:),                & ! IN  - Pressure at model-interface (Pa)
-            thetaTendAllSky))                         ! OUT - All-sky heating-rate (K/sec)
-       htrsw(idxday(1:nDay),:) = thetaTendAllSky
-
-       ! #######################################################################################
-       ! Save SW outputs
-       ! (Copy fluxes from RRTMGP types into model radiation types.)
-       ! #######################################################################################
-
-       ! TOA fluxes
-       topfsw(:)%upfxc = fluxswUP_allsky(:,iTOA)
-       topfsw(:)%upfx0 = fluxswUP_clrsky(:,iTOA)
-       topfsw(:)%dnfxc = fluxswDOWN_allsky(:,iTOA)
-
-       ! Surface fluxes
-       sfcfsw(:)%upfxc = fluxswUP_allsky(:,iSFC)
-       sfcfsw(:)%upfx0 = fluxswUP_clrsky(:,iSFC)
-       sfcfsw(:)%dnfxc = fluxswDOWN_allsky(:,iSFC)
-       sfcfsw(:)%dnfx0 = fluxswDOWN_clrsky(:,iSFC)
-
-       ! Surface down and up spectral component fluxes
-       ! - Save two spectral bands' surface downward and upward fluxes for output.
-       do i=1,nCol
-          nirbmdi(i) = scmpsw(i)%nirbm
-          nirdfdi(i) = scmpsw(i)%nirdf
-          visbmdi(i) = scmpsw(i)%visbm
-          visdfdi(i) = scmpsw(i)%visdf
-          nirbmui(i) = scmpsw(i)%nirbm * sfc_alb_nir_dir(i)
-          nirdfui(i) = scmpsw(i)%nirdf * sfc_alb_nir_dif(i)
-          visbmui(i) = scmpsw(i)%visbm * sfc_alb_uvvis_dir(i)
-          visdfui(i) = scmpsw(i)%visdf * sfc_alb_uvvis_dif(i)
-       enddo
-    else                   ! if_nday_block
-       ! #######################################################################################
-       ! Dark everywhere
-       ! #######################################################################################
-       htrsw(:,:) = 0.0
-       sfcfsw     = sfcfsw_type( 0.0, 0.0, 0.0, 0.0 )
-       topfsw     = topfsw_type( 0.0, 0.0, 0.0 )
-       do i=1,nCol
-          nirbmdi(i) = 0.0
-          nirdfdi(i) = 0.0
-          visbmdi(i) = 0.0
-          visdfdi(i) = 0.0
-          nirbmui(i) = 0.0
-          nirdfui(i) = 0.0
-          visbmui(i) = 0.0
-          visdfui(i) = 0.0
-       enddo
-
-       if (do_sw_clrsky_hr) then
-          htrswc(:,:) = 0
-       endif
-    endif                  ! end_if_nday
-
-    ! Radiation fluxes for other physics processes
-    do i=1,nCol
-       sfcnsw(i) = sfcfsw(i)%dnfxc - sfcfsw(i)%upfxc
-       sfcdsw(i) = sfcfsw(i)%dnfxc
-    enddo
-
-    ! #######################################################################################
-    ! Save SW diagnostics
-    ! - For time averaged output quantities (including total-sky and clear-sky SW and LW 
-    !   fluxes at TOA and surface; conventional 3-domain cloud amount, cloud top and base 
-    !   pressure, and cloud top temperature; aerosols AOD, etc.), store computed results in
-    !   corresponding slots of array fluxr with appropriate time weights.
-    ! - Collect the fluxr data for wrtsfc
-    ! #######################################################################################
-    if (save_diag) then
-       do i=1,nCol
-          fluxr(i,34) = aerodp(i,1)  ! total aod at 550nm
-          fluxr(i,35) = aerodp(i,2)  ! DU aod at 550nm
-          fluxr(i,36) = aerodp(i,3)  ! BC aod at 550nm
-          fluxr(i,37) = aerodp(i,4)  ! OC aod at 550nm
-          fluxr(i,38) = aerodp(i,5)  ! SU aod at 550nm
-          fluxr(i,39) = aerodp(i,6)  ! SS aod at 550nm
-          if (coszen(i) > 0.) then
-             ! SW all-sky fluxes
-             tem0d = fhswr * coszdg(i) / coszen(i)
-             fluxr(i,2 ) = fluxr(i,2)  + topfsw(i)%upfxc * tem0d  ! total sky top sw up
-             fluxr(i,3 ) = fluxr(i,3)  + sfcfsw(i)%upfxc * tem0d  
-             fluxr(i,4 ) = fluxr(i,4)  + sfcfsw(i)%dnfxc * tem0d  ! total sky sfc sw dn
-             ! SW uv-b fluxes
-             fluxr(i,21) = fluxr(i,21) + scmpsw(i)%uvbfc * tem0d  ! total sky uv-b sw dn
-             fluxr(i,22) = fluxr(i,22) + scmpsw(i)%uvbf0 * tem0d  ! clear sky uv-b sw dn
-             ! SW TOA incoming fluxes
-             fluxr(i,23) = fluxr(i,23) + topfsw(i)%dnfxc * tem0d  ! top sw dn 
-             ! SW SFC flux components
-             fluxr(i,24) = fluxr(i,24) + visbmdi(i) * tem0d       ! uv/vis beam sw dn
-             fluxr(i,25) = fluxr(i,25) + visdfdi(i) * tem0d       ! uv/vis diff sw dn
-             fluxr(i,26) = fluxr(i,26) + nirbmdi(i) * tem0d       ! nir beam sw dn
-             fluxr(i,27) = fluxr(i,27) + nirdfdi(i) * tem0d       ! nir diff sw dn
-             ! SW clear-sky fluxes
-             fluxr(i,29) = fluxr(i,29) + topfsw(i)%upfx0 * tem0d
-             fluxr(i,31) = fluxr(i,31) + sfcfsw(i)%upfx0 * tem0d
-             fluxr(i,32) = fluxr(i,32) + sfcfsw(i)%dnfx0 * tem0d
-          endif
-       enddo
-
-       ! Save total and boundary-layer clouds
-       do i=1,nCol
-          fluxr(i,17) = fluxr(i,17) + raddt * cldsa(i,4)
-          fluxr(i,18) = fluxr(i,18) + raddt * cldsa(i,5)
-       enddo
-
-       ! Save cld frac,toplyr,botlyr and top temp, note that the order of h,m,l cloud 
-       ! is reversed for the fluxr output. save interface pressure (pa) of top/bot
-       do j = 1, 3
-          do i = 1, nCol
-             tem0d = raddt * cldsa(i,j)
-             itop  = mtopa(i,j)
-             ibtc  = mbota(i,j)
-             fluxr(i, 8-j) = fluxr(i, 8-j) + tem0d
-             fluxr(i,11-j) = fluxr(i,11-j) + tem0d * p_lev(i,itop)
-             fluxr(i,14-j) = fluxr(i,14-j) + tem0d * p_lev(i,ibtc)
-             fluxr(i,17-j) = fluxr(i,17-j) + tem0d * p_lev(i,itop)
-
-             ! Add optical depth and emissivity output
-             tem1 = 0.
-             do k=ibtc,itop
-                tem1 = tem1 + cldtausw(i,k)      ! approx .55 mu channel
-             enddo
-             fluxr(i,43-j) = fluxr(i,43-j) + tem0d * tem1
-          enddo
-       enddo
-    endif
-  end subroutine GFS_rrtmgp_sw_post_run
-
-end module GFS_rrtmgp_sw_post
diff --git a/physics/GFS_rrtmgp_sw_pre.F90 b/physics/GFS_rrtmgp_sw_pre.F90
deleted file mode 100644
index 87d0f9ad1..000000000
--- a/physics/GFS_rrtmgp_sw_pre.F90
+++ /dev/null
@@ -1,95 +0,0 @@
-!> \file GFS_rrtmgp_sw_pre.F90
-!! This file contains code to gather the sunlit points for the RRTMGP shortwave scheme.
-!!
-!> \defgroup GFS_rrtmgp_sw_pre RRTMGP Shortwave pre
-!!
-!! \brief *TODO* Combine with rrtmg_sw_pre.F90, maybe call sw_rad_pre.F90, use by both.
-!!
-module GFS_rrtmgp_sw_pre
-  use machine,               only: kind_phys
-  use mo_gas_optics_rrtmgp,  only: ty_gas_optics_rrtmgp
-  use rrtmgp_sw_gas_optics,  only: sw_gas_props
-  public GFS_rrtmgp_sw_pre_run
-contains
-
-!> \section arg_table_GFS_rrtmgp_sw_pre_run
-!! \htmlinclude GFS_rrtmgp_sw_pre.html
-!!
-!! \section GFS_rrtmgp_sw_pre RRTMGP shortwave pre routine
-!! @{ 
-!! 
-!! Gather the sunlit points for shortwave radiation.
-!!
- ! #########################################################################################  
-  subroutine GFS_rrtmgp_sw_pre_run(nCol, doSWrad, coszen, nday, idxday, sfc_alb_nir_dir,    &
-       sfc_alb_nir_dif, sfc_alb_uvvis_dir, sfc_alb_uvvis_dif, sfc_alb_nir_dir_byband,       &
-       sfc_alb_nir_dif_byband, sfc_alb_uvvis_dir_byband, sfc_alb_uvvis_dif_byband, errmsg,  &
-       errflg)
-
-    ! Input
-    integer, intent(in)    :: &
-         nCol                 ! Number of horizontal grid points
-    logical,intent(in) :: &
-         doSWrad              ! Call RRTMGP SW radiation?
-    real(kind_phys), dimension(:), intent(in) :: &
-         coszen
-    real(kind_phys), dimension(:), intent(in) :: &
-         sfc_alb_nir_dir,   & !
-         sfc_alb_nir_dif,   & !
-         sfc_alb_uvvis_dir, & !
-         sfc_alb_uvvis_dif    !
-
-    ! Outputs
-    integer, intent(out)   :: &
-         nday                 ! Number of daylit points
-    integer, dimension(:), intent(out) :: &
-         idxday               ! Indices for daylit points
-    real(kind_phys), dimension(:,:), intent(out) :: &
-         sfc_alb_nir_dir_byband,   & ! Surface albedo (direct)
-         sfc_alb_nir_dif_byband,   & ! Surface albedo (diffuse)
-         sfc_alb_uvvis_dir_byband, & ! Surface albedo (direct)
-         sfc_alb_uvvis_dif_byband    ! Surface albedo (diffuse)
-    character(len=*), intent(out) :: &
-         errmsg               ! Error message
-    integer, intent(out) :: &
-         errflg               ! Error flag
-
-    ! Local variables
-    integer :: i, iBand
-
-    ! Initialize CCPP error handling variables
-    errmsg = ''
-    errflg = 0
-
-    if (doSWrad) then
-       ! ####################################################################################
-       ! For SW gather daylit points
-       ! ####################################################################################
-       nday   = 0
-       idxday = 0
-       do i = 1, nCol
-          if (coszen(i) >= 0.0001) then
-             nday = nday + 1
-             idxday(nday) = i
-          endif
-       enddo
-
-       ! Spread across all SW bands
-       do iBand=1,sw_gas_props%get_nband()
-          sfc_alb_nir_dir_byband(iBand,1:nCol)   = sfc_alb_nir_dir(1:nCol)
-          sfc_alb_nir_dif_byband(iBand,1:nCol)   = sfc_alb_nir_dif(1:nCol)
-          sfc_alb_uvvis_dir_byband(iBand,1:nCol) = sfc_alb_uvvis_dir(1:nCol)
-          sfc_alb_uvvis_dif_byband(iBand,1:nCol) = sfc_alb_uvvis_dif(1:nCol)
-       enddo
-    else
-       nday                               = 0
-       idxday                             = 0
-       sfc_alb_nir_dir_byband(:,1:nCol)   = 0.
-       sfc_alb_nir_dif_byband(:,1:nCol)   = 0.
-       sfc_alb_uvvis_dir_byband(:,1:nCol) = 0.
-       sfc_alb_uvvis_dif_byband(:,1:nCol) = 0.
-    endif
-
-  end subroutine GFS_rrtmgp_sw_pre_run
-!> @}
-end module GFS_rrtmgp_sw_pre
diff --git a/physics/GFS_rrtmgp_sw_pre.meta b/physics/GFS_rrtmgp_sw_pre.meta
deleted file mode 100644
index 462ab5f18..000000000
--- a/physics/GFS_rrtmgp_sw_pre.meta
+++ /dev/null
@@ -1,124 +0,0 @@
-[ccpp-table-properties]
-  name = GFS_rrtmgp_sw_pre
-  type = scheme
-  dependencies = machine.F,radiation_astronomy.f,rrtmgp_sw_gas_optics.F90,rte-rrtmgp/rrtmgp/mo_gas_optics_rrtmgp.F90,
-
-########################################################################
-[ccpp-arg-table]
-  name = GFS_rrtmgp_sw_pre_run
-  type = scheme
-[ncol]
-  standard_name = horizontal_loop_extent
-  long_name = horizontal loop extent
-  units = count
-  dimensions = ()
-  type = integer
-  intent = in
-[doSWrad]
-  standard_name = flag_for_calling_shortwave_radiation
-  long_name = logical flags for sw radiation calls
-  units = flag
-  dimensions = ()
-  type = logical
-  intent = in
-[nday]
-  standard_name = daytime_points_dimension
-  long_name = daytime points dimension
-  units = count
-  dimensions = ()
-  type = integer
-  intent = out
-[idxday]
-  standard_name = daytime_points
-  long_name = daytime points
-  units = index
-  dimensions = (horizontal_loop_extent)
-  type = integer
-  intent = out
-[coszen]
-  standard_name = cosine_of_solar_zenith_angle_for_daytime_points_on_radiation_timestep
-  long_name = mean cos of zenith angle over rad call period
-  units = none
-  dimensions = (horizontal_loop_extent)
-  type = real
-  kind = kind_phys
-  intent = in
-[sfc_alb_nir_dir]
-  standard_name = surface_albedo_due_to_near_IR_direct
-  long_name = surface albedo due to near IR direct beam
-  units = frac
-  dimensions = (horizontal_loop_extent)
-  type = real
-  kind = kind_phys
-  intent = in
-[sfc_alb_nir_dif]
-  standard_name = surface_albedo_due_to_near_IR_diffused
-  long_name = surface albedo due to near IR diffused beam
-  units = frac
-  dimensions = (horizontal_loop_extent)
-  type = real
-  kind = kind_phys
-  intent = in
-[sfc_alb_uvvis_dir]
-  standard_name = surface_albedo_due_to_UV_and_VIS_direct
-  long_name = surface albedo due to UV+VIS direct beam
-  units = frac
-  dimensions = (horizontal_loop_extent)
-  type = real
-  kind = kind_phys
-  intent = in
-[sfc_alb_uvvis_dif]
-  standard_name = surface_albedo_due_to_UV_and_VIS_diffused
-  long_name = surface albedo due to UV+VIS diffused beam
-  units = frac
-  dimensions = (horizontal_loop_extent)
-  type = real
-  kind = kind_phys
-  intent = in
-[sfc_alb_nir_dir_byband]
-  standard_name = surface_albedo_nearIR_direct
-  long_name = near-IR (direct) surface albedo (sfc_alb_nir_dir)
-  units = none
-  dimensions = (number_of_shortwave_bands,horizontal_loop_extent)
-  type = real
-  kind = kind_phys
-  intent = out
-[sfc_alb_nir_dif_byband]
-  standard_name = surface_albedo_nearIR_diffuse
-  long_name = near-IR (diffuse) surface albedo (sfc_alb_nir_dif)
-  units = none
-  dimensions = (number_of_shortwave_bands,horizontal_loop_extent)
-  type = real
-  kind = kind_phys
-  intent = out
-[sfc_alb_uvvis_dir_byband]
-  standard_name =  surface_albedo_uvvis_direct
-  long_name = UVVIS (direct) surface albedo (sfc_alb_uvvis_dir)
-  units = none
-  dimensions = (number_of_shortwave_bands,horizontal_loop_extent)
-  type = real
-  kind = kind_phys
-  intent = out
-[sfc_alb_uvvis_dif_byband]
-  standard_name =  surface_albedo_uvvis_diffuse
-  long_name = UVVIS (diffuse) surface albedo (sfc_alb_uvvis_dif)
-  units = none
-  dimensions = (number_of_shortwave_bands,horizontal_loop_extent)
-  type = real
-  kind = kind_phys
-  intent = out
-[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
diff --git a/physics/rrtmgp_aerosol_optics.F90 b/physics/rrtmgp_aerosol_optics.F90
index e2cc95994..cf3f7deea 100644
--- a/physics/rrtmgp_aerosol_optics.F90
+++ b/physics/rrtmgp_aerosol_optics.F90
@@ -3,16 +3,10 @@
 
 module rrtmgp_aerosol_optics
   use machine,                   only: kind_phys
-  use mo_gas_optics_rrtmgp,      only: ty_gas_optics_rrtmgp
-  use mo_optical_props,          only: ty_optical_props_2str, ty_optical_props_1scl
   use radiation_tools,           only: check_error_msg
   use rrtmgp_sw_gas_optics,      only: sw_gas_props
   use rrtmgp_lw_gas_optics,      only: lw_gas_props
-  use module_radiation_aerosols, only: &
-       NF_AESW,                  & ! Number of optical-fields in SW output (3=tau+g+omega)
-       NF_AELW,                  & ! Number of optical-fields in LW output (3=tau+g+omega)
-       setaer,                   & ! Routine to compute aerosol radiative properties (tau,g,omega)
-       NSPC1                       ! Number of species for vertically integrated aerosol optical-depth
+  use module_radiation_aerosols, only: setaer
   use netcdf
 
   implicit none
@@ -30,9 +24,9 @@ module rrtmgp_aerosol_optics
 !! \section arg_table_rrtmgp_aerosol_optics_run
 !! \htmlinclude rrtmgp_aerosol_optics_run.html
 !!
-  subroutine rrtmgp_aerosol_optics_run(doSWrad, doLWrad, nCol, nLev, nTracer, nTracerAer,   &
-       nDay, idxday, p_lev, p_lay, p_lk, tv_lay, relhum, lsmask, tracer, aerfld, lon, lat,  &
-       aerodp, sw_optical_props_aerosol, lw_optical_props_aerosol, errmsg, errflg       )
+  subroutine rrtmgp_aerosol_optics_run(doSWrad, doLWrad, nCol, nLev, nDay, idxday, p_lev,   &
+       p_lay, p_lk, tv_lay, relhum, lsmask, tracer, aerfld, lon, lat,                       &
+       aerodp, aerlw_tau, aerlw_ssa, aerlw_g, aersw_tau, aersw_ssa, aersw_g, errmsg, errflg )
 
     ! Inputs
     logical, intent(in) :: &
@@ -41,10 +35,8 @@ subroutine rrtmgp_aerosol_optics_run(doSWrad, doLWrad, nCol, nLev, nTracer, nTra
     integer, intent(in) :: &
          nCol,                  & ! Number of horizontal grid points
          nDay,                  & ! Number of daylit points
-         nLev,                  & ! Number of vertical layers
-         nTracer,               & ! Number of tracers
-         nTracerAer               ! Number of aerosol tracers
-    integer,intent(in),dimension(:) :: &
+         nLev                     ! Number of vertical layers
+    integer,dimension(:), intent(in) :: &
          idxday              ! Indices for daylit points.
     real(kind_phys), dimension(:), intent(in) :: &
          lon,                   & ! Longitude
@@ -65,19 +57,22 @@ subroutine rrtmgp_aerosol_optics_run(doSWrad, doLWrad, nCol, nLev, nTracer, nTra
     ! Outputs
     real(kind_phys), dimension(:,:), intent(out) :: &
          aerodp                   ! Vertical integrated optical depth for various aerosol species 
-    type(ty_optical_props_2str),intent(out) :: &
-         sw_optical_props_aerosol ! RRTMGP DDT: Longwave aerosol optical properties (tau)
-    type(ty_optical_props_1scl),intent(inout) :: &
-         lw_optical_props_aerosol ! RRTMGP DDT: Longwave aerosol optical properties (tau)
+    real(kind_phys), dimension(:,:,:), intent(out) :: &
+         aerlw_tau,             & ! Longwave aerosol optical depth
+         aerlw_ssa,             & ! Longwave aerosol single scattering albedo
+         aerlw_g,               & ! Longwave aerosol asymmetry parameter
+         aersw_tau,             & ! Shortwave aerosol optical depth 
+         aersw_ssa,             & ! Shortwave aerosol single scattering albedo
+         aersw_g                  ! Shortwave aerosol asymmetry parameter
     integer, intent(out) :: &
          errflg                   ! CCPP error flag
     character(len=*), intent(out) :: &
          errmsg                   ! CCPP error message
 
     ! Local variables
-    real(kind_phys), dimension(nCol, nLev, lw_gas_props%get_nband(), NF_AELW) :: &
+    real(kind_phys), dimension(nCol, nLev, lw_gas_props%get_nband(), 3) :: &
          aerosolslw            !
-    real(kind_phys), dimension(nCol, nLev, sw_gas_props%get_nband(), NF_AESW) :: &
+    real(kind_phys), dimension(nCol, nLev, sw_gas_props%get_nband(), 3) :: &
          aerosolssw, aerosolssw2
     integer :: iBand
 
@@ -85,14 +80,14 @@ subroutine rrtmgp_aerosol_optics_run(doSWrad, doLWrad, nCol, nLev, nTracer, nTra
     errmsg = ''
     errflg = 0
 
-    if (.not. doSWrad) return
+    if (.not. (doSWrad .or. doLWrad)) return
 
     ! Call module_radiation_aerosols::setaer(),to setup aerosols property profile
     call setaer(p_lev*0.01, p_lay*0.01, p_lk, tv_lay, relhum, lsmask, tracer, aerfld, lon, lat, nCol, nLev, &
          nLev+1, .true., .true., aerosolssw2, aerosolslw, aerodp)
 
     ! Shortwave
-    if (nDay .gt. 0) then
+    if (doSWrad .and. (nDay .gt. 0)) then
        ! Store aerosol optical properties
        ! SW. 
        ! For RRTMGP SW the bands are now ordered from [IR(band) -> nIR -> UV], in RRTMG the 
@@ -103,26 +98,19 @@ subroutine rrtmgp_aerosol_optics_run(doSWrad, doLWrad, nCol, nLev, nTracer, nTra
        aerosolssw(1:nCol,:,2:sw_gas_props%get_nband(),1) = aerosolssw2(1:nCol,:,1:sw_gas_props%get_nband()-1,1)
        aerosolssw(1:nCol,:,2:sw_gas_props%get_nband(),2) = aerosolssw2(1:nCol,:,1:sw_gas_props%get_nband()-1,2)
        aerosolssw(1:nCol,:,2:sw_gas_props%get_nband(),3) = aerosolssw2(1:nCol,:,1:sw_gas_props%get_nband()-1,3)
-       
-       ! Allocate RRTMGP DDT: Aerosol optics [nCol,nlev,nBands]
-       call check_error_msg('rrtmgp_aerosol_optics_run',sw_optical_props_aerosol%alloc_2str(      &
-            nDay, nlev, sw_gas_props%get_band_lims_wavenumber()))
-       
-       ! Copy aerosol optical information to RRTMGP DDT
-       sw_optical_props_aerosol%tau = aerosolssw(idxday(1:nday),:,:,1)
-       sw_optical_props_aerosol%ssa = aerosolssw(idxday(1:nday),:,:,2)
-       sw_optical_props_aerosol%g   = aerosolssw(idxday(1:nday),:,:,3)
+     
+       ! Copy aerosol optical information/
+       aersw_tau = aerosolssw(:,:,:,1)
+       aersw_ssa = aerosolssw(:,:,:,2)
+       aersw_g   = aerosolssw(:,:,:,3)
     endif
 
     ! Longwave
-    if (.not. doLWrad) return
-    lw_optical_props_aerosol%tau = aerosolslw(:,:,:,1) * (1. - aerosolslw(:,:,:,2))
-
-    lw_optical_props_aerosol%band_lims_wvn = lw_gas_props%get_band_lims_wavenumber()
-    do iBand=1,lw_gas_props%get_nband()
-       lw_optical_props_aerosol%band2gpt(1:2,iBand) = iBand
-       lw_optical_props_aerosol%gpt2band(iBand)     = iBand
-    end do
+    if (doLWrad) then
+       aerlw_tau = aerosolslw(:,:,:,1)
+       aerlw_ssa = aerosolslw(:,:,:,2)
+       aerlw_g   = aerosolslw(:,:,:,3)
+    endif
 
   end subroutine rrtmgp_aerosol_optics_run
 !> @}  
diff --git a/physics/rrtmgp_aerosol_optics.meta b/physics/rrtmgp_aerosol_optics.meta
index f0c37edc0..6dbf9c73c 100644
--- a/physics/rrtmgp_aerosol_optics.meta
+++ b/physics/rrtmgp_aerosol_optics.meta
@@ -35,20 +35,6 @@
   dimensions = ()
   type = integer
   intent = in
-[nTracer]
-  standard_name = number_of_tracers
-  long_name = number of tracers
-  units = count
-  dimensions = ()
-  type = integer
-  intent = in
-[nTracerAer]
-  standard_name = number_of_aerosol_tracers_MG
-  long_name = number of aerosol tracers for Morrison Gettelman MP
-  units = count
-  dimensions = ()
-  type = integer
-  intent = in
 [nday]
   standard_name = daytime_points_dimension
   long_name = daytime points dimension
@@ -112,9 +98,9 @@
   kind = kind_phys
   intent = in
 [tracer]
-  standard_name = chemical_tracers
-  long_name = chemical tracers
-  units = g g-1
+  standard_name = tracer_concentration
+  long_name = model layer mean tracer concentration
+  units = kg kg-1
   dimensions = (horizontal_loop_extent,vertical_layer_dimension,number_of_tracers)
   type = real
   kind = kind_phys
@@ -151,20 +137,54 @@
   type = real
   kind = kind_phys
   intent = out
-[sw_optical_props_aerosol]
-  standard_name = shortwave_optical_properties_for_aerosols
-  long_name = Fortran DDT containing RRTMGP optical properties
-  units = DDT
-  dimensions = ()
-  type = ty_optical_props_2str
+[aersw_tau]
+  standard_name = aerosol_optical_depth_for_shortwave_bands_01_16
+  long_name = aerosol optical depth for shortwave bands 01-16
+  units = none
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension,number_of_aerosol_bands_for_shortwave_radiation)
+  type = real
+  kind = kind_phys
+  intent = out
+[aersw_ssa]
+  standard_name = aerosol_single_scattering_albedo_for_shortwave_bands_01_16
+  long_name = aerosol single scattering albedo for shortwave bands 01-16
+  units = frac
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension,number_of_aerosol_bands_for_shortwave_radiation)
+  type = real
+  kind = kind_phys
+  intent = out
+[aersw_g]
+  standard_name = aerosol_asymmetry_parameter_for_shortwave_bands_01_16
+  long_name = aerosol asymmetry parameter for shortwave bands 01-16
+  units = none
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension,number_of_aerosol_bands_for_shortwave_radiation)
+  type = real
+  kind = kind_phys
+  intent = out
+[aerlw_tau]
+  standard_name = aerosol_optical_depth_for_longwave_bands_01_16
+  long_name = aerosol optical depth for longwave bands 01-16
+  units = none
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension,number_of_aerosol_bands_for_longwave_radiation)
+  type = real
+  kind = kind_phys
+  intent = out
+[aerlw_ssa]
+  standard_name = aerosol_single_scattering_albedo_for_longwave_bands_01_16
+  long_name = aerosol single scattering albedo for longwave bands 01-16
+  units = frac
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension,number_of_aerosol_bands_for_longwave_radiation)
+  type = real
+  kind = kind_phys
+  intent = out
+[aerlw_g]
+  standard_name = aerosol_asymmetry_parameter_for_longwave_bands_01_16
+  long_name = aerosol asymmetry parameter for longwave bands 01-16
+  units = none
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension,number_of_aerosol_bands_for_longwave_radiation)
+  type = real
+  kind = kind_phys
   intent = out
-[lw_optical_props_aerosol]
-  standard_name = longwave_optical_properties_for_aerosols
-  long_name = Fortran DDT containing RRTMGP optical properties
-  units = DDT
-  dimensions = ()
-  type = ty_optical_props_1scl
-  intent = inout
 [errmsg]
   standard_name = ccpp_error_message
   long_name = error message for error handling in CCPP
diff --git a/physics/rrtmgp_lw_cloud_optics.F90 b/physics/rrtmgp_lw_cloud_optics.F90
index 8bdd71696..9915c0040 100644
--- a/physics/rrtmgp_lw_cloud_optics.F90
+++ b/physics/rrtmgp_lw_cloud_optics.F90
@@ -12,8 +12,6 @@ module rrtmgp_lw_cloud_optics
   use machine,                  only: kind_phys
   use mo_rte_kind,              only: wl
   use mo_cloud_optics,          only: ty_cloud_optics
-  use mo_optical_props,         only: ty_optical_props_1scl, ty_optical_props_2str
-  use mo_rrtmg_lw_cloud_optics, only: rrtmg_lw_cloud_optics   
   use rrtmgp_lw_gas_optics,     only: lw_gas_props
   use radiation_tools,          only: check_error_msg
   use netcdf
@@ -74,55 +72,42 @@ module rrtmgp_lw_cloud_optics
 
 contains
 
-!>\defgroup rrtmgp_lw_cloud_optics_mod GFS RRTMGP-LW Cloud Optics Module
-!> \section arg_table_rrtmgp_lw_cloud_optics_init
-!! \htmlinclude rrtmgp_lw_cloud_optics.html
-!!
-!> \ingroup rrtmgp_lw_cloud_optics
-!!
-!! RRTMGP relies heavily on derived-data-types, which contain type-bound procedures
-!! that are referenced frequently throughout the RRTMGP longwave scheme. The data needed
-!! to compute the shortwave cloud optical properties are initialized here and loaded into
-!! the RRTMGP DDT, ty_cloud_optics.
-!!
-!! \section rrtmgp_sw_cloud_optics_init
-  subroutine rrtmgp_lw_cloud_optics_init(nrghice, mpicomm, mpirank, mpiroot,             &
-       doG_cldoptics, doGP_cldoptics_PADE, doGP_cldoptics_LUT, rrtmgp_root_dir,          &
-       rrtmgp_lw_file_clouds, errmsg, errflg)
+  ! ######################################################################################
+  ! SUBROUTINE rrtmgp_lw_cloud_optics_init()
+  ! ######################################################################################
+  subroutine rrtmgp_lw_cloud_optics_init(rrtmgp_root_dir, rrtmgp_lw_file_clouds,         &
+       doGP_cldoptics_PADE, doGP_cldoptics_LUT, nrghice, mpicomm, mpirank, mpiroot,      &
+       errmsg, errflg)
 
     ! Inputs
+    character(len=128),intent(in) :: &
+         rrtmgp_root_dir,    & ! RTE-RRTMGP root directory
+         rrtmgp_lw_file_clouds ! RRTMGP file containing clouds optics data
+
     logical, intent(in) :: &
-         doG_cldoptics,                 & ! Use legacy RRTMG cloud-optics?
-         doGP_cldoptics_PADE,           & ! Use RRTMGP cloud-optics: PADE approximation?
-         doGP_cldoptics_LUT               ! Use RRTMGP cloud-optics: LUTs?
+         doGP_cldoptics_PADE,& ! Use RRTMGP cloud-optics: PADE approximation?
+         doGP_cldoptics_LUT    ! Use RRTMGP cloud-optics: LUTs?
     integer, intent(inout) :: &
-         nrghice                          ! Number of ice-roughness categories
+         nrghice               ! Number of ice-roughness categories
     integer, intent(in) :: & 
-         mpicomm,                       & ! MPI communicator
-         mpirank,                       & ! Current MPI rank
-         mpiroot                          ! Master MPI rank
-    character(len=128),intent(in) :: &
-         rrtmgp_root_dir,               & ! RTE-RRTMGP root directory
-         rrtmgp_lw_file_clouds            ! RRTMGP file containing coefficients used to compute clouds optical properties
+         mpicomm,            & ! MPI communicator
+         mpirank,            & ! Current MPI rank
+         mpiroot               ! Master MPI rank
 
     ! Outputs
     character(len=*), intent(out) :: &
-         errmsg                           ! Error message
+         errmsg                ! Error message
     integer,          intent(out) :: &
-         errflg                           ! Error code
+         errflg                ! Error code
 
     ! Local variables
     integer :: dimID,varID,status,ncid,mpierr
     character(len=264) :: lw_cloud_props_file
-    integer,parameter :: max_strlen=256, nrghice_default=2
 
     ! Initialize
     errmsg = ''
     errflg = 0
 
-    ! If not using RRTMGP cloud optics, return.
-    if (doG_cldoptics) return
-    
     ! Filenames are set in the physics_nml
     lw_cloud_props_file = trim(rrtmgp_root_dir)//trim(rrtmgp_lw_file_clouds)
 
@@ -391,171 +376,4 @@ subroutine rrtmgp_lw_cloud_optics_init(nrghice, mpicomm, mpirank, mpiroot,
     call check_error_msg('lw_cloud_optics_init',lw_cloud_props%set_ice_roughness(nrghice))
  
   end subroutine rrtmgp_lw_cloud_optics_init
-  ! ######################################################################################
-!> \section arg_table_rrtmgp_lw_cloud_optics_run
-!! \htmlinclude rrtmgp_lw_cloud_optics.html
-!!
-!> \ingroup rrtmgp_lw_cloud_optics
-!!
-!! Compute longwave optical prperties (optical-depth) for ALL cloud types visible to RRTMGP.                                                                                                                                   
-!!
-!! \section rrtmgp_lw_gas_optics_run
-  subroutine rrtmgp_lw_cloud_optics_run(doLWrad, doG_cldoptics, icliq_lw, icice_lw,      &
-       doGP_cldoptics_PADE, doGP_cldoptics_LUT, doGP_lwscat, do_mynnedmf, imfdeepcnv,    &
-       imfdeepcnv_gf, imfdeepcnv_samf, nCol, nLev, nbndsGPlw , p_lay, cld_frac, cld_lwp, &
-       cld_reliq, cld_iwp, cld_reice, cld_swp, cld_resnow, cld_rwp, cld_rerain,          &
-       precip_frac, cld_cnv_lwp, cld_cnv_reliq, cld_cnv_iwp, cld_cnv_reice, cld_pbl_lwp, &
-       cld_pbl_reliq, cld_pbl_iwp, cld_pbl_reice, lon, lat, cldtaulw,                    &
-       lw_optical_props_cloudsByBand, lw_optical_props_cnvcloudsByBand,                  &
-       lw_optical_props_MYNNcloudsByBand, lw_optical_props_precipByBand, errmsg, errflg)
-    
-    ! Inputs
-    logical, intent(in) :: &
-         doLWrad,             & ! Logical flag for longwave radiation call
-         doG_cldoptics,       & ! Use legacy RRTMG cloud-optics?
-         doGP_cldoptics_PADE, & ! Use RRTMGP cloud-optics: PADE approximation?
-         doGP_cldoptics_LUT,  & ! Use RRTMGP cloud-optics: LUTs?
-         doGP_lwscat,         & ! Include scattering in LW cloud-optics?
-         do_mynnedmf            !
-    integer, intent(in) ::    &
-         nbndsGPlw,           & !
-         nCol,                & ! Number of horizontal gridpoints
-         nLev,                & ! Number of vertical levels
-         icliq_lw,            & ! Choice of treatment of liquid cloud optical properties (RRTMG legacy)
-         icice_lw,            & ! Choice of treatment of ice cloud optical properties (RRTMG legacy) 
-         imfdeepcnv,          & ! 
-         imfdeepcnv_gf,       & ! 
-         imfdeepcnv_samf        ! 
-    real(kind_phys), dimension(:), intent(in) :: &
-         lon,                 & ! Longitude
-         lat                    ! Latitude
-    real(kind_phys), dimension(:,:),intent(in) :: &
-         p_lay,               & ! Layer pressure (Pa)
-         cld_frac,            & ! Total cloud fraction by layer
-         cld_lwp,             & ! Cloud liquid water path
-         cld_reliq,           & ! Cloud liquid effective radius
-         cld_iwp,             & ! Cloud ice water path
-         cld_reice,           & ! Cloud ice effective radius
-         cld_swp,             & ! Cloud snow water path       
-         cld_resnow,          & ! Cloud snow effective radius 
-         cld_rwp,             & ! Cloud rain water path      
-         cld_rerain,          & ! Cloud rain effective radius 
-         precip_frac,         & ! Precipitation fraction by layer.
-         cld_cnv_lwp,         & ! Water path for       convective liquid cloud-particles (microns) 
-         cld_cnv_reliq,       & ! Effective radius for convective liquid cloud-particles (microns)
-         cld_cnv_iwp,         & ! Water path for       convective ice cloud-particles (microns)
-         cld_cnv_reice,       & ! Effective radius for convective ice cloud-particles (microns) 
-         cld_pbl_lwp,         & ! Water path for       SGS PBL liquid cloud-particles
-         cld_pbl_reliq,       & ! Effective radius for SGS PBL liquid cloud-particles
-         cld_pbl_iwp,         & ! Water path for       SGS PBL ice    cloud-particles
-         cld_pbl_reice          ! Effective radius for SGS PBL ice    cloud-particles
- 
-    ! Outputs
-    character(len=*), intent(out) :: &
-         errmsg                             ! CCPP error message
-    integer, intent(out) :: &
-         errflg                             ! CCPP error flag
-    type(ty_optical_props_2str),intent(inout) :: &
-         lw_optical_props_cloudsByBand,     & ! RRTMGP DDT: Longwave optical properties in each band (clouds)
-         lw_optical_props_cnvcloudsByBand,  & ! RRTMGP DDT: Longwave optical properties in each band (convective cloud)
-         lw_optical_props_MYNNcloudsByBand, & ! RRTMGP DDT: Longwave optical properties in each band (MYNN-PBL cloud)
-         lw_optical_props_precipByBand        ! RRTMGP DDT: Longwave optical properties in each band (precipitation)
-    real(kind_phys), dimension(:,:), intent(inout) :: &
-         cldtaulw                           ! Approx 10.mu band layer cloud optical depth  
-         
-    ! Local variables
-    real(kind_phys) :: tau_rain, tau_snow
-    real(kind_phys), dimension(ncol,nLev,nbndsGPlw) :: &
-         tau_cld, tau_precip
-    integer :: iCol, iLay, iBand
-
-    ! Initialize CCPP error handling variables
-    errmsg = ''
-    errflg = 0
-    
-    ! Initialize locals
-    tau_cld    = 0._kind_phys
-    tau_precip = 0._kind_phys
-
-    if (.not. doLWrad) return
-
-    ! Compute cloud-optics for RTE.
-    if (doGP_cldoptics_PADE .or. doGP_cldoptics_LUT) then
-       
-       ! i) Cloud-optics.
-       lw_optical_props_cloudsByBand%band_lims_wvn     = lw_gas_props%get_band_lims_wavenumber()
-       do iBand=1,lw_gas_props%get_nband()
-          lw_optical_props_cloudsByBand%band2gpt(1:2,iBand)     = iBand
-          lw_optical_props_cloudsByBand%gpt2band(iBand)         = iBand
-       end do
-       call check_error_msg('rrtmgp_lw_cloud_optics_run - clouds',lw_cloud_props%cloud_optics(&
-            cld_lwp,                           & ! IN  - Cloud liquid water path (g/m2)
-            cld_iwp,                           & ! IN  - Cloud ice water path (g/m2)
-            cld_reliq,                         & ! IN  - Cloud liquid effective radius (microns)
-            cld_reice,                         & ! IN  - Cloud ice effective radius (microns)
-            lw_optical_props_cloudsByBand))      ! OUT - RRTMGP DDT containing cloud radiative properties
-                                                 !       in each band
-       ! ii) Convective cloud-optics
-       if (imfdeepcnv == imfdeepcnv_samf .or. imfdeepcnv == imfdeepcnv_gf) then
-          lw_optical_props_cnvcloudsByBand%band_lims_wvn = lw_gas_props%get_band_lims_wavenumber()
-          do iBand=1,lw_gas_props%get_nband()
-             lw_optical_props_cnvcloudsByBand%band2gpt(1:2,iBand) = iBand
-             lw_optical_props_cnvcloudsByBand%gpt2band(iBand)     = iBand
-          end do
-          call check_error_msg('rrtmgp_lw_cnvcloud_optics_run - convective cloud',lw_cloud_props%cloud_optics(&
-               cld_cnv_lwp,                       & ! IN  - Convective cloud liquid water path (g/m2)
-               cld_cnv_iwp,                       & ! IN  - Convective cloud ice water path (g/m2)
-               cld_cnv_reliq,                     & ! IN  - Convective cloud liquid effective radius (microns)
-               cld_cnv_reice,                     & ! IN  - Convective cloud ice effective radius (microns)
-               lw_optical_props_cnvcloudsByBand))   ! OUT - RRTMGP DDT containing convective cloud radiative properties
-                                                    !       in each band
-       endif
-
-       ! iii) MYNN cloud-optics
-       if (do_mynnedmf) then
-          lw_optical_props_MYNNcloudsByBand%band_lims_wvn = lw_gas_props%get_band_lims_wavenumber()
-          do iBand=1,lw_gas_props%get_nband()
-             lw_optical_props_MYNNcloudsByBand%band2gpt(1:2,iBand) = iBand
-             lw_optical_props_MYNNcloudsByBand%gpt2band(iBand)     = iBand
-          end do
-          call check_error_msg('rrtmgp_lw_MYNNcloud_optics_run - MYNN-EDMF cloud',lw_cloud_props%cloud_optics(&
-               cld_pbl_lwp,                       & ! IN  - MYNN-EDMF PBL cloud liquid water path (g/m2)
-               cld_pbl_iwp,                       & ! IN  - MYNN-EDMF PBL cloud ice water path (g/m2)
-               cld_pbl_reliq,                     & ! IN  - MYNN-EDMF PBL cloud liquid effective radius (microns)
-               cld_pbl_reice,                     & ! IN  - MYNN-EDMF PBL cloud ice effective radius (microns)
-               lw_optical_props_MYNNcloudsByBand))   ! OUT - RRTMGP DDT containing MYNN-EDMF PBL  cloud radiative properties
-                                                     !       in each band
-       endif
-
-       ! iv) Cloud precipitation optics: rain and snow(+groupel)   
-       lw_optical_props_precipByBand%band_lims_wvn     = lw_gas_props%get_band_lims_wavenumber()
-       do iBand=1,lw_gas_props%get_nband()
-          lw_optical_props_precipByBand%band2gpt(1:2,iBand)     = iBand
-          lw_optical_props_precipByBand%gpt2band(iBand)         = iBand
-       end do
-       do iCol=1,nCol
-          do iLay=1,nLev                                      
-             if (cld_frac(iCol,iLay) .gt. 0.) then
-                ! Rain optical-depth (No band dependence)
-                tau_rain = absrain*cld_rwp(iCol,iLay)
-                
-                ! Snow (+groupel) optical-depth (No band dependence)
-                if (cld_swp(iCol,iLay) .gt. 0. .and. cld_resnow(iCol,iLay) .gt. 10._kind_phys) then
-                   tau_snow = abssnow0*1.05756*cld_swp(iCol,iLay)/cld_resnow(iCol,iLay)
-                else
-                   tau_snow = 0.0
-                endif
-                do iBand=1,nbndsGPlw
-                   lw_optical_props_precipByBand%tau(iCol,iLay,iBand) = tau_rain + tau_snow
-                enddo
-             endif
-          enddo
-       enddo
-    endif
-
-    ! All-sky LW optical depth ~10microns (DJS asks: Same as SW, move to cloud-diagnostics?)
-    cldtaulw = lw_optical_props_cloudsByBand%tau(:,:,7)
-        
-  end subroutine rrtmgp_lw_cloud_optics_run
-  
 end module rrtmgp_lw_cloud_optics
diff --git a/physics/rrtmgp_lw_cloud_optics.meta b/physics/rrtmgp_lw_cloud_optics.meta
deleted file mode 100644
index c58496dc5..000000000
--- a/physics/rrtmgp_lw_cloud_optics.meta
+++ /dev/null
@@ -1,412 +0,0 @@
-[ccpp-table-properties]
-  name = rrtmgp_lw_cloud_optics
-  type = scheme
-  dependencies = machine.F,rrtmg_lw_cloud_optics.F90,radiation_tools.F90
-
-########################################################################
-[ccpp-arg-table]
-  name = rrtmgp_lw_cloud_optics_init
-  type = scheme
-[doG_cldoptics]
-  standard_name = flag_to_calc_lw_cld_optics_using_RRTMG
-  long_name = logical flag to control cloud optics scheme.
-  units = flag
-  dimensions = ()
-  type = logical
-  intent = in
-[doGP_cldoptics_PADE]
-  standard_name = flag_to_calc_lw_cld_optics_using_RRTMGP_PADE
-  long_name = logical flag to control cloud optics scheme.
-  units = flag
-  dimensions = ()
-  type = logical
-  intent = in
-[doGP_cldoptics_LUT]
-  standard_name = flag_to_calc_lw_cld_optics_using_RRTMGP_LUT
-  long_name = logical flag to control cloud optics scheme.
-  units = flag
-  dimensions = ()
-  type = logical
-  intent = in
-[nrghice]
-  standard_name = number_of_ice_roughness_categories
-  long_name = number of ice-roughness categories in RRTMGP calculation
-  units = count
-  dimensions =  ()
-  type = integer
-  intent = inout
-[rrtmgp_root_dir]
-  standard_name = directory_for_rte_rrtmgp_source_code
-  long_name = directory for rte+rrtmgp source code
-  units = none
-  dimensions =  ()
-  type = character
-  intent = in
-  kind = len=128
-[rrtmgp_lw_file_clouds]
-  standard_name = filename_of_rrtmgp_longwave_cloud_optics_coefficients 
-  long_name = file containing coefficients for RRTMGP LW cloud optics
-  units = none
-  dimensions =  ()
-  type = character
-  intent = in
-  kind = len=128
-[mpirank]
-  standard_name = mpi_rank
-  long_name = current MPI rank
-  units = index
-  dimensions = ()
-  type = integer
-  intent = in
-[mpiroot]
-  standard_name = mpi_root
-  long_name = master MPI rank
-  units = index
-  dimensions = ()
-  type = integer
-  intent = in
-[mpicomm]
-  standard_name = mpi_communicator
-  long_name = MPI communicator
-  units = index
-  dimensions = ()
-  type = integer
-  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
-
-########################################################################
-[ccpp-arg-table]
-  name = rrtmgp_lw_cloud_optics_run
-  type = scheme
-[doLWrad]
-  standard_name = flag_for_calling_longwave_radiation
-  long_name = logical flags for lw radiation calls
-  units = flag
-  dimensions = ()
-  type = logical
-  intent = in
-[doG_cldoptics]
-  standard_name = flag_to_calc_lw_cld_optics_using_RRTMG
-  long_name = logical flag to control cloud optics scheme.
-  units = flag
-  dimensions = ()
-  type = logical
-  intent = in
-[icliq_lw]
-  standard_name = flag_for_optical_property_for_liquid_clouds_for_longwave_radiation
-  long_name = lw optical property for liquid clouds
-  units = flag
-  dimensions = ()
-  type = integer
-  intent = in
-[icice_lw]
-  standard_name = flag_for_optical_property_for_ice_clouds_for_longwave_radiation
-  long_name = lw optical property for ice clouds
-  units = flag
-  dimensions = ()
-  type = integer
-  intent = in
-[doGP_cldoptics_PADE]
-  standard_name = flag_to_calc_lw_cld_optics_using_RRTMGP_PADE
-  long_name = logical flag to control cloud optics scheme.
-  units = flag
-  dimensions = ()
-  type = logical
-  intent = in
-[doGP_cldoptics_LUT]
-  standard_name = flag_to_calc_lw_cld_optics_using_RRTMGP_LUT
-  long_name = logical flag to control cloud optics scheme.
-  units = flag
-  dimensions = ()
-  type = logical
-  intent = in
-[doGP_lwscat] 
-  standard_name = flag_to_include_longwave_scattering_in_cloud_optics
-  long_name = logical flag to control the addition of LW scattering in RRTMGP 
-  units = flag
-  dimensions = ()
-  type = logical  
-  intent = in
-[do_mynnedmf]
-  standard_name = flag_for_mellor_yamada_nakanishi_niino_pbl_scheme
-  long_name = flag to activate MYNN-EDMF
-  units = flag
-  dimensions = ()
-  type = logical
-  intent = in
-[imfdeepcnv]
-  standard_name = control_for_deep_convection_scheme
-  long_name = flag for mass-flux deep convection scheme
-  units = flag
-  dimensions = ()
-  type = integer
-  intent = in
-[imfdeepcnv_gf]
-  standard_name = identifier_for_grell_freitas_deep_convection
-  long_name = flag for Grell-Freitas deep convection scheme
-  units = flag
-  dimensions = ()
-  type = integer
-  intent = in
-[imfdeepcnv_samf]
-  standard_name = identifer_for_scale_aware_mass_flux_deep_convection
-  long_name = flag for SAMF deep convection scheme
-  units = flag
-  dimensions = ()
-  type = integer
-  intent = in
-[ncol]
-  standard_name = horizontal_loop_extent
-  long_name = horizontal dimension
-  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
-[cld_frac]
-  standard_name = total_cloud_fraction
-  long_name = layer total cloud fraction
-  units = frac
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  intent = in
-  kind = kind_phys
-[cld_lwp]
-  standard_name = cloud_liquid_water_path
-  long_name = layer cloud liquid water path
-  units = g m-2
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  intent = in
-  kind = kind_phys
-[cld_reliq]
-  standard_name = mean_effective_radius_for_liquid_cloud
-  long_name = mean effective radius for liquid cloud
-  units = um
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  intent = in
-  kind = kind_phys
-[cld_iwp]
-  standard_name = cloud_ice_water_path
-  long_name = layer cloud ice water path
-  units = g m-2
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  intent = in
-  kind = kind_phys
-[cld_reice]
-  standard_name = mean_effective_radius_for_ice_cloud
-  long_name = mean effective radius for ice cloud
-  units = um
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  intent = in
-  kind = kind_phys
-[cld_swp]
-  standard_name = cloud_snow_water_path
-  long_name = cloud snow water path
-  units = g m-2
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  intent = in
-  kind = kind_phys
-[cld_resnow]
-  standard_name = mean_effective_radius_for_snow_flake
-  long_name = mean effective radius for snow flake
-  units = um
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  intent = in
-  kind = kind_phys
-[cld_rwp]
-  standard_name = cloud_rain_water_path
-  long_name = cloud rain water path
-  units = g m-2
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  intent = in
-  kind = kind_phys
-[cld_rerain]
-  standard_name = mean_effective_radius_for_rain_drop
-  long_name = mean effective radius for rain drop
-  units = um
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  intent = in
-  kind = kind_phys
-[precip_frac]
-  standard_name = precipitation_fraction_by_layer
-  long_name = precipitation fraction in each layer
-  units = frac
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[cld_cnv_lwp]
-  standard_name = convective_cloud_liquid_water_path
-  long_name = layer convective cloud liquid water path
-  units = g m-2
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[cld_cnv_iwp]
-  standard_name = convective_cloud_ice_water_path
-  long_name = layer convective cloud ice water path
-  units = g m-2
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[cld_cnv_reliq]
-  standard_name = mean_effective_radius_for_liquid_convective_cloud
-  long_name = mean effective radius for liquid convective cloud
-  units = um
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[cld_cnv_reice]
-  standard_name = mean_effective_radius_for_ice_convective_cloud
-  long_name = mean effective radius for ice convective cloud
-  units = um
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[cld_pbl_lwp]
-  standard_name = MYNN_SGS_cloud_liquid_water_path
-  long_name = layer convective cloud liquid water path
-  units = g m-2
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[cld_pbl_iwp]
-  standard_name = MYNN_SGS_cloud_ice_water_path
-  long_name = layer convective cloud ice water path
-  units = g m-2
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[cld_pbl_reliq]
-  standard_name = mean_effective_radius_for_liquid_MYNN_SGS_cloud
-  long_name = mean effective radius for liquid MYNN_SGS cloud
-  units = um
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[cld_pbl_reice]
-  standard_name = mean_effective_radius_for_ice_MYNN_SGS_cloud
-  long_name = mean effective radius for ice MYNN_SGS cloud
-  units = um
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[p_lay]
-  standard_name = air_pressure_at_layer_for_RRTMGP
-  long_name = air pressure layer
-  units = Pa
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[nbndsGPlw]
-  standard_name = number_of_longwave_bands
-  long_name = number of lw bands used in RRTMGP
-  units = count
-  dimensions =  ()
-  type = integer
-  intent = in
-[lon]
-  standard_name = longitude
-  long_name = longitude
-  units = radian
-  dimensions = (horizontal_loop_extent)
-  type = real
-  kind = kind_phys
-  intent = in
-[lat]
-  standard_name = latitude
-  long_name = latitude
-  units = radian
-  dimensions = (horizontal_loop_extent)
-  type = real
-  kind = kind_phys
-  intent = in
-[cldtaulw]
-  standard_name = cloud_optical_depth_layers_at_10mu_band
-  long_name = approx 10mu band layer cloud optical depth
-  units = none
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = inout
-[lw_optical_props_cloudsByBand]
-  standard_name = longwave_optical_properties_for_cloudy_atmosphere_by_band
-  long_name = Fortran DDT containing RRTMGP optical properties
-  units = DDT
-  dimensions = ()
-  type = ty_optical_props_2str
-  intent = inout
-[lw_optical_props_cnvcloudsByBand]
-  standard_name = longwave_optical_properties_for_convective_cloudy_atmosphere_by_band
-  long_name = Fortran DDT containing RRTMGP optical properties
-  units = DDT
-  dimensions = ()
-  type = ty_optical_props_2str
-  intent = inout
-[lw_optical_props_MYNNcloudsByBand]
-  standard_name = longwave_optical_properties_for_MYNN_EDMF_PBL_cloudy_atmosphere_by_band
-  long_name = Fortran DDT containing RRTMGP optical properties
-  units = DDT
-  dimensions = ()
-  type = ty_optical_props_2str
-  intent = inout
-[lw_optical_props_precipByBand]
-  standard_name = longwave_optical_properties_for_precipitation_by_band
-  long_name = Fortran DDT containing RRTMGP optical properties
-  units = DDT
-  dimensions = ()
-  type = ty_optical_props_2str
-  intent = inout
-[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
-
diff --git a/physics/rrtmgp_lw_cloud_sampling.F90 b/physics/rrtmgp_lw_cloud_sampling.F90
deleted file mode 100644
index 80fd3444a..000000000
--- a/physics/rrtmgp_lw_cloud_sampling.F90
+++ /dev/null
@@ -1,170 +0,0 @@
-!> \file rrtmgp_lw_cloud_sampling.F90
-!!
-!> \defgroup rrtmgp_lw_cloud_sampling rrtmgp_lw_cloud_sampling.F90
-!!
-!! \brief
-!!
-module rrtmgp_lw_cloud_sampling
-  use machine,                  only: kind_phys, kind_dbl_prec
-  use mo_gas_optics_rrtmgp,     only: ty_gas_optics_rrtmgp
-  use mo_optical_props,         only: ty_optical_props_2str
-  use rrtmgp_sampling,          only: sampled_mask, draw_samples
-  use mersenne_twister,         only: random_setseed, random_number, random_stat
-  use radiation_tools,          only: check_error_msg
-  use rrtmgp_lw_gas_optics,     only: lw_gas_props
-  use netcdf
-
-  implicit none
-
-contains
-
-!>\defgroup rrtmgp_lw_cloud_sampling_mod GFS RRTMGP-LW Cloud Sampling Module
-!> \section arg_table_rrtmgp_lw_cloud_sampling_run
-!! \htmlinclude rrtmgp_lw_cloud_sampling_run.html
-!!
-!> \ingroup rrtmgp_lw_cloud_sampling
-!!
-!! \brief This routine performs the McICA cloud-sampling and maps the shortwave cloud-
-!! optical properties, defined for each spectral band, to each spectral point (g-point).
-!!
-!! \section rrtmgp_lw_cloud_sampling_run
-  subroutine rrtmgp_lw_cloud_sampling_run(doLWrad, nCol, nLev, icseed_lw, iovr,iovr_convcld,&
-       iovr_max, iovr_maxrand, iovr_rand, iovr_dcorr, iovr_exp, iovr_exprand, isubc_lw,     &
-       cld_frac, precip_frac, cloud_overlap_param, precip_overlap_param, cld_cnv_frac,      &
-       cnv_cloud_overlap_param, imfdeepcnv, imfdeepcnv_gf, imfdeepcnv_samf,                 &
-       lw_optical_props_cloudsByBand, lw_optical_props_cnvcloudsByBand,                     &
-       lw_optical_props_precipByBand, lw_optical_props_clouds, lw_optical_props_cnvclouds,  &
-       lw_optical_props_precip, errmsg, errflg)
-    
-    ! Inputs
-    logical, intent(in) :: &
-         doLWrad                             ! Logical flag for shortwave radiation call
-    integer, intent(in) :: &
-         nCol,                             & ! Number of horizontal gridpoints
-         nLev,                             & ! Number of vertical layers
-         imfdeepcnv,                       & !
-         imfdeepcnv_gf,                    & !
-         imfdeepcnv_samf,                  & !
-         iovr,                             & ! Choice of cloud-overlap method
-         iovr_convcld,                     & ! Choice of convective cloud-overlap
-         iovr_max,                         & ! Flag for maximum cloud overlap method
-         iovr_maxrand,                     & ! Flag for maximum-random cloud overlap method
-         iovr_rand,                        & ! Flag for random cloud overlap method
-         iovr_dcorr,                       & ! Flag for decorrelation-length cloud overlap method
-         iovr_exp,                         & ! Flag for exponential cloud overlap method
-         iovr_exprand,                     & ! Flag for exponential-random cloud overlap method
-         isubc_lw 
-    integer,intent(in),dimension(:) :: &
-         icseed_lw                           ! auxiliary special cloud related array when module 
-                                             ! variable isubc_lw=2, it provides permutation seed 
-                                             ! for each column profile that are used for generating 
-                                             ! random numbers. when isubc_lw /=2, it will not be used.
-    real(kind_phys), dimension(:,:),intent(in) :: &
-         cld_frac,                         & ! Total cloud fraction by layer
-         cld_cnv_frac,                     & ! Convective cloud fraction by layer 
-         precip_frac,                      & ! Precipitation fraction by layer
-         cloud_overlap_param,              & ! Cloud overlap parameter
-         cnv_cloud_overlap_param,          & ! Convective cloud overlap parameter 
-         precip_overlap_param                ! Precipitation overlap parameter 
-    type(ty_optical_props_2str),intent(in) :: &
-         lw_optical_props_cloudsByBand,    & ! RRTMGP DDT: Longwave optical properties in each band (clouds)
-         lw_optical_props_cnvcloudsByBand, & ! RRTMGP DDT: Longwave optical properties in each band (convective cloud) 
-         lw_optical_props_precipByBand       ! RRTMGP DDT: Longwave optical properties in each band (precipitation)
-
-    ! Outputs
-    character(len=*), intent(out) :: &
-         errmsg                         ! CCPP error message
-    integer,          intent(out) :: &
-         errflg                         ! CCPP error code
-    type(ty_optical_props_2str),intent(inout) :: &
-         lw_optical_props_clouds,     & ! RRTMGP DDT: Shortwave optical properties by spectral point (clouds)
-         lw_optical_props_cnvclouds,  & ! RRTMGP DDT: Shortwave optical properties by spectral point (convective cloud)
-         lw_optical_props_precip        ! RRTMGP DDT: Shortwave optical properties by spectral point (precipitation)
-
-    ! Local variables
-    integer :: iCol, iLay, iBand
-    integer,dimension(ncol) :: ipseed_lw
-    type(random_stat) :: rng_stat
-    real(kind_dbl_prec), dimension(lw_gas_props%get_ngpt(),nLev,ncol) :: rng3D,rng3D2
-    real(kind_dbl_prec), dimension(lw_gas_props%get_ngpt()*nLev) :: rng2D
-    real(kind_dbl_prec), dimension(lw_gas_props%get_ngpt()) :: rng1D
-    logical, dimension(ncol,nLev,lw_gas_props%get_ngpt()) :: maskMCICA
-
-    ! Initialize CCPP error handling variables
-    errmsg = ''
-    errflg = 0
-    
-    if (.not. doLWrad) return
-    
-    ! ####################################################################################    
-    ! First sample the clouds...
-    ! ####################################################################################
-    lw_optical_props_clouds%band2gpt      = lw_gas_props%get_band_lims_gpoint()
-    lw_optical_props_clouds%band_lims_wvn = lw_gas_props%get_band_lims_wavenumber()
-    do iBand=1,lw_gas_props%get_nband()
-       lw_optical_props_clouds%gpt2band(lw_optical_props_clouds%band2gpt(1,iBand):lw_optical_props_clouds%band2gpt(2,iBand)) = iBand
-    end do
-    
-    ! Change random number seed value for each radiation invocation (isubc_lw =1 or 2).
-    if(isubc_lw == 1) then      ! advance prescribed permutation seed
-       do iCol = 1, ncol
-          ipseed_lw(iCol) = lw_gas_props%get_ngpt() + iCol
-       enddo
-    elseif (isubc_lw == 2) then ! use input array of permutaion seeds
-       do iCol = 1, ncol
-          ipseed_lw(iCol) = icseed_lw(iCol)
-       enddo
-    endif
-    
-    ! Call RNG. Mersennse Twister accepts 1D array, so loop over columns and collapse along G-points 
-    ! and layers. ([nGpts,nLev,nColumn]-> [nGpts*nLev]*nColumn)
-    do iCol=1,ncol
-       call random_setseed(ipseed_lw(icol),rng_stat)
-       ! Use same rng for each layer
-       if (iovr == iovr_max) then
-          call random_number(rng1D,rng_stat)
-          do iLay=1,nLev
-             rng3D(:,iLay,iCol) = rng1D
-          enddo
-       else
-          do iLay=1,nLev
-             call random_number(rng1D,rng_stat)
-             rng3D(:,iLay,iCol) = rng1D
-          enddo
-       endif
-    enddo
-
-    ! Cloud-overlap.
-    ! Maximum-random, random or maximum.
-    if (iovr == iovr_maxrand .or. iovr == iovr_rand .or. iovr == iovr_max) then
-       call sampled_mask(real(rng3D, kind=kind_phys), cld_frac, maskMCICA) 
-    endif
-	!  Exponential decorrelation length overlap
-    if (iovr == iovr_dcorr) then
-       ! Generate second RNG
-       do iCol=1,ncol
-          call random_setseed(ipseed_lw(icol),rng_stat)
-          call random_number(rng2D,rng_stat)
-          rng3D2(:,:,iCol) = reshape(source = rng2D,shape=[lw_gas_props%get_ngpt(),nLev])
-       enddo
-       call sampled_mask(real(rng3D, kind=kind_phys), cld_frac, maskMCICA, &
-                         overlap_param = cloud_overlap_param(:,1:nLev-1),  &
-                         randoms2      = real(rng3D2, kind=kind_phys))
-    endif
-    ! Exponential or Exponential-random
-    if (iovr == iovr_exp .or. iovr == iovr_exprand) then
-       call sampled_mask(real(rng3D, kind=kind_phys), cld_frac, maskMCICA, &
-                         overlap_param = cloud_overlap_param(:,1:nLev-1))
-    endif
-
-    !
-    ! Sampling. Map band optical depth to each g-point using McICA
-    !
-    call check_error_msg('rrtmgp_lw_cloud_sampling_run_draw_samples',&
-         draw_samples(maskMCICA, .true.,                             &
-                      lw_optical_props_cloudsByBand,                 &
-                      lw_optical_props_clouds))
-
-  end subroutine rrtmgp_lw_cloud_sampling_run
-
-end module rrtmgp_lw_cloud_sampling
diff --git a/physics/rrtmgp_lw_cloud_sampling.meta b/physics/rrtmgp_lw_cloud_sampling.meta
deleted file mode 100644
index c1ae9d139..000000000
--- a/physics/rrtmgp_lw_cloud_sampling.meta
+++ /dev/null
@@ -1,226 +0,0 @@
-[ccpp-table-properties]
-  name = rrtmgp_lw_cloud_sampling
-  type = scheme
-  dependencies = machine.F,mersenne_twister.f,rrtmgp_sampling.F90,radiation_tools.F90
-
-######################################################
-[ccpp-arg-table]
-  name = rrtmgp_lw_cloud_sampling_run
-  type = scheme
-[doLWrad]
-  standard_name = flag_for_calling_longwave_radiation
-  long_name = logical flags for lw radiation calls
-  units = flag
-  dimensions = ()
-  type = logical
-  intent = in
-[imfdeepcnv]
-  standard_name = control_for_deep_convection_scheme
-  long_name = flag for mass-flux deep convection scheme
-  units = flag
-  dimensions = ()
-  type = integer
-  intent = in
-[imfdeepcnv_gf]
-  standard_name = identifier_for_grell_freitas_deep_convection
-  long_name = flag for Grell-Freitas deep convection scheme
-  units = flag
-  dimensions = ()
-  type = integer
-  intent = in
-[imfdeepcnv_samf]
-  standard_name = identifer_for_scale_aware_mass_flux_deep_convection
-  long_name = flag for SAMF deep convection scheme
-  units = flag
-  dimensions = ()
-  type = integer
-  intent = in
-[iovr_convcld]
-  standard_name = flag_for_convective_cloud_overlap_method_for_radiation
-  long_name = flag for convective cloud overlap method
-  units = flag
-  dimensions = ()
-  type = integer
-  intent = in
-[ncol]
-  standard_name = horizontal_loop_extent
-  long_name = horizontal dimension
-  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
-[isubc_lw]
-  standard_name = flag_for_lw_clouds_sub_grid_approximation
-  long_name = flag for lw clouds sub-grid approximation
-  units = flag
-  dimensions = ()
-  type = integer
-  intent = in
-[iovr]
-  standard_name = flag_for_cloud_overlap_method_for_radiation
-  long_name = max-random overlap clouds
-  units = flag
-  dimensions = ()
-  type = integer
-  intent = in
-[iovr_maxrand]
-  standard_name = flag_for_maximum_random_cloud_overlap_method
-  long_name = choice of maximum-random cloud overlap method
-  units = flag
-  dimensions = ()
-  type = integer
-  intent = in
-[iovr_dcorr]
-  standard_name = flag_for_decorrelation_length_cloud_overlap_method
-  long_name = choice of decorrelation-length cloud overlap method
-  units     = flag
-  dimensions = ()
-  type = integer
-  intent = in
-[iovr_exp]
-  standard_name = flag_for_exponential_cloud_overlap_method
-  long_name = choice of exponential cloud overlap method
-  units     = flag
-  dimensions = ()
-  type = integer
-  intent = in
-[iovr_exprand]
-  standard_name = flag_for_exponential_random_cloud_overlap_method
-  long_name = choice of exponential-random cloud overlap method
-  units     = flag
-  dimensions = ()
-  type = integer
-  intent = in
-[iovr_rand]
-  standard_name = flag_for_random_cloud_overlap_method
-  long_name = choice of random cloud overlap method
-  units = flag
-  dimensions = ()
-  type = integer
-  intent = in
-[iovr_max]
-  standard_name = flag_for_maximum_cloud_overlap_method
-  long_name = choice of maximum cloud overlap method
-  units = flag
-  dimensions = ()
-  type = integer
-  intent = in
-[icseed_lw]
-  standard_name = random_number_seed_for_mcica_longwave
-  long_name = seed for random number generation for longwave radiation
-  units = none
-  dimensions = (horizontal_loop_extent)
-  type = integer
-  intent = in
-[cld_frac]
-  standard_name = total_cloud_fraction
-  long_name = layer total cloud fraction
-  units = frac
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[cld_cnv_frac]
-  standard_name = convective_cloud_fraction_for_RRTMGP
-  long_name = layer convective cloud fraction
-  units = frac
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[precip_frac]
-  standard_name = precipitation_fraction_by_layer
-  long_name = precipitation fraction in each layer
-  units = frac
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[cloud_overlap_param]
-  standard_name = cloud_overlap_param
-  long_name = cloud overlap parameter
-  units = km
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[cnv_cloud_overlap_param]
-  standard_name = convective_cloud_overlap_param
-  long_name = convective cloud overlap parameter
-  units = km
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[precip_overlap_param]
-  standard_name = precip_overlap_param
-  long_name = precipitation overlap parameter
-  units = km
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[lw_optical_props_cloudsByBand]
-  standard_name = longwave_optical_properties_for_cloudy_atmosphere_by_band
-  long_name = Fortran DDT containing RRTMGP optical properties
-  units = DDT
-  dimensions = ()
-  type = ty_optical_props_2str
-  intent = in
-[lw_optical_props_cnvcloudsByBand]
-  standard_name = longwave_optical_properties_for_convective_cloudy_atmosphere_by_band
-  long_name = Fortran DDT containing RRTMGP optical properties
-  units = DDT
-  dimensions = ()
-  type = ty_optical_props_2str
-  intent = in
-[lw_optical_props_precipByBand]
-  standard_name = longwave_optical_properties_for_precipitation_by_band
-  long_name = Fortran DDT containing RRTMGP optical properties
-  units = DDT
-  dimensions = ()
-  type = ty_optical_props_2str
-  intent = in
-[lw_optical_props_clouds]
-  standard_name = longwave_optical_properties_for_cloudy_atmosphere
-  long_name = Fortran DDT containing RRTMGP optical properties
-  units = DDT
-  dimensions = ()
-  type = ty_optical_props_2str
-  intent = inout
-[lw_optical_props_precip]
-  standard_name = longwave_optical_properties_for_precipitation
-  long_name = Fortran DDT containing RRTMGP optical properties
-  units = DDT
-  dimensions = ()
-  type = ty_optical_props_2str
-  intent = inout
-[lw_optical_props_cnvclouds]
-  standard_name = longwave_optical_properties_for_convective_cloudy_atmosphere
-  long_name = Fortran DDT containing RRTMGP optical properties
-  units = DDT
-  dimensions = ()
-  type = ty_optical_props_2str
-  intent = inout
-[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
diff --git a/physics/rrtmgp_lw_gas_optics.F90 b/physics/rrtmgp_lw_gas_optics.F90
index fad01a336..8cd38f210 100644
--- a/physics/rrtmgp_lw_gas_optics.F90
+++ b/physics/rrtmgp_lw_gas_optics.F90
@@ -12,8 +12,6 @@ module rrtmgp_lw_gas_optics
   use mo_rte_kind,           only: wl
   use mo_gas_optics_rrtmgp,  only: ty_gas_optics_rrtmgp
   use mo_gas_concentrations, only: ty_gas_concs  
-  use mo_source_functions,   only: ty_source_func_lw
-  use mo_optical_props,      only: ty_optical_props_1scl
   use radiation_tools,       only: check_error_msg
   use netcdf
 #ifdef MPI
@@ -77,28 +75,18 @@ module rrtmgp_lw_gas_optics
 
 contains
 
-!>\defgroup rrtmgp_lw_gas_optics_mod GFS RRTMGP-LW Gas Optics Module
-!! \section arg_table_rrtmgp_lw_gas_optics_init
-!! \htmlinclude rrtmgp_lw_gas_optics.html
-!!
-!> \ingroup rrtmgp_lw_gas_optics
-!!
-!! RRTMGP relies heavility on derived-data-types, which contain type-bound procedures
-!! that are referenced frequently throughout the RRTMGP longwave scheme. The data needed
-!! for the correlated k-distribution is also contained within this type. Within this module,
-!! the full k-distribution data is read in, reduced by the "active gases" provided, and
-!! loaded into the RRTMGP DDT, ty_gas_optics_rrtmgp.
-!!
-!! \section rrtmgp_lw_gas_optics_init
-  ! ######################################################################################
-  subroutine rrtmgp_lw_gas_optics_init(rrtmgp_root_dir, rrtmgp_lw_file_gas, mpicomm,        &
-       mpirank, mpiroot, minGPpres, maxGPpres, minGPtemp, maxGPtemp, active_gases_array,    &
-       errmsg, errflg)
+  ! #########################################################################################
+  ! SUBROUTINE rrtmgp_lw_gas_optics_init
+  ! #########################################################################################
+  subroutine rrtmgp_lw_gas_optics_init(rrtmgp_root_dir, rrtmgp_lw_file_gas,                 &
+       active_gases_array, mpicomm, mpirank, mpiroot, errmsg, errflg)
 
     ! Inputs
     character(len=128),intent(in) :: &
          rrtmgp_root_dir,  & ! RTE-RRTMGP root directory
-         rrtmgp_lw_file_gas  ! RRTMGP file containing coefficients used to compute gaseous optical properties
+         rrtmgp_lw_file_gas  ! RRTMGP file containing K-distribution data
+    character(len=*), dimension(:), intent(in) :: &
+         active_gases_array  ! List of active gases from namelist as array   
     integer,intent(in) :: &
          mpicomm,          & ! MPI communicator
          mpirank,          & ! Current MPI rank
@@ -109,20 +97,12 @@ subroutine rrtmgp_lw_gas_optics_init(rrtmgp_root_dir, rrtmgp_lw_file_gas, mpicom
          errmsg              ! CCPP error message
     integer,          intent(out) :: &
          errflg              ! CCPP error code
-    real(kind_phys), intent(out) :: &
-         minGPtemp,        & ! Minimum temperature allowed by RRTMGP.
-         maxGPtemp,        & ! Maximum ...
-         minGPpres,        & ! Minimum pressure allowed by RRTMGP. 
-         maxGPpres           ! Maximum pressure allowed by RRTMGP. 
-    character(len=*), dimension(:), intent(in) :: &
-         active_gases_array ! List of active gases from namelist as array
 
     ! Local variables
-    integer :: ncid, dimID, varID, status, iGas, ierr, ii, mpierr, iChar
-    integer,dimension(:),allocatable :: temp1, temp2, temp3, temp4, &
-         temp_log_array1, temp_log_array2, temp_log_array3, temp_log_array4
+    integer :: ncid, dimID, varID, status, ii, mpierr, iChar
+    integer,dimension(:),allocatable :: temp1, temp2, temp3, temp4
     character(len=264) :: lw_gas_props_file
-    type(ty_gas_concs) :: gas_concentrations  ! RRTMGP DDT: trace gas concentrations (vmr)
+    type(ty_gas_concs) :: gas_concs  ! RRTMGP DDT: trace gas concentrations (vmr)
 
     ! Initialize
     errmsg = ''
@@ -455,9 +435,8 @@ subroutine rrtmgp_lw_gas_optics_init(rrtmgp_root_dir, rrtmgp_lw_file_gas, mpicom
     ! Initialize RRTMGP DDT's...
     !
     ! #######################################################################################
-    allocate(gas_concentrations%gas_name(1:size(active_gases_array)))
-    gas_concentrations%gas_name(:) = active_gases_array(:)
-    call check_error_msg('rrtmgp_lw_gas_optics_init',lw_gas_props%load(gas_concentrations,  &
+    call check_error_msg('rrtmgp_lw_gas_optics_init_gas_concs',gas_concs%init(active_gases_array))
+    call check_error_msg('rrtmgp_lw_gas_optics_init_load',lw_gas_props%load(gas_concs,      &
          gas_namesLW, key_speciesLW, band2gptLW, band_limsLW, press_refLW, press_ref_tropLW,&
          temp_refLW,  temp_ref_pLW, temp_ref_tLW, vmr_refLW, kmajorLW, kminor_lowerLW,      &
          kminor_upperLW, gas_minorLW, identifier_minorLW, minor_gases_lowerLW,              &
@@ -467,80 +446,6 @@ subroutine rrtmgp_lw_gas_optics_init(rrtmgp_root_dir, rrtmgp_lw_file_gas, mpicom
          scale_by_complement_upperLW, kminor_start_lowerLW, kminor_start_upperLW, totplnkLW,&
          planck_fracLW, rayl_lowerLW, rayl_upperLW, optimal_angle_fitLW))
     
-    ! The minimum pressure allowed in GP RTE calculations. Used to bound uppermost layer
-    ! temperature (GFS_rrtmgp_pre.F90)
-    minGPpres = lw_gas_props%get_press_min()
-    maxGPpres = lw_gas_props%get_press_max()
-    minGPtemp = lw_gas_props%get_temp_min() 
-    maxGPtemp = lw_gas_props%get_temp_max()
-
   end subroutine rrtmgp_lw_gas_optics_init
 
-!> \section arg_table_rrtmgp_lw_gas_optics_run
-!! \htmlinclude rrtmgp_lw_gas_optics_run.html
-!! 
-!! Compute longwave optical prperties (optical-depth) for clear-sky conditions.
-!! \section rrtmgp_lw_gas_optics_run
-  subroutine rrtmgp_lw_gas_optics_run(doLWrad, nCol, nLev, p_lay, p_lev, t_lay, t_lev, tsfg, &
-       gas_concentrations, lw_optical_props_clrsky, sources, errmsg, errflg)
-
-    ! Inputs
-    logical, intent(in) :: &
-         doLWrad                 ! Flag to calculate LW irradiances
-    integer,intent(in) :: &
-         ncol,                &  ! Number of horizontal points
-         nLev                    ! Number of vertical levels
-    real(kind_phys), dimension(ncol,nLev), intent(in) :: &
-         p_lay,                & ! Pressure @ model layer-centers (Pa)
-         t_lay                   ! Temperature (K)
-    real(kind_phys), dimension(ncol,nLev+1), intent(in) :: &
-         p_lev,                & ! Pressure @ model layer-interfaces (Pa)
-         t_lev                   ! Temperature @ model levels
-    real(kind_phys), dimension(ncol), intent(in) :: &
-         tsfg                    ! Surface ground temperature (K)
-    type(ty_gas_concs),intent(in) :: &
-         gas_concentrations      ! RRTMGP DDT: trace gas concentrations (vmr)
-
-    ! Output
-    character(len=*), intent(out) :: &
-         errmsg                  ! CCPP error message
-    integer,          intent(out) :: &
-         errflg                  ! CCPP error code
-    type(ty_optical_props_1scl),intent(inout) :: &
-         lw_optical_props_clrsky ! RRTMGP DDT: longwave clear-sky radiative properties
-    type(ty_source_func_lw),intent(inout) :: &
-         sources                 ! RRTMGP DDT: longwave source functions
-    
-    ! Local
-    integer :: ii
-
-    ! Initialize CCPP error handling variables
-    errmsg = ''
-    errflg = 0
-
-    if (.not. doLWrad) return
-
-    ! Copy spectral information into GP DDTs.
-    lw_optical_props_clrsky%band2gpt      = lw_gas_props%get_band_lims_gpoint()
-    sources%band2gpt                      = lw_gas_props%get_band_lims_gpoint()
-    sources%band_lims_wvn                 = lw_gas_props%get_band_lims_wavenumber()
-    lw_optical_props_clrsky%band_lims_wvn = lw_gas_props%get_band_lims_wavenumber()
-    do ii=1,nbndsLW
-       lw_optical_props_clrsky%gpt2band(band2gptLW(1,ii):band2gptLW(2,ii)) = ii
-       sources%gpt2band(band2gptLW(1,ii):band2gptLW(2,ii))                 = ii
-    end do
-
-    ! Gas-optics 
-    call check_error_msg('rrtmgp_lw_gas_optics_run',lw_gas_props%gas_optics(&
-         p_lay,                   & ! IN  - Pressure @ layer-centers (Pa)
-         p_lev,                   & ! IN  - Pressure @ layer-interfaces (Pa)
-         t_lay,                   & ! IN  - Temperature @ layer-centers (K)
-         tsfg,                    & ! IN  - Skin-temperature (K)
-         gas_concentrations,      & ! IN  - RRTMGP DDT: trace gas volumne mixing-ratios
-         lw_optical_props_clrsky, & ! OUT - RRTMGP DDT: longwave optical properties
-         sources,                 & ! OUT - RRTMGP DDT: source functions
-         tlev=t_lev))               ! IN  - Temperature @ layer-interfaces (K) (optional)
-
-  end subroutine rrtmgp_lw_gas_optics_run
-
 end module rrtmgp_lw_gas_optics
diff --git a/physics/rrtmgp_lw_gas_optics.meta b/physics/rrtmgp_lw_gas_optics.meta
deleted file mode 100644
index 0b484b6ac..000000000
--- a/physics/rrtmgp_lw_gas_optics.meta
+++ /dev/null
@@ -1,203 +0,0 @@
-[ccpp-table-properties]
-  name = rrtmgp_lw_gas_optics
-  type = scheme
-  dependencies = machine.F,radiation_tools.F90,GFS_rrtmgp_pre.F90,rte-rrtmgp/rrtmgp/mo_gas_optics_rrtmgp.F90,rte-rrtmgp/rte/mo_rte_kind.F90,rte-rrtmgp/rrtmgp/mo_gas_concentrations.F90,rte-rrtmgp/rte/mo_optical_props.F90,rte-rrtmgp/rte/mo_source_functions.F90
-
-########################################################################
-[ccpp-arg-table]
-  name = rrtmgp_lw_gas_optics_init
-  type = scheme
-[rrtmgp_root_dir]
-  standard_name = directory_for_rte_rrtmgp_source_code
-  long_name = directory for rte+rrtmgp source code
-  units = none
-  dimensions =  ()
-  type = character
-  intent = in
-  kind = len=128
-[rrtmgp_lw_file_gas]
-  standard_name = filename_of_rrtmgp_longwave_k_distribution
-  long_name = file containing RRTMGP LW k-distribution
-  units = none
-  dimensions =  ()
-  type = character
-  intent = in
-  kind = len=128
-[mpirank]
-  standard_name = mpi_rank
-  long_name = current MPI rank
-  units = index
-  dimensions = ()
-  type = integer
-  intent = in
-[mpiroot]
-  standard_name = mpi_root
-  long_name = master MPI rank
-  units = index
-  dimensions = ()
-  type = integer
-  intent = in
-[mpicomm]
-  standard_name = mpi_communicator
-  long_name = MPI communicator
-  units = index
-  dimensions = ()
-  type = integer
-  intent = in
-[minGPpres]
-  standard_name = minimum_pressure_in_RRTMGP
-  long_name = minimum pressure allowed in RRTMGP
-  units = Pa
-  dimensions = ()
-  type = real
-  kind = kind_phys
-  intent = out
-[maxGPpres]
-  standard_name = maximum_pressure_in_RRTMGP
-  long_name = maximum pressure allowed in RRTMGP
-  units = Pa
-  dimensions = ()
-  type = real
-  kind = kind_phys
-  intent = out
-[minGPtemp]
-  standard_name = minimum_temperature_in_RRTMGP
-  long_name = minimum temperature allowed in RRTMGP
-  units = K
-  dimensions = ()
-  type = real
-  kind = kind_phys
-  intent = out
-[maxGPtemp]
-  standard_name = maximum_temperature_in_RRTMGP
-  long_name = maximum temperature allowed in RRTMGP
-  units = K
-  dimensions = ()
-  type = real
-  kind = kind_phys
-  intent = out
-[active_gases_array]
-  standard_name = list_of_active_gases_used_by_RRTMGP
-  long_name = list of active gases used by RRTMGP
-  units = none
-  dimensions =  (number_of_active_gases_used_by_RRTMGP)
-  type = character
-  kind = len=*
-  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
-
-########################################################################
-[ccpp-arg-table]
-  name = rrtmgp_lw_gas_optics_run
-  type = scheme
-[doLWrad]
-  standard_name = flag_for_calling_longwave_radiation
-  long_name = flag to calculate LW irradiances
-  units = flag
-  dimensions = ()
-  type = logical
-  intent = in
-[ncol]
-  standard_name = horizontal_loop_extent
-  long_name = horizontal dimension
-  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
-[p_lay]
-  standard_name = air_pressure_at_layer_for_RRTMGP
-  long_name = air pressure layer
-  units = Pa
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[p_lev]
-  standard_name = air_pressure_at_interface_for_RRTMGP
-  long_name = air pressure level
-  units = Pa
-  dimensions = (horizontal_loop_extent,vertical_interface_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[t_lay]
-  standard_name = air_temperature_at_layer_for_RRTMGP
-  long_name = air temperature layer
-  units = K
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[t_lev]
-  standard_name = air_temperature_at_interface_for_RRTMGP
-  long_name = air temperature level
-  units = K
-  dimensions = (horizontal_loop_extent,vertical_interface_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[tsfg]
-  standard_name = surface_ground_temperature_for_radiation
-  long_name = surface ground temperature for radiation
-  units = K
-  dimensions = (horizontal_loop_extent)
-  type = real
-  kind = kind_phys
-  intent = in
-[gas_concentrations]
-  standard_name = Gas_concentrations_for_RRTMGP_suite
-  long_name = DDT containing gas concentrations for RRTMGP radiation scheme
-  units = DDT
-  dimensions = ()
-  type = ty_gas_concs
-  intent = in
-[lw_optical_props_clrsky]
-  standard_name = longwave_optical_properties_for_clear_sky
-  long_name = Fortran DDT containing RRTMGP optical properties
-  units = DDT
-  dimensions = ()
-  type = ty_optical_props_1scl
-  intent = inout
-[sources]
-  standard_name = longwave_source_function
-  long_name = Fortran DDT containing RRTMGP source functions
-  units = DDT
-  dimensions = ()
-  type = ty_source_func_lw
-  intent = inout
-[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
diff --git a/physics/rrtmgp_lw_main.F90 b/physics/rrtmgp_lw_main.F90
new file mode 100644
index 000000000..c0bc99d35
--- /dev/null
+++ b/physics/rrtmgp_lw_main.F90
@@ -0,0 +1,611 @@
+! ###########################################################################################
+!> \file rrtmgp_lw_main.F90
+!!
+!> \defgroup rrtmgp_lw_main rrtmgp_lw_main.F90
+!!
+!! \brief This module contains the longwave RRTMGP radiation scheme.
+!!
+! ###########################################################################################
+module rrtmgp_lw_main
+  use machine,                only: kind_phys, kind_dbl_prec
+  use mo_optical_props,       only: ty_optical_props_1scl, ty_optical_props_2str
+  use mo_cloud_optics,        only: ty_cloud_optics
+  use mo_rte_lw,              only: rte_lw
+  use mo_gas_optics_rrtmgp,   only: ty_gas_optics_rrtmgp
+  use mo_gas_concentrations,  only: ty_gas_concs
+  use mo_fluxes_byband,       only: ty_fluxes_byband
+  use mo_source_functions,    only: ty_source_func_lw
+  use radiation_tools,        only: check_error_msg
+  use rrtmgp_lw_gas_optics,   only: lw_gas_props,rrtmgp_lw_gas_optics_init
+  use rrtmgp_lw_cloud_optics, only: lw_cloud_props, rrtmgp_lw_cloud_optics_init, abssnow0,   &
+                                    abssnow1, absrain
+  use module_radiation_gases, only: NF_VGAS, getgases, getozn
+  use GFS_rrtmgp_pre,         only: iStr_h2o, iStr_co2, iStr_o3, iStr_n2o, iStr_ch4,         &
+                                    iStr_o2, iStr_ccl4, iStr_cfc11, iStr_cfc12, iStr_cfc22,  &
+                                    eps, oneminus, ftiny
+  use mersenne_twister,       only: random_setseed, random_number, random_stat 
+  use rrtmgp_sampling,        only: sampled_mask, draw_samples
+  implicit none
+
+  type(ty_gas_concs)          :: gas_concs
+  type(ty_optical_props_1scl) :: lw_optical_props_clrsky, lw_optical_props_aerosol_local
+  type(ty_optical_props_2str) :: lw_optical_props_clouds, lw_optical_props_cloudsByBand,    &
+       lw_optical_props_cnvcloudsByBand, lw_optical_props_pblcloudsByBand,                  &
+       lw_optical_props_precipByBand
+  type(ty_source_func_lw)     :: sources 
+
+  public rrtmgp_lw_main_init, rrtmgp_lw_main_run
+contains
+  ! #########################################################################################
+!! \section arg_table_rrtmgp_lw_main_init
+!! \htmlinclude rrtmgp_lw_main_int.html
+!!
+!> \ingroup rrtmgp_lw_main
+!!
+!! \brief 
+!!
+!! \section rrtmgp_lw_main_init
+!> @{
+  ! #########################################################################################
+  subroutine rrtmgp_lw_main_init(rrtmgp_root_dir, rrtmgp_lw_file_gas, rrtmgp_lw_file_clouds,&
+       active_gases_array, doGP_cldoptics_PADE, doGP_cldoptics_LUT, doGP_sgs_pbl,           &
+       doGP_sgs_cnv, nrghice, mpicomm, mpirank, mpiroot, nLay, rrtmgp_phys_blksz,           &
+       errmsg, errflg)
+
+    ! Inputs
+    character(len=128),intent(in) :: &
+         rrtmgp_root_dir,       & ! RTE-RRTMGP root directory
+         rrtmgp_lw_file_clouds, & ! RRTMGP file containing coefficients used to compute
+                                  ! clouds optical properties
+         rrtmgp_lw_file_gas       ! RRTMGP file containing coefficients used to compute
+                                  ! gaseous optical properties
+    character(len=*), dimension(:), intent(in) :: &
+         active_gases_array ! List of active gases from namelist as array)
+    logical, intent(in) :: &
+         doGP_cldoptics_PADE,   & ! Use RRTMGP cloud-optics: PADE approximation?
+         doGP_cldoptics_LUT,    & ! Use RRTMGP cloud-optics: LUTs?
+         doGP_sgs_pbl,          & ! Flag to include sgs PBL clouds
+         doGP_sgs_cnv             ! Flag to include sgs convective clouds 
+    integer, intent(inout) :: &
+         nrghice                  ! Number of ice-roughness categories
+    integer,intent(in) :: &
+         mpicomm,               & ! MPI communicator
+         mpirank,               & ! Current MPI rank
+         mpiroot,               & ! Master MPI rank
+         rrtmgp_phys_blksz,     & ! Number of horizontal points to process at once.
+         nLay
+
+    ! Outputs
+    character(len=*), intent(out) :: &
+         errmsg                   ! CCPP error message
+    integer,          intent(out) :: &
+         errflg                   ! CCPP error code
+
+    ! Initialize CCPP error handling variables 
+    errmsg = ''
+    errflg = 0
+
+    ! RRTMGP longwave gas-optics (k-distribution) initialization
+    call rrtmgp_lw_gas_optics_init(rrtmgp_root_dir, rrtmgp_lw_file_gas,                  &
+         active_gases_array, mpicomm, mpirank, mpiroot, errmsg, errflg)
+
+    ! RRTMGP longwave cloud-optics initialization
+    call rrtmgp_lw_cloud_optics_init(rrtmgp_root_dir, rrtmgp_lw_file_clouds,             &
+         doGP_cldoptics_PADE, doGP_cldoptics_LUT, nrghice, mpicomm, mpirank, mpiroot,    &
+         errmsg, errflg)
+
+    ! DDTs
+    
+    ! ty_gas_concs
+    call check_error_msg('rrtmgp_lw_main_gas_concs_init',gas_concs%init(active_gases_array))
+
+    ! ty_optical_props
+    call check_error_msg('rrtmgp_lw_main_gas_optics_init',&
+         lw_optical_props_clrsky%alloc_1scl(rrtmgp_phys_blksz, nLay, lw_gas_props))
+    call check_error_msg('rrtmgp_lw_main_sources_init',&
+         sources%alloc(rrtmgp_phys_blksz, nLay, lw_gas_props))
+    call check_error_msg('rrtmgp_lw_main_cloud_optics_init',&
+         lw_optical_props_cloudsByBand%alloc_2str(rrtmgp_phys_blksz, nLay, lw_gas_props%get_band_lims_wavenumber()))
+    call check_error_msg('rrtmgp_lw_main_precip_optics_init',&
+         lw_optical_props_precipByBand%alloc_2str(rrtmgp_phys_blksz, nLay, lw_gas_props%get_band_lims_wavenumber()))
+    call check_error_msg('rrtmgp_lw_mian_cloud_sampling_init', &
+         lw_optical_props_clouds%alloc_2str(rrtmgp_phys_blksz, nLay, lw_gas_props))
+    call check_error_msg('rrtmgp_lw_main_aerosol_optics_init',&
+         lw_optical_props_aerosol_local%alloc_1scl(rrtmgp_phys_blksz, nLay, lw_gas_props%get_band_lims_wavenumber()))
+    if (doGP_sgs_cnv) then
+       call check_error_msg('rrtmgp_lw_main_cnv_cloud_optics_init',&
+            lw_optical_props_cnvcloudsByBand%alloc_2str(rrtmgp_phys_blksz, nLay, lw_gas_props%get_band_lims_wavenumber()))
+    endif
+    if (doGP_sgs_pbl) then
+       call check_error_msg('rrtmgp_lw_main_pbl_cloud_optics_init',&
+            lw_optical_props_pblcloudsByBand%alloc_2str(rrtmgp_phys_blksz, nLay, lw_gas_props%get_band_lims_wavenumber()))
+    endif
+
+  end subroutine rrtmgp_lw_main_init
+!> @}
+  ! ######################################################################################
+!! \section arg_table_rrtmgp_lw_main_run
+!! \htmlinclude rrtmgp_lw_main_run.html
+!!
+!> \ingroup rrtmgp_lw_main
+!!
+!! \brief
+!!
+!! \section rrtmgp_lw_main_run
+!> @{
+  ! ######################################################################################
+  subroutine rrtmgp_lw_main_run(doLWrad, doLWclrsky, top_at_1, doGP_lwscat,              &
+       use_LW_jacobian, doGP_sgs_cnv, doGP_sgs_pbl, nCol, nLay, nGases,rrtmgp_phys_blksz,&
+       nGauss_angles, icseed_lw, iovr, iovr_convcld, iovr_max, iovr_maxrand, iovr_rand,  &
+       iovr_dcorr, iovr_exp, iovr_exprand, isubc_lw, semis, tsfg, p_lay, p_lev, t_lay,   &
+       t_lev,  vmr_o2, vmr_h2o, vmr_o3, vmr_ch4, vmr_n2o, vmr_co2,                       &
+       cld_frac, cld_lwp, cld_reliq, cld_iwp, cld_reice, cld_swp, cld_resnow,            &
+       cld_rwp, cld_rerain, precip_frac, cld_cnv_lwp, cld_cnv_reliq, cld_cnv_iwp,        &
+       cld_cnv_reice, cld_pbl_lwp, cld_pbl_reliq, cld_pbl_iwp, cld_pbl_reice,            &
+       cloud_overlap_param, active_gases_array, aerlw_tau, aerlw_ssa, aerlw_g,           &
+       fluxlwUP_allsky, fluxlwDOWN_allsky, fluxlwUP_clrsky, fluxlwDOWN_clrsky,           &
+       fluxlwUP_jac, fluxlwUP_radtime, fluxlwDOWN_radtime, errmsg, errflg)
+
+    ! Inputs
+    logical, intent(in) :: &
+         doLWrad,            & ! Flag to perform longwave calculation
+         doLWclrsky,         & ! Flag to compute clear-sky fluxes
+         top_at_1,           & ! Flag for vertical ordering convention
+         use_LW_jacobian,    & ! Flag to compute Jacobian of longwave surface flux
+         doGP_sgs_pbl,       & ! Flag to include sgs PBL clouds
+         doGP_sgs_cnv,       & ! Flag to include sgs convective clouds
+         doGP_lwscat           ! Flag to include scattering in clouds
+    integer,intent(in) :: &
+         nCol,               & ! Number of horizontal points
+         nLay,               & ! Number of vertical grid points.
+         nGases,             & ! Number of active gases
+         rrtmgp_phys_blksz,  & ! Number of horizontal points to process at once.
+         nGauss_angles,      & ! Number of gaussian quadrature angles used
+         iovr,               & ! Choice of cloud-overlap method
+         iovr_convcld,       & ! Choice of convective cloud-overlap
+         iovr_max,           & ! Flag for maximum cloud overlap method
+         iovr_maxrand,       & ! Flag for maximum-random cloud overlap method
+         iovr_rand,          & ! Flag for random cloud overlap method
+         iovr_dcorr,         & ! Flag for decorrelation-length cloud overlap method
+         iovr_exp,           & ! Flag for exponential cloud overlap method
+         iovr_exprand,       & ! Flag for exponential-random cloud overlap method
+         isubc_lw              ! Flag for cloud-seeding (rng) for cloud-sampling
+    integer,intent(in),dimension(:) :: &
+         icseed_lw             ! Seed for random number generation for longwave radiation
+    real(kind_phys), dimension(:), intent(in) :: &
+         semis,              & ! Surface-emissivity (1)
+         tsfg                  ! Skin temperature (K)
+    real(kind_phys), dimension(:,:), intent(in) :: &
+         p_lay,               & ! Pressure @ model layer-centers (Pa)
+         t_lay,               & ! Temperature (K)
+         p_lev,               & ! Pressure @ model layer-interfaces (Pa)
+         t_lev,               & ! Temperature @ model levels (K)
+         vmr_o2,              & ! Molar-mixing ratio oxygen
+         vmr_h2o,             & ! Molar-mixing ratio water vapor
+         vmr_o3,              & ! Molar-mixing ratio ozone
+         vmr_ch4,             & ! Molar-mixing ratio methane
+         vmr_n2o,             & ! Molar-mixing ratio nitrous oxide
+         vmr_co2,             & ! Molar-mixing ratio carbon dioxide
+         cld_frac,            & ! Cloud-fraction for   stratiform   clouds
+         cld_lwp,             & ! Water path for       stratiform   liquid cloud-particles
+         cld_reliq,           & ! Effective radius for stratiform   liquid cloud-particles
+         cld_iwp,             & ! Water path for       stratiform   ice    cloud-particles
+         cld_reice,           & ! Effective radius for stratiform   ice    cloud-particles
+         cld_swp,             & ! Water path for                    snow   hydrometeors
+         cld_resnow,          & ! Effective radius for              snow   hydrometeors
+         cld_rwp,             & ! Water path for                    rain   hydrometeors
+         cld_rerain,          & ! Effective radius for              rain   hydrometeors
+         precip_frac,         & ! Precipitation fraction (not active, currently precipitation optics uses cloud-fraction)
+         cld_cnv_lwp,         & ! Water path for       convective   liquid cloud-particles
+         cld_cnv_reliq,       & ! Effective radius for convective   liquid cloud-particles
+         cld_cnv_iwp,         & ! Water path for       convective   ice    cloud-particles
+         cld_cnv_reice,       & ! Effective radius for convective   ice    cloud-particles
+         cld_pbl_lwp,         & ! Water path for       PBL          liquid cloud-particles
+         cld_pbl_reliq,       & ! Effective radius for PBL          liquid cloud-particles
+         cld_pbl_iwp,         & ! Water path for       PBL          ice    cloud-particles
+         cld_pbl_reice,       & ! Effective radius for PBL          ice    cloud-particles
+         cloud_overlap_param    ! Cloud overlap parameter
+    real(kind_phys), dimension(:,:,:), intent(in) :: &
+          aerlw_tau,          & ! Aerosol optical depth
+          aerlw_ssa,          & ! Aerosol single scattering albedo
+          aerlw_g               ! Aerosol asymmetry paramter
+    character(len=*), dimension(:), intent(in) :: &
+         active_gases_array     ! List of active gases from namelist as array
+
+    ! Outputs
+    real(kind_phys), dimension(:,:), intent(inout) :: &
+         fluxlwUP_jac,        & ! Jacobian of upwelling LW surface radiation (W/m2/K) 
+         fluxlwUP_allsky,     & ! All-sky flux (W/m2)
+         fluxlwDOWN_allsky,   & ! All-sky flux (W/m2)
+         fluxlwUP_clrsky,     & ! Clear-sky flux (W/m2)
+         fluxlwDOWN_clrsky,   & ! All-sky flux (W/m2)
+         fluxlwUP_radtime,    & ! Copy of fluxes (Used for coupling)
+         fluxlwDOWN_radtime     !
+    character(len=*), intent(out) :: & 
+         errmsg                 ! CCPP error message
+    integer, intent(out) :: & 
+         errflg                 ! CCPP error flag
+
+    ! Local variables
+    type(ty_fluxes_byband) :: flux_allsky, flux_clrsky
+    integer :: iCol, iLay, iGas, iBand, iCol2, ix, iblck
+    integer, dimension(rrtmgp_phys_blksz) :: ipseed_lw
+    type(random_stat) :: rng_stat
+    real(kind_phys), dimension(rrtmgp_phys_blksz) :: zcf0, zcf1
+    logical, dimension(rrtmgp_phys_blksz,nLay,lw_gas_props%get_ngpt()) :: maskMCICA
+    real(kind_phys), dimension(rrtmgp_phys_blksz) :: tau_rain, tau_snow
+    real(kind_dbl_prec), dimension(lw_gas_props%get_ngpt()) :: rng1D
+    real(kind_dbl_prec), dimension(lw_gas_props%get_ngpt(),nLay,rrtmgp_phys_blksz) :: rng3D,rng3D2
+    real(kind_dbl_prec), dimension(lw_gas_props%get_ngpt()*nLay) :: rng2D
+    real(kind_phys), dimension(rrtmgp_phys_blksz,nLay+1,lw_gas_props%get_nband()),target :: &
+         fluxLW_up_allsky, fluxLW_up_clrsky, fluxLW_dn_allsky, fluxLW_dn_clrsky
+    real(kind_phys), dimension(rrtmgp_phys_blksz,lw_gas_props%get_ngpt()) :: lw_Ds
+    real(kind_phys), dimension(lw_gas_props%get_nband(),rrtmgp_phys_blksz) :: sfc_emiss_byband
+
+    ! Initialize CCPP error handling variables
+    errmsg = ''
+    errflg = 0
+
+    if (.not. doLWrad) return
+
+    ! ######################################################################################
+    !
+    ! Loop over all columns...
+    !
+    ! ###################################################################################### 
+    do iCol=1,nCol,rrtmgp_phys_blksz
+       iCol2 = iCol + rrtmgp_phys_blksz - 1
+
+       ! Initialize/reset
+
+       ! ty_optical_props
+       lw_optical_props_clrsky%tau       = 0._kind_phys
+       lw_optical_props_precipByBand%tau = 0._kind_phys
+       lw_optical_props_precipByBand%ssa = 0._kind_phys
+       lw_optical_props_precipByBand%g   = 0._kind_phys
+       lw_optical_props_cloudsByBand%tau = 0._kind_phys
+       lw_optical_props_cloudsByBand%ssa = 0._kind_phys
+       lw_optical_props_cloudsByBand%g   = 0._kind_phys
+       lw_optical_props_clouds%tau       = 0._kind_phys
+       lw_optical_props_clouds%ssa       = 0._kind_phys
+       lw_optical_props_clouds%g         = 0._kind_phys
+       sources%sfc_source                = 0._kind_phys
+       sources%lay_source                = 0._kind_phys
+       sources%lev_source_inc            = 0._kind_phys
+       sources%lev_source_dec            = 0._kind_phys
+       sources%sfc_source_Jac            = 0._kind_phys
+       fluxLW_up_allsky                  = 0._kind_phys
+       fluxLW_dn_allsky                  = 0._kind_phys
+       fluxLW_up_clrsky                  = 0._kind_phys
+       fluxLW_dn_clrsky                  = 0._kind_phys
+       if (doGP_sgs_cnv) lw_optical_props_cnvcloudsByBand%tau = 0._kind_phys
+       if (doGP_sgs_pbl) lw_optical_props_pblcloudsByBand%tau = 0._kind_phys
+
+       ! ty_fluxes_byband
+       fluxLW_up_allsky        = 0._kind_phys
+       fluxLW_dn_allsky        = 0._kind_phys
+       fluxLW_up_clrsky        = 0._kind_phys
+       fluxLW_dn_clrsky        = 0._kind_phys
+       flux_allsky%bnd_flux_up => fluxLW_up_allsky
+       flux_allsky%bnd_flux_dn => fluxLW_dn_allsky
+       flux_clrsky%bnd_flux_up => fluxLW_up_clrsky
+       flux_clrsky%bnd_flux_dn => fluxLW_dn_clrsky
+
+       ! ###################################################################################
+       !
+       ! Set gas-concentrations
+       !
+       ! ###################################################################################
+       call check_error_msg('rrtmgp_lw_main_set_vmr_o2',  &
+            gas_concs%set_vmr(trim(active_gases_array(istr_o2)), vmr_o2(iCol:iCol2,:)))
+       call check_error_msg('rrtmgp_lw_main_set_vmr_co2', &
+            gas_concs%set_vmr(trim(active_gases_array(istr_co2)),vmr_co2(iCol:iCol2,:)))
+       call check_error_msg('rrtmgp_lw_main_set_vmr_ch4', &
+            gas_concs%set_vmr(trim(active_gases_array(istr_ch4)),vmr_ch4(iCol:iCol2,:)))
+       call check_error_msg('rrtmgp_lw_main_set_vmr_n2o', &
+            gas_concs%set_vmr(trim(active_gases_array(istr_n2o)),vmr_n2o(iCol:iCol2,:)))
+       call check_error_msg('rrtmgp_lw_main_set_vmr_h2o', &
+            gas_concs%set_vmr(trim(active_gases_array(istr_h2o)),vmr_h2o(iCol:iCol2,:)))
+       call check_error_msg('rrtmgp_lw_main_set_vmr_o3',  &
+            gas_concs%set_vmr(trim(active_gases_array(istr_o3)), vmr_o3(iCol:iCol2,:)))
+
+       ! ###################################################################################
+       !
+       ! Surface emissity in each band
+       !
+       ! ###################################################################################
+       ! Assign same emissivity to all band
+       do iblck=1,rrtmgp_phys_blksz
+          if (semis(iCol+iblck-1) > eps .and. semis(iCol+iblck-1) <= 1._kind_phys) then
+             do iBand=1,lw_gas_props%get_nband()
+                sfc_emiss_byband(iBand,iblck) = semis(iCol+iblck-1)
+             enddo
+          else
+             sfc_emiss_byband(1:lw_gas_props%get_nband(),iblck) = 1.0
+          endif
+       enddo
+
+       ! ###################################################################################
+       !
+       ! Compute gas-optics...
+       !
+       ! ###################################################################################
+       call check_error_msg('rrtmgp_lw_main_gas_optics',lw_gas_props%gas_optics(&
+            p_lay(iCol:iCol2,:),              & ! IN  - Pressure @ layer-centers (Pa)
+            p_lev(iCol:iCol2,:),              & ! IN  - Pressure @ layer-interfaces (Pa)
+            t_lay(iCol:iCol2,:),              & ! IN  - Temperature @ layer-centers (K)
+            tsfg(iCol:iCol2),                 & ! IN  - Skin-temperature (K)
+            gas_concs,                        & ! IN  - RRTMGP DDT: trace gas volumne mixing-ratios
+            lw_optical_props_clrsky,          & ! OUT - RRTMGP DDT: longwave optical properties
+            sources,                          & ! OUT - RRTMGP DDT: source functions
+            tlev=t_lev(iCol:iCol2,:)))          ! IN  - Temperature @ layer-interfaces (K) (optional)
+
+       ! ###################################################################################
+       !
+       ! Compute cloud-optics...
+       !
+       ! ###################################################################################
+       ! Create clear/cloudy indicator
+       zcf0(:) = 1._kind_phys
+       zcf1(:) = 1._kind_phys
+       do iblck = 1, rrtmgp_phys_blksz
+          do iLay=1,nLay
+             zcf0(iblck) = min(zcf0(iblck), 1._kind_phys - cld_frac(iCol+iblck-1,iLay))
+          enddo
+          if (zcf0(iblck) <= ftiny)   zcf0(iblck) = 0._kind_phys
+          if (zcf0(iblck) > oneminus) zcf0(iblck) = 1._kind_phys
+          zcf1(iblck) = 1._kind_phys - zcf0(iblck)
+       enddo
+
+       if (any(zcf1 .gt. eps)) then
+          ! Microphysical (gridmean) cloud optics
+          call check_error_msg('rrtmgp_lw_main_cloud_optics',lw_cloud_props%cloud_optics(&
+               cld_lwp(iCol:iCol2,:),                & ! IN  - Cloud liquid water path (g/m2)
+               cld_iwp(iCol:iCol2,:),                & ! IN  - Cloud ice water path (g/m2)
+               cld_reliq(iCol:iCol2,:),              & ! IN  - Cloud liquid effective radius (microns)
+               cld_reice(iCol:iCol2,:),              & ! IN  - Cloud ice effective radius (microns)
+               lw_optical_props_cloudsByBand))         ! OUT - RRTMGP DDT containing cloud radiative properties
+                                                       !       in each band
+          ! Include convective (subgrid scale) clouds?
+          if (doGP_sgs_cnv) then
+             ! Compute
+             call check_error_msg('rrtmgp_lw_main_cnv_cloud_optics',lw_cloud_props%cloud_optics(&
+                  cld_cnv_lwp(iCol:iCol2,:),         & ! IN  - Convective cloud liquid water path (g/m2)
+                  cld_cnv_iwp(iCol:iCol2,:),         & ! IN  - Convective cloud ice water path (g/m2)
+                  cld_cnv_reliq(iCol:iCol2,:),       & ! IN  - Convective cloud liquid effective radius (microns)
+                  cld_cnv_reice(iCol:iCol2,:),       & ! IN  - Convective cloud ice effective radius (microns)
+                  lw_optical_props_cnvcloudsByBand))   ! OUT - RRTMGP DDT containing convective cloud radiative properties
+                                                       !       in each band
+             ! Increment
+             call check_error_msg('rrtmgp_lw_main_increment_cnvclouds_to_clouds',&
+                  lw_optical_props_cnvcloudsByBand%increment(lw_optical_props_cloudsByBand))
+          endif
+
+          ! Include PBL (subgrid scale) clouds?
+          if (doGP_sgs_pbl) then
+             ! Compute
+             call check_error_msg('rrtmgp_lw_main_pbl_cloud_optics',lw_cloud_props%cloud_optics(&
+                  cld_pbl_lwp(iCol:iCol2,:),         & ! IN  - PBL cloud liquid water path (g/m2)
+                  cld_pbl_iwp(iCol:iCol2,:),         & ! IN  - PBL cloud ice water path (g/m2)
+                  cld_pbl_reliq(iCol:iCol2,:),       & ! IN  - PBL cloud liquid effective radius (microns)
+                  cld_pbl_reice(iCol:iCol2,:),       & ! IN  - PBL cloud ice effective radius (microns)
+                  lw_optical_props_pblcloudsByBand))   ! OUT - RRTMGP DDT containing PBL cloud radiative properties
+                                                       !       in each band
+             ! Increment
+             call check_error_msg('rrtmgp_lw_main_increment_pblclouds_to_clouds',&
+                  lw_optical_props_pblcloudsByBand%increment(lw_optical_props_cloudsByBand))
+          endif
+       endif
+
+       ! ###################################################################################
+       !
+       ! Cloud precipitation optics: rain and snow(+groupel)
+       !
+       ! ###################################################################################
+       tau_rain(:) = 0._kind_phys
+       tau_snow(:) = 0._kind_phys
+       do ix=1,rrtmgp_phys_blksz
+          do iLay=1,nLay
+             if (cld_frac(iCol+ix-1,iLay) .gt. eps) then
+                ! Rain optical-depth (No band dependence)
+                tau_rain(ix) = absrain*cld_rwp(iCol+ix-1,iLay)
+                
+                ! Snow (+groupel) optical-depth (No band dependence)
+                if (cld_swp(iCol+ix-1,iLay) .gt. 0. .and. cld_resnow(iCol+ix-1,iLay) .gt. 10._kind_phys) then
+                   tau_snow(ix) = abssnow0*1.05756*cld_swp(iCol+ix-1,iLay)/cld_resnow(iCol+ix-1,iLay)
+                else
+                   tau_snow(ix) = 0.0
+                endif
+                do iBand=1,lw_gas_props%get_nband()
+                   lw_optical_props_precipByBand%tau(ix,iLay,iBand) = tau_rain(ix) + tau_snow(ix)
+                enddo
+             endif
+          enddo
+       enddo
+       ! Increment
+       call check_error_msg('rrtmgp_lw_main_increment_precip_to_clouds',&
+            lw_optical_props_precipByBand%increment(lw_optical_props_cloudsByBand))
+
+       ! ###################################################################################
+       !
+       ! Cloud-sampling
+       ! *Note* All of the included cloud-types are sampled together, not independently.
+       !
+       ! ###################################################################################
+       if (any(zcf1 .gt. eps)) then
+          ! Change random number seed value for each radiation invocation (isubc_lw =1 or 2).
+          if(isubc_lw == 1) then      ! advance prescribed permutation seed
+             do ix=1,rrtmgp_phys_blksz
+                ipseed_lw(ix) = lw_gas_props%get_ngpt() + iCol + ix - 1
+             enddo
+          elseif (isubc_lw == 2) then ! use input array of permutaion seeds
+             do ix=1,rrtmgp_phys_blksz
+                ipseed_lw(ix) = icseed_lw(iCol+ix-1)
+             enddo
+          endif
+
+          ! Call RNG
+          do ix=1,rrtmgp_phys_blksz
+             call random_setseed(ipseed_lw(ix),rng_stat)
+             ! Use same rng for each layer
+             if (iovr == iovr_max) then
+                call random_number(rng1D,rng_stat)
+                do iLay=1,nLay
+                   rng3D(:,iLay,ix) = rng1D
+                enddo
+             else
+                do iLay=1,nLay
+                   call random_number(rng1D,rng_stat)
+                   rng3D(:,iLay,ix) = rng1D
+                enddo
+             endif
+          enddo
+
+          ! Cloud-overlap.
+          ! Maximum-random, random or maximum.
+          if (iovr == iovr_maxrand .or. iovr == iovr_rand .or. iovr == iovr_max) then
+             call sampled_mask(real(rng3D,kind=kind_phys), cld_frac(iCol:iCol2,:), maskMCICA)
+          endif
+          ! Exponential decorrelation length overlap
+          if (iovr == iovr_dcorr) then
+             do ix=1,rrtmgp_phys_blksz
+                ! Generate second RNG
+                call random_setseed(ipseed_lw(ix),rng_stat)
+                call random_number(rng2D,rng_stat)
+                rng3D2(:,:,ix) = reshape(source = rng2D,shape=[lw_gas_props%get_ngpt(),nLay])
+             enddo
+             !
+             call sampled_mask(real(rng3D,kind=kind_phys), cld_frac(iCol:iCol2,:), maskMCICA,                    &
+                  overlap_param = cloud_overlap_param(iCol:iCol2,1:nLay-1), randoms2 = real(rng3D2, kind=kind_phys))
+          endif
+          ! Exponential or Exponential-random
+          if (iovr == iovr_exp .or. iovr == iovr_exprand) then
+             call sampled_mask(real(rng3D,kind=kind_phys), cld_frac(iCol:iCol2,:), maskMCICA,  &
+                  overlap_param = cloud_overlap_param(iCol:iCol2,1:nLay-1))
+          endif
+          ! Sampling. Map band optical depth to each g-point using McICA
+          call check_error_msg('rrtmgp_lw_main_cloud_sampling',&
+               draw_samples(maskMCICA, .true., &
+               lw_optical_props_cloudsByBand, lw_optical_props_clouds))
+       endif
+
+       ! ###################################################################################
+       !
+       ! Compute clear-sky fluxes (gaseous+aerosol) (optional)
+       !
+       ! ###################################################################################
+       ! Increment
+       lw_optical_props_aerosol_local%tau = aerlw_tau(iCol:iCol2,:,:)
+       call check_error_msg('rrtmgp_lw_main_increment_aerosol_to_clrsky',&
+            lw_optical_props_aerosol_local%increment(lw_optical_props_clrsky))
+
+       ! Call RTE solver
+       if (doLWclrsky) then
+          call check_error_msg('rrtmgp_lw_main_opt_angle',&
+               lw_gas_props%compute_optimal_angles(lw_optical_props_clrsky,lw_Ds))
+          if (nGauss_angles .gt. 1) then
+             call check_error_msg('rrtmgp_lw_main_lw_rte_clrsky',rte_lw(           &
+                  lw_optical_props_clrsky,         & ! IN  - optical-properties
+                  top_at_1,                        & ! IN  - veritcal ordering flag
+                  sources,                         & ! IN  - source function
+                  sfc_emiss_byband,                & ! IN  - surface emissivity in each LW band
+                  flux_clrsky,                     & ! OUT - Fluxes
+                  n_gauss_angles = nGauss_angles))   ! IN  - Number of angles in Gaussian quadrature
+          else
+             call check_error_msg('rrtmgp_lw_main_lw_rte_clrsky',rte_lw(           &
+                  lw_optical_props_clrsky,         & ! IN  - optical-properties
+                  top_at_1,                        & ! IN  - veritcal ordering flag
+                  sources,                         & ! IN  - source function
+                  sfc_emiss_byband,                & ! IN  - surface emissivity in each LW band
+                  flux_clrsky,                     & ! OUT - Fluxes
+                  lw_Ds = lw_Ds))
+          endif
+          
+          ! Store fluxes
+          fluxlwUP_clrsky(iCol:iCol2,:)   = sum(flux_clrsky%bnd_flux_up, dim=3)
+          fluxlwDOWN_clrsky(iCol:iCol2,:) = sum(flux_clrsky%bnd_flux_dn, dim=3)
+       else
+          fluxlwUP_clrsky(iCol:iCol2,:)   = 0.0
+          fluxlwDOWN_clrsky(iCol:iCol2,:) = 0.0   
+       endif
+
+       ! ###################################################################################
+       !
+       ! All-sky fluxes (clear-sky + clouds + precipitation)
+       ! *Note* CCPP does not allow for polymorphic types, they are ambiguous to the CCPP
+       ! framework. rte-rrtmgp uses polymorphic types extensively, for example, querying the
+       ! type to determine physics configuration/pathway/etc...
+       !
+       ! The logic in the code below is to satisfy the polymorphishm in the rte-rrtmgp code.
+       ! The rte-rrtmgp "increment" procedures are utilized to provide the correct type to the
+       ! rte solver (rte_lw). Rte_lw quieries the type determine if scattering is to be 
+       ! included in the calculation. The increment procedures are called so that the correct
+       ! optical properties are inherited. ugh...
+       ! 
+       ! ###################################################################################
+
+       ! Include LW cloud-scattering?
+       if (doGP_lwscat) then 
+          ! Increment
+          call check_error_msg('rrtmgp_lw_main_increment_clrsky_to_clouds',&
+               lw_optical_props_clrsky%increment(lw_optical_props_clouds))
+          
+          if (use_LW_jacobian) then
+             ! Compute LW Jacobians
+             call check_error_msg('rrtmgp_lw_main_lw_rte_allsky',rte_lw(           &
+                  lw_optical_props_clouds,         & ! IN  - optical-properties
+                  top_at_1,                        & ! IN  - veritcal ordering flag
+                  sources,                         & ! IN  - source function
+                  sfc_emiss_byband,                & ! IN  - surface emissivity in each LW band
+                  flux_allsky,                     & ! OUT - Flxues 
+                  n_gauss_angles = nGauss_angles,  & ! IN  - Number of angles in Gaussian quadrature
+                  flux_up_Jac    = fluxlwUP_jac))    ! OUT - surface temperature flux (upward) Jacobian (W/m2/K)
+          else
+             call check_error_msg('rrtmgp_lw_main_lw_rte_allsky',rte_lw(           &
+                  lw_optical_props_clouds,         & ! IN  - optical-properties
+                  top_at_1,                        & ! IN  - veritcal ordering flag
+                  sources,                         & ! IN  - source function
+                  sfc_emiss_byband,                & ! IN  - surface emissivity in each LW band
+                  flux_allsky,                     & ! OUT - Flxues 
+                  n_gauss_angles = nGauss_angles))   ! IN  - Number of angles in Gaussian quadrature    
+          end if
+       ! No scattering in LW clouds.   
+       else
+          ! Increment
+          call check_error_msg('rrtmgp_lw_main_increment_clouds_to_clrsky', &
+               lw_optical_props_clouds%increment(lw_optical_props_clrsky))
+          
+          if (use_LW_jacobian) then
+             ! Compute LW Jacobians
+             call check_error_msg('rrtmgp_lw_rte_run',rte_lw(           &
+                  lw_optical_props_clrsky,         & ! IN  - optical-properties
+                  top_at_1,                        & ! IN  - veritcal ordering flag
+                  sources,                         & ! IN  - source function
+                  sfc_emiss_byband,                & ! IN  - surface emissivity in each LW band
+                  flux_allsky,                     & ! OUT - Flxues 
+                  n_gauss_angles = nGauss_angles,  & ! IN  - Number of angles in Gaussian quadrature
+                  flux_up_Jac    = fluxlwUP_jac))    ! OUT - surface temperature flux (upward) Jacobian (W/m2/K)
+          else
+             call check_error_msg('rrtmgp_lw_rte_run',rte_lw(           &
+                  lw_optical_props_clrsky,         & ! IN  - optical-properties
+                  top_at_1,                        & ! IN  - veritcal ordering flag
+                  sources,                         & ! IN  - source function
+                  sfc_emiss_byband,                & ! IN  - surface emissivity in each LW band
+                  flux_allsky,                     & ! OUT - Flxues 
+                  n_gauss_angles = nGauss_angles))   ! IN  - Number of angles in Gaussian quadrature    
+          end if
+       endif
+       
+       ! Store fluxes
+       fluxlwUP_allsky(iCol:iCol2,:)   = sum(flux_allsky%bnd_flux_up, dim=3)
+       fluxlwDOWN_allsky(iCol:iCol2,:) = sum(flux_allsky%bnd_flux_dn, dim=3)
+       
+       ! Save fluxes for coupling
+       fluxlwUP_radtime(iCol:iCol2,:)   = fluxlwUP_allsky(iCol:iCol2,:)
+       fluxlwDOWN_radtime(iCol:iCol2,:) = fluxlwDOWN_allsky(iCol:iCol2,:)
+
+    enddo
+
+  end subroutine rrtmgp_lw_main_run
+!> @}
+end module rrtmgp_lw_main
diff --git a/physics/rrtmgp_lw_main.meta b/physics/rrtmgp_lw_main.meta
new file mode 100644
index 000000000..a1a384b25
--- /dev/null
+++ b/physics/rrtmgp_lw_main.meta
@@ -0,0 +1,641 @@
+[ccpp-table-properties]
+  name = rrtmgp_lw_main
+  type = scheme
+  dependencies = machine.F,radiation_tools.F90,GFS_rrtmgp_pre.F90,rte-rrtmgp/rrtmgp/mo_gas_optics_rrtmgp.F90
+  dependencies = rte-rrtmgp/rte/mo_rte_kind.F90,rte-rrtmgp/rrtmgp/mo_gas_concentrations.F90,rte-rrtmgp/rte/mo_optical_props.F90
+  dependencies = rte-rrtmgp/rte/mo_source_functions.F90,rte-rrtmgp/rte/mo_rte_lw.F90,rte-rrtmgp/rte/mo_fluxes.F90
+  dependencies = rte-rrtmgp/rte/kernels/mo_fluxes_broadband_kernels.F90, rte-rrtmgp/rte/kernels/mo_rte_solver_kernels.F90
+  dependencies = mersenne_twister.f,rrtmgp_sampling.F90,rte-rrtmgp/extensions/mo_fluxes_byband.F90
+  dependencies = rrtmgp_lw_gas_optics.F90, rrtmgp_lw_cloud_optics.F90
+
+########################################################################
+[ccpp-arg-table]
+  name = rrtmgp_lw_main_init
+  type = scheme
+[rrtmgp_root_dir]
+  standard_name = directory_for_rte_rrtmgp_source_code
+  long_name = directory for rte+rrtmgp source code
+  units = none
+  dimensions =  ()
+  type = character
+  intent = in
+  kind = len=128
+[rrtmgp_lw_file_gas]
+  standard_name = filename_of_rrtmgp_longwave_k_distribution
+  long_name = file containing RRTMGP LW k-distribution
+  units = none
+  dimensions =  ()
+  type = character
+  intent = in
+  kind = len=128
+[rrtmgp_lw_file_clouds]
+  standard_name = filename_of_rrtmgp_longwave_cloud_optics_coefficients 
+  long_name = file containing coefficients for RRTMGP LW cloud optics
+  units = none
+  dimensions =  ()
+  type = character
+  intent = in
+  kind = len=128
+[doGP_cldoptics_PADE]
+  standard_name = flag_to_calc_lw_cld_optics_using_RRTMGP_PADE
+  long_name = logical flag to control cloud optics scheme.
+  units = flag
+  dimensions = ()
+  type = logical
+  intent = in
+[doGP_cldoptics_LUT]
+  standard_name = flag_to_calc_lw_cld_optics_using_RRTMGP_LUT
+  long_name = logical flag to control cloud optics scheme.
+  units = flag
+  dimensions = ()
+  type = logical
+  intent = in
+[doGP_sgs_cnv]
+  standard_name = flag_to_include_sgs_convective_cloud_in_RRTMGP
+  long_name = logical flag to control sgs convective cloud in RRTMGP
+  units = flag
+  dimensions = ()
+  type = logical
+  intent = in
+[doGP_sgs_pbl]
+  standard_name = flag_to_include_sgs_MYNN_EDMF_cloud_in_RRTMGP
+  long_name = logical flag to control MYNN-EDMF PBL cloud in RRTMGP
+  units = flag
+  dimensions = ()
+  type = logical
+  intent = in
+[nrghice]
+  standard_name = number_of_ice_roughness_categories
+  long_name = number of ice-roughness categories in RRTMGP calculation
+  units = count
+  dimensions =  ()
+  type = integer
+  intent = inout
+[mpirank]
+  standard_name = mpi_rank
+  long_name = current MPI rank
+  units = index
+  dimensions = ()
+  type = integer
+  intent = in
+[mpiroot]
+  standard_name = mpi_root
+  long_name = master MPI rank
+  units = index
+  dimensions = ()
+  type = integer
+  intent = in
+[mpicomm]
+  standard_name = mpi_communicator
+  long_name = MPI communicator
+  units = index
+  dimensions = ()
+  type = integer
+  intent = in
+[rrtmgp_phys_blksz]
+  standard_name = number_of_columns_per_RRTMGP_LW_block
+  long_name = number of columns to process at a time by RRTMGP LW scheme
+  units = count
+  dimensions =  ()
+  type = integer
+  intent = in
+[nLay]
+  standard_name = vertical_layer_dimension
+  long_name = number of vertical levels
+  units = count
+  dimensions = ()
+  type = integer
+  intent = in
+[active_gases_array]
+  standard_name = list_of_active_gases_used_by_RRTMGP
+  long_name = list of active gases used by RRTMGP
+  units = none
+  dimensions =  (number_of_active_gases_used_by_RRTMGP)
+  type = character
+  kind = len=*
+  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
+
+########################################################################
+[ccpp-arg-table]
+  name = rrtmgp_lw_main_run
+  type = scheme
+[doLWrad]
+  standard_name = flag_for_calling_longwave_radiation
+  long_name = logical flags for lw radiation calls
+  units = flag
+  dimensions = ()
+  type = logical
+  intent = in
+[doLWclrsky]
+  standard_name = flag_for_output_of_tendency_of_air_temperature_due_to_longwave_heating_on_radiation_timestep_assuming_clear_sky
+  long_name = flag to output lw heating rate (Radtend%lwhc)
+  units = flag
+  dimensions = ()
+  type = logical  
+  intent = in
+[top_at_1]
+  standard_name = flag_for_vertical_ordering_in_RRTMGP
+  long_name = flag for vertical ordering in RRTMGP
+  units = flag
+  dimensions = ()
+  type = logical
+  intent = in
+[use_LW_jacobian]
+  standard_name = flag_to_calc_RRTMGP_LW_jacobian
+  long_name = logical flag to control RRTMGP LW calculation
+  units = flag
+  dimensions = ()
+  type = logical 
+  intent = in
+[doGP_lwscat] 
+  standard_name = flag_to_include_longwave_scattering_in_cloud_optics
+  long_name = logical flag to control the addition of LW scattering in RRTMGP 
+  units = flag
+  dimensions = ()
+  type = logical  
+  intent = in
+[doGP_sgs_cnv]
+  standard_name = flag_to_include_sgs_convective_cloud_in_RRTMGP
+  long_name = logical flag to control sgs convective cloud in RRTMGP
+  units = flag
+  dimensions = ()
+  type = logical
+  intent = in
+[doGP_sgs_pbl]
+  standard_name = flag_to_include_sgs_MYNN_EDMF_cloud_in_RRTMGP
+  long_name = logical flag to control MYNN-EDMF PBL cloud in RRTMGP
+  units = flag
+  dimensions = ()
+  type = logical
+  intent = in
+[ncol]
+  standard_name = horizontal_loop_extent
+  long_name = horizontal dimension
+  units = count
+  dimensions = ()
+  type = integer
+  intent = in
+[rrtmgp_phys_blksz]
+  standard_name = number_of_columns_per_RRTMGP_LW_block
+  long_name = number of columns to process at a time by RRTMGP LW scheme
+  units = count
+  dimensions =  ()
+  type = integer
+  intent = in
+[nLay]
+  standard_name = vertical_layer_dimension
+  long_name = number of vertical levels
+  units = count
+  dimensions = ()
+  type = integer
+  intent = in
+[nGauss_angles]
+  standard_name = number_of_gaussian_quadrature_angles_for_radiation
+  long_name = Number of angles used in Gaussian quadrature
+  units = count
+  dimensions =  ()
+  type = integer
+  intent = in
+[nGases]
+  standard_name = number_of_active_gases_used_by_RRTMGP
+  long_name = number of gases available used by RRTMGP (Model%nGases)
+  units = count
+  dimensions =  ()
+  type = integer
+  intent = in
+[isubc_lw]
+  standard_name = flag_for_lw_clouds_sub_grid_approximation
+  long_name = flag for lw clouds sub-grid approximation
+  units = flag
+  dimensions = ()
+  type = integer
+  intent = in
+[iovr]
+  standard_name = flag_for_cloud_overlap_method_for_radiation
+  long_name = max-random overlap clouds
+  units = flag
+  dimensions = ()
+  type = integer
+  intent = in
+[iovr_maxrand]
+  standard_name = flag_for_maximum_random_cloud_overlap_method
+  long_name = choice of maximum-random cloud overlap method
+  units = flag
+  dimensions = ()
+  type = integer
+  intent = in
+[iovr_dcorr]
+  standard_name = flag_for_decorrelation_length_cloud_overlap_method
+  long_name = choice of decorrelation-length cloud overlap method
+  units     = flag
+  dimensions = ()
+  type = integer
+  intent = in
+[iovr_exp]
+  standard_name = flag_for_exponential_cloud_overlap_method
+  long_name = choice of exponential cloud overlap method
+  units     = flag
+  dimensions = ()
+  type = integer
+  intent = in
+[iovr_exprand]
+  standard_name = flag_for_exponential_random_cloud_overlap_method
+  long_name = choice of exponential-random cloud overlap method
+  units     = flag
+  dimensions = ()
+  type = integer
+  intent = in
+[iovr_rand]
+  standard_name = flag_for_random_cloud_overlap_method
+  long_name = choice of random cloud overlap method
+  units = flag
+  dimensions = ()
+  type = integer
+  intent = in
+[iovr_max]
+  standard_name = flag_for_maximum_cloud_overlap_method
+  long_name = choice of maximum cloud overlap method
+  units = flag
+  dimensions = ()
+  type = integer
+  intent = in
+[iovr_convcld]
+  standard_name = flag_for_convective_cloud_overlap_method_for_radiation
+  long_name = flag for convective cloud overlap method
+  units = flag
+  dimensions = ()
+  type = integer
+  intent = in
+[icseed_lw]
+  standard_name = random_number_seed_for_mcica_longwave
+  long_name = seed for random number generation for longwave radiation
+  units = none
+  dimensions = (horizontal_loop_extent)
+  type = integer
+  intent = in
+[semis]
+  standard_name = surface_longwave_emissivity
+  long_name = surface lw emissivity in fraction
+  units = frac
+  dimensions = (horizontal_loop_extent)
+  type = real
+  kind = kind_phys
+  intent = in
+[tsfg]
+  standard_name = surface_ground_temperature_for_radiation
+  long_name = surface ground temperature for radiation
+  units = K
+  dimensions = (horizontal_loop_extent)
+  type = real
+  kind = kind_phys
+  intent = in
+[p_lay]
+  standard_name = air_pressure_at_layer_for_RRTMGP
+  long_name = air pressure at vertical layer for radiation calculation
+  units = Pa
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[p_lev]
+  standard_name = air_pressure_at_interface_for_RRTMGP
+  long_name = air pressure at vertical interface for radiation calculation
+  units = Pa
+  dimensions = (horizontal_loop_extent,vertical_interface_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[t_lay]
+  standard_name = air_temperature_at_layer_for_RRTMGP
+  long_name = air temperature at vertical layer for radiation calculation
+  units = K
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[t_lev]
+  standard_name = air_temperature_at_interface_for_RRTMGP
+  long_name = air temperature  at vertical interface for radiation calculation
+  units = K
+  dimensions = (horizontal_loop_extent,vertical_interface_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[vmr_o2]
+  standard_name = volume_mixing_ratio_for_o2
+  long_name = molar mixing ratio of o2 in with respect to dry air
+  units = 1
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[vmr_h2o]
+  standard_name = volume_mixing_ratio_for_h2o
+  long_name = molar mixing ratio of h2o in with respect to dry air
+  units = 1
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[vmr_o3]
+  standard_name = volume_mixing_ratio_for_o3
+  long_name = molar mixing ratio of o3 in with respect to dry air
+  units = 1
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[vmr_ch4]
+  standard_name = volume_mixing_ratio_for_ch4
+  long_name = molar mixing ratio of ch4 in with respect to dry air
+  units = 1
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[vmr_n2o]
+  standard_name = volume_mixing_ratio_for_n2o
+  long_name = molar mixing ratio of n2o in with respect to dry air
+  units = 1
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[vmr_co2]
+  standard_name = volume_mixing_ratio_for_co2
+  long_name = molar mixing ratio of co2 in with respect to dry air
+  units = 1
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[cld_frac]
+  standard_name = total_cloud_fraction
+  long_name = layer total cloud fraction
+  units = frac
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[cld_lwp]
+  standard_name = cloud_liquid_water_path
+  long_name = layer cloud liquid water path
+  units = g m-2
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[cld_reliq]
+  standard_name = mean_effective_radius_for_liquid_cloud
+  long_name = mean effective radius for liquid cloud
+  units = um
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[cld_iwp]
+  standard_name = cloud_ice_water_path
+  long_name = layer cloud ice water path
+  units = g m-2
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[cld_reice]
+  standard_name = mean_effective_radius_for_ice_cloud
+  long_name = mean effective radius for ice cloud
+  units = um
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[cld_swp]
+  standard_name = cloud_snow_water_path
+  long_name = layer cloud snow water path
+  units = g m-2
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[cld_resnow]
+  standard_name = mean_effective_radius_for_snow_flake
+  long_name = mean effective radius for snow cloud
+  units = um
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[cld_rwp]
+  standard_name = cloud_rain_water_path
+  long_name = layer cloud rain water path
+  units = g m-2
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[cld_rerain]
+  standard_name = mean_effective_radius_for_rain_drop
+  long_name = mean effective radius for rain cloud
+  units = um
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[precip_frac]
+  standard_name = precipitation_fraction_by_layer
+  long_name = precipitation fraction in each layer
+  units = frac
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[cld_cnv_lwp]
+  standard_name = convective_cloud_liquid_water_path
+  long_name = layer convective cloud liquid water path
+  units = g m-2
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[cld_cnv_iwp]
+  standard_name = convective_cloud_ice_water_path
+  long_name = layer convective cloud ice water path
+  units = g m-2
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[cld_cnv_reliq]
+  standard_name = mean_effective_radius_for_liquid_convective_cloud
+  long_name = mean effective radius for liquid convective cloud
+  units = um
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[cld_cnv_reice]
+  standard_name = mean_effective_radius_for_ice_convective_cloud
+  long_name = mean effective radius for ice convective cloud
+  units = um
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[cld_pbl_lwp]
+  standard_name = MYNN_SGS_cloud_liquid_water_path
+  long_name = layer convective cloud liquid water path
+  units = g m-2
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[cld_pbl_iwp]
+  standard_name = MYNN_SGS_cloud_ice_water_path
+  long_name = layer convective cloud ice water path
+  units = g m-2
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[cld_pbl_reliq]
+  standard_name = mean_effective_radius_for_liquid_MYNN_SGS_cloud
+  long_name = mean effective radius for liquid MYNN_SGS cloud
+  units = um
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[cld_pbl_reice]
+  standard_name = mean_effective_radius_for_ice_MYNN_SGS_cloud
+  long_name = mean effective radius for ice MYNN_SGS cloud
+  units = um
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[cloud_overlap_param]
+  standard_name = cloud_overlap_param
+  long_name = cloud overlap parameter
+  units = km
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[active_gases_array]
+  standard_name = list_of_active_gases_used_by_RRTMGP
+  long_name = list of active gases used by RRTMGP
+  units = none
+  dimensions =  (number_of_active_gases_used_by_RRTMGP)
+  type = character
+  kind = len=*
+  intent = in
+[aerlw_tau]
+  standard_name = aerosol_optical_depth_for_longwave_bands_01_16
+  long_name = aerosol optical depth for longwave bands 01-16
+  units = none
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension,number_of_aerosol_bands_for_longwave_radiation)
+  type = real
+  kind = kind_phys
+  intent = in
+[aerlw_ssa]
+  standard_name = aerosol_single_scattering_albedo_for_longwave_bands_01_16
+  long_name = aerosol single scattering albedo for longwave bands 01-16
+  units = frac
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension,number_of_aerosol_bands_for_longwave_radiation)
+  type = real
+  kind = kind_phys
+  intent = in
+[aerlw_g]
+  standard_name = aerosol_asymmetry_parameter_for_longwave_bands_01_16
+  long_name = aerosol asymmetry parameter for longwave bands 01-16
+  units = none
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension,number_of_aerosol_bands_for_longwave_radiation)
+  type = real
+  kind = kind_phys
+  intent = in
+[fluxlwUP_radtime]
+  standard_name = RRTMGP_lw_flux_profile_upward_allsky_on_radiation_timestep
+  long_name = RRTMGP upward longwave all-sky flux profile
+  units = W m-2
+  dimensions = (horizontal_loop_extent,vertical_interface_dimension)
+  type = real
+  kind = kind_phys
+  intent = inout
+[fluxlwDOWN_radtime]
+  standard_name = RRTMGP_lw_flux_profile_downward_allsky_on_radiation_timestep
+  long_name = RRTMGP downward longwave all-sky flux profile
+  units = W m-2
+  dimensions = (horizontal_loop_extent,vertical_interface_dimension)
+  type = real
+  kind = kind_phys
+  intent = inout
+[fluxlwUP_allsky]
+  standard_name = RRTMGP_lw_flux_profile_upward_allsky
+  long_name = RRTMGP upward longwave all-sky flux profile
+  units = W m-2
+  dimensions = (horizontal_loop_extent,vertical_interface_dimension)
+  type = real
+  kind = kind_phys
+  intent = inout
+[fluxlwDOWN_allsky]
+  standard_name = RRTMGP_lw_flux_profile_downward_allsky
+  long_name = RRTMGP downward longwave all-sky flux profile
+  units = W m-2
+  dimensions = (horizontal_loop_extent,vertical_interface_dimension)
+  type = real
+  kind = kind_phys
+  intent = inout
+[fluxlwUP_clrsky]
+  standard_name = RRTMGP_lw_flux_profile_upward_clrsky
+  long_name = RRTMGP upward longwave clr-sky flux profile
+  units = W m-2
+  dimensions = (horizontal_loop_extent,vertical_interface_dimension)
+  type = real
+  kind = kind_phys
+  intent = inout
+[fluxlwDOWN_clrsky]
+  standard_name = RRTMGP_lw_flux_profile_downward_clrsky
+  long_name = RRTMGP downward longwave clr-sky flux profile
+  units = W m-2
+  dimensions = (horizontal_loop_extent,vertical_interface_dimension)
+  type = real
+  kind = kind_phys
+  intent = inout
+[fluxlwUP_jac]
+  standard_name = RRTMGP_jacobian_of_lw_flux_upward
+  long_name = RRTMGP Jacobian upward longwave flux profile
+  units = W m-2 K-1
+  dimensions = (horizontal_loop_extent,vertical_interface_dimension)
+  type = real
+  kind = kind_phys
+  intent = inout
+[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
\ No newline at end of file
diff --git a/physics/rrtmgp_lw_pre.F90 b/physics/rrtmgp_lw_pre.F90
deleted file mode 100644
index 1501ca319..000000000
--- a/physics/rrtmgp_lw_pre.F90
+++ /dev/null
@@ -1,61 +0,0 @@
-!> \file rrtmgp_lw_pre.F90
-!!
-!> \defgroup rrtmgp_lw_pre rrtmgp_lw_pre.F90
-!!
-!! \brief RRTMGP Longwave pre-processing routine.
-!!
-module rrtmgp_lw_pre
-  use machine, only: &
-       kind_phys                   ! Working type
-  use mo_gas_optics_rrtmgp,  only: &
-       ty_gas_optics_rrtmgp
-  use rrtmgp_lw_gas_optics, only: lw_gas_props
-
-  implicit none
-
-  public rrtmgp_lw_pre_run
-
-contains
-
-!>\defgroup rrtmgp_lw_pre_mode GFS RRTMGP-LW Pre Module
-!> \section arg_table_rrtmgp_lw_pre_run
-!! \htmlinclude rrtmgp_lw_pre_run.html
-!!
-!> \ingroup rrtmgp_lw_pre
-!!
-!! \brief
-!!
-!! \section rrtmgp_lw_pre_run
-  subroutine rrtmgp_lw_pre_run (doLWrad, semis, sfc_emiss_byband, errmsg, errflg)
-
-    ! Inputs
-    logical, intent(in) :: &
-         doLWrad
-    real(kind_phys), dimension(:), intent(in) :: &
-         semis
-
-    ! Outputs
-    real(kind_phys), dimension(:,:), intent(inout) :: &
-         sfc_emiss_byband ! Surface emissivity in each band
-    character(len=*), intent(out) :: &
-         errmsg           ! Error message
-    integer, intent(out) :: &  
-         errflg           ! Error flag
-
-    ! Local variables
-    integer :: iBand
-
-    ! Initialize CCPP error handling variables
-    errmsg = ''
-    errflg = 0
-
-    if (.not. doLWrad) return
-
-    ! Assign same emissivity to all bands
-    do iBand=1,lw_gas_props%get_nband()
-       sfc_emiss_byband(iBand,:) = semis
-    enddo
-
-  end subroutine rrtmgp_lw_pre_run
-  
-end module rrtmgp_lw_pre
diff --git a/physics/rrtmgp_lw_pre.meta b/physics/rrtmgp_lw_pre.meta
deleted file mode 100644
index aa2a06a0f..000000000
--- a/physics/rrtmgp_lw_pre.meta
+++ /dev/null
@@ -1,47 +0,0 @@
-[ccpp-table-properties]
-  name = rrtmgp_lw_pre
-  type = scheme
-  dependencies = iounitdef.f,machine.F
-
-########################################################################
-[ccpp-arg-table]
-  name = rrtmgp_lw_pre_run
-  type = scheme
-[doLWrad]
-  standard_name = flag_for_calling_longwave_radiation
-  long_name = logical flags for lw radiation calls
-  units = flag
-  dimensions = ()
-  type = logical
-  intent = in
-[semis]
-  standard_name = surface_longwave_emissivity
-  long_name = surface lw emissivity in fraction
-  units = frac
-  dimensions = (horizontal_loop_extent)
-  type = real
-  kind = kind_phys
-  intent = in
-[sfc_emiss_byband]
-  standard_name = surface_emissivity_in_each_RRTMGP_LW_band
-  long_name = surface emissivity in each RRTMGP LW band
-  units = none
-  dimensions = (number_of_longwave_bands,horizontal_loop_extent)
-  type = real
-  kind = kind_phys
-  intent = inout
-[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
diff --git a/physics/rrtmgp_lw_rte.F90 b/physics/rrtmgp_lw_rte.F90
deleted file mode 100644
index 9109a5780..000000000
--- a/physics/rrtmgp_lw_rte.F90
+++ /dev/null
@@ -1,208 +0,0 @@
-!> \file rrtmgp_lw_rte.F90
-!!
-!> \defgroup rrtmgp_lw_rte rrtmgp_lw_rte.F90
-!!
-!! \brief This module contains the main rte longwave driver.
-!!
-module rrtmgp_lw_rte
-  use machine,                only: kind_phys
-  use mo_optical_props,       only: ty_optical_props_1scl, ty_optical_props_2str
-  use mo_rte_lw,              only: rte_lw
-  use mo_fluxes_byband,       only: ty_fluxes_byband
-  use mo_source_functions,    only: ty_source_func_lw
-  use radiation_tools,        only: check_error_msg
-  use rrtmgp_lw_gas_optics,   only: lw_gas_props
-  implicit none
-
-  public rrtmgp_lw_rte_run
-contains
-
-!>\defgroup rrtmgp_lw_rte_mod GFS RRTMGP-LW RTE Module
-!> \section arg_table_rrtmgp_lw_rte_run
-!! \htmlinclude rrtmgp_lw_rte_run.html
-!!
-!> \ingroup rrtmgp_lw_rte 
-!!
-!! \brief This routine takes all of the longwave optical properties ,ty_optical_props_1scl,
-!! and computes the longwave radiative fluxes for cloudy and clear-sky conditions.  
-!!
-!! \section rrtmgp_lw_rte_run
-  subroutine rrtmgp_lw_rte_run(doLWrad, doLWclrsky, use_LW_jacobian, doGP_lwscat, nCol,     &
-       nLev, top_at_1, doGP_sgs_cnv, doGP_sgs_mynn, sfc_emiss_byband, sources,              &
-       lw_optical_props_clrsky, lw_optical_props_clouds, lw_optical_props_precipByBand,     &
-       lw_optical_props_cnvcloudsByBand, lw_optical_props_MYNNcloudsByBand,                 &
-       lw_optical_props_aerosol, nGauss_angles, fluxlwUP_allsky, fluxlwDOWN_allsky,         &
-       fluxlwUP_clrsky, fluxlwDOWN_clrsky, fluxlwUP_jac, fluxlwUP_radtime,                  &
-       fluxlwDOWN_radtime, errmsg, errflg)
-
-    ! Inputs
-    logical, intent(in) :: &
-         top_at_1,                & ! Vertical ordering flag
-         doLWrad,                 & ! Logical flag for longwave radiation call
-         doLWclrsky,              & ! Compute clear-sky fluxes for clear-sky heating-rate?
-         use_LW_jacobian,         & ! Compute Jacobian of LW to update radiative fluxes between radiation calls?
-         doGP_sgs_mynn,           & ! Flag for sgs MYNN-EDMF PBL cloud scheme
-         doGP_sgs_cnv,            & ! Flagg for sgs convective cloud scheme
-         doGP_lwscat                ! Include scattering in LW cloud-optics?
-    integer, intent(in) :: &
-         nCol,                    & ! Number of horizontal gridpoints
-         nLev,                    & ! Number of vertical levels
-         nGauss_angles              ! Number of angles used in Gaussian quadrature
-    real(kind_phys), dimension(:,:), intent(in) :: &
-         sfc_emiss_byband                    ! Surface emissivity in each band
-    type(ty_source_func_lw),intent(in) :: &
-         sources                             ! RRTMGP DDT: longwave source functions
-    type(ty_optical_props_1scl),intent(inout) :: &
-         lw_optical_props_aerosol,          &! RRTMGP DDT: longwave aerosol optical properties
-         lw_optical_props_clrsky             ! RRTMGP DDT: longwave clear-sky optical properties 
-    type(ty_optical_props_2str),intent(inout) :: &
-         lw_optical_props_clouds,          & ! RRTMGP DDT: longwave cloud optical properties
-         lw_optical_props_precipByBand,    & ! RRTMGP DDT: longwave precipitation optical properties
-         lw_optical_props_cnvcloudsByBand, & ! RRTMGP DDT: longwave convective cloud optical properties
-         lw_optical_props_MYNNcloudsByBand   ! RRTMGP DDT: longwave MYNN-EDMF PBL cloud optical properties
-    ! Outputs
-    real(kind_phys), dimension(:,:), intent(inout) :: &
-         fluxlwUP_jac,             & ! Jacobian of upwelling LW surface radiation (W/m2/K) 
-         fluxlwUP_allsky,          & ! All-sky flux (W/m2)
-         fluxlwDOWN_allsky,        & ! All-sky flux (W/m2)
-         fluxlwUP_clrsky,          & ! Clear-sky flux (W/m2)
-         fluxlwDOWN_clrsky,        & ! All-sky flux (W/m2)
-         fluxlwUP_radtime,         & ! Copy of fluxes (Used for coupling)
-         fluxlwDOWN_radtime
-    character(len=*), intent(out) :: & 
-         errmsg                      ! CCPP error message
-    integer, intent(out) :: & 
-         errflg                      ! CCPP error flag         
-
-    ! Local variables
-    type(ty_fluxes_byband) :: &
-         flux_allsky, flux_clrsky
-    real(kind_phys), dimension(ncol,nLev+1,lw_gas_props%get_nband()),target :: &
-         fluxLW_up_allsky, fluxLW_up_clrsky, fluxLW_dn_allsky, fluxLW_dn_clrsky
-    real(kind_phys), dimension(nCol,lw_gas_props%get_ngpt()) :: lw_Ds
-
-    ! Initialize CCPP error handling variables
-    errmsg = ''
-    errflg = 0
-
-    if (.not. doLWrad) return
-
-    ! Initialize RRTMGP DDT containing 2D(3D) fluxes
-    flux_allsky%bnd_flux_up => fluxLW_up_allsky
-    flux_allsky%bnd_flux_dn => fluxLW_dn_allsky
-    flux_clrsky%bnd_flux_up => fluxLW_up_clrsky
-    flux_clrsky%bnd_flux_dn => fluxLW_dn_clrsky
-
-    !
-    ! Compute clear-sky fluxes (if requested)
-    !
-    ! Add aerosol optics to gas optics
-    call check_error_msg('rrtmgp_lw_rte_run',lw_optical_props_aerosol%increment(lw_optical_props_clrsky))
-
-    ! Call RTE solver
-    if (doLWclrsky) then
-       call check_error_msg('rrtmgp_lw_rte_run_opt_angle',lw_gas_props%compute_optimal_angles(lw_optical_props_clrsky,lw_Ds))
-       if (nGauss_angles .gt. 1) then
-          call check_error_msg('rrtmgp_lw_rte_run',rte_lw(           &
-               lw_optical_props_clrsky,         & ! IN  - optical-properties
-               top_at_1,                        & ! IN  - veritcal ordering flag
-               sources,                         & ! IN  - source function
-               sfc_emiss_byband,                & ! IN  - surface emissivity in each LW band
-               flux_clrsky,                     & ! OUT - Fluxes
-               n_gauss_angles = nGauss_angles))   ! IN  - Number of angles in Gaussian quadrature
-       else
-          call check_error_msg('rrtmgp_lw_rte_run',rte_lw(           &
-               lw_optical_props_clrsky,         & ! IN  - optical-properties
-               top_at_1,                        & ! IN  - veritcal ordering flag
-               sources,                         & ! IN  - source function
-               sfc_emiss_byband,                & ! IN  - surface emissivity in each LW band
-               flux_clrsky,                     & ! OUT - Fluxes
-               lw_Ds = lw_Ds))
-       endif
-
-       ! Store fluxes
-       fluxlwUP_clrsky   = sum(flux_clrsky%bnd_flux_up,dim=3)
-       fluxlwDOWN_clrsky = sum(flux_clrsky%bnd_flux_dn,dim=3)
-    else
-       fluxlwUP_clrsky   = 0.0
-       fluxlwDOWN_clrsky = 0.0   
-    endif
-    
-    !
-    ! All-sky fluxes (clear-sky + clouds + precipitation)
-    !
-
-    ! Include convective cloud?
-    if (doGP_sgs_cnv) then
-       call check_error_msg('rrtmgp_lw_rte_run',lw_optical_props_cnvcloudsByBand%increment(lw_optical_props_clrsky))
-    endif
-
-    ! Include MYNN-EDMF PBL clouds?
-    if (doGP_sgs_mynn) then
-        call check_error_msg('rrtmgp_lw_rte_run',lw_optical_props_MYNNcloudsByBand%increment(lw_optical_props_clrsky))
-    endif
-
-    ! Add in precipitation
-    call check_error_msg('rrtmgp_lw_rte_run',lw_optical_props_precipByBand%increment(lw_optical_props_clouds))
-
-    ! Include LW cloud-scattering?
-    if (doGP_lwscat) then 
-       ! Add clear-sky optics to cloud-optics (2-stream)
-       call check_error_msg('rrtmgp_lw_rte_run',lw_optical_props_clrsky%increment(lw_optical_props_clouds))
-       
-       if (use_LW_jacobian) then
-          ! Compute LW Jacobians
-          call check_error_msg('rrtmgp_lw_rte_run',rte_lw(           &
-               lw_optical_props_clouds,         & ! IN  - optical-properties
-               top_at_1,                        & ! IN  - veritcal ordering flag
-               sources,                         & ! IN  - source function
-               sfc_emiss_byband,                & ! IN  - surface emissivity in each LW band
-               flux_allsky,                     & ! OUT - Flxues 
-               n_gauss_angles = nGauss_angles,  & ! IN  - Number of angles in Gaussian quadrature
-               flux_up_Jac    = fluxlwUP_jac))    ! OUT - surface temperature flux (upward) Jacobian (W/m2/K)
-       else
-          call check_error_msg('rrtmgp_lw_rte_run',rte_lw(           &
-               lw_optical_props_clouds,         & ! IN  - optical-properties
-               top_at_1,                        & ! IN  - veritcal ordering flag
-               sources,                         & ! IN  - source function
-               sfc_emiss_byband,                & ! IN  - surface emissivity in each LW band
-               flux_allsky,                     & ! OUT - Flxues 
-               n_gauss_angles = nGauss_angles))   ! IN  - Number of angles in Gaussian quadrature    
-       end if
-    ! No scattering in LW clouds.   
-    else
-       ! Add cloud optics to clear-sky optics (scalar)
-       call check_error_msg('rrtmgp_lw_rte_run',lw_optical_props_clouds%increment(lw_optical_props_clrsky))
-    
-       if (use_LW_jacobian) then
-          ! Compute LW Jacobians
-          call check_error_msg('rrtmgp_lw_rte_run',rte_lw(           &
-               lw_optical_props_clrsky,         & ! IN  - optical-properties
-               top_at_1,                        & ! IN  - veritcal ordering flag
-               sources,                         & ! IN  - source function
-               sfc_emiss_byband,                & ! IN  - surface emissivity in each LW band
-               flux_allsky,                     & ! OUT - Flxues 
-               n_gauss_angles = nGauss_angles,  & ! IN  - Number of angles in Gaussian quadrature
-               flux_up_Jac    = fluxlwUP_jac))    ! OUT - surface temperature flux (upward) Jacobian (W/m2/K)
-       else
-          call check_error_msg('rrtmgp_lw_rte_run',rte_lw(           &
-               lw_optical_props_clrsky,         & ! IN  - optical-properties
-               top_at_1,                        & ! IN  - veritcal ordering flag
-               sources,                         & ! IN  - source function
-               sfc_emiss_byband,                & ! IN  - surface emissivity in each LW band
-               flux_allsky,                     & ! OUT - Flxues 
-               n_gauss_angles = nGauss_angles))   ! IN  - Number of angles in Gaussian quadrature    
-       end if    
-    endif
-    
-    ! Store fluxes
-    fluxlwUP_allsky   = sum(flux_allsky%bnd_flux_up,dim=3)
-    fluxlwDOWN_allsky = sum(flux_allsky%bnd_flux_dn,dim=3) 
-
-    ! Save fluxes for coupling
-    fluxlwUP_radtime   = fluxlwUP_allsky
-    fluxlwDOWN_radtime = fluxlwDOWN_allsky
-
-  end subroutine rrtmgp_lw_rte_run
-
-end module rrtmgp_lw_rte
diff --git a/physics/rrtmgp_lw_rte.meta b/physics/rrtmgp_lw_rte.meta
deleted file mode 100644
index 0ad0754b5..000000000
--- a/physics/rrtmgp_lw_rte.meta
+++ /dev/null
@@ -1,208 +0,0 @@
-[ccpp-table-properties]
-  name = rrtmgp_lw_rte
-  type = scheme
-  dependencies = machine.F,rte-rrtmgp/rte/mo_rte_lw.F90,rte-rrtmgp/rte/mo_fluxes.F90,rte-rrtmgp/rte/kernels/mo_fluxes_broadband_kernels.F90,radiation_tools.F90
-  dependencies = rte-rrtmgp/rte/kernels/mo_rte_solver_kernels.F90,rte-rrtmgp/extensions/mo_fluxes_byband.F90
-
-########################################################################
-[ccpp-arg-table]
-  name = rrtmgp_lw_rte_run
-  type = scheme
-[doLWrad]
-  standard_name = flag_for_calling_longwave_radiation
-  long_name = logical flags for lw radiation calls
-  units = flag
-  dimensions = ()
-  type = logical
-  intent = in
-[doLWclrsky]
-  standard_name = flag_for_output_of_tendency_of_air_temperature_due_to_longwave_heating_on_radiation_timestep_assuming_clear_sky
-  long_name = flag to output lw heating rate (Radtend%lwhc)
-  units = flag
-  dimensions = ()
-  type = logical  
-  intent = in
-[use_LW_jacobian]
-  standard_name = flag_to_calc_RRTMGP_LW_jacobian
-  long_name = logical flag to control RRTMGP LW calculation
-  units = flag
-  dimensions = ()
-  type = logical 
-  intent = in
-[doGP_lwscat] 
-  standard_name = flag_to_include_longwave_scattering_in_cloud_optics
-  long_name = logical flag to control the addition of LW scattering in RRTMGP 
-  units = flag
-  dimensions = ()
-  type = logical  
-  intent = in
-[doGP_sgs_cnv]
-  standard_name = flag_to_include_sgs_convective_cloud_in_RRTMGP
-  long_name = logical flag to control sgs convective cloud in RRTMGP
-  units = flag
-  dimensions = ()
-  type = logical
-  intent = in
-[doGP_sgs_mynn]
-  standard_name = flag_to_include_sgs_MYNN_EDMF_cloud_in_RRTMGP
-  long_name = logical flag to control MYNN-EDMF PBL cloud in RRTMGP
-  units = flag
-  dimensions = ()
-  type = logical
-  intent = in
-[ncol]
-  standard_name = horizontal_loop_extent
-  long_name = horizontal dimension
-  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
-[nGauss_angles]
-  standard_name = number_of_gaussian_quadrature_angles_for_radiation
-  long_name = Number of angles used in Gaussian quadrature
-  units = count
-  dimensions =  ()
-  type = integer
-  intent = in
-[top_at_1]
-  standard_name = flag_for_vertical_ordering_in_RRTMGP
-  long_name = flag for vertical ordering in RRTMGP
-  units = flag
-  dimensions = ()
-  type = logical
-  intent = in
-[sfc_emiss_byband]
-  standard_name = surface_emissivity_in_each_RRTMGP_LW_band
-  long_name = surface emissivity in each RRTMGP LW band
-  units = none
-  dimensions = (number_of_longwave_bands,horizontal_loop_extent)
-  type = real
-  kind = kind_phys
-  intent = in
-[lw_optical_props_clrsky]
-  standard_name = longwave_optical_properties_for_clear_sky
-  long_name = Fortran DDT containing RRTMGP optical properties
-  units = DDT
-  dimensions = ()
-  type = ty_optical_props_1scl
-  intent = inout
-[lw_optical_props_clouds]
-  standard_name = longwave_optical_properties_for_cloudy_atmosphere
-  long_name = Fortran DDT containing RRTMGP optical properties
-  units = DDT
-  dimensions = ()
-  type = ty_optical_props_2str
-  intent = inout
-[lw_optical_props_precipByBand]
-  standard_name = longwave_optical_properties_for_precipitation_by_band
-  long_name = Fortran DDT containing RRTMGP optical properties
-  units = DDT
-  dimensions = ()
-  type = ty_optical_props_2str
-  intent = inout
-[lw_optical_props_cnvcloudsByBand]
-  standard_name = longwave_optical_properties_for_convective_cloudy_atmosphere_by_band
-  long_name = Fortran DDT containing RRTMGP optical properties
-  units = DDT
-  dimensions = ()
-  type = ty_optical_props_2str
-  intent = inout
-[lw_optical_props_MYNNcloudsByBand]
-  standard_name = longwave_optical_properties_for_MYNN_EDMF_PBL_cloudy_atmosphere_by_band
-  long_name = Fortran DDT containing RRTMGP optical properties
-  units = DDT
-  dimensions = ()
-  type = ty_optical_props_2str
-  intent = inout
-[lw_optical_props_aerosol]
-  standard_name = longwave_optical_properties_for_aerosols
-  long_name = Fortran DDT containing RRTMGP optical properties
-  units = DDT
-  dimensions = ()
-  type = ty_optical_props_1scl
-  intent = inout
-[sources]
-  standard_name = longwave_source_function
-  long_name = Fortran DDT containing RRTMGP source functions
-  units = DDT
-  dimensions = ()
-  type = ty_source_func_lw
-  intent = in
-[fluxlwUP_radtime]
-  standard_name = RRTMGP_lw_flux_profile_upward_allsky_on_radiation_timestep
-  long_name = RRTMGP upward longwave all-sky flux profile
-  units = W m-2
-  dimensions = (horizontal_loop_extent,vertical_interface_dimension)
-  type = real
-  kind = kind_phys
-  intent = inout
-[fluxlwDOWN_radtime]
-  standard_name = RRTMGP_lw_flux_profile_downward_allsky_on_radiation_timestep
-  long_name = RRTMGP downward longwave all-sky flux profile
-  units = W m-2
-  dimensions = (horizontal_loop_extent,vertical_interface_dimension)
-  type = real
-  kind = kind_phys
-  intent = inout
-[fluxlwUP_allsky]
-  standard_name = RRTMGP_lw_flux_profile_upward_allsky
-  long_name = RRTMGP upward longwave all-sky flux profile
-  units = W m-2
-  dimensions = (horizontal_loop_extent,vertical_interface_dimension)
-  type = real
-  kind = kind_phys
-  intent = inout
-[fluxlwDOWN_allsky]
-  standard_name = RRTMGP_lw_flux_profile_downward_allsky
-  long_name = RRTMGP downward longwave all-sky flux profile
-  units = W m-2
-  dimensions = (horizontal_loop_extent,vertical_interface_dimension)
-  type = real
-  kind = kind_phys
-  intent = inout
-[fluxlwUP_clrsky]
-  standard_name = RRTMGP_lw_flux_profile_upward_clrsky
-  long_name = RRTMGP upward longwave clr-sky flux profile
-  units = W m-2
-  dimensions = (horizontal_loop_extent,vertical_interface_dimension)
-  type = real
-  kind = kind_phys
-  intent = inout
-[fluxlwDOWN_clrsky]
-  standard_name = RRTMGP_lw_flux_profile_downward_clrsky
-  long_name = RRTMGP downward longwave clr-sky flux profile
-  units = W m-2
-  dimensions = (horizontal_loop_extent,vertical_interface_dimension)
-  type = real
-  kind = kind_phys
-  intent = inout
-[fluxlwUP_jac]
-  standard_name = RRTMGP_jacobian_of_lw_flux_upward
-  long_name = RRTMGP Jacobian upward longwave flux profile
-  units = W m-2 K-1
-  dimensions = (horizontal_loop_extent,vertical_interface_dimension)
-  type = real
-  kind = kind_phys
-  intent = inout
-[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
diff --git a/physics/rrtmgp_sw_cloud_optics.F90 b/physics/rrtmgp_sw_cloud_optics.F90
index 3aab115cd..4293a7be6 100644
--- a/physics/rrtmgp_sw_cloud_optics.F90
+++ b/physics/rrtmgp_sw_cloud_optics.F90
@@ -1,18 +1,7 @@
-!> \file rrtmgp_sw_cloud_optics.F90
-!!
-!> \defgroup rrtmgp_sw_cloud_optics rrtmgp_sw_cloud_optics.F90
-!!
-!! \brief This module contains two routines: The first initializes data and functions
-!! needed to compute the shortwave cloud radiative properteis in RRTMGP. The second routine
-!! is a ccpp scheme within the "radiation loop", where the shortwave optical prperties
-!! (optical-depth, single-scattering albedo, asymmetry parameter) are computed for ALL
-!! cloud types visible to RRTMGP.
 module rrtmgp_sw_cloud_optics
   use machine,                  only: kind_phys
   use mo_rte_kind,              only: wl
   use mo_cloud_optics,          only: ty_cloud_optics
-  use mo_optical_props,         only: ty_optical_props_2str
-  use mo_rrtmg_sw_cloud_optics, only: rrtmg_sw_cloud_optics   
   use rrtmgp_sw_gas_optics,     only: sw_gas_props
   use radiation_tools,          only: check_error_msg
   use netcdf
@@ -59,52 +48,41 @@ module rrtmgp_sw_cloud_optics
        pade_exticeSW,         & ! PADE coefficients for shortwave ice extinction
        pade_ssaiceSW,         & ! PADE coefficients for shortwave ice single scattering albedo
        pade_asyiceSW            ! PADE coefficients for shortwave ice asymmetry parameter
+  real(kind_phys) :: &
+       radliq_lwrSW,          & ! Liquid particle size lower bound for LUT interpolation
+       radliq_uprSW,          & ! Liquid particle size upper bound for LUT interpolation
+       radice_lwrSW,          & ! Ice particle    size upper bound for LUT interpolation
+       radice_uprSW             ! Ice particle    size lower bound for LUT interpolation
 
-  ! Parameters used for rain and snow(+groupel) RRTMGP cloud-optics
+  ! Parameters used for rain and snow(+groupel) RRTMGP cloud-optics. *NOTE* Same as in RRTMG
+  ! Need to document these magic numbers below.
   real(kind_phys),parameter :: &
-       a0r = 3.07e-3, & !
-       a0s = 0.0,     & !
-       a1s = 1.5        !  
+       a0r = 3.07e-3,        & !
+       a0s = 0.0,            & !
+       a1s = 1.5               !  
   real(kind_phys),dimension(:),allocatable :: b0r,b0s,b1s,c0r,c0s
-  real(kind_phys) :: &
-       radliq_lwrSW,         & ! Liquid particle size lower bound for LUT interpolation   
-       radliq_uprSW,         & ! Liquid particle size upper bound for LUT interpolation
-       radice_lwrSW,         & ! Ice particle size upper bound for LUT interpolation  
-       radice_uprSW            ! Ice particle size lower bound for LUT interpolation
 
 contains
-
-!>\defgroup rrtmgp_sw_cloud_optics_mod GFS RRTMGP-SW Cloud Optics Module
-!> \section arg_table_rrtmgp_sw_cloud_optics_init
-!! \htmlinclude rrtmgp_lw_cloud_optics.html
-!!
-!> \ingroup rrtmgp_sw_cloud_optics
-!!
-!! RRTMGP relies heavily on derived-data-types, which contain type-bound procedures
-!! that are referenced frequently throughout the RRTMGP shortwave scheme. The data needed
-!! to compute the shortwave cloud optical properties are initialized here and loaded into
-!! the RRTMGP DDT, ty_cloud_optics.
-!!
-!! \section rrtmgp_sw_cloud_optics_init
   ! ######################################################################################
-  subroutine rrtmgp_sw_cloud_optics_init(doG_cldoptics, doGP_cldoptics_PADE,             &
-       doGP_cldoptics_LUT, nrghice, rrtmgp_root_dir, rrtmgp_sw_file_clouds, mpicomm,     &
-       mpirank, mpiroot, errmsg, errflg)
+  ! SUBROUTINE sw_cloud_optics_init
+  ! ######################################################################################
+  subroutine rrtmgp_sw_cloud_optics_init( rrtmgp_root_dir, rrtmgp_sw_file_clouds,        &
+       doGP_cldoptics_PADE, doGP_cldoptics_LUT, nrghice, mpicomm, mpirank, mpiroot,      &
+       errmsg, errflg)
 
     ! Inputs
+    character(len=128),intent(in) :: &
+         rrtmgp_root_dir,    & ! RTE-RRTMGP root directory
+         rrtmgp_sw_file_clouds ! RRTMGP file containing cloud-optic data
     logical, intent(in) :: &
-         doG_cldoptics,       & ! Use legacy RRTMG cloud-optics?
-         doGP_cldoptics_PADE, & ! Use RRTMGP cloud-optics: PADE approximation?
-         doGP_cldoptics_LUT     ! Use RRTMGP cloud-optics: LUTs?    
+         doGP_cldoptics_PADE,& ! Use RRTMGP cloud-optics: PADE approximation?
+         doGP_cldoptics_LUT    ! Use RRTMGP cloud-optics: LUTs?    
     integer, intent(inout) :: &
          nrghice               ! Number of ice-roughness categories
     integer, intent(in) :: &
          mpicomm,            & ! MPI communicator
          mpirank,            & ! Current MPI rank
          mpiroot               ! Master MPI rank
-    character(len=128),intent(in) :: &
-         rrtmgp_root_dir,    & ! RTE-RRTMGP root directory
-         rrtmgp_sw_file_clouds ! RRTMGP file containing coefficients used to compute clouds optical properties
 
     ! Outputs
     character(len=*), intent(out) :: &
@@ -120,8 +98,6 @@ subroutine rrtmgp_sw_cloud_optics_init(doG_cldoptics, doGP_cldoptics_PADE,
     errmsg = ''
     errflg = 0
 
-    if (doG_cldoptics) return
-
     ! Filenames are set in the physics_nml
     sw_cloud_props_file = trim(rrtmgp_root_dir)//trim(rrtmgp_sw_file_clouds)
 
@@ -180,7 +156,7 @@ subroutine rrtmgp_sw_cloud_optics_init(doG_cldoptics, doGP_cldoptics_PADE,
     call mpi_bcast(nPairsSW,           1, MPI_INTEGER, mpiroot, mpicomm, mpierr)
 #endif
     
-    ! Has the number of ice-roughnesses provided from the namelist?
+    ! Has the number of ice-roughnes categories been provided from the namelist?
     ! If so, override nrghice from cloud-optics file
     if (nrghice .ne. 0) nrghice_fromfileSW = nrghice
 #ifdef MPI
@@ -404,182 +380,4 @@ subroutine rrtmgp_sw_cloud_optics_init(doG_cldoptics, doGP_cldoptics_PADE,
             0.970, 0.970,   0.970,   0.700, 0.700, 0.700, 0.700/)
 
   end subroutine rrtmgp_sw_cloud_optics_init
-
-!> \section arg_table_rrtmgp_sw_cloud_optics_run
-!! \htmlinclude rrtmgp_sw_cloud_optics.html
-!!
-!> \ingroup rrtmgp_sw_cloud_optics
-!!
-!! Compute shortwave optical prperties (optical-depth, single-scattering albedo, 
-!! asymmetry parameter) for ALL cloud types visible to RRTMGP. 
-!!
-!! \section rrtmgp_sw_gas_optics_run
-  ! ###################################################################################### 
-  subroutine rrtmgp_sw_cloud_optics_run(doSWrad, doG_cldoptics, icliq_sw, icice_sw,         &
-       doGP_cldoptics_PADE, doGP_cldoptics_LUT, do_mynnedmf, imfdeepcnv, imfdeepcnv_gf,     &
-       imfdeepcnv_samf, nCol, nLev, nDay, nbndsGPsw, idxday, cld_frac, cld_lwp, cld_reliq,  &
-       cld_iwp, cld_reice, cld_swp, cld_resnow, cld_rwp, cld_rerain, precip_frac,           &
-       cld_cnv_lwp, cld_cnv_reliq, cld_cnv_iwp, cld_cnv_reice, cld_pbl_lwp, cld_pbl_reliq,  &
-       cld_pbl_iwp, cld_pbl_reice, sw_optical_props_cloudsByBand,                           &
-       sw_optical_props_cnvcloudsByBand, sw_optical_props_precipByBand,                     &
-       sw_optical_props_MYNNcloudsByBand, cldtausw,  errmsg, errflg)
-    
-    ! Inputs
-    logical, intent(in) :: &
-         doSWrad,             & ! Logical flag for shortwave radiation call
-         doG_cldoptics,       & ! Use legacy RRTMG cloud-optics?
-         doGP_cldoptics_PADE, & ! Use RRTMGP cloud-optics: PADE approximation?
-         doGP_cldoptics_LUT,  & ! Use RRTMGP cloud-optics: LUTs?
-         do_mynnedmf            !
-    integer, intent(in) :: &
-         nbndsGPsw,           & ! Number of shortwave bands
-         nCol,                & ! Number of horizontal gridpoints
-         nLev,                & ! Number of vertical levels
-         nday,                & ! Number of daylit points.
-         icliq_sw,            & ! Choice of treatment of liquid cloud optical properties (RRTMG legacy)
-         icice_sw,            & ! Choice of treatment of ice cloud optical properties (RRTMG legacy) 
-         imfdeepcnv,          & ! 
-         imfdeepcnv_gf,       & ! 
-         imfdeepcnv_samf        !
-    integer,intent(in),dimension(:) :: &
-         idxday                 ! Indices for daylit points.
-    real(kind_phys), dimension(:,:),intent(in) :: &
-         cld_frac,            & ! Total cloud fraction by layer
-         cld_lwp,             & ! Cloud liquid water path
-         cld_reliq,           & ! Cloud liquid effective radius
-         cld_iwp,             & ! Cloud ice water path
-         cld_reice,           & ! Cloud ice effective radius
-         cld_swp,             & ! Cloud snow water path
-         cld_resnow,          & ! Cloud snow effective radius
-         cld_rwp,             & ! Cloud rain water path
-         cld_rerain,          & ! Cloud rain effective radius
-         precip_frac,         & ! Precipitation fraction by layer
-         cld_cnv_lwp,         & ! Water path for       convective liquid cloud-particles (microns) 
-         cld_cnv_reliq,       & ! Effective radius for convective liquid cloud-particles (microns)
-         cld_cnv_iwp,         & ! Water path for       convective ice cloud-particles (microns)
-         cld_cnv_reice,       & ! Effective radius for convective ice cloud-particles (microns)
-         cld_pbl_lwp,         & ! Water path for       SGS PBL liquid cloud-particles
-         cld_pbl_reliq,       & ! Effective radius for SGS PBL liquid cloud-particles
-         cld_pbl_iwp,         & ! Water path for       SGS PBL ice    cloud-particles
-         cld_pbl_reice          ! Effective radius for SGS PBL ice    cloud-particles
-    ! Outputs
-    character(len=*), intent(out) :: &
-         errmsg                              ! CCPP error message
-    integer,          intent(out) :: &
-         errflg                              ! CCPP error flag
-    type(ty_optical_props_2str),intent(out) :: &
-         sw_optical_props_cloudsByBand,    & ! RRTMGP DDT: Shortwave optical properties in each band (clouds)
-         sw_optical_props_cnvcloudsByBand, & ! RRTMGP DDT: Shortwave optical properties in each band (convective cloud)
-         sw_optical_props_MYNNcloudsByBand,& ! RRTMGP DDT: Shortwave optical properties in each band (MYNN PBL cloud)
-         sw_optical_props_precipByBand       ! RRTMGP DDT: Shortwave optical properties in each band (cloud precipitation)
-    real(kind_phys), dimension(:,:), intent(out) :: &
-         cldtausw                            ! Approx 10.mu band layer cloud optical depth  
-    
-    ! Local variables
-    integer :: iDay, iLay, iBand
-    real(kind_phys) :: tau_rain, tau_snow, ssa_rain, ssa_snow, asy_rain, asy_snow, &
-         tau_prec, asy_prec, ssa_prec, asyw, ssaw, za1, za2
-    real(kind_phys), dimension(nday,nLev,nbndsGPsw) :: &
-         tau_cld, ssa_cld, asy_cld, tau_precip, ssa_precip, asy_precip
-    type(ty_optical_props_2str) :: sw_optical_props_cloudsByBand_daylit
-
-    ! Initialize CCPP error handling variables
-    errmsg = ''
-    errflg = 0
-    
-    if (.not. doSWrad) return
-    
-    ! Only process sunlit points...
-    if (nDay .gt. 0) then
-       
-       ! Compute cloud/precipitation optics.
-       if (doGP_cldoptics_PADE .or. doGP_cldoptics_LUT) then
-          ! i) Cloud-optics.
-          call check_error_msg('rrtmgp_sw_cloud_optics_run - sw_optical_props_cloudsByBand',&
-               sw_optical_props_cloudsByBand%alloc_2str(nday, nLev, sw_cloud_props%get_band_lims_wavenumber()))
-
-          call check_error_msg('rrtmgp_sw_cloud_optics_run - clouds',sw_cloud_props%cloud_optics(&
-               cld_lwp(idxday(1:nday),:),            & ! IN  - Cloud liquid water path
-               cld_iwp(idxday(1:nday),:),            & ! IN  - Cloud ice water path
-               cld_reliq(idxday(1:nday),:),          & ! IN  - Cloud liquid effective radius
-               cld_reice(idxday(1:nday),:),          & ! IN  - Cloud ice effective radius
-               sw_optical_props_cloudsByBand))         ! OUT - RRTMGP DDT: Shortwave optical properties, 
-                                                       !       in each band (tau,ssa,g)
-
-          ! ii) Convective cloud-optics
-          if (imfdeepcnv == imfdeepcnv_samf .or. imfdeepcnv == imfdeepcnv_gf) then
-             call check_error_msg('rrtmgp_sw_cloud_optics_run - sw_optical_props_cnvcloudsByBand',&
-                  sw_optical_props_cnvcloudsByBand%alloc_2str(nday, nLev, sw_cloud_props%get_band_lims_wavenumber()))
-
-             call check_error_msg('rrtmgp_sw_cloud_optics_run - convective clouds',sw_cloud_props%cloud_optics(&
-                  cld_cnv_lwp(idxday(1:nday),:),     & ! IN  - Convective cloud liquid water path
-                  cld_cnv_iwp(idxday(1:nday),:),     & ! IN  - Convective cloud ice water path
-                  cld_cnv_reliq(idxday(1:nday),:),   & ! IN  - Convective cloud liquid effective radius
-                  cld_cnv_reice(idxday(1:nday),:),   & ! IN  - Convective cloud ice effective radius
-                  sw_optical_props_cnvcloudsByBand))   ! OUT - RRTMGP DDT: Shortwave optical properties, 
-                                                       !       in each band (tau,ssa,g)
-          endif
-
-          ! iii) MYNN cloud-optics
-          if (do_mynnedmf) then
-             call check_error_msg('rrtmgp_sw_cloud_optics_run - sw_optical_props_MYNNcloudsByBand',&
-                  sw_optical_props_MYNNcloudsByBand%alloc_2str(nday, nLev, sw_cloud_props%get_band_lims_wavenumber()))
-
-             call check_error_msg('rrtmgp_sw_MYNNcloud_optics_run - MYNN-EDMF cloud',sw_cloud_props%cloud_optics(&
-                  cld_pbl_lwp(idxday(1:nday),:),     & ! IN  - MYNN-EDMF PBL cloud liquid water path (g/m2)
-                  cld_pbl_iwp(idxday(1:nday),:),     & ! IN  - MYNN-EDMF PBL cloud ice water path (g/m2)
-                  cld_pbl_reliq(idxday(1:nday),:),   & ! IN  - MYNN-EDMF PBL cloud liquid effective radius (microns)
-                  cld_pbl_reice(idxday(1:nday),:),   & ! IN  - MYNN-EDMF PBL cloud ice effective radius (microns)
-                  sw_optical_props_MYNNcloudsByBand))  ! OUT - RRTMGP DDT containing MYNN-EDMF PBL  cloud radiative properties
-                                                       !       in each band
-          endif
-       
-          ! iv) Cloud precipitation optics: rain and snow(+groupel)
-          call check_error_msg('rrtmgp_sw_cloud_optics_run - sw_optical_props_precipByBand',&
-               sw_optical_props_precipByBand%alloc_2str(nday, nLev, sw_cloud_props%get_band_lims_wavenumber()))
-          sw_optical_props_precipByBand%tau(:,:,:) = 0._kind_phys
-          sw_optical_props_precipByBand%ssa(:,:,:) = 1._kind_phys
-          sw_optical_props_precipByBand%g(:,:,:)   = 0._kind_phys
-
-          do iDay=1,nDay
-             do iLay=1,nLev                                      
-                if (cld_frac(idxday(iDay),iLay) .gt. 1.e-12_kind_phys) then
-                   ! Rain/Snow optical depth (No band dependence)
-                   tau_rain = cld_rwp(idxday(iDay),iLay)*a0r                   
-                   if (cld_swp(idxday(iDay),iLay) .gt. 0. .and. cld_resnow(idxday(iDay),iLay) .gt. 10._kind_phys) then
-                      tau_snow = cld_swp(idxday(iDay),iLay)*1.09087*(a0s + a1s/(1.0315*cld_resnow(idxday(iDay),iLay)))     ! fu's formula 
-                   else
-                      tau_snow = 0._kind_phys
-                   endif
-                   
-                   ! Rain/Snow single-scattering albedo and asymmetry (Band dependent)
-                   do iBand=1,nbndsGPsw
-                      ! By species
-                      ssa_rain = tau_rain*(1.-b0r(iBand))
-                      asy_rain = ssa_rain*c0r(iBand)
-                      ssa_snow = tau_snow*(1.-(b0s(iBand)+b1s(iBand)*1.0315*cld_resnow(idxday(iDay),iLay)))
-                      asy_snow = ssa_snow*c0s(iBand)
-                      ! Combine
-                      tau_prec = max(1.e-12_kind_phys, tau_rain + tau_snow)
-                      ssa_prec = max(1.e-12_kind_phys, ssa_rain + ssa_snow)
-                      asy_prec = max(1.e-12_kind_phys, asy_rain + asy_snow)
-                      asyw     = asy_prec/max(1.e-12_kind_phys, ssa_prec)
-                      ssaw     = min(1._kind_phys-0.000001, ssa_prec/tau_prec)
-                      za1      = asyw * asyw
-                      za2      = ssaw * za1                      
-                      sw_optical_props_precipByBand%tau(iDay,iLay,iBand) = (1._kind_phys - za2) * tau_prec
-                      sw_optical_props_precipByBand%ssa(iDay,iLay,iBand) = (ssaw - za2) / (1._kind_phys - za2)
-                      sw_optical_props_precipByBand%g(iDay,iLay,iBand)   = asyw/(1+asyw)
-                   enddo
-                endif
-             enddo
-          enddo
-       endif
-       
-       ! All-sky SW optical depth ~0.55microns (DJS asks: Move to cloud diagnostics?)
-       cldtausw(idxday(1:nDay),:) = sw_optical_props_cloudsByBand%tau(:,:,11)    
-    endif
- 
-  end subroutine rrtmgp_sw_cloud_optics_run
-
 end module rrtmgp_sw_cloud_optics
diff --git a/physics/rrtmgp_sw_cloud_optics.meta b/physics/rrtmgp_sw_cloud_optics.meta
deleted file mode 100644
index 064b7cf80..000000000
--- a/physics/rrtmgp_sw_cloud_optics.meta
+++ /dev/null
@@ -1,393 +0,0 @@
-[ccpp-table-properties]
-  name = rrtmgp_sw_cloud_optics
-  type = scheme
-  dependencies = machine.F,rrtmg_sw_cloud_optics.F90,radiation_tools.F90
-
-########################################################################
-[ccpp-arg-table]
-  name = rrtmgp_sw_cloud_optics_init
-  type = scheme
-[doG_cldoptics]
-  standard_name = flag_to_calc_lw_cld_optics_using_RRTMG
-  long_name = logical flag to control cloud optics scheme.
-  units = flag
-  dimensions = ()
-  type = logical
-  intent = in
-[doGP_cldoptics_PADE]
-  standard_name = flag_to_calc_lw_cld_optics_using_RRTMGP_PADE
-  long_name = logical flag to control cloud optics scheme.
-  units = flag
-  dimensions = ()
-  type = logical
-  intent = in
-[doGP_cldoptics_LUT]
-  standard_name = flag_to_calc_lw_cld_optics_using_RRTMGP_LUT
-  long_name = logical flag to control cloud optics scheme.
-  units = flag
-  dimensions = ()
-  type = logical
-  intent = in
-[nrghice]
-  standard_name = number_of_ice_roughness_categories
-  long_name = number of ice-roughness categories in RRTMGP calculation
-  units = count
-  dimensions =  ()
-  type = integer
-  intent = inout
-[rrtmgp_root_dir]
-  standard_name = directory_for_rte_rrtmgp_source_code
-  long_name = directory for rte+rrtmgp source code
-  units = none
-  dimensions =  ()
-  type = character
-  intent = in
-  kind = len=128
-[rrtmgp_sw_file_clouds]
-  standard_name = filename_of_rrtmgp_shortwave_cloud_optics_coefficients 
-  long_name = file containing coefficients for RRTMGP SW cloud optics
-  units = none
-  dimensions =  ()
-  type = character
-  intent = in
-  kind = len=128
-[mpirank]
-  standard_name = mpi_rank
-  long_name = current MPI rank
-  units = index
-  dimensions = ()
-  type = integer
-  intent = in
-[mpiroot]
-  standard_name = mpi_root
-  long_name = master MPI rank
-  units = index
-  dimensions = ()
-  type = integer
-  intent = in
-[mpicomm]
-  standard_name = mpi_communicator
-  long_name = MPI communicator
-  units = index
-  dimensions = ()
-  type = integer
-  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
-########################################################################
-[ccpp-arg-table]
-  name = rrtmgp_sw_cloud_optics_run
-  type = scheme
-[doSWrad]
-  standard_name = flag_for_calling_shortwave_radiation
-  long_name = logical flags for sw radiation calls
-  units = flag
-  dimensions = ()
-  type = logical
-  intent = in
-[ncol]
-  standard_name = horizontal_loop_extent
-  long_name = horizontal dimension
-  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
-[doG_cldoptics]
-  standard_name = flag_to_calc_lw_cld_optics_using_RRTMG
-  long_name = logical flag to control cloud optics scheme.
-  units = flag
-  dimensions = ()
-  type = logical
-  intent = in
-[icliq_sw]
-  standard_name = control_for_shortwave_radiation_liquid_clouds
-  long_name = sw optical property for liquid clouds
-  units = flag
-  dimensions = ()
-  type = integer
-  intent = in
-[icice_sw]
-  standard_name = flag_for_optical_property_for_ice_clouds_for_shortwave_radiation
-  long_name = sw optical property for ice clouds
-  units = flag
-  dimensions = ()
-  type = integer
-  intent = in
-[doGP_cldoptics_PADE]
-  standard_name = flag_to_calc_lw_cld_optics_using_RRTMGP_PADE
-  long_name = logical flag to control cloud optics scheme.
-  units = flag
-  dimensions = ()
-  type = logical
-  intent = in
-[doGP_cldoptics_LUT]
-  standard_name = flag_to_calc_lw_cld_optics_using_RRTMGP_LUT
-  long_name = logical flag to control cloud optics scheme.
-  units = flag
-  dimensions = ()
-  type = logical
-  intent = in
-[do_mynnedmf]
-  standard_name = flag_for_mellor_yamada_nakanishi_niino_pbl_scheme
-  long_name = flag to activate MYNN-EDMF
-  units = flag
-  dimensions = ()
-  type = logical
-  intent = in
-[imfdeepcnv]
-  standard_name = control_for_deep_convection_scheme
-  long_name = flag for mass-flux deep convection scheme
-  units = flag
-  dimensions = ()
-  type = integer
-  intent = in
-[imfdeepcnv_gf]
-  standard_name = identifier_for_grell_freitas_deep_convection
-  long_name = flag for Grell-Freitas deep convection scheme
-  units = flag
-  dimensions = ()
-  type = integer
-  intent = in
-[imfdeepcnv_samf]
-  standard_name = identifer_for_scale_aware_mass_flux_deep_convection
-  long_name = flag for SAMF deep convection scheme
-  units = flag
-  dimensions = ()
-  type = integer
-  intent = in
-[cld_frac]
-  standard_name = total_cloud_fraction
-  long_name = layer total cloud fraction
-  units = frac
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[cld_lwp]
-  standard_name = cloud_liquid_water_path
-  long_name = layer cloud liquid water path
-  units = g m-2
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[cld_reliq]
-  standard_name = mean_effective_radius_for_liquid_cloud
-  long_name = mean effective radius for liquid cloud
-  units = um
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[cld_iwp]
-  standard_name = cloud_ice_water_path
-  long_name = layer cloud ice water path
-  units = g m-2
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[cld_reice]
-  standard_name = mean_effective_radius_for_ice_cloud
-  long_name = mean effective radius for ice cloud
-  units = um
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[cld_swp]
-  standard_name = cloud_snow_water_path
-  long_name = layer cloud snow water path
-  units = g m-2
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[cld_resnow]
-  standard_name = mean_effective_radius_for_snow_flake
-  long_name = mean effective radius for snow cloud
-  units = um
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[cld_rwp]
-  standard_name = cloud_rain_water_path
-  long_name = layer cloud rain water path
-  units = g m-2
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[cld_rerain]
-  standard_name = mean_effective_radius_for_rain_drop
-  long_name = mean effective radius for rain cloud
-  units = um
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[precip_frac]
-  standard_name = precipitation_fraction_by_layer
-  long_name = precipitation fraction in each layer
-  units = frac
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[cld_cnv_lwp]
-  standard_name = convective_cloud_liquid_water_path
-  long_name = layer convective cloud liquid water path
-  units = g m-2
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[cld_cnv_iwp]
-  standard_name = convective_cloud_ice_water_path
-  long_name = layer convective cloud ice water path
-  units = g m-2
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[cld_cnv_reliq]
-  standard_name = mean_effective_radius_for_liquid_convective_cloud
-  long_name = mean effective radius for liquid convective cloud
-  units = um
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[cld_cnv_reice]
-  standard_name = mean_effective_radius_for_ice_convective_cloud
-  long_name = mean effective radius for ice convective cloud
-  units = um
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[cld_pbl_lwp]
-  standard_name = MYNN_SGS_cloud_liquid_water_path
-  long_name = layer convective cloud liquid water path
-  units = g m-2
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[cld_pbl_iwp]
-  standard_name = MYNN_SGS_cloud_ice_water_path
-  long_name = layer convective cloud ice water path
-  units = g m-2
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[cld_pbl_reliq]
-  standard_name = mean_effective_radius_for_liquid_MYNN_SGS_cloud
-  long_name = mean effective radius for liquid MYNN_SGS cloud
-  units = um
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[cld_pbl_reice]
-  standard_name = mean_effective_radius_for_ice_MYNN_SGS_cloud
-  long_name = mean effective radius for ice MYNN_SGS cloud
-  units = um
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[nbndsGPsw]
-  standard_name = number_of_shortwave_bands
-  long_name = number of sw bands used in RRTMGP
-  units = count
-  dimensions =  ()
-  type = integer
-  intent = in
-[nday]
-  standard_name = daytime_points_dimension
-  long_name = daytime points dimension
-  units = count
-  dimensions = ()
-  type = integer
-  intent = in
-[idxday]
-  standard_name = daytime_points
-  long_name = daytime points
-  units = index
-  dimensions = (horizontal_loop_extent)
-  type = integer
-  intent = in
-[sw_optical_props_cloudsByBand]
-  standard_name = shortwave_optical_properties_for_cloudy_atmosphere_by_band
-  long_name = Fortran DDT containing RRTMGP optical properties
-  units = DDT
-  dimensions = ()
-  type = ty_optical_props_2str
-  intent = out
-[sw_optical_props_cnvcloudsByBand]
-  standard_name = shortwave_optical_properties_for_convective_cloudy_atmosphere_by_band
-  long_name = Fortran DDT containing RRTMGP optical properties
-  units = DDT
-  dimensions = ()
-  type = ty_optical_props_2str
-  intent = out
-[sw_optical_props_precipByBand]
-  standard_name = shortwave_optical_properties_for_precipitation_by_band
-  long_name = Fortran DDT containing RRTMGP optical properties
-  units = DDT
-  dimensions = ()
-  type = ty_optical_props_2str
-  intent = out
-[sw_optical_props_MYNNcloudsByBand]
-  standard_name = shortwave_optical_properties_for_MYNN_EDMF_PBL_cloudy_atmosphere_by_band
-  long_name = Fortran DDT containing RRTMGP optical properties
-  units = DDT
-  dimensions = ()
-  type = ty_optical_props_2str
-  intent = out
-[cldtausw]
-  standard_name = cloud_optical_depth_layers_at_0p55mu_band
-  long_name = approx .55mu band layer cloud optical depth
-  units = none
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = out
-[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
diff --git a/physics/rrtmgp_sw_cloud_sampling.F90 b/physics/rrtmgp_sw_cloud_sampling.F90
deleted file mode 100644
index 238ed7d1c..000000000
--- a/physics/rrtmgp_sw_cloud_sampling.F90
+++ /dev/null
@@ -1,174 +0,0 @@
-!> \file rrtmgp_sw_cloud_sampling.F90 
-!!
-!> \defgroup rrtmgp_sw_cloud_sampling rrtmgp_sw_cloud_sampling.F90
-!!
-module rrtmgp_sw_cloud_sampling
-  use machine,                  only: kind_phys, kind_dbl_prec
-  use mo_gas_optics_rrtmgp,     only: ty_gas_optics_rrtmgp
-  use mo_optical_props,         only: ty_optical_props_2str
-  use rrtmgp_sampling,          only: sampled_mask, draw_samples
-  use mersenne_twister,         only: random_setseed, random_number, random_stat
-  use radiation_tools,          only: check_error_msg
-  use rrtmgp_sw_gas_optics,     only: sw_gas_props
-  use netcdf
-
-  implicit none
-
-contains
-
-!>\defgroup rrtmgp_sw_cloud_sampling_mod GFS RRTMGP-SW Cloud Sampling Module
-!> @{
-!> \section arg_table_rrtmgp_sw_cloud_sampling_run
-!! \htmlinclude rrtmgp_sw_cloud_sampling.html
-!!
-!> \ingroup rrtmgp_sw_cloud_sampling
-!!
-!! \brief This routine performs the McICA cloud-sampling and maps the shortwave cloud-
-!! optical properties, defined for each spectral band, to each spectral point (g-point).
-!!
-!! \section rrtmgp_sw_cloud_sampling_run
-  subroutine rrtmgp_sw_cloud_sampling_run(doSWrad, nCol, nDay, nLev, idxday, iovr,          &
-       iovr_convcld, iovr_max, iovr_maxrand, iovr_rand, iovr_dcorr, iovr_exp, iovr_exprand, &
-       isubc_sw,icseed_sw, cld_frac, precip_frac, cloud_overlap_param, precip_overlap_param,&
-       imfdeepcnv, imfdeepcnv_gf, imfdeepcnv_samf, cnv_cloud_overlap_param, cld_cnv_frac,   &
-       sw_optical_props_cnvcloudsByBand, sw_optical_props_cloudsByBand,                     &
-       sw_optical_props_precipByBand, sw_optical_props_clouds, sw_optical_props_cnvclouds,  &
-       sw_optical_props_precip, errmsg, errflg)
-    
-    ! Inputs
-    logical, intent(in) :: &
-         doSWrad                            ! Logical flag for shortwave radiation call
-    integer, intent(in) :: &
-         nCol,                            & ! Number of horizontal gridpoints
-         nDay,                            & ! Number of daylit points.
-         nLev,                            & ! Number of vertical layers
-         imfdeepcnv,                      & !
-         imfdeepcnv_gf,                   & !
-         imfdeepcnv_samf,                 & !
-         iovr,                            & ! Choice of cloud-overlap method
-         iovr_convcld,                    & ! Choice of convective cloud-overlap method
-         iovr_max,                        & ! Flag for maximum cloud overlap method
-         iovr_maxrand,                    & ! Flag for maximum-random cloud overlap method
-         iovr_rand,                       & ! Flag for random cloud overlap method
-         iovr_dcorr,                      & ! Flag for decorrelation-length cloud overlap method
-         iovr_exp,                        & ! Flag for exponential cloud overlap method
-         iovr_exprand,                    & ! Flag for exponential-random cloud overlap method
-         isubc_sw
-    integer,intent(in),dimension(:) :: &
-         idxday                             ! Indices for daylit points.
-    integer,intent(in),dimension(:) :: &
-         icseed_sw                          ! auxiliary special cloud related array when module 
-                                            ! variable isubc_sw=2, it provides permutation seed 
-                                            ! for each column profile that are used for generating 
-                                            ! random numbers. when isubc_sw /=2, it will not be used.
-    real(kind_phys), dimension(:,:),intent(in) :: &
-         cld_frac,                        & ! Total cloud fraction by layer
-         cld_cnv_frac,                    & ! Convective cloud fraction by layer
-         precip_frac                        ! Precipitation fraction by layer
-    real(kind_phys), dimension(:,:), intent(in)  :: &
-         cloud_overlap_param,             & ! Cloud overlap parameter
-         cnv_cloud_overlap_param,         & ! Convective cloud overlap parameter
-         precip_overlap_param               ! Precipitation overlap parameter
-    type(ty_optical_props_2str),intent(in) :: &
-         sw_optical_props_cloudsByBand,   & ! RRTMGP DDT: Shortwave optical properties in each band (clouds)
-         sw_optical_props_cnvcloudsByBand,& ! RRTMGP DDT: Shortwave optical properties in each band (convectivecloud) 
-         sw_optical_props_precipByBand      ! RRTMGP DDT: Shortwave optical properties in each band (precipitation)
-
-    ! Outputs
-    character(len=*), intent(out) :: &
-         errmsg                             ! Error message
-    integer,          intent(out) :: &
-         errflg                             ! Error flag
-    type(ty_optical_props_2str),intent(out) :: &
-         sw_optical_props_clouds,         & ! RRTMGP DDT: Shortwave optical properties at each spectral point (clouds) 
-         sw_optical_props_cnvclouds,      & ! RRTMGP DDT: Shortwave optical properties at each spectral point (convectivecloud)
-         sw_optical_props_precip            ! RRTMGP DDT: Shortwave optical properties at each spectral point (precipitation) 
-
-    ! Local variables
-    integer :: iday,iLay,iGpt
-    integer,dimension(nday) :: ipseed_sw
-    type(random_stat) :: rng_stat
-    real(kind_phys) :: tauloc,asyloc,ssaloc
-    real(kind_dbl_prec), dimension(sw_gas_props%get_ngpt(),nLev,nday) :: rng3D,rng3D2
-    real(kind_dbl_prec), dimension(sw_gas_props%get_ngpt()*nLev) :: rng2D
-    real(kind_dbl_prec), dimension(sw_gas_props%get_ngpt()) :: rng1D
-    logical, dimension(nday,nLev,sw_gas_props%get_ngpt()) :: maskMCICA
-
-    ! Initialize CCPP error handling variables
-    errmsg = ''
-    errflg = 0
-    
-    if (.not. doSWrad) return
-    if (nDay .gt. 0) then
-       ! #################################################################################
-       ! First sample the clouds...
-       ! #################################################################################
-
-       ! Allocate space RRTMGP DDTs [nday,nLev,nGpt]
-       call check_error_msg('rrtmgp_sw_cloud_sampling_run', & 
-            sw_optical_props_clouds%alloc_2str(nday, nLev, sw_gas_props))
- 
-       ! Change random number seed value for each radiation invocation (isubc_sw =1 or 2).
-       if(isubc_sw == 1) then      ! advance prescribed permutation seed
-          do iday = 1, nday
-             ipseed_sw(iday) = sw_gas_props%get_ngpt() + iday
-          enddo
-       elseif (isubc_sw == 2) then ! use input array of permutaion seeds
-          do iday = 1, nday
-             ipseed_sw(iday) = icseed_sw(idxday(iday))
-          enddo
-       endif
-
-       ! Call RNG. Mersennse Twister accepts 1D array, so loop over columns and collapse along G-points 
-       ! and layers. ([nGpts,nLev,nDayumn]-> [nGpts*nLev]*nDayumn)
-       do iday=1,nday
-          call random_setseed(ipseed_sw(iday),rng_stat)
-          ! Use same rng for each layer
-          if (iovr == iovr_max) then
-             call random_number(rng1D,rng_stat)
-             do iLay=1,nLev
-                rng3D(:,iLay,iday) = rng1D
-             enddo
-          else
-             do iLay=1,nLev
-                call random_number(rng1D,rng_stat)
-                rng3D(:,iLay,iday) = rng1D
-             enddo
-          endif
-       enddo
-
-       ! Cloud overlap.
-       ! Maximum-random, random, or maximum cloud overlap
-       if (iovr == iovr_maxrand .or. iovr == iovr_max .or. iovr == iovr_rand) then
-          call sampled_mask(real(rng3D, kind=kind_phys), cld_frac(idxday(1:nDay),:), maskMCICA)  
-       endif
-       ! Decorrelation-length overlap
-       if (iovr == iovr_dcorr) then
-          do iday=1,nday
-             call random_setseed(ipseed_sw(iday),rng_stat)
-             call random_number(rng2D,rng_stat)
-             rng3D2(:,:,iday) = reshape(source = rng2D,shape=[sw_gas_props%get_ngpt(),nLev])
-          enddo
-          call sampled_mask(real(rng3D, kind=kind_phys), cld_frac(idxday(1:nDay),:), maskMCICA, &
-	                        overlap_param = cloud_overlap_param(idxday(1:nDay),1:nLev-1),       &
-	                        randoms2      = real(rng3D2, kind=kind_phys))
-       endif 
-       ! Exponential or exponential-random cloud overlap
-       if (iovr == iovr_exp .or. iovr == iovr_exprand) then
-          call sampled_mask(real(rng3D, kind=kind_phys), cld_frac(idxday(1:nDay),:), maskMCICA, &
-                            overlap_param = cloud_overlap_param(idxday(1:nDay),1:nLev-1))
-       endif
-
-       !
-       ! Sampling. Map band optical depth to each g-point using McICA
-       !
-       call check_error_msg('rrtmgp_sw_cloud_sampling_run_draw_samples', & 
-            draw_samples(maskMCICA, .true.,              &
-                         sw_optical_props_cloudsByBand,     &
-                         sw_optical_props_clouds))
-    endif
-
-  end subroutine rrtmgp_sw_cloud_sampling_run
-
-!> @}
-end module rrtmgp_sw_cloud_sampling
diff --git a/physics/rrtmgp_sw_cloud_sampling.meta b/physics/rrtmgp_sw_cloud_sampling.meta
deleted file mode 100644
index 1415108f8..000000000
--- a/physics/rrtmgp_sw_cloud_sampling.meta
+++ /dev/null
@@ -1,240 +0,0 @@
-[ccpp-table-properties]
-  name = rrtmgp_sw_cloud_sampling
-  type = scheme
-  dependencies = machine.F,mersenne_twister.f,rrtmgp_sampling.F90,radiation_tools.F90
-
-######################################################
-[ccpp-arg-table]
-  name = rrtmgp_sw_cloud_sampling_run
-  type = scheme
-[doSWrad]
-  standard_name = flag_for_calling_shortwave_radiation
-  long_name = logical flags for sw radiation calls
-  units = flag
-  dimensions = ()
-  type = logical
-  intent = in
-[imfdeepcnv]
-  standard_name = control_for_deep_convection_scheme
-  long_name = flag for mass-flux deep convection scheme
-  units = flag
-  dimensions = ()
-  type = integer
-  intent = in
-[imfdeepcnv_gf]
-  standard_name = identifier_for_grell_freitas_deep_convection
-  long_name = flag for Grell-Freitas deep convection scheme
-  units = flag
-  dimensions = ()
-  type = integer
-  intent = in
-[imfdeepcnv_samf]
-  standard_name = identifer_for_scale_aware_mass_flux_deep_convection
-  long_name = flag for SAMF deep convection scheme
-  units = flag
-  dimensions = ()
-  type = integer
-  intent = in
-[iovr_convcld]
-  standard_name = flag_for_convective_cloud_overlap_method_for_radiation
-  long_name = flag for convective cloud overlap method
-  units = flag
-  dimensions = ()
-  type = integer
-  intent = in
-[ncol]
-  standard_name = horizontal_loop_extent
-  long_name = horizontal dimension
-  units = count
-  dimensions = ()
-  type = integer
-  intent = in
-[nday]
-  standard_name = daytime_points_dimension
-  long_name = daytime points dimension
-  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
-[isubc_sw]
-  standard_name = flag_for_sw_clouds_grid_approximation
-  long_name = flag for sw clouds sub-grid approximation
-  units = flag
-  dimensions = ()
-  type = integer
-  intent = in
-[idxday]
-  standard_name = daytime_points
-  long_name = daytime points
-  units = index
-  dimensions = (horizontal_loop_extent)
-  type = integer
-  intent = in
-[iovr]
-  standard_name = flag_for_cloud_overlap_method_for_radiation
-  long_name = max-random overlap clouds
-  units = flag
-  dimensions = ()
-  type = integer
-  intent = in
-[iovr_maxrand]
-  standard_name = flag_for_maximum_random_cloud_overlap_method
-  long_name = choice of maximum-random cloud overlap method
-  units = flag
-  dimensions = ()
-  type = integer
-  intent = in
-[iovr_dcorr]
-  standard_name = flag_for_decorrelation_length_cloud_overlap_method
-  long_name = choice of decorrelation-length cloud overlap method
-  units     = flag
-  dimensions = ()
-  type = integer
-  intent = in
-[iovr_exp]
-  standard_name = flag_for_exponential_cloud_overlap_method
-  long_name = choice of exponential cloud overlap method
-  units     = flag
-  dimensions = ()
-  type = integer
-  intent = in
-[iovr_exprand]
-  standard_name = flag_for_exponential_random_cloud_overlap_method
-  long_name = choice of exponential-random cloud overlap method
-  units     = flag
-  dimensions = ()
-  type = integer
-  intent = in
-[iovr_rand]
-  standard_name = flag_for_random_cloud_overlap_method
-  long_name = choice of random cloud overlap method
-  units = flag
-  dimensions = ()
-  type = integer
-  intent = in
-[iovr_max]
-  standard_name = flag_for_maximum_cloud_overlap_method
-  long_name = choice of maximum cloud overlap method
-  units = flag
-  dimensions = ()
-  type = integer
-  intent = in
-[icseed_sw]
-  standard_name = random_number_seed_for_mcica_shortwave
-  long_name = seed for random number generation for shortwave radiation
-  units = none
-  dimensions = (horizontal_loop_extent)
-  type = integer
-  intent = in
-[cld_frac]
-  standard_name = total_cloud_fraction
-  long_name = layer total cloud fraction
-  units = frac
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[precip_frac]
-  standard_name = precipitation_fraction_by_layer
-  long_name = precipitation fraction in each layer
-  units = frac
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[cld_cnv_frac]
-  standard_name = convective_cloud_fraction_for_RRTMGP
-  long_name = layer convective cloud fraction
-  units = frac
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[cnv_cloud_overlap_param]
-  standard_name = convective_cloud_overlap_param
-  long_name = convective cloud overlap parameter
-  units = km
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[cloud_overlap_param]
-  standard_name = cloud_overlap_param
-  long_name = cloud overlap parameter
-  units = km
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[precip_overlap_param]
-  standard_name = precip_overlap_param
-  long_name = precipitation overlap parameter
-  units = km
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[sw_optical_props_cloudsByBand]
-  standard_name = shortwave_optical_properties_for_cloudy_atmosphere_by_band
-  long_name = Fortran DDT containing RRTMGP optical properties
-  units = DDT
-  dimensions = ()
-  type = ty_optical_props_2str
-  intent = in
-[sw_optical_props_cnvcloudsByBand]
-  standard_name = shortwave_optical_properties_for_convective_cloudy_atmosphere_by_band
-  long_name = Fortran DDT containing RRTMGP optical properties
-  units = DDT
-  dimensions = ()
-  type = ty_optical_props_2str
-  intent = in
-[sw_optical_props_precipByBand]
-  standard_name = shortwave_optical_properties_for_precipitation_by_band
-  long_name = Fortran DDT containing RRTMGP optical properties
-  units = DDT
-  dimensions = ()
-  type = ty_optical_props_2str
-  intent = in
-[sw_optical_props_clouds]
-  standard_name = shortwave_optical_properties_for_cloudy_atmosphere
-  long_name = Fortran DDT containing RRTMGP optical properties
-  units = DDT
-  dimensions = ()
-  type = ty_optical_props_2str
-  intent = out
-[sw_optical_props_cnvclouds]
-  standard_name = shortwave_optical_properties_for_convective_cloudy_atmosphere
-  long_name = Fortran DDT containing RRTMGP optical properties
-  units = DDT
-  dimensions = ()
-  type = ty_optical_props_2str
-  intent = out
-[sw_optical_props_precip]
-  standard_name = shortwave_optical_properties_for_precipitation
-  long_name = Fortran DDT containing RRTMGP optical properties
-  units = DDT
-  dimensions = ()
-  type = ty_optical_props_2str    
-  intent = out
-[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
diff --git a/physics/rrtmgp_sw_gas_optics.F90 b/physics/rrtmgp_sw_gas_optics.F90
index 4bafa56a4..f62a75e4b 100644
--- a/physics/rrtmgp_sw_gas_optics.F90
+++ b/physics/rrtmgp_sw_gas_optics.F90
@@ -2,11 +2,8 @@
 !!
 !> \defgroup rrtmgp_sw_gas_optics rrtmgp_sw_gas_optics.F90
 !!
-!! \brief This module contains two routines: One to initialize the k-distribution data
-!! and functions needed to compute the shortwave gaseous optical properties in RRTMGP.
-!! The second routine is a ccpp scheme within the "radiation loop", where the shortwave 
-!! optical prperties (optical-depth, single-scattering albedo, asymmetry parameter) are 
-!! computed for clear-sky conditions (no aerosols)
+!! \brief This module contains a routine to initialize the k-distribution data used
+!! by the RRTMGP shortwave radiation scheme.
 !!
 module rrtmgp_sw_gas_optics
   use machine,                only: kind_phys
@@ -14,7 +11,6 @@ module rrtmgp_sw_gas_optics
   use mo_gas_optics_rrtmgp,   only: ty_gas_optics_rrtmgp
   use mo_gas_concentrations,  only: ty_gas_concs
   use radiation_tools,        only: check_error_msg
-  use mo_optical_props,       only: ty_optical_props_2str
   use netcdf
 #ifdef MPI
   use mpi
@@ -83,7 +79,7 @@ module rrtmgp_sw_gas_optics
        scale_by_complement_upperSW          ! Absorption is scaled by concentration of scaling_gas (F) or its complement (T)
 contains
 
-
+  ! ######################################################################################
 !>\defgroup rrtmgp_sw_gas_optics_mod GFS RRTMGP-SW Gas Optics Module
 !> @{
 !! \section arg_table_rrtmgp_sw_gas_optics_init
@@ -100,19 +96,19 @@ module rrtmgp_sw_gas_optics
 !! \section rrtmgp_sw_gas_optics_init
 !> @{ 
   ! ######################################################################################  
-  subroutine rrtmgp_sw_gas_optics_init(rrtmgp_root_dir, rrtmgp_sw_file_gas,                 &
+  subroutine rrtmgp_sw_gas_optics_init(rrtmgp_root_dir, rrtmgp_sw_file_gas,              &
        active_gases_array, mpicomm, mpirank, mpiroot, errmsg, errflg)
 
     ! Inputs
     character(len=128),intent(in) :: &
          rrtmgp_root_dir,  & ! RTE-RRTMGP root directory
-         rrtmgp_sw_file_gas  ! RRTMGP file containing coefficients used to compute gaseous optical properties
+         rrtmgp_sw_file_gas  ! RRTMGP file containing K-distribution data
+    character(len=*), dimension(:), intent(in) :: &
+         active_gases_array  ! List of active gases from namelist as array
     integer,intent(in) :: &
          mpicomm,          & ! MPI communicator
          mpirank,          & ! Current MPI rank
          mpiroot             ! Master MPI rank
-    character(len=*), dimension(:), intent(in) :: &
-         active_gases_array ! List of active gases from namelist as array
 
     ! Outputs
     character(len=*), intent(out) :: &
@@ -121,11 +117,10 @@ subroutine rrtmgp_sw_gas_optics_init(rrtmgp_root_dir, rrtmgp_sw_file_gas,
          errflg              ! CCPP error code
 
     ! Local variables
-    integer :: status, ncid, dimid, varID, iGas, mpierr, iChar
+    integer :: status, ncid, dimid, varID, mpierr, iChar
     integer,dimension(:),allocatable :: temp1, temp2, temp3, temp4
     character(len=264) :: sw_gas_props_file
-    type(ty_gas_concs) :: gas_concentrations  ! RRTMGP DDT containing active trace gases
-
+    type(ty_gas_concs) :: gas_concs  ! RRTMGP DDT containing active trace gases
 
     ! Initialize
     errmsg = ''
@@ -488,129 +483,19 @@ subroutine rrtmgp_sw_gas_optics_init(rrtmgp_root_dir, rrtmgp_sw_file_gas,
     ! Initialize RRTMGP DDT's...
     !
     ! #######################################################################################
-    allocate(gas_concentrations%gas_name(1:size(active_gases_array)))
-    gas_concentrations%gas_name(:) = active_gases_array(:)
-    call check_error_msg('sw_gas_optics_init',sw_gas_props%load(gas_concentrations,         &
+    call check_error_msg('rrtmgp_sw_gas_optics_init_gas_concs',gas_concs%init(active_gases_array))
+    call check_error_msg('rrtmgp_sw_gas_optics_init_load',sw_gas_props%load(gas_concs,      &
          gas_namesSW, key_speciesSW, band2gptSW, band_limsSW, press_refSW, press_ref_tropSW,&
          temp_refSW, temp_ref_pSW, temp_ref_tSW, vmr_refSW, kmajorSW, kminor_lowerSW,       &
          kminor_upperSW, gas_minorSW, identifier_minorSW, minor_gases_lowerSW,              &
          minor_gases_upperSW, minor_limits_gpt_lowerSW, minor_limits_gpt_upperSW,           &
          minor_scales_with_density_lowerSW, minor_scales_with_density_upperSW,              &
          scaling_gas_lowerSW, scaling_gas_upperSW, scale_by_complement_lowerSW,             &
-
-
          scale_by_complement_upperSW, kminor_start_lowerSW, kminor_start_upperSW,           &
          solar_quietSW, solar_facularSW, solar_sunspotSW, tsi_defaultSW, mg_defaultSW,      &
          sb_defaultSW, rayl_lowerSW, rayl_upperSW))
 
   end subroutine rrtmgp_sw_gas_optics_init
-
-!> @}
-  ! ###################################################################################### 
-!> \section arg_table_rrtmgp_sw_gas_optics_run
-!! \htmlinclude rrtmgp_sw_gas_optics.html
-!!
-!> \ingroup rrtmgp_sw_gas_optics
-!!
-!! Compute shortwave optical prperties (optical-depth, single-scattering albedo,
-!! asymmetry parameter) for clear-sky conditions.
-!!
-!! \section rrtmgp_sw_gas_optics_run
-!> @{
-  ! ###################################################################################### 
-  subroutine rrtmgp_sw_gas_optics_run(doSWrad, nCol, nLev, ngptsGPsw, nday, idxday,  p_lay, &
-       p_lev, toa_src_sw, t_lay, t_lev, active_gases_array, gas_concentrations, solcon,     &
-       sw_optical_props_clrsky, errmsg, errflg)
-
-    ! Inputs
-    logical, intent(in) :: &
-         doSWrad                 ! Flag to calculate SW irradiances
-    integer,intent(in) :: &
-         ngptsGPsw,            & ! Number of spectral (g) points.
-         nDay,                 & ! Number of daylit points.
-         nCol,                 & ! Number of horizontal points
-         nLev                    ! Number of vertical levels
-    integer,intent(in),dimension(ncol) :: &
-         idxday                  ! Indices for daylit points.
-    real(kind_phys), dimension(ncol,nLev), intent(in) :: &
-         p_lay,                & ! Pressure @ model layer-centers (Pa)
-         t_lay                   ! Temperature (K)
-    real(kind_phys), dimension(ncol,nLev+1), intent(in) :: &
-         p_lev,                & ! Pressure @ model layer-interfaces (Pa)
-         t_lev                   ! Temperature @ model levels
-    type(ty_gas_concs),intent(inout) :: &
-         gas_concentrations      ! RRTMGP DDT: trace gas concentrations (vmr)
-    real(kind_phys), intent(in) :: &
-         solcon                  ! Solar constant
-
-    ! Output
-    character(len=*), intent(out) :: &
-         errmsg                  ! CCPP error message
-    integer,          intent(out) :: &
-         errflg                  ! CCPP error code
-    type(ty_optical_props_2str),intent(out) :: &
-         sw_optical_props_clrsky ! RRTMGP DDT: clear-sky shortwave optical properties, spectral (tau,ssa,g) 
-    real(kind_phys), dimension(nCol,ngptsGPsw), intent(out) :: &
-         toa_src_sw              ! TOA incident spectral flux (W/m2)
-    character(len=*), dimension(:), intent(in) :: &
-         active_gases_array ! List of active gases from namelist as array
-
-    ! Local variables
-    integer :: ij,iGas
-    real(kind_phys), dimension(ncol,nLev) :: vmrTemp
-    real(kind_phys), dimension(nday,ngptsGPsw) :: toa_src_sw_temp
-    type(ty_gas_concs)  ::  gas_concentrations_daylit
-
-    ! Initialize CCPP error handling variables
-    errmsg = ''
-    errflg = 0
-
-    if (.not. doSWrad) return
-
-    gas_concentrations%gas_name(:) = active_gases_array(:)
-
-    toa_src_sw(:,:) = 0._kind_phys
-    if (nDay .gt. 0) then
-       ! Allocate space
-       call check_error_msg('rrtmgp_sw_gas_optics_run_alloc_2str',&
-            sw_optical_props_clrsky%alloc_2str(nday, nLev, sw_gas_props))
-
-       gas_concentrations_daylit%ncol = nDay
-       gas_concentrations_daylit%nlay = nLev
-       allocate(gas_concentrations_daylit%gas_name(gas_concentrations%get_num_gases()))
-       allocate(gas_concentrations_daylit%concs(gas_concentrations%get_num_gases()))
-       do iGas=1,gas_concentrations%get_num_gases()
-          allocate(gas_concentrations_daylit%concs(iGas)%conc(nDay, nLev))
-       enddo
-       gas_concentrations_daylit%gas_name(:) = active_gases_array(:)
-
-       ! Subset the gas concentrations.
-       do iGas=1,gas_concentrations%get_num_gases()
-          call check_error_msg('rrtmgp_sw_gas_optics_run_get_vmr',&
-               gas_concentrations%get_vmr(trim(gas_concentrations_daylit%gas_name(iGas)),vmrTemp))
-          call check_error_msg('rrtmgp_sw_gas_optics_run_set_vmr',&
-               gas_concentrations_daylit%set_vmr(trim(gas_concentrations_daylit%gas_name(iGas)),vmrTemp(idxday(1:nday),:)))
-       enddo
-
-       ! Call SW gas-optics
-       call check_error_msg('rrtmgp_sw_gas_optics_run',sw_gas_props%gas_optics(&
-            p_lay(idxday(1:nday),:),          & ! IN  - Pressure @ layer-centers (Pa)
-            p_lev(idxday(1:nday),:),          & ! IN  - Pressure @ layer-interfaces (Pa)
-            t_lay(idxday(1:nday),:),          & ! IN  - Temperature @ layer-centers (K)
-            gas_concentrations_daylit,        & ! IN  - RRTMGP DDT: trace gas volumne mixing-ratios
-            sw_optical_props_clrsky,          & ! OUT - RRTMGP DDT: Shortwave optical properties, by
-                                                !                   spectral point (tau,ssa,g)
-            toa_src_sw_temp))                   ! OUT - TOA incident shortwave radiation (spectral)
-       toa_src_sw(idxday(1:nday),:) = toa_src_sw_temp
-
-       ! Scale incident flux
-       do ij=1,nday
-          toa_src_sw(idxday(ij),:) = toa_src_sw(idxday(ij),:)*solcon/ &
-                                     sum(toa_src_sw(idxday(ij),:))
-       enddo
-    endif
-
-  end subroutine rrtmgp_sw_gas_optics_run
 !> @}
 end module rrtmgp_sw_gas_optics
  
diff --git a/physics/rrtmgp_sw_gas_optics.meta b/physics/rrtmgp_sw_gas_optics.meta
deleted file mode 100644
index 1fdbc946b..000000000
--- a/physics/rrtmgp_sw_gas_optics.meta
+++ /dev/null
@@ -1,201 +0,0 @@
-[ccpp-table-properties]
-  name = rrtmgp_sw_gas_optics
-  type = scheme
-  dependencies = machine.F,radiation_tools.F90,GFS_rrtmgp_pre.F90,rte-rrtmgp/rrtmgp/mo_gas_optics_rrtmgp.F90,rte-rrtmgp/rte/mo_rte_kind.F90,rte-rrtmgp/rrtmgp/mo_gas_concentrations.F90,rte-rrtmgp/rte/mo_optical_props.F90
-
-########################################################################
-[ccpp-arg-table]
-  name = rrtmgp_sw_gas_optics_init
-  type = scheme
-[rrtmgp_root_dir]
-  standard_name = directory_for_rte_rrtmgp_source_code
-  long_name = directory for rte+rrtmgp source code
-  units = none
-  dimensions =  ()
-  type = character
-  intent = in
-  kind = len=128
-[rrtmgp_sw_file_gas]
-  standard_name = filename_of_rrtmgp_shortwave_k_distribution
-  long_name = file containing RRTMGP SW k-distribution
-  units = none
-  dimensions =  ()
-  type = character
-  intent = in
-  kind = len=128
-[active_gases_array]
-  standard_name = list_of_active_gases_used_by_RRTMGP
-  long_name = list of active gases used by RRTMGP
-  units = none
-  dimensions =  (number_of_active_gases_used_by_RRTMGP)
-  type = character
-  kind = len=*
-  intent = in
-[mpirank]
-  standard_name = mpi_rank
-  long_name = current MPI rank
-  units = index
-  dimensions = ()
-  type = integer
-  intent = in
-[mpiroot]
-  standard_name = mpi_root
-  long_name = master MPI rank
-  units = index
-  dimensions = ()
-  type = integer
-  intent = in
-[mpicomm]
-  standard_name = mpi_communicator
-  long_name = MPI communicator
-  units = index
-  dimensions = ()
-  type = integer
-  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
-
-########################################################################
-[ccpp-arg-table]
-  name = rrtmgp_sw_gas_optics_run
-  type = scheme
-[doSWrad]
-  standard_name = flag_for_calling_shortwave_radiation
-  long_name = flag to calculate SW irradiances
-  units = flag
-  dimensions = ()
-  type = logical
-  intent = in
-[ncol]
-  standard_name = horizontal_loop_extent
-  long_name = horizontal dimension
-  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
-[nday]
-  standard_name = daytime_points_dimension
-  long_name = daytime points dimension
-  units = count
-  dimensions = ()
-  type = integer
-  intent = in
-[idxday]
-  standard_name = daytime_points
-  long_name = daytime points
-  units = index
-  dimensions = (horizontal_loop_extent)
-  type = integer
-  intent = in
-[ngptsGPsw]
-  standard_name = number_of_shortwave_spectral_points
-  long_name = number of spectral points in RRTMGP SW calculation
-  units = count
-  dimensions =  ()
-  type = integer
-  intent = in
-[p_lay]
-  standard_name = air_pressure_at_layer_for_RRTMGP
-  long_name = air pressure layer
-  units = Pa
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[p_lev]
-  standard_name = air_pressure_at_interface_for_RRTMGP
-  long_name = air pressure level
-  units = Pa
-  dimensions = (horizontal_loop_extent,vertical_interface_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[t_lay]
-  standard_name = air_temperature_at_layer_for_RRTMGP
-  long_name = air temperature layer
-  units = K
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[t_lev]
-  standard_name = air_temperature_at_interface_for_RRTMGP
-  long_name = air temperature level
-  units = K
-  dimensions = (horizontal_loop_extent,vertical_interface_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[toa_src_sw]
-  standard_name = toa_incident_sw_flux_by_spectral_point
-  long_name = TOA shortwave incident flux at each spectral points
-  units = W m-2
-  dimensions = (horizontal_loop_extent,number_of_shortwave_spectral_points)
-  type = real
-  kind = kind_phys
-  intent = out
-[active_gases_array]
-  standard_name = list_of_active_gases_used_by_RRTMGP
-  long_name = list of active gases used by RRTMGP
-  units = none
-  dimensions =  (number_of_active_gases_used_by_RRTMGP)
-  type = character
-  kind = len=*
-  intent = in
-[gas_concentrations]
-  standard_name = Gas_concentrations_for_RRTMGP_suite
-  long_name = DDT containing gas concentrations for RRTMGP radiation scheme
-  units = DDT
-  dimensions = ()
-  type = ty_gas_concs
-  intent = inout
-[solcon]
-  standard_name = solar_constant
-  long_name = solar constant
-  units = W m-2
-  dimensions = ()
-  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
-[sw_optical_props_clrsky]
-  standard_name = shortwave_optical_properties_for_clear_sky
-  long_name = Fortran DDT containing RRTMGP optical properties
-  units = DDT
-  dimensions = ()
-  type = ty_optical_props_2str
-  intent = out
diff --git a/physics/rrtmgp_sw_main.F90 b/physics/rrtmgp_sw_main.F90
new file mode 100644
index 000000000..b25e093e7
--- /dev/null
+++ b/physics/rrtmgp_sw_main.F90
@@ -0,0 +1,683 @@
+! ###########################################################################################
+! ###########################################################################################
+module rrtmgp_sw_main
+  use machine,                only: kind_phys, kind_dbl_prec
+  use mo_optical_props,       only: ty_optical_props_2str
+  use mo_cloud_optics,        only: ty_cloud_optics
+  use module_radsw_parameters, only: cmpfsw_type
+  use mo_rte_sw,              only: rte_sw
+  use mo_gas_optics_rrtmgp,   only: ty_gas_optics_rrtmgp
+  use mo_gas_concentrations,  only: ty_gas_concs
+  use mo_fluxes_byband,       only: ty_fluxes_byband
+  use radiation_tools,        only: check_error_msg
+  use rrtmgp_sw_gas_optics,   only: sw_gas_props,rrtmgp_sw_gas_optics_init
+  use rrtmgp_sw_cloud_optics, only: sw_cloud_props, rrtmgp_sw_cloud_optics_init, a0r, a0s,  &
+                                    a1s, b0r, b0s, b1s, c0r, c0s
+  use GFS_rrtmgp_pre,         only: iStr_h2o, iStr_co2, iStr_o3, iStr_n2o, iStr_ch4,        &
+                                    iStr_o2, iStr_ccl4, iStr_cfc11, iStr_cfc12, iStr_cfc22, &
+                                    eps, oneminus, ftiny
+  use mersenne_twister,       only: random_setseed, random_number, random_stat
+  use rrtmgp_sampling,        only: sampled_mask, draw_samples
+  implicit none
+
+  type(ty_gas_concs)          :: gas_concs
+  type(ty_optical_props_2str) :: sw_optical_props_accum, sw_optical_props_aerosol_local,    &
+       sw_optical_props_cloudsByBand, sw_optical_props_cnvcloudsByBand,                     &
+       sw_optical_props_pblcloudsByBand, sw_optical_props_precipByBand,                     &
+       sw_optical_props_clouds
+
+  public rrtmgp_sw_main_init, rrtmgp_sw_main_run
+
+contains
+
+  ! #########################################################################################
+  ! SUBROUTINE rrtmgp_sw_main_init
+  ! #########################################################################################
+!! \section arg_table_rrtmgp_sw_main_init
+!! \htmlinclude rrtmgp_sw_main_init.html
+!!
+  subroutine rrtmgp_sw_main_init(rrtmgp_root_dir, rrtmgp_sw_file_gas, rrtmgp_sw_file_clouds,&
+       active_gases_array, doGP_cldoptics_PADE, doGP_cldoptics_LUT, doGP_sgs_pbl,           &
+       doGP_sgs_cnv, nrghice, mpicomm, mpirank, mpiroot, nLay, rrtmgp_phys_blksz,           &
+       errmsg, errflg)
+
+    ! Inputs
+    character(len=128),intent(in) :: &
+         rrtmgp_root_dir,       & ! RTE-RRTMGP root directory
+         rrtmgp_sw_file_clouds, & ! RRTMGP file containing K-distribution data
+         rrtmgp_sw_file_gas       ! RRTMGP file containing cloud-optics data
+    character(len=*), dimension(:), intent(in) :: &
+         active_gases_array       ! List of active gases from namelist as array)
+    logical, intent(in) :: &
+         doGP_cldoptics_PADE,   & ! Use RRTMGP cloud-optics: PADE approximation?
+         doGP_cldoptics_LUT,    & ! Use RRTMGP cloud-optics: LUTs?
+         doGP_sgs_pbl,          & ! Flag to include sgs PBL clouds
+         doGP_sgs_cnv             ! Flag to include sgs convective clouds
+    integer, intent(inout) :: &
+         nrghice                  ! Number of ice-roughness categories
+    integer,intent(in) :: &
+         mpicomm,               & ! MPI communicator
+         mpirank,               & ! Current MPI rank
+         mpiroot,               & ! Master MPI rank
+         rrtmgp_phys_blksz,     & ! Number of horizontal points to process at once.
+         nLay
+    ! Outputs
+    character(len=*), intent(out) :: &
+         errmsg                   ! CCPP error message
+    integer,          intent(out) :: &
+         errflg                   ! CCPP error code
+
+    ! Initialize CCPP error handling variables
+    errmsg = ''
+    errflg = 0
+
+    ! RRTMGP shortwave gas-optics (k-distribution) initialization
+    call rrtmgp_sw_gas_optics_init(rrtmgp_root_dir, rrtmgp_sw_file_gas, active_gases_array,&
+         mpicomm, mpirank, mpiroot, errmsg, errflg)
+
+    ! RRTMGP shortwave cloud-optics initialization
+    call rrtmgp_sw_cloud_optics_init(rrtmgp_root_dir, rrtmgp_sw_file_clouds,               &
+         doGP_cldoptics_PADE, doGP_cldoptics_LUT, nrghice, mpicomm, mpirank, mpiroot,      &
+         errmsg, errflg)
+
+    ! DDTs
+
+    ! ty_gas_concs
+    call check_error_msg('rrtmgp_sw_main_gas_concs_init',gas_concs%init(active_gases_array))
+
+    ! ty_optical_props
+    call check_error_msg('rrtmgp_sw_main_accumulated_optics_init',&
+         sw_optical_props_accum%alloc_2str(rrtmgp_phys_blksz, nLay, sw_gas_props))
+    call check_error_msg('rrtmgp_sw_main_cloud_optics_init',&
+         sw_optical_props_cloudsByBand%alloc_2str(rrtmgp_phys_blksz, nLay, sw_gas_props%get_band_lims_wavenumber()))
+    call check_error_msg('rrtmgp_sw_main_precip_optics_init',&
+         sw_optical_props_precipByBand%alloc_2str(rrtmgp_phys_blksz, nLay, sw_gas_props%get_band_lims_wavenumber()))
+    call check_error_msg('rrtmgp_sw_mian_cloud_sampling_init', &
+         sw_optical_props_clouds%alloc_2str(rrtmgp_phys_blksz, nLay, sw_gas_props))
+    call check_error_msg('rrtmgp_sw_main_aerosol_optics_init',&
+         sw_optical_props_aerosol_local%alloc_2str(rrtmgp_phys_blksz, nLay, sw_gas_props%get_band_lims_wavenumber()))
+    if (doGP_sgs_cnv) then
+       call check_error_msg('rrtmgp_sw_main_cnv_cloud_optics_init',&
+            sw_optical_props_cnvcloudsByBand%alloc_2str(rrtmgp_phys_blksz, nLay, sw_gas_props%get_band_lims_wavenumber()))
+    endif
+    if (doGP_sgs_pbl) then
+       call check_error_msg('rrtmgp_sw_main_pbl_cloud_optics_init',&
+            sw_optical_props_pblcloudsByBand%alloc_2str(rrtmgp_phys_blksz, nLay, sw_gas_props%get_band_lims_wavenumber()))
+    endif
+  end subroutine rrtmgp_sw_main_init
+
+  ! #########################################################################################
+  ! SUBROUTINE rrtmgp_sw_main_run
+  ! #########################################################################################
+!! \section arg_table_rrtmgp_sw_main_run
+!! \htmlinclude rrtmgp_sw_main_run.html
+!!
+  subroutine rrtmgp_sw_main_run(doSWrad, doSWclrsky, top_at_1, doGP_sgs_cnv, doGP_sgs_pbl,  &
+       nCol, nDay, nLay, nGases, rrtmgp_phys_blksz, idx, icseed_sw, iovr, iovr_convcld,     &
+       iovr_max, iovr_maxrand, iovr_rand, iovr_dcorr, iovr_exp, iovr_exprand, isubc_sw,     &
+       iSFC, sfc_alb_nir_dir, sfc_alb_nir_dif, sfc_alb_uvvis_dir, sfc_alb_uvvis_dif, coszen,&
+       p_lay, p_lev, t_lay, t_lev, vmr_o2, vmr_h2o, vmr_o3, vmr_ch4, vmr_n2o, vmr_co2,      &
+       cld_frac, cld_lwp, cld_reliq, cld_iwp, cld_reice, cld_swp, cld_resnow, cld_rwp,      &
+       cld_rerain, precip_frac, cld_cnv_lwp, cld_cnv_reliq, cld_cnv_iwp, cld_cnv_reice,     &
+       cld_pbl_lwp, cld_pbl_reliq, cld_pbl_iwp, cld_pbl_reice, cloud_overlap_param,         &
+       active_gases_array, aersw_tau, aersw_ssa, aersw_g, solcon, scmpsw,                   &
+       fluxswUP_allsky, fluxswDOWN_allsky, fluxswUP_clrsky, fluxswDOWN_clrsky, cldtausw,    &
+       errmsg, errflg)
+
+    ! Inputs
+    logical, intent(in) :: &
+         doSWrad,             & ! Flag to perform shortwave calculation
+         doSWclrsky,          & ! Flag to compute clear-sky fluxes
+         top_at_1,            & ! Flag for vertical ordering convention
+         doGP_sgs_pbl,        & ! Flag to include sgs PBL clouds
+         doGP_sgs_cnv           ! Flag to include sgs convective clouds
+    integer,intent(in) :: &
+         nCol,                & ! Number of horizontal points
+         nDay,                & ! Number of daytime points
+         nLay,                & ! Number of vertical grid points.
+         nGases,              & ! Number of active gases
+         rrtmgp_phys_blksz,   & ! Number of horizontal points to process at once.
+         iovr,                & ! Choice of cloud-overlap method
+         iovr_convcld,        & ! Choice of convective cloud-overlap
+         iovr_max,            & ! Flag for maximum cloud overlap method
+         iovr_maxrand,        & ! Flag for maximum-random cloud overlap method
+         iovr_rand,           & ! Flag for random cloud overlap method
+         iovr_dcorr,          & ! Flag for decorrelation-length cloud overlap method
+         iovr_exp,            & ! Flag for exponential cloud overlap method
+         iovr_exprand,        & ! Flag for exponential-random cloud overlap method
+         isubc_sw,            & !
+         iSFC
+    integer,intent(in),dimension(:) :: &
+         idx,                 & ! Index array for daytime points
+         icseed_sw              ! Seed for random number generation for shortwave radiation
+    real(kind_phys), dimension(:), intent(in) :: &
+         sfc_alb_nir_dir,     & ! Surface albedo (direct)
+         sfc_alb_nir_dif,     & ! Surface albedo (diffuse)
+         sfc_alb_uvvis_dir,   & ! Surface albedo (direct)
+         sfc_alb_uvvis_dif,   & ! Surface albedo (diffuse)
+         coszen                 ! Cosize of SZA
+    real(kind_phys), dimension(:,:), intent(in) :: &
+         p_lay,               & ! Pressure @ model layer-centers (Pa)
+         t_lay,               & ! Temperature (K)
+         p_lev,               & ! Pressure @ model layer-interfaces (Pa)
+         t_lev,               & ! Temperature @ model levels (K)
+         vmr_o2,              & ! Molar-mixing ratio oxygen
+         vmr_h2o,             & ! Molar-mixing ratio water vapor
+         vmr_o3,              & ! Molar-mixing ratio ozone
+         vmr_ch4,             & ! Molar-mixing ratio methane
+         vmr_n2o,             & ! Molar-mixing ratio nitrous oxide
+         vmr_co2,             & ! Molar-mixing ratio carbon dioxide
+         cld_frac,            & ! Cloud-fraction for   stratiform   clouds
+         cld_lwp,             & ! Water path for       stratiform   liquid cloud-particles
+         cld_reliq,           & ! Effective radius for stratiform   liquid cloud-particles
+         cld_iwp,             & ! Water path for       stratiform   ice    cloud-particles
+         cld_reice,           & ! Effective radius for stratiform   ice    cloud-particles
+         cld_swp,             & ! Water path for                    snow   hydrometeors
+         cld_resnow,          & ! Effective radius for              snow   hydrometeors
+         cld_rwp,             & ! Water path for                    rain   hydrometeors
+         cld_rerain,          & ! Effective radius for              rain   hydrometeors
+         precip_frac,         & ! Precipitation fraction
+         cld_cnv_lwp,         & ! Water path for       convective   liquid cloud-particles
+         cld_cnv_reliq,       & ! Effective radius for convective   liquid cloud-particles
+         cld_cnv_iwp,         & ! Water path for       convective   ice    cloud-particles
+         cld_cnv_reice,       & ! Effective radius for convective   ice    cloud-particles
+         cld_pbl_lwp,         & ! Water path for       PBL          liquid cloud-particles
+         cld_pbl_reliq,       & ! Effective radius for PBL          liquid cloud-particles
+         cld_pbl_iwp,         & ! Water path for       PBL          ice    cloud-particles
+         cld_pbl_reice,       & ! Effective radius for PBL          ice    cloud-particles
+         cloud_overlap_param    !
+    real(kind_phys), dimension(:,:,:), intent(in) :: &
+          aersw_tau,          & ! Aerosol optical depth
+          aersw_ssa,          & ! Aerosol single scattering albedo
+          aersw_g               ! Aerosol asymmetry paramter
+    character(len=*), dimension(:), intent(in) :: &
+         active_gases_array     ! List of active gases from namelist as array
+    real(kind_phys), intent(in) :: &
+         solcon                 ! Solar constant
+
+    ! Outputs
+    character(len=*), intent(out) :: &
+         errmsg                ! CCPP error message
+    integer, intent(out) :: &
+         errflg                ! CCPP error flag
+    real(kind_phys), dimension(:,:), intent(inout) :: &
+         cldtausw              ! Approx 10.mu band layer cloud optical depth  
+    real(kind_phys), dimension(:,:), intent(inout) :: &
+         fluxswUP_allsky,    & ! RRTMGP upward all-sky flux profiles (W/m2)
+         fluxswDOWN_allsky,  & ! RRTMGP downward all-sky flux profiles (W/m2)
+         fluxswUP_clrsky,    & ! RRTMGP upward clear-sky flux profiles (W/m2)
+         fluxswDOWN_clrsky     ! RRTMGP downward clear-sky flux profiles (W/m2)
+    type(cmpfsw_type), dimension(:), intent(inout) :: &
+         scmpsw                ! 2D surface fluxes, components:
+                               ! uvbfc - total sky downward uv-b flux (W/m2)
+                               ! uvbf0 - clear sky downward uv-b flux (W/m2)
+                               ! nirbm - downward nir direct beam flux (W/m2)
+                               ! nirdf - downward nir diffused flux (W/m2)
+                               ! visbm - downward uv+vis direct beam flux (W/m2)
+                               ! visdf - downward uv+vis diffused flux (W/m2)
+
+    ! Local variables
+    type(cmpfsw_type), dimension(rrtmgp_phys_blksz) :: scmpsw_clrsky, scmpsw_allsky
+    type(ty_fluxes_byband)      :: flux_allsky, flux_clrsky
+    real(kind_phys) :: tau_rain, tau_snow, ssa_rain, ssa_snow, asy_rain, asy_snow, &
+         tau_prec, asy_prec, ssa_prec, asyw, ssaw, za1, za2, flux_dir, flux_dif
+    real(kind_phys), dimension(rrtmgp_phys_blksz) :: zcf0, zcf1
+    real(kind_dbl_prec), dimension(sw_gas_props%get_ngpt()) :: rng1D
+    real(kind_dbl_prec), dimension(sw_gas_props%get_ngpt(),nLay,rrtmgp_phys_blksz) :: rng3D,rng3D2
+    real(kind_dbl_prec), dimension(sw_gas_props%get_ngpt()*nLay) :: rng2D
+    logical, dimension(rrtmgp_phys_blksz,nLay,sw_gas_props%get_ngpt()) :: maskMCICA
+    logical :: cloudy_column, clear_column
+    real(kind_phys), dimension(sw_gas_props%get_nband(),rrtmgp_phys_blksz) :: &
+         sfc_alb_dir, sfc_alb_dif
+    real(kind_phys), dimension(rrtmgp_phys_blksz,nLay+1,sw_gas_props%get_nband()),target :: &
+         fluxSW_up_allsky, fluxSW_up_clrsky, fluxSW_dn_dir_clrsky, fluxSW_dn_allsky, &
+         fluxSW_dn_clrsky, fluxSW_dn_dir_allsky
+    integer :: iBand, ibd, ibd_uv, iCol, iGas, iLay, ix, ix2, iblck
+    integer, dimension(rrtmgp_phys_blksz) :: ipseed_sw, iCols
+    type(random_stat) :: rng_stat
+    real(kind_phys), dimension(2,sw_gas_props%get_nband()) :: bandlimits
+    real(kind_phys), dimension(2), parameter :: &
+         nIR_uvvis_bnd = (/12850,16000/), &
+         uvb_bnd       = (/29000,38000/)
+    real(kind_phys), dimension(rrtmgp_phys_blksz,sw_gas_props%get_ngpt()) :: toa_src_sw
+
+    ! Initialize CCPP error handling variables
+    errmsg = ''
+    errflg = 0
+
+    if (.not. doSWrad) return
+
+    if (nDay .gt. 0) then
+
+       bandlimits = sw_gas_props%get_band_lims_wavenumber()
+       ! ######################################################################################
+       !
+       ! Loop over all (daylit) columns...
+       !
+       ! ######################################################################################
+       do iCol=1,nDay,rrtmgp_phys_blksz
+          !ix  = idx(iCol)
+          !ix2 = idx(iCol + rrtmgp_phys_blksz - 1)
+          iCols = idx(iCol:iCol + rrtmgp_phys_blksz - 1)
+
+          ! Create clear/cloudy indicator
+          zcf0(:) = 1._kind_phys
+          zcf1(:) = 1._kind_phys
+          do iblck = 1, rrtmgp_phys_blksz
+             do iLay=1,nLay
+                zcf0(iblck) = min(zcf0(iblck), 1._kind_phys - cld_frac(iCols(iblck),iLay))
+             enddo
+             if (zcf0(iblck) <= ftiny)   zcf0(iblck) = 0._kind_phys
+             if (zcf0(iblck) > oneminus) zcf0(iblck) = 1._kind_phys
+             zcf1(iblck) = 1._kind_phys - zcf0(iblck)
+          enddo
+          cloudy_column = any(zcf1 .gt. eps)
+          clear_column  = .true.
+          if (cloudy_column) clear_column = .false.
+
+          ! ###################################################################################
+          !
+          ! Initialize/reset
+          !
+          ! ###################################################################################
+          sw_optical_props_clouds%tau             = 0._kind_phys
+          sw_optical_props_clouds%ssa             = 0._kind_phys
+          sw_optical_props_clouds%g               = 0._kind_phys
+          sw_optical_props_accum%tau              = 0._kind_phys
+          sw_optical_props_accum%ssa              = 0._kind_phys
+          sw_optical_props_accum%g                = 0._kind_phys
+          sw_optical_props_cloudsByBand%tau       = 0._kind_phys
+          sw_optical_props_cloudsByBand%ssa       = 0._kind_phys
+          sw_optical_props_cloudsByBand%g         = 0._kind_phys
+          sw_optical_props_precipByBand%tau       = 0._kind_phys
+          sw_optical_props_precipByBand%ssa       = 0._kind_phys
+          sw_optical_props_precipByBand%g         = 0._kind_phys
+          if (doGP_sgs_cnv) then
+             sw_optical_props_cnvcloudsByBand%tau = 0._kind_phys
+             sw_optical_props_cnvcloudsByBand%ssa = 0._kind_phys
+             sw_optical_props_cnvcloudsByBand%g   = 0._kind_phys
+          endif
+          if (doGP_sgs_pbl) then
+             sw_optical_props_pblcloudsByBand%tau = 0._kind_phys
+             sw_optical_props_pblcloudsByBand%ssa = 0._kind_phys
+             sw_optical_props_pblcloudsByBand%g   = 0._kind_phys
+          endif
+          scmpsw_clrsky= cmpfsw_type( 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 )
+          scmpsw_allsky= cmpfsw_type( 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 )
+          cldtausw = 0._kind_phys
+
+          ! ty_fluxes_byband
+          fluxSW_up_allsky            = 0._kind_phys
+          fluxSW_dn_allsky            = 0._kind_phys
+          fluxSW_dn_dir_allsky        = 0._kind_phys
+          fluxSW_up_clrsky            = 0._kind_phys
+          fluxSW_dn_clrsky            = 0._kind_phys
+          flux_allsky%bnd_flux_up     => fluxSW_up_allsky
+          flux_allsky%bnd_flux_dn     => fluxSW_dn_allsky
+          flux_allsky%bnd_flux_dn_dir => fluxSW_dn_dir_allsky
+          flux_clrsky%bnd_flux_up     => fluxSW_up_clrsky
+          flux_clrsky%bnd_flux_dn     => fluxSW_dn_clrsky
+
+          ! ###################################################################################
+          !
+          ! Set gas-concentrations
+          !
+          ! ###################################################################################
+          call check_error_msg('rrtmgp_sw_main_set_vmr_o2',  &
+               gas_concs%set_vmr(trim(active_gases_array(istr_o2)), vmr_o2(iCols,:)))
+          call check_error_msg('rrtmgp_sw_main_set_vmr_co2', &
+               gas_concs%set_vmr(trim(active_gases_array(istr_co2)),vmr_co2(iCols,:)))
+          call check_error_msg('rrtmgp_sw_main_set_vmr_ch4', &
+               gas_concs%set_vmr(trim(active_gases_array(istr_ch4)),vmr_ch4(iCols,:)))
+          call check_error_msg('rrtmgp_sw_main_set_vmr_n2o', &
+               gas_concs%set_vmr(trim(active_gases_array(istr_n2o)),vmr_n2o(iCols,:)))
+          call check_error_msg('rrtmgp_sw_main_set_vmr_h2o', &
+               gas_concs%set_vmr(trim(active_gases_array(istr_h2o)),vmr_h2o(iCols,:)))
+          call check_error_msg('rrtmgp_sw_main_set_vmr_o3',  &
+               gas_concs%set_vmr(trim(active_gases_array(istr_o3)), vmr_o3(iCols,:)))
+
+          ! ###################################################################################
+          !
+          ! Compute gas-optics
+          !
+          ! ###################################################################################
+
+          call check_error_msg('rrtmgp_sw_main_gas_optics',sw_gas_props%gas_optics(&
+               p_lay(iCols,:),          & ! IN  - Pressure @ layer-centers (Pa)
+               p_lev(iCols,:),          & ! IN  - Pressure @ layer-interfaces (Pa)
+               t_lay(iCols,:),          & ! IN  - Temperature @ layer-centers (K)
+               gas_concs,               & ! IN  - RRTMGP DDT: trace gas volumne mixing-ratios
+               sw_optical_props_accum,  & ! OUT - RRTMGP DDT: Shortwave optical properties, by
+                                          !                   spectral point (tau,ssa,g)
+               toa_src_sw))               ! OUT - TOA incident shortwave radiation (spectral)
+          ! Scale incident flux
+          do iblck = 1, rrtmgp_phys_blksz
+             toa_src_sw(iblck,:) = toa_src_sw(iblck,:)*solcon / sum(toa_src_sw(iblck,:))
+          enddo
+
+          ! ###################################################################################
+          !
+          ! Set surface albedo
+          !
+          ! Use near-IR albedo for bands with wavenumbers extending to 12850cm-1
+          ! Use uv-vis albedo for bands with wavenumbers greater than 16000cm-1
+          ! For overlapping band, average near-IR and us-vis albedos.
+          !
+          ! ###################################################################################
+          do iblck = 1, rrtmgp_phys_blksz
+             do iBand=1,sw_gas_props%get_nband()
+                if (bandlimits(1,iBand) .lt. nIR_uvvis_bnd(1)) then
+                   sfc_alb_dir(iBand,iblck) = sfc_alb_nir_dir(iCols(iblck))
+                   sfc_alb_dif(iBand,iblck) = sfc_alb_nir_dif(iCols(iblck))
+                endif
+                if (bandlimits(1,iBand) .eq. nIR_uvvis_bnd(1)) then
+                   sfc_alb_dir(iBand,iblck) = 0.5_kind_phys*(sfc_alb_nir_dir(iCols(iblck)) +    &
+                                                             sfc_alb_uvvis_dir(iCols(iblck)))
+                   sfc_alb_dif(iBand,iblck) = 0.5_kind_phys*(sfc_alb_nir_dif(iCols(iblck)) +    &
+                                                             sfc_alb_uvvis_dif(iCols(iblck)))
+                   ibd = iBand
+                endif
+                if (bandlimits(1,iBand) .ge. nIR_uvvis_bnd(2)) then
+                   sfc_alb_dir(iBand,iblck) = sfc_alb_uvvis_dir(iCols(iblck))
+                   sfc_alb_dif(iBand,iblck) = sfc_alb_uvvis_dif(iCols(iblck))
+                endif
+                if (bandlimits(1,iBand) .eq. uvb_bnd(1)) ibd_uv = iBand
+             enddo
+          enddo
+
+          ! ###################################################################################
+          !
+          ! Compute optics for cloud(s) and precipitation, sample clouds...
+          !
+          ! ###################################################################################
+          if (cloudy_column) then
+             ! Gridmean/mp-clouds
+             call check_error_msg('rrtmgp_sw_main_cloud_optics',sw_cloud_props%cloud_optics(&
+                  cld_lwp(iCols,:),                     & ! IN  - Cloud liquid water path
+                  cld_iwp(iCols,:),                     & ! IN  - Cloud ice water path
+                  cld_reliq(iCols,:),                   & ! IN  - Cloud liquid effective radius
+                  cld_reice(iCols,:),                   & ! IN  - Cloud ice effective radius
+                  sw_optical_props_cloudsByBand))         ! OUT - RRTMGP DDT: Shortwave optical properties, 
+                                                          !       in each band (tau,ssa,g)
+             cldtausw(iCols,:) = sw_optical_props_cloudsByBand%tau(:,:,11)
+          
+             ! Include convective clouds?
+             if (doGP_sgs_cnv) then
+                ! Compute
+                call check_error_msg('rrtmgp_sw_main_cnv_cloud_optics',sw_cloud_props%cloud_optics(&
+                     cld_cnv_lwp(iCols,:),              & ! IN  - Convective cloud liquid water path (g/m2)
+                     cld_cnv_iwp(iCols,:),              & ! IN  - Convective cloud ice water path (g/m2)
+                     cld_cnv_reliq(iCols,:),            & ! IN  - Convective cloud liquid effective radius (microns)
+                     cld_cnv_reice(iCols,:),            & ! IN  - Convective cloud ice effective radius (microns)
+                     sw_optical_props_cnvcloudsByBand))   ! OUT - RRTMGP DDT containing convective cloud radiative properties
+                                                          !       in each band
+                ! Increment
+                call check_error_msg('rrtmgp_sw_main_increment_cnvclouds_to_clouds',&
+                     sw_optical_props_cnvcloudsByBand%increment(sw_optical_props_cloudsByBand))
+             endif
+
+             ! Include PBL clouds?
+             if (doGP_sgs_pbl) then
+                ! Compute
+                call check_error_msg('rrtmgp_sw_main_pbl_cloud_optics',sw_cloud_props%cloud_optics(&
+                     cld_pbl_lwp(iCols,:),              & ! IN  - PBL cloud liquid water path (g/m2)
+                     cld_pbl_iwp(iCols,:),              & ! IN  - PBL cloud ice water path (g/m2)
+                     cld_pbl_reliq(iCols,:),            & ! IN  - PBL cloud liquid effective radius (microns)
+                     cld_pbl_reice(iCols,:),            & ! IN  - PBL cloud ice effective radius (microns)
+                     sw_optical_props_pblcloudsByBand))   ! OUT - RRTMGP DDT containing PBL cloud radiative properties
+                                                          !       in each band
+                ! Increment
+                call check_error_msg('rrtmgp_sw_main_increment_pblclouds_to_clouds',&
+                     sw_optical_props_pblcloudsByBand%increment(sw_optical_props_cloudsByBand))
+             endif
+          
+             ! Cloud precipitation optics: rain and snow(+groupel)
+             do iblck = 1, rrtmgp_phys_blksz
+                do iLay=1,nLay
+                   if (cld_frac(iCols(iblck),iLay) .gt. ftiny) then
+                      ! Rain/Snow optical depth (No band dependence)
+                      tau_rain = cld_rwp(iCols(iblck),iLay)*a0r
+                      if (cld_swp(iCols(iblck),iLay) .gt. 0. .and. cld_resnow(iCols(iblck),iLay) .gt. 10._kind_phys) then
+                         tau_snow = cld_swp(iCols(iblck),iLay)*1.09087*(a0s + a1s/(1.0315*cld_resnow(iCols(iblck),iLay)))     ! fu's formula 
+                      else
+                         tau_snow = 0._kind_phys
+                      endif
+                      
+                      ! Rain/Snow single-scattering albedo and asymmetry (Band dependent)
+                      do iBand=1,sw_gas_props%get_nband()
+                         ! By species
+                         ssa_rain = tau_rain*(1.-b0r(iBand))
+                         asy_rain = ssa_rain*c0r(iBand)
+                         ssa_snow = tau_snow*(1.-(b0s(iBand)+b1s(iBand)*1.0315*cld_resnow(iCols(iblck),iLay)))
+                         asy_snow = ssa_snow*c0s(iBand)
+                         ! Combine
+                         tau_prec = max(1.e-12_kind_phys, tau_rain + tau_snow)
+                         ssa_prec = max(1.e-12_kind_phys, ssa_rain + ssa_snow)
+                         asy_prec = max(1.e-12_kind_phys, asy_rain + asy_snow)
+                         asyw     = asy_prec/max(1.e-12_kind_phys, ssa_prec)
+                         ssaw     = min(1._kind_phys-0.000001, ssa_prec/tau_prec)
+                         za1      = asyw * asyw
+                         za2      = ssaw * za1                      
+                         sw_optical_props_precipByBand%tau(iblck,iLay,iBand) = (1._kind_phys - za2) * tau_prec
+                         sw_optical_props_precipByBand%ssa(iblck,iLay,iBand) = (ssaw - za2) / (1._kind_phys - za2)
+                         sw_optical_props_precipByBand%g(iblck,iLay,iBand)   = asyw/(1+asyw)
+                      enddo
+                   endif
+                enddo
+             enddo
+             ! Increment 
+             call check_error_msg('rrtmgp_sw_main_increment_precip_to_clouds',&
+                  sw_optical_props_precipByBand%increment(sw_optical_props_cloudsByBand))
+          
+             ! ###################################################################################
+             !
+             ! Cloud-sampling
+             !
+             ! ###################################################################################
+             ! Change random number seed value for each radiation invocation (isubc_sw =1 or 2).
+             if(isubc_sw == 1) then      ! advance prescribed permutation seed
+                do iblck = 1, rrtmgp_phys_blksz
+                   ipseed_sw(iblck) = sw_gas_props%get_ngpt() + iCols(iblck)
+                enddo
+             elseif (isubc_sw == 2) then ! use input array of permutaion seeds
+                do iblck = 1, rrtmgp_phys_blksz
+                   ipseed_sw(iblck) = icseed_sw(iCols(iblck))
+                enddo
+             endif
+
+             ! Call RNG
+             do iblck = 1, rrtmgp_phys_blksz
+                call random_setseed(ipseed_sw(iblck),rng_stat)
+                ! Use same rng for each layer
+                if (iovr == iovr_max) then
+                   call random_number(rng1D,rng_stat)
+                   do iLay=1,nLay
+                      rng3D(:,iLay,iblck) = rng1D
+                   enddo
+                else
+                   do iLay=1,nLay
+                      call random_number(rng1D,rng_stat)
+                      rng3D(:,iLay,iblck) = rng1D
+                   enddo
+                endif
+             enddo
+             
+             ! Cloud-overlap.
+             ! Maximum-random, random or maximum.
+             if (iovr == iovr_maxrand .or. iovr == iovr_rand .or. iovr == iovr_max) then
+                call sampled_mask(real(rng3D, kind=kind_phys), cld_frac(iCols,:), maskMCICA)
+             endif
+             ! Exponential decorrelation length overlap
+             if (iovr == iovr_dcorr) then
+                do iblck = 1, rrtmgp_phys_blksz
+                   ! Generate second RNG
+                   call random_setseed(ipseed_sw(iblck),rng_stat)
+                   call random_number(rng2D,rng_stat)
+                   rng3D2(:,:,iblck) = reshape(source = rng2D,shape=[sw_gas_props%get_ngpt(),nLay])
+                enddo
+                !
+                call sampled_mask(real(rng3D, kind=kind_phys), cld_frac(iCols,:), maskMCICA,                    &
+                     overlap_param = cloud_overlap_param(iCols,1:nLay-1), randoms2 = real(rng3D2, kind=kind_phys))
+             endif
+             ! Exponential or Exponential-random
+             if (iovr == iovr_exp .or. iovr == iovr_exprand) then
+                call sampled_mask(real(rng3D, kind=kind_phys), cld_frac(iCols,:), maskMCICA,  &
+                     overlap_param = cloud_overlap_param(iCols,1:nLay-1))
+             endif
+             ! Sampling. Map band optical depth to each g-point using McICA
+             call check_error_msg('rrtmgp_sw_main_cloud_sampling',&
+                  draw_samples(maskMCICA, .true., &
+                  sw_optical_props_cloudsByBand, sw_optical_props_clouds))
+          endif ! cloudy_column
+
+          ! ###################################################################################
+          !
+          ! Compute clear-sky fluxes (gaseous+aerosol)
+          !
+          ! ###################################################################################
+          ! Increment optics (always)
+          sw_optical_props_aerosol_local%tau = aersw_tau(iCols,:,:)
+          sw_optical_props_aerosol_local%ssa = aersw_ssa(iCols,:,:)
+          sw_optical_props_aerosol_local%g   = aersw_g(iCols,:,:)
+          call check_error_msg('rrtmgp_sw_main_increment_aerosol_to_clrsky', & 
+               sw_optical_props_aerosol_local%increment(sw_optical_props_accum))
+
+          ! Compute clear-sky fluxes (Yes for no-clouds. Optional for cloudy scenes)
+          if (clear_column .or. doSWclrsky) then
+             call check_error_msg('rrtmgp_sw_main_rte_sw_clrsky',rte_sw(     &
+                  sw_optical_props_accum,    & ! IN  - optical-properties
+                  top_at_1,                  & ! IN  - veritcal ordering flag
+                  coszen(iCols),             & ! IN  - Cosine of solar zenith angle
+                  toa_src_sw,                & ! IN  - incident solar flux at TOA
+                  sfc_alb_dir,               & ! IN  - Shortwave surface albedo (direct)
+                  sfc_alb_dif,               & ! IN  - Shortwave surface albedo (diffuse)
+                  flux_clrsky))                ! OUT - Fluxes, clear-sky, 3D (1,nLay,nBand) 
+             
+             ! Store fluxes
+             fluxswUP_clrsky(iCols,:)   = sum(flux_clrsky%bnd_flux_up, dim=3)
+             fluxswDOWN_clrsky(iCols,:) = sum(flux_clrsky%bnd_flux_dn, dim=3)
+
+             ! Compute surface downward beam/diffused flux components
+             do iblck = 1, rrtmgp_phys_blksz
+                do iBand=1,sw_gas_props%get_nband()
+                   flux_dir = flux_clrsky%bnd_flux_dn(iblck,iSFC,iBand)
+                   flux_dif = 0._kind_phys
+                   ! Near-IR bands
+                   if (iBand < ibd) then
+                      scmpsw_clrsky(iblck)%nirbm = scmpsw_clrsky(iblck)%nirbm + flux_dir
+                      scmpsw_clrsky(iblck)%nirdf = scmpsw_clrsky(iblck)%nirdf + flux_dif
+                   endif
+                   ! Transition band
+                   if (iBand == ibd) then
+                      scmpsw_clrsky(iblck)%nirbm = scmpsw_clrsky(iblck)%nirbm + flux_dir*0.5_kind_phys
+                      scmpsw_clrsky(iblck)%nirdf = scmpsw_clrsky(iblck)%nirdf + flux_dif*0.5_kind_phys
+                      scmpsw_clrsky(iblck)%visbm = scmpsw_clrsky(iblck)%visbm + flux_dir*0.5_kind_phys
+                      scmpsw_clrsky(iblck)%visdf = scmpsw_clrsky(iblck)%visdf + flux_dif*0.5_kind_phys
+                   endif
+                   ! UV-VIS bands
+                   if (iBand > ibd) then
+                      scmpsw_clrsky(iblck)%visbm = scmpsw_clrsky(iblck)%visbm + flux_dir
+                      scmpsw_clrsky(iblck)%visdf = scmpsw_clrsky(iblck)%visdf + flux_dif
+                   endif
+                   ! uv-b surface downward flux
+                   scmpsw_clrsky(iblck)%uvbfc    = flux_clrsky%bnd_flux_dn(iblck,iSFC,ibd_uv)
+                enddo
+             enddo
+          else
+             fluxswUP_clrsky(iCols,:)   = 0._kind_phys
+             fluxswDOWN_clrsky(iCols,:) = 0._kind_phys
+             scmpsw                     = cmpfsw_type( 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 )
+          endif
+
+          ! ###################################################################################
+          !
+          ! All-sky fluxes (clear-sky + clouds + precipitation)
+          !
+          ! ###################################################################################
+          if (cloudy_column) then
+             ! Delta scale
+             !call check_error_msg('rrtmgp_sw_main_delta_scale',sw_optical_props_clouds%delta_scale())
+
+             ! Increment
+             call check_error_msg('rrtmgp_sw_main_increment_clouds_to_clrsky', & 
+                  sw_optical_props_clouds%increment(sw_optical_props_accum))
+
+             ! Compute fluxes
+             call check_error_msg('rrtmgp_sw_main_rte_sw_allsky',rte_sw(     &
+                  sw_optical_props_accum,    & ! IN  - optical-properties
+                  top_at_1,                  & ! IN  - veritcal ordering flag
+                  coszen(iCols),             & ! IN  - Cosine of solar zenith angle
+                  toa_src_sw,                & ! IN  - incident solar flux at TOA
+                  sfc_alb_dir,               & ! IN  - Shortwave surface albedo (direct)
+                  sfc_alb_dif,               & ! IN  - Shortwave surface albedo (diffuse)
+                  flux_allsky))                ! OUT - Fluxes, clear-sky, 3D (1,nLay,nBand)
+             
+             ! Store fluxes
+             fluxswUP_allsky(iCols,:)   = sum(flux_allsky%bnd_flux_up, dim=3)
+             fluxswDOWN_allsky(iCols,:) = sum(flux_allsky%bnd_flux_dn, dim=3)
+             
+             ! Compute and store downward beam/diffused flux components
+             do iblck = 1, rrtmgp_phys_blksz
+                ! Loop over bands, sum fluxes...
+                do iBand=1,sw_gas_props%get_nband()
+                   flux_dir = flux_allsky%bnd_flux_dn_dir(iblck,iSFC,iBand) 
+                   flux_dif = flux_allsky%bnd_flux_dn(iblck,iSFC,iBand) - flux_allsky%bnd_flux_dn_dir(iblck,iSFC,iBand)
+                   ! Near-IR bands
+                   if (iBand < ibd) then
+                      scmpsw_allsky(iblck)%nirbm = scmpsw_allsky(iblck)%nirbm + flux_dir
+                      scmpsw_allsky(iblck)%nirdf = scmpsw_allsky(iblck)%nirdf + flux_dif
+                   endif
+                   ! Transition band
+                   if (iBand == ibd) then
+                      scmpsw_allsky(iblck)%nirbm = scmpsw_allsky(iblck)%nirbm + flux_dir*0.5_kind_phys
+                      scmpsw_allsky(iblck)%nirdf = scmpsw_allsky(iblck)%nirdf + flux_dif*0.5_kind_phys
+                      scmpsw_allsky(iblck)%visbm = scmpsw_allsky(iblck)%visbm + flux_dir*0.5_kind_phys
+                      scmpsw_allsky(iblck)%visdf = scmpsw_allsky(iblck)%visdf + flux_dif*0.5_kind_phys
+                   endif
+                   ! UV-VIS bands
+                   if (iBand > ibd) then
+                      scmpsw_allsky(iblck)%visbm = scmpsw_allsky(iblck)%visbm + flux_dir
+                      scmpsw_allsky(iblck)%visdf = scmpsw_allsky(iblck)%visdf + flux_dif
+                   endif
+                   ! uv-b surface downward flux 
+                   scmpsw_allsky(iblck)%uvbfc    = flux_allsky%bnd_flux_dn(iblck,iSFC,ibd_uv)
+                enddo
+                ! Store surface downward beam/diffused flux components
+                if (zcf1(iblck) .gt. eps) then
+                   scmpsw(iCols(iblck))%nirbm = scmpsw_allsky(iblck)%nirbm
+                   scmpsw(iCols(iblck))%nirdf = scmpsw_allsky(iblck)%nirdf
+                   scmpsw(iCols(iblck))%visbm = scmpsw_allsky(iblck)%visbm
+                   scmpsw(iCols(iblck))%visdf = scmpsw_allsky(iblck)%visdf
+                   scmpsw(iCols(iblck))%uvbfc = flux_allsky%bnd_flux_dn(iblck,iSFC,ibd_uv)
+                else
+                   scmpsw(iCols(iblck))%nirbm = scmpsw_clrsky(iblck)%nirbm
+                   scmpsw(iCols(iblck))%nirdf = scmpsw_clrsky(iblck)%nirdf
+                   scmpsw(iCols(iblck))%visbm = scmpsw_clrsky(iblck)%visbm
+                   scmpsw(iCols(iblck))%visdf = scmpsw_clrsky(iblck)%visdf
+                   scmpsw(iCols(iblck))%uvbfc = flux_clrsky%bnd_flux_dn(iblck,iSFC,ibd_uv)
+                endif
+                scmpsw(iCols(iblck))%uvbf0    = flux_clrsky%bnd_flux_dn(iblck,iSFC,ibd_uv)
+             enddo
+          else ! No clouds
+             fluxswUP_allsky(iCols,:)   = sum(flux_clrsky%bnd_flux_up, dim=3)
+             fluxswDOWN_allsky(iCols,:) = sum(flux_clrsky%bnd_flux_dn, dim=3)
+             do iblck = 1, rrtmgp_phys_blksz
+                scmpsw(iCols(iblck))%nirbm = scmpsw_clrsky(iblck)%nirbm
+                scmpsw(iCols(iblck))%nirdf = scmpsw_clrsky(iblck)%nirdf
+                scmpsw(iCols(iblck))%visbm = scmpsw_clrsky(iblck)%visbm
+                scmpsw(iCols(iblck))%visdf = scmpsw_clrsky(iblck)%visdf
+                scmpsw(iCols(iblck))%uvbfc = flux_clrsky%bnd_flux_dn(iblck,iSFC,ibd_uv)
+                scmpsw(iCols(iblck))%uvbf0 = flux_clrsky%bnd_flux_dn(iblck,iSFC,ibd_uv)
+             enddo
+          endif
+          !
+       enddo ! nday
+    else
+       fluxswUP_allsky(:,:)   = 0._kind_phys
+       fluxswDOWN_allsky(:,:) = 0._kind_phys
+       fluxswUP_clrsky(:,:)   = 0._kind_phys
+       fluxswDOWN_clrsky(:,:) = 0._kind_phys
+       scmpsw                 = cmpfsw_type( 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 )
+    endif
+  end subroutine rrtmgp_sw_main_run
+end module rrtmgp_sw_main
diff --git a/physics/rrtmgp_sw_main.meta b/physics/rrtmgp_sw_main.meta
new file mode 100644
index 000000000..4ca6cc716
--- /dev/null
+++ b/physics/rrtmgp_sw_main.meta
@@ -0,0 +1,664 @@
+[ccpp-table-properties]
+  name = rrtmgp_sw_main
+  type = scheme
+  dependencies = machine.F,radiation_tools.F90,GFS_rrtmgp_pre.F90,rte-rrtmgp/rrtmgp/mo_gas_optics_rrtmgp.F90
+  dependencies = rte-rrtmgp/rte/mo_rte_kind.F90,rte-rrtmgp/rrtmgp/mo_gas_concentrations.F90,rte-rrtmgp/rte/mo_optical_props.F90
+  dependencies = rte-rrtmgp/rte/mo_rte_sw.F90,rte-rrtmgp/rte/mo_fluxes.F90
+  dependencies = rte-rrtmgp/rte/kernels/mo_fluxes_broadband_kernels.F90, rte-rrtmgp/rte/kernels/mo_rte_solver_kernels.F90
+  dependencies = mersenne_twister.f,rrtmgp_sampling.F90,rte-rrtmgp/extensions/mo_fluxes_byband.F90
+  dependencies = rrtmgp_sw_gas_optics.F90, rrtmgp_sw_cloud_optics.F90
+
+########################################################################
+[ccpp-arg-table]
+  name = rrtmgp_sw_main_init
+  type = scheme
+[rrtmgp_root_dir]
+  standard_name = directory_for_rte_rrtmgp_source_code
+  long_name = directory for rte+rrtmgp source code
+  units = none
+  dimensions =  ()
+  type = character
+  intent = in
+  kind = len=128
+[rrtmgp_sw_file_gas]
+  standard_name = filename_of_rrtmgp_shortwave_k_distribution
+  long_name = file containing RRTMGP SW k-distribution
+  units = none
+  dimensions =  ()
+  type = character
+  intent = in
+  kind = len=128
+[rrtmgp_sw_file_clouds]
+  standard_name = filename_of_rrtmgp_shortwave_cloud_optics_coefficients
+  long_name = file containing coefficients for RRTMGP SW cloud optics
+  units = none
+  dimensions =  ()
+  type = character
+  intent = in
+  kind = len=128
+[doGP_cldoptics_PADE]
+  standard_name = flag_to_calc_lw_cld_optics_using_RRTMGP_PADE
+  long_name = logical flag to control cloud optics scheme.
+  units = flag
+  dimensions = ()
+  type = logical
+  intent = in
+[doGP_cldoptics_LUT]
+  standard_name = flag_to_calc_lw_cld_optics_using_RRTMGP_LUT
+  long_name = logical flag to control cloud optics scheme.
+  units = flag
+  dimensions = ()
+  type = logical
+  intent = in
+[nrghice]
+  standard_name = number_of_ice_roughness_categories
+  long_name = number of ice-roughness categories in RRTMGP calculation
+  units = count
+  dimensions =  ()
+  type = integer
+  intent = inout
+[doGP_sgs_cnv]
+  standard_name = flag_to_include_sgs_convective_cloud_in_RRTMGP
+  long_name = logical flag to control sgs convective cloud in RRTMGP
+  units = flag
+  dimensions = ()
+  type = logical
+  intent = in
+[doGP_sgs_pbl]
+  standard_name = flag_to_include_sgs_MYNN_EDMF_cloud_in_RRTMGP
+  long_name = logical flag to control MYNN-EDMF PBL cloud in RRTMGP
+  units = flag
+  dimensions = ()
+  type = logical
+  intent = in
+[rrtmgp_phys_blksz]
+  standard_name = number_of_columns_per_RRTMGP_SW_block
+  long_name = number of columns to process at a time by RRTMGP SW scheme
+  units = count
+  dimensions =  ()
+  type = integer
+  intent = in
+[nLay]
+  standard_name = vertical_layer_dimension
+  long_name = number of vertical levels
+  units = count
+  dimensions = ()
+  type = integer
+  intent = in
+[mpirank]
+  standard_name = mpi_rank
+  long_name = current MPI rank
+  units = index
+  dimensions = ()
+  type = integer
+  intent = in
+[mpiroot]
+  standard_name = mpi_root
+  long_name = master MPI rank
+  units = index
+  dimensions = ()
+  type = integer
+  intent = in
+[mpicomm]
+  standard_name = mpi_communicator
+  long_name = MPI communicator
+  units = index
+  dimensions = ()
+  type = integer
+  intent = in
+[active_gases_array]
+  standard_name = list_of_active_gases_used_by_RRTMGP
+  long_name = list of active gases used by RRTMGP
+  units = none
+  dimensions =  (number_of_active_gases_used_by_RRTMGP)
+  type = character
+  kind = len=*
+  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
+
+########################################################################
+[ccpp-arg-table]
+  name = rrtmgp_sw_main_run
+  type = scheme
+[doSWrad]
+  standard_name = flag_for_calling_shortwave_radiation
+  long_name = logical flags for sw radiation calls
+  units = flag
+  dimensions = ()
+  type = logical
+  intent = in
+[doSWclrsky]
+  standard_name = flag_for_output_of_tendency_of_air_temperature_due_to_shortwave_heating_on_radiation_timestep_assuming_clear_sky
+  long_name = flag to output sw heating rate (Radtend%swhc)
+  units = flag
+  dimensions = ()
+  type = logical  
+  intent = in
+[top_at_1]
+  standard_name = flag_for_vertical_ordering_in_RRTMGP
+  long_name = flag for vertical ordering in RRTMGP
+  units = flag
+  dimensions = ()
+  type = logical
+  intent = in
+[iSFC]
+  standard_name = vertical_index_for_surface_in_RRTMGP
+  long_name = index for surface layer in RRTMGP
+  units = flag
+  dimensions = ()
+  type = integer
+  intent = in
+[doGP_sgs_cnv]
+  standard_name = flag_to_include_sgs_convective_cloud_in_RRTMGP
+  long_name = logical flag to control sgs convective cloud in RRTMGP
+  units = flag
+  dimensions = ()
+  type = logical
+  intent = in
+[doGP_sgs_pbl]
+  standard_name = flag_to_include_sgs_MYNN_EDMF_cloud_in_RRTMGP
+  long_name = logical flag to control MYNN-EDMF PBL cloud in RRTMGP
+  units = flag
+  dimensions = ()
+  type = logical
+  intent = in
+[ncol]
+  standard_name = horizontal_loop_extent
+  long_name = horizontal dimension
+  units = count
+  dimensions = ()
+  type = integer
+  intent = in
+[nLay]
+  standard_name = vertical_layer_dimension
+  long_name = number of vertical levels
+  units = count
+  dimensions = ()
+  type = integer
+  intent = in
+[rrtmgp_phys_blksz]
+  standard_name = number_of_columns_per_RRTMGP_SW_block
+  long_name = number of columns to process at a time by RRTMGP SW scheme
+  units = count
+  dimensions =  ()
+  type = integer
+  intent = in
+[nGases]
+  standard_name = number_of_active_gases_used_by_RRTMGP
+  long_name = number of gases available used by RRTMGP (Model%nGases)
+  units = count
+  dimensions =  ()
+  type = integer
+  intent = in
+[nday]
+  standard_name = daytime_points_dimension
+  long_name = daytime points dimension
+  units = count
+  dimensions = ()
+  type = integer
+  intent = in
+[idx]
+  standard_name = daytime_points
+  long_name = daytime points
+  units = index
+  dimensions = (horizontal_loop_extent)
+  type = integer
+  intent = in
+[coszen]
+  standard_name = cosine_of_solar_zenith_angle_for_daytime_points_on_radiation_timestep
+  long_name = mean cos of zenith angle over rad call period
+  units = none
+  dimensions = (horizontal_loop_extent)
+  type = real
+  kind = kind_phys
+  intent = in
+[isubc_sw]
+  standard_name = flag_for_sw_clouds_grid_approximation
+  long_name = flag for sw clouds sub-grid approximation
+  units = flag
+  dimensions = ()
+  type = integer
+  intent = in
+[iovr]
+  standard_name = flag_for_cloud_overlap_method_for_radiation
+  long_name = max-random overlap clouds
+  units = flag
+  dimensions = ()
+  type = integer
+  intent = in
+[iovr_maxrand]
+  standard_name = flag_for_maximum_random_cloud_overlap_method
+  long_name = choice of maximum-random cloud overlap method
+  units = flag
+  dimensions = ()
+  type = integer
+  intent = in
+[iovr_dcorr]
+  standard_name = flag_for_decorrelation_length_cloud_overlap_method
+  long_name = choice of decorrelation-length cloud overlap method
+  units     = flag
+  dimensions = ()
+  type = integer
+  intent = in
+[iovr_exp]
+  standard_name = flag_for_exponential_cloud_overlap_method
+  long_name = choice of exponential cloud overlap method
+  units     = flag
+  dimensions = ()
+  type = integer
+  intent = in
+[iovr_exprand]
+  standard_name = flag_for_exponential_random_cloud_overlap_method
+  long_name = choice of exponential-random cloud overlap method
+  units     = flag
+  dimensions = ()
+  type = integer
+  intent = in
+[iovr_rand]
+  standard_name = flag_for_random_cloud_overlap_method
+  long_name = choice of random cloud overlap method
+  units = flag
+  dimensions = ()
+  type = integer
+  intent = in
+[iovr_max]
+  standard_name = flag_for_maximum_cloud_overlap_method
+  long_name = choice of maximum cloud overlap method
+  units = flag
+  dimensions = ()
+  type = integer
+  intent = in
+[iovr_convcld]
+  standard_name = flag_for_convective_cloud_overlap_method_for_radiation
+  long_name = flag for convective cloud overlap method
+  units = flag
+  dimensions = ()
+  type = integer
+  intent = in
+[icseed_sw]
+  standard_name = random_number_seed_for_mcica_shortwave
+  long_name = seed for random number generation for shortwave radiation
+  units = none
+  dimensions = (horizontal_loop_extent)
+  type = integer
+  intent = in
+[p_lay]
+  standard_name = air_pressure_at_layer_for_RRTMGP
+  long_name = air pressure at vertical layer for radiation calculation
+  units = Pa
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[p_lev]
+  standard_name = air_pressure_at_interface_for_RRTMGP
+  long_name = air pressure at vertical interface for radiation calculation
+  units = Pa
+  dimensions = (horizontal_loop_extent,vertical_interface_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[t_lay]
+  standard_name = air_temperature_at_layer_for_RRTMGP
+  long_name = air temperature at vertical layer for radiation calculation
+  units = K
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[t_lev]
+  standard_name = air_temperature_at_interface_for_RRTMGP
+  long_name = air temperature  at vertical interface for radiation calculation
+  units = K
+  dimensions = (horizontal_loop_extent,vertical_interface_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[vmr_o2]
+  standard_name = volume_mixing_ratio_for_o2
+  long_name = molar mixing ratio of o2 in with respect to dry air
+  units = 1
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[vmr_h2o]
+  standard_name = volume_mixing_ratio_for_h2o
+  long_name = molar mixing ratio of h2o in with respect to dry air
+  units = 1
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[vmr_o3]
+  standard_name = volume_mixing_ratio_for_o3
+  long_name = molar mixing ratio of o3 in with respect to dry air
+  units = 1
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[vmr_ch4]
+  standard_name = volume_mixing_ratio_for_ch4
+  long_name = molar mixing ratio of ch4 in with respect to dry air
+  units = 1
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[vmr_n2o]
+  standard_name = volume_mixing_ratio_for_n2o
+  long_name = molar mixing ratio of n2o in with respect to dry air
+  units = 1
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[vmr_co2]
+  standard_name = volume_mixing_ratio_for_co2
+  long_name = molar mixing ratio of co2 in with respect to dry air
+  units = 1
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[cld_frac]
+  standard_name = total_cloud_fraction
+  long_name = layer total cloud fraction
+  units = frac
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[cld_lwp]
+  standard_name = cloud_liquid_water_path
+  long_name = layer cloud liquid water path
+  units = g m-2
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[cld_reliq]
+  standard_name = mean_effective_radius_for_liquid_cloud
+  long_name = mean effective radius for liquid cloud
+  units = um
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[cld_iwp]
+  standard_name = cloud_ice_water_path
+  long_name = layer cloud ice water path
+  units = g m-2
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[cld_reice]
+  standard_name = mean_effective_radius_for_ice_cloud
+  long_name = mean effective radius for ice cloud
+  units = um
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[cld_swp]
+  standard_name = cloud_snow_water_path
+  long_name = layer cloud snow water path
+  units = g m-2
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[cld_resnow]
+  standard_name = mean_effective_radius_for_snow_flake
+  long_name = mean effective radius for snow cloud
+  units = um
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[cld_rwp]
+  standard_name = cloud_rain_water_path
+  long_name = layer cloud rain water path
+  units = g m-2
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[cld_rerain]
+  standard_name = mean_effective_radius_for_rain_drop
+  long_name = mean effective radius for rain cloud
+  units = um
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[precip_frac]
+  standard_name = precipitation_fraction_by_layer
+  long_name = precipitation fraction in each layer
+  units = frac
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[cld_cnv_lwp]
+  standard_name = convective_cloud_liquid_water_path
+  long_name = layer convective cloud liquid water path
+  units = g m-2
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[cld_cnv_iwp]
+  standard_name = convective_cloud_ice_water_path
+  long_name = layer convective cloud ice water path
+  units = g m-2
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[cld_cnv_reliq]
+  standard_name = mean_effective_radius_for_liquid_convective_cloud
+  long_name = mean effective radius for liquid convective cloud
+  units = um
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[cld_cnv_reice]
+  standard_name = mean_effective_radius_for_ice_convective_cloud
+  long_name = mean effective radius for ice convective cloud
+  units = um
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[cld_pbl_lwp]
+  standard_name = MYNN_SGS_cloud_liquid_water_path
+  long_name = layer convective cloud liquid water path
+  units = g m-2
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[cld_pbl_iwp]
+  standard_name = MYNN_SGS_cloud_ice_water_path
+  long_name = layer convective cloud ice water path
+  units = g m-2
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[cld_pbl_reliq]
+  standard_name = mean_effective_radius_for_liquid_MYNN_SGS_cloud
+  long_name = mean effective radius for liquid MYNN_SGS cloud
+  units = um
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[cld_pbl_reice]
+  standard_name = mean_effective_radius_for_ice_MYNN_SGS_cloud
+  long_name = mean effective radius for ice MYNN_SGS cloud
+  units = um
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[cloud_overlap_param]
+  standard_name = cloud_overlap_param
+  long_name = cloud overlap parameter
+  units = km
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[sfc_alb_nir_dir]
+  standard_name = surface_albedo_due_to_near_IR_direct
+  long_name = surface albedo due to near IR direct beam
+  units = frac
+  dimensions = (horizontal_loop_extent)
+  type = real
+  kind = kind_phys
+  intent = in
+[sfc_alb_nir_dif]
+  standard_name = surface_albedo_due_to_near_IR_diffused
+  long_name = surface albedo due to near IR diffused beam
+  units = frac
+  dimensions = (horizontal_loop_extent)
+  type = real
+  kind = kind_phys
+  intent = in
+[sfc_alb_uvvis_dir]
+  standard_name = surface_albedo_due_to_UV_and_VIS_direct
+  long_name = surface albedo due to UV+VIS direct beam
+  units = frac
+  dimensions = (horizontal_loop_extent)
+  type = real
+  kind = kind_phys
+  intent = in
+[sfc_alb_uvvis_dif]
+  standard_name = surface_albedo_due_to_UV_and_VIS_diffused
+  long_name = surface albedo due to UV+VIS diffused beam
+  units = frac
+  dimensions = (horizontal_loop_extent)
+  type = real
+  kind = kind_phys
+  intent = in
+[active_gases_array]
+  standard_name = list_of_active_gases_used_by_RRTMGP
+  long_name = list of active gases used by RRTMGP
+  units = none
+  dimensions =  (number_of_active_gases_used_by_RRTMGP)
+  type = character
+  kind = len=*
+  intent = in
+[aersw_tau]
+  standard_name = aerosol_optical_depth_for_shortwave_bands_01_16
+  long_name = aerosol optical depth for shortwave bands 01-16
+  units = none
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension,number_of_aerosol_bands_for_shortwave_radiation)
+  type = real
+  kind = kind_phys
+  intent = in
+[aersw_ssa]
+  standard_name = aerosol_single_scattering_albedo_for_shortwave_bands_01_16
+  long_name = aerosol single scattering albedo for shortwave bands 01-16
+  units = frac
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension,number_of_aerosol_bands_for_shortwave_radiation)
+  type = real
+  kind = kind_phys
+  intent = in
+[aersw_g]
+  standard_name = aerosol_asymmetry_parameter_for_shortwave_bands_01_16
+  long_name = aerosol asymmetry parameter for shortwave bands 01-16
+  units = none
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension,number_of_aerosol_bands_for_shortwave_radiation)
+  type = real
+  kind = kind_phys
+  intent = in
+[solcon]
+  standard_name = solar_constant
+  long_name = solar constant
+  units = W m-2
+  dimensions = ()
+  type = real
+  kind = kind_phys
+  intent = in
+[scmpsw]
+  standard_name = components_of_surface_downward_shortwave_fluxes
+  long_name = derived type for special components of surface downward shortwave fluxes
+  units = W m-2
+  dimensions = (horizontal_loop_extent)
+  type = cmpfsw_type
+  intent = inout
+[fluxswUP_allsky]
+  standard_name = RRTMGP_sw_flux_profile_upward_allsky
+  long_name = RRTMGP upward shortwave all-sky flux profile
+  units = W m-2
+  dimensions = (horizontal_loop_extent,vertical_interface_dimension)
+  type = real
+  kind = kind_phys
+  intent = inout
+[fluxswDOWN_allsky]
+  standard_name = RRTMGP_sw_flux_profile_downward_allsky
+  long_name = RRTMGP downward shortwave all-sky flux profile
+  units = W m-2
+  dimensions = (horizontal_loop_extent,vertical_interface_dimension)
+  type = real
+  kind = kind_phys
+  intent = inout
+[fluxswUP_clrsky]
+  standard_name = RRTMGP_sw_flux_profile_upward_clrsky
+  long_name = RRTMGP upward shortwave clr-sky flux profile
+  units = W m-2
+  dimensions = (horizontal_loop_extent,vertical_interface_dimension)
+  type = real
+  kind = kind_phys
+  intent = inout
+[fluxswDOWN_clrsky]
+  standard_name = RRTMGP_sw_flux_profile_downward_clrsky
+  long_name = RRTMGP downward shortwave clr-sky flux profile
+  units = W m-2
+  dimensions = (horizontal_loop_extent,vertical_interface_dimension)
+  type = real
+  kind = kind_phys
+  intent = inout
+[cldtausw]
+  standard_name = cloud_optical_depth_layers_at_0p55mu_band
+  long_name = approx .55mu band layer cloud optical depth
+  units = none
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = inout
+[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
diff --git a/physics/rrtmgp_sw_rte.F90 b/physics/rrtmgp_sw_rte.F90
deleted file mode 100644
index 521aae2c1..000000000
--- a/physics/rrtmgp_sw_rte.F90
+++ /dev/null
@@ -1,219 +0,0 @@
-!> \file rrtmgp_sw_rte.F90 
-!!
-!> \defgroup rrtmgp_sw_rte rrtmgp_sw_rte.F90
-!!
-!! \brief This module contains the main rte shortwave driver.
-module rrtmgp_sw_rte
-  use machine,                 only: kind_phys
-  use mo_optical_props,        only: ty_optical_props_2str
-  use mo_rte_sw,               only: rte_sw
-  use mo_fluxes_byband,        only: ty_fluxes_byband
-  use module_radsw_parameters, only: cmpfsw_type
-  use radiation_tools,         only: check_error_msg
-  use rrtmgp_sw_gas_optics,    only: sw_gas_props
-  implicit none
-
-  public rrtmgp_sw_rte_run
-
-contains
-!>\defgroup rrtmgp_sw_rte_mod GFS RRTMGP-SW RTE Module
-!> \section arg_table_rrtmgp_sw_rte_run
-!! \htmlinclude rrtmgp_sw_rte.html
-!!
-!> \ingroup rrtmgp_sw_rte
-!! 
-!! \brief This routine takes all of the shortwave optical properties ,ty_optical_props_2str,
-!! and computes the shortwave radiative fluxes for cloudy and clear-sky conditions.
-!!
-!! \section rrtmgp_sw_rte_run Main Driver
-!> @{
-  ! ######################################################################################
-  subroutine rrtmgp_sw_rte_run(doSWrad, doSWclrsky, nCol, nLev, nDay, idxday, coszen, p_lay,&
-       t_lay, top_at_1, doGP_sgs_cnv, doGP_sgs_mynn, iSFC, sfc_alb_nir_dir, sfc_alb_nir_dif,&
-       sfc_alb_uvvis_dir, sfc_alb_uvvis_dif, toa_src_sw, sw_optical_props_clrsky,           &
-       sw_optical_props_clouds, sw_optical_props_precipByBand,                              &
-       sw_optical_props_cnvcloudsByBand, sw_optical_props_MYNNcloudsByBand,                 &
-       sw_optical_props_aerosol, scmpsw, fluxswUP_allsky, fluxswDOWN_allsky,                &
-       fluxswUP_clrsky, fluxswDOWN_clrsky, errmsg, errflg)
-    
-    ! Inputs
-    logical, intent(in) :: &
-         top_at_1,                          & ! Vertical ordering flag
-         doGP_sgs_mynn,                     & ! Flag for MYNN-EDMF PBL cloud scheme
-         doGP_sgs_cnv,                      & ! Flag for sgs convective clouds scheme
-         doSWrad,                           & ! Flag to calculate SW irradiances
-         doSWclrsky                           ! Compute clear-sky fluxes?
-    integer, intent(in) :: &
-         nCol,                              & ! Number of horizontal gridpoints
-         nday,                              & ! Number of daytime points
-         nLev,                              & ! Number of vertical levels
-         iSFC                                 ! Vertical index for surface-level
-    integer, intent(in), dimension(:) :: &
-         idxday                               ! Index array for daytime points
-    real(kind_phys),intent(in), dimension(:) :: &
-         sfc_alb_nir_dir,                   & ! Surface albedo (direct)
-         sfc_alb_nir_dif,                   & ! Surface albedo (diffuse)
-         sfc_alb_uvvis_dir,                 & ! Surface albedo (direct)
-         sfc_alb_uvvis_dif,                 & ! Surface albedo (diffuse)
-         coszen                               ! Cosize of SZA
-    real(kind_phys), dimension(:,:), intent(in) :: &
-         p_lay,                             & ! Pressure @ model layer-centers (Pa)
-         t_lay,                             & ! Temperature (K)
-         toa_src_sw                           ! TOA incident spectral flux (W/m2)
-    type(ty_optical_props_2str),intent(inout) :: &
-         sw_optical_props_clrsky              ! RRTMGP DDT: shortwave clear-sky radiative properties 
-    type(ty_optical_props_2str),intent(in) :: &
-         sw_optical_props_clouds,           & ! RRTMGP DDT: shortwave cloud optical properties 
-         sw_optical_props_cnvcloudsByBand,  & ! RRTMGP DDT: shortwave convecive cloud optical properties
-         sw_optical_props_MYNNcloudsByBand, & ! RRTMGP DDT: shortwave MYNN-EDMF PBL cloud optical properties
-         sw_optical_props_precipByBand,     & ! RRTMGP DDT: shortwave precipitation optical properties
-         sw_optical_props_aerosol             ! RRTMGP DDT: shortwave aerosol optical properties
-
-    ! Outputs
-    character(len=*), intent(out) :: &
-         errmsg                     ! CCPP error message
-    integer, intent(out) :: &
-         errflg                     ! CCPP error flag
-    real(kind_phys), dimension(:,:), intent(inout) :: &
-         fluxswUP_allsky,         & ! RRTMGP upward all-sky flux profiles (W/m2)
-         fluxswDOWN_allsky,       & ! RRTMGP downward all-sky flux profiles (W/m2)
-         fluxswUP_clrsky,         & ! RRTMGP upward clear-sky flux profiles (W/m2)
-         fluxswDOWN_clrsky          ! RRTMGP downward clear-sky flux profiles (W/m2)
-    type(cmpfsw_type), dimension(:), intent(inout) :: &
-         scmpsw                     ! 2D surface fluxes, components:
-                                    ! uvbfc - total sky downward uv-b flux (W/m2)
-                                    ! uvbf0 - clear sky downward uv-b flux (W/m2)
-                                    ! nirbm - downward nir direct beam flux (W/m2)
-                                    ! nirdf - downward nir diffused flux (W/m2)
-                                    ! visbm - downward uv+vis direct beam flux (W/m2)
-                                    ! visdf - downward uv+vis diffused flux (W/m2)
-
-    ! Local variables
-    real(kind_phys), dimension(sw_gas_props%get_nband(),nday) :: &
-         sfc_alb_dir,sfc_alb_dif
-    type(ty_fluxes_byband) :: &
-         flux_allsky, & ! All-sky flux (W/m2)
-         flux_clrsky    ! Clear-sky flux (W/m2)
-    real(kind_phys), dimension(nday,NLev+1,sw_gas_props%get_nband()),target :: &
-         fluxSW_up_allsky, fluxSW_up_clrsky, fluxSW_dn_allsky, fluxSW_dn_clrsky, fluxSW_dn_dir_allsky
-    real(kind_phys), dimension(ncol,NLev) :: vmrTemp
-    integer :: iBand, iDay,ibd
-    real(kind_phys), dimension(2,sw_gas_props%get_nband()) :: bandlimits
-    real(kind_phys), dimension(2), parameter :: nIR_uvvis_bnd = (/12850,16000/)
-
-    ! Initialize CCPP error handling variables
-    errmsg = ''
-    errflg  = 0
-
-    if (.not. doSWrad) return
-
-    if (nDay .gt. 0) then
-
-       ! Initialize RRTMGP DDT containing 2D(3D) fluxes
-       flux_allsky%bnd_flux_up     => fluxSW_up_allsky
-       flux_allsky%bnd_flux_dn     => fluxSW_dn_allsky
-       flux_allsky%bnd_flux_dn_dir => fluxSW_dn_dir_allsky
-       flux_clrsky%bnd_flux_up     => fluxSW_up_clrsky
-       flux_clrsky%bnd_flux_dn     => fluxSW_dn_clrsky
-
-       ! Use near-IR albedo for bands with wavenumbers extending to 12850cm-1
-       ! Use uv-vis albedo for bands with wavenumbers greater than 16000cm-1
-       ! For overlapping band, average near-IR and us-vis albedos.
-       bandlimits = sw_gas_props%get_band_lims_wavenumber()
-       do iBand=1,sw_gas_props%get_nband()
-          if (bandlimits(1,iBand) .lt. nIR_uvvis_bnd(1)) then
-             sfc_alb_dir(iBand,:) = sfc_alb_nir_dir(idxday(1:nday))
-             sfc_alb_dif(iBand,:) = sfc_alb_nir_dif(idxday(1:nday))
-          endif
-          if (bandlimits(1,iBand) .eq. nIR_uvvis_bnd(1)) then
-             sfc_alb_dir(iBand,:) = 0.5_kind_phys*(sfc_alb_nir_dir(idxday(1:nday)) + sfc_alb_uvvis_dir(idxday(1:nday)))
-             sfc_alb_dif(iBand,:) = 0.5_kind_phys*(sfc_alb_nir_dif(idxday(1:nday)) + sfc_alb_uvvis_dif(idxday(1:nday)))
-             ibd = iBand
-          endif
-          if (bandlimits(1,iBand) .ge. nIR_uvvis_bnd(2)) then
-             sfc_alb_dir(iBand,:) = sfc_alb_uvvis_dir(idxday(1:nday))
-             sfc_alb_dif(iBand,:) = sfc_alb_uvvis_dif(idxday(1:nday))
-          endif
-       enddo
-
-       !
-       ! Compute clear-sky fluxes (if requested)
-       !
-
-       ! Clear-sky fluxes (gas+aerosol)
-       call check_error_msg('rrtmgp_sw_rte_run',sw_optical_props_aerosol%increment(sw_optical_props_clrsky))
-       ! Delta-scale optical properties
-       call check_error_msg('rrtmgp_sw_rte_run',sw_optical_props_clrsky%delta_scale())
-       if (doSWclrsky) then
-          call check_error_msg('rrtmgp_sw_rte_run',rte_sw(     &
-               sw_optical_props_clrsky,      & ! IN  - optical-properties
-               top_at_1,                     & ! IN  - veritcal ordering flag
-               coszen(idxday(1:nday)),       & ! IN  - Cosine of solar zenith angle
-               toa_src_sw(idxday(1:nday),:), & ! IN  - incident solar flux at TOA
-               sfc_alb_dir,                  & ! IN  - Shortwave surface albedo (direct)
-               sfc_alb_dif,                  & ! IN  - Shortwave surface albedo (diffuse)
-               flux_clrsky))                   ! OUT - Fluxes, clear-sky, 3D (nCol,NLev,nBand) 
-          ! Store fluxes
-          fluxswUP_clrsky(idxday(1:nday),:)   = sum(flux_clrsky%bnd_flux_up,dim=3)
-          fluxswDOWN_clrsky(idxday(1:nday),:) = sum(flux_clrsky%bnd_flux_dn,dim=3)
-       endif
-
-       !
-       ! Compute all-sky fluxes
-       !
-
-       ! Include convective cloud?
-       if (doGP_sgs_cnv) then
-          call check_error_msg('rrtmgp_sw_rte_run',sw_optical_props_cnvcloudsByBand%increment(sw_optical_props_clrsky))
-       endif
-
-       ! Include MYNN-EDMF PBL cloud?
-       if (doGP_sgs_mynn) then
-          call check_error_msg('rrtmgp_sw_rte_run',sw_optical_props_MYNNcloudsByBand%increment(sw_optical_props_clrsky))
-       endif
-
-       ! All-sky fluxes (clear-sky + clouds + precipitation)
-       call check_error_msg('rrtmgp_sw_rte_run',sw_optical_props_precipByBand%increment(sw_optical_props_clrsky))
-       call check_error_msg('rrtmgp_sw_rte_run',sw_optical_props_clouds%increment(sw_optical_props_clrsky))
-
-       ! Delta-scale optical properties
-       call check_error_msg('rrtmgp_sw_rte_run',sw_optical_props_clrsky%delta_scale())
-       call check_error_msg('rrtmgp_sw_rte_run',rte_sw(     &
-            sw_optical_props_clrsky,      & ! IN  - optical-properties
-            top_at_1,                     & ! IN  - veritcal ordering flag
-            coszen(idxday(1:nday)),       & ! IN  - Cosine of solar zenith angle
-            toa_src_sw(idxday(1:nday),:), & ! IN  - incident solar flux at TOA
-            sfc_alb_dir,                  & ! IN  - Shortwave surface albedo (direct)
-            sfc_alb_dif,                  & ! IN  - Shortwave surface albedo (diffuse)
-            flux_allsky))                   ! OUT - Fluxes, clear-sky, 3D (nCol,NLev,nBand) 
-
-       ! Store fluxes
-       fluxswUP_allsky(idxday(1:nday),:)   = sum(flux_allsky%bnd_flux_up,dim=3)
-       fluxswDOWN_allsky(idxday(1:nday),:) = sum(flux_allsky%bnd_flux_dn,dim=3)
-       do iDay=1,nDay
-          ! Near IR
-          scmpsw(idxday(iDay))%nirbm = sum(flux_allsky%bnd_flux_dn_dir(iDay,iSFC,1:ibd-1))  + &
-                                           flux_allsky%bnd_flux_dn_dir(iDay,iSFC,ibd)/2.
-          scmpsw(idxday(iDay))%nirdf = (sum(flux_allsky%bnd_flux_dn(iDay,iSFC,1:ibd-1))     + &
-                                            flux_allsky%bnd_flux_dn(iDay,iSFC,ibd)/2.)      - &
-                                       (sum(flux_allsky%bnd_flux_dn_dir(iDay,iSFC,1:ibd-1)) + &
-                                            flux_allsky%bnd_flux_dn_dir(iDay,iSFC,ibd)/2.)
-          ! UV-VIS
-          scmpsw(idxday(iDay))%visbm = sum(flux_allsky%bnd_flux_dn_dir(iDay,iSFC,ibd+1:sw_gas_props%get_nband()))  + &
-                                           flux_allsky%bnd_flux_dn_dir(iDay,iSFC,ibd)/2.
-          scmpsw(idxday(iDay))%visdf = (sum(flux_allsky%bnd_flux_dn(iDay,iSFC,ibd+1:sw_gas_props%get_nband()))     + &
-                                            flux_allsky%bnd_flux_dn(iDay,iSFC,ibd)/2. )                            - &
-                                       (sum(flux_allsky%bnd_flux_dn_dir(iDay,iSFC,ibd+1:sw_gas_props%get_nband())) + &
-                                            flux_allsky%bnd_flux_dn_dir(iDay,iSFC,ibd)/2.)
-       enddo
-    else
-       fluxswUP_allsky(:,:)   = 0._kind_phys
-       fluxswDOWN_allsky(:,:) = 0._kind_phys
-       fluxswUP_clrsky(:,:)   = 0._kind_phys
-       fluxswDOWN_clrsky(:,:) = 0._kind_phys
-       scmpsw                 = cmpfsw_type( 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 )       
-    endif
-
-  end subroutine rrtmgp_sw_rte_run
-!> @}
-end module rrtmgp_sw_rte
diff --git a/physics/rrtmgp_sw_rte.meta b/physics/rrtmgp_sw_rte.meta
deleted file mode 100644
index 9ab24c8b3..000000000
--- a/physics/rrtmgp_sw_rte.meta
+++ /dev/null
@@ -1,240 +0,0 @@
-[ccpp-table-properties]
-  name = rrtmgp_sw_rte
-  type = scheme
-  dependencies = machine.F,radsw_param.f,rte-rrtmgp/rte/mo_rte_sw.F90,rte-rrtmgp/rte/mo_fluxes.F90,rte-rrtmgp/rte/kernels/mo_fluxes_broadband_kernels.F90,radiation_tools.F90
-  dependencies = rte-rrtmgp/rte/kernels/mo_rte_solver_kernels.F90,rte-rrtmgp/extensions/mo_fluxes_byband.F90
-
-########################################################################
-[ccpp-arg-table]
-  name = rrtmgp_sw_rte_run
-  type = scheme
-[doSWrad]
-  standard_name = flag_for_calling_shortwave_radiation
-  long_name = flag to calculate SW irradiances
-  units = flag
-  dimensions = ()
-  type = logical
-  intent = in
-[doSWclrsky]
-  standard_name = flag_for_output_of_tendency_of_air_temperature_due_to_shortwave_heating_on_radiation_timestep_assuming_clear_sky
-  long_name = flag to output sw heating rate (Radtend%swhc)
-  units = flag
-  dimensions = ()
-  type = logical  
-  intent = in
-[ncol]
-  standard_name = horizontal_loop_extent
-  long_name = horizontal dimension
-  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
-[nday]
-  standard_name = daytime_points_dimension
-  long_name = daytime points dimension
-  units = count
-  dimensions = ()
-  type = integer
-  intent = in
-[idxday]
-  standard_name = daytime_points
-  long_name = daytime points
-  units = index
-  dimensions = (horizontal_loop_extent)
-  type = integer
-  intent = in
-[coszen]
-  standard_name = cosine_of_solar_zenith_angle_for_daytime_points_on_radiation_timestep
-  long_name = mean cos of zenith angle over rad call period
-  units = none
-  dimensions = (horizontal_loop_extent)
-  type = real
-  kind = kind_phys
-  intent = in
-[p_lay]
-  standard_name = air_pressure_at_layer_for_RRTMGP
-  long_name = air pressure layer
-  units = Pa
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[top_at_1]
-  standard_name = flag_for_vertical_ordering_in_RRTMGP
-  long_name = flag for vertical ordering in RRTMGP
-  units = flag
-  dimensions = ()
-  type = logical
-  intent = in
-[doGP_sgs_cnv]
-  standard_name = flag_to_include_sgs_convective_cloud_in_RRTMGP
-  long_name = logical flag to control sgs convective cloud in RRTMGP
-  units = flag
-  dimensions = ()
-  type = logical
-  intent = in
-[doGP_sgs_mynn]
-  standard_name = flag_to_include_sgs_MYNN_EDMF_cloud_in_RRTMGP
-  long_name = logical flag to control MYNN-EDMF PBL cloud in RRTMGP
-  units = flag
-  dimensions = ()
-  type = logical
-  intent = in
-[iSFC]
-  standard_name = vertical_index_for_surface_in_RRTMGP
-  long_name = index for surface layer in RRTMGP
-  units = flag
-  dimensions = ()
-  type = integer
-  intent = in
-[t_lay]
-  standard_name = air_temperature_at_layer_for_RRTMGP
-  long_name = air temperature layer
-  units = K
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[sw_optical_props_clrsky]
-  standard_name = shortwave_optical_properties_for_clear_sky
-  long_name = Fortran DDT containing RRTMGP optical properties
-  units = DDT
-  dimensions = ()
-  type = ty_optical_props_2str
-  intent = inout
-[sw_optical_props_clouds]
-  standard_name = shortwave_optical_properties_for_cloudy_atmosphere
-  long_name = Fortran DDT containing RRTMGP optical properties
-  units = DDT
-  dimensions = ()
-  type = ty_optical_props_2str
-  intent = in
-[sw_optical_props_precipByBand]
-  standard_name = shortwave_optical_properties_for_precipitation_by_band
-  long_name = Fortran DDT containing RRTMGP optical properties
-  units = DDT
-  dimensions = ()
-  type = ty_optical_props_2str
-  intent = in
-[sw_optical_props_cnvcloudsByBand]
-  standard_name = shortwave_optical_properties_for_convective_cloudy_atmosphere_by_band
-  long_name = Fortran DDT containing RRTMGP optical properties
-  units = DDT
-  dimensions = ()
-  type = ty_optical_props_2str
-  intent = in
-[sw_optical_props_MYNNcloudsByBand]
-  standard_name = shortwave_optical_properties_for_MYNN_EDMF_PBL_cloudy_atmosphere_by_band
-  long_name = Fortran DDT containing RRTMGP optical properties
-  units = DDT
-  dimensions = ()
-  type = ty_optical_props_2str
-  intent = in
-[sw_optical_props_aerosol]
-  standard_name = shortwave_optical_properties_for_aerosols
-  long_name = Fortran DDT containing RRTMGP optical properties
-  units = DDT
-  dimensions = ()
-  type = ty_optical_props_2str
-  intent = in
-[sfc_alb_nir_dir]
-  standard_name = surface_albedo_due_to_near_IR_direct
-  long_name = surface albedo due to near IR direct beam
-  units = frac
-  dimensions = (horizontal_loop_extent)
-  type = real
-  kind = kind_phys
-  intent = in
-[sfc_alb_nir_dif]
-  standard_name = surface_albedo_due_to_near_IR_diffused
-  long_name = surface albedo due to near IR diffused beam
-  units = frac
-  dimensions = (horizontal_loop_extent)
-  type = real
-  kind = kind_phys
-  intent = in
-[sfc_alb_uvvis_dir]
-  standard_name = surface_albedo_due_to_UV_and_VIS_direct
-  long_name = surface albedo due to UV+VIS direct beam
-  units = frac
-  dimensions = (horizontal_loop_extent)
-  type = real
-  kind = kind_phys
-  intent = in
-[sfc_alb_uvvis_dif]
-  standard_name = surface_albedo_due_to_UV_and_VIS_diffused
-  long_name = surface albedo due to UV+VIS diffused beam
-  units = frac
-  dimensions = (horizontal_loop_extent)
-  type = real
-  kind = kind_phys
-  intent = in
-[toa_src_sw]
-  standard_name = toa_incident_sw_flux_by_spectral_point
-  long_name = TOA shortwave incident flux at each spectral points
-  units = W m-2
-  dimensions = (horizontal_loop_extent,number_of_shortwave_spectral_points)
-  type = real
-  kind = kind_phys
-  intent = in
-[scmpsw]
-  standard_name = components_of_surface_downward_shortwave_fluxes
-  long_name = derived type for special components of surface downward shortwave fluxes
-  units = W m-2
-  dimensions = (horizontal_loop_extent)
-  type = cmpfsw_type
-  intent = inout
-[fluxswUP_allsky]
-  standard_name = RRTMGP_sw_flux_profile_upward_allsky
-  long_name = RRTMGP upward shortwave all-sky flux profile
-  units = W m-2
-  dimensions = (horizontal_loop_extent,vertical_interface_dimension)
-  type = real
-  kind = kind_phys
-  intent = inout
-[fluxswDOWN_allsky]
-  standard_name = RRTMGP_sw_flux_profile_downward_allsky
-  long_name = RRTMGP downward shortwave all-sky flux profile
-  units = W m-2
-  dimensions = (horizontal_loop_extent,vertical_interface_dimension)
-  type = real
-  kind = kind_phys
-  intent = inout
-[fluxswUP_clrsky]
-  standard_name = RRTMGP_sw_flux_profile_upward_clrsky
-  long_name = RRTMGP upward shortwave clr-sky flux profile
-  units = W m-2
-  dimensions = (horizontal_loop_extent,vertical_interface_dimension)
-  type = real
-  kind = kind_phys
-  intent = inout
-[fluxswDOWN_clrsky]
-  standard_name = RRTMGP_sw_flux_profile_downward_clrsky
-  long_name = RRTMGP downward shortwave clr-sky flux profile
-  units = W m-2
-  dimensions = (horizontal_loop_extent,vertical_interface_dimension)
-  type = real
-  kind = kind_phys
-  intent = inout
-[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
diff --git a/physics/rte-rrtmgp b/physics/rte-rrtmgp
index 7f01618c9..0dc54f5ec 160000
--- a/physics/rte-rrtmgp
+++ b/physics/rte-rrtmgp
@@ -1 +1 @@
-Subproject commit 7f01618c92409658bddd3afa9acb004c608f6a0d
+Subproject commit 0dc54f5ecaeb1e1e342efd1e02d0bcd41737bde2

From 6760693df8390074a8d6c64c2a0ae330e7bb0dbf Mon Sep 17 00:00:00 2001
From: Grant Firl <grant.firl@noaa.gov>
Date: Mon, 30 Jan 2023 09:24:50 -0500
Subject: [PATCH 031/115] Merge pull request #35 from
 ChunxiZhang-NOAA/bugfix/cloud_rad

Bug fix for cloud effective radius for convective clouds (HR1)
---
 physics/radiation_clouds.f | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/physics/radiation_clouds.f b/physics/radiation_clouds.f
index 81a845fd2..ca9ea6e81 100644
--- a/physics/radiation_clouds.f
+++ b/physics/radiation_clouds.f
@@ -2127,10 +2127,16 @@ subroutine progcld_thompson_wsm6                                  &
 !>   The total condensate includes convective condensate.
         do k = 1, NLAY-1
           do i = 1, IX
-            cwp(i,k) = max(0.0, (clw(i,k,ntcw)+cnvw(i,k)*
-     &                  (1.-tem2d(i,k))) * gfac * delp(i,k))
-            cip(i,k) = max(0.0, (clw(i,k,ntiw) + cnvw(i,k)*
-     &                  tem2d(i,k)) *gfac * delp(i,k))
+            tem1 = cnvw(i,k)*(1.-tem2d(i,k))
+            cwp(i,k) = max(0.0, (clw(i,k,ntcw)+tem1) *
+     &                 gfac * delp(i,k))
+            if(tem1 > 1.e-12 .and.  clw(i,k,ntcw) < 1.e-12)
+     &                 rew(i,k)=reliq_def
+            tem2 = cnvw(i,k)*tem2d(i,k)
+            cip(i,k) = max(0.0, (clw(i,k,ntiw) + tem2 )
+     &             *gfac * delp(i,k))
+            if(tem2 > 1.e-12 .and.  clw(i,k,ntiw) < 1.e-12)
+     &             rei(i,k)=reice_def
             crp(i,k) = max(0.0, clw(i,k,ntrw) * gfac * delp(i,k))
             csp(i,k) = max(0.0, clw(i,k,ntsw) * gfac * delp(i,k))
           enddo

From e1679258e2ab5bd9b0c2761fa6de6d3a88c3443d Mon Sep 17 00:00:00 2001
From: Grant Firl <grant.firl@noaa.gov>
Date: Wed, 22 Feb 2023 10:01:32 -0500
Subject: [PATCH 032/115] Merge pull request #40 from
 mdtoyNOAA/ufs/dev_drag_suite_intent_mods

Changed UGWP diagnostic variable declaration intents from 'out' to 'inout'
---
 physics/drag_suite.F90  |  4 ++--
 physics/drag_suite.meta | 32 ++++++++++++++++----------------
 2 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/physics/drag_suite.F90 b/physics/drag_suite.F90
index 4c65a91ce..5cb49acff 100644
--- a/physics/drag_suite.F90
+++ b/physics/drag_suite.F90
@@ -383,12 +383,12 @@ subroutine drag_suite_run(                                           &
    real(kind=kind_phys), intent(inout) ::                        &
      &                      dusfc(:),   dvsfc(:)
 !Output (optional):
-   real(kind=kind_phys), intent(out) ::                          &
+   real(kind=kind_phys), intent(inout) ::                        &
      &                      dusfc_ms(:),dvsfc_ms(:),             &
      &                      dusfc_bl(:),dvsfc_bl(:),             &
      &                      dusfc_ss(:),dvsfc_ss(:),             &
      &                      dusfc_fd(:),dvsfc_fd(:)
-   real(kind=kind_phys), intent(out) ::                          &
+   real(kind=kind_phys), intent(inout) ::                        &
      &         dtaux2d_ms(:,:),dtauy2d_ms(:,:),                  &
      &         dtaux2d_bl(:,:),dtauy2d_bl(:,:),                  &
      &         dtaux2d_ss(:,:),dtauy2d_ss(:,:),                  &
diff --git a/physics/drag_suite.meta b/physics/drag_suite.meta
index 8f33fcc60..ff60290ae 100644
--- a/physics/drag_suite.meta
+++ b/physics/drag_suite.meta
@@ -277,7 +277,7 @@
   dimensions = (horizontal_loop_extent,vertical_layer_dimension)
   type = real
   kind = kind_phys
-  intent = out
+  intent = inout
 [dtauy2d_ms]
   standard_name = tendency_of_y_wind_due_to_mesoscale_orographic_gravity_wave_drag
   long_name = y wind tendency from mesoscale gwd
@@ -285,7 +285,7 @@
   dimensions = (horizontal_loop_extent,vertical_layer_dimension)
   type = real
   kind = kind_phys
-  intent = out
+  intent = inout
 [dtaux2d_bl]
   standard_name = tendency_of_x_wind_due_to_blocking_drag
   long_name = x wind tendency from blocking drag
@@ -293,7 +293,7 @@
   dimensions = (horizontal_loop_extent,vertical_layer_dimension)
   type = real
   kind = kind_phys
-  intent = out
+  intent = inout
 [dtauy2d_bl]
   standard_name = tendency_of_y_wind_due_to_blocking_drag
   long_name = y wind tendency from blocking drag
@@ -301,7 +301,7 @@
   dimensions = (horizontal_loop_extent,vertical_layer_dimension)
   type = real
   kind = kind_phys
-  intent = out
+  intent = inout
 [dtaux2d_ss]
   standard_name = tendency_of_x_wind_due_to_small_scale_gravity_wave_drag
   long_name = x wind tendency from small scale gwd
@@ -309,7 +309,7 @@
   dimensions = (horizontal_loop_extent,vertical_layer_dimension)
   type = real
   kind = kind_phys
-  intent = out
+  intent = inout
 [dtauy2d_ss]
   standard_name = tendency_of_y_wind_due_to_small_scale_gravity_wave_drag
   long_name = y wind tendency from small scale gwd
@@ -317,7 +317,7 @@
   dimensions = (horizontal_loop_extent,vertical_layer_dimension)
   type = real
   kind = kind_phys
-  intent = out
+  intent = inout
 [dtaux2d_fd]
   standard_name = tendency_of_x_wind_due_to_form_drag
   long_name = x wind tendency from form drag
@@ -325,7 +325,7 @@
   dimensions = (horizontal_loop_extent,vertical_layer_dimension)
   type = real
   kind = kind_phys
-  intent = out
+  intent = inout
 [dtauy2d_fd]
   standard_name = tendency_of_y_wind_due_to_form_drag
   long_name = y wind tendency from form drag
@@ -333,7 +333,7 @@
   dimensions = (horizontal_loop_extent,vertical_layer_dimension)
   type = real
   kind = kind_phys
-  intent = out
+  intent = inout
 [dusfc]
   standard_name = instantaneous_x_stress_due_to_gravity_wave_drag
   long_name = zonal surface stress due to orographic gravity wave drag
@@ -357,7 +357,7 @@
   dimensions = (horizontal_loop_extent)
   type = real
   kind = kind_phys
-  intent = out
+  intent = inout
 [dvsfc_ms]
   standard_name = vertically_integrated_y_momentum_flux_due_to_mesoscale_orographic_gravity_wave_drag
   long_name = integrated y momentum flux from mesoscale gwd
@@ -365,7 +365,7 @@
   dimensions = (horizontal_loop_extent)
   type = real
   kind = kind_phys
-  intent = out
+  intent = inout
 [dusfc_bl]
   standard_name = vertically_integrated_x_momentum_flux_due_to_blocking_drag
   long_name = integrated x momentum flux from blocking drag
@@ -373,7 +373,7 @@
   dimensions = (horizontal_loop_extent)
   type = real
   kind = kind_phys
-  intent = out
+  intent = inout
 [dvsfc_bl]
   standard_name = vertically_integrated_y_momentum_flux_due_to_blocking_drag
   long_name = integrated y momentum flux from blocking drag
@@ -381,7 +381,7 @@
   dimensions = (horizontal_loop_extent)
   type = real
   kind = kind_phys
-  intent = out
+  intent = inout
 [dusfc_ss]
   standard_name = vertically_integrated_x_momentum_flux_due_to_small_scale_gravity_wave_drag
   long_name = integrated x momentum flux from small scale gwd
@@ -389,7 +389,7 @@
   dimensions = (horizontal_loop_extent)
   type = real
   kind = kind_phys
-  intent = out
+  intent = inout
 [dvsfc_ss]
   standard_name = vertically_integrated_y_momentum_flux_due_to_small_scale_gravity_wave_drag
   long_name = integrated y momentum flux from small scale gwd
@@ -397,7 +397,7 @@
   dimensions = (horizontal_loop_extent)
   type = real
   kind = kind_phys
-  intent = out
+  intent = inout
 [dusfc_fd]
   standard_name = vertically_integrated_x_momentum_flux_due_to_form_drag
   long_name = integrated x momentum flux from form drag
@@ -405,7 +405,7 @@
   dimensions = (horizontal_loop_extent)
   type = real
   kind = kind_phys
-  intent = out
+  intent = inout
 [dvsfc_fd]
   standard_name = vertically_integrated_y_momentum_flux_due_to_form_drag
   long_name = integrated y momentum flux from form drag
@@ -413,7 +413,7 @@
   dimensions = (horizontal_loop_extent)
   type = real
   kind = kind_phys
-  intent = out
+  intent = inout
 [slmsk]
   standard_name = area_type
   long_name = landmask: sea/land/ice=0/1/2

From 2b504ec5cb7e7eafda0049c76a7a605f67353a8b Mon Sep 17 00:00:00 2001
From: dustinswales <dswales@ucar.edu>
Date: Thu, 16 Mar 2023 13:27:37 -0600
Subject: [PATCH 033/115] Fix missed change in merge.

---
 physics/rrtmgp_lw_main.meta | 4 ++--
 physics/rrtmgp_sw_main.meta | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/physics/rrtmgp_lw_main.meta b/physics/rrtmgp_lw_main.meta
index a1a384b25..48db72e37 100644
--- a/physics/rrtmgp_lw_main.meta
+++ b/physics/rrtmgp_lw_main.meta
@@ -149,8 +149,8 @@
   type = logical  
   intent = in
 [top_at_1]
-  standard_name = flag_for_vertical_ordering_in_RRTMGP
-  long_name = flag for vertical ordering in RRTMGP
+  standard_name = flag_for_vertical_ordering_in_radiation
+  long_name = flag for vertical ordering in radiation
   units = flag
   dimensions = ()
   type = logical
diff --git a/physics/rrtmgp_sw_main.meta b/physics/rrtmgp_sw_main.meta
index 4ca6cc716..dbb93a5df 100644
--- a/physics/rrtmgp_sw_main.meta
+++ b/physics/rrtmgp_sw_main.meta
@@ -149,8 +149,8 @@
   type = logical  
   intent = in
 [top_at_1]
-  standard_name = flag_for_vertical_ordering_in_RRTMGP
-  long_name = flag for vertical ordering in RRTMGP
+  standard_name = flag_for_vertical_ordering_in_radiation
+  long_name = flag for vertical ordering in radiation
   units = flag
   dimensions = ()
   type = logical

From 0a71797cac0a52a9b50bd28ab39baae5dfb79772 Mon Sep 17 00:00:00 2001
From: Ted Mansell <ted.mansell@noaa.gov>
Date: Mon, 10 Apr 2023 13:21:54 -0500
Subject: [PATCH 034/115]   Adds support for 3-moment rain/graupel/hail in NSSL
 microphysics scheme   Also other various bug fixes etc.

---
 physics/module_mp_nssl_2mom.F90 | 4774 +++++++++++++++++++++++++++----
 physics/mp_nssl.F90             |   78 +-
 physics/mp_nssl.meta            |   38 +
 3 files changed, 4371 insertions(+), 519 deletions(-)

diff --git a/physics/module_mp_nssl_2mom.F90 b/physics/module_mp_nssl_2mom.F90
index d190e94b4..f2f9707fb 100644
--- a/physics/module_mp_nssl_2mom.F90
+++ b/physics/module_mp_nssl_2mom.F90
@@ -1,7 +1,14 @@
 !>  \file module_mp_nssl_2mom.F90
 
+
+
+
+
+
+
+
 !---------------------------------------------------------------------
-! code snapshot: "Feb 24 2022" at "14:27:57"
+! code snapshot: "Apr 10 2023" at "13:17:29"
 !---------------------------------------------------------------------
 !---------------------------------------------------------------------
 ! IMPORTANT: Best results are attained using the 5th-order WENO (Weighted Essentially Non-Oscillatory) advection option (4) for scalars:
@@ -19,17 +26,14 @@
 ! WENO references: Jiang and Shu, 1996, J. Comp. Phys. v. 126, 202-223; Shu 2003, Int. J. Comp. Fluid Dyn. v. 17 107-118;
 !
 !>\ingroup mod_mp_nssl2m
-!! This module provides a 2-moment bulk microphysics scheme described by 
-!! Mansell, Zeigler, and Bruning (2010, JAS) 
-!!
-!! This module provides a 2-moment bulk microphysics scheme based on a combination of 
-!! Straka and Mansell (2005, JAM) and Zeigler (1985, JAS) and modified/upgraded in 
-!! in Mansell, Zeigler, and Bruning (2010, JAS).  Two-moment adaptive sedimentation 
+!! This module provides a 1/2/3-moment bulk microphysics scheme based on a combination of
+!! Straka and Mansell (2005, JAM) and Zeigler (1985, JAS) and modified/upgraded in
+!! in Mansell, Zeigler, and Bruning (2010, JAS).  Two-moment adaptive sedimentation
 !! follows Mansell (2010, JAS), using parameter infall = 4.
 !!
 !! Added info on graupel density and soaking is in Mansell and Ziegler (2013, JAS)
 !!
-!! Average graupel particle density is predicted, which affects fall speed as well. 
+!! Average graupel particle density is predicted, which affects fall speed as well.
 !! Hail density prediction is by default disabled in this version, but may be enabled
 !! at some point if there is interest.
 !!
@@ -37,19 +41,19 @@
 !!
 !! Microphysics References:
 !!
-!! Mansell, E. R., C. L. Ziegler, and E. C. Bruning, 2010: Simulated electrification of a small 
+!! Mansell, E. R., C. L. Ziegler, and E. C. Bruning, 2010: Simulated electrification of a small
 !!   thunderstorm with two-moment bulk microphysics. J. Atmos. Sci., 67, 171-194, doi:10. 1175/2009JAS2965.1.
 !!
-!!  Mansell, E. R. and C. L. Ziegler, 2013: Aerosol effects on simulated storm electrification and 
-!!     precipitation in a two-moment bulk microphysics model. J. Atmos. Sci., 70 (7), 2032-2050, 
+!!  Mansell, E. R. and C. L. Ziegler, 2013: Aerosol effects on simulated storm electrification and
+!!     precipitation in a two-moment bulk microphysics model. J. Atmos. Sci., 70 (7), 2032-2050,
 !!     doi:10.1175/JAS-D-12-0264.1.
 !!
-!! Ziegler, C. L., 1985: Retrieval of thermal and microphysical variables in observed convective storms. 
+!! Ziegler, C. L., 1985: Retrieval of thermal and microphysical variables in observed convective storms.
 !!    Part I: Model development and preliminary testing. J. Atmos. Sci., 42, 1487-1509.
 !!
 !! Sedimentation reference:
 !!
-!! Mansell, E. R., 2010: On sedimentation and advection in multimoment bulk microphysics. 
+!! Mansell, E. R., 2010: On sedimentation and advection in multimoment bulk microphysics.
 !!    J. Atmos. Sci., 67, 3084-3094, doi:10.1175/2010JAS3341.1.
 !
 ! Possible parameters to adjust:
@@ -63,9 +67,9 @@
 !    Fierro, A. O., E.R. Mansell, C. Ziegler and D. R. MacGorman 2013: The
 !    implementation of an explicit charging and discharge lightning scheme
 !    within the WRF-ARW model: Benchmark simulations of a continental squall line, a
-!    tropical cyclone and a winter storm. Monthly Weather Review, Volume 141, 2390-2415 
+!    tropical cyclone and a winter storm. Monthly Weather Review, Volume 141, 2390-2415
 !
-!    Mansell et al. 2005: Charge structure and lightning sensitivity in a simulated 
+!    Mansell et al. 2005: Charge structure and lightning sensitivity in a simulated
 !     multicell thunderstorm. J. Geophys. Res., 110, D12101, doi:10.1029/2004JD005287
 !
 ! Note: Some parameters below apply to unreleased features.
@@ -74,7 +78,7 @@
 !---------------------------------------------------------------------
 ! Sept. 2021:
 ! Fixes:
-!   Restored previous formulation of snow reflectivity, as it was realized that the last change incorrectly assumed a fixed 
+!   Restored previous formulation of snow reflectivity, as it was realized that the last change incorrectly assumed a fixed
 !     density independent of size. Generally lower snow reflectivity values as a result (no effect on microphysics)
 ! Other:
 !   Generic fall speed coeffecients (axx,bxx) to accomodate future frozen drops category (no effect)
@@ -234,8 +238,9 @@ MODULE module_mp_nssl_2mom
   real   , private :: qcmincwrn      = 2.0e-3    ! qc threshold for autonconversion (LFO; for 10ICE use qminrncw for ircnw != 5)
   real   , private :: cwdiap         = 20.0e-6   ! threshold diameter of cloud drops (Ferrier 1994 autoconversion)
   real   , private :: cwdisp         = 0.15      ! assume droplet dispersion parameter (can be 0.3 for maritime)
-  real   , private  :: ccn            = 0.6e+09   ! set in namelist!! Central plains CCN value
-  real   , public  :: qccn             ! ccn "mixing ratio"
+  real   , private :: ccn            = 0.6e+09   ! set in namelist!! Central plains CCN value
+  real   , private :: ccnuf          = 0        ! set in namelist!! Central plains CCN value
+  real   , public  :: qccn, qccnuf               ! ccn "mixing ratio"
   real   , private :: old_qccn = -1.0
   integer, private :: iauttim        = 1         ! 10-ice rain delay flag
   real   , private :: auttim         = 300.      ! 10-ice rain delay time
@@ -245,12 +250,17 @@ MODULE module_mp_nssl_2mom
 ! NMM WRF core does not have special boundary conditions for CCN, therefore set invertccn to true
       logical, parameter :: invertccn = .true. ! =true for base state of ccn=0, =false for ccn initialized in the base state
 #else
-      logical, parameter :: invertccn = .false. ! =true for base state of ccn=0, =false for ccn initialized in the base state
+      logical, private :: invertccn = .false. ! =true for base state of ccn=0, =false for ccn initialized in the base state
 #endif
   logical :: switchccn = .false.
   real    :: old_cccn = -1.0
   logical :: restoreccn = .true. ! whether or not to nudge CCN back to base state (qccn) (only applies if CCNA is NOT predicted)
   real    :: ccntimeconst = 3600.  ! time constant for CCN restore (either for CCNA or when restoreccn = true)
+  real, private  :: restoreccnfrac = 1.0  ! fraction of evaporated droplets that restore CCN
+  real    :: ufccntimeconst = 6.*3600.  ! time constant for UFCCN decay (Blossey et al. 2018)
+  real    :: ufbackground = 0.1e9       ! background ccnuf value (Blossey et al.)
+  logical :: decayufccn = .false.
+  integer :: i_uf_or_ccn = 0      ! 0 = ship adds UF; 1 = treat UF as regular ccn (add to qccn)
 
 ! sedimentation flags
 ! itfall -> 0 = 1st order fallout (other options removed)
@@ -259,6 +269,7 @@ MODULE module_mp_nssl_2mom
   integer, private :: itfall = 0
   integer, private :: iscfall = 1
   integer, private :: irfall = -1
+  integer, private :: isfall =  2 ! default limit with method II (more restrictive)
   logical, private :: do_accurate_sedimentation = .true. ! if true, recalculate fall speeds on sub time steps; (more expensive)
                                                          ! if false, reuse fall speeds on multiple steps (can have a noticeable speedup)
                                                          ! Mainly is an issue for small dz near the surface. 
@@ -269,6 +280,7 @@ MODULE module_mp_nssl_2mom
                           ! 3 -> uses number-wgt for N and Z-weighted correction for N (Method I in Mansell, 2010 JAS)
                           ! 4 -> Hybrid of 2 and 3: Uses minimum N from each method (z-wgt and m-wgt corrections) (Method I+II in Mansell, 2010 JAS)
                           ! 5 -> uses number-wgt for N and uses average of N-wgt and q-wgt instead of Max.
+  integer :: imydiagalpha = 0 ! apply MY diagnostic shape parameter for fall speeds (1=for fall speed only; 2=also for microphysics rates)
   real, private    :: rainfallfac = 1.0 ! factor to adjust rain fall speed (single moment only)
   real, private    :: icefallfac = 1.5   ! factor to adjust ice fall speed
   real, private    :: snowfallfac = 1.25 ! factor to adjust snow fall speed
@@ -277,6 +289,9 @@ MODULE module_mp_nssl_2mom
   integer, private :: icefallopt = 3 ! 1= default, 2 = Ferrier ice fall speed; 3 = adjusted Ferrier (slightly high Vt)
   integer, private :: icdx = 3 ! (graupel) 0=Ferrier; 1=leave drag coef. cd fixed; 2=vary by density, 4=set by user with cdxmin,cdxmax,etc.
   integer, private :: icdxhl = 3 ! (hail) 0=Ferrier; 1=leave drag coef. cd fixed; 2=vary by density, 4=set by user with cdxmin,cdxmax,etc.
+  real    :: axh = 75.7149, bxh = 0.5
+  real    :: axf = 75.7149, bxf = 0.5
+  real    :: axhl = 206.984, bxhl = 0.6384
   real   , private :: cdhmin = 0.45, cdhmax = 0.8        ! defaults for graupel (icdx=4)
   real   , private :: cdhdnmin = 500., cdhdnmax = 800.0  ! defaults for graupel (icdx=4)
   real   , private :: cdhlmin = 0.45, cdhlmax = 0.6      ! defaults for hail (icdx=4)
@@ -310,7 +325,7 @@ MODULE module_mp_nssl_2mom
   integer, private :: irimtim = 0 ! future use
 !  integer, private :: infdo = 1   ! 1 = calculate number-weighted fall speeds
 
-  integer, private :: irimdenopt = 1 ! = 1 for default Macklin; = 2 for experimental Cober and List (1993)
+  integer, private :: irimdenopt = 1 ! = 1 for default Heymsfield and Pflaum (1985); = 2 for experimental Cober and List (1993); = 3 Macklin
   real   , private :: rimc1 = 300.0, rimc2 = 0.44  ! rime density coeff. and power (Default Heymsfield and Pflaum, 1985)
   real   , private :: rimc3 = 170.0                ! minimum rime density
   real    :: rimc4 = 900.0                ! maximum rime density
@@ -347,6 +362,7 @@ MODULE module_mp_nssl_2mom
 
 ! 0,2, 5.00e-10, 1, 0, 0, 0      : itype1,itype2,cimas0,icfn,ihrn,ibfc,iacr
   integer, private :: itype1 = 0, itype2 = 2  ! controls Hallett-Mossop process
+  integer, private :: in_freeze_rain_first = 0 ! =1 use IN to freezed rain drops (if none, then freeze droplets)
   integer, private :: icenucopt = 1       ! =1 Meyers/Ferrier primary ice nucleation; =2 Thompson/Cooper, =3 Phillips (Meyers/Demott), =4 DeMott (2010)
   real, private :: naer = 1.0e6  ! background large aerosol conc. for DeMott
   integer, private :: icfn = 2                ! contact freezing: 0 = off; 1 = hack (ok for single moment); 2 = full Cotton/Meyers version
@@ -357,7 +373,9 @@ MODULE module_mp_nssl_2mom
   integer, private :: iremoveqwfrz = 1    ! Whether to remove (=1) or not (=0) the newly-frozen cloud droplets (ibfc=1) from the CWC used for charge separation
   integer, private :: iacr = 2            ! Flag for drop contact freezing with crytals
                                  ! (0=off; 1=drops > 500micron diameter; 2 = > 300micron)
+  integer, private :: icrcev = 1          ! 1 = old crcev; 2 = crcev scaled by vtrain ratio (num/mass); 3 = set to zero
   integer, private :: icracr = 1          ! Flag to turn rain self-collection on/off (=0 to turn off)
+  integer, private :: icracrthresh = 1    ! For rain self-coll. thresh. use: 1 = mean diam of 2mm; 2 = rain median volume diam of 1.9mm
   integer, private :: ibfr = 2            ! Flag for Bigg freezing conversion of freezing drops to graupel
                                  ! (1=min graupel size is vr1mm; 2=use min size of dfrz, 5= as for 2 and apply dbz conservation)
   integer, private :: ibiggopt = 2        ! 1 = old Bigg; 2 = experimental Bigg (only for imurain = 1, however)
@@ -413,11 +431,14 @@ MODULE module_mp_nssl_2mom
                                      ! set eii1 = 0 to get a constant value of eii0
   real   , private :: eii0hl = 0.2 ,eii1hl = 0.0  ! hail-crystal coll. eff. parameters: eii0hl*exp(eii1hl*min(temcg(mgs),0.0))
                                      ! set eii1hl = 0 to get a constant value of eii0hl
+  real, private :: ewi_dcmin = 15.0e-06 ! minimum droplet diameter for nonzero ewi
+  real, private :: ewi_dimin = 30.0e-06 ! minimum ice crystal diameter for nonzero ewi
   real   , private :: eri0 = 0.1   ! rain efficiency to collect ice crystals
   real   , private :: eri_cimin = 10.e-6      ! minimum ice crystal diameter for collection by rain
   real   , private :: esi0 = 0.1              ! linear factor in snow-ice collection efficiency
   real   , private :: ehs0 = 0.1, ehs1 = 0.1  ! graupel-snow coll. eff. parameters: ehs0*exp(ehs1*min(temcg(mgs),0.0))
                                      ! set ehs1 = 0 to get a constant value of ehs0
+  integer :: iessopt = 1  ! 1 = Original (no factor); 2 = factor based on wvel; 3 = factor based on SSI
   real   , private :: ess0 = 0.5, ess1 = 0.05 ! snow aggregation coefficients: ess0*exp(ess1*min(temcg(mgs),0.0))
                                      ! set ess1 = 0 to get a constant value of ess0
   real   , private :: esstem1 = -15.  ! lower temperature where snow aggregation turns on
@@ -452,11 +473,13 @@ MODULE module_mp_nssl_2mom
                                    ! 0 = no condensation on rain; 1 = bulk condensation on rain
   integer, parameter, private :: icond = 1    ! (Z only) icond = 1 calculates ice deposition (crystals and snow) BEFORE droplet condensation
                           ! icond = 2 does not work (intended to calc. dep in loop with droplet cond.)
+  integer, private :: iqis0 = 2    ! = 1 for normal qis; = 2 to set qis to use T = 0C when T > 0C  
   
   real   , private :: dfrz = 0.15e-3 ! 0.25e-3  ! minimum diameter of frozen drops from Bigg freezing (used for vfrz) for iacr > 1
                             ! and for ciacrf for iacr=4
   real   , private :: dmlt = 3.0e-3  ! maximum diameter for rain melting from graupel and hail
   real   , private :: dshd = 1.0e-3  ! nominal diameter for rain drops shed from graupel/hail
+  integer, private :: ivshdgs   = 1  ! 0 = use 1mm for all shedding (non-mixedphase); 1 = use vshdgs with sheddiam
   integer, private :: ished2cld = 0  ! 1: Send shed liquid (from wet growth) to cloud droplets
 
   integer, private :: ihmlt = 2      ! 1=old melting with vmlt; 2=new melting using mean volume diam of graupel/hail
@@ -480,6 +503,7 @@ MODULE module_mp_nssl_2mom
   real, private  :: qhdpvdn = -1.
   real, private  :: qhacidn = -1.
 
+  integer, private :: iraintypes = 0
   logical, private :: mixedphase = .false.   ! .false.=off, true=on to include mixed phase graupel
   integer, private :: imixedphase = 0
   logical, private :: qsdenmod = .false.     ! true = modify snow density by linear interpolation of snow and rain density
@@ -514,14 +538,19 @@ MODULE module_mp_nssl_2mom
   integer, private ::  ihlcnh = 1  ! which graupel -> hail conversion to use
                           ! 1 = Milbrandt and Yau (2005) using Ziegler 1985 wet growth diameter
                           ! 2 = Straka and Mansell (2005) conversion using size threshold
+                          ! 3 = Conversion using wet growth diameter
   real, private :: hlcnhdia = 1.e-3 ! threshold diameter for graupel -> hail conversion for ihlcnh = 1 option.
   real, private :: hlcnhqmin = 0.1e-3 ! minimum graupel mass content for graupel -> hail conversion (ihlcnh = 1)
   real   , private :: hldia1 = 20.0e-3  ! threshold diameter for graupel -> hail conversion for ihlcnh = 2 option.
+  integer :: incwet = 0    ! flag to do wet growth only on D > D_wet
   integer, private  :: iusedw = 0    ! flag to use experimental wet growth ice diameter for gr -> hl conversion (=1 turns on)
-  real   , private  :: dwmin  = 0.0  ! Minimum diameter with iusedw (can stay at 0 or be set to something larger)
+  real   , private  :: dwmin   = 5.0e-3  ! Minimum diameter with iusedw (can stay at 0 or be set to something larger)
+  real   , private  :: dwetmin = 5.0e-3  ! Minimum diameter with iusedw (can stay at 0 or be set to something larger)
   real   , private  :: dwtempmin = 242. ! lowest temperature to allow wet growth conversion to hail
   real   , private  :: dwehwmin = 0.   ! Minimum ehw to use to find wet growth diameter (if > ehw0, then wet growth diam becomes smaller)
   real   , private  :: dg0thresh = 0.15 ! graupel wet growth diameter above which we say do not bother
+  integer :: ifddenfac = 0  ! = 1 to use density threshold to count FD as GR when converting to HL
+  real    :: fddenthresh = 500. ! if ifddenfac > 0, then hail from FD with lower density are considered to come from graupel
   integer :: icvhl2h = 0   ! allow conversion of hail back to graupel when hail density gets close to minimum allowed
 
   integer, private :: imurain = 1 ! 3 for gamma-volume, 1 for gamma-diameter DSD for rain.
@@ -538,6 +567,8 @@ MODULE module_mp_nssl_2mom
                                ! = 1 use mean diameter for breakup
                                ! = 2 use maximum mass diameter for breakup
                                ! = 3 use mass-weighted diameter for breakup
+  integer :: iraintailbreak = 0 ! 1 = on
+  real    :: draintail      = 8.e-3 ! starting size for rain breakup
   integer, private :: dmrauto       = 0 
                               ! = -1 no limiter on crcnw
                               ! =  0 limit crcnw when qr > 1.2*L (Cohard-Pinty 2002)
@@ -595,9 +626,12 @@ MODULE module_mp_nssl_2mom
   integer, private :: ibinnum   = 2  ! number of bins for melting of smaller ice (for ibinhmlr = 1)
   integer, private :: iqhacrmlr = 1  ! turn on/off qhacrmlr
   integer, private :: iqhlacrmlr = 1  ! turn on/off qhlacrmlr
+  integer, private :: iqhacwshr = 1  ! turn on/off qhacw for T > 0
+  integer, private :: iqhlacwshr = 1  ! turn on/off qhlacw for T > 0
   real, private :: binmlrmxdia = 40.e-3 ! threshold diameter (graupel/hail) to switch bin-bulk melting to use standard chmlr
   real, private :: binmlrzrrfac = 1.0 ! factor for reflectivity change ice that sheds while melting
   real, private :: snowmeltdia = 0 ! If nonzero, sets the size of rain drops from melting snow.
+  real, private :: alphasmlr0 = 14.0 ! shape parameter for drops formed from melting/shedding snow
   real, private :: delta_alphamlr = 0.5 ! offset from alphamax at which melting does not further collapse the shape parameter
   
   integer :: iqvsopt = 0 ! =0 use old default for tabqvs; =1 use Bolton formulation (Rogers and Yau)
@@ -739,6 +773,7 @@ MODULE module_mp_nssl_2mom
       real da1 (lc:lqmx)          ! collection coefficients from Seifert 2005
       real bb  (lc:lqmx)
 
+
 ! put ipelec here for now....
   integer :: ipelec = 0
   integer :: isaund = 0
@@ -764,7 +799,7 @@ MODULE module_mp_nssl_2mom
       double precision, parameter :: dgam = 0.01, dgami = 100.
       double precision gmoi(0:ngm0) ! ,gmod(0:ngm1,0:ngm2),gmdi(0:ngm1,0:ngm2)
 
-      integer, parameter :: nqiacralpha =  240 !480 ! 240 ! 120 ! 15
+      integer, parameter :: nqiacralpha =  300 !480 ! 240 ! 120 ! 15
       integer, parameter :: nqiacrratio =  100 ! 500 !50  ! 25
 !      real,    parameter :: maxratiolu = 25.
       real,    parameter :: maxratiolu = 100. ! 25.
@@ -782,6 +817,10 @@ MODULE module_mp_nssl_2mom
 !      real :: ziacrratio(0:nqiacrratio,0:nqiacralpha)
 !      double precision :: gamxinflu(0:nqiacrratio,0:nqiacralpha,12,2) ! last index for graupel (1) or hail (2)
 
+! for 3-moment collection coefficients
+      real, save :: dab0lu(ialpstart:nqiacralpha,ialpstart:nqiacralpha,lc:lqmx,lc:lqmx)  ! collection coefficients from Seifert 2005
+      real, save :: dab1lu(ialpstart:nqiacralpha,ialpstart:nqiacralpha,lc:lqmx,lc:lqmx)  ! collection coefficients from Seifert 2005
+
     integer, parameter :: ngdnmm = 9
     real :: mmgraupvt(ngdnmm,3)  ! Milbrandt and Morrison (2013) fall speed coefficients for graupel/hail
 
@@ -914,6 +953,7 @@ MODULE module_mp_nssl_2mom
       real :: tfrcbw
       real :: tfrcbi
       real :: rovcp
+      real, public :: rdorv = 0.622
 
       real, parameter :: poo = 1.0e+05
       real, parameter :: advisc0 = 1.832e-05     ! reference dynamic viscosity (SMT; see Beard & Pruppacher 71)
@@ -955,7 +995,7 @@ MODULE module_mp_nssl_2mom
 
 ! Note to users: Many of these options are for development and not guaranteed to perform well.
 ! Some may not be functional depending on the version of the code.
-! Some may be useful for ensemble physics diversity. Feel free to contact me if you have questions
+! Some may be useful for ensemble physics diversity. Feel free to contact Ted Mansell if you have questions
 ! in that regard.
   NAMELIST /nssl_mp_params/               &
                         ndebug, ncdebug,&
@@ -965,7 +1005,7 @@ MODULE module_mp_nssl_2mom
                         idbzci,         &
                         vtmaxsed,       &
                         itfall,iscfall, &
-                        infall,         &
+                        infall,irfall,isfall,  &
                         rssflg,         &
                         sssflg,         &
                         hssflg,         &
@@ -976,13 +1016,15 @@ MODULE module_mp_nssl_2mom
                         icnuclimit,     &
                         irenuc,         &
                         restoreccn, ccntimeconst, cck, &
+                        decayufccn, ufccntimeconst, &
                         switchccn, old_cccn,  &
                         ciintmx,        &
                         itype1, itype2, &
-                        icenucopt,      &
+                        icenucopt, in_freeze_rain_first,     &
                         naer,           &
                         icfn,           &
                         ibfc, iacr, icracr, &
+                        icracrthresh,   &
                         cwfrz2snowfrac, cwfrz2snowratio, &
                         ibfr,           &
                         ibiggopt,       &
@@ -998,7 +1040,7 @@ MODULE module_mp_nssl_2mom
                         eri_cimin,      &
                         eii0hl, eii1hl, &
                         ehs0, ehs1,     &
-                        ess0, ess1,     &
+                        ess0, ess1, iessopt,    &
                         esstem1,esstem2, &
                         ircnw, qminrncw,& ! single-moment only
                         iglcnvi,        &
@@ -1024,6 +1066,7 @@ MODULE module_mp_nssl_2mom
                         hailfallfac,    &
                         icefallopt,     &
                         icdx,icdxhl,    &
+                        axh,bxh,axf,bxf,axhl,bxhl, &
                         cdhmin, cdhmax,       &
                         cdhdnmin, cdhdnmax,   &
                         cdhlmin, cdhlmax,     &
@@ -1133,12 +1176,12 @@ SUBROUTINE nssl_2mom_init_const(  &
          real, intent(in) :: con_g, con_rd, con_cp, con_rv, &
                              con_t0c, con_cliq, con_csol, con_eps
        
-       cp608 = con_eps ! 0.608          ! constant used in conversion of T to Tv
        gr = con_g
        tfr = con_t0c
        cp = con_cp
        rd = con_rd
        rw = con_rv
+       rdorv = con_eps
        cpl = con_cliq ! 4190.0
        cpigb = con_csol ! 2106.0
        cpi = 1./cp
@@ -1157,6 +1200,7 @@ END SUBROUTINE nssl_2mom_init_const
 !! NSSL MP setup routine (sets local options and array indices)
        SUBROUTINE nssl_2mom_init(  &
      & ims,ime, jms,jme, kms,kme, nssl_params, ipctmp, mixphase,ihvol,idoniconlytmp, &
+     & igvol, &
      & nssl_graupelfallfac, &
      & nssl_hailfallfac, &
      & nssl_ehw0, &
@@ -1165,7 +1209,13 @@ SUBROUTINE nssl_2mom_init(  &
      & nssl_icdxhl, &
      & nssl_icefallfac, &
      & nssl_snowfallfac, &
+     & nssl_cccn,   &
+     & nssl_ufccn,  &
+     & nssl_alphah, &
+     & nssl_alphahl, &
+     & nssl_alphar, &
      & errmsg, errflg, &
+     & infileunit, &
      & myrank, mpiroot &
      )
 
@@ -1177,22 +1227,30 @@ SUBROUTINE nssl_2mom_init(  &
      & nssl_ehw0, &
      & nssl_ehlw0, &
      & nssl_icefallfac, &
-     & nssl_snowfallfac 
+     & nssl_snowfallfac, &
+     & nssl_cccn,   &
+     & nssl_alphah, &
+     & nssl_alphahl, &
+     & nssl_alphar
    integer, intent(in), optional ::  &
-     & nssl_icdx, &
-     & nssl_icdxhl, myrank, mpiroot
+     & nssl_icdx, igvol, &
+     & nssl_icdxhl, myrank, mpiroot, &
+     & nssl_ufccn
+
+  integer, intent(in),optional      :: infileunit
 
    ! CCPP error handling
    character(len=*), intent(  out) :: errmsg
    integer,          intent(  out) :: errflg
-   integer, intent(in) :: ims,ime, jms,jme, kms,kme
-   real,  intent(in), dimension(20) :: nssl_params
+   integer, intent(in), optional :: ims,ime, jms,jme, kms,kme
+   real,  intent(in), dimension(20), optional :: nssl_params
 
 
 
    integer, intent(in) :: ipctmp,mixphase,ihvol
    logical, optional, intent(in) :: idoniconlytmp
 
+    integer :: igvol_local = 1
     logical :: wrote_namelist = .false.
     logical :: wrf_dm_on_monitor
 
@@ -1202,22 +1260,31 @@ SUBROUTINE nssl_2mom_init(  &
      integer :: i,il,j,l
      integer :: ltmp
      integer :: isub
-     real    :: bxh,bxhl
+     real    :: bxh1,bxhl1
 
       real    :: alp,ratio
       double precision  :: x,y,y2,y7
       logical :: turn_on_ccna, turn_on_cina
+      integer :: iufccn = 0
       integer :: istat
+
+      real :: alpjj, alpii, xnuii, xnujj
+      integer :: ii, jj
      
 
      errmsg = ''
      errflg = 0
      turn_on_ccna = .false.
      turn_on_cina = .false.
+
+      IF ( present( igvol ) ) THEN
+        igvol_local = igvol
+      ENDIF
 !
 ! set some global values from namelist input
 !
 
+      IF ( present( nssl_params ) ) THEN
       ccn      = Abs( nssl_params(1) )
       alphah   = nssl_params(2)
       alphahl  = nssl_params(3)
@@ -1228,8 +1295,16 @@ SUBROUTINE nssl_2mom_init(  &
       rho_qh   = nssl_params(8)
       rho_qhl  = nssl_params(9)
       rho_qs   = nssl_params(10)
-      alphar   = nssl_params(14)
-      
+      IF ( Nint(nssl_params(13)) == 1 ) THEN
+      ! hack to switch CCN field to CCNA (activated ccn)
+!       invertccn = .true.
+        turn_on_ccna = .true.
+        irenuc = 7
+      ENDIF
+      ccnuf     = Abs( nssl_params(14) )
+      IF ( present(nssl_ufccn) ) iufccn = nssl_ufccn
+
+      ENDIF
 !      ipelec   = Nint(nssl_params(11))
 !      isaund   = Nint(nssl_params(12))
       IF ( present(nssl_graupelfallfac) ) graupelfallfac = nssl_graupelfallfac
@@ -1240,14 +1315,12 @@ SUBROUTINE nssl_2mom_init(  &
       IF ( present(nssl_icdxhl) ) icdxhl = nssl_icdxhl
       IF ( present(nssl_icefallfac) ) icefallfac = nssl_icefallfac
       IF ( present(nssl_snowfallfac) ) snowfallfac = nssl_snowfallfac
+      IF ( present(nssl_cccn) )    ccn = nssl_cccn
+      IF ( present(nssl_alphah) )  alphah = nssl_alphah
+      IF ( present(nssl_alphahl) ) alphahl = nssl_alphahl
+      IF ( present(nssl_alphar) )  alphar = nssl_alphar
 
 
-      IF ( Nint(nssl_params(13)) == 1 ) THEN
-      ! hack to switch CCN field to CCNA (activated ccn)
-!       invertccn = .true.
-        turn_on_ccna = .true.
-        irenuc = 7
-      ENDIF
 
       
 
@@ -1275,6 +1348,15 @@ SUBROUTINE nssl_2mom_init(  &
 
 
 
+      IF ( iufccn > 0 ) THEN ! make sure to use option that uses UF ccn
+        irenuc = 7
+        IF ( ccnuf <= 0.0 ) decayufccn = .true. ! assume surface emission and need decay
+        IF ( i_uf_or_ccn > 0 ) THEN
+          ufbackground = 0.0
+          ccntimeconst = ufccntimeconst
+        ENDIF
+      ENDIF
+
       IF ( irenuc >= 5 ) THEN
         turn_on_ccna = .true.
       ENDIF
@@ -1300,7 +1382,7 @@ SUBROUTINE nssl_2mom_init(  &
         ! dfrz = Max( dfrz, 0.5e-3 )
         ENDIF
         IF ( ihvol == -2 .or. ihvol == 2 ) THEN ! ice crystals are turned off
-         ! a value of -3 means to turn off ice crystals but turn on hail
+         ! a value of 2? means to turn off ice crystals but turn on hail
           renucfrac = 1.0
           ffrzs = 1.0
           ! idoci = 0 ! try this later
@@ -1335,29 +1417,42 @@ SUBROUTINE nssl_2mom_init(  &
       bx(lr) = 0.85
       ax(lr) = 1647.81
       fx(lr) = 135.477
+
       
       IF ( icdx == 6 ) THEN
         bx(lh) = 0.6 ! Milbrandt and Morrison (2013) for density of 550.
         ax(lh) = 157.71
-      ELSEIF ( icdx > 0 ) THEN
+!      ELSEIF ( icdx == 1 ) THEN
+!        bx(lh) = bxh
+!        ax(lh) = axh
+      ELSEIF ( icdx > 1 ) THEN
         bx(lh) = 0.5
         ax(lh) = 75.7149
-      ELSE
-        bx(lh) = 0.37 ! 0.6  ! Ferrier 1994
+      ELSEIF ( icdx == 0 ) THEN
+        bx(lh) = 0.37 ! 0.6  ! Ferrier 1994 graupel
         ax(lh) = 19.3
+      ELSE ! icdx < 0
+!        ax(lh) = 206.984 ! Ferrier 1994 hail/frozen drops
+!        bx(lh) = 0.6384
+        bx(lh) = bxh
+        ax(lh) = axh
       ENDIF
+
 !      bx(lh) = 0.6
 
       IF ( lhl .gt. 1 ) THEN
         IF ( icdxhl == 6 ) THEN
           bx(lhl) = 0.593 ! Milbrandt and Morrison (2013) for density of 750.
           ax(lhl) = 179.36
+        ELSEIF (icdxhl == 0 ) THEN
+          ax(lhl) = 206.984 ! Ferrier 1994
+          bx(lhl) = 0.6384
         ELSEIF (icdxhl > 0 ) THEN
-          bx(lhl) = 0.5
-          ax(lhl) = 75.7149
+         bx(lhl) = 0.5
+         ax(lhl) = 75.7149
         ELSE
-          ax(lhl) = 206.984  ! Ferrier 1994
-          bx(lhl) = 0.6384
+         bx(lhl) = bxhl
+         ax(lhl) = axhl
         ENDIF
       ENDIF
 
@@ -1373,8 +1468,8 @@ SUBROUTINE nssl_2mom_init(  &
      ! Uses incomplete gamma functions
      ! The terms with bxh or bxhl will be off if the actual bxh or bxhl is different from the base value (icdx=6 option)
       
-      bxh = bx(lh)
-      bxhl = bx(Max(lh,lhl))
+      bxh1 = bx(lh)
+      bxhl1 = bx(Max(lh,lhl))
       
 !      DO j = 0,nqiacralpha
       DO j = ialpstart,nqiacralpha
@@ -1390,9 +1485,9 @@ SUBROUTINE nssl_2mom_init(  &
         ! graupel (.,.,.,1)
         gamxinflu(i,j,1,1) = x/y
         gamxinflu(i,j,2,1) = gamxinfdp( 2.0+alp, ratio )/y
-        gamxinflu(i,j,3,1) = gamxinfdp( 2.5+alp+0.5*bxh, ratio )/y
+        gamxinflu(i,j,3,1) = gamxinfdp( 2.5+alp+0.5*bxh1, ratio )/y
         gamxinflu(i,j,5,1) = (gamma_dpr(5.0+alp) - gamxinfdp( 5.0+alp, ratio ))/y
-        gamxinflu(i,j,6,1) = (gamma_dpr(5.5+alp+0.5*bxh) - gamxinfdp( 5.5+alp+0.5*bxh, ratio ))/y
+        gamxinflu(i,j,6,1) = (gamma_dpr(5.5+alp+0.5*bxh1) - gamxinfdp( 5.5+alp+0.5*bxh1, ratio ))/y
         gamxinflu(i,j,9,1) = gamxinfdp( 1.0+alp, ratio )/y
         gamxinflu(i,j,10,1)= gamxinfdp( 4.0+alp, ratio )/y
 
@@ -1401,9 +1496,9 @@ SUBROUTINE nssl_2mom_init(  &
         ! hail (.,.,.,2)
         gamxinflu(i,j,1,2) = gamxinflu(i,j,1,1)
         gamxinflu(i,j,2,2) = gamxinflu(i,j,2,1)
-        gamxinflu(i,j,3,2) = gamxinfdp( 2.5+alp+0.5*bxhl, ratio )/y
+        gamxinflu(i,j,3,2) = gamxinfdp( 2.5+alp+0.5*bxhl1, ratio )/y
         gamxinflu(i,j,5,2) = gamxinflu(i,j,5,1)
-        gamxinflu(i,j,6,2) = (gamma_dpr(5.5+alp+0.5*bxhl) - gamxinfdp( 5.5+alp+0.5*bxhl, ratio ))/y
+        gamxinflu(i,j,6,2) = (gamma_dpr(5.5+alp+0.5*bxhl1) - gamxinfdp( 5.5+alp+0.5*bxhl1, ratio ))/y
         gamxinflu(i,j,9,2) = gamxinflu(i,j,9,1)
         gamxinflu(i,j,10,2)= gamxinflu(i,j,10,1)
 
@@ -1411,16 +1506,16 @@ SUBROUTINE nssl_2mom_init(  &
 !       gamxinflu(i,j,7,1) = gamxinfdp( alp - 1., ratio )/y
        gamxinflu(i,j,7,1) = (gamma_dpr(alp - 1.) - gamxinfdp( alp - 1., ratio ))/y
 !       gamxinflu(i,j,8,1) = gamxinfdp( alp - 0.5 + 0.5*bxh, ratio )/y
-       gamxinflu(i,j,8,1) = (gamma_dpr(alp - 0.5 + 0.5*bxh) - gamxinfdp( alp - 0.5 + 0.5*bxh, ratio ))/y
-!       gamxinflu(i,j,8,2) = gamxinfdp( alp - 0.5 + 0.5*bxhl, ratio )/y
-       gamxinflu(i,j,8,2) = (gamma_dpr(alp - 0.5 + 0.5*bxhl) - gamxinfdp( alp - 0.5 + 0.5*bxhl, ratio ))/y
+       gamxinflu(i,j,8,1) = (gamma_dpr(alp - 0.5 + 0.5*bxh1) - gamxinfdp( alp - 0.5 + 0.5*bxh1, ratio ))/y
+!       gamxinflu(i,j,8,2) = gamxinfdp( alp - 0.5 + 0.5*bxhl1, ratio )/y
+       gamxinflu(i,j,8,2) = (gamma_dpr(alp - 0.5 + 0.5*bxhl1) - gamxinfdp( alp - 0.5 + 0.5*bxhl1, ratio ))/y
       ELSE
 !       gamxinflu(i,j,7,1) = gamxinfdp( .1, ratio )/y
        gamxinflu(i,j,7,1) = (gamma_dpr(0.1) - gamxinfdp( 0.1, ratio ) )/y
-!       gamxinflu(i,j,8,1) = gamxinfdp( 1.1 - 0.5 + 0.5*bxh, ratio )/y
-!       gamxinflu(i,j,8,2) = gamxinfdp( 1.1 - 0.5 + 0.5*bxhl, ratio )/y
-       gamxinflu(i,j,8,1) = (gamma_dpr(1.1 - 0.5 + 0.5*bxh) - gamxinfdp( 1.1 - 0.5 + 0.5*bxh, ratio ) )/y
-       gamxinflu(i,j,8,2) = (gamma_dpr(1.1 - 0.5 + 0.5*bxhl) - gamxinfdp( 1.1 - 0.5 + 0.5*bxhl, ratio ) )/y
+!       gamxinflu(i,j,8,1) = gamxinfdp( 1.1 - 0.5 + 0.5*bxh1, ratio )/y
+!       gamxinflu(i,j,8,2) = gamxinfdp( 1.1 - 0.5 + 0.5*bxhl1, ratio )/y
+       gamxinflu(i,j,8,1) = (gamma_dpr(1.1 - 0.5 + 0.5*bxh1) - gamxinfdp( 1.1 - 0.5 + 0.5*bxh1, ratio ) )/y
+       gamxinflu(i,j,8,2) = (gamma_dpr(1.1 - 0.5 + 0.5*bxhl1) - gamxinfdp( 1.1 - 0.5 + 0.5*bxhl1, ratio ) )/y
       ENDIF
         
         gamxinflu(i,j,7,2) = gamxinflu(i,j,7,1)
@@ -1457,6 +1552,7 @@ SUBROUTINE nssl_2mom_init(  &
       isub = Min( 0, Max(-1,ihvol) ) ! is -1 or 0
 
       lccn = 0
+      lccnuf = 0
       lccna = 0
       lnc = 0
       lnr = 0
@@ -1490,21 +1586,29 @@ SUBROUTINE nssl_2mom_init(  &
        lhl = 0
        ENDIF
     ELSEIF ( ipconc == 5 ) THEN
-      lccn = lhab+1 ! 9
-      lnc = lhab+2 ! 10
-      lnr = lhab+3 ! 11
-      lni = lhab+4 !12
-      lns = lhab+5 !13
-      lnh = lhab+6 !14
+      ltmp = lhab
+      IF ( iufccn > 0 ) THEN
+        ltmp = ltmp+1
+        lccnuf = ltmp
+        denscale(lccnuf) = 1
+      ENDIF
+      lccn= ltmp+1 ! 9
+      lnc = ltmp+2 ! 10
+      lnr = ltmp+3 ! 11
+      lni = ltmp+4 !12
+      lns = ltmp+5 !13
+      lnh = ltmp+6 !14
       ltmp = lnh
       IF ( ihvol >= 0 ) THEN
       ltmp = ltmp + 1
       lnhl = ltmp ! lhab+7 ! 15
       ENDIF
+      IF ( igvol_local >= 1 ) THEN
       ltmp = ltmp + 1
       lvh = ltmp ! lhab+8 + isub ! 16 + isub ! isub adjusts to 15 if hail is off
 !      ltmp = lvh
-      denscale(lccn:lvh) = 1
+      ENDIF
+      denscale(lccn:ltmp) = 1
       IF ( ihvol >= 1 ) THEN
        ltmp = ltmp + 1
        lvhl = ltmp
@@ -1523,24 +1627,30 @@ SUBROUTINE nssl_2mom_init(  &
 !      ltmp = lhlw
       ENDIF
     ELSEIF ( ipconc >= 6 ) THEN
-      errmsg = 'NSSL microphysics has not been compiled for 3-moment. Sorry.'
-      errflg = 1
-      return
-      lccn = lhab+1 ! 9
-      lnc = lhab+2 ! 10
-      lnr = lhab+3 ! 11
-      lni = lhab+4 !12
-      lns = lhab+5 !13
-      lnh = lhab+6 !14
+      ltmp = lhab
+      IF ( iufccn > 0 ) THEN
+        ltmp = ltmp+1
+        lccnuf = ltmp
+        denscale(lccnuf) = 1
+      ENDIF
+      write(0,*) 'nsslwrf: lccnuf = ',lccnuf
+      lccn= ltmp+1 ! 9
+      lnc = ltmp+2 ! 10
+      lnr = ltmp+3 ! 11
+      lni = ltmp+4 !12
+      lns = ltmp+5 !13
+      lnh = ltmp+6 !14
       ltmp = lnh
       IF ( lhl > 0 ) THEN
       ltmp = ltmp + 1
       lnhl = ltmp ! lhab+7 ! 15
       ENDIF
+      IF ( igvol_local >= 1 ) THEN
       ltmp = ltmp + 1
       lvh = ltmp ! lhab+8 + isub ! 16 + isub ! isub adjusts to 15 if hail is off
+      ENDIF
 !      ltmp = lvh
-      denscale(lccn:lvh) = 1
+      denscale(lccn:ltmp) = 1
       IF ( ihvol >= 1 ) THEN
        ltmp = ltmp + 1
        lvhl = ltmp
@@ -1825,9 +1935,11 @@ SUBROUTINE nssl_2mom_init(  &
       IF ( lhl .gt. 1 ) ido(lhl) = idohl
 
       IF ( irfall .lt. 0 ) irfall = infall
+      IF ( isfall .lt. 0 ) isfall = infall
       IF ( lzr > 0 ) irfall = 0
 
       qccn = ccn/rho00
+      qccnuf = ccnuf/rho00
       IF ( old_cccn > 0.0 ) THEN
          old_qccn = old_cccn/rho00
       ELSE
@@ -1981,6 +2093,33 @@ SUBROUTINE nssl_2mom_init(  &
         ENDDO
       ENDDO
 
+      dab0lu(:,:,:,:) = 0.0
+      dab1lu(:,:,:,:) = 0.0
+      
+      IF ( ipconc >= 6 ) THEN
+      DO il = lc,lhab ! collector
+        DO j = lc,lhab ! collected
+          IF ( il .ne. j ) THEN
+
+            DO jj = ialpstart,nqiacralpha
+                alpjj = float(jj)*dqiacralpha
+                xnujj = (alpjj - 2.)/3.
+            DO ii = ialpstart,nqiacralpha
+                alpii = float(ii)*dqiacralpha
+                xnuii = (alpii - 2.)/3.
+          
+            dab0lu(ii,jj,il,j) = delabk(bb(il), bb(j), xnuii, xnujj, xmu(il), xmu(j), 0)
+            dab1lu(ii,jj,il,j) = delabk(bb(il), bb(j), xnuii, xnujj, xmu(il), xmu(j), 1)
+          
+            ENDDO
+            ENDDO
+!           write(0,*) 'il, j, dab0, dab1 = ',il, j, dab0(il,j), dab1(il,j)
+          ENDIF
+        ENDDO
+      ENDDO
+      
+      ENDIF
+
         gf4br = gamma_sp(4.0+br)
         gf4ds = gamma_sp(4.0+ds)
         gf4p5 = gamma_sp(4.0+0.5)
@@ -2029,10 +2168,12 @@ END SUBROUTINE nssl_2mom_init
 !>\ingroup mod_nsslmp
 !! Driver subroutine that copies state data to local 2D arrays for microphysics calls
 SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw, chl,  &
-                              cn, vhw, vhl, cna, cni, f_cn, f_cna, f_cina,               &
-                              zrw, zhw, zhl,                                            &
+                              cn, vhw, vhl, cna, cni, f_cn, f_cna, f_cina,              &
+                              cnuf, f_cnuf,                                             &
+                              zrw, zhw, zhl, f_zrw, f_zhw, f_zhl, f_vhw, f_vhl,         &
                               qsw, qhw, qhlw,                                           &
                               tt, th, pii, p, w, dn, dz, dtp, itimestep,                &
+                              ntmul, ntcnt, lastloop,                                   &
                               RAINNC,RAINNCV,                                           &
                               dx, dy,                                                   &
                               axtra,                                                    &
@@ -2091,7 +2232,8 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
                               zrw, zhw, zhl,                                            &
                               qsw, qhw, qhlw,                                           &
                             qi,qhl,ccw,crw,cci,csw,chw,chl,vhw,vhl
-      real, dimension(ims:ime, kms:kme, jms:jme), optional, intent(inout):: dbz, vzf, cn, cna, cni
+      logical, optional, intent(in) ::  f_zrw, f_zhw, f_zhl, f_vhw, f_vhl ! not used yet
+      real, dimension(ims:ime, kms:kme, jms:jme), optional, intent(inout):: dbz, vzf, cn, cna, cni, cnuf
       real, dimension(ims:ime, jms:jme), optional, intent(inout):: compdbz
       real, dimension(ims:ime, jms:jme), optional, intent(inout):: rscghis_2d,  & ! 2D accumulation arrays for vertically-integrated charging rate
                                                                    rscghis_2dp, & ! 2D accumulation arrays for vertically-integrated charging rate (positive only)
@@ -2102,8 +2244,8 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
                             scr,scw,sci,scs,sch,schl,sciona,sctot  ! space charge
       real, dimension(ims:ime, kms:kme, jms:jme),  optional, intent(inout)::                   &
                             induc,noninduc,noninducp,noninducn  ! charging rates: inductive, noninductive (all, positive, negative to graupel)
-      real, dimension(ims:ime, kms:kme, jms:jme),  optional, intent(in) :: elecz ! elecsave = Ez     
-      real, dimension(ims:ime, kms:kme, jms:jme,2),optional, intent(inout) :: scion  
+      real, dimension(ims:ime, kms:kme, jms:jme),  optional, intent(in) :: elecz ! elecsave = Ez
+      real, dimension(ims:ime, kms:kme, jms:jme,2),optional, intent(inout) :: scion
       real, dimension(ims:ime, kms:kme, jms:jme), intent(in)::  p,w,dz,dn
 
       real, dimension(ims:ime, kms:kme, jms:jme), intent(in)::  pii
@@ -2139,7 +2281,9 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
       real, optional, intent(in) :: dx,dy
       real, intent(in)::    dtp
       integer, intent(in):: itimestep !, ccntype
-      logical, optional, intent(in) :: diagflag, f_cna, f_cn, f_cina
+      integer, intent(in), optional :: ntmul, ntcnt
+      logical, optional, intent(in) :: lastloop
+      logical, optional, intent(in) :: diagflag, f_cna, f_cn, f_cina, f_cnuf
       integer, optional, intent(in) :: ipelectmp, ke_diag
 
    ! CCPP error handling
@@ -2151,6 +2295,7 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
 !   REAL, DIMENSION(ims:ime, kms:kme, jms:jme), optional,INTENT(INOUT):: qndrop
   LOGICAL :: flag_qndrop  ! wrf-chem
   LOGICAL :: flag_qnifa , flag_qnwfa
+  logical :: flag_cnuf = .false.
   logical :: flag
   real :: cinchange, t7max,testmax,wmax
 
@@ -2223,6 +2368,9 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
       real :: fach(kts:kte)
       
       logical, parameter :: debugdriver = .false.
+      
+      integer :: loopcnt, loopmax, outerloopcnt
+      logical :: lastlooptmp
 
 #ifdef MPI
 
@@ -2246,12 +2394,21 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
      flag_qndrop = .false.
      flag_qnifa = .false.
      flag_qnwfa = .false.
+     flag_cnuf = .false.
      
      IF ( PRESENT ( nssl_progn ) ) flag_qndrop = nssl_progn
+     IF ( present ( f_cnuf ) ) flag_cnuf = f_cnuf
 
      
-     
-     
+     loopmax = 1
+     outerloopcnt = 1
+     lastlooptmp = .true.
+     IF ( present( ntmul ) .and. present( ntcnt ) .and. present( lastloop ) ) THEN
+       loopmax = ntmul
+       outerloopcnt = ntcnt
+       lastlooptmp = lastloop
+     ENDIF
+          
      ! ---
 
      IF ( present( f_cna ) ) THEN
@@ -2365,6 +2522,7 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
           ancuten(its:ite,1,kts:kte,:) = 0.0
           thproclocal(:,:) = 0.0
 
+
      DO jy = jts,jye
      
      xfall(:,:,:) = 0.0
@@ -2408,6 +2566,9 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
              ELSE
                an(ix,1,kz,lccn) = cn(ix,kz,jy)
              ENDIF
+             IF ( i_uf_or_ccn > 0 .and. lccnuf > 1 ) THEN ! UF ccn are extra regular ccn
+               an(ix,1,kz,lccn) = an(ix,1,kz,lccn) + cnuf(ix,kz,jy)
+             ENDIF
            ELSE
             IF ( lccna == 0 .and. ( .not. f_cnatmp ) ) THEN
               an(ix,1,kz,lccn) = qccn - ccw(ix,kz,jy)
@@ -2418,6 +2579,14 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
            ENDIF
           ENDIF
 
+          IF ( lccnuf > 0 .and. flag_cnuf ) THEN
+            IF ( i_uf_or_ccn == 0 ) THEN ! UF are UF
+              an(ix,1,kz,lccnuf) = Max(0.0, cnuf(ix,kz,jy) )
+            ELSE ! UF were added to lccn
+              an(ix,1,kz,lccnuf) = 0.0
+            ENDIF
+          ENDIF
+
           IF ( lccna > 1 ) THEN
             IF ( present( cna ) .and. f_cnatmp ) THEN
               an(ix,1,kz,lccna) = cna(ix,kz,jy)
@@ -2448,9 +2617,19 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
           IF ( lvh > 0 ) an(ix,1,kz,lvh)  = vhw(ix,kz,jy)
           IF ( lvhl > 0 .and. present( vhl ) ) an(ix,1,kz,lvhl)  = vhl(ix,kz,jy)
 
+          IF ( ipconc >= 6 ) THEN
+            IF ( lzr > 0 )  an(ix,1,kz,lzr)  = zrw(ix,kz,jy)*zscale
+            IF ( lzh > 0 )  an(ix,1,kz,lzh)  = zhw(ix,kz,jy)*zscale
+            IF ( lzhl > 0 ) an(ix,1,kz,lzhl) = zhl(ix,kz,jy)*zscale
+          ENDIF
           
 
 
+        ENDDO
+       ENDDO
+       
+       DO kz = kts,kte
+        DO ix = its,ite
 
           
           IF ( present( tt ) ) THEN
@@ -2458,6 +2637,26 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
           ELSE
             t0(ix,1,kz) = th(ix,kz,jy)*pii(ix,kz,jy) ! temperature (Kelvin)
           ENDIF
+          t00(ix,1,kz) = 380.0/p(ix,kz,jy)
+          t77(ix,1,kz) = pii(ix,kz,jy)
+          dbz2d(ix,1,kz) = 0.0
+          vzf2d(ix,1,kz) = 0.0
+        ENDDO
+       ENDDO
+       
+       DO ix = its,ite
+         RAINNCV(ix,jy) = 0.0
+         IF ( present( GRPLNCV ) ) GRPLNCV(ix,jy) = 0.0
+         IF ( present( HAILNCV ) ) HAILNCV(ix,jy) = 0.0
+         IF ( present( SNOWNCV ) ) SNOWNCV(ix,jy) = 0.0
+       ENDDO
+
+      DO loopcnt = 1,loopmax
+       
+       DO kz = kts,kte
+        DO ix = its,ite
+
+          
           t1(ix,1,kz) = 0.0
           t2(ix,1,kz) = 0.0
           t3(ix,1,kz) = 0.0
@@ -2467,14 +2666,11 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
           t7(ix,1,kz) = 0.0
           t8(ix,1,kz) = 0.0
           t9(ix,1,kz) = 0.0
-          t00(ix,1,kz) = 380.0/p(ix,kz,jy)
-          t77(ix,1,kz) = pii(ix,kz,jy)
-          dbz2d(ix,1,kz) = 0.0
-          vzf2d(ix,1,kz) = 0.0
 
-          dn1(ix,1,kz) = dn(ix,kz,jy)
           pn(ix,1,kz) = p(ix,kz,jy)
           wn(ix,1,kz) = w(ix,kz,jy)
+! calculate dn1 in case we are substepping: rho = con_eps*prsl/(con_rd*tgrs*(qv_mp+con_eps))
+          dn1(ix,1,kz) = rdorv*pn(ix,1,kz)/(rd*t0(ix,1,kz)*(an(ix,1,kz,lv) + rdorv))
 !          wmax = Max(wmax,wn(ix,1,kz))
           dz2d(ix,1,kz) = dz(ix,kz,jy)
           dz2dinv(ix,1,kz) = 1./dz(ix,kz,jy)
@@ -2544,19 +2740,19 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
 
       ELSEIF ( icenucopt == 4 ) THEN ! DeMott 2010
 
-        IF ( t0(ix,jy,kz) < 268.16 .and.  t0(ix,jy,kz) > 223.15 .and. ssival > 1.001 ) THEN ! 
+        IF ( t0(ix,1,kz) < 268.16 .and.  t0(ix,1,kz) > 223.15 .and. ssival > 1.001 ) THEN ! 
       
         ! a = 0.0000594, b = 3.33, c = 0.0264, d = 0.0033,
         ! nint = a*(-Tc)**b * naer**(c*(-Tc) + d)
         ! nint has units of per (standard) liter, so mult by 1.e3 and scale by dn/rho00
         ! naer needs units of cm**-3, so mult by 1.e-6
         
-        !  dp1 = 1.e3*0.0000594*(273.16 - t0(ix,jy,kz))**3.33 * (1.e-6*cin*dn(ix,jy,kz))**(0.0264*(273.16 - t0(ix,jy,kz)) + 0.0033)
-          dp1 = 1.e3*dn(ix,jy,kz)/rho00*0.0000594*(273.16 - t0(ix,jy,kz))**3.33 * (1.e-6*naer)**(0.0264*(273.16 - t0(ix,jy,kz)) + 0.0033)
-          t7(ix,jy,kz) = Min(dp1, 1.0d30)
+        !  dp1 = 1.e3*0.0000594*(273.16 - t0(ix,1,kz))**3.33 * (1.e-6*cin*dn(ix,1,kz))**(0.0264*(273.16 - t0(ix,1,kz)) + 0.0033)
+          dp1 = 1.e3*dn1(ix,1,kz)/rho00*0.0000594*(273.16 - t0(ix,1,kz))**3.33 * (1.e-6*naer)**(0.0264*(273.16 - t0(ix,1,kz)) + 0.0033)
+          t7(ix,1,kz) = Min(dp1, 1.0d30)
       
         ELSE
-          t7(ix,jy,kz) = 0.0
+       !   t7(ix,1,kz) = 0.0
         ENDIF
       
       ENDIF ! icenucopt
@@ -2583,25 +2779,29 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
 
    ! transform from number mixing ratios to number conc.
      
+    IF ( loopcnt == 1 ) THEN
      DO il = lnb,na
        IF ( denscale(il) == 1 ) THEN
          DO kz = kts,kte
           DO ix = its,ite
-           an(ix,1,kz,il) = an(ix,1,kz,il)*dn(ix,kz,jy)
+           an(ix,1,kz,il) = an(ix,1,kz,il)*dn1(ix,1,kz) ! dn(ix,kz,jy)
           ENDDO
          ENDDO
        ENDIF
      ENDDO ! il
+    ENDIF
+
         
 ! sedimentation
       xfall(:,:,:) = 0.0
        
-      IF ( .true. ) THEN
+
+!      IF ( .true. ) THEN
 
 
 ! #ifndef CM1
 ! for real cases when hydrometeor mixing ratios have been initialized without concentrations
-       IF ( itimestep == 1 .and. ipconc > 0 ) THEN
+       IF ( itimestep == 1 .and. ipconc > 0 .and. loopcnt == 1 ) THEN
          call calcnfromq(nx,ny,nz,an,na,nor,nor,dn1)
        ENDIF
 !       IF ( itimestep == 3 .and. ipconc > 0 ) THEN
@@ -2611,9 +2811,9 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
 
       IF ( present(cu_used) .and.         &
            ( present( qrcuten ) .or. present( qscuten ) .or.  &
-             present( qicuten ) .or. present( qccuten ) ) ) THEN
+             present( qicuten ) .or. present( qccuten ) ) ) THEN !{
 
-       IF ( cu_used == 1 ) THEN
+       IF ( cu_used == 1 ) THEN !{
        DO kz = kts,kte
         DO ix = its,ite
 
@@ -2627,10 +2827,22 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
        
          call calcnfromcuten(nx,ny,nz,ancuten,an,na,nor,nor,dn1)
 
+       DO kz = kts,kte
+        DO ix = its,ite
+
+
+          IF ( ipconc >= 6 ) THEN
+!            IF ( lzr > 0 )  an(ix,1,kz,lzr)  = an(ix,1,kz,lzr) + ancuten(ix,1,kz,lzr) 
+          ENDIF
+         
+        ENDDO
+       ENDDO
        
-       ENDIF
+       ENDIF !}
        
-      ENDIF
+      ENDIF !}
+      
+      
 
 
       call sediment1d(dtp,nx,ny,nz,an,na,nor,nor,xfall,dn1,dz2d,dz2dinv, &
@@ -2644,10 +2856,12 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
 
        DO ix = its,ite
          IF ( lhl > 1 ) THEN
-         RAINNCV(ix,jy) = dtp*dn1(ix,1,1)*(xfall(ix,1,lr) + xfall(ix,1,ls)*1000./xdn0(lr) + &
+         RAINNCV(ix,jy) = RAINNCV(ix,jy) + &
+                          dtp*dn1(ix,1,1)*(xfall(ix,1,lr) + xfall(ix,1,ls)*1000./xdn0(lr) + &
               &            xfall(ix,1,lh)*1000./xdn0(lr) + xfall(ix,1,lhl)*1000./xdn0(lr) )
          ELSE
-         RAINNCV(ix,jy) = dtp*dn1(ix,1,1)*(xfall(ix,1,lr) + xfall(ix,1,ls)*1000./xdn0(lr) + &
+         RAINNCV(ix,jy) = RAINNCV(ix,jy) + &
+                           dtp*dn1(ix,1,1)*(xfall(ix,1,lr) + xfall(ix,1,ls)*1000./xdn0(lr) + &
               &            xfall(ix,1,lh)*1000./xdn0(lr) )
          ENDIF
          IF ( present ( rainncw2 ) ) THEN ! rain only
@@ -2662,17 +2876,19 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
      &            xfall(ix,1,lh)*1000./xdn0(lr) )
            ENDIF
          ENDIF
-         IF ( present( SNOWNCV ) ) SNOWNCV(ix,jy) = dtp*dn1(ix,1,1)*xfall(ix,1,ls)*1000./xdn0(lr)
+         IF ( present( SNOWNCV ) ) SNOWNCV(ix,jy) = SNOWNCV(ix,jy) + dtp*dn1(ix,1,1)*xfall(ix,1,ls)*1000./xdn0(lr)
          IF ( present( GRPLNCV ) ) THEN 
            IF ( lhl > 1 .and. .not. present( HAILNC) ) THEN ! if no separate hail accum, then add to graupel
-             GRPLNCV(ix,jy) = dtp*dn1(ix,1,1)*(xfall(ix,1,lh) + xfall(ix,1,lhl)) *1000./xdn0(lr)
+             GRPLNCV(ix,jy) = GRPLNCV(ix,jy) + dtp*dn1(ix,1,1)*(xfall(ix,1,lh) + xfall(ix,1,lhl)) *1000./xdn0(lr)
            ELSE
-             GRPLNCV(ix,jy) = dtp*dn1(ix,1,1)*xfall(ix,1,lh)*1000./xdn0(lr)
+             GRPLNCV(ix,jy) = GRPLNCV(ix,jy) + dtp*dn1(ix,1,1)*xfall(ix,1,lh)*1000./xdn0(lr)
            ENDIF
          ENDIF
-         RAINNC(ix,jy)  = RAINNC(ix,jy) + RAINNCV(ix,jy)
+         IF ( loopcnt == loopmax ) RAINNC(ix,jy)  = RAINNC(ix,jy) + RAINNCV(ix,jy)
 
-         IF ( present (SNOWNC) .and. present (SNOWNCV) ) SNOWNC(ix,jy)  = SNOWNC(ix,jy) + SNOWNCV(ix,jy)
+         IF ( present (SNOWNC) .and. present (SNOWNCV) .and. loopcnt == loopmax ) THEN
+           SNOWNC(ix,jy)  = SNOWNC(ix,jy) + SNOWNCV(ix,jy)
+         ENDIF
          IF ( lhl > 1 ) THEN
 !#ifdef CM1
 !           IF ( .true. ) THEN
@@ -2680,13 +2896,15 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
            IF ( present( HAILNC ) ) THEN
 !#endif
              HAILNCV(ix,jy) = dtp*dn1(ix,1,1)*xfall(ix,1,lhl)*1000./xdn0(lr)
-             HAILNC(ix,jy)  = HAILNC(ix,jy) + HAILNCV(ix,jy)
+             IF ( loopcnt == loopmax ) HAILNC(ix,jy)  = HAILNC(ix,jy) + HAILNCV(ix,jy)
 !           ELSEIF ( present( GRPLNCV ) ) THEN ! if no separate hail accum, then add to graupel
 !             GRPLNCV(ix,jy) = GRPLNCV(ix,jy) + dtp*dn1(ix,1,1)*xfall(ix,1,lhl)*1000./xdn0(lr)
            ENDIF
          ENDIF
-         IF ( present( GRPLNCV ) ) GRPLNC(ix,jy)  = GRPLNC(ix,jy) + GRPLNCV(ix,jy)
-        IF ( present( SR ) .and. present (SNOWNCV) .and. present(GRPLNCV) ) THEN
+         IF ( present( GRPLNCV ) .and. loopcnt == loopmax ) THEN
+           GRPLNC(ix,jy)  = GRPLNC(ix,jy) + GRPLNCV(ix,jy)
+         ENDIF
+        IF ( present( SR ) .and. present (SNOWNCV) .and. present(GRPLNCV) .and. loopcnt == loopmax ) THEN
          IF ( present( HAILNC ) ) THEN
            SR(ix,jy)      = (SNOWNCV(ix,jy)+HAILNCV(ix,jy)+GRPLNCV(ix,jy))/(RAINNCV(ix,jy)+1.e-12)
          ELSE
@@ -2695,7 +2913,7 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
         ENDIF
        ENDDO
        
-      ENDIF ! .false.
+!      ENDIF ! .false.
  
       IF ( isedonly /= 1 ) THEN
    ! call nssl_2mom_gs: main gather-scatter routine to calculate microphysics
@@ -2726,6 +2944,13 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
 
 
 
+! recalculate dn1 after temperature changes: rho = con_eps*prsl/(con_rd*tgrs*(qv_mp+con_eps))
+      DO kz = kts,kte
+        DO ix = its,ite
+          dn1(ix,1,kz) = rdorv*pn(ix,1,kz)/(rd*t0(ix,1,kz)*(an(ix,1,kz,lv) + rdorv))
+        ENDDO
+      ENDDO
+
 
    ENDIF ! isedonly /= 1
    
@@ -2741,11 +2966,21 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
      &  ,axtra2d, makediag  &
      &  ,ssat,t00,t77,flag_qndrop)
 
+! recalculate dn1 after temperature changes 
+      DO kz = kts,kte
+        DO ix = its,ite
+          dn1(ix,1,kz) = rdorv*pn(ix,1,kz)/(rd*t0(ix,1,kz)*(an(ix,1,kz,lv) + rdorv))
+        ENDDO
+      ENDDO
+
 
    ENDIF
 
 
 
+
+     ENDDO ! loopcnt=1,loopmax
+
      IF ( present( pcc2 ) .and. makediag ) THEN
          DO kz = kts,kte
           DO ix = its,ite
@@ -2759,7 +2994,7 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
 
 
 ! compute diagnostic S-band reflectivity if needed
-     IF ( present( dbz ) .and. makediag ) THEN
+     IF ( present( dbz ) .and. makediag .and. lastlooptmp ) THEN
    ! calc dbz
       
       IF ( .true. ) THEN
@@ -2797,7 +3032,8 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
 
 ! Following Greg Thompson, calculation for effective radii. Used by RRTMG LW/SW schemes if enabled in module_physics_init.F
       IF ( present( has_reqc ).and. present( has_reqi ) .and. present( has_reqs ) .and.  &
-           present( re_cloud ).and. present( re_ice ) .and. present( re_snow ) ) THEN
+           present( re_cloud ).and. present( re_ice ) .and. present( re_snow )    .and.  &
+           lastlooptmp) THEN
        IF ( has_reqc.ne.0 .or. has_reqi.ne.0 .or. has_reqs.ne.0) THEN
          DO kz = kts,kte
           DO ix = its,ite
@@ -2821,10 +3057,10 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
         DO kz = kts,kte
           DO ix = its,ite
              re_cloud(ix,kz,jy) = MAX(2.51E-6, MIN(t1(ix,1,kz), 50.E-6))
-             re_ice(ix,kz,jy)   = MAX(10.01E-6, MIN(t2(ix,1,kz), 200.E-6))
+             re_ice(ix,kz,jy)   = MAX(10.01E-6, MIN(t2(ix,1,kz), 125.E-6))
              re_snow(ix,kz,jy)  = MAX(25.E-6, MIN(t3(ix,1,kz), 999.E-6))
              ! check for case where snow needs to be treated as cloud ice (for rrtmg radiation)
-             IF ( .not. present(qi) ) re_ice(ix,kz,jy)  = MAX(10.E-6, MIN(t3(ix,1,kz), 200.E-6))
+             IF ( .not. present(qi) ) re_ice(ix,kz,jy)  = MAX(10.E-6, MIN(t3(ix,1,kz), 125.E-6))
           ENDDO
          ENDDO
 
@@ -2849,7 +3085,7 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
       IF ( denscale(il) == 1 ) THEN
        DO kz = kts,kte
         DO ix = its,ite
-         an(ix,1,kz,il) = an(ix,1,kz,il)/dn(ix,kz,jy)
+         an(ix,1,kz,il) = an(ix,1,kz,il)/dn1(ix,1,kz) ! dn(ix,kz,jy)
         ENDDO
        ENDDO
       ENDIF
@@ -2896,6 +3132,21 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
            ENDIF
          ENDIF
 
+         IF ( lccnuf > 0 .and. flag_cnuf ) THEN
+           IF ( i_uf_or_ccn > 0 ) THEN ! UF are ccn and lccnuf is zero, so put cnuf into lccnuf to do decay
+             an(ix,1,kz,lccnuf) = Max(0.0, cnuf(ix,kz,jy) )
+           ENDIF
+           IF ( decayufccn ) THEN
+             IF ( an(ix,1,kz,lccnuf) > ufbackground ) THEN
+               an(ix,1,kz,lccnuf) = an(ix,1,kz,lccnuf) - (an(ix,1,kz,lccnuf) - &
+                            ufbackground)*(1.0 - exp(-dtp/ufccntimeconst))
+             ENDIF
+           ENDIF
+           cnuf(ix,kz,jy) = an(ix,1,kz,lccnuf)
+         ENDIF
+
+
+
          IF ( ipconc >= 5 ) THEN
 
           ccw(ix,kz,jy) = an(ix,1,kz,lnc)
@@ -2906,6 +3157,11 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
           IF ( lhl > 1 ) chl(ix,kz,jy) = an(ix,1,kz,lnhl)
          ENDIF
 
+         IF ( ipconc >= 6 ) THEN
+            IF ( lzr > 0 )  zrw(ix,kz,jy) = an(ix,1,kz,lzr) *zscaleinv
+            IF ( lzh > 0 )  zhw(ix,kz,jy) = an(ix,1,kz,lzh) *zscaleinv
+            IF ( lzhl > 0 ) zhl(ix,kz,jy) = an(ix,1,kz,lzhl)*zscaleinv
+         ENDIF
 
 
 
@@ -2914,6 +3170,9 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
 
 #if ( WRF_CHEM == 1 )
          IF ( has_wetscav ) THEN
+           IF ( loopmax > 1 ) THEN
+             ! wrferror not supported
+           ENDIF
            IF ( PRESENT( rainprod ) ) rainprod(ix,kz,jy) = rainprod2d(ix,kz)
            IF ( PRESENT( evapprod ) ) evapprod(ix,kz,jy) = evapprod2d(ix,kz)
          ENDIF
@@ -2923,6 +3182,8 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
        ENDDO
   
      ENDDO ! jy
+     
+     
 
      
 
@@ -3217,7 +3478,7 @@ END FUNCTION GAML02
 ! **********************************************************
 !>\ingroup mod_nsslmp
 !! Function calculates fraction of drops larger than 300 microns ( imurain == 3 )
-     real FUNCTION GAML02d300(x) 
+     real FUNCTION GAML02d300(x)
       implicit none
       integer ig, i, ii, n, np
       real x
@@ -3825,7 +4086,8 @@ subroutine sediment1d(dtp,nx,ny,nz,an,na,nor,norz,xfall,dn,dz3d,dz3dinv, &
 
 
         IF ( il >= lr .and. ( infall .eq. 3 .or. infall .eq. 4 ) .and. ln(il) > 0 ) THEN
-           IF ( (il .eq. lr .and. irfall .eq. infall .and. lzr < 1) .or. (il .ge. lh .and. lz(il) .lt. 1 ) ) THEN
+           IF ( (il .eq. lr .and. irfall .eq. infall .and. lzr < 1) .or. & 
+                 (il .ge. lh .and. lz(il) .lt. 1 ) .or. (il == ls .and. isfall == infall ) ) THEN
             call calczgr1d(nx,ny,nz,nor,na,an,ixe,kze, & 
      &         z,db1,jgs,ipconc, dnu(il), il, ln(il), qxmin(il), xvmn(il), xvmx(il), lvol(il), xdn0(il), ix )
            ENDIF
@@ -3850,6 +4112,14 @@ subroutine sediment1d(dtp,nx,ny,nz,an,na,nor,norz,xfall,dn,dz3d,dz3dinv, &
         ENDIF
       ENDIF
 
+! reflectivity
+
+      IF ( ipconc .ge. 6 ) THEN
+        IF ( lz(il) .gt. 1 ) THEN
+         call fallout1d(nx,ny,nz,nor,na,dtptmp,dtfrac,jgs,xvt(1,1,3,il), & 
+     &              an,db1,lz(il),0,xfall,dtz1,ix)
+        ENDIF
+      ENDIF
 
       if (ndebug .gt. 0 ) write(0,*) 'dbg = 3d'
 
@@ -3863,9 +4133,11 @@ subroutine sediment1d(dtp,nx,ny,nz,an,na,nor,norz,xfall,dn,dz3d,dz3dinv, &
 !  to put a lower bound on number conc.
 !
 
-        IF ( ( infall .eq. 3 .or. infall .eq. 4 ) .and. ( il .eq. lh .or. il .eq. lhl .or.  & 
+        IF ( ( infall .eq. 3 .or. infall .eq. 4 ) .and. (  (il == ls .and. isfall .eq. infall ) &
+     &        .or. il .eq. lh .or. il .eq. lhl .or.  il == lf .or. & 
      &      ( il .eq. lr .and. irfall .eq. infall) ) ) THEN
 
+          ! set up for method I+II
           DO kz = kzb,kze
 !            DO ix = ixb,ixe
               tmpn2(ix,jy,kz) = z(ix,kz,il)
@@ -3878,7 +4150,7 @@ subroutine sediment1d(dtp,nx,ny,nz,an,na,nor,norz,xfall,dn,dz3d,dz3dinv, &
           ENDDO
         
         ELSE
-          
+          ! set up for method II only
           DO kz = kzb,kze
 !            DO ix = ixb,ixe
               tmpn(ix,jy,kz) = an(ix,jy,kz,ln(il))
@@ -3907,7 +4179,8 @@ subroutine sediment1d(dtp,nx,ny,nz,an,na,nor,norz,xfall,dn,dz3d,dz3dinv, &
            xfall0(:,jgs) = 0.0
 
            IF ( ( infall .eq. 3 .or. infall .eq. 4 ) .and.  & 
-     &        ( il .ge. lh .or. (il .eq. lr .and. irfall .eq. infall) ) ) THEN
+     &        ( il .ge. lh .or. (il .eq. lr .and. irfall .eq. infall)    &
+                   .or. (il .eq. ls .and. isfall .eq. infall) ) ) THEN
              call fallout1d(nx,ny,nz,nor,1,dtptmp,dtfrac,jgs,xvt(1,1,3,il), & 
      &         tmpn2,db1,1,0,xfall0,dtz1,ix)
              call fallout1d(nx,ny,nz,nor,1,dtptmp,dtfrac,jgs,xvt(1,1,1,il), & 
@@ -3918,12 +4191,12 @@ subroutine sediment1d(dtp,nx,ny,nz,an,na,nor,norz,xfall,dn,dz3d,dz3dinv, &
            ENDIF
 
            IF ( ( infall .eq. 3 .or. infall .eq. 4 ) .and. ( (il .eq. lr .and. irfall .eq. infall) & 
-     &            .or. il .ge. lh ) ) THEN
+     &            .or. il .ge. lh .or. (il == ls .and. isfall .eq. infall ) ) ) THEN
 ! "Method I" - dbz correction
 
              call calcnfromz1d(nx,ny,nz,nor,na,an,tmpn2,ixe,kze, & 
      &       z,db1,jgs,ipconc, dnu(il), il, ln(il), qxmin(il), xvmn(il), xvmx(il),tmpn,  & 
-     &       lvol(il), rho_qh, infall, ix)
+     &       lvol(il), xdn0(il), infall, ix)
 
            ELSEIF ( infall .eq. 5 .and. il .ge. lh .or. ( il == lr .and. irfall == 5 ) ) THEN
 
@@ -3934,7 +4207,7 @@ subroutine sediment1d(dtp,nx,ny,nz,an,na,nor,norz,xfall,dn,dz3d,dz3dinv, &
 !              ENDDO
              ENDDO           
 
-           ELSEIF ( .not. (il .eq. lr .and. irfall .eq. 0) ) THEN
+           ELSEIF ( .not. (il .eq. lr .and. irfall .eq. 0) .and. .not. (il .eq. ls .and. isfall .eq. 0) ) THEN
 ! "Method II" M-wgt N-fallout correction
 
              DO kz = kzb,kze
@@ -4120,13 +4393,14 @@ subroutine calczgr1d(nx,ny,nz,nor,na,a,ixe,kze,              &
 
 
       integer ix,jy,kz
-      real vr,qr,nrx,rd,xv,g1,zx,chw,xdn
+      real vr,qr,nrx,rd,xv,g1,zx,chw,xdn,ynu
       
       
       jy = jgs
       ix = ixcol
       
-      IF ( l .eq. lh .or. l .eq. lhl .or. ( l .eq. lr .and. imurain == 1 )  ) THEN
+      IF ( l .eq. lh .or. l .eq. lhl .or. ( l .eq. lr .and. imurain == 1 )  &
+           .or. ( l .eq. ls .and. imusnow == 1 ) ) THEN
       
       
       DO kz = 1,kze
@@ -4176,16 +4450,19 @@ subroutine calczgr1d(nx,ny,nz,nor,na,a,ixe,kze,              &
           
       ENDDO
       
-      ELSEIF ( l .eq. lr .and. imurain == 3) THEN
+      ELSEIF ( (l == ls .and. imusnow == 3) .or. ( l .eq. lr .and. imurain == 3 ) ) THEN
 
-      xdn = 1000.
+      xdn = rho_qx ! 1000.
+      IF ( l == ls ) ynu = snu
+      IF ( l == lr ) ynu = rnu
       
       DO kz = 1,kze
+
           IF (  a(ix,jy,kz,l) .gt. qmin .and. a(ix,jy,kz,ln) .gt. 1.e-15 ) THEN
 
             vr = db(ix,kz)*a(ix,jy,kz,l)/(xdn*a(ix,jy,kz,ln))
-!            z(ix,kz,l) = 3.6e18*(rnu+2.0)*a(ix,jy,kz,ln)*vr**2/(rnu+1.0)
-            z(ix,kz,l) = 3.6*(rnu+2.0)*a(ix,jy,kz,ln)*vr**2/(rnu+1.0)
+!            z(ix,kz,l) = 3.6e18*(ynu+2.0)*a(ix,jy,kz,ln)*vr**2/(ynu+1.0)
+            z(ix,kz,l) = 3.6*(ynu+2.0)*a(ix,jy,kz,ln)*vr**2/(ynu+1.0)
 !            qr = a(ix,jy,kz,lr)
 !            nrx = a(ix,jy,kz,lnr)
           
@@ -4590,6 +4867,9 @@ subroutine calcnfromq(nx,ny,nz,an,na,nor,norz,dn, &
 
              an(ix,jy,kz,lnr) = nrx ! *dninv ! convert to number mixing ratio
              
+             IF ( lzr > 1 ) THEN ! set reflectivity moment
+               an(ix,jy,kz,lzr) = 36.*g1r*dn(ix,kz)**2*q**2/(pi**2*xdnr**2*nrx) ! *dninv
+             ENDIF
            ELSEIF ( an(ix,jy,kz,lr) <= qxmin(lr) .or. &
                     ( an(ix,jy,kz,lnr) <= cxmin .and. an(ix,jy,kz,lr) <= qxmin_init(lr)) ) THEN
              an(ix,jy,kz,lv) = an(ix,jy,kz,lv) + an(ix,jy,kz,lr)
@@ -4651,6 +4931,9 @@ subroutine calcnfromq(nx,ny,nz,an,na,nor,norz,dn, &
                an(ix,jy,kz,lvh) = 0.0
              ENDIF
 
+             IF ( lzh > 1 ) THEN ! set reflectivity moment
+               an(ix,jy,kz,lzh) = 36.*g1h*dn(ix,kz)**2*q**2/(pi**2*xdnh**2*nrx) ! *dninv
+             ENDIF
            ELSEIF ( an(ix,jy,kz,lh) <= qxmin(lh) .or. &
                     ( an(ix,jy,kz,lnh) <= cxmin .and. an(ix,jy,kz,lh) <= qxmin_init(lh)) ) THEN
            
@@ -4680,6 +4963,9 @@ subroutine calcnfromq(nx,ny,nz,an,na,nor,norz,dn, &
 
              an(ix,jy,kz,lnhl) = nrx ! *dninv ! convert to number mixing ratio
 
+             IF ( lzhl > 1 ) THEN ! set reflectivity moment
+               an(ix,jy,kz,lzhl) = 36.*g1hl*dn(ix,kz)**2*q**2/(pi**2*xdnhl**2*nrx) ! *dninv
+             ENDIF
 
            ELSEIF ( an(ix,jy,kz,lhl) <= qxmin(lhl) .or.  &
                    ( an(ix,jy,kz,lnhl) <= cxmin .and. an(ix,jy,kz,lhl) <= qxmin_init(lhl)) ) THEN
@@ -4859,6 +5145,9 @@ subroutine calcnfromcuten(nx,ny,nz,an,anold,na,nor,norz,dn)
                 anold(ix,jy,kz,lnr) = anold(ix,jy,kz,lnr) + an(ix,jy,kz,lr)/xmass
             ENDIF
              
+             IF ( lzr > 1 ) THEN ! set reflectivity moment
+               an(ix,jy,kz,lzr) = 36.*g1r*dn(ix,kz)**2*q**2/(pi**2*xdnr**2*nrx) ! *dninv
+             ENDIF
            ENDIF
          ENDIF
 
@@ -4909,6 +5198,9 @@ subroutine calcnfromcuten(nx,ny,nz,an,anold,na,nor,norz,dn)
 !
 !             an(ix,jy,kz,lnh) = nrx ! *dninv ! convert to number mixing ratio
 !
+!             IF ( lzh > 1 ) THEN ! set reflectivity moment
+!               an(ix,jy,kz,lzh) = 36.*g1h*dn(ix,kz)**2*q**2/(pi**2*xdnh**2*nrx) ! *dninv
+!             ENDIF
 !           ENDIF
 !         ENDIF
 !
@@ -4932,6 +5224,9 @@ subroutine calcnfromcuten(nx,ny,nz,an,anold,na,nor,norz,dn)
 !
 !             an(ix,jy,kz,lnhl) = nrx ! *dninv ! convert to number mixing ratio
 !
+!             IF ( lzhl > 1 ) THEN ! set reflectivity moment
+!               an(ix,jy,kz,lzhl) = 36.*g1hl*dn(ix,kz)**2*q**2/(pi**2*xdnhl**2*nrx) ! *dninv
+!             ENDIF
 !           ENDIF
 !         ENDIF
  
@@ -6490,6 +6785,9 @@ SUBROUTINE setvtz(ngscnt,qx,qxmin,qxw,cx,rho0,rhovt,xdia,cno,cnostmp, &
                ELSEIF ( icdxhl .eq. 6 ) THEN ! Milbrandt and Morrison (2013)
                   aax = axx(mgs,lhl)
                   bbx = bxx(mgs,lhl)
+               ELSEIF ( icdxhl <= 0 ) THEN ! 
+                  aax = ax(lhl)
+                  bbx = bx(lhl)
                ENDIF
                
               ENDIF ! }
@@ -6798,7 +7096,11 @@ subroutine ziegfall1d(nx,ny,nz,nor,norz,na,dtp,jgs,ixcol, &
       
       real vtmax
       real xvbarmax
-      
+
+      real, parameter ::  c1r=19.0, c2r=0.6, c3r=1.8, c4r=17.0   ! rain
+      real, parameter ::  c1h=5.5, c2h=0.7, c3h=4.5, c4h=8.5   ! Graupel
+      real, parameter ::  c1hl=3.7, c2hl=0.3, c3hl=9.0, c4hl=6.5, c5hl=1.0, c6hl=6.5 ! Hail
+
       integer l1, l2
       
       double precision :: dpt1, dpt2
@@ -7074,83 +7376,564 @@ subroutine ziegfall1d(nx,ny,nz,nor,norz,na,dtp,jgs,ixcol, &
       ELSEIF ( imurain == 3 ) THEN
         alpha(:,lr) = xnu(lr)
       ENDIF
-       
-
-
 
 
+      IF ( ipconc == 5 .and. imydiagalpha > 0 ) THEN
+        DO mgs = 1,ngscnt
+          IF ( qx(mgs,lr) .gt. qxmin(lr) .and. cx(mgs,lr) > cxmin ) THEN
+             xv(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(xdn(mgs,lr)*cx(mgs,lr))            ! 
+             xdia(mgs,lr,3) = (xv(mgs,lr)*6.0*cwc1)**(1./3.) 
+             alpha(mgs,lr) = Min(alphamax, c1r*tanh(c2r*(xdia(mgs,lr,3)*1000. - c3r)) + c4r)
+          ENDIF
+          IF ( qx(mgs,lh) .gt. qxmin(lh) .and. cx(mgs,lh) > cxmin ) THEN
+             xv(mgs,lh) = rho0(mgs)*qx(mgs,lh)/(xdn(mgs,lh)*cx(mgs,lh))            ! 
+             xdia(mgs,lh,3) = (xv(mgs,lh)*6.*piinv)**(1./3.) ! mwfac*xdia(mgs,lh,1) ! (xv(mgs,lh)*cwc0*6.0)**(1./3.)
+             alpha(mgs,lh) = Min(alphamax, c1h*tanh(c2h*(xdia(mgs,lh,3)*1000. - c3h)) + c4h)
+          ENDIF
+!        alpha(:,lr) = 0. ! 10.
+!        alpha(:,lh) = 0. ! 10.
+          IF ( lhl > 0 ) THEN
+          IF ( qx(mgs,lhl) .gt. qxmin(lhl) .and. cx(mgs,lhl) > cxmin ) THEN
+             xv(mgs,lhl) = rho0(mgs)*qx(mgs,lhl)/(xdn(mgs,lhl)*cx(mgs,lhl))            ! 
+             xdia(mgs,lhl,3) = (xv(mgs,lhl)*6.*piinv)**(1./3.)
+             IF ( xdia(mgs,lhl,3) < 0.008 ) THEN
+               alpha(mgs,lhl) = Min(alphamax, c1hl*tanh(c2hl*(xdia(mgs,lhl,3)*1000. - c3hl)) + c4hl)
+             ELSE
+               alpha(mgs,lhl) = Min(alphamax, c5hl*xdia(mgs,lhl,3)*1000. + c6hl)
+             ENDIF
+          ENDIF
+          ENDIF
+        ENDDO
+      ENDIF
 
 
 !
-!  Set density
-!
-      if (ndebugzf .gt. 0 ) write(0,*)  'ZIEGFALL: call setvtz'
+! Set 6th moments
 !
+      IF ( ipconc .ge. 6 .or. lzr > 1) THEN
       
-      call setvtz(ngscnt,qx,qxmin,qxw,cx,rho0,rhovt,xdia,cno,cnostmp,   &
-     &                 xmas,vtxbar,xdn,xvmn,xvmx,xv,cdx,cdxgs,        &
-     &                 ipconc,ndebugzf,ngs,nz,kgs,fadvisc, &
-     &                 cwmasn,cwmasx,cwradn,cnina,cimn,cimx,    &
-     &                 itype1,itype2,temcg,infdo,alpha,ildo,axx,bxx)
-!     &                 itype1,itype2,temcg,infdo,alpha,ildo,axh,bxh,axhl,bxhl)
-
-
-
-!
-! put fall speeds into the x-z arrays
-!
-      DO il = l1,l2
-      do mgs = 1,ngscnt
-       
-       vtmax = 150.0
-
-       
-       IF ( vtxbar(mgs,il,2) .gt. vtxbar(mgs,il,1)  .or. &
-     &      ( vtxbar(mgs,il,1) .gt. vtxbar(mgs,il,3) .and. vtxbar(mgs,il,3) > 0.0) ) THEN
-          
-          
-          
-          vtxbar(mgs,il,1) = Max( vtxbar(mgs,il,1), vtxbar(mgs,il,2) )
-          vtxbar(mgs,il,3) = Max( vtxbar(mgs,il,3), vtxbar(mgs,il,1) )
+      zx(:,:) = 0.0
+      
+!      DO il = lr,lhab
+       DO il = l1,l2
+        
+        IF ( lz(il) .ge. 1 ) THEN
+        
+          DO mgs = 1,ngscnt
+            zx(mgs,il) = Max(an(igs(mgs),jy,kgs(mgs),lz(il)), 0.0)
+          ENDDO
           
-       ENDIF
-
-       
-       IF ( vtxbar(mgs,il,1) .gt. vtmax .or. vtxbar(mgs,il,2) .gt. vtmax .or. &
-     &      vtxbar(mgs,il,3) .gt. vtmax ) THEN
-       
-        vtxbar(mgs,il,1) = Min(vtmax,vtxbar(mgs,il,1) )
-        vtxbar(mgs,il,2) = Min(vtmax,vtxbar(mgs,il,2) )
-        vtxbar(mgs,il,3) = Min(vtmax,vtxbar(mgs,il,3) )
         
-!        call commasmpi_abort()
-       ENDIF
+        ENDIF
+      
+       ENDDO
+      
+      ENDIF
+       
 
 
-       xvt(kgs(mgs),igs(mgs),1,il) = vtxbar(mgs,il,1)
-       xvt(kgs(mgs),igs(mgs),2,il) = vtxbar(mgs,il,2)
-       IF ( infdo .ge. 2 ) THEN
-       xvt(kgs(mgs),igs(mgs),3,il) = vtxbar(mgs,il,3)
-       ELSE
-       xvt(kgs(mgs),igs(mgs),3,il) = 0.0
-       ENDIF
 
-!       xvt(kgs(mgs),igs(mgs),2,il) = xvt(kgs(mgs),igs(mgs),1,il)
+       
+!  Find shape parameter rain
 
-      enddo
-      ENDDO
 
+     IF ( lz(lr) > 1 .and. (ildo == 0 .or. ildo == lr ) .and. imurain == 3  ) THEN ! { RAIN SHAPE PARAM
+          il = lr
+          DO mgs = 1,ngscnt
+         
+         IF ( iresetmoments == 1 .or. iresetmoments == il  ) THEN
+!         IF (  .false. .and. zx(mgs,lr) <= zxmin ) THEN
+         IF ( zx(mgs,lr) <= zxmin ) THEN
+           qx(mgs,lr) = 0.0
+           cx(mgs,lr) = 0.0
+           an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),lr)
+           an(igs(mgs),jgs,kgs(mgs),lr) = qx(mgs,lr)
+           an(igs(mgs),jgs,kgs(mgs),ln(lr)) = cx(mgs,lr)
+!         ELSEIF ( zx(mgs,lr) <= 0.0 .and. cx(mgs,lr) > 0.0 .and. qx(mgs,il) .gt. qxmin(il)) THEN
+!           write(91,*) 'ZF: overdepletion of Zr: z,c,q = ',zx(mgs,il),cx(mgs,il),qx(mgs,il)
+         ELSEIF ( cx(mgs,lr) <= cxmin ) THEN
+           zx(mgs,lr) = 0.0
+           qx(mgs,lr) = 0.0
+           an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),lr)
+           an(igs(mgs),jgs,kgs(mgs),lr) = qx(mgs,lr)
+           an(igs(mgs),jgs,kgs(mgs),lz(lr)) = zx(mgs,lr)
+         ENDIF
+         ENDIF
+         
+          
+         
+         IF ( qx(mgs,lr) .gt. qxmin(lr) ) THEN
 
-      if (ndebugzf .gt. 0 ) write(0,*)  'ZIEGFALL: COPIED FALL SPEEDS'
+        xv(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(xdn(mgs,lr)*Max(1.0e-11,cx(mgs,lr)))
+        IF ( xv(mgs,lr) .gt. xvmx(lr) ) THEN
+!          tmp = cx(mgs,lr)
+!          xv(mgs,lr) = xvmx(lr)
+!          cx(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(xvmx(lr)*xdn(mgs,lr))
+!          an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
+!          IF ( tmp < cx(mgs,il) ) THEN ! breakup
+!             g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
+!!             zx(mgs,lr) = zx(mgs,lr) + g1*(rho0(mgs)/(1000.))**2*( (qx(mgs,il)/tmp)**2 * (tmp-cx(mgs,il)) )
+!!             an(igs(mgs),jgs,kgs(mgs),lz(lr)) = zx(mgs,lr)
+!          ENDIF
+        ELSEIF ( xv(mgs,lr) .lt. xvmn(lr) ) THEN
+          xv(mgs,lr) = xvmn(lr)
+          cx(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(xvmn(lr)*xdn(mgs,lr))
+          an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
+        ENDIF
 
+          IF ( zx(mgs,il) > 0.0 .and. cx(mgs,il) <= 0.0 ) THEN
+!  have mass and reflectivity but no concentration, so set concentration, using default alpha
+            g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
+            z   = zx(mgs,il)
+            qr  = qx(mgs,il)
+
+            cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/(z*1000.*1000)
+            an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
+
+           ELSEIF ( zx(mgs,il) <= 0.0 .and. cx(mgs,il) > 0.0 ) THEN
+!  have mass and concentration but no reflectivity, so set reflectivity, using default alpha
+            g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
+            chw = cx(mgs,il)
+            qr  = qx(mgs,il)
+
+!            xv(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(1000.*Max(1.0e-9,cx(mgs,lr)))
+!            vr = xv(mgs,lr)
+
+!             z  = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/((alpha(mgs,lr)+1.0)*pi**2)
+!             zx(mgs,il) = z
+!             an(igs(mgs),jy,kgs(mgs),lz(il)) = z
+
+            zx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/(xdn(mgs,lr)**2*chw)
+            an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
+
+           ELSEIF ( zx(mgs,il) <= 0.0 .and. cx(mgs,il) <= 0.0 ) THEN
+!   How did this happen?
+         ! set values according to dBZ of -10, or Z = 0.1
+!              write(91,*) 'alpha = ',alpha(mgs,il)
+             IF ( qx(mgs,il) < 1.e-8 ) THEN
+             qx(mgs,il) = 0.0
+             an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),il)
+             an(igs(mgs),jgs,kgs(mgs),il) = qx(mgs,il)
+             ELSE
+!              0.1 = 1.e18*0.224*an(ix,jy,kz,lzh)*(hwdn/rwdn)**2
+               zx(mgs,il) = 1.e-19/0.224*(xdn0(lr)/xdn0(il))**2
+               an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
+               
+               g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
+               z   = zx(mgs,il)
+               qr  = qx(mgs,il)
+               cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/(z*1000.*1000)
+               an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
+             ENDIF
+          ENDIF
+          
+          IF ( zx(mgs,lr) > 0.0 ) THEN
+            xv(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(1000.*Max(1.0e-9,cx(mgs,lr)))
+            vr = xv(mgs,lr)
+!            z = 36.*(alpha(kz)+2.0)*a(ix,jy,kz,lnr)*vr**2/((alpha(kz)+1.0)*pi**2)
+           qr = qx(mgs,lr)
+           nrx = cx(mgs,lr)
+           z = zx(mgs,lr)
+
+!           xv = (db(1,kz)*a(1,1,kz,lr))**2/(a(1,1,kz,lnr))
+!           rd = z*(pi/6.*1000.)**2/xv
+
+! determine shape parameter alpha by iteration
+           IF ( z .gt. 0.0 ) THEN
+!           alpha(mgs,lr) = 3.
+           alp = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/(z*pi**2) - 1.
+           DO i = 1,20
+!            IF ( 100.*Abs(alp - alpha(mgs,lr))/Abs(alpha(mgs,lr)) .lt. 1. ) EXIT
+            IF ( Abs(alp - alpha(mgs,lr)) .lt. 0.01 ) EXIT
+             alpha(mgs,lr) = Max( rnumin, Min( rnumax, alp ) )
+           alp = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/(z*pi**2) - 1.
+!           write(0,*) 'i,alp = ',i,alp
+             alp = Max( rnumin, Min( rnumax, alp ) )
+           ENDDO
+!           write(0,*) 'kz, alp, alpha(kz) = ',kz,alp,alpha(mgs,lr),qr*1000,z*1.e18,vr,nrx
+
+
+! check for artificial breakup (rain larger than allowed max size)
+        IF (  xv(mgs,il) .gt. xvmx(il) ) THEN
+          tmp = cx(mgs,il)
+          xv(mgs,il) = Min( xvmx(il), Max( xvmn(il),xv(mgs,il) ) )
+          xmas(mgs,il) = xv(mgs,il)*xdn(mgs,il)
+          cx(mgs,il) = rho0(mgs)*qx(mgs,il)/(xmas(mgs,il))
+          IF ( tmp < cx(mgs,il) ) THEN ! breakup
+
+            g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
+            zx(mgs,il) = zx(mgs,il) + g1*(rho0(mgs)/xdn(mgs,il))**2*( (qx(mgs,il)/tmp)**2 * (tmp-cx(mgs,il)) )
+            an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
+
+           vr = xv(mgs,lr)
+           qr = qx(mgs,lr)
+           nrx = cx(mgs,lr)
+           z = zx(mgs,lr)
+
+
+! determine shape parameter alpha by iteration
+           alp = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/(z*pi**2) - 1.
+           DO i = 1,20
+            IF ( Abs(alp - alpha(mgs,lr)) .lt. 0.01 ) EXIT
+             alpha(mgs,lr) = Max( rnumin, Min( rnumax, alp ) )
+           alp = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/(z*pi**2) - 1.
+             alp = Max( rnumin, Min( rnumax, alp ) )
+           ENDDO
 
+            
+          ENDIF
+        ENDIF
 
- 9998 continue
+!
+! Check whether the shape parameter is at or less than the minimum, and if it is, reset the 
+! concentration or reflectivity to match (prevents reflectivity from being out of balance with Q and N)
+!
+!           IF ( alpha(mgs,il) <= rnumin .or. alp == rnumin .or. alp == rnumax ) THEN
+           IF ( .true. .and. (alpha(mgs,il) <= rnumin .or. alp == rnumin .or. alp == rnumax) ) THEN
 
-      if (ndebugzf .gt. 0 ) write(0,*)  'ZIEGFALL: DONE WITH LOOP'
+            IF ( rescale_high_alpha .and. alp >= rnumax - 0.01  ) THEN  ! reset c at high alpha to prevent growth in Z
+              g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
+              cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/z*(1./(xdn(mgs,il)))**2
+              an(igs(mgs),jy,kgs(mgs),ln(il)) = cx(mgs,il)
+            
+            ELSEIF ( rescale_low_alphar .and. alp <= rnumin ) THEN
 
-      if ( kz .gt. nz-1 ) then
-        go to 1200
+             z  = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/((alpha(mgs,lr)+1.0)*pi**2)
+             zx(mgs,il) = z
+             an(igs(mgs),jy,kgs(mgs),lz(il)) = z
+             
+             ENDIF
+           ENDIF
+
+           ENDIF
+          ENDIF
+           
+          ELSE
+          
+           zx(mgs,lr) = 0.0
+           cx(mgs,lr) = 0.0
+           an(igs(mgs),jgs,kgs(mgs),ln(lr)) = cx(mgs,lr)
+           an(igs(mgs),jgs,kgs(mgs),lz(lr)) = zx(mgs,lr)
+          
+          ENDIF
+          
+          ENDDO
+        ENDIF ! }
+        
+
+      IF ( ipconc .ge. 6 ) THEN
+
+!  Find shape parameters for graupel,hail
+
+        DO il = lr,lhab
+        
+        IF ( lz(il) .gt. 1 .and. (ildo == 0 .or. ildo == il ) .and. ( .not. ( il == lr .and. imurain == 3 )) ) THEN
+        
+        DO mgs = 1,ngscnt
+
+         IF ( iresetmoments == 1 .or. iresetmoments == il  .or. iresetmoments == -1 ) THEN
+         IF ( zx(mgs,il) <= zxmin ) THEN !  .and. qx(mgs,il) > 0.05e-3 ) THEN
+           qx(mgs,il) = 0.0
+           cx(mgs,il) = 0.0
+           an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),il)
+           an(igs(mgs),jgs,kgs(mgs),il) = qx(mgs,il)
+           an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
+         ELSEIF ( iresetmoments == -1 .and. qx(mgs,il) < qxmin(il) ) THEN
+           zx(mgs,il) = 0.0
+           cx(mgs,il) = 0.0
+           an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),il)
+
+           qx(mgs,il) = 0.0
+           an(igs(mgs),jgs,kgs(mgs),il) = qx(mgs,il)
+           an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
+           an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
+         
+         ELSEIF ( cx(mgs,il) <= cxmin .and. iresetmoments /= -1 ) THEN !  .and. qx(mgs,il) > 0.05e-3  ) THEN
+!!            write(91,*) 'cx=0; qx,zx = ',1000.*qx(mgs,il),1.e18*zx(mgs,il)
+           zx(mgs,il) = 0.0
+           qx(mgs,il) = 0.0
+           an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),il)
+           an(igs(mgs),jgs,kgs(mgs),il) = qx(mgs,il)
+           an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
+         ENDIF
+         ENDIF
+
+         IF (  zx(mgs,il) <= zxmin .and. cx(mgs,il) <= cxmin ) THEN
+           zx(mgs,il) = 0.0
+           cx(mgs,il) = 0.0
+           an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),il)
+           qx(mgs,il) = 0.0
+           an(igs(mgs),jgs,kgs(mgs),il) = qx(mgs,il)
+           an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
+           an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
+         ENDIF
+
+         IF ( qx(mgs,il) .gt. qxmin(il) ) THEN
+
+        xv(mgs,il) = rho0(mgs)*qx(mgs,il)/(xdn(mgs,il)*Max(1.0e-9,cx(mgs,il)))
+        xmas(mgs,il) = xv(mgs,il)*xdn(mgs,il)
+
+        IF ( xv(mgs,il) .lt. xvmn(il)  ) THEN
+!          tmp = cx(mgs,il)
+          xv(mgs,il) = Min( xvmx(il), Max( xvmn(il),xv(mgs,il) ) )
+          xmas(mgs,il) = xv(mgs,il)*xdn(mgs,il)
+          cx(mgs,il) = rho0(mgs)*qx(mgs,il)/(xmas(mgs,il))
+!          IF ( tmp < cx(mgs,il) ) THEN ! breakup
+!            g1 = 36.*(6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
+!     &            ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il))*pi**2)
+!             zx(mgs,il) = zx(mgs,il) + g1*(rho0(mgs)/xdn(mgs,il))**2*( (qx(mgs,il)/tmp)**2 * (tmp-cx(mgs,il)) )
+!             an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
+!            
+!          ENDIF
+        ENDIF
+
+          IF ( zx(mgs,il) > 0.0 .and. cx(mgs,il) <= 0.0 ) THEN
+!  have mass and reflectivity but no concentration, so set concentration, using default alpha
+            g1 = (6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
+     &            ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il)))
+            z   = zx(mgs,il)
+            qr  = qx(mgs,il)
+            cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(6*qr)**2/(z*(pi*xdn(mgs,il))**2)
+            an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
+
+           ELSEIF ( zx(mgs,il) <= zxmin .and. cx(mgs,il) > cxmin ) THEN
+!  have mass and concentration but no reflectivity, so set reflectivity, using default alpha
+            g1 = (6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
+     &            ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il)))
+            chw = cx(mgs,il)
+            qr  = qx(mgs,il)
+!            zx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/chw
+            zx(mgs,il) = Min(zxmin*1.1, g1*dn(igs(mgs),jy,kgs(mgs))**2*(6*qr)**2/(chw*(pi*xdn(mgs,il))**2) )
+            an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
+           ELSEIF ( zx(mgs,il) <= 0.0 .and. cx(mgs,il) <= 0.0 ) THEN
+!   How did this happen?
+!              write(91,*) 'ziegfall: something screwy with moments: il = ',il
+!              write(91,*) 'q,n,z = ', 1.e3*qx(mgs,il),cx(mgs,il),zx(mgs,il)
+!              write(91,*) 'alpha = ',alpha(mgs,il)
+
+             IF ( qx(mgs,il) < 1.e-8 ) THEN
+             qx(mgs,il) = 0.0
+             an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),il)
+             an(igs(mgs),jgs,kgs(mgs),il) = qx(mgs,il)
+             ELSE
+!              write(0,*) 'alpha = ',alpha(mgs,il)
+         ! set values according to dBZ of -10
+!              0.1 = 1.e18*0.224*an(ix,jy,kz,lzh)*(hwdn/rwdn)**2
+               zx(mgs,il) = 1.e-19/0.224*(xdn0(lr)/xdn0(il))**2
+               an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
+               
+               g1 = (6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
+     &            ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il)))
+               z   = zx(mgs,il)
+               qr  = qx(mgs,il)
+               cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(6*qr)**2/(z*(pi*xdn(mgs,il))**2)
+               an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
+            ENDIF
+          ENDIF
+         ENDIF
+
+        IF ( qx(mgs,il) .gt. qxmin(il) .and. cx(mgs,il) .gt. 0.0 ) THEN
+          chw = cx(mgs,il)
+          qr  = qx(mgs,il)
+          z   = zx(mgs,il)
+
+          IF ( zx(mgs,il) .gt. 0. ) THEN
+           
+!            rd = z*(pi/6.*1000.)**2*chw/(0.224*(dn(igs(mgs),jy,kgs(mgs))*qr)**2)
+            rd = z*(pi/6.*xdn(mgs,il))**2*chw/((dn(igs(mgs),jy,kgs(mgs))*qr)**2)
+
+           alp = (6.+alpha(mgs,il))*(5.0+alpha(mgs,il))*(4.0+alpha(mgs,il))/ &
+     &            ((3.0+alpha(mgs,il))*(2.0+alpha(mgs,il))*rd) - 1.0
+           DO i = 1,10
+            IF ( Abs(alp - alpha(mgs,il)) .lt. 0.01 ) EXIT
+             alpha(mgs,il) = Max( alphamin, Min( alphamax, alp ) )
+             alp = (6.+alpha(mgs,il))*(5.0+alpha(mgs,il))*(4.0+alpha(mgs,il))/ &
+     &            ((3.0+alpha(mgs,il))*(2.0+alpha(mgs,il))*rd) - 1.0
+!           write(0,*) 'i,alp = ',i,alp
+             alp = Max( alphamin, Min( alphamax, alp ) )
+           ENDDO
+
+
+
+! check for artificial breakup (graupel/hail larger than allowed max size)
+        
+        IF ( imaxdiaopt == 1 ) THEN
+          xvbarmax = xvmx(il) 
+        ELSEIF ( imaxdiaopt == 2 ) THEN ! test against maximum mass diameter
+          xvbarmax = xvmx(il) /((3. + alpha(mgs,il))**3/((3. + alpha(mgs,il))*(2. + alpha(mgs,il))*(1. + alpha(mgs,il))))
+        ELSEIF ( imaxdiaopt == 3 ) THEN ! test against mass-weighted diameter
+          xvbarmax = xvmx(il) /((4. + alpha(mgs,il))**3/((3. + alpha(mgs,il))*(2. + alpha(mgs,il))*(1. + alpha(mgs,il))))
+        ENDIF
+        
+        IF (  xv(mgs,il) .gt. xvbarmax ) THEN
+          tmp = cx(mgs,il)
+          xv(mgs,il) = Min( xvbarmax, Max( xvmn(il),xv(mgs,il) ) )
+          xmas(mgs,il) = xv(mgs,il)*xdn(mgs,il)
+          cx(mgs,il) = rho0(mgs)*qx(mgs,il)/(xmas(mgs,il))
+          IF ( tmp < cx(mgs,il) ) THEN ! breakup
+            g1 = 36.*(6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
+     &            ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il))*pi**2)
+             zx(mgs,il) = zx(mgs,il) + g1*(rho0(mgs)/xdn(mgs,il))**2*( (qx(mgs,il)/tmp)**2 * (tmp-cx(mgs,il)) )
+             an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
+
+          chw = cx(mgs,il)
+          qr  = qx(mgs,il)
+          z   = zx(mgs,il)
+
+            rd = z*(pi/6.*xdn(mgs,il))**2*chw/((rho0(mgs)*qr)**2)
+            alp = (6.0+alpha(mgs,il))*(5.0+alpha(mgs,il))*(4.0+alpha(mgs,il))/   &
+     &            ((3.0+alpha(mgs,il))*(2.0+alpha(mgs,il))*rd) - 1.0
+           DO i = 1,10
+             IF ( Abs(alp - alpha(mgs,il)) .lt. 0.01 ) EXIT
+             alpha(mgs,il) = Max( alphamin, Min( alphamax, alp ) )
+             alp = (6.+alpha(mgs,il))*(5.0+alpha(mgs,il))*(4.0+alpha(mgs,il))/   &
+     &            ((3.0+alpha(mgs,il))*(2.0+alpha(mgs,il))*rd) - 1.0
+             alp = Max( alphamin, Min( alphamax, alp ) )
+           ENDDO
+
+            
+          ENDIF
+        ENDIF
+           
+!
+! Check whether the shape parameter is at or less than the minimum, and if it is, reset the 
+! concentration or reflectivity to match (prevents reflectivity from being out of balance with Q and N)
+!
+           IF ( (rescale_low_alpha .or. rescale_high_alpha ) .and.  &
+     &        ( alpha(mgs,il) <= alphamin .or. alp == alphamin .or. alp == alphamax ) ) THEN
+
+             g1 = (6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
+     &            ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il)))
+
+            IF ( rescale_high_alpha .and. alp >= alphamax - 0.01  ) THEN  ! reset c at high alpha to prevent growth in Z
+              cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/z*(6./(pi*xdn(mgs,il)))**2
+              an(igs(mgs),jy,kgs(mgs),ln(il)) = cx(mgs,il)
+            
+            ELSEIF ( rescale_low_alpha .and. alp <= alphamin .and. .not. (il == lh .and. icvhl2h > 0 ) ) THEN
+
+!!             z1 = g1*dn(igs(mgs),jy,kgs(mgs))**2*( 0.224*qr)*qr/chw
+             z1 = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/chw
+             z  = z1*(6./(pi*xdn(mgs,il)))**2
+             zx(mgs,il) = z
+             an(igs(mgs),jy,kgs(mgs),lz(il)) = z
+            ENDIF
+           ENDIF
+          ELSE
+          ENDIF
+        ENDIF
+        ENDDO ! mgs
+        
+        ENDIF ! lz(il) .gt. 1
+        
+        ENDDO ! il
+
+!      CALL cld_cpu('Z-MOMENT-ZFAll')  
+          
+      ENDIF
+
+      IF ( lzhl > 1 ) THEN
+        IF ( lhl .gt. 1 ) THEN
+        
+        ENDIF
+      ENDIF
+
+
+
+!
+!  Set density
+!
+      if (ndebugzf .gt. 0 ) write(0,*)  'ZIEGFALL: call setvtz'
+!
+      
+      call setvtz(ngscnt,qx,qxmin,qxw,cx,rho0,rhovt,xdia,cno,cnostmp,   &
+     &                 xmas,vtxbar,xdn,xvmn,xvmx,xv,cdx,cdxgs,        &
+     &                 ipconc,ndebugzf,ngs,nz,kgs,fadvisc, &
+     &                 cwmasn,cwmasx,cwradn,cnina,cimn,cimx,    &
+     &                 itype1,itype2,temcg,infdo,alpha,ildo,axx,bxx)
+!     &                 itype1,itype2,temcg,infdo,alpha,ildo,axh,bxh,axhl,bxhl)
+
+
+
+!
+! put fall speeds into the x-z arrays
+!
+      DO il = l1,l2
+      do mgs = 1,ngscnt
+       
+       vtmax = 150.0
+
+       
+       IF ( vtxbar(mgs,il,2) .gt. vtxbar(mgs,il,1)  .or. &
+     &      ( vtxbar(mgs,il,1) .gt. vtxbar(mgs,il,3) .and. vtxbar(mgs,il,3) > 0.0) ) THEN
+          
+          
+!          IF ( qx(mgs,il) > 1.e-4 .and.  &
+!     &        .not. ( il == lr .and. 1.e3*xdia(mgs,il,3) > 5.0 ) ) THEN
+!          write(0,*) 'infdo,mgs = ',infdo,lzr,mgs
+!          write(0,*) 'Moment problem with vtxbar for il at i,j,k = ',il,igs(mgs),jy,kgs(mgs)
+!          write(0,*) 'nx,ny,nz,ng = ',nx,ny,nz,nor
+!          write(0,*) 'cwmasn,cwmasx = ',cwmasn,cwmasx
+!          write(0,*) 'vt1,2,3 = ',vtxbar(mgs,il,1),vtxbar(mgs,il,2),vtxbar(mgs,il,3)
+!          write(0,*) 'q,n,d = ', 1.e3*qx(mgs,il),cx(mgs,il),1.e3*xdia(mgs,il,3)
+!          IF ( il .ge. lr  .and. lz(il) > 1 ) write(0,*) 'z = ', zx(mgs,il)
+!          IF ( il .ge. lg .or. il == lr ) THEN
+!            write(0,*) 'alpha = ',alpha(mgs,il)
+!          ENDIF
+!          ENDIF
+          
+          vtxbar(mgs,il,1) = Max( vtxbar(mgs,il,1), vtxbar(mgs,il,2) )
+          vtxbar(mgs,il,3) = Max( vtxbar(mgs,il,3), vtxbar(mgs,il,1) )
+          
+       ENDIF
+
+       
+       IF ( vtxbar(mgs,il,1) .gt. vtmax .or. vtxbar(mgs,il,2) .gt. vtmax .or. &
+     &      vtxbar(mgs,il,3) .gt. vtmax ) THEN
+       
+!        IF ( ndebugzf >= 0 .and.  1.e3*qx(mgs,il) > 0.1 ) THEN
+!          write(0,*) 'infdo = ',infdo
+!          write(0,*) 'Problem with vtxbar for il at i,j,k = ',il,igs(mgs),jy,kgs(mgs)
+!          write(0,*) 'nx,ny,nz,ng = ',nx,ny,nz,nor
+!          write(0,*) 'cwmasn,cwmasx = ',cwmasn,cwmasx
+!          write(0,*) 'vt1,2,3 = ',vtxbar(mgs,il,1),vtxbar(mgs,il,2),vtxbar(mgs,il,3)
+!          write(0,*) 'q,n,d = ', 1.e3*qx(mgs,il),cx(mgs,il),1.e3*xdia(mgs,il,3)
+!          IF ( il .ge. lr  .and. lz(il) > 1 ) write(0,*) 'z = ', zx(mgs,il)
+!          IF ( il .ge. lg ) THEN
+!            write(0,*) 'alpha = ',alpha(mgs,il)
+!          ENDIF
+!        ENDIF
+        vtxbar(mgs,il,1) = Min(vtmax,vtxbar(mgs,il,1) )
+        vtxbar(mgs,il,2) = Min(vtmax,vtxbar(mgs,il,2) )
+        vtxbar(mgs,il,3) = Min(vtmax,vtxbar(mgs,il,3) )
+        
+!        call commasmpi_abort()
+       ENDIF
+
+
+       xvt(kgs(mgs),igs(mgs),1,il) = vtxbar(mgs,il,1)
+       xvt(kgs(mgs),igs(mgs),2,il) = vtxbar(mgs,il,2)
+       IF ( infdo .ge. 2 ) THEN
+       xvt(kgs(mgs),igs(mgs),3,il) = vtxbar(mgs,il,3)
+       ELSE
+       xvt(kgs(mgs),igs(mgs),3,il) = 0.0
+       ENDIF
+
+!       xvt(kgs(mgs),igs(mgs),2,il) = xvt(kgs(mgs),igs(mgs),1,il)
+
+      enddo
+      ENDDO
+
+
+      if (ndebugzf .gt. 0 ) write(0,*)  'ZIEGFALL: COPIED FALL SPEEDS'
+
+
+
+ 9998 continue
+
+      if (ndebugzf .gt. 0 ) write(0,*)  'ZIEGFALL: DONE WITH LOOP'
+
+      if ( kz .gt. nz-1 ) then
+        go to 1200
       else
         nzmpb = kz 
       end if
@@ -7630,6 +8413,8 @@ subroutine radardd02(nx,ny,nz,nor,na,an,temk,         &
              IF ( ipconc .le. 2 ) THEN
                gtmp(ix,kz) = dadr*an(ix,jy,kz,lr)**(0.25)
                dtmp(ix,kz) = zrc*gtmp(ix,kz)**7
+             ELSEIF ( lzr .gt. 1 ) THEN
+               dtmp(ix,kz) = 1e18*an(ix,jy,kz,lzr)
              ELSEIF ( an(ix,jy,kz,lnr) .gt. 1.e-3 ) THEN
                IF ( imurain == 3 ) THEN
                  vr = db(ix,jy,kz)*an(ix,jy,kz,lr)/(1000.*an(ix,jy,kz,lnr))
@@ -7822,7 +8607,7 @@ subroutine radardd02(nx,ny,nz,nor,na,an,temk,         &
 
                ELSE ! new form using a mass relationship m = p d^2 (instead of d^3 -- Cox 1988 QJRMS) so that density depends on size
                     ! p = 0.106214 for m = p v^(2/3)
-                 dnsnow = 0.346159*sqrt(an(ix,jy,kz,lns)/(an(ix,jy,kz,ls)*db(ix,jy,kz)) )
+                 dnsnow = 0.0346159*sqrt(an(ix,jy,kz,lns)/(an(ix,jy,kz,ls)*db(ix,jy,kz)) )
                  IF ( .true. .or. dnsnow < 900. ) THEN
                   gtmp(ix,kz) = 1.e18*323.3226* 0.106214**2*(ksq*an(ix,jy,kz,ls) + &
      &             (1.-ksq)*qxw)*an(ix,jy,kz,ls)*db(ix,jy,kz)**2*gsnow73/         &
@@ -7898,6 +8683,10 @@ subroutine radardd02(nx,ny,nz,nor,na,an,temk,         &
           IF ( izieg .ge. 1 .and. ipconc .ge. 5 ) THEN
 
            ltest = .false.
+           IF ( lzh > 1 ) THEN
+             IF ( an(ix,jy,kz,lzh) > 0.0 .and. an(ix,jy,kz,lh) > qhmin .and. &
+                  an(ix,jy,kz,lnh) >= cxmin ) ltest = .true.
+           ENDIF
            
            IF ( ltest .or. (an(ix,jy,kz,lh) .ge. qhmin .and. an(ix,jy,kz,lnh) .ge. cxmin )) THEN
             
@@ -7943,6 +8732,9 @@ subroutine radardd02(nx,ny,nz,nor,na,an,temk,         &
              ENDIF
              
              IF ( lzh .gt. 1 ) THEN
+              x = (0.224*qh +  0.776*qxw)/an(ix,jy,kz,lh)  ! weighted average of dielectric const
+              dtmph = 1.e18*x*an(ix,jy,kz,lzh)*(hwdn/rwdn)**2
+              dtmp(ix,kz) = dtmp(ix,kz) + dtmph
              ELSE
              g1 = (6.0 + alphah)*(5.0 + alphah)*(4.0 + alphah)/((3.0 + alphah)*(2.0 + alphah)*(1.0 + alphah))
 !             zx = g1*(db(ix,jy,kz)*an(ix,jy,kz,lh))**2/chw
@@ -8015,6 +8807,10 @@ subroutine radardd02(nx,ny,nz,nor,na,an,temk,         &
         IF ( ipconc .ge. 5 ) THEN
 
            ltest = .false.
+           IF ( lzhl > 1 ) THEN
+             IF ( an(ix,jy,kz,lzhl) > 0.0 .and. an(ix,jy,kz,lhl) > qhlmin .and. &
+                  an(ix,jy,kz,lnhl) > 0.0 ) ltest = .true.
+           ENDIF
 
           IF ( ltest .or. ( an(ix,jy,kz,lhl) .ge. qhlmin .and. an(ix,jy,kz,lnhl) .gt. 0.) ) THEN !{
             chl = an(ix,jy,kz,lnhl)
@@ -8038,6 +8834,9 @@ subroutine radardd02(nx,ny,nz,nor,na,an,temk,         &
              ENDIF
             
              IF ( lzhl .gt. 1 ) THEN !{
+              x = (0.224*an(ix,jy,kz,lhl) +  0.776*qxw)/an(ix,jy,kz,lhl)  ! weighted average of dielectric const
+              dtmphl = 1.e18*x*an(ix,jy,kz,lzhl)*(hldn/rwdn)**2
+              dtmp(ix,kz) = dtmp(ix,kz) + dtmphl
              ELSE !}
 
              g1 = (6.0 + alphahl)*(5.0 + alphahl)*(4.0 + alphahl)/((3.0 + alphahl)*(2.0 + alphahl)*(1.0 + alphahl))
@@ -8118,8 +8917,7 @@ subroutine radardd02(nx,ny,nz,nor,na,an,temk,         &
 !          write(0,*) 'Hail,snow c: ',an(ix,jy,kz,lnh),an(ix,jy,kz,lns)
 !          write(0,*) 'dtmps,dtmph = ',dtmps,dtmph
 !         ENDIF
-
-        IF ( ndebug>1 .and. .not. dtmp(ix,kz) .lt. 1.e30 .or. dbz(ix,jy,kz) > 190.0 ) THEN
+        IF ( .not. dtmp(ix,kz) .lt. 1.e30 .or. dbz(ix,jy,kz) > 190.0 ) THEN
 !        IF ( ix == 31 .and. kz == 20 .and. jy == 23 ) THEN
 !          write(0,*) 'my_rank = ',my_rank
           write(0,*) 'ix,jy,kz = ',ix,jy,kz
@@ -8190,6 +8988,8 @@ END subroutine radardd02
 ! #####################################################################
 !
 ! Subroutine for explicit cloud condensation and droplet nucleation
+!
+! 11/30/2022: Fixed droplet evaporation heating term for CM1 eqtset=2 (was only doing eqtset=1)
 !
    SUBROUTINE NUCOND    &
      &  (nx,ny,nz,na,jyslab & 
@@ -8543,6 +9343,7 @@ SUBROUTINE NUCOND    &
       
       qx(:,:) = 0.0
       cx(:,:) = 0.0
+      zx(:,:) = 0.0
 
       xv(:,:) = 0.0
       xmas(:,:) = 0.0
@@ -8602,6 +9403,7 @@ SUBROUTINE NUCOND    &
         ELSE ! equation set 2 in cm1
           tmp = qx(mgs,li)+qx(mgs,ls)+qx(mgs,lh)
           IF ( lhl > 1 ) tmp = tmp + qx(mgs,lhl)
+          IF ( lf > 1 ) tmp = tmp + qx(mgs,lf)
           cvm = cv+cvv*qx(mgs,lv)+cpl*(qx(mgs,lc)+qx(mgs,lr))   &
                                   +cpigb*(tmp)
           cpm = cp+cpv*qx(mgs,lv)+cpl*(qx(mgs,lc)+qx(mgs,lr))   &
@@ -8716,6 +9518,237 @@ SUBROUTINE NUCOND    &
       ventrxn(:) = ventrn
       
 
+!  Find shape parameter rain
+
+      IF ( lzr > 1 .and. rcond == 2 ) THEN ! { RAIN SHAPE PARAM
+      DO mgs = 1,ngscnt
+         zx(mgs,lr) = Max(an(igs(mgs),jy,kgs(mgs),lzr), 0.0)
+      ENDDO
+
+!      CALL cld_cpu('Z-MOMENT-1r2')
+          il = lr
+          DO mgs = 1,ngscnt
+
+         IF ( zx(mgs,il) <= 0.0 ) THEN
+           qx(mgs,lv) = qx(mgs,lv) + qx(mgs,il)
+           qx(mgs,il) = 0.0
+           cx(mgs,il) = 0.0
+           an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),il)
+           an(igs(mgs),jgs,kgs(mgs),il) = qx(mgs,il)
+           an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
+         ELSEIF ( cx(mgs,il) <= 0.0 ) THEN
+           qx(mgs,lv) = qx(mgs,lv) + qx(mgs,il)
+           zx(mgs,il) = 0.0
+           qx(mgs,il) = 0.0
+           an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),il)
+           an(igs(mgs),jgs,kgs(mgs),il) = qx(mgs,il)
+           an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
+         ENDIF
+
+         IF ( qx(mgs,lr) .gt. qxmin(lr) ) THEN
+
+          xv(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(xdn(mgs,lr)*Max(1.0e-11,cx(mgs,lr)))
+          IF ( xv(mgs,lr) .gt. xvmx(lr) ) THEN
+            xv(mgs,lr) = xvmx(lr)
+            cx(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(xvmx(lr)*xdn(mgs,lr))
+          ELSEIF ( xv(mgs,lr) .lt. xvmn(lr) ) THEN
+            xv(mgs,lr) = xvmn(lr)
+            cx(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(xvmn(lr)*xdn(mgs,lr))
+          ENDIF
+
+          IF ( zx(mgs,il) > 0.0 .and. cx(mgs,il) <= 0.0 ) THEN
+!  have mass and reflectivity but no concentration, so set concentration, using default alpha
+            IF ( imurain == 3 ) THEN
+            g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
+            z1   = zx(mgs,il)
+            qr  = qx(mgs,il)
+            cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/(z1*1000.*1000)
+            ELSE
+            g1 = 36.*(6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
+     &            ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il))*pi**2)
+            z1   = zx(mgs,il)
+            qr  = qx(mgs,il)
+            cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/(z1*1000.*1000)
+            
+            ENDIF
+!            an(igs(mgs),jgs,kgs(mgs),ln(il)) = zx(mgs,il)
+           ELSEIF ( zx(mgs,il) <= 0.0 .and. cx(mgs,il) > 0.0 ) THEN
+!  have mass and concentration but no reflectivity, so set reflectivity, using default alpha
+            IF ( imurain == 3 ) THEN
+            g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
+            chw = cx(mgs,il)
+            qr  = qx(mgs,il)
+            zx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/(chw*1000.*1000)
+            ELSE
+            g1 = 36.*(6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
+     &            ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il))*pi**2)
+            chw = cx(mgs,il)
+            qr  = qx(mgs,il)
+            zx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/(chw*1000.*1000)
+            
+            ENDIF
+
+           ELSEIF ( zx(mgs,il) <= 0.0 .and. cx(mgs,il) <= 0.0 ) THEN
+!   How did this happen?
+         ! set values according to dBZ of -10, or Z = 0.1
+!              0.1 = 1.e18*0.224*an(ix,jy,kz,lzh)*(hwdn/rwdn)**2
+               zx(mgs,il) = 1.e-19/0.224*(xdn0(lr)/xdn0(il))**2
+               an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
+               
+              IF ( imurain == 3 ) THEN
+               g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
+               z1   = zx(mgs,il)
+               qr  = qx(mgs,il)
+               cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/(z1*1000.*1000)
+               an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
+              ELSEIF ( imurain == 1 ) THEN
+               g1 = (6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
+     &            ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il)))
+               z1   = zx(mgs,il)
+               qr  = qx(mgs,il)
+               cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(6*qr)**2/(z1*(pi*xdn(mgs,il))**2)
+               an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
+              
+              ENDIF
+          ENDIF
+        
+          IF ( zx(mgs,lr) > 0.0 ) THEN
+            vr = rho0(mgs)*qx(mgs,lr)/(1000.*cx(mgs,lr))
+!            z1 = 36.*(alpha(kz)+2.0)*a(ix,jy,kz,lnr)*vr**2/((alpha(kz)+1.0)*pi**2)
+           qr = qx(mgs,lr)
+           nrx = cx(mgs,lr)
+           z1 = zx(mgs,lr)
+
+!           xv = (db(1,kz)*a(1,1,kz,lr))**2/(a(1,1,kz,lnr))
+!           rd = z1*(pi/6.*1000.)**2/xv
+
+
+! determine shape parameter alpha by iteration
+        IF ( z1 .gt. 0.0 ) THEN
+
+          IF ( imurain == 3 ) THEN
+           alp = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/(z1*pi**2) - 1.
+!           write(0,*) 'kz, alp, alpha(kz) = ',kz,alp,alpha(kz),rd,z1,xv
+           DO i = 1,20
+            IF ( Abs(alp - alpha(mgs,lr)) .lt. 0.01 ) EXIT
+             alpha(mgs,lr) = Max( rnumin, Min( rnumax, alp ) )
+           alp = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/(z1*pi**2) - 1.
+!           write(0,*) 'i,alp = ',i,alp
+             alp = Max( rnumin, Min( rnumax, alp ) )
+           ENDDO
+
+         ELSE ! imurain == 1
+            g1 = 36.*(6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
+     &            ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il))*pi**2)
+
+            rd1 = z1*(pi/6.*xdn(mgs,il))**2*nrx/(rho0(mgs)*qr)**2
+
+           alp = (6.+alpha(mgs,il))*(5.0+alpha(mgs,il))*(4.0+alpha(mgs,il))/ &
+     &            ((3.0+alpha(mgs,il))*(2.0+alpha(mgs,il))*rd1) - 1.0
+
+           DO i = 1,10
+            IF ( Abs(alp - alpha(mgs,il)) .lt. 0.01 ) EXIT
+             alpha(mgs,il) = Max( alphamin, Min( alphamax, alp ) )
+
+             alp = (6.+alpha(mgs,il))*(5.0+alpha(mgs,il))*(4.0+alpha(mgs,il))/ &
+     &            ((3.0+alpha(mgs,il))*(2.0+alpha(mgs,il))*rd1) - 1.0
+
+             alp = Max( alphamin, Min( alphamax, alp ) )
+           ENDDO
+
+         
+         ENDIF
+!         ENDIF
+
+!
+! Check whether the shape parameter is at or less than the minimum, and if it is, reset the 
+! concentration or reflectivity to match (prevents reflectivity from being out of balance with Q and N)
+!
+          IF ( imurain == 3 ) THEN
+           IF ( .true. .and. (alpha(mgs,il) <= rnumin .or. alp == rnumin .or. alp == rnumax) ) THEN
+
+             IF ( rescale_high_alpha .and. alp >= rnumax - 0.01  ) THEN  ! reset c at high alpha to prevent growth in Z
+               g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
+               cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/z1*(1./(xdn(mgs,il)))**2
+               an(igs(mgs),jy,kgs(mgs),ln(il)) = cx(mgs,il)
+            
+             ELSEIF ( rescale_low_alphar .and. alp <= rnumin ) THEN
+
+              z1  = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/((alpha(mgs,lr)+1.0)*pi**2)
+              zx(mgs,il) = z1
+             ENDIF
+           ENDIF
+           
+          ELSEIF ( imurain == 1 ) THEN
+          
+             g1 = (6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
+     &            ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il)))
+
+           IF ( (rescale_low_alpha .or. rescale_high_alpha ) .and.  &
+     &          ( alpha(mgs,il) <= alphamin .or. alp == alphamin .or. alp == alphamax ) ) THEN
+
+
+
+            IF ( rescale_high_alpha .and. alp >= alphamax - 0.01  ) THEN  ! reset c at high alpha to prevent growth in Z
+              cx(mgs,il) = g1*rho0(mgs)**2*(qr)*qr/zx(mgs,lr)*(6./(pi*xdn(mgs,il)))**2
+              an(igs(mgs),jy,kgs(mgs),ln(il)) = cx(mgs,il)
+            
+            ELSEIF ( rescale_low_alpha .and. alp <= alphamin ) THEN ! alpha = alphamin, so reset Z to prevent growth in C
+             z1 = g1*rho0(mgs)**2*(qr)*qr/nrx
+             z2  = z1*(6./(pi*xdn(mgs,il)))**2
+             zx(mgs,il) = z2
+             an(igs(mgs),jy,kgs(mgs),lz(il)) = z2
+            ENDIF
+          ENDIF ! imurain
+
+          ENDIF ! z > 0
+
+           tmp = alpha(mgs,lr) + 4./3.
+           i = Int(dgami*(tmp))
+           del = tmp - dgam*i
+           x = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
+
+           tmp = alpha(mgs,lr) + 1.
+           i = Int(dgami*(tmp))
+           del = tmp - dgam*i
+           y = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
+
+!           ventrx(mgs) = Gamma(alpha(mgs,lr) + 4./3.)/(alpha(mgs,lr) + 1.)**(1./3.)/Gamma(alpha(mgs,lr) + 1.)
+           ventrx(mgs) = x/(y*(alpha(mgs,lr) + 1.)**(1./3.))
+
+           IF ( imurain == 3 .and. izwisventr == 2 ) THEN
+
+           tmp = alpha(mgs,lr) + 1.5 + br/6.
+           i = Int(dgami*(tmp))
+           del = tmp - dgam*i
+           x = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
+
+!           ventrx(mgs) = Gamma(alpha(mgs,lr) + 1.5 + br/6.)/Gamma(alpha(mgs,lr) + 1.)
+           ventrxn(mgs) = x/(y*(alpha(mgs,lr) + 1.)**((1.+br)/6. + 1./3.))
+           
+           ELSEIF ( imurain == 1 .and.  iferwisventr == 2 ) THEN
+
+           tmp = alpha(mgs,lr) + 2.5 + br/2.
+           i = Int(dgami*(tmp))
+           del = tmp - dgam*i
+           x = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
+
+!           ventrx(mgs) = Gamma(alpha(mgs,lr) + 1.5 + br/6.)/Gamma(alpha(mgs,lr) + 1.)
+           ventrxn(mgs) = x/y
+           
+           
+           ENDIF
+
+           
+           ENDIF
+          ENDIF
+          
+          ENDIF
+          
+          ENDDO
+!        CALL cld_cpu('Z-MOMENT-1r2')  
+        ENDIF ! }
+
 
 !       write(0,*) 'NUCOND: Set ssf variables, ssmxinit =',ssmxinit
       ssmx = 0.0
@@ -8868,9 +9901,9 @@ SUBROUTINE NUCOND    &
       QEVAP= Min( qx(mgs,lc), R1*(qss(mgs)-qvap(mgs)) )
 
 
-      IF ( qx(mgs,lc) .LT. QEVAP ) THEN ! GO TO 63
+      IF ( qx(mgs,lc) <= QEVAP ) THEN ! GO TO 63
         qwvp(mgs) = qwvp(mgs) + qx(mgs,lc)
-        thetap(mgs) = thetap(mgs) - felv(mgs)*qx(mgs,lc)/(cp*pi0(mgs))
+        thetap(mgs) = thetap(mgs) - felvcp(mgs)*qx(mgs,lc)/(pi0(mgs))
         IF ( io_flag .and. nxtra > 1 ) THEN
            axtra(igs(mgs),jy,kgs(mgs),1) = -qx(mgs,lc)/dtp
         ENDIF
@@ -8878,13 +9911,13 @@ SUBROUTINE NUCOND    &
         IF ( restoreccn ) THEN
           IF ( irenuc <= 2 ) THEN
              IF ( .not. invertccn ) THEN
-              ccnc(mgs) = Max( ccnc(mgs), Min( qccn*rho0(mgs), ccnc(mgs) + cx(mgs,lc) ) )
+              ccnc(mgs) = Max( ccnc(mgs), Min( qccn*rho0(mgs), ccnc(mgs) + restoreccnfrac*cx(mgs,lc) ) )
              ELSE
-              ccnc(mgs) = ccnc(mgs) + cx(mgs,lc)
+              ccnc(mgs) = ccnc(mgs) + restoreccnfrac*cx(mgs,lc)
              ENDIF
           ENDIF
           IF ( lccna > 1 ) THEN
-            ccna(mgs) = ccna(mgs) - cx(mgs,lc)
+            ccna(mgs) = ccna(mgs) - restoreccnfrac*cx(mgs,lc)
           ENDIF
         ENDIF
         cx(mgs,lc) = 0.
@@ -8898,13 +9931,13 @@ SUBROUTINE NUCOND    &
 !              ccnc(mgs) = Max( ccnc(mgs), Min( qccn*rho0(mgs), ccnc(mgs) + cx(mgs,lc) ) )
 !              ccnc(mgs) = ccnc(mgs) + cx(mgs,lc)
               IF ( .not. invertccn ) THEN
-               ccnc(mgs) = Max( ccnc(mgs), Min( qccn*rho0(mgs), ccnc(mgs) + cx(mgs,lc) ) )
+               ccnc(mgs) = Max( ccnc(mgs), Min( qccn*rho0(mgs), ccnc(mgs) + restoreccnfrac*cx(mgs,lc) ) )
               ELSE
-               ccnc(mgs) = ccnc(mgs) + cx(mgs,lc)
+               ccnc(mgs) = ccnc(mgs) + restoreccnfrac*cx(mgs,lc)
               ENDIF
             ENDIF
             IF ( lccna > 1 ) THEN
-              ccna(mgs) = ccna(mgs) - cx(mgs,lc)
+              ccna(mgs) = ccna(mgs) - restoreccnfrac*cx(mgs,lc)
             ENDIF
           ENDIF
           cx(mgs,lc) = 0.
@@ -8915,18 +9948,18 @@ SUBROUTINE NUCOND    &
  !             ccnc(mgs) = Max( ccnc(mgs), Min( qccn*rho0(mgs), ccnc(mgs) + tmp ) )
 !              ccnc(mgs) = ccnc(mgs) + tmp
               IF ( .not. invertccn ) THEN
-               ccnc(mgs) = Max( ccnc(mgs), Min( qccn*rho0(mgs), ccnc(mgs) + tmp ) )
+               ccnc(mgs) = Max( ccnc(mgs), Min( qccn*rho0(mgs), ccnc(mgs) + restoreccnfrac*tmp ) )
               ELSE
-               ccnc(mgs) = ccnc(mgs) + tmp
+               ccnc(mgs) = ccnc(mgs) + restoreccnfrac*tmp
               ENDIF
             ENDIF
             IF ( lccna > 1 ) THEN
-              ccna(mgs) = ccna(mgs) - tmp
+              ccna(mgs) = ccna(mgs) - restoreccnfrac*tmp
             ENDIF
           ENDIF
           cx(mgs,lc) = cx(mgs,lc) - tmp
         ENDIF
-        thetap(mgs) = thetap(mgs) - felv(mgs)*QEVAP/(CP*pi0(mgs))
+        thetap(mgs) = thetap(mgs) - felvcp(mgs)*QEVAP/(pi0(mgs))
         IF ( io_flag .and. nxtra > 1 ) THEN
            axtra(igs(mgs),jy,kgs(mgs),1) = -QEVAP/dtp
         ENDIF
@@ -9208,6 +10241,19 @@ SUBROUTINE NUCOND    &
 !!     &                 dx*dy*dz3d(igs(mgs),jy,kgs(mgs))
 
 
+        IF ( lzr > 1 .and. rcond == 2 .and. qx(mgs,lr) .gt. qxmin(lr)   &
+     &       .and. cx(mgs,lr) .gt. 1.e-9 ) THEN
+          tmp = qx(mgs,lr)/cx(mgs,lr)
+          IF ( imurain == 3 ) THEN
+          g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
+          ELSE
+            g1 = 36.*(6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
+     &            ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il))*pi**2)
+          
+          ENDIF
+          zx(mgs,lr) = zx(mgs,lr) + g1*(rho0(mgs)/(xdn(mgs,lr)))**2*( 2.*( tmp ) * dqr )
+        ENDIF
+
         theta(mgs) = thetap(mgs) + theta0(mgs)
         temg(mgs) = theta(mgs)*f1
         ltemq = (temg(mgs)-163.15)/fqsat+1.5
@@ -9468,15 +10514,143 @@ SUBROUTINE NUCOND    &
        
        ccnc(mgs) = Max(0.0, ccnc(mgs) - cn(mgs))
 
-      ELSEIF ( irenuc == 5 ) THEN !} { 
-
-      ! modification of Phillips Donner Garner 2007
+      ELSEIF ( irenuc == 3 ) THEN !} { 
+      ! Phillips Donner Garner 2007
 !      if (ndebug .gt. 0) write(0,*) 'ICEZVD_DR:  Cloud reNucleation, wvel = ',wvel(mgs)
-!      CN(mgs) =  Min( 0.91*cnuc(mgs), CCNE0*cnuc(mgs)**(2./(2.+cck))*Max(0.0,wvel(mgs))**cnexp )! *Min(1.0,1./dtp) ! 0.3465
-       CN(mgs) =  Min( cnuc(mgs),  CCNE0*cnuc(mgs)**(2./(2.+cck))*Max(0.0,wvel(mgs))**cnexp )
+!       CN(mgs) =   cwccn*Min(ssf(mgs),ssfcut)**cck 
 
-         
-        IF ( ccna(mgs) >= cnuc(mgs) ) THEN ! apply limit after all "base" CCN have been depleted
+! Need to calculate new ssf since condensation has happened:
+         temp1 = (theta0(mgs)+thetap(mgs))*pk(mgs) ! t77(ix,jy,kz)
+          ltemq = Int( (temp1-163.15)/fqsat+1.5 )
+         ltemq = Min( nqsat, Max(1,ltemq) )
+
+          c1= pqs(mgs)*tabqvs(ltemq)
+
+          ssf(mgs) = 0.0
+          IF ( c1 > 0. ) THEN
+            ssf(mgs) = 100.*(qx(mgs,lv)/c1 - 1.0)  ! from "new" values
+          ENDIF
+       CN(mgs) =   cnuc(mgs)*Min(1.0, (ssf(mgs))**cck ) ! 
+
+       CN(mgs) = Max( 0.0, CN(mgs) - ccna(mgs) ) ! this was from
+               ! Philips, Donner et al. 2007, but results in too much limitation of
+               ! nucleation
+       CN(mgs) = Min(cn(mgs), ccnc(mgs))
+       cn(mgs) = Min(cn(mgs), 0.5*dqc/cwmasn) ! limit the nucleation mass to half of the condensation mass
+       
+       cx(mgs,lc) = cx(mgs,lc) + cn(mgs)
+       
+       ! 6/13/2016: Phillips et al. appears not to decrement CCN, but only increments CCNa.
+       ! This would allow an initially non-homogeneous (vertically, e.g.) initial value of CCN/rho_air
+        ccnc(mgs) = Max(0.0, ccnc(mgs) - cn(mgs)) 
+       
+      ELSEIF ( irenuc == 4 ) THEN !} { 
+      ! modification of Phillips Donner Garner 2007
+!      if (ndebug .gt. 0) write(0,*) 'ICEZVD_DR:  Cloud reNucleation, wvel = ',wvel(mgs)
+!       CN(mgs) =   CCNE0*cnuc(mgs)**(2./(2.+cck))*Max(0.0,wvel(mgs))**cnexp
+!       cn(mgs) = Min( cn(mgs), cnuc(mgs) )
+! Need to calculate new ssf since condensation has happened:
+         temp1 = (theta0(mgs)+thetap(mgs))*pk(mgs) ! t77(ix,jy,kz)
+          ltemq = Int( (temp1-163.15)/fqsat+1.5 )
+         ltemq = Min( nqsat, Max(1,ltemq) )
+
+          c1= pqs(mgs)*tabqvs(ltemq)
+          IF ( c1 > 0. ) THEN
+            ssf(mgs) = Max(0.0, 100.*((qv0(mgs) + qwvp(mgs))/c1 - 1.0) )  ! from "new" values
+          ELSE
+            ssf(mgs) = 0.0
+          ENDIF
+       CN(mgs) =   cnuc(mgs)*Min(ssf2kmax, ssf(mgs)**cck) ! this allows cn(mgs) > cnuc(mgs)
+
+       CN(mgs) = Max( 0.0, CN(mgs) - ccna(mgs) ) ! this was from
+               ! Philips, Donner et al. 2007, but results in too much limitation of
+               ! nucleation
+!       CN(mgs) = Min(cn(mgs), ccnc(mgs))
+       cn(mgs) = Min(cn(mgs), 0.5*dqc/cwmasn) ! limit the nucleation mass to half of the condensation mass
+       
+       IF ( cn(mgs) > 0.0 ) THEN
+       cx(mgs,lc) = cx(mgs,lc) + cn(mgs)
+       ! ccnc(mgs) = Max(0.0, ccnc(mgs) - cn(mgs)) 
+       
+       dcrit = 2.0*2.5e-7
+       
+       dcloud = 1000.*dcrit**3*Pi/6.*cn(mgs)
+        qx(mgs,lc) = qx(mgs,lc) + DCLOUD
+        thetap(mgs) = thetap(mgs) + felvcp(mgs)*DCLOUD/(pi0(mgs))
+        qwvp(mgs) = qwvp(mgs) - DCLOUD
+        ENDIF
+       ! 6/13/2016: Phillips et al. appears not to decrement CCN, but only increments CCNa.
+       ! This would allow an initially non-homogeneous (vertically, e.g.) initial value of CCN/rho_air
+!        ccnc(mgs) = Max(0.0, ccnc(mgs) - cn(mgs))
+       
+
+
+      ELSEIF ( irenuc == 6 ) THEN !} { 
+
+      ! simple Twomey scheme but limit activation to try to do most activation near cloud base, but keep some CCN available for renuclation
+!      if (ndebug .gt. 0) write(0,*) 'ICEZVD_DR:  Cloud reNucleation, wvel = ',wvel(mgs)
+       cn(mgs) = 0.0
+!       IF ( ccna(mgs) < 0.7*cnuc(mgs) .and. ccnc(mgs) > 0.69*cnuc(mgs) - ccna(mgs)) THEN ! here, assume we are near cloud base and use Twomey formulation
+       IF ( ccna(mgs) < 0.7*cnuc(mgs) ) THEN ! here, assume we are near cloud base and use Twomey formulation
+         CN(mgs) =  Min( 0.9*cnuc(mgs), CCNE0*cnuc(mgs)**(2./(2.+cck))*Max(0.0,wvel(mgs))**cnexp )! *Min(1.0,1./dtp) ! 0.3465
+!         IF ( cn(mgs) + ccna(mgs) > 0.71*cnuc ) THEN
+         ! prevent this branch from activating more than 70% of CCN
+           CN(mgs) = Min( CN(mgs), Max(0.0, (0.7*cnuc(mgs) - ccna(mgs) )) )
+!           CN(mgs) = Min( CN(mgs), Max(0.0, 0.71*ccnc(mgs) - ccna(mgs) ) )
+           
+       ELSE
+        ! if a large fraction of CCN have been activated, then assume we are in the cloud interior and use local SSw as in Phillips et al. 2007.
+
+         temp1 = (theta0(mgs)+thetap(mgs))*pk(mgs) ! t77(ix,jy,kz)
+!          t0(ix,jy,kz) = temp1
+          ltemq = Int( (temp1-163.15)/fqsat+1.5 )
+         ltemq = Min( nqsat, Max(1,ltemq) )
+
+!          c1 = t00(igs(mgs),jy,kgs(mgs))*tabqvs(ltemq)
+          c1= pqs(mgs)*tabqvs(ltemq)
+          IF ( c1 > 0. ) THEN
+            ssf(mgs) = Max(0.0, 100.*((qv0(mgs) + qwvp(mgs))/c1 - 1.0) )  ! from "new" values
+          ELSE
+            ssf(mgs) = 0.0
+          ENDIF
+
+!        CN(mgs) = cnuc(mgs)*Min(0.99, Min(ssf(mgs),ssfcut)**cck ) ! 
+         CN(mgs) =   cnuc(mgs)*Min(2.0, Max(0.0,ssf(mgs))**cck ) ! 
+!         CN(mgs) =   cnuc(mgs)*Min(ssf(mgs),ssfcut)**cck ! 
+
+
+        CN(mgs) = Min(0.01*cnuc(mgs), Max( 0.0, CN(mgs) - ccna(mgs) ) ) ! this was from
+!        cn(mgs) = 0.0
+       ENDIF
+!      ccne = ccnefac*1.e6*(1.e-6*Abs(cwccn))**(2./(2.+cck))
+!!!       CN(mgs) = Max( 0.0, CN(mgs) - ccna(mgs) ) ! this was from
+               ! Philips, Donner et al. 2007, but results in too much limitation of
+               ! nucleation
+!       CN(mgs) = Min(cn(mgs), ccnc(mgs))
+!       cn(mgs) = Min(cn(mgs), 0.5*dqc/cwmasn) ! limit the nucleation mass to half of the condensation mass
+       
+       IF ( cn(mgs) > 0.0 ) THEN
+       cx(mgs,lc) = cx(mgs,lc) + cn(mgs)
+       
+       ! create some small droplets at minimum size (CP 2000), although it adds very little liquid
+       
+       dcrit = 2.0*2.5e-7
+       
+       dcloud = 1000.*dcrit**3*Pi/6.*cn(mgs)
+        qx(mgs,lc) = qx(mgs,lc) + DCLOUD
+        thetap(mgs) = thetap(mgs) + felvcp(mgs)*DCLOUD/(pi0(mgs))
+        qwvp(mgs) = qwvp(mgs) - DCLOUD
+  !      ccnc(mgs) = Max(0.0, ccnc(mgs) - cn(mgs))
+        ENDIF
+      ELSEIF ( irenuc == 5 ) THEN !} { 
+
+      ! modification of Phillips Donner Garner 2007
+!      if (ndebug .gt. 0) write(0,*) 'ICEZVD_DR:  Cloud reNucleation, wvel = ',wvel(mgs)
+!      CN(mgs) =  Min( 0.91*cnuc(mgs), CCNE0*cnuc(mgs)**(2./(2.+cck))*Max(0.0,wvel(mgs))**cnexp )! *Min(1.0,1./dtp) ! 0.3465
+       CN(mgs) =  Min( cnuc(mgs),  CCNE0*cnuc(mgs)**(2./(2.+cck))*Max(0.0,wvel(mgs))**cnexp )
+
+         
+        IF ( ccna(mgs) >= cnuc(mgs) ) THEN ! apply limit after all "base" CCN have been depleted
         temp1 = (theta0(mgs)+thetap(mgs))*pk(mgs) ! t77(ix,jy,kz)
           ltemq = Int( (temp1-163.15)/fqsat+1.5 )
          ltemq = Min( nqsat, Max(1,ltemq) )
@@ -9573,7 +10747,7 @@ SUBROUTINE NUCOND    &
          !  write(0,*) 'k,cn = ',kgs(mgs),cn(mgs),ssf(mgs)
          !  write(0,*) 'ccn-ccna = ',cnuc(mgs) - ccna(mgs),ccnc(mgs) - ccna(mgs)
 !           IF ( ccncuf(mgs) > 0.0 .and. cn(mgs) < 1.e-3 .and. ssmax(mgs) > 1.0 ) THEN
-           IF ( ccncuf(mgs) > 0.0 .and. ssf(mgs) > ssmxuf .and. ssmax(mgs) > ssmxuf ) THEN
+           IF ( ccncuf(mgs) > 0.0 .and. ssf(mgs) > ssmxuf .and. ( ssmax(mgs) > ssmxuf .or. lss < 1 ) ) THEN
             CNuf(mgs) =  Min( ccncuf(mgs), CCNE0*ccncuf(mgs)**(2./(2.+cck))*Max(0.0,wvel(mgs))**cnexp )! *Min(1.0,1./dtp) ! 0.3465
           !  IF ( cnuf(mgs) >= 0.0 ) write(0,*) 'cnuf, k = ',cnuf(mgs),ccncuf(mgs),kgs(mgs)
            ENDIF
@@ -9853,6 +11027,10 @@ SUBROUTINE NUCOND    &
 !        qx(mgs,lr) = an(igs(mgs),jy,kgs(mgs),lr)
        end if
 
+        IF ( lzr > 1 .and. rcond == 2 ) THEN
+        an(igs(mgs),jy,kgs(mgs),lzr) = zx(mgs,lr) +  &
+     &    min( an(igs(mgs),jy,kgs(mgs),lzr), 0.0 )
+        ENDIF
 
 
        IF (  ipconc .ge. 2 ) THEN
@@ -9938,6 +11116,42 @@ SUBROUTINE NUCOND    &
 
       IF ( lhl .gt. 1 ) THEN
       
+      IF ( lzhl .gt. 1 ) THEN
+
+        an(ix,jy,kz,lzhl) = Max(0.0, an(ix,jy,kz,lzhl) )
+        
+        IF ( an(ix,jy,kz,lhl) .ge. frac*qxmin(lhl) .and. rescale_low_alpha ) THEN ! check 6th moment
+          
+          IF ( an(ix,jy,kz,lnhl) .gt. 0.0 ) THEN
+
+           IF ( lvhl .gt. 1 ) THEN
+             IF ( an(ix,jy,kz,lvhl) .gt. 0.0 ) THEN
+               hwdn = dn(ix,jy,kz)*an(ix,jy,kz,lhl)/an(ix,jy,kz,lvhl)
+             ELSE
+               hwdn = xdn0(lhl)
+             ENDIF
+             hwdn = Max( xdnmn(lhl), hwdn )
+           ELSE
+             hwdn = xdn0(lhl)
+           ENDIF
+
+             chw = an(ix,jy,kz,lnhl)
+             g1 = (6.0+alphamin)*(5.0+alphamin)*(4.0+alphamin)/   &
+     &            ((3.0+alphamin)*(2.0+alphamin)*(1.0+alphamin))
+             z1 = g1*dn(ix,jy,kz)**2*( an(ix,jy,kz,lhl) )*an(ix,jy,kz,lhl)/chw
+             z1 = z1*(6./(pi*hwdn))**2
+          ELSE
+             z1 = 0.0
+          ENDIF
+          
+          an(ix,jy,kz,lzhl) = Min( z1, an(ix,jy,kz,lzhl) )
+          
+          IF (  an(ix,jy,kz,lnhl) .lt. 1.e-5 ) THEN
+!            an(ix,jy,kz,lzhl) = 0.9*an(ix,jy,kz,lzhl)
+          ENDIF
+        ENDIF
+        
+      ENDIF !lzhl
       
       if ( an(ix,jy,kz,lhl) .lt. frac*qxmin(lhl) .or. zerocx(lhl) ) then
 
@@ -10038,6 +11252,42 @@ SUBROUTINE NUCOND    &
 
 
 
+      IF ( lzh .gt. 1 ) THEN
+
+        an(ix,jy,kz,lzh) = Max(0.0, an(ix,jy,kz,lzh) )
+        
+        IF ( .false. .and. an(ix,jy,kz,lh) .ge. frac*qxmin(lh) .and. rescale_low_alpha ) THEN
+          
+          IF ( an(ix,jy,kz,lnh) .gt. 0.0 ) THEN
+
+           IF ( lvh .gt. 1 ) THEN
+             IF ( an(ix,jy,kz,lvh) .gt. 0.0 ) THEN
+               hwdn = dn(ix,jy,kz)*an(ix,jy,kz,lh)/an(ix,jy,kz,lvh)
+             ELSE
+               hwdn = xdn0(lh)
+             ENDIF
+             hwdn = Max( xdnmn(lh), hwdn )
+           ELSE
+             hwdn = xdn0(lh)
+           ENDIF
+
+             chw = an(ix,jy,kz,lnh)
+             g1 = (6.0+alphamin)*(5.0+alphamin)*(4.0+alphamin)/   &
+     &            ((3.0+alphamin)*(2.0+alphamin)*(1.0+alphamin))
+             z1 = g1*dn(ix,jy,kz)**2*( an(ix,jy,kz,lh) )*an(ix,jy,kz,lh)/chw
+             z1  = z1*(6./(pi*hwdn))**2
+          ELSE
+             z1 = 0.0
+          ENDIF
+          
+          an(ix,jy,kz,lzh) = Min( z1, an(ix,jy,kz,lzh) )
+          
+          IF (  an(ix,jy,kz,lnh) .lt. 1.e-5 ) THEN
+!            an(ix,jy,kz,lzh) = 0.9*an(ix,jy,kz,lzh)
+          ENDIF
+        ENDIF
+        
+      ENDIF
 
       if ( an(ix,jy,kz,lh) .lt. frac*qxmin(lh) .or. zerocx(lh) ) then
 
@@ -10198,6 +11448,9 @@ SUBROUTINE NUCOND    &
 
       end if
 
+        IF ( lzr > 1 ) THEN
+          an(ix,jy,kz,lzr) = Max(0.0, an(ix,jy,kz,lzr) )
+        ENDIF
 
       if ( an(ix,jy,kz,lr) .lt. frac*qxmin(lr)  .or. zerocx(lr)  &
      &  ) then
@@ -10208,6 +11461,10 @@ SUBROUTINE NUCOND    &
           an(ix,jy,kz,lnr) = 0.0
         ENDIF
         
+        IF ( lzr > 1 ) THEN
+          an(ix,jy,kz,lzr) = 0.0
+        ENDIF
+
       end if
 
 !
@@ -10265,12 +11522,14 @@ SUBROUTINE NUCOND    &
      &       an(ix,jy,kz,lccn) + Max(0.0,an(ix,jy,kz,lnc))
         ENDIF
          an(ix,jy,kz,lnc) = 0.0
+         IF ( lccn > 1 ) an(ix,jy,kz,lccn) = Max( 0.0, an(ix,jy,kz,lccn) )
          
          IF ( lccna > 0  ) THEN ! apply exponential decay to activated CCN to restore to environmental value
+           IF ( restoreccn ) THEN
            tmp = an(ix,jy,kz,li) + an(ix,jy,kz,ls)  
            
            IF ( an(ix,jy,kz,lccna) > 1. .and. tmp < qxmin(li) ) an(ix,jy,kz,lccna) = an(ix,jy,kz,lccna)*Exp(-dtp/ccntimeconst)
-
+           ENDIF
          ELSEIF ( lccn > 1 .and. restoreccn ) THEN
            ! in this case, we are treating the ccn field as ccna
            tmp = an(ix,jy,kz,li) + an(ix,jy,kz,ls)  
@@ -10425,6 +11684,7 @@ subroutine nssl_2mom_gs   &
       real rainprod2d(-nor+1:nx+nor,-norz+ng1:nz+norz)
       real evapprod2d(-nor+1:nx+nor,-norz+ng1:nz+norz)
 
+      logical lrescalelow(lc:lhab)
       real tkediss(-nor+1:nx+nor,-norz+ng1:nz+norz)
       real axtra(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-norz+ng1:nz+norz,nxtra)
 
@@ -10633,7 +11893,8 @@ subroutine nssl_2mom_gs   &
       real ex1, ft, rhoinv(ngs)
       double precision ec0(ngs)
       
-      real ac1,bc, taus, c1,d1,e1,f1,p380,tmp,tmp1,tmp2,tmp3,tmp4,tmp5,temp3 ! , sstdy, super
+      real ac1,bc, taus, c1,d1,e1,f1,p380,tmp,tmp1,tmp2,tmp3,tmp4,tmp5,tmp6,temp3 ! , sstdy, super
+      real :: flim
       real dw,dwr
       double precision :: tmpz, tmpzmlt
       real ratio, delx, dely
@@ -10714,7 +11975,7 @@ subroutine nssl_2mom_gs   &
       real temgx(ngs),temcgx(ngs)
       real qvs(ngs),qis(ngs),qss(ngs),pqs(ngs)
       real elv(ngs),elf(ngs),els(ngs)
-      real tsqr(ngs),ssi(ngs),ssw(ngs)
+      real tsqr(ngs),ssi(ngs),ssw(ngs),ssi0(ngs)
       real qcwtmp(ngs),qtmp,qtot(ngs) 
       real qcond(ngs)
       real ctmp, sctmp
@@ -10729,6 +11990,7 @@ subroutine nssl_2mom_gs   &
       parameter ( rwradmn = 50.e-6 )
       real dh0
       real dg0(ngs),df0(ngs)
+      real dhwet(ngs),dhlwet(ngs),dfwet(ngs)
       
       real clionpmx,clionnmx
       parameter (clionpmx=1.e9,clionnmx=1.e9) ! Takahashi 84
@@ -10736,7 +11998,7 @@ subroutine nssl_2mom_gs   &
 !  other arrays
 
       real fwet1(ngs),fwet2(ngs)   
-      real fmlt1(ngs),fmlt2(ngs)  
+      real fmlt1(ngs),fmlt2(ngs),fmlt1e(ngs)
       real fvds(ngs),fvce(ngs),fiinit(ngs) 
       real fvent(ngs),fraci(ngs),fracl(ngs)
 !
@@ -10760,6 +12022,7 @@ subroutine nssl_2mom_gs   &
 !
       real :: sfm1(ngs),sfm2(ngs)
       real :: gfm1(ngs),gfm2(ngs)
+      real :: ffm1(ngs),ffm2(ngs)
       real :: hfm1(ngs),hfm2(ngs)
 
       logical :: wetsfc(ngs),wetsfchl(ngs),wetsfcf(ngs)
@@ -10800,6 +12063,10 @@ subroutine nssl_2mom_gs   &
       real ::  alpha(ngs,lc:lhab)
       real ::  dab0lh(ngs,lc:lhab,lc:lhab)
       real ::  dab1lh(ngs,lc:lhab,lc:lhab)
+      real ::  zx(ngs,lr:lhab)
+      real ::  zxmxd(ngs,lr:lhab)
+      real ::  g1x(ngs,lr:lhab)
+      
 
       real :: qsimxdep(ngs) ! max sublimation of qi+qs+qis
       real :: qsimxsub(ngs) ! max depositionof qi+qs+qis
@@ -10815,6 +12082,7 @@ subroutine nssl_2mom_gs   &
       real ventrxn(ngs)
       real g1shr, alphashr
       real g1mlr, alphamlr
+      real g1smlr, alphasmlr
       real massfacshr, massfacmlr
       
       real :: qhgt8mm ! ice mass greater than 8mm
@@ -10827,6 +12095,8 @@ subroutine nssl_2mom_gs   &
       real, parameter :: srasheym = 0.1389 ! slope fraction from Rasmussen and Heymsfield 
 !
       real swvent(ngs),hwvent(ngs),rwvent(ngs),hlvent(ngs),hwventy(ngs),hlventy(ngs),rwventz(ngs)
+      real hxventtmp
+      real hlventinc(ngs),hwventinc(ngs)
       integer, parameter :: ndiam = 10
       integer :: numdiam
       real hwvent0(ndiam+4),hlvent0 ! 0 to d1
@@ -10946,9 +12216,10 @@ subroutine nssl_2mom_gs   &
 
       real qsacw(ngs) ! ,qwacs(ngs),
       real qhacw(ngs) ! qwach(ngs),
-      real :: qhlacw(ngs) ! 
+      real :: qhlacw(ngs), qxacwtmp, qxacrtmp ! 
       real vhacw(ngs), vsacw(ngs), vhlacw(ngs), vhlacr(ngs)
 
+      real qfcev(ngs)
       real qfmul1(ngs),cfmul1(ngs)
 !
       real qsacws(ngs)
@@ -10957,7 +12228,7 @@ subroutine nssl_2mom_gs   &
 !  arrays for x-ac-r and r-ac-x; 
 !
       real qsacr(ngs),qracs(ngs)
-      real qhacr(ngs),qhacrmlr(ngs) ! ,qrach(ngs)
+      real qhacr(ngs),qhacrmlr(ngs),qhacwmlr(ngs) ! ,qrach(ngs)
       real vhacr(ngs), zhacr(ngs), zhacrf(ngs), zrach(ngs), zrachl(ngs)
       real qiacr(ngs),qraci(ngs)
       
@@ -10965,7 +12236,7 @@ subroutine nssl_2mom_gs   &
 
       real qracif(ngs),qiacrf(ngs),qiacrs(ngs),ciacrs(ngs)
 
-      real :: qhlacr(ngs),qhlacrmlr(ngs)
+      real :: qhlacr(ngs),qhlacrmlr(ngs), qhlacwmlr(ngs)
       real qsacrs(ngs) !,qracss(ngs)
 !
 !  ice - ice interactions
@@ -11011,7 +12282,7 @@ subroutine nssl_2mom_gs   &
       real zfmlr(ngs), zfdsv(ngs), zfsbv(ngs), zhlcnf(ngs), zfshr(ngs), zfshrr(ngs)
       real zhmlrtmp,zhmlr0inf,zhlmlr0inf
       real zhmlrr(ngs),zhlmlrr(ngs),zhshrr(ngs),zhlshrr(ngs),zfmlrr(ngs)
-      real zsmlr(ngs), zsmlrr(ngs), zsshr(ngs)
+      real zsmlr(ngs), zsmlrr(ngs), zsshr(ngs), zsshrr(ngs)
       real zhcns(ngs), zhcni(ngs)
       real zhwdn(ngs), zfwdn(ngs) ! change in Z due to density changes
       real zhldn(ngs) ! change in Z due to density changes
@@ -11052,9 +12323,10 @@ subroutine nssl_2mom_gs   &
 !
       real :: qhldpv(ngs), qhlsbv(ngs) ! qhlcnv(ngs),qhlevv(ngs),
       real :: qhlmlr(ngs), qhldsv(ngs), qhlmlrsave(ngs)
-      real :: qhlwet(ngs), qhldry(ngs), qhlshr(ngs) 
+      real :: qhlwet(ngs), qhldry(ngs), qhlshr(ngs), qxwettmp
 !
       real :: qrfz(ngs),qsfz(ngs),qhfz(ngs),qhlfz(ngs)
+      real :: qffz(ngs)
 !
       real qhdpv(ngs),qhsbv(ngs) ! qhcnv(ngs),qhevv(ngs),
       real qhmlr(ngs),qhdsv(ngs),qhcev(ngs),qhcndv(ngs),qhevv(ngs)
@@ -11064,6 +12336,7 @@ subroutine nssl_2mom_gs   &
       real qhshh(ngs) !accreted water that remains on graupel
       real qhmlh(ngs) !melt water that remains on graupel
       real qhfzh(ngs) !water that freezes on mixed-phase graupel
+      real qffzf(ngs) !water that freezes on mixed-phase FD
       real qhlfzhl(ngs) !water that freezes on mixed-phase hail
       
       real qhmlrlg(ngs),qhlmlrlg(ngs) ! melting from the larger diameters
@@ -11115,6 +12388,7 @@ subroutine nssl_2mom_gs   &
       real qrshr(ngs)
       real fsw(ngs),fhw(ngs),fhlw(ngs),ffw(ngs) !liquid water fractions
       real fswmax(ngs),fhwmax(ngs),fhlwmax(ngs) !liquid water fractions
+      real ffwmax(ngs)
       real qhcnf(ngs) 
       real :: qhlcnh(ngs)
       real qhcngh(ngs),qhcngm(ngs),qhcngl(ngs)
@@ -11128,7 +12402,7 @@ subroutine nssl_2mom_gs   &
       real ehxr(ngs),ehlr(ngs),egmr(ngs) 
       real eri(ngs),esi(ngs),egli(ngs),eghi(ngs),efi(ngs),efis(ngs)
       real ehxi(ngs),ehli(ngs),egmi(ngs),ehi(ngs),ehis(ngs),ehlis(ngs)
-      real ers(ngs),ess(ngs),egls(ngs),eghs(ngs),efs(ngs),ehs(ngs)
+      real ers(ngs),ess(ngs),egls(ngs),eghs(ngs),efs(ngs),ehs(ngs),ehsfac(ngs)
       real ehscnv(ngs)
       real ehxs(ngs),ehls(ngs),egms(ngs),egmip(ngs) 
 
@@ -11187,12 +12461,13 @@ subroutine nssl_2mom_gs   &
       real pqgli(ngs),pqghi(ngs),pqfwi(ngs)
       real pqgmi(ngs),pqhli(ngs) ! ,pqhxi(ngs)
       real pqiri(ngs),pqipi(ngs) ! pqwai(ngs),
-      real pqlwsi(ngs),pqlwhi(ngs),pqlwhli(ngs)
+      real pqlwsi(ngs),pqlwhi(ngs),pqlwhli(ngs),pqlwfi(ngs)
       
       real pqlwlghi(ngs),pqlwlghli(ngs)
       real pqlwlghd(ngs),pqlwlghld(ngs)
       
       
+      
 
       real pvhwi(ngs), pvhwd(ngs)
       real pvfwi(ngs), pvfwd(ngs)
@@ -11204,7 +12479,7 @@ subroutine nssl_2mom_gs   &
       real pqgld(ngs),pqghd(ngs),pqfwd(ngs)
       real pqgmd(ngs),pqhld(ngs) ! ,pqhxd(ngs)
       real pqird(ngs),pqipd(ngs) ! pqwad(ngs),
-      real pqlwsd(ngs),pqlwhd(ngs),pqlwhld(ngs)
+      real pqlwsd(ngs),pqlwhd(ngs),pqlwhld(ngs),pqlwfd(ngs)
 !
 !      real pqxii(ngs,nhab),pqxid(ngs,nhab)
 !
@@ -11352,7 +12627,7 @@ subroutine nssl_2mom_gs   &
       real  frcrglgm,  frcrglgh, frcrglfw, frcrglgl1
       real  frcgmrgl, frcgmrgm, frcgmrgh, frcgmrfw,  frcgmrgm1
       real  frcrgmgl, frcrgmgm,  frcrgmgh, frcrgmfw, frcrgmgm1
-      real  sum,  qweps,  gf2a, gf4a, dqldt, dqidt, dqdt
+      real  total,  qweps,  gf2a, gf4a, dqldt, dqidt, dqdt
       real frcghrgl, frcghrgm, frcghrgh, frcghrfw, frcghrgh1, frcrghgl
       real frcrghgm, frcrghgh,  frcrghfw, frcrghgh1
       real    a1,a2,a3,a4,a5,a6
@@ -11385,8 +12660,20 @@ subroutine nssl_2mom_gs   &
       real :: term1,term2,term3,term4
       real :: qaacw ! combined qsacw-qhacw for WSM6 variation
 
+      real, parameter ::  c1r=19.0, c2r=0.6, c3r=1.8, c4r=17.0   ! rain
+      real, parameter ::  c1h=5.5, c2h=0.7, c3h=4.5, c4h=8.5   ! Graupel
+      real, parameter ::  c1hl=3.7, c2hl=0.3, c3hl=9.0, c4hl=6.5, c5hl=1.0, c6hl=6.5 ! Hail
+
 
+! inline functions for Newton method
+       real :: galpha, dgalpha
+       real :: a_in
+       logical, parameter :: newton = .false.
 
+
+      galpha(a_in) = ((4. + a_in)*(5. + a_in)*(6. + a_in))/((1. + a_in)*(2. + a_in)*(3. + a_in))
+      dgalpha(a_in) = (876. + 1260.*a_in + 621.*a_in**2 + 126.*a_in**3 + 9.*a_in**4)/            &
+     &  (36. + 132.*a_in + 193.*a_in**2 + 144.*a_in**3 + 58.*a_in**4 + 12.*a_in**5 + a_in**6)
 !
 ! ####################################################################
 !
@@ -11416,6 +12703,11 @@ subroutine nssl_2mom_gs   &
       jstag = 0
       kstag = 1
 
+      lrescalelow(:) = rescale_low_alpha
+      lrescalelow(lr) = rescale_low_alphar .and. rescale_low_alpha
+      lrescalelow(lh) = rescale_low_alphah .and. rescale_low_alpha
+      IF ( lf > 1 ) lrescalelow(lf) = rescale_low_alphah .and. rescale_low_alpha
+      IF ( lhl > 1 ) lrescalelow(lhl) = rescale_low_alphahl .and. rescale_low_alpha
 
 
 !
@@ -11533,11 +12825,18 @@ subroutine nssl_2mom_gs   &
       vmlt = Min(xvmx(lr), 0.523599*(dmlt)**3 )
       vshd = Min(xvmx(lr), 0.523599*(dshd)**3 )
 
-      snowmeltmass = pi/6.0 * 1000. * snowmeltdia**3  ! maximum rain particle mass from melting snow (if snowmeltdia > 0)
+      IF ( snowmeltdia > 0.0 ) THEN
+        snowmeltmass = pi/6.0 * 1000. * snowmeltdia**3  ! maximum rain particle mass from melting snow (if snowmeltdia > 0)
+      ENDIF
 
       tdtol = 1.0e-05
       tfrcbw = tfr - cbw
       tfrcbi = tfr - cbi
+      
+      IF ( mixedphase ) THEN
+       ibinhmlr = 0
+       ibinhlmlr = 0
+      ENDIF
 !
 !
 ! #ifdef COMMAS
@@ -11695,10 +12994,15 @@ subroutine nssl_2mom_gs   &
       temg(1) = t0(ix,jy,kz)
       temcg(1) = temg(1) - tfr
       tqvcon = temg(1)-cbw
-      ltemq = (temg(1)-163.15)/fqsat+1.5
+      ltemq = (temg(1)-163.15)/fqsat + 1.5
       ltemq = Min( nqsat, Max(1,ltemq) )
       qvs(1) = pqs(1)*tabqvs(ltemq)
-      qis(1) = pqs(1)*tabqis(ltemq)
+      IF ( iqis0 == 1 .or. temg(1) <= tfr+0.5 ) THEN
+        qis(1) = pqs(1)*tabqis(ltemq)
+      ELSE
+        ltemq = (tfr - 163.15)/fqsat + 1.5
+        qis(1) = pqs(1)*tabqis(ltemq)
+      ENDIF
 
       qss(1) = qvs(1)
 
@@ -11793,7 +13097,12 @@ subroutine nssl_2mom_gs   &
       ltemq = (temg(mgs)-163.15)/fqsat+1.5
       ltemq = Min( nqsat, Max(1,ltemq) )
       qvs(mgs) = pqs(mgs)*tabqvs(ltemq)
-      qis(mgs) = pqs(mgs)*tabqis(ltemq)
+      IF ( iqis0 == 1 .or. temg(mgs) <= tfr+0.5 ) THEN
+        qis(mgs) = pqs(mgs)*tabqis(ltemq)
+      ELSE
+        ltemq = (tfr - 163.15)/fqsat + 1.5
+        qis(mgs) = pqs(mgs)*tabqis(ltemq)
+      ENDIF
       qss(mgs) = qvs(mgs)
 !      es(mgs)  = 6.1078e2*tabqvs(ltemq)
 !      eis(mgs) = 6.1078e2*tabqis(ltemq)
@@ -11834,78 +13143,6 @@ subroutine nssl_2mom_gs   &
 
 
 
-        scx(:,:) = 0.0
-!
-!  set shape parameters
-!
-      IF ( imurain == 1 ) THEN
-        alpha(:,lr) = alphar
-      ELSEIF ( imurain == 3 ) THEN
-        alpha(:,lr) = xnu(lr)
-      ENDIF
-      
-      alpha(:,li) = xnu(li)
-      alpha(:,lc) = xnu(lc)
-
-      IF ( imusnow == 1 ) THEN
-        alpha(:,ls) = alphas
-      ELSEIF ( imusnow == 3 ) THEN
-        alpha(:,ls) = xnu(ls)
-      ENDIF
-      
-      DO il = lr,lhab
-      do mgs = 1,ngscnt
-        IF ( il .ge. lg ) alpha(mgs,il) = dnu(il)
-
-
-        DO ic = lc,lhab
-        dab0lh(mgs,il,ic) =  dab0(il,ic) ! dab0(ic,il)
-        dab1lh(mgs,il,ic) =  dab1(il,ic) ! dab1(ic,il)
-        ENDDO
-      ENDDO
-      end do
-      
-      
-!      DO mgs = 1,ngscnt
-        DO il = lr,lhab
-          da0lx(:,il) = da0(il)
-        ENDDO
-        da0lh(:) = da0(lh)
-        da0lr(:) = da0(lr)
-        da1lr(:) = da1(lr)
-        da0lc(:) = da0(lc)
-        da1lc(:) = da1(lc)
-
-
-        IF ( lzh < 1 .or. lzhl < 1 ) THEN
-          rzxhlh(:) = rzhl/rz
-        ELSEIF ( lzh > 1 .and. lzhl > 1 ) THEN
-          rzxhlh(:) = 1.
-        ENDIF
-        IF ( lzr > 1 ) THEN
-          rzxh(:) = 1.
-          rzxhl(:) = 1.
-        ELSE
-          rzxh(:) = rz
-          rzxhl(:) = rzhl
-        ENDIF
-        
-        IF ( imurain == 1 .and. imusnow == 3 .and. lzr < 1 ) THEN
-          rzxs(:) = rzs
-        ELSEIF ( imurain == imusnow .or. lzr > 1 ) THEN
-          rzxs(:) = 1.
-        ENDIF
- !     ENDDO
-      
-      IF ( lhl .gt. 1 ) THEN
-      DO mgs = 1,ngscnt
-        da0lhl(mgs) = da0(lhl)
-      ENDDO
-      ENDIF
-      
-      ventrx(:) = ventr
-      ventrxn(:) = ventrn
-      gf1palp(:) = gamma_sp(1.0 + alphar)
 
 !
 !  set concentrations
@@ -12076,17 +13313,136 @@ subroutine nssl_2mom_gs   &
 
 
 !
-!  set factors
-!
-      do mgs = 1,ngscnt
-!
-      ssi(mgs) = qx(mgs,lv)/qis(mgs)
-      ssw(mgs) = qx(mgs,lv)/qvs(mgs)
+!  6th moments
 !
-      tsqr(mgs) = temg(mgs)**2
-!
-      temgx(mgs) = min(temg(mgs),313.15)
-      temgx(mgs) = max(temgx(mgs),233.15)
+
+      IF ( ipconc .ge. 6 ) THEN
+       zx(:,:) = 0.0
+       DO il = lr,lhab
+        IF ( lz(il) .gt. 1 ) THEN
+         DO mgs = 1,ngscnt
+          zx(mgs,il) = Max( an(igs(mgs),jy,kgs(mgs),lz(il)), 0.0 )
+         ENDDO
+        ENDIF
+       ENDDO
+
+      ENDIF
+
+      IF ( ipconc .ge. 6 ) THEN
+
+       IF ( lz(lr) .lt. 1 ) THEN
+         g1x(:,lr) = (6.0 + alphar)*(5.0 + alphar)*(4.0 + alphar)/ &
+     &            ((3.0 + alphar)*(2.0 + alphar)*(1.0 + alphar))
+
+         
+         DO mgs = 1,ngscnt
+           IF ( cx(mgs,lr) .gt. 0.0 .and. qx(mgs,lr) .gt. qxmin(lr)  ) THEN
+            
+            vr = rho0(mgs)*qx(mgs,lr)/(1000.*cx(mgs,lr))
+            IF ( lzr < 1 ) THEN
+             IF ( imurain == 3 ) THEN
+               zx(mgs,lr) = 3.6476*(rnu+2.0)*cx(mgs,lr)*vr**2/(rnu+1.0)
+             ELSE ! imurain == 1
+               zx(mgs,lr) = 3.6476*g1x(mgs,lr)*cx(mgs,lr)*vr**2
+             ENDIF
+            ENDIF
+             
+           ENDIF
+         ENDDO
+       ENDIF
+      
+      ENDIF
+
+
+        scx(:,:) = 0.0
+!
+!  set shape parameters
+!
+       if ( ndebug .gt. 0 .and. my_rank>=0 ) write(0,*) my_rank,  'ICEZVD_GS: dbg = set alpha'
+      IF ( imurain == 1 ) THEN
+        alpha(:,lr) = alphar
+      ELSEIF ( imurain == 3 ) THEN
+        alpha(:,lr) = xnu(lr)
+      ENDIF
+      
+      alpha(:,li) = xnu(li)
+      alpha(:,lc) = xnu(lc)
+
+      IF ( imusnow == 1 ) THEN
+        alpha(:,ls) = alphas
+      ELSEIF ( imusnow == 3 ) THEN
+        alpha(:,ls) = xnu(ls)
+      ENDIF
+
+       if ( ndebug .gt. 0 .and. my_rank>=0 ) write(0,*) my_rank,  'ICEZVD_GS: dbg = set dab'
+      
+      DO il = lr,lhab
+      do mgs = 1,ngscnt
+        IF ( il .ge. lg ) alpha(mgs,il) = dnu(il)
+
+
+        DO ic = lc,lhab
+        dab0lh(mgs,il,ic) =  dab0(il,ic) ! dab0(ic,il)
+        dab1lh(mgs,il,ic) =  dab1(il,ic) ! dab1(ic,il)
+        ENDDO
+      end do
+      ENDDO
+
+      
+!      DO mgs = 1,ngscnt
+        DO il = lr,lhab
+          da0lx(:,il) = da0(il)
+        ENDDO
+        da0lh(:) = da0(lh)
+        da0lr(:) = da0(lr)
+        da1lr(:) = da1(lr)
+        da0lc(:) = da0(lc)
+        da1lc(:) = da1(lc)
+
+       if ( ndebug .gt. 0 .and. my_rank>=0 ) write(0,*) my_rank,  'ICEZVD_GS: dbg = set rz'
+
+        IF ( lzh < 1 .or. lzhl < 1 ) THEN
+          rzxhlh(:) = rzhl/rz
+        ELSEIF ( lzh > 1 .and. lzhl > 1 ) THEN
+          rzxhlh(:) = 1.
+        ENDIF
+        IF ( lzr > 1 ) THEN
+          rzxh(:) = 1.
+          rzxhl(:) = 1.
+        ELSE
+          rzxh(:) = rz
+          rzxhl(:) = rzhl
+        ENDIF
+        
+        IF ( imurain == 1 .and. imusnow == 3 .and. lzr < 1 ) THEN
+          rzxs(:) = rzs
+        ELSEIF ( imurain == imusnow .or. lzr > 1 ) THEN
+          rzxs(:) = 1.
+        ENDIF
+ !     ENDDO
+      
+      IF ( lhl .gt. 1 ) THEN
+      DO mgs = 1,ngscnt
+        da0lhl(mgs) = da0(lhl)
+      ENDDO
+      ENDIF
+      
+      ventrx(:) = ventr
+      ventrxn(:) = ventrn
+      gf1palp(:) = gamma_sp(1.0 + alphar)
+
+!
+!  set factors
+!
+      do mgs = 1,ngscnt
+!
+      ssi(mgs) = qx(mgs,lv)/qis(mgs)
+      ssw(mgs) = qx(mgs,lv)/qvs(mgs)
+!
+      tsqr(mgs) = temg(mgs)**2
+!
+      temgx(mgs) = min(temg(mgs),313.15)
+      temgx(mgs) = max(temgx(mgs),233.15)
       felv(mgs) = 2500837.367 * (273.15/temgx(mgs))**((0.167)+(3.67e-4)*temgx(mgs))
 !
       temcgx(mgs) = min(temg(mgs),273.15)
@@ -12112,6 +13468,7 @@ subroutine nssl_2mom_gs   &
           
           tmp = qx(mgs,li)+qx(mgs,ls)+qx(mgs,lh)
           IF ( lhl > 1 ) tmp = tmp + qx(mgs,lhl)
+          IF ( lf > 1 ) tmp = tmp + qx(mgs,lf)
           cvm = cv+cvv*qx(mgs,lv)+cpl*(qx(mgs,lc)+qx(mgs,lr))   &
                                   +cpigb*(tmp)
 
@@ -12260,14 +13617,86 @@ subroutine nssl_2mom_gs   &
 
       end do
 
+      IF ( ipconc == 5 .and. imydiagalpha > 1 ) THEN
+
+        DO mgs = 1,ngscnt
+          !IF ( igs(mgs) == 19 ) write(0,*) 'k,qr,qh,cr,ch = ',kgs(mgs),qx(mgs,lr),cx(mgs,lr),qx(mgs,lh),cx(mgs,lh)
+          IF ( qx(mgs,lr) .gt. qxmin(lr) .and. cx(mgs,lr) > cxmin ) THEN
+             xv(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(xdn(mgs,lr)*cx(mgs,lr))            ! 
+             xdia(mgs,lr,3) = (xv(mgs,lr)*6.0*cwc1)**(1./3.) 
+             alpha(mgs,lr) = Min(alphamax, c1r*tanh(c2r*(xdia(mgs,lr,3)*1000. - c3r)) + c4r)
+           ! IF ( igs(mgs) == 19 ) write(0,*) 'imy: i,k,alpr,xdia = ',igs(mgs),kgs(mgs),alpha(mgs,lr),xdia(mgs,lr,3)*1000.
+          ENDIF
+          IF ( qx(mgs,lh) .gt. qxmin(lh) .and. cx(mgs,lh) > cxmin ) THEN
+             xv(mgs,lh) = rho0(mgs)*qx(mgs,lh)/(xdn(mgs,lh)*cx(mgs,lh))            ! 
+             xdia(mgs,lh,3) = (xv(mgs,lh)*6.*piinv)**(1./3.) ! mwfac*xdia(mgs,lh,1) ! (xv(mgs,lh)*cwc0*6.0)**(1./3.)
+             alpha(mgs,lh) = Min(alphamax, c1h*tanh(c2h*(xdia(mgs,lh,3)*1000. - c3h)) + c4h)
+            
+           ! IF ( igs(mgs) == 19 ) write(0,*) 'imy: i,k,alph,xdia = ',igs(mgs),kgs(mgs),alpha(mgs,lh),xdia(mgs,lh,3)*1000.
+            il = lh
+            DO ic = lc,lh-1 ! lhab
+               i = Nint( alpha(mgs,il)*dqiacralphainv )
+               IF ( ic == lc .or. ic == li .or. ic == ls .or. (ic == lr .and. imurain == 3) ) THEN
+                 alp = (3.*alpha(mgs,ic) + 2.)
+                 j = Nint( (3.*alpha(mgs,ic) + 2.)*dqiacralphainv )
+               ELSE ! IF ( ic == lr .and. imurain == 1 ) ! rain
+                 alp = alpha(mgs,ic)
+                 j = Nint( alpha(mgs,ic)*dqiacralphainv )
+               ENDIF
+             
+               dab0lh(mgs,ic,il) = dab0lu(j,i,ic,il)
+               dab1lh(mgs,ic,il) = dab1lu(j,i,ic,il)
+               dab0lh(mgs,il,ic) = dab0lu(i,j,il,ic)
+               dab1lh(mgs,il,ic) = dab1lu(i,j,il,ic)
+             ENDDO
+          ENDIF
+!        alpha(:,lr) = 0. ! 10.
+!        alpha(:,lh) = 0. ! 10.
+          IF ( lhl > 0 ) THEN
+          IF ( qx(mgs,lhl) .gt. qxmin(lhl) .and. cx(mgs,lhl) > cxmin ) THEN
+             xv(mgs,lhl) = rho0(mgs)*qx(mgs,lhl)/(xdn(mgs,lhl)*cx(mgs,lhl))            ! 
+             xdia(mgs,lhl,3) = (xv(mgs,lhl)*6.*piinv)**(1./3.)
+             IF ( xdia(mgs,lhl,3) < 0.008 ) THEN
+               alpha(mgs,lhl) = Min(alphamax, c1hl*tanh(c2hl*(xdia(mgs,lhl,3)*1000. - c3hl)) + c4hl)
+             ELSE
+               alpha(mgs,lhl) = Min(alphamax, c5hl*xdia(mgs,lhl,3)*1000. + c6hl)
+             ENDIF
+
+            il = lhl
+            DO ic = lc,lh-1 ! lhab
+               i = Nint( alpha(mgs,il)*dqiacralphainv )
+               IF ( ic == lc .or. ic == li .or. ic == ls .or. (ic == lr .and. imurain == 3) ) THEN
+                 alp = (3.*alpha(mgs,ic) + 2.)
+                 j = Nint( (3.*alpha(mgs,ic) + 2.)*dqiacralphainv )
+               ELSE ! IF ( ic == lr .and. imurain == 1 ) ! rain
+                 alp = alpha(mgs,ic)
+                 j = Nint( alpha(mgs,ic)*dqiacralphainv )
+               ENDIF
+             
+               dab0lh(mgs,ic,il) = dab0lu(j,i,ic,il)
+               dab1lh(mgs,ic,il) = dab1lu(j,i,ic,il)
+               dab0lh(mgs,il,ic) = dab0lu(i,j,il,ic)
+               dab1lh(mgs,il,ic) = dab1lu(i,j,il,ic)
+             ENDDO
+
+          ENDIF
+          ENDIF
+
+
+
+        ENDDO
+      ENDIF
+      
 
        IF ( imurain == 3 ) THEN
          IF ( lzr > 1 ) THEN
            alphashr = 0.0
            alphamlr = -2.0/3.0
+           alphasmlr = -2.0/3.0
          ELSE
            alphashr = xnu(lr)
            alphamlr = xnu(lr)
+           alphasmlr = xnu(lr)
          ENDIF
 !         massfacshr = ( (2. + 3.*(1. +alphashr) )/( 3.*(1. + alphashr) ) )**(1./3.) ! this is the diameter factor
 !         massfacmlr = ( (2. + 3.*(1. +alphamlr) )/( 3.*(1. + alphamlr) ) )**(1./3.)
@@ -12277,9 +13706,11 @@ subroutine nssl_2mom_gs   &
          IF ( lzr > 1 ) THEN
            alphashr = 4.0
            alphamlr = 4.0
+           alphasmlr = alphasmlr0
          ELSE
            alphashr = alphar
            alphamlr = alphar
+           alphasmlr = alphar
          ENDIF
 !         massfacshr = (3.0 + alphashr)*((3.+alphashr)*(2.+alphashr)*(1. + alphashr) )**(-1./3.) ! this is the diameter factor
 !         massfacmlr = (3.0 + alphamlr)*((3.+alphamlr)*(2.+alphamlr)*(1. + alphamlr) )**(-1./3.)
@@ -12287,110 +13718,819 @@ subroutine nssl_2mom_gs   &
          massfacmlr = (3.0 + alphamlr)**3/((3.+alphamlr)*(2.+alphamlr)*(1. + alphamlr) )
        ENDIF
        
+!  Find shape parameter rain
 
-!
-!  set some values for ice nucleation
-!
-      do mgs = 1,ngscnt
-      kp1 = Min(nz, kgs(mgs)+1 )
-!      wvel(mgs) = (0.5)*(w(igs(mgs),jgs,kp1)   &
-!     &                  +w(igs(mgs),jgs,kgs(mgs)))
+      g1shr = 1.0
+      g1mlr = 1.0
+      g1smlr = 1.0
+ 
+!      CALL cld_cpu('Z-MOMENT-1')  
+      
+      ! set base g1x in case rain is not 3-moment
+       IF ( ipconc >= 6 .and. imurain == 3 ) THEN
+         il = lr
+         DO mgs = 1,ngscnt
+!           g1x(mgs,il) = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
+           g1x(mgs,il) = (alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0))
+         ENDDO
+       ENDIF
 
+      IF (lzr > 1 ) THEN
+       IF ( imurain == 3 ) THEN
+         g1shr = (alphashr+2.0)/((alphashr+1.0))
+         g1mlr = (alphamlr+2.0)/((alphamlr+1.0))
+         g1smlr = (alphasmlr+2.0)/((alphasmlr+1.0))
+       ELSEIF ( imurain == 1 ) THEN
+!         g1shr = 36.*(6.0 + alphashr)*(5.0 + alphashr)*(4.0 + alphashr)/ &
+!     &            (pi**2*(3.0 + alphashr)*(2.0 + alphashr)*(1.0 + alphashr))
+         g1shr = (6.0 + alphashr)*(5.0 + alphashr)*(4.0 + alphashr)/ &
+     &            ((3.0 + alphashr)*(2.0 + alphashr)*(1.0 + alphashr))
+!         g1mlr = 36.*(6.0 + alphamlr)*(5.0 + alphamlr)*(4.0 + alphamlr)/ &
+!     &            (pi**2*(3.0 + alphamlr)*(2.0 + alphamlr)*(1.0 + alphamlr))
+         g1mlr = (6.0 + alphamlr)*(5.0 + alphamlr)*(4.0 + alphamlr)/ &
+     &            ((3.0 + alphamlr)*(2.0 + alphamlr)*(1.0 + alphamlr))
+         g1smlr = (6.0 + alphasmlr)*(5.0 + alphasmlr)*(4.0 + alphasmlr)/ &
+     &            ((3.0 + alphasmlr)*(2.0 + alphasmlr)*(1.0 + alphasmlr))
+       ENDIF
+      ENDIF
+
+      IF ( lzr > 1 .and. imurain == 3 ) THEN ! { RAIN SHAPE PARAM
       
-        wvelkm1(mgs) = (0.5)*(w(igs(mgs),jgs,kgs(mgs))   &
-     &                    +w(igs(mgs),jgs,kgsm(mgs)))
-      cninm(mgs) = t7(igs(mgs),jgs,kgsm(mgs))
-      cnina(mgs) = t7(igs(mgs),jgs,kgs(mgs))
-      cninp(mgs) = t7(igs(mgs),jgs,kgsp(mgs))
-      end do
+      
+!      CALL cld_cpu('Z-MOMENT-1r')  
+          il = lr
+          DO mgs = 1,ngscnt
+          
 
-!
-!  Set a couple of cloud variables...
-!
+         IF ( iresetmoments == 1 .or. iresetmoments == il .or. iresetmoments == -1  ) THEN ! .or. qx(mgs,il) <= qxmin(il)  THEN
+         IF ( zx(mgs,il) <= zxmin ) THEN !  .and. qx(mgs,il) > 0.05e-3  THEN
+!!            write(91,*) 'zx=0; qx,cx = ',1000.*qx(mgs,il),cx(mgs,il)
+           qx(mgs,il) = 0.0
+           cx(mgs,il) = 0.0
+           an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),il)
+           an(igs(mgs),jgs,kgs(mgs),il) = qx(mgs,il)
+           an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
+         ELSEIF ( iresetmoments == -1 .and. qx(mgs,il) < qxmin(il) ) THEN
+           zx(mgs,il) = 0.0
+           cx(mgs,il) = 0.0
+           an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),il)
+
+           qx(mgs,il) = 0.0
+           an(igs(mgs),jgs,kgs(mgs),il) = qx(mgs,il)
+           an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
+           an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
+         
+         ELSEIF ( cx(mgs,il) <= cxmin .and. iresetmoments /= -1 ) THEN !  .and. qx(mgs,il) > 0.05e-3   THEN
+         
+           qx(mgs,lv) = qx(mgs,lv) + qx(mgs,il)
+           zx(mgs,lr) = 0.0
+           qx(mgs,lr) = 0.0
+           an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),lr)
+           an(igs(mgs),jgs,kgs(mgs),lr) = qx(mgs,lr)
+           an(igs(mgs),jgs,kgs(mgs),lz(lr)) = zx(mgs,lr)
+         ENDIF
+         ENDIF
 
-!      SUBROUTINE setvt(ngscnt,qx,qxmin,cx,rho0,rhovt,xdia,cno,
-!     :                 xmas,xdn,xvmn,xvmx,xv,cdx,
-!     :                 ipconc,ndebug)
-!      SUBROUTINE setvtz(ngscnt,qx,qxmin,qxw,cx,rho0,rhovt,xdia,cno, &
-!     &                 xmas,vtxbar,xdn,xvmn,xvmx,xv,cdx,            &
-!     &                 ipconc1,ndebug1,ngs,nz,kgs,cwnccn,fadvisc,   &
-!     &                 cwmasn,cwmasx,cwradn,cnina,cimna,cimxa,      &
-!     &                 itype1a,itype2a,temcg,infdo,alpha)
+         IF ( .false. .and. zx(mgs,il) <= zxmin .and. cx(mgs,il) <= cxmin ) THEN
+           zx(mgs,il) = 0.0
+           cx(mgs,il) = 0.0
+           an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),il)
 
+           qx(mgs,il) = 0.0
+           an(igs(mgs),jgs,kgs(mgs),il) = qx(mgs,il)
+           an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
+           an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
+         ENDIF
+         
+         IF ( qx(mgs,lr) .gt. qxmin(lr) ) THEN
 
-      infdo = 0
-      IF ( rimdenvwgt > 0 ) infdo = 1
+        xv(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(xdn(mgs,lr)*Max(1.0e-11,cx(mgs,lr)))
+        IF ( xv(mgs,lr) .gt. xvmx(lr) ) THEN
+!          xv(mgs,lr) = xvmx(lr)
+!          cx(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(xvmx(lr)*xdn(mgs,lr))
+        ELSEIF ( xv(mgs,lr) .lt. xvmn(lr) ) THEN
+          xv(mgs,lr) = xvmn(lr)
+          cx(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(xvmn(lr)*xdn(mgs,lr))
+        ENDIF
 
-      call setvtz(ngscnt,qx,qxmin,qxw,cx,rho0,rhovt,xdia,cno,cnostmp,   &
-     &                 xmas,vtxbar,xdn,xvmn,xvmx,xv,cdx,cdxgs,   &
-     &                 ipconc,ndebug,ngs,nz,kgs,fadvisc,   &
-     &                 cwmasn,cwmasx,cwradn,cnina,cimn,cimx,   &
-     &                 itype1,itype2,temcg,infdo,alpha,0,axx,bxx) ! ,cdh,cdhl)
-!     &                 itype1,itype2,temcg,infdo,alpha,0,axh,bxh,axhl,bxhl) ! ,cdh,cdhl)
+          IF ( zx(mgs,il) > 0.0 .and. cx(mgs,il) <= 0.0 ) THEN
+!  have mass and reflectivity but no concentration, so set concentration, using default alpha
+            g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
+            z   = zx(mgs,il)
+            qr  = qx(mgs,il)
+            cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/(z*xdn(mgs,lr)**2)
+!            an(igs(mgs),jgs,kgs(mgs),ln(il)) = zx(mgs,il)
+           ELSEIF ( zx(mgs,il) <= 0.0 .and. cx(mgs,il) > 0.0 ) THEN
+!  have mass and concentration but no reflectivity, so set reflectivity, using default alpha
+            g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
+            chw = cx(mgs,il)
+            qr  = qx(mgs,il)
+            zx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/(xdn(mgs,lr)**2*chw)
+            an(igs(mgs),jgs,kgs(mgs),lz(lr)) = zx(mgs,lr)
+
+           ELSEIF ( zx(mgs,il) <= 0.0 .and. cx(mgs,il) <= 0.0 ) THEN
+!   How did this happen?
+         ! set values according to dBZ of -10, or Z = 0.1
+!              0.1 = 1.e18*0.224*an(ix,jy,kz,lzh)*(hwdn/rwdn)**2
+               zx(mgs,il) = 1.e-19/0.224*(xdn0(lr)/xdn0(il))**2
+               an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
+               
+            g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
+               z   = zx(mgs,il)
+               qr  = qx(mgs,il)
+               cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/(z*1000.*1000)
+               an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
+          ENDIF
+        
+          IF ( zx(mgs,lr) > 0.0 ) THEN
+            xv(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(1000.*cx(mgs,lr))
+            vr = xv(mgs,lr)
+!            z = 36.*(alpha(kz)+2.0)*a(ix,jy,kz,lnr)*vr**2/((alpha(kz)+1.0)*pi**2)
+           qr = qx(mgs,lr)
+           nrx = cx(mgs,lr)
+           z = zx(mgs,lr)
+
+!           xv = (db(1,kz)*a(1,1,kz,lr))**2/(a(1,1,kz,lnr))
+!           rd = z*(pi/6.*1000.)**2/xv
+
+! determine shape parameter alpha by iteration
+           IF ( z .gt. 0.0 ) THEN
+!           alpha(mgs,lr) = 3.
+           alp = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/(z*pi**2) - 1.
+!           print*,'kz, alp, alpha(kz) = ',kz,alp,alpha(kz),rd,z,xv
+           DO i = 1,20
+            IF ( Abs(alp - alpha(mgs,lr)) .lt. 0.01 ) EXIT
+             alpha(mgs,lr) = Max( rnumin, Min( rnumax, alp ) )
+           alp = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/(z*pi**2) - 1.
+             alp = Max( rnumin, Min( rnumax, alp ) )
+           ENDDO
 
+! check for artificial breakup (rain larger than allowed max size)
+        IF (  (xv(mgs,il) .gt. xvmx(il) .or. (ioldlimiter >= 2 .and. xv(mgs,il) .gt. xvmx(il)/8.) )) THEN
+          tmp = cx(mgs,il)
+          IF ( ioldlimiter >= 2 ) THEN ! MY-style active breakup
+            x = (6.*rho0(mgs)*qx(mgs,il)/(pi*xdn(mgs,il)*cx(mgs,il)))**(1./3.)
+            x1 = Max(0.0e-3, x - 3.0e-3)
+            x2 = Max(0.5, x/6.0e-3)
+            x3 = x2**3
+            cx(mgs,il) = cx(mgs,il)*Max((1.+2.222e3*x1**2), x3)
+            xv(mgs,il) = xv(mgs,il)/Max((1.+2.222e3*x1**2), x3)
+          ELSE ! simple cutoff 
+            xv(mgs,il) = Min( xvmx(il), Max( xvmn(il),xv(mgs,il) ) )
+            xmas(mgs,il) = xv(mgs,il)*xdn(mgs,il)
+            cx(mgs,il) = rho0(mgs)*qx(mgs,il)/(xmas(mgs,il))
+          ENDIF
+            !xmas(mgs,il) = xv(mgs,il)*xdn(mgs,il)
+            !cx(mgs,il) = rho0(mgs)*qx(mgs,il)/(xmas(mgs,il))
 
-       IF ( lwsm6 .and. ipconc == 0 ) THEN
-         tmp = Max(qxmin(lh), qxmin(ls))
-         DO mgs = 1,ngscnt
-           sum = qx(mgs,lh) + qx(mgs,ls)
-           IF ( sum > tmp ) THEN
-             vt2ave(mgs) = (qx(mgs,lh)*vtxbar(mgs,lh,1) + qx(mgs,ls)*vtxbar(mgs,ls,1))/sum
-           ELSE
-             vt2ave(mgs) = 0.0
-           ENDIF
-         ENDDO
-       ENDIF
+          IF ( tmp < cx(mgs,il) ) THEN ! breakup
 
+            g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
+            zx(mgs,il) = zx(mgs,il) + g1*(rho0(mgs)/xdn(mgs,il))**2*( (qx(mgs,il)/tmp)**2 * (tmp-cx(mgs,il)) )
+            an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
 
-!
-!  Set number concentrations (need xdia from setvt)
-!
-      if ( ndebug .gt. 0 ) write(0,*) 'ICEZVD_GS: Set concentration'
-      IF ( ipconc .lt. 1 ) THEN
-         cina(1:ngscnt) = cx(1:ngscnt,li)
-      ENDIF
-      if ( ipconc .lt. 5 ) then
-      do mgs = 1,ngscnt
+           vr = xv(mgs,lr)
+           qr = qx(mgs,lr)
+           nrx = cx(mgs,lr)
+           z = zx(mgs,lr)
 
 
-      IF ( ipconc .lt. 3 ) THEN
-!      cx(mgs,lr) = 0.0
-      if ( qx(mgs,lr) .gt. qxmin(lh) )  then
-!      cx(mgs,lr) = cno(lr)*xdia(mgs,lr,1)
-!      xv(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(xdn(mgs,lr)*cx(mgs,lr))
-      end if
-      ENDIF
+! determine shape parameter alpha by iteration
+           alp = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/(z*pi**2) - 1.
+           DO i = 1,20
+            IF ( Abs(alp - alpha(mgs,lr)) .lt. 0.01 ) EXIT
+             alpha(mgs,lr) = Max( rnumin, Min( rnumax, alp ) )
+           alp = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/(z*pi**2) - 1.
+             alp = Max( rnumin, Min( rnumax, alp ) )
+           ENDDO
 
-      IF ( ipconc .lt. 4 ) THEN
-!      tmp = cx(mgs,ls)
-!      cx(mgs,ls) = 0.0
-      if ( qx(mgs,ls) .gt. qxmin(ls) )  then
-!      cx(mgs,ls) = cno(ls)*xdia(mgs,ls,1)
-!      xv(mgs,ls) = rho0(mgs)*qx(mgs,ls)/(xdn(mgs,ls)*cx(mgs,ls))
-      end if
-      ENDIF ! ( ipconc .lt. 4 )
+            
+          ENDIF
+        ENDIF
 
-      IF ( ipconc .lt. 5 ) THEN
+!
+! Check whether the shape parameter is at or less than the minimum, and if it is, reset the 
+! concentration or reflectivity to match (prevents reflectivity from being out of balance with Q and N)
+!
+              g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
+           IF ( .true. .and. (alpha(mgs,il) <= rnumin .or. alp == rnumin .or. alp == rnumax) ) THEN
 
+            IF ( rescale_high_alpha .and. alp >= rnumax - 0.01  ) THEN  ! reset c at high alpha to prevent growth in Z
+              cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/z*(1./(xdn(mgs,il)))**2
+              an(igs(mgs),jy,kgs(mgs),ln(il)) = cx(mgs,il)
+            
+            ELSEIF ( rescale_low_alphar .and. alp <= rnumin ) THEN
+             z  = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/((alpha(mgs,lr)+1.0)*pi**2)
+             zx(mgs,il) = z
+             an(igs(mgs),jy,kgs(mgs),lz(il)) = zx(mgs,il)
+            ENDIF
+           ENDIF
+           
+         ! set g1x to use as G factor later. If alpha is in the range ( rnumin < alpha < rnumax ), then 
+         ! this will be the same as computing G from alpha.  If alpha = rnumax, however, it probably means that
+         ! the moments are not matched correctly, so we compute G from the moments instead so that the dZ/dt rates
+         ! stay consistent with dN/dt and dq/dt.
+           IF ( alp >= rnumax - 0.01 ) THEN
+!             g1x(mgs,il) = 6**2*zx(mgs,il)/(cx(mgs,il)*(pi*xv(mgs,lr))**2)
+!             g1x(mgs,il) = xdn(mgs,il)*zx(mgs,il)*cx(mgs,il)/((rho0(mgs)*qx(mgs,lr))**2)
+             g1x(mgs,il) = (pi*xdn(mgs,il))**2*zx(mgs,il)*cx(mgs,il)/((6.*rho0(mgs)*qx(mgs,il))**2)
+           ELSE
+             g1x(mgs,il) = g1
+           ENDIF
+           
+           tmp = alpha(mgs,lr) + 4./3.
+           i = Int(dgami*(tmp))
+           del = tmp - dgam*i
+           x = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
+
+           tmp = alpha(mgs,lr) + 1.
+           i = Int(dgami*(tmp))
+           del = tmp - dgam*i
+           y = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
+           
+           gf1palp(mgs) = y
 
-!      cx(mgs,lh) = 0.0
-      if ( qx(mgs,lh) .gt. qxmin(lh) )  then
-!      cx(mgs,lh) = cno(lh)*xdia(mgs,lh,1)
-!      xv(mgs,lh) = Max(xvmn(lh), rho0(mgs)*qx(mgs,lh)/(xdn(mgs,lh)*cx(mgs,lh)) )
-!      xdia(mgs,lh,3) = (xv(mgs,lh)*6./pi)**(1./3.) 
-      end if
+!           ventrx(mgs) = Gamma_sp(alpha(mgs,lr) + 4./3.)/(alpha(mgs,lr) + 1.)**(1./3.)/Gamma_sp(alpha(mgs,lr) + 1.)
+           ventrx(mgs) = x/(y*(alpha(mgs,lr) + 1.)**(1./3.))
 
-      ENDIF ! ( ipconc .lt. 5 )
+           IF ( imurain == 3 .and. izwisventr == 2 ) THEN
 
-      end do
-      end if
-      
-      IF ( ipconc .ge. 2 ) THEN
-      DO mgs = 1,ngscnt
-        
-        rb(mgs) = 0.5*xdia(mgs,lc,1)*(1./(1.+alpha(mgs,lc)))**(1./6.)
-        xl2p(mgs) = Max(0.0d0, 2.7e-2*xdn(mgs,lc)*cx(mgs,lc)*xv(mgs,lc)*   &
-     &           ((0.5e20*rb(mgs)**3*xdia(mgs,lc,1))-0.4) )
+           tmp = alpha(mgs,lr) + 1.5 + br/6.
+           i = Int(dgami*(tmp))
+           del = tmp - dgam*i
+           x = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
+
+!           ventrx(mgs) = Gamma_sp(alpha(mgs,lr) + 1.5 + br/6.)/Gamma_sp(alpha(mgs,lr) + 1.)
+           ventrxn(mgs) = x/(y*(alpha(mgs,lr) + 1.)**((1.+br)/6. + 1./3.))
+           
+! This whole section is imurain == 3, so this branch never runs
+!           ELSEIF ( imurain == 1 .and.  iferwisventr == 2 ) THEN
+!
+!           tmp = alpha(mgs,lr) + 2.5 + br/2.
+!           i = Int(dgami*(tmp))
+!           del = tmp - dgam*i
+!           x = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
+!
+!!           ventrx(mgs) = Gamma_sp(alpha(mgs,lr) + 1.5 + br/6.)/Gamma_sp(alpha(mgs,lr) + 1.)
+!           ventrxn(mgs) = x/y
+           
+           
+           ENDIF
+           
+           ENDIF
+          ENDIF
+          
+          ENDIF
+          
+          ENDDO
+!        CALL cld_cpu('Z-MOMENT-1r')  
+        ENDIF ! }
+        
+
+!  Find shape parameters for graupel and hail
+      IF ( ipconc .ge. 6 ) THEN
+            
+        DO il = lr,lhab
+          
+        ! set base values of g1x
+          IF ( (.not. ( il == lr .and. imurain == 3 )) .and. ( il == lr .or. il == lh .or. il == lhl .or. il == lf ) ) THEN
+          DO mgs = 1,ngscnt
+            g1x(mgs,il) = (6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
+     &            ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il)))
+          ENDDO
+          ENDIF
+        
+        IF ( lz(il) .gt. 1   .and. ( .not. ( il == lr .and. imurain == 3 )) ) THEN
+        
+        DO mgs = 1,ngscnt
+
+
+         IF ( iresetmoments == 1 .or. iresetmoments == il .or. iresetmoments == -1  ) THEN ! .or. qx(mgs,il) <= qxmin(il) ) THEN
+         IF ( zx(mgs,il) <= zxmin ) THEN !  .and. qx(mgs,il) > 0.05e-3 ) THEN
+!!            write(91,*) 'zx=0; qx,cx = ',1000.*qx(mgs,il),cx(mgs,il)
+           qx(mgs,il) = 0.0
+           cx(mgs,il) = 0.0
+           zx(mgs,il) = 0.0
+           an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),il)
+           an(igs(mgs),jgs,kgs(mgs),il) = qx(mgs,il)
+           an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
+           an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
+         ELSEIF ( iresetmoments == -1 .and. qx(mgs,il) < qxmin(il) ) THEN
+           zx(mgs,il) = 0.0
+           cx(mgs,il) = 0.0
+           an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),il)
+
+           qx(mgs,il) = 0.0
+           an(igs(mgs),jgs,kgs(mgs),il) = qx(mgs,il)
+           an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
+           an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
+         
+         ELSEIF ( cx(mgs,il) <= cxmin .and. iresetmoments /= -1 ) THEN !  .and. qx(mgs,il) > 0.05e-3  ) THEN
+           qx(mgs,lv) = qx(mgs,lv) + qx(mgs,il)
+           zx(mgs,il) = 0.0
+           cx(mgs,il) = 0.0
+           qx(mgs,il) = 0.0
+           an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),il)
+           an(igs(mgs),jgs,kgs(mgs),il) = qx(mgs,il)
+           an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
+           an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
+         ENDIF
+         ENDIF
+
+         IF ( zx(mgs,il) <= zxmin .and. cx(mgs,il) <= cxmin ) THEN
+           zx(mgs,il) = 0.0
+           cx(mgs,il) = 0.0
+           an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),il)
+
+           qx(mgs,il) = 0.0
+           an(igs(mgs),jgs,kgs(mgs),il) = qx(mgs,il)
+           an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
+           an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
+         ENDIF
+        
+        IF ( qx(mgs,il) .gt. qxmin(il) ) THEN
+
+        xv(mgs,il) = rho0(mgs)*qx(mgs,il)/(xdn(mgs,il)*Max(1.0e-9,cx(mgs,il)))
+        xmas(mgs,il) = xv(mgs,il)*xdn(mgs,il)
+
+        IF ( xv(mgs,il) .lt. xvmn(il) ) THEN
+          xv(mgs,il) = Min( xvmx(il), Max( xvmn(il),xv(mgs,il) ) )
+          xmas(mgs,il) = xv(mgs,il)*xdn(mgs,il)
+          cx(mgs,il) = rho0(mgs)*qx(mgs,il)/(xmas(mgs,il))
+        ENDIF
+
+          IF ( zx(mgs,il) > 0.0 .and. cx(mgs,il) <= 0.0 ) THEN
+!  have mass and reflectivity but no concentration, so set concentration, using default alpha
+            g1 = (6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
+     &            ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il)))
+            z   = zx(mgs,il)
+            qr  = qx(mgs,il)
+!            cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/z
+            cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(6.*qr)**2/(z*(pi*xdn(mgs,il))**2)
+
+           ELSEIF ( zx(mgs,il) <= 0.0 .and. cx(mgs,il) > cxmin ) THEN
+!  have mass and concentration but no reflectivity, so set reflectivity, using default alpha
+!            g1 = (6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
+!     &            ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il)))
+            chw = cx(mgs,il)
+            qr  = qx(mgs,il)
+!            zx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/chw
+!            zx(mgs,il) = Min(zxmin*1.1, g1*dn(igs(mgs),jy,kgs(mgs))**2*(6.*qr)**2/(chw*(pi*xdn(mgs,il))**2) )
+            g1 = (6.0 + alphamax)*(5.0 + alphamax)*(4.0 + alphamax)/ &
+     &            ((3.0 + alphamax)*(2.0 + alphamax)*(1.0 + alphamax))
+            zx(mgs,il) = Max(zxmin*1.1, g1*dn(igs(mgs),jy,kgs(mgs))**2*(6*qr)**2/(chw*(pi*xdn(mgs,il))**2) )
+            an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
+
+           ELSEIF ( zx(mgs,il) <= 0.0 .and. cx(mgs,il) <= 0.0 ) THEN
+!   How did this happen?
+         ! set values according to dBZ of -10, or Z = 0.1
+!              0.1 = 1.e18*0.224*an(ix,jy,kz,lzh)*(hwdn/rwdn)**2
+               zx(mgs,il) = 1.e-19/0.224*(xdn0(lr)/xdn0(il))**2
+               an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
+               
+               g1 = (6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
+     &            ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il)))
+               z   = zx(mgs,il)
+               qr  = qx(mgs,il)
+!               cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/z
+               cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(6.*qr)**2/(z*(pi*xdn(mgs,il))**2)
+               an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
+           ELSE
+          
+          chw = cx(mgs,il)
+          qr  = qx(mgs,il)
+          z   = zx(mgs,il)
+
+          IF ( zx(mgs,il) .gt. 0. ) THEN
+           
+!            rdi = z*(pi/6.*1000.)**2*chw/((rho0(mgs)*qr)**2)
+            rdi = z*(pi/6.*xdn(mgs,il))**2*chw/((rho0(mgs)*qr)**2)
+
+!           alp = 1.e18*(6.+alpha(mgs,il))*(5.0+alpha(mgs,il))*(4.0+alpha(mgs,il))/
+!     :            ((3.0+alpha(mgs,il))*(2.0+alpha(mgs,il))*rdi) - 1.0
+           alp = (6.0+alpha(mgs,il))*(5.0+alpha(mgs,il))*(4.0+alpha(mgs,il))/   &
+     &            ((3.0+alpha(mgs,il))*(2.0+alpha(mgs,il))*rdi) - 1.0
+!           print*,'kz, alp, alpha(mgs,il) = ',kz,alp,alpha(mgs,il),rdi,z,xv
+           alp = Max( alphamin, Min( alphamax, alp ) )
+           
+         IF ( newton ) THEN
+           DO i = 1,10
+             IF ( Abs(alp - alpha(mgs,il)) .lt. 0.01 ) EXIT
+             alpha(mgs,il) = Max( alphamin, Min( alphamax, alp ) )
+             alp = alp + ( galpha(alp) - rdi )/dgalpha(alp)
+             alp = Max( alphamin, Min( alphamax, alp ) )
+           ENDDO
+           
+         ELSE
+           DO i = 1,10
+!            IF ( 100.*Abs(alp - alpha(mgs,il))/(Abs(alpha(mgs,il))+1.e-5) .lt. 1. ) EXIT
+             IF ( Abs(alp - alpha(mgs,il)) .lt. 0.01 ) EXIT
+             alpha(mgs,il) = Max( alphamin, Min( alphamax, alp ) )
+!             alp = 1.e18*(6.+alpha(mgs,il))*(5.0+alpha(mgs,il))*(4.0+alpha(mgs,il))/
+!     :            ((3.0+alpha(mgs,il))*(2.0+alpha(mgs,il))*rdi) - 1.0
+             alp = (6.+alpha(mgs,il))*(5.0+alpha(mgs,il))*(4.0+alpha(mgs,il))/   &
+     &            ((3.0+alpha(mgs,il))*(2.0+alpha(mgs,il))*rdi) - 1.0
+!           print*,'i,alp = ',i,alp
+             alp = Max( alphamin, Min( alphamax, alp ) )
+           ENDDO
+          ENDIF
+
+
+! check for artificial breakup (graupel/hail larger than allowed max size)
+        IF ( imaxdiaopt == 1 ) THEN
+          xvbarmax = xvmx(il) 
+        ELSEIF ( imaxdiaopt == 2 ) THEN ! test against maximum mass diameter
+          xvbarmax = xvmx(il) /((3. + alpha(mgs,il))**3/((3. + alpha(mgs,il))*(2. + alpha(mgs,il))*(1. + alpha(mgs,il))))
+        ELSEIF ( imaxdiaopt == 3 ) THEN ! test against mass-weighted diameter
+          xvbarmax = xvmx(il) /((4. + alpha(mgs,il))**3/((3. + alpha(mgs,il))*(2. + alpha(mgs,il))*(1. + alpha(mgs,il))))
+        ELSE
+          xvbarmax = xvmx(il) 
+        ENDIF
+
+        IF (  xv(mgs,il) .gt. xvbarmax .or. (il == lr .and. ioldlimiter >= 2 .and. xv(mgs,il) .gt. xvmx(il)/8.)) THEN
+          tmp = cx(mgs,il)
+          IF( ioldlimiter >= 2 .and. il == lr) THEN ! MY-style drop limiter for rain
+            x = (6.*rho0(mgs)*qx(mgs,il)/(pi*xdn(mgs,il)*cx(mgs,il)))**(1./3.)
+            x1 = Max(0.0e-3, x - 3.0e-3)
+            x2 = Max(0.5, x/6.0e-3)
+            x3 = x2**3
+            cx(mgs,il) = cx(mgs,il)*Max((1.+2.222e3*x1**2), x3)
+            xv(mgs,il) = xv(mgs,il)/Max((1.+2.222e3*x1**2), x3)
+          ELSE
+            xv(mgs,il) = Min( xvbarmax, Max( xvmn(il),xv(mgs,il) ) )
+            xmas(mgs,il) = xv(mgs,il)*xdn(mgs,il)
+            cx(mgs,il) = rho0(mgs)*qx(mgs,il)/(xmas(mgs,il))
+          ENDIF
+          IF ( tmp < cx(mgs,il) ) THEN ! artificial breakup has happened, so need to adjust reflectivity and find new shape parameter
+            g1 = 36.*(6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
+     &            ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il))*pi**2)
+             zx(mgs,il) = zx(mgs,il) + g1*(rho0(mgs)/xdn(mgs,il))**2*( (qx(mgs,il)/tmp)**2 * (tmp-cx(mgs,il)) )
+             an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
+
+          chw = cx(mgs,il)
+          qr  = qx(mgs,il)
+          z   = zx(mgs,il)
+
+            rdi = z*(pi/6.*xdn(mgs,il))**2*chw/((rho0(mgs)*qr)**2)
+            alp = (6.0+alpha(mgs,il))*(5.0+alpha(mgs,il))*(4.0+alpha(mgs,il))/   &
+     &            ((3.0+alpha(mgs,il))*(2.0+alpha(mgs,il))*rdi) - 1.0
+           DO i = 1,10
+             IF ( Abs(alp - alpha(mgs,il)) .lt. 0.01 ) EXIT
+             alpha(mgs,il) = Max( alphamin, Min( alphamax, alp ) )
+             alp = (6.+alpha(mgs,il))*(5.0+alpha(mgs,il))*(4.0+alpha(mgs,il))/   &
+     &            ((3.0+alpha(mgs,il))*(2.0+alpha(mgs,il))*rdi) - 1.0
+             alp = Max( alphamin, Min( alphamax, alp ) )
+           ENDDO
+
+            
+          ENDIF
+        ENDIF
+
+!
+! Check whether the shape parameter is at or less than the minimum, and if it is, reset the 
+! concentration or reflectivity to match (prevents reflectivity from being out of balance with Q and N)
+!
+             g1 = (6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
+     &            ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il)))
+ 
+           IF ( ( lrescalelow(il) .or. rescale_high_alpha ) .and.  &
+     &          ( alpha(mgs,il) <= alphamin .or. alp == alphamin .or. alp == alphamax ) ) THEN
+
+
+
+            IF ( rescale_high_alpha .and. alp >= alphamax - 0.01  ) THEN  ! reset c at high alpha to prevent growth in Z
+              cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/z*(6./(pi*xdn(mgs,il)))**2
+              an(igs(mgs),jy,kgs(mgs),ln(il)) = cx(mgs,il)
+            
+            ELSEIF ( lrescalelow(il) .and. alp <= alphamin .and. .not. (il == lh .and. icvhl2h > 0 ) .and. &
+                     .not. ( il == lr .and. .not. rescale_low_alphar ) ) THEN ! alpha = alphamin, so reset Z to prevent growth in C
+             wtest = .false.
+             IF ( irescalerainopt == 0 ) THEN
+               wtest = .false.
+             ELSEIF ( irescalerainopt == 1 ) THEN
+               wtest = qx(mgs,lc) > qxmin(lc) 
+             ELSEIF ( irescalerainopt == 2 ) THEN
+               wtest = qx(mgs,lc) > qxmin(lc) .and. wvel(mgs) < rescale_wthresh
+             ELSEIF ( irescalerainopt == 3 ) THEN
+               wtest = temcg(mgs) > rescale_tempthresh .and. qx(mgs,lc) > qxmin(lc) .and. wvel(mgs) < rescale_wthresh
+             ENDIF
+             
+             IF ( il == lr .and. ( wtest ) ) THEN
+!             IF ( temcg(mgs) > 0.0 .and. il == lr .and. qx(mgs,lc) > qxmin(lc) ) THEN
+             ! certain situations where rain number is adjusted instead of Z. Helps avoid rain being 'zapped' by autoconverted 
+             ! drops (i.e., favor preserving Z when alpha tries to go negative)
+             chw = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/z*(6./(pi*xdn(mgs,il)))**2 ! g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/z1
+             cx(mgs,il) = chw
+             an(igs(mgs),jy,kgs(mgs),ln(il)) = chw
+             ELSE
+             
+             ! Usual resetting of reflectivity moment to force consisntency between Q, N, Z, and alpha when alpha = alphamin
+             z1 = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/chw
+             z  = z1*(6./(pi*xdn(mgs,il)))**2
+             zx(mgs,il) = z
+             an(igs(mgs),jy,kgs(mgs),lz(il)) = z
+             ENDIF
+            ENDIF
+           ENDIF
+          
+          
+         ! set g1x to use as G factor later. If alpha is in the range ( rnumin < alpha < rnumax ), then 
+         ! this will be the same as computing G from alpha.  If alpha = rnumax, however, it probably means that
+         ! the moments are not matched correctly, so we compute G from the moments instead so that the dZ/dt rates
+         ! stay consistent with dN/dt and dq/dt.
+!          g1x(mgs,il) = zx(mgs,il)*chw*(pi*xdn(mgs,il))**2/(6.*qr*dn(igs(mgs),jy,kgs(mgs)))**2
+!          g1x(mgs,il) = g1 ! zx(mgs,il)*cx(mgs,il)/(qr)**2
+           IF ( alp >= alphamax - 0.5 ) THEN
+!             g1x(mgs,il) = 6**2*zx(mgs,il)/(cx(mgs,il)*(pi*xv(mgs,lr))**2)
+!             g1x(mgs,il) = (xdn(mgs,il))**2*zx(mgs,il)*cx(mgs,il)/((rho0(mgs)*qx(mgs,il))**2)
+             g1x(mgs,il) = (pi*xdn(mgs,il))**2*zx(mgs,il)*cx(mgs,il)/((6.*rho0(mgs)*qx(mgs,il))**2)
+           ELSE
+             g1x(mgs,il) = g1
+           ENDIF
+          
+           ENDIF
+          
+!          IF ( ny .eq. 2 ) THEN
+!          IF ( qr .gt. 1.e-3 ) THEN
+!           write(0,*) 'alphah at nstep,i,k = ',dtp*(nstep-1),igs(mgs),kgs(mgs),alpha(mgs,il),qr*1000.
+!          ENDIF
+!          ENDIF
+          
+           
+           ENDIF ! .true.
+
+          IF ( il == lr ) THEN
+           
+!           tmp = alpha(mgs,lr) + 4./3.
+!           i = Int(dgami*(tmp))
+!           del = tmp - dgam*i
+!           x = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
+!
+!           tmp = alpha(mgs,lr) + 1.
+!           i = Int(dgami*(tmp))
+!           del = tmp - dgam*i
+!           y = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
+!
+!!           ventrx(mgs) = Gamma_sp(alpha(mgs,lr) + 4./3.)/(alpha(mgs,lr) + 1.)**(1./3.)/Gamma_sp(alpha(mgs,lr) + 1.)
+!           ventrx(mgs) = x/(y*(alpha(mgs,lr) + 1.)**(1./3.))
+
+
+           tmp = alpha(mgs,lr) + 1.
+           i = Int(dgami*(tmp))
+           del = tmp - dgam*i
+           y = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
+
+           gf1palp(mgs) = y
+
+           IF (   iferwisventr == 2 ) THEN
+           tmp = alpha(mgs,lr) + 2.5 + br/2.
+           i = Int(dgami*(tmp))
+           del = tmp - dgam*i
+           x = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
+
+!           ventrx(mgs) = Gamma_sp(alpha(mgs,lr) + 1.5 + br/6.)/Gamma_sp(alpha(mgs,lr) + 1.)
+
+           ventrxn(mgs) = x/y
+           
+           ENDIF
+           
+          ENDIF ! il==lr
+ 
+          
+          ELSE ! below mass threshold
+!             g1 = (6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/
+!     &            ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il)))
+!             z1 = g1*rho0(mgs)**2*(qr)*qr/chw
+!             z  = 1.e18*z1*(6./(pi*1000.))**2
+!             z  = z1*(6./(pi*1000.))**2
+!             zx(mgs,il) = z
+!             an(igs(mgs),jy,kgs(mgs),lz(il)) = z
+          ENDIF ! ( qx(mgs,il) .gt. qxmin(il) )
+        
+        
+        
+!        ENDIF
+        ENDDO ! mgs
+
+!         CALL cld_cpu('Z-DELABK')  
+        
+!        IF ( il == lr ) THEN
+!          xnutmp = (alpha(mgs,il) - 2.)/3.
+!           da0lr(mgs) = delbk(bb(il), xnutmp, xmu(il), 0)
+!        ENDIF
+        
+        IF ( .not. ( il == lr .and. imurain == 3 ) ) THEN
+!          CALL cld_cpu('Z-DELABK')  
+        DO mgs = 1,ngscnt
+          IF ( qx(mgs,il) > qxmin(il) ) THEN
+          xnutmp = (alpha(mgs,il) - 2.)/3.
+          
+!          IF ( .true. ) THEN
+          DO ic = lc,lh-1 ! lhab
+           IF ( il .ne. ic .and.  qx(mgs,ic) .gt. qxmin(ic)) THEN
+             xnuc = xnu(ic)
+             IF ( ic == lc .and. idiagnosecnu > 0 ) xnuc = alpha(mgs,lc) ! alpha for droplets is actually nu
+             IF ( il /= lr .and. ic == lr .and. lzr > 1 ) THEN
+               IF ( imurain == 3 ) THEN
+                 xnuc = alpha(mgs,lr) ! alpha is nu already
+               ELSE
+                 xnuc = ( alpha(mgs,lr) - 2. )/3. ! convert alpha to nu
+               ENDIF
+             ENDIF
+                                 ! delabk(ba,bb,nua,nub,mua,mub,k), where a (il)  is collector and b (ic) is collected
+             IF ( .false. ) THEN
+             dab0lh(mgs,ic,il) =  delabk(bb(ic), bb(il), xnuc, xnutmp, xmu(ic), xmu(il), 0) !dab0(il,ic)
+             dab1lh(mgs,ic,il) =  delabk(bb(ic), bb(il), xnuc, xnutmp, xmu(ic), xmu(il), 1) !dab1(il,ic)
+             dab0lh(mgs,il,ic) =  delabk(bb(il), bb(ic), xnutmp, xnuc, xmu(il), xmu(ic), 0) !dab0(il,ic)
+             dab1lh(mgs,il,ic) =  delabk(bb(il), bb(ic), xnutmp, xnuc, xmu(il), xmu(ic), 1) !dab1(il,ic)
+             ELSE ! use lookup table -- not interpolating yet because table resolution of 0.05 is good enough
+               i = Nint( alpha(mgs,il)*dqiacralphainv )
+               IF ( ic == lc .or. ic == li .or. ic == ls .or. (ic == lr .and. imurain == 3) ) THEN
+                 alp = (3.*alpha(mgs,ic) + 2.)
+                 j = Nint( (3.*alpha(mgs,ic) + 2.)*dqiacralphainv )
+               ELSE ! IF ( ic == lr .and. imurain == 1 ) ! rain
+                 alp = alpha(mgs,ic)
+                 j = Nint( alpha(mgs,ic)*dqiacralphainv )
+               ENDIF
+             
+               dab0lh(mgs,ic,il) = dab0lu(j,i,ic,il)
+               dab1lh(mgs,ic,il) = dab1lu(j,i,ic,il)
+               dab0lh(mgs,il,ic) = dab0lu(i,j,il,ic)
+               dab1lh(mgs,il,ic) = dab1lu(i,j,il,ic)
+
+!               tmp1 = dab0lu(j,i,ic,il)
+!               tmp2 = dab1lu(j,i,ic,il)
+!               tmp3 = dab0lu(i,j,il,ic)
+!               tmp4 = dab1lu(i,j,il,ic)
+!               tmp5 =  delabk(bb(il), bb(ic), xnutmp, xnuc, xmu(ic), xmu(il), 0) !dab0(il,ic)
+!               tmp6 =  delabk(bb(il), bb(ic), xnutmp, xnuc, xmu(ic), xmu(il), 1) !dab1(il,ic)
+!               tmp5 =  delabk(bb(il), bb(ic), xnutmp, xnuc, xmu(il), xmu(ic), 0) !dab0(il,ic)
+!               tmp6 =  delabk(bb(il), bb(ic), xnutmp, xnuc, xmu(il), xmu(ic), 1) !dab1(il,ic)
+               
+               IF ( .false. .and. ny <= 2 ) THEN
+                 write(0,*)
+                 write(0,*) 'bb: ', bb(il), bb(ic), xnutmp, xnuc, xmu(il), xmu(ic)
+                 write(0,*) 'il,ic = ',il,ic,alpha(mgs,il),i,xnuc,alp,j
+                 write(0,*) 'dab0lh,tmp1 = ',dab0lh(mgs,ic,il),tmp1
+                 write(0,*) 'dab1lh,tmp2 = ',dab1lh(mgs,ic,il),tmp2
+                 write(0,*) 'dab0lh,tmp3 = ',dab0lh(mgs,il,ic),tmp3,tmp5
+                 write(0,*) 'dab1lh,tmp4 = ',dab1lh(mgs,il,ic),tmp4,tmp6
+               
+               ENDIF
+             
+             ENDIF
+             
+           ENDIF
+          ENDDO
+
+!          ENDIF
+           
+             da0lx(mgs,il) = delbk(bb(il), xnutmp, xmu(il), 0)
+           IF ( il .eq. lh ) THEN
+             da0lh(mgs) = delbk(bb(il), xnutmp, xmu(il), 0)
+            IF ( lzr > 1 ) THEN
+             rzxh(mgs) = 1.
+            ELSE
+             rzxh(mgs) = ((4. + alpha(mgs,il))*(5. + alpha(mgs,il))*(6. + alpha(mgs,il))*(1. + xnu(lr)))/   &
+     &  ((1. + alpha(mgs,il))*(2. + alpha(mgs,il))*(3. + alpha(mgs,il))*(2. + xnu(lr)))
+            ENDIF
+            
+            IF ( lzhl < 1 ) THEN
+              rzxhlh(mgs) = rzxhl(mgs)/(((4. + alpha(mgs,il))*(5. + alpha(mgs,il))*(6. + alpha(mgs,il))*(1. + xnu(lr)))/   &
+     &  ((1. + alpha(mgs,il))*(2. + alpha(mgs,il))*(3. + alpha(mgs,il))*(2. + xnu(lr))))
+            ENDIF
+           ELSEIF ( il .eq. lhl ) THEN
+             da0lhl(mgs) = delbk(bb(il), xnutmp, xmu(il), 0)
+            IF ( lzr > 1 ) THEN
+             rzxhl(mgs) = 1.
+            ELSE
+             rzxhl(mgs) = ((4.0 + alpha(mgs,il))*(5. + alpha(mgs,il))*(6. + alpha(mgs,il))*(1. + xnu(lr)))/   &
+     &  ((1. + alpha(mgs,il))*(2. + alpha(mgs,il))*(3. + alpha(mgs,il))*(2. + xnu(lr)))
+            ENDIF
+           ELSEIF ( il == lr ) THEN
+             xnutmp = (alpha(mgs,il) - 2.)/3.
+             da0lr(mgs) = delbk(bb(il), xnutmp, xmu(il), 0)
+             da1lr(mgs) = delbk(bb(il), xnutmp, xmu(il), 1)
+           ENDIF
+          
+          ENDIF ! ( qx(mgs,il) > qxmin(il) )
+        ENDDO ! mgs
+!          CALL cld_cpu('Z-DELABK')  
+        ENDIF ! il /= lr
+
+!         CALL cld_cpu('Z-DELABK')  
+        
+        ENDIF ! lz(il) .gt. 1
+        
+        ENDDO ! il
+          
+      ENDIF ! ipconc .ge. 6
+
+!      CALL cld_cpu('Z-MOMENT-1')  
+
+!
+!  set some values for ice nucleation
+!
+      do mgs = 1,ngscnt
+      kp1 = Min(nz, kgs(mgs)+1 )
+!      wvel(mgs) = (0.5)*(w(igs(mgs),jgs,kp1)   &
+!     &                  +w(igs(mgs),jgs,kgs(mgs)))
+
+      
+        wvelkm1(mgs) = (0.5)*(w(igs(mgs),jgs,kgs(mgs))   &
+     &                    +w(igs(mgs),jgs,kgsm(mgs)))
+      cninm(mgs) = t7(igs(mgs),jgs,kgsm(mgs))
+      cnina(mgs) = t7(igs(mgs),jgs,kgs(mgs))
+      cninp(mgs) = t7(igs(mgs),jgs,kgsp(mgs))
+      end do
+
+!
+!  Set a couple of cloud variables...
+!
+
+!      SUBROUTINE setvt(ngscnt,qx,qxmin,cx,rho0,rhovt,xdia,cno,
+!     :                 xmas,xdn,xvmn,xvmx,xv,cdx,
+!     :                 ipconc,ndebug)
+!      SUBROUTINE setvtz(ngscnt,qx,qxmin,qxw,cx,rho0,rhovt,xdia,cno, &
+!     &                 xmas,vtxbar,xdn,xvmn,xvmx,xv,cdx,            &
+!     &                 ipconc1,ndebug1,ngs,nz,kgs,cwnccn,fadvisc,   &
+!     &                 cwmasn,cwmasx,cwradn,cnina,cimna,cimxa,      &
+!     &                 itype1a,itype2a,temcg,infdo,alpha)
+
+
+      infdo = 1
+      IF ( rimdenvwgt > 0 ) infdo = 1
+
+      call setvtz(ngscnt,qx,qxmin,qxw,cx,rho0,rhovt,xdia,cno,cnostmp,   &
+     &                 xmas,vtxbar,xdn,xvmn,xvmx,xv,cdx,cdxgs,   &
+     &                 ipconc,ndebug,ngs,nz,kgs,fadvisc,   &
+     &                 cwmasn,cwmasx,cwradn,cnina,cimn,cimx,   &
+     &                 itype1,itype2,temcg,infdo,alpha,0,axx,bxx) ! ,cdh,cdhl)
+!     &                 itype1,itype2,temcg,infdo,alpha,0,axh,bxh,axhl,bxhl) ! ,cdh,cdhl)
+
+
+       IF ( lwsm6 .and. ipconc == 0 ) THEN
+         tmp = Max(qxmin(lh), qxmin(ls))
+         DO mgs = 1,ngscnt
+           total = qx(mgs,lh) + qx(mgs,ls)
+           IF ( total > tmp ) THEN
+             vt2ave(mgs) = (qx(mgs,lh)*vtxbar(mgs,lh,1) + qx(mgs,ls)*vtxbar(mgs,ls,1))/total
+           ELSE
+             vt2ave(mgs) = 0.0
+           ENDIF
+         ENDDO
+       ENDIF
+
+
+!
+!  Set number concentrations (need xdia from setvt)
+!
+      if ( ndebug .gt. 0 ) write(0,*) 'ICEZVD_GS: Set concentration'
+      IF ( ipconc .lt. 1 ) THEN
+         cina(1:ngscnt) = cx(1:ngscnt,li)
+      ENDIF
+      if ( ipconc .lt. 5 ) then
+      do mgs = 1,ngscnt
+
+
+      IF ( ipconc .lt. 3 ) THEN
+!      cx(mgs,lr) = 0.0
+      if ( qx(mgs,lr) .gt. qxmin(lh) )  then
+!      cx(mgs,lr) = cno(lr)*xdia(mgs,lr,1)
+!      xv(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(xdn(mgs,lr)*cx(mgs,lr))
+      end if
+      ENDIF
+
+      IF ( ipconc .lt. 4 ) THEN
+!      tmp = cx(mgs,ls)
+!      cx(mgs,ls) = 0.0
+      if ( qx(mgs,ls) .gt. qxmin(ls) )  then
+!      cx(mgs,ls) = cno(ls)*xdia(mgs,ls,1)
+!      xv(mgs,ls) = rho0(mgs)*qx(mgs,ls)/(xdn(mgs,ls)*cx(mgs,ls))
+      end if
+      ENDIF ! ( ipconc .lt. 4 )
+
+      IF ( ipconc .lt. 5 ) THEN
+
+
+!      cx(mgs,lh) = 0.0
+      if ( qx(mgs,lh) .gt. qxmin(lh) )  then
+!      cx(mgs,lh) = cno(lh)*xdia(mgs,lh,1)
+!      xv(mgs,lh) = Max(xvmn(lh), rho0(mgs)*qx(mgs,lh)/(xdn(mgs,lh)*cx(mgs,lh)) )
+!      xdia(mgs,lh,3) = (xv(mgs,lh)*6./pi)**(1./3.) 
+      end if
+
+      ENDIF ! ( ipconc .lt. 5 )
+
+      end do
+      end if
+      
+      IF ( ipconc .ge. 2 ) THEN
+      DO mgs = 1,ngscnt
+        
+        rb(mgs) = 0.5*xdia(mgs,lc,1)*(1./(1.+alpha(mgs,lc)))**(1./6.)
+        xl2p(mgs) = Max(0.0d0, 2.7e-2*xdn(mgs,lc)*cx(mgs,lc)*xv(mgs,lc)*   &
+     &           ((0.5e20*rb(mgs)**3*xdia(mgs,lc,1))-0.4) )
         IF ( rb(mgs) .gt. 3.51e-6 ) THEN
 !          rh(mgs) = Max( 0.5d0*xdia(mgs,lc,1), 6.3d-4/(1.d6*(rb(mgs) - 3.5d-6)) )
           rh(mgs) = Max( 41.d-6, 6.3d-4/(1.d6*(rb(mgs) - 3.5d-6)) )
@@ -12480,6 +14620,17 @@ subroutine nssl_2mom_gs   &
 
 
 
+      IF ( ipconc >= 6 ) THEN
+      frac = 0.4d0
+      zxmxd(:,:) = 0.0
+      DO il = lr,lhab
+       IF ( lz(il) > 0 .or. ( il == lr ) ) THEN
+         DO mgs = 1,ngscnt
+           zxmxd(mgs,il) = frac*zx(mgs,il)*dtpinv
+         ENDDO
+       ENDIF
+      ENDDO
+      ENDIF
 
 
 
@@ -12517,10 +14668,10 @@ subroutine nssl_2mom_gs   &
             
             vshdgs(mgs,il) = vshd ! base value
             
-            IF ( qx(mgs,il) > qxmin(il) ) THEN
+            IF ( qx(mgs,il) > qxmin(il) .and. ivshdgs > 0 ) THEN
               
               ! tmpdiam is weighted diameter of d^(shedalp-1), so for shedalp=3, this is the area-weighted diameter or maximum mass diameter.
-              tmpdiam = (shedalp+alpha(mgs,il))*xdia(mgs,il,1)*( xdn(mgs,il)/917. )**(1./3.) ! erm added density factor for equiv. solid ice sphere 10.12.2015
+              tmpdiam = (shedalp+alpha(mgs,il))*xdia(mgs,il,1) ! *( xdn(mgs,il)/917. )**(1./3.) ! erm added density factor for equiv. solid ice sphere 10.12.2015
               
               IF ( tmpdiam > sheddiam0 ) THEN
                 vshdgs(mgs,il) = 0.523599*(1.5e-3)**3/massfacshr ! 1.5mm drops from very large ice
@@ -12577,6 +14728,7 @@ subroutine nssl_2mom_gs   &
       ers(mgs) = 0.0
       ess(mgs) = 0.0
       ehs(mgs) = 0.0 ! used as sticking efficiency, so collection efficiency is ehs*ehsclsn
+      ehsfac(mgs) = 1.0 ! factor based on ice saturation
       ehls(mgs) = 0.0 ! used as sticking efficiency, so collection efficiency is ehls*ehlsclsn
       ehscnv(mgs) = 0.0
 !      ehxs(mgs) = 0.0
@@ -12678,7 +14830,7 @@ subroutine nssl_2mom_gs   &
       if ( qx(mgs,li).gt.qxmin(li) .and. qx(mgs,lc).gt.qxmin(lc) ) then
       
       
-      if (xdia(mgs,lc,1).gt.15.0e-06 .and. xdia(mgs,li,1).gt.30.0e-06) then
+      if (xdia(mgs,lc,1).gt.ewi_dcmin .and. xdia(mgs,li,1).gt.ewi_dimin) then
 ! erm 5/10/2007 test following change:
 !      if (xdia(mgs,lc,1).gt.12.0e-06 .and. xdia(mgs,li,1).gt.50.0e-06) then
       eiw(mgs) = 0.5
@@ -12802,7 +14954,7 @@ subroutine nssl_2mom_gs   &
       ELSE
       
         fac = Abs(ess0)
-        IF ( .true. .and. ess0 < 0.0 ) THEN
+        IF ( iessopt == 2 ) THEN ! experimental code
 !         IF ( wvel(mgs) > 2.0 .or. wvel(mgs) < -0.5 .or. ssi(mgs) < 1.0 ) THEN
          IF ( wvel(mgs) > 2.0 ) THEN
           ! assume convective cell or downdraft
@@ -12810,9 +14962,25 @@ subroutine nssl_2mom_gs   &
          ELSEIF ( wvel(mgs) > 1.0 ) THEN ! transition to stratiform range of values
            fac = Max(0.0, 2.0 - wvel(mgs))*fac
          ENDIF
+        ELSEIF ( iessopt == 3 ) THEN ! factor based on ice supersat
+           IF ( ssi(mgs) <= 1.0 ) THEN
+             fac = 0.0
+             ehsfac(mgs) = 0.0
+           ELSEIF ( ssi(mgs) <= 1.02 ) THEN
+             fac = fac*(ssi(mgs) - 1.0)/0.02
+             ehsfac(mgs) = (ssi(mgs) - 1.0)/0.02
+           ENDIF
+        ELSEIF ( iessopt == 4 ) THEN ! factor based on ice supersat
+           IF ( ssi(mgs) <= 1.0 ) THEN
+             fac = 0.1
+             ehsfac(mgs) = 0.1
+           ELSEIF ( ssi(mgs) <= 1.005 ) THEN
+             fac = Max(0.1, fac*(ssi(mgs) - 1.0)/0.005)
+             ehsfac(mgs) = Max(0.1, (ssi(mgs) - 1.0)/0.005)
+           ENDIF
         ENDIF
         
-        IF ( temcg(mgs) > esstem1 .and. temcg(mgs) < esstem2 ) THEN  ! only nonzero for T > -25
+        IF ( temcg(mgs) > esstem1 .and. temcg(mgs) < esstem2 ) THEN  ! only nonzero for T > esstem1
           ess(mgs) = fac*Exp(ess1*(esstem2) )*(temcg(mgs) - esstem1)/(esstem2 - esstem1) ! linear ramp up from zero at esstem1 to value at esstem2
         ELSEIF ( temcg(mgs) >= esstem2 ) THEN
           ess(mgs) = fac*Exp(ess1*Min( temcg(mgs), 0.0 ) )
@@ -12923,7 +15091,11 @@ subroutine nssl_2mom_gs   &
         ELSE
         ehscnv(mgs) = exp(0.09*min(temcg(mgs),0.0))
         ENDIF
-        if ( qx(mgs,lh).gt.qxmin(lh) .and. qx(mgs,lc) > qxmin(lc)  ) then
+        
+        IF ( qx(mgs,lh).gt.qxmin(lh) .and. qx(mgs,lc) >= qxmin(lc)  ) THEN
+!          ehsclsn(mgs) = ehs_collsn
+!          ehs(mgs) = ehscnv(mgs)*ehsfac(mgs)*Min(1.0, Max(0.0,xdn(mgs,lh) - 300.)/300.  )
+!        ELSEIF ( qx(mgs,lh).gt.qxmin(lh) .and. qx(mgs,lc) >= qxmin(lc)  ) then
           ehsclsn(mgs) = ehs_collsn
           IF ( xdia(mgs,ls,3) < 40.e-6 ) THEN
             ehsclsn(mgs) = 0.0
@@ -12933,10 +15105,9 @@ subroutine nssl_2mom_gs   &
             ehsclsn(mgs) = ehs_collsn
           ENDIF
 !          ehs(mgs) = ehscnv(mgs)*Min(1.0, Max(0., xdn(mgs,lh) - xdnmn(lh)*1.2)/xdnmn(lh)  ) ! shut off qhacs as graupel goes to lowest density
-          ehs(mgs) = ehscnv(mgs)*Min(1.0, Max(0.0,xdn(mgs,lh) - 300.)/300.  ) ! shut off qhacs as graupel goes to low density
+          ehs(mgs) = ehscnv(mgs)*Min(1.0, Max(0.0,xdn(mgs,lh) - 300.)/300.  ) ! shut off qhacs as graupel goes to low density; limits scavenging of snow in bright band
 !          ehs(mgs) = ehscnv(mgs) ! *Min(1.0, Max(0.0,xdn(mgs,lh) - 300.)/300.  ) ! shut off qhacs as graupel goes to low density
           ehs(mgs) = Min(ehs(mgs),ehsmax)
-          IF ( qx(mgs,lc) < qxmin(lc) ) ehs(mgs) = 0.0
         end if
       ENDIF
 !
@@ -12944,7 +15115,7 @@ subroutine nssl_2mom_gs   &
       ehiclsn(mgs) = ehi_collsn
       ehi(mgs)=eii0*exp(eii1*min(temcg(mgs),0.0))
       ehi(mgs) = Min( ehimax, Max( ehi(mgs), ehimin ) )
-      if ( temg(mgs) .gt. 273.15 .or. ( qx(mgs,lc) < qxmin(lc)) ) ehi(mgs) = 0.0
+!      if ( temg(mgs) .gt. 273.15 .or. ( qx(mgs,lc) < qxmin(lc)) ) ehi(mgs) = 0.0
       end if
 
       IF ( lis > 1 ) THEN
@@ -12952,7 +15123,7 @@ subroutine nssl_2mom_gs   &
       ehisclsn(mgs) = ehi_collsn
       ehis(mgs)=eii0*exp(eii1*min(temcg(mgs),0.0))
       ehis(mgs) = Min( ehimax, Max( ehis(mgs), ehimin ) )
-      if ( temg(mgs) .gt. 273.15 .or. ( qx(mgs,lc) < qxmin(lc)) ) ehis(mgs) = 0.0
+!      if ( temg(mgs) .gt. 273.15 .or. ( qx(mgs,lc) < qxmin(lc)) ) ehis(mgs) = 0.0
       end if
       ENDIF
 
@@ -13089,6 +15260,7 @@ subroutine nssl_2mom_gs   &
       end do
       
       
+
 !
 !
 !
@@ -13207,6 +15379,7 @@ subroutine nssl_2mom_gs   &
       ENDIF
       end do
 !
+      IF ( ipconc < 3 ) THEN
       do mgs = 1,ngscnt
       qracs(mgs) =  0.0
       IF ( ers(mgs) .gt. 0.0 .and. ipconc < 3 ) THEN
@@ -13225,6 +15398,7 @@ subroutine nssl_2mom_gs   &
      &  , qsmxd(mgs))
       ENDIF
       end do
+      ENDIF
 
 !
 !
@@ -13371,6 +15545,7 @@ subroutine nssl_2mom_gs   &
 !
       do mgs = 1,ngscnt
       qhacw(mgs) = 0.0
+      qhacwmlr(mgs) = 0.0
       rarx(mgs,lh) = 0.0
       vhacw(mgs) = 0.0
       vhsoak(mgs) = 0.0
@@ -13437,6 +15612,11 @@ subroutine nssl_2mom_gs   &
          
        ENDIF
 
+          qhacwmlr(mgs) = qhacw(mgs)
+          IF ( temg(mgs) > tfr .and. iqhacwshr == 0 ) THEN
+            qhacw(mgs) = 0.0
+          ENDIF
+          
           IF ( lvol(lh) .gt. 1 .or. lhl .gt. 1 ) THEN ! calculate rime density for graupel volume and/or for graupel conversion to hail
              
              IF ( temg(mgs) .lt. 273.15) THEN
@@ -13466,14 +15646,18 @@ subroutine nssl_2mom_gs   &
                 
                 rimdn(mgs,lh) = 1000.*(0.051 + 0.114*tmp - 0.0055*tmp**2)
 
-               ELSEIF ( irimdenopt == 3 ) THEN ! Macklin
+               ELSEIF ( irimdenopt == 3 .or. irimdenopt == 4) THEN ! Macklin (3) or Saunders and Hosseini 2001
 
                 tmp = (-((0.5)*(1.e+06)*xdia(mgs,lc,1))   &
      &                *( (1.0-rimdenvwgt)*vtxbar(mgs,lh,1) + rimdenvwgt*vtxbar(mgs,lh,2) )   &
      &                /(temg(mgs)-273.15))
               !  tmp = Min( 5.5/0.6, Max( 0.3/0.6, tmp ) )
                 
-                rimdn(mgs,lh) =  Min(900., Max( 170., 110.*tmp**0.76 ) )
+                IF ( irimdenopt == 3 ) THEN
+                  rimdn(mgs,lh) =  Min(900., Max( 170., 110.*tmp**0.76 ) )
+                ELSEIF ( irimdenopt == 4 ) THEN ! Saunders and Hosseini
+                  rimdn(mgs,lh) =  Min(917., Max( 10.,  900.0*(1.0 - 0.905**tmp ) ) )
+                ENDIF
                
                ENDIF
              ELSE
@@ -13687,6 +15871,7 @@ subroutine nssl_2mom_gs   &
 
       do mgs = 1,ngscnt
       qhlacw(mgs) = 0.0
+      qhlacwmlr(mgs) = 0.0
       vhlacw(mgs) = 0.0
       vhlsoak(mgs) = 0.0
       IF ( lhl > 1 .and. .true.) THEN
@@ -13715,10 +15900,15 @@ subroutine nssl_2mom_gs   &
 
           qhlacw(mgs) = Min( qhlacw(mgs), 0.5*qx(mgs,lc)*dtpinv )
 
+          qhlacwmlr(mgs) = qhlacw(mgs)
+          IF ( temg(mgs) > tfr .and. iqhlacwshr == 0 ) THEN
+            qhlacw(mgs) = 0.0
+          ENDIF
+
           IF ( lvol(lhl) .gt. 1 ) THEN
 
              IF ( temg(mgs) .lt. 273.15) THEN
-               IF ( irimdenopt == 1 ) THEN ! Rasmussen and Heymsfeld (1985)
+               IF ( irimdenopt == 1 ) THEN ! Heymsfeld and Pflaum (1985)
              rimdn(mgs,lhl) = rimc1*(-((0.5)*(1.e+06)*xdia(mgs,lc,1))   &
      &                *((0.60)*( (1.0-rimdenvwgt)*vtxbar(mgs,lhl,1) + rimdenvwgt*vtxbar(mgs,lhl,2) ))   &
      &                /(temg(mgs)-273.15))**(rimc2)
@@ -13732,13 +15922,17 @@ subroutine nssl_2mom_gs   &
                 
                 rimdn(mgs,lhl) = 1000.*(0.051 + 0.114*tmp - 0.005*tmp**2)
                
-               ELSEIF ( irimdenopt == 3 ) THEN ! Macklin
+               ELSEIF ( irimdenopt == 3 .or. irimdenopt == 4) THEN ! Macklin (3) or Saunders and Hosseini 2001
                 tmp = -0.5*(1.e+06)*xdia(mgs,lc,1)   &
      &                *( (1.0-rimdenvwgt)*vtxbar(mgs,lhl,1) + rimdenvwgt*vtxbar(mgs,lhl,2) )  &
      &                /(temg(mgs)-273.15)
               !  tmp = Min( 5.5/0.6, Max( 0.3/0.6, tmp ) )
                 
-                rimdn(mgs,lhl) = Min(900., Max( 170., 110.*tmp**0.76 ) )
+                IF ( irimdenopt == 3 ) THEN
+                  rimdn(mgs,lhl) =  Min(900., Max( 170., 110.*tmp**0.76 ) )
+                ELSEIF ( irimdenopt == 4 ) THEN ! Saunders and Hosseini
+                  rimdn(mgs,lhl) =  Min(917., Max( 10.,  900.0*(1.0 - 0.905**tmp ) ) )
+                ENDIF
                
                ENDIF
              ELSE
@@ -14053,7 +16247,7 @@ subroutine nssl_2mom_gs   &
            frach = 0.5 *(1. +  Tanh(0.2e12 *( xvfrz - 1.15*xvbiggsnow)))
 
              qiacrs(mgs) = (1.-frach)*qiacr(mgs)
-             ciacrs(mgs) = (1.-frach)*ciacr(mgs) ! *rzxh(mgs)
+             ciacrs(mgs) = (1.-frach)*ciacrf(mgs) ! *rzxh(mgs)
            
            ENDIF
            ENDIF
@@ -14083,7 +16277,7 @@ subroutine nssl_2mom_gs   &
           tmp = xv(mgs,ls)/(xvmx(ls)*Max(1.,100./Min(100.,xdn(mgs,ls)))) ! fraction of max snow mass
           IF ( tmp .lt. essfrac1 ) THEN
             ec0(mgs) = 1.0
-          ELSEIF ( tmp .gt. essfrac2 ) THEN
+          ELSEIF ( tmp .ge. essfrac2 ) THEN
             ec0(mgs) = 0.0
           ELSE
             ec0(mgs) = (essfrac2 - tmp)/(essfrac2 - essfrac1)
@@ -14160,7 +16354,21 @@ subroutine nssl_2mom_gs   &
         ec0(mgs) = 2.e9
         IF ( qx(mgs,lr) .gt. qxmin(lr) ) THEN
         rwrad = 0.5*xdia(mgs,lr,3)
-        IF ( xdia(mgs,lr,3) .gt. 2.0e-3 .or. icracr <= 0 ) THEN
+        
+        
+        ! check median volume diameter
+        IF ( icracrthresh > 1 ) THEN
+         IF ( imurain == 1 ) THEN
+           tmp =  (3.67+alpha(mgs,lr))*xdia(mgs,lr,1) ! median volume diameter; units of mm (Ulbrich 1983, JCAM)
+         ELSE ! imurain == 3, 
+           tmp =  (1.678+alpha(mgs,lr))**(1./3.)*xdia(mgs,lr,1) ! units of mm (using method of Ulbrich 1983. See ventillation_stuff.nb)
+         ENDIF
+        ELSE
+          tmp = xdia(mgs,lr,3) - 0.1e-3
+        ENDIF
+         
+!        IF ( xdia(mgs,lr,3) .gt. 2.0e-3 .or. icracr <= 0 ) THEN
+        IF ( tmp .gt. 1.9e-3 .or. icracr <= 0 ) THEN
           ec0(mgs) = 0.0
           cracr(mgs) = 0.0
         ELSE
@@ -14242,6 +16450,7 @@ subroutine nssl_2mom_gs   &
 !
       if (ndebug .gt. 0 ) write(0,*) 'ICEZVD_GS: conc 22kk'
       chaci(:) = 0.0
+      chaci0(:) = 0.0
       if ( ipconc .ge. 1 .or. ipelec .ge. 1 ) then
       do mgs = 1,ngscnt
       IF ( ehi(mgs) .gt. 0.0 .or. ( ehiclsn(mgs) > 0.0 .and. ipelec > 0 )) THEN
@@ -14292,6 +16501,7 @@ subroutine nssl_2mom_gs   &
 !
       if (ndebug .gt. 0 ) write(0,*) 'ICEZVD_GS: conc 22nn'
       chacs(:) = 0.0
+      chacs0(:) = 0.0
       if ( ipconc .ge. 1 .or. ipelec .ge. 1 ) then
       do mgs = 1,ngscnt
       IF ( ehs(mgs) .gt. 0 ) THEN
@@ -14534,6 +16744,45 @@ subroutine nssl_2mom_gs   &
            
            IF ( crcnw(mgs) < 1.e-30 ) qrcnw(mgs) = 0.0
 
+           IF ( lzr > 1 .and. qrcnw(mgs) > 0.0 ) THEN
+!            vr = rho0(mgs)*qrcnw(mgs)/(1000.*crcnw(mgs))
+!            zrcnw(mgs) = 36.*(xnu(lr)+2.0)*crcnw(mgs)*vr**2/((xnu(lr)+1.0)*pi**2)
+             ! DTD: If rain exists at a grid point already either use the alpha-preserving Z-rate eqn. (dmrauto == 1)
+             ! or a mass-weighted average of the alpha-preserving Z-rate eqn. and the init. rate eqn. (dmrauto == 2)
+             ! or the original initiation rate equation (dmrauto == 0).  Not sure if this is the correct way to go but seems to work ok.
+             IF (qx(mgs,lr) .gt. qxmin(lr) .and. ( dmrauto == 1 .or. dmrauto ==2 ) ) THEN
+              tmp3 = qx(mgs,lr)/cx(mgs,lr)
+              tmp4 =  g1x(mgs,lr)*(6.*rho0(mgs)/(pi*xdn(mgs,lr)))**2* &
+     &                 ( 2.*tmp3 * qrcnw(mgs) - tmp3**2 * crcnw(mgs)  )
+              if (imurain == 3) then
+                vr = rho0(mgs)*qrcnw(mgs)/(1000.)
+                tmp3 = 36.*(xnu(lc)+2.0)*vr**2/(crcnw(mgs)*(xnu(lc)+1.0)*pi**2)
+              else
+                tmp3 = galpharaut*(6.*rho0(mgs)*qrcnw(mgs)/(pi*xdn0(lr)))**2/crcnw(mgs)
+              endif
+              IF ( dmrauto == 1 ) THEN ! Preserve alpha
+                zrcnw(mgs) = tmp4
+              ELSEIF ( dmrauto == 2 ) THEN ! Mass-weighted average
+                zrcnw(mgs) = (tmp3*qrcnw(mgs)+tmp4*qx(mgs,lr))/(qrcnw(mgs)+qx(mgs,lr))
+              ENDIF
+             else ! original formulation
+              IF ( imurain == 3 ) THEN
+                vr = rho0(mgs)*qrcnw(mgs)/(1000.) ! crcnw(mgs) not divided here but is in next line, cancels one factor in the numerator
+                zrcnw(mgs) = 36.*(xnu(lc)+2.0)*vr**2/(crcnw(mgs)*(xnu(lc)+1.0)*pi**2)
+              ELSE ! rain in gamma of diameter
+                IF ( dmropt <= 1 .or. dmropt >= 4 .or. ( qx(mgs,lr) < qxmin(lr) .and. cx(mgs,lr) < cxmin ) ) THEN
+                  zrcnw(mgs) = galpharaut*(6.*rho0(mgs)*qrcnw(mgs)/(pi*xdn0(lr)))**2/crcnw(mgs)
+                ELSE
+                  tmp3 = qx(mgs,lr)/cx(mgs,lr)
+                  zrcnw(mgs) =  g1x(mgs,lr)*(6.*rho0(mgs)/(pi*xdn(mgs,lr)))**2* &
+     &                 ( 2.*tmp3 * qrcnw(mgs) - tmp3**2 * crcnw(mgs)  )
+                ENDIF
+!             vr = rho0(mgs)*qrcnw(mgs)/(1000.) ! crcnw(mgs) not divided here but is in next line, cancels one factor in the numerator
+!             zrcnw(mgs) = 36.*(xnu(lc)+2.0)*vr**2/(crcnw(mgs)*(xnu(lc)+1.0)*pi**2)
+              ENDIF
+             endif
+!             z  = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/((alpha(mgs,lr)+1.0)*pi**2)
+           ENDIF 
 !           IF (  crcnw(mgs) .gt. cautn(mgs) .and. crcnw(mgs) .gt. 1.0 )
 !     :          THEN
 !             write(0,*)  'crcnw,cautn ',crcnw(mgs)/cautn(mgs),
@@ -14744,6 +16993,15 @@ subroutine nssl_2mom_gs   &
            ELSE !{
 
             
+           IF ( lzr > 1 ) THEN
+           ! interpolate along x, i.e., ratio; 
+            tmp1 = ziacrratio(i,j) + delx*dqiacrratioinv*(ziacrratio(ip1,j) - ziacrratio(i,j))
+            tmp2 = ziacrratio(i,jp1) + delx*dqiacrratioinv*(ziacrratio(ip1,jp1) - ziacrratio(i,jp1))
+           
+           ! interpolate along alpha; 
+           
+            zrfrz(mgs) = (tmp1 + dely*dqiacralphainv*(tmp2 - tmp1))*zx(mgs,lr)*dtpinv
+           ENDIF
            
             IF ( ibiggsmallrain > 0 .and. xv(mgs,lr) < 2.*xvmn(lr) .and. ( ibiggsnow == 1 .or. ibiggsnow == 3 ) ) THEN
 !            IF ( ibiggsmallrain > 0 .and. xv(mgs,lr) < xvbiggsnow .and. ( ibiggsnow == 1 .or. ibiggsnow == 3 ) ) THEN
@@ -14753,6 +17011,10 @@ subroutine nssl_2mom_gs   &
               crfrzs(mgs) = crfrz(mgs)
               qrfrzs(mgs) = qrfrz(mgs)
 
+              IF ( lzr > 1 ) THEN
+                zrfrzs(mgs) = zrfrz(mgs)
+                zrfrzf(mgs) = 0.
+              ENDIF
            ELSEIF ( dbigg < Max( biggsnowdiam, Max(dfrz,dhmn)) .and. ( ibiggsnow == 1 .or. ibiggsnow == 3 ) ) THEN ! { convert some to snow or ice crystals
             ! temporarily store qrfrz and crfrz in snow terms and caclulate new crfrzf, qrfrzf, and zrfrzf. Leave crfrz etc. alone!
             
@@ -14764,6 +17026,10 @@ subroutine nssl_2mom_gs   &
             crfrzf(mgs) = 0.0
             qrfrzf(mgs) = 0.0
 
+             IF ( lzr > 1 ) THEN
+               zrfrzs(mgs) = zrfrz(mgs)
+               zrfrzf(mgs) = 0.
+             ENDIF
             ELSE !{
             
            ! recalculate using dhmn for ratio
@@ -14803,10 +17069,23 @@ subroutine nssl_2mom_gs   &
             crfrzs(mgs) = crfrzs(mgs) - crfrzf(mgs)
             qrfrzs(mgs) = qrfrzs(mgs) - qrfrzf(mgs)
 
+           IF ( lzr > 1 ) THEN
+            zrfrzs(mgs) = zrfrz(mgs)
+           ! interpolate along x, i.e., ratio; 
+            tmp1 = ziacrratio(i,j) + delx*dqiacrratioinv*(ziacrratio(ip1,j) - ziacrratio(i,j))
+            tmp2 = ziacrratio(i,jp1) + delx*dqiacrratioinv*(ziacrratio(ip1,jp1) - ziacrratio(i,jp1))
+           
+           ! interpolate along alpha; 
+           
+            zrfrzf(mgs) = (tmp1 + dely*dqiacralphainv*(tmp2 - tmp1))*zx(mgs,lr)*dtpinv
+            zrfrzs(mgs) = zrfrzs(mgs) - zrfrzf(mgs)
+            zrfrzf(mgs) = (1000./900.)**2*zrfrzf(mgs)
+           ENDIF
             ENDIF ! }
            ELSE
             crfrzs(mgs) = 0.0
             qrfrzs(mgs) = 0.0
+            zrfrzs(mgs) = 0.0
            ENDIF ! }
            
            ENDIF !}
@@ -14819,6 +17098,10 @@ subroutine nssl_2mom_gs   &
              crfrz(mgs) = fac*crfrz(mgs)
              crfrzs(mgs) = fac*crfrzs(mgs)
              crfrzf(mgs) = fac*crfrzf(mgs)
+             IF ( lzr > 1 ) THEN
+               zrfrz(mgs) = fac*zrfrz(mgs)
+               zrfrzf(mgs) = fac*zrfrzf(mgs)
+             ENDIF
            ENDIF
            
             ENDIF !}
@@ -15364,7 +17647,15 @@ subroutine nssl_2mom_gs   &
         x =  1. + alpha(mgs,lr)
 
         IF ( lzr > 1 ) THEN ! 3 moment
-! 
+        tmp = 1. + alpr ! alpha(mgs,lr)
+        i = Int(dgami*(tmp))
+        del = tmp - dgam*i
+        g1palp = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
+
+        tmp = 2.5 + alpha(mgs,lr) + 0.5*bx(lr)
+        i = Int(dgami*(tmp))
+        del = tmp - dgam*i
+        y = (gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami)/g1palp ! ratio of gamma functions
         ELSE
          y = ventrxn(mgs)
         ENDIF
@@ -15381,6 +17672,12 @@ subroutine nssl_2mom_gs   &
      &            Sqrt(ax(lr)*rhovt(mgs))*(vent1/vent2)
        
 
+!        rwventz(mgs) =    &
+!     &    0.78*x +    &
+!     &    0.308*fvent(mgs)*y*   &
+!     &            Sqrt(ax(lr)*rhovt(mgs))*(vent1/vent2)
+
+
         ELSEIF ( iferwisventr == 2 ) THEN
           
 !  Following Wisner et al. (1972) but using gamma of volume. Note that Ferrier rain fall speed does not integrate with gamma of volume, so using Vr = ar*d^br
@@ -15392,6 +17689,22 @@ subroutine nssl_2mom_gs   &
      &    *(xdia(mgs,lr,1)**((1.0+br)/2.0)) )
 
 
+        alpr = Min(alpharmax,alpha(mgs,lr) )
+
+           tmp = alpr + 5.5 + br/2.
+           i = Int(dgami*(tmp))
+           del = tmp - dgam*i
+           y = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
+
+!        rwventz(mgs) =    &
+!     &    0.78*(4. + alpha(mgs,lr))*(3. + alpha(mgs,lr))*(2. + alpha(mgs,lr))*(1. + alpha(mgs,lr)) +    &
+        rwventz(mgs) =    &
+     &    0.78*(4. + alpr)*(3. + alpr)*(2. + alpr)*(1. + alpr) +    &
+     &    0.308*fvent(mgs)*   &
+     &            Sqrt(ax(lr)*rhovt(mgs))*(y/gf1palp(mgs))*(xdia(mgs,lr,1)**((1.0+br)/2.0))
+
+
+
           
           ENDIF ! iferwisventr
           
@@ -15554,6 +17867,8 @@ subroutine nssl_2mom_gs   &
      &   -ftka(mgs)*temcg(mgs)/rho0(mgs) )    &
      &  / (felf(mgs))
       fmlt2(mgs) = -fcw(mgs)*temcg(mgs)/felf(mgs)
+      fmlt1e(mgs) = (2.0*pi)*   &
+     &  ( felv(mgs)*fwvdf(mgs)*(qss0(mgs)-qx(mgs,lv))  ) / (felf(mgs))
       end do
 !
 !  Vapor Deposition constants
@@ -15581,6 +17896,7 @@ subroutine nssl_2mom_gs   &
         qhlmlrlg(:) = 0.0
       ENDIF
       qhfzh(:) = 0.0
+      qffzf(:) = 0.0
       qhlfzhl(:) = 0.0
       qhfzhlg(:) = 0.0
       qhlfzhllg(:) = 0.0
@@ -15591,6 +17907,7 @@ subroutine nssl_2mom_gs   &
       zsmlr(:) = 0.0
       zhmlr(:) = 0.0
       zhmlrr(:) = 0.0
+      zsmlrr(:) = 0.0
       zhshr(:) = 0.0
       zhlmlr(:) = 0.0
       zhlshr(:) = 0.0
@@ -15642,7 +17959,7 @@ subroutine nssl_2mom_gs   &
        qhmlr(mgs) =   &
      &   meltfac*min(   &
      &  fmlt1(mgs)*cx(mgs,lh)*hwvent(mgs)*xdia(mgs,lh,1)   &
-     &  + fmlt2(mgs)*(qhacrmlr(mgs)+qhacw(mgs))    &
+     &  + fmlt2(mgs)*(qhacrmlr(mgs)+qhacwmlr(mgs))    &
      &   , 0.0 )
        ELSEIF ( ibinhmlr == 1 ) THEN ! use incomplete gamma functions to approximate the bin results
 
@@ -15674,13 +17991,13 @@ subroutine nssl_2mom_gs   &
        qhlmlr(mgs) =   &
      &   meltfac*min(   &
      &  fmlt1(mgs)*cx(mgs,lhl)*hlvent(mgs)*xdia(mgs,lhl,1)   &
-     &  + fmlt2(mgs)*(qhlacrmlr(mgs)+qhlacw(mgs))    &
+     &  + fmlt2(mgs)*(qhlacrmlr(mgs)+qhlacwmlr(mgs))    &
      &   , 0.0 )
 
        ELSEIF ( ibinhlmlr == 1 ) THEN ! use incomplete gamma functions to approximate the bin results
 
-! #ifdef Z3MOM
-! #if (defined Z3MOM) && defined( COMMAS ) || defined( COMMASTMP )
+! #ifdef 1
+! #if (defined 1) && defined( COMMAS ) || defined( COMMASTMP )
 
        ELSEIF ( ibinhlmlr == -1 ) THEN ! OLD VERSION use incomplete gamma functions to approximate the bin results
 
@@ -15711,7 +18028,7 @@ subroutine nssl_2mom_gs   &
         chmlr(mgs)  = max( chmlr(mgs),  Min( -chmxd(mgs), -0.95*cx(mgs,lh)*dtpinv ) ) 
       ENDIF
 !      qhmlr(mgs)  = max( max( qhmlr(mgs),  -qhmxd(mgs) ) , -0.5*qx(mgs,lh)*dtpinv ) !limits to 1/2 qh or max depletion
-      qhmlh(mgs)  = 0.
+      qhmlh(mgs)  = 0. ! not used
 
 
       ! Rasmussen and Heymsfield say melt water remains on graupel up to 9 mm before shedding
@@ -15789,7 +18106,26 @@ subroutine nssl_2mom_gs   &
 
 
 
+        IF ( lzr .gt. 1 .and. qx(mgs,ls) > qxmin(ls) ) THEN
+            tmp = qx(mgs,ls)/cx(mgs,ls)
+!            alp = Max( -0.8, alpha(mgs,lh) )
+            alp = xnu(ls)
+            g1 = 36.*(alp+2.0)/((alp+1.0)*pi**2)
+
+          zsmlr(mgs) =  g1*(rho0(mgs)/(xdn(mgs,ls)))**2*( tmp * qsmlr(mgs) )
+!          zhmlr(mgs) =  (xdn0(lr)/(xdn(mgs,lh)))**2*( zx(mgs,lh) * qhmlr(mgs) )
+
+        ENDIF
+
      IF ( chmlr(mgs) < 0.0 .and. (ibinhmlr < 1 .or. lzh < 1) ) THEN ! { already done if ibinhmlr > 0
+      IF ( lzr .gt. 1 .and. lzh < 1  .and. qx(mgs,lh) > qxmin(lh) ) THEN ! Only compute if rain is 3-moment but graupel is not, otherwise is computed later
+          tmp = qx(mgs,lh)/cx(mgs,lh)
+          alp = alpha(mgs,lh)
+          g1 = g1x(mgs,lh) ! (6.0 + alp)*(5.0 + alp)*(4.0 + alp)/((3.0 + alp)*(2.0 + alp)*(1.0 + alp))
+        
+        zhmlr(mgs) =  g1*(6.*rho0(mgs)/(pi*xdn(mgs,lh)))**2*( 2.*tmp * qhmlr(mgs) - tmp**2 * chmlr(mgs)  )
+
+      ENDIF
       
       IF ( ibinhmlr == 0 .or. lzh < 1 ) THEN
       IF ( ihmlt .eq. 1 ) THEN
@@ -15895,6 +18231,17 @@ subroutine nssl_2mom_gs   &
       ENDIF !}
       
         
+       IF ( lzhl .gt. 1 .and. ibinhlmlr <= 0 ) THEN
+        IF ( cx(mgs,lhl) > 0.0 ) THEN
+
+          tmp = qx(mgs,lhl)/cx(mgs,lhl)
+          alp = alpha(mgs,lhl)
+!          g1 = (6.0 + alp)*(5.0 + alp)*(4.0 + alp)/((3.0 + alp)*(2.0 + alp)*(1.0 + alp))
+          g1 = g1x(mgs,lhl) ! (6.0 + alp)*(5.0 + alp)*(4.0 + alp)/((3.0 + alp)*(2.0 + alp)*(1.0 + alp))
+        
+        zhlmlr(mgs) =  g1*(6.*rho0(mgs)/(pi*xdn(mgs,lhl)))**2*( tmp * qhlmlr(mgs) )
+       ENDIF
+      ENDIF
       ENDIF ! }
 
       ENDIF ! }.not. mixedphase 
@@ -15932,6 +18279,7 @@ subroutine nssl_2mom_gs   &
       ENDDO
 !
 !
+      qhdsv(:) = 0.0
       qhldsv(:) = 0.0
 
       do mgs = 1,ngscnt
@@ -15941,6 +18289,7 @@ subroutine nssl_2mom_gs   &
      &    fvds(mgs)*cx(mgs,li)*civent(mgs)*cicap(mgs)*depfac
         qsdsv(mgs) =   &
      &    fvds(mgs)*cx(mgs,ls)*swvent(mgs)*swcap(mgs)*depfac
+
 !        IF ( ny .eq. 2 .and. igs(mgs) .eq. 302 .and. temg(mgs) .le. tfrh+10 .and. qx(mgs,lv) .gt. qis(mgs)
 !     :       .and. qx(mgs,li) .gt. qxmin(li) ) THEN
 !         write(0,*) 'qidsv = ',nstep,kgs(mgs),qidsv(mgs),temg(mgs)-tfrh,100.*(qx(mgs,lv)/qis(mgs) - 1.),1.e6*xdia(mgs,li,1),
@@ -16177,20 +18526,41 @@ subroutine nssl_2mom_gs   &
 
 ! end of qlimit
 
+      qhcev(:) = 0.0
+      chcev(:) = 0.0
+      qhlcev(:) = 0.0
+      chlcev(:) = 0.0
+      qfcev(:) = 0.0
+
       do mgs = 1,ngscnt
       qisbv(mgs) = 0.0
       qssbv(mgs) = 0.0
       qidpv(mgs) = 0.0
       qsdpv(mgs) = 0.0
+      qhsbv(mgs) = 0.0
+      qscev(mgs) = 0.0
+      cscev(mgs) = 0.0
       IF ( icond .eq. 1 .or. temg(mgs) .le. tfrh    &
-     &      .or. (qx(mgs,lr) .le. qxmin(lr) .and. qx(mgs,lc) .le. qxmin(lc)) ) THEN
+     &      .or. (qx(mgs,lr) .le. qxmin(lr) .and. qx(mgs,lc) .le. qxmin(lc)) ) THEN ! last condition (qr<qmin & qc<qmin) for case icond=0
 !        qisbv(mgs) = max( min(qidsv(mgs), 0.0), -qimxd(mgs) )
 !        qssbv(mgs) = max( min(qsdsv(mgs), 0.0), -qsmxd(mgs) )
 ! erm 5/10/2007:
         qisbv(mgs) = max( min(qidsv(mgs), 0.0),  Min( -qimxd(mgs), -0.5*qx(mgs,li)*dtpinv ) )
+        IF ( temg(mgs) < tfr .or. .not. qsmlr(mgs) < 0.0 ) THEN
         qssbv(mgs) = max( min(qsdsv(mgs), 0.0),  Min( -qsmxd(mgs), -0.5*qx(mgs,ls)*dtpinv ) )
+        ENDIF
         qidpv(mgs) = Max(qidsv(mgs), 0.0)
         qsdpv(mgs) = Max(qsdsv(mgs), 0.0)
+        
+        IF ( qsmlr(mgs) < 0.0 .and. .not. mixedphase ) THEN ! switch snow sublimation to evaporation if there is melting
+
+          qscev(mgs) = evapfac*   &
+     &  4.0*pi*(qx(mgs,lv)-qss0(mgs))*cx(mgs,ls)*swcap(mgs)*swvent(mgs)/(qss0(mgs)*(fav(mgs)+fbv(mgs)))
+          qscev(mgs) = Max( Min(0.0,qscev(mgs)),  Min( -qsmxd(mgs), -0.5*qx(mgs,ls)*dtpinv ) )
+        ELSE
+
+        ENDIF
+
 
 
       ELSE
@@ -16200,16 +18570,43 @@ subroutine nssl_2mom_gs   &
         qsdpv(mgs) = 0.0
       ENDIF
 
+      IF ( temg(mgs) < tfr .or. .not. qhmlr(mgs) < 0.0 ) THEN
+      ! no liquid from melting, so evaporation is greater. Thus can calculate sublimation rate
       qhsbv(mgs) = max( min(qhdsv(mgs), 0.0), -qhmxd(mgs) )
-
       qhdpv(mgs) = Max(qhdsv(mgs), 0.0)
+      ENDIF
+      
+      IF ( .true. .and. qhmlr(mgs) < 0.0 .and. .not. mixedphase ) THEN
+        ! Liquid is forming, so find the evaporation that was subtracted from melting (if it is not condensing)
+!       qhcev(mgs) =   &
+!     &   evapfac*min(   &
+!     &  fmlt1e(mgs)*cx(mgs,lh)*hwvent(mgs)*xdia(mgs,lh,1), 0.0 )
+        
+      qhcev(mgs) =  evapfac*  &
+     &  2.0*pi*(qx(mgs,lv)-qss0(mgs))*cx(mgs,lh)*xdia(mgs,lh,1)*hwvent(mgs)/(qss0(mgs)*(fav(mgs)+fbv(mgs)))
+
+      qhcev(mgs)  = max(qhcev(mgs), -qhmxd(mgs))
+        
+      ENDIF
 
 
       qhlsbv(mgs) = 0.0
       qhldpv(mgs) = 0.0
       IF ( lhl .gt. 1 ) THEN
+      IF ( qx(mgs,lhl) > qxmin(lhl) ) THEN
+        IF ( temg(mgs) < tfr .or. .not. qhlmlr(mgs) < 0.0 ) THEN
         qhlsbv(mgs) = max( min(qhldsv(mgs), 0.0), -qxmxd(mgs,lhl) )
         qhldpv(mgs) = Max(qhldsv(mgs), 0.0)
+        ENDIF
+        IF ( qhlmlr(mgs) < 0.0 .and. .not. mixedphase ) THEN
+        ! Liquid is forming, so find the evaporation that was subtracted from melting (if it is not condensing)
+         qhlcev(mgs) =  evapfac*  &
+     &      2.0*pi*(qx(mgs,lv)-qss0(mgs))*cx(mgs,lhl)*xdia(mgs,lhl,1)*hlvent(mgs)/(qss0(mgs)*(fav(mgs)+fbv(mgs)))
+
+         qhlcev(mgs)  = max(qhlcev(mgs), -qhlmxd(mgs))
+        
+      ENDIF
+      ENDIF
       ENDIF
       
       temp1 = qidpv(mgs) + qsdpv(mgs) + qhdpv(mgs) + qhldpv(mgs)
@@ -16345,6 +18742,10 @@ subroutine nssl_2mom_gs   &
       end if
       end do
 
+
+
+
+
 !
 !
 !  compute dry growth rate of snow, graupel, and hail
@@ -16382,19 +18783,27 @@ subroutine nssl_2mom_gs   &
 !      IF ( dnu(lh) .ne. 0. ) THEN
 !        qhwet(mgs) = qhdry(mgs)
 !      ELSE
+       IF ( incwet == 0 ) THEN
         qhwet(mgs) =   &
      &    ( xdia(mgs,lh,1)*hwvent(mgs)*cx(mgs,lh)*fwet1(mgs)   &
      &   + fwet2(mgs)*(qhaci(mgs) + qhacs(mgs)) )
        qhwet(mgs) = max( 0.0, qhwet(mgs))
+         ELSE
+         ENDIF
+
 !      ENDIF
 
 
        qhlwet(mgs) = 0.0
        IF ( lhl .gt. 1 ) THEN
-       qhlwet(mgs) =   &
-     &    ( xdia(mgs,lhl,1)*hlvent(mgs)*cx(mgs,lhl)*fwet1(mgs)   &
-     &   + fwet2(mgs)*(qhlaci(mgs) + qhlacs(mgs)) )
-       qhlwet(mgs) = max( 0.0, qhlwet(mgs))
+         IF ( incwet == 0 ) THEN
+         qhlwet(mgs) =   &
+     &     ( xdia(mgs,lhl,1)*hlvent(mgs)*cx(mgs,lhl)*fwet1(mgs)   &
+     &     + fwet2(mgs)*(qhlaci(mgs) + qhlacs(mgs)) )
+         qhlwet(mgs) = max( 0.0, qhlwet(mgs))
+         
+         ELSE
+         ENDIF ! incwet
        ENDIF
        
        ELSE
@@ -16407,6 +18816,7 @@ subroutine nssl_2mom_gs   &
 !      qhlwet(mgs) = qhldry(mgs)
 
       end do
+
 !
 ! shedding rate
 !
@@ -16466,7 +18876,7 @@ subroutine nssl_2mom_gs   &
        qhshr(mgs)  = -qhdry(mgs)
        qhlshr(mgs) = -qhldry(mgs)
        ELSE ! new and correct
-       
+       ! note that the qxacr terms should be zero here, so shedding at T > 0 is all from the droplets
        qsshr(mgs)   = - qsacr(mgs) - qsacw(mgs) ! -qsdry(mgs)
        qhlshr(mgs)  = - qhlacw(mgs) - qhlacr(mgs) ! -qhldry(mgs)
        qhshr(mgs)  = - qhacw(mgs) - qhacr(mgs) ! -qhdry(mgs)
@@ -16802,7 +19212,94 @@ subroutine nssl_2mom_gs   &
           ltest =  xdia(mgs,lh,1)*(4. + alpha(mgs,lh)) > Abs( hlcnhdia ) ! test on mass-weighted diameter
         ENDIF
 
-         dg0(mgs) = -1.
+         IF ( iusedw == 0 .and. ihlcnh == 1 ) THEN
+           dg0(mgs) = -1.
+         ELSE
+         IF (((qhacw(mgs) + qhacr(mgs))*dtp > qxmin(lh) .and. qx(mgs,lh) > hlcnhqmin .and. temg(mgs) .le. tfr-2.0  &
+               .and.  temg(mgs) .gt. dwtempmin ) .or. ( wetgrowth(mgs) .and. qx(mgs,lh) > hlcnhqmin ) ) THEN
+         dw = 0.01*( Exp( -temcg(mgs)/( 1.1e4 * rho0(mgs)*ehw(mgs)*qx(mgs,lc) - 1.3e3*rho0(mgs)*qx(mgs,li) + 1.0 ) ) - 1.0 )
+         dwr = 0.01*( Exp( -temcg(mgs)/( 1.1e4 * rho0(mgs)*(ehw(mgs)*qx(mgs,lc)+ehr(mgs)*qx(mgs,lr)) - &
+                1.3e3*rho0(mgs)*qx(mgs,li) + 1.0 ) ) - 1.0 )
+          d = dwr
+           IF ( dwr < 0.2 .and. dwr > 0.0 ) THEN
+                      fventh = sqrtrhovt*(fpndl(mgs)**(1./3.)) * (fakvisc(mgs))**(-0.5) 
+                      fventm = sqrtrhovt*(fschm(mgs)**(1./3.)) * (fakvisc(mgs))**(-0.5)
+                      sqrtrhovt = Sqrt( rhovt(mgs) )
+                      ltemq = (tfr-163.15)/fqsat+1.5
+                      qvs0 = pqs(mgs)*tabqvs(ltemq)
+                      denomdp = felf(mgs) + fcw(mgs)*temcg(mgs)
+                      denominvdp = 1.d0/(felf(mgs) + fcw(mgs)*temcg(mgs))
+
+!                      write(91,*) 'dw,dwr,temcg = ',100.*dw,100.*dwr,temcg(mgs)
+                      h1 = ( -ftka(mgs)*temcg(mgs) - felv(mgs)*fwvdf(mgs)*rho0(mgs)*(qx(mgs,lv) - qvs0) )
+                      h2 = ehi(mgs)*qx(mgs,li)*rho0(mgs)*fci(mgs)*temcg(mgs)
+                      h3 = Max(dwehwmin, ehw(mgs))*qx(mgs,lc) 
+                      h4 = ehr(mgs)* qx(mgs,lr)
+                      ! iterate to find minimum diameter for wet growth. Start with value of dwr
+                      DO n = 1,10
+                        dold = d
+                        vth = axx(mgs,lh)*d**bxx(mgs,lh) 
+                        x2 = fventh*sqrtrhovt*Sqrt(d*vth)
+                       IF ( x2 > 1.4 ) THEN
+                         ah = 0.78 + 0.308*x2  ! heat ventillation
+                       ELSE
+                         ah = 1.0 + 0.108*x2**2 ! mass ventillation (Beard and Pruppacher 1971, eq. 9)
+                       ENDIF
+
+                       IF ( .false. ) THEN ! this option includes 'am' separate from ah, which makes only small differences. Otherwise equivalent to second option
+                        x1 = fventm*sqrtrhovt*Sqrt(d*vth)
+                        IF ( x1 > 1.4 ) THEN
+                          am = 0.78 + 0.308*x1 ! mass ventillation (Beard and Pruppacher 1971, eq. 8)
+                        ELSE
+                          am = 1.0 + 0.108*x1**2 ! mass ventillation (Beard and Pruppacher 1971, eq. 9)
+                        ENDIF
+                        
+                        d = 8.*denominvdp*( am*felv(mgs)*fwvdf(mgs)*rho0(mgs)*(qvs0 - qx(mgs,lv)) - ah*ftka(mgs)*temcg(mgs)  )/ &
+                           (dtp* ( ( Max(0.001,vth - vtxbar(mgs,lc,1))*h3 +                              &
+                            Max(0.001,vth - vtxbar(mgs,lr,1))*h4) *rho0(mgs) +               &
+                            Max(0.001,vth - vtxbar(mgs,li,1))*h2*denominvdp))
+                       
+                        ELSE
+
+                        d = 8.*ah*h1*dtpinv/ &
+                            ( ( Max(0.001,vth - vtxbar(mgs,lc,1))*h3 +                              &
+                            Max(0.001,vth - vtxbar(mgs,lr,1))*h4) *rho0(mgs)*denomdp +               &
+                            Max(0.001,vth - vtxbar(mgs,li,1))*h2)
+                        ENDIF
+!                        write(0,*) 'iter,d,dwr = ',n,d,dwr
+!                        write(91,*) 'parts = ',( -ah*ftka*temcg - ah*felv*fwvdf*dn(i,j,k)*(qvamb - qvs0) ),( Max(0.001,vth - 0.01*vwmw)*ehw* qcmks*dn(i,j,k)/denominv + Max(0.001,vth - 0.01*vimw)*ehi*qimks*dn(i,j,k)*fci*temcg)
+!!                        write(91,*) 'partsr = ',( -ah*ftka*temcg - ah*felv*fwvdf*dn(i,j,k)*(qvamb - qvs0) ),( ( Max(0.001,vth - 0.01*vwmw)*ehw* qcmks + Max(0.001,vth - 0.01*vrmw)*ehr* qrmks) *dn(i,j,k)/denominv + &
+!!                            Max(0.001,vth - 0.01*vimw)*ehi*qimks*dn(i,j,k)*fci*temcg)
+!                        write(91,*) 'parts2 = ',vth
+                        
+                        IF ( Abs(dold - d)/dold < 0.05 .or. ( n > 3 .and. d > dg0thresh ) ) EXIT
+                        
+                      ENDDO
+              ENDIF
+              
+              dg0(mgs) = Max( d, dwmin )
+!             IF ( .false. .and. ny == 2 .and. dwr < 0.5 .and. dwr > 0. ) THEN
+!             write(0,*) 'i,k,dg0 = ',igs(mgs), kgs(mgs), dg0(mgs)
+!             write(0,*) 'h1,h2,h3,h4 = ',h1,h2,h3,h4
+!             write(0,*) 'dw,dwr = ',dw,dwr
+!             write(0,*) 'wetgrowth = ',wetgrowth(mgs)
+!             write(0,*) 'temc,Dh, Dhl = ',temcg(mgs),xdia(mgs,lh,3),xdia(mgs,lhl,3)
+!             ENDIF
+          ELSE
+            dg0(mgs) = dg0thresh + 0.0001
+          ENDIF
+          
+            IF ( ihlcnh == 3 .and. (qhacw(mgs) + qhacr(mgs))*dtp > qxmin(lh) .and. qx(mgs,lh) > hlcnhqmin &
+                   .and. temg(mgs) .le. tfr-2.0 ) THEN
+           ! set a secondary condition on to capture large graupel that is riming but not in wet growth
+                dg0(mgs) = Min( dg0(mgs), dg0thresh - 0.0001 )
+            ENDIF
+            
+          ENDIF
+!       write(0,*) 'notwet growth graupel,hail,Dw,Dwr = ',wetgrowth(mgs) , wetgrowthhl(mgs), dh0 ,tmp,tmp1
+!       write(0,*) 'temc,Dh, Dhl = ',temcg(mgs),xdia(mgs,lh,3),xdia(mgs,lhl,3)
+!       write(0,*) 'qc,qi = ', qx(mgs,lc) , qx(mgs,li) 
+
 
         wtest = (dg0(mgs) > 0.0 .and. dg0(mgs) < dg0thresh )
         
@@ -16874,12 +19371,142 @@ subroutine nssl_2mom_gs   &
         ELSEIF ( ihlcnh == 3 ) THEN !{
          
 
+          IF ( wtest  .and. &
+               ( qhacw(mgs)*dtp > qxmin(lh) .and. temg(mgs) .lt. tfr-2. .and. qx(mgs,lh) > hlcnhqmin ) ) THEN
+        ! convert number, mass, and reflectivity for d > dw
+           IF ( ipconc == 5 ) THEN
+            ! dg0(mgs) = Min( dg0(mgs), hldia1 )
+             !dg0(mgs) = hldia1
+           ENDIF
+           
+           ratio = Min( maxratiolu, dg0(mgs)/xdia(mgs,lh,1) )
+
+
+           ! mass
+            tmp2 = gaminterp(ratio,alpha(mgs,lh),4,1)
+           IF ( ipconc == 5 ) THEN
+       !      tmp2 = Min( 0.25, tmp2 )
+           ENDIF
+            qxd1 = qx(mgs,lh)*(tmp2)
+            qhlcnh(mgs) = dtpinv*qxd1
+            flim = 1.0
+!            tmp3 = Min( dtp*(qfacw(mgs) + qfacr(mgs) ), qxmxd(mgs,lf) )
+            tmp3 = qxmxd(mgs,lh)
+            IF (qxd1 > tmp3 ) THEN
+              flim = tmp3/(qxd1)
+              qhlcnh(mgs) = flim*qhlcnh(mgs)
+            ENDIF
+
+            
+            
+            IF ( ( qxd1 > qxmin(lhl) .and. ipconc > 5 ) .or. ( qxd1 > 10.*qxmin(lhl) .and. ipconc == 5) ) THEN
+            
+           ! number
+            tmp = gaminterp(ratio,alpha(mgs,lh),1,1)
+             IF ( ipconc == 5 ) THEN
+          !     tmp = Min( 0.2, tmp )
+             ENDIF
+            cxd1 = flim*cx(mgs,lh)*( tmp)
+            chlcnh(mgs) = dtpinv*cxd1
+            chlcnhhl(mgs) = chlcnh(mgs)
+
+           IF ( qx(mgs,lhl) > qxmin(lhl) .and. dmhlopt > 0 ) THEN
+             dh0 = rho0(mgs)*qhlcnh(mgs)/chlcnhhl(mgs)
+             IF ( dh0 < xmas(mgs,lhl) ) THEN
+               ! dh0 = ( qxd1*dh0 + qx(mgs,lhl)*xmas(mgs,lhl))/( qxd1 + qx(mgs,lhl))  ! weighted average
+               dh0 = (( qxd1*dh0**(1./3.) + qx(mgs,lhl)*xmas(mgs,lhl)**(1./3.))/( qxd1 + qx(mgs,lhl)))**3  ! weighted average
+               chlcnhhl(mgs) = Min( chlcnhhl(mgs), rho0(mgs)*qhlcnh(mgs)/dh0 )
+             ELSE
+!               dh0 = Max( dh0, xmas(mgs,lhl) ) ! when enough hail is established, do not dilute the size
+             ENDIF
+           ENDIF
+
+
+           ! reflectivity
+           IF ( lzh > 1 .and. lzhl > 1 ) THEN
+            tmp3 = gaminterp(ratio,alpha(mgs,lh),11,1)
+            zxd1 = flim*zx(mgs,lh)*(tmp3)
+            zhlcnh(mgs) = dtpinv*zxd1
+           ELSE
+            zxd1 = 0
+           ENDIF
+
+            ELSE
+               qhlcnh(mgs) = 0.0
+            ENDIF
+
+!           IF ( cxd1 < 0.0 .or. qxd1 < 0.0 ) THEN
+!             write(0,*) 'cxd1,qxd1 = ',cxd1,qxd1
+!             write(0,*) 'dw,temcg = ',dw,temcg(mgs),ratio 
+!           ENDIF
+           
+!           write(0,*) 'dw,temcg = ',dw,temcg(mgs),ratio
+!           write(0,*) 'qhlcnh,qh = ',qhlcnh(mgs),qx(mgs,lh),qxd1
+!           write(0,*) 'chlcnh,ch = ',chlcnh(mgs),cx(mgs,lh),cxd1
+!           write(0,*) 'zhlcnh,zh = ',zhlcnh(mgs),zx(mgs,lh),zxd1
+!           write(0,*) 'tmp1,2,3 = ',tmp,tmp2,tmp3
+
+           vhlcnh(mgs) = rho0(mgs)*qhlcnh(mgs)/xdn(mgs,lh)
+           vhlcnhl(mgs) = rho0(mgs)*qhlcnh(mgs)/Max(xdnmn(lhl), xdn(mgs,lh))
+           
+           ENDIF
+
+
         ENDIF !}
       
       ENDDO
       
       ELSEIF ( ihlcnh == 2 ) THEN ! 10-ice type conversion 
 
+!
+! Staka and Mansell (2005) type conversion
+!
+!      hldia1 is set in micro_module and namelist
+!      IF ( .true. ) THEN
+      
+        ! convert number, mass, and reflectivity for d > hldia1,
+        ! regardless of wet growth status, but as long as riming > 0
+        DO mgs = 1,ngscnt
+        IF ( qhacw(mgs)*dtp > qxmin(lh) .and. temg(mgs) .lt. tfr-2. .and. qx(mgs,lh) > qxmin(lh) ) THEN
+           ratio = Min( maxratiolu, hldia1/xdia(mgs,lh,1) )
+
+           ! number
+            tmp = gaminterp(ratio,alpha(mgs,lh),1,1)
+            cxd1 = cx(mgs,lh)*( tmp)
+            chlcnh(mgs) = dtpinv*cxd1
+            chlcnhhl(mgs) = chlcnh(mgs)
+
+           ! mass
+            tmp2 = gaminterp(ratio,alpha(mgs,lh),4,1)
+            qxd1 = qx(mgs,lh)*(tmp2)
+            qhlcnh(mgs) = dtpinv*qxd1
+
+           ! reflectivity
+           IF ( lzh > 1 .and. lzhl > 1 ) THEN
+            tmp3 = gaminterp(ratio,alpha(mgs,lh),11,1)
+            zxd1 = zx(mgs,lh)*(tmp3)
+            zhlcnh(mgs) = dtpinv*zxd1
+           ELSE
+            zxd1 = 0
+           ENDIF
+!           IF ( cxd1 < 0.0 .or. qxd1 < 0.0 ) THEN
+!             write(0,*) 'cxd1,qxd1 = ',cxd1,qxd1
+!             write(0,*) 'dw,temcg = ',dw,temcg(mgs),ratio 
+!           ENDIF
+           
+!           write(0,*) 'dw,temcg = ',dw,temcg(mgs),ratio
+!           write(0,*) 'qhlcnh,qh = ',qhlcnh(mgs),qx(mgs,lh),qxd1
+!           write(0,*) 'chlcnh,ch = ',chlcnh(mgs),cx(mgs,lh),cxd1
+!           write(0,*) 'zhlcnh,zh = ',zhlcnh(mgs),zx(mgs,lh),zxd1
+!           write(0,*) 'tmp1,2,3 = ',tmp,tmp2,tmp3
+
+           vhlcnh(mgs) = rho0(mgs)*qhlcnh(mgs)/xdn(mgs,lh)
+           vhlcnhl(mgs) = rho0(mgs)*qhlcnh(mgs)/Max(xdnmn(lhl), xdn(mgs,lh))
+           
+         ENDIF
+         
+         ENDDO
+!        ENDIF
       ELSEIF ( ihlcnh == 0 ) THEN
 
       do mgs = 1,ngscnt
@@ -17115,6 +19742,10 @@ subroutine nssl_2mom_gs   &
       ciacrf(mgs)  = qrzfac(mgs)*ciacrf(mgs)
       ciacrs(mgs)  = qrzfac(mgs)*ciacrs(mgs)
 
+!      IF ( lzh .gt. 1 ) THEN
+!        zrfrzf(mgs) = 3.6476*rho0(mgs)**2*(alpha(mgs,lr)+2.)/(xdn0(lr)**2*(alpha(mgs,lr)+1.)) * &
+!        ( 2.*tmp * qrfrzf(mgs) - tmp**2 * crfrzf(mgs)  )
+!      ENDIF
       
        vrfrzf(mgs)  = qrzfac(mgs)*vrfrzf(mgs)
        viacrf(mgs)  = qrzfac(mgs)*viacrf(mgs)
@@ -17154,7 +19785,13 @@ subroutine nssl_2mom_gs   &
       IF ( qrcev(mgs) .lt. 0. .and. lnr > 1 ) THEN
 !        qrcev(mgs) =   -qrmxd(mgs)
 !        crcev(mgs) = (rho0(mgs)/(xmas(mgs,lr)+1.e-20))*qrcev(mgs)
-      crcev(mgs) = (cx(mgs,lr)/(qx(mgs,lr)))*qrcev(mgs)
+        IF ( icrcev == 1 ) THEN
+          crcev(mgs) = (cx(mgs,lr)/(qx(mgs,lr)))*qrcev(mgs)
+        ELSEIF ( icrcev == 2 ) THEN
+          crcev(mgs) = (cx(mgs,lr)/(qx(mgs,lr)))*qrcev(mgs)*vtxbar(mgs,lr,2)/vtxbar(mgs,lr,1)
+        ELSE
+          crcev(mgs) = 0.0
+        ENDIF
       ELSE
          crcev(mgs) = 0.0
       ENDIF
@@ -17166,12 +19803,6 @@ subroutine nssl_2mom_gs   &
 !
 ! evaporation/condensation of wet graupel and snow
 !
-      qscev(:) = 0.0
-      cscev(:) = 0.0
-      qhcev(:) = 0.0
-      chcev(:) = 0.0
-      qhlcev(:) = 0.0
-      chlcev(:) = 0.0
       IF ( lhwlg > 1 ) THEN
       qhcevlg(:) = 0.0
       chcevlg(:) = 0.0
@@ -17181,6 +19812,7 @@ subroutine nssl_2mom_gs   &
       chlcevlg(:) = 0.0
       ENDIF
 
+
 !
 !
 !
@@ -18140,6 +20772,7 @@ subroutine nssl_2mom_gs   &
       pqwvi(mgs) =    &
      &  -Min(0.0, qrcev(mgs))   &
      &  -Min(0.0, qhcev(mgs))   &
+     &  -Min(0.0, qfcev(mgs))   &
      &  -Min(0.0, qhlcev(mgs))   &
      &  -Min(0.0, qscev(mgs))   &
 !     >  +il5(mgs)*(-qhsbv(mgs) - qhlsbv(mgs) )   &
@@ -18150,6 +20783,7 @@ subroutine nssl_2mom_gs   &
       pqwvd(mgs) =     &
      &  -Max(0.0, qrcev(mgs))   &
      &  -Max(0.0, qhcev(mgs))   &
+     &  -Max(0.0, qfcev(mgs))   &
      &  -Max(0.0, qhlcev(mgs))   &
      &  -Max(0.0, qscev(mgs))   &
      &  +il5(mgs)*(-qiint(mgs)   &
@@ -18366,7 +21000,8 @@ subroutine nssl_2mom_gs   &
        qrcev(mgs)  = frac*qrcev(mgs)
        qhlacr(mgs) = frac*qhlacr(mgs)
        vhlacr(mgs) = frac*vhlacr(mgs)
-!       qhcev(mgs)  = frac*qhcev(mgs)
+       qhcev(mgs)  = frac*qhcev(mgs)
+       qhlcev(mgs)  = frac*qhlcev(mgs)
 
 
       IF ( warmonly < 0.5 ) THEN
@@ -18412,6 +21047,8 @@ subroutine nssl_2mom_gs   &
 
 !       STOP
       ENDIF
+
+
       end do
 
       IF ( warmonly < 0.5 ) THEN
@@ -18440,7 +21077,7 @@ subroutine nssl_2mom_gs   &
      &  -qhcns(mgs)   &
      &  +(1-il5(mgs))*qsmlr(mgs) + qsshr(mgs)    &    !null at this point when wet snow included
 !     >  +il5(mgs)*(qssbv(mgs))   &
-     &  + (qssbv(mgs))   &
+     &  + qssbv(mgs)   &
      &  + Min(0.0, qscev(mgs))  &
      &  -qsmul(mgs)
       
@@ -18534,74 +21171,656 @@ subroutine nssl_2mom_gs   &
       ENDIF
 
 
-      end do
-      
-      ENDIF ! lhl
+      end do
+      
+      ENDIF ! lhl
+
+      ELSEIF ( warmonly < 0.8 ) THEN
+!
+!  Graupel
+!
+      do mgs = 1,ngscnt
+      pqhwi(mgs) =    &
+     &  +il5(mgs)*ifrzg*(qrfrzf(mgs) )   &
+     &  +il5(mgs)*(qhdpv(mgs))   &
+     &  +qhacr(mgs)+qhacw(mgs)   
+      pqhwd(mgs) =     &
+     &   qhshr(mgs)                &    !null at this point when wet graupel included
+     &  - qhlcnh(mgs)   &
+     &  - qhmul1(mgs)   &
+     &  - qsplinter(mgs) - qsplinter2(mgs) &
+     &  +(1-il5(mgs))*qhmlr(mgs)        !null at this point when wet graupel included
+       end do
+
+!
+!  Hail
+!
+      IF ( lhl .gt. 1 ) THEN
+
+      do mgs = 1,ngscnt
+      pqhli(mgs) =    &
+     &  +il5(mgs)*(qhldpv(mgs) ) & ! + (1.0-ifrzg)*(qiacrf(mgs)+qrfrzf(mgs)  + qracif(mgs)))   &
+     &  +il5(mgs)*(1.0-ifrzg)*(qrfrzf(mgs) )  &
+     &  +qhlacr(mgs)+qhlacw(mgs)   &
+!     &  +qhlacs(mgs)+qhlaci(mgs)   &
+     &  + qhlcnh(mgs)
+      pqhld(mgs) =     &
+     &   qhlshr(mgs)    &
+     &  +(1-il5(mgs))*qhlmlr(mgs)    &
+!     >  +il5(mgs)*qhlsbv(mgs)   &
+     &  + qhlsbv(mgs)   &
+     &  -qhlmul1(mgs) - qhcnhl(mgs)
+
+      end do
+
+      ENDIF ! lhl
+
+      ENDIF ! warmonly
+
+!
+!  Liquid water on snow and graupel 
+!
+
+      vhmlr(:) = 0.0
+      vhlmlr(:) = 0.0
+      vhfzh(:) = 0.0
+      vhlfzhl(:) = 0.0
+
+      IF ( mixedphase ) THEN
+      ELSE ! set arrays for non-mixedphase graupel
+      
+!        vhshdr(:) = 0.0
+        vhmlr(:) = qhmlr(:) ! not actually volume, but treated as q in rate equation
+!        vhsoak(:) = 0.0
+
+!        vhlshdr(:) = 0.0
+        vhlmlr(:) = qhlmlr(:) ! not actually volume, but treated as q in rate equation
+!        vhlmlr(:) = rho0(:)*qhlmlr(:)/xdn(:,lhl) 
+!        vhlsoak(:) = 0.0
+
+      ENDIF  ! mixedphase
+
+
+
+!
+!  Graupel reflectivity
+!
+      if (ndebug .gt. 0 .and. my_rank>=0 ) write(0,*) my_rank, 'graupel reflectivity'
+
+      do mgs = 1,ngscnt
+      
+!      zhmlr(mgs) = 0.0
+!      zhshr(mgs) = 0.0
+!      zhmlrr(mgs) = 0.0
+!      zhshrr(mgs) = 0.0
+      zhdsv(mgs) = 0.0
+!      IF ( lf < 1 ) THEN
+      IF ( ffrzh > 0.0 ) THEN
+      ziacr(mgs) = 0.0
+      ziacrf(mgs) = 0.0
+      ENDIF
+!      ENDIF
+      zhcns(mgs) = 0.0
+      zhcni(mgs) = 0.0
+      zhacs(mgs) = 0.0
+      zhaci(mgs) = 0.0
+      
+      ENDDO
+
+      IF ( lzh .gt. 1 ) THEN ! 
+      do mgs = 1,ngscnt
+      
+      
+      IF ( qx(mgs,lh) .gt. qxmin(lh) .and. cx(mgs,lh) .gt. 0.0 ) THEN
+          tmp = qx(mgs,lh)/cx(mgs,lh)
+          alp = Max( alphamin, alpha(mgs,lh) )
+!          g1 = (6.0 + alp)*(5.0 + alp)*(4.0 + alp)/((3.0 + alp)*(2.0 + alp)*(1.0 + alp))
+          g1 = g1x(mgs,lh) ! (6.0 + alp)*(5.0 + alp)*(4.0 + alp)/((3.0 + alp)*(2.0 + alp)*(1.0 + alp))
+!          g1r = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
+
+           zhaci(mgs) =  g1*(6.*rho0(mgs)/(pi*xdn(mgs,lh)))**2*( 2.*( tmp ) * qhaci(mgs) )
+           zhacs(mgs) =  g1*(6.*rho0(mgs)/(pi*xdn(mgs,lh)))**2*( 2.*( tmp ) * qhacs(mgs) )
+        
+        IF ( .not. mixedphase  .and. ibinhmlr < 1 ) THEN
+        zhmlr(mgs) =  g1*(6.*rho0(mgs)/(pi*xdn(mgs,lh)))**2*( 2.*tmp * qhmlr(mgs) - tmp**2 * chmlr(mgs)  )
+        ENDIF
+        
+        zhshr(mgs) =  g1*(6.*rho0(mgs)/(pi*xdn(mgs,lh)))**2*( 2.*tmp * qhshr(mgs) - tmp**2 * chshr(mgs)  )
+
+!        IF ( lzr > 0 .and. qhshr(mgs) /= 0.0 .and. chshrr(mgs) /= 0.0 .and. ibinhmlr < 1 ) THEN
+        IF ( lzr > 0 .and. qhshr(mgs) /= 0.0 .and. chshrr(mgs) /= 0.0 ) THEN
+!         IF ( temg(mgs) > tfr + 2.0 ) THEN
+!           zhshrr(mgs) =  g1*(6.*rho0(mgs)/(pi*xdn(mgs,lr)))**2*( 2.*tmp * qhshr(mgs) - tmp**2 * chshrr(mgs)  )
+!           IF ( zhshrr(mgs) > 0. ) THEN
+!             zhshrr(mgs) =  g1*(6.*rho0(mgs)/(pi*xdn(mgs,lr)))**2*( 2.*tmp * qhshr(mgs) - tmp**2 * chshr(mgs) )
+!           ENDIF
+!           z1 = g1shr*(6.*rho0(mgs)/(pi*xdn(mgs,lr)))**2*( qhshr(mgs)**2/ chshrr(mgs)  ) ! should this be g1shr?
+!           zhshrr(mgs) = Max( z1, zhshrr(mgs))
+!         ELSE
+!          zhshrr(mgs) =  g1shr*(6.*rho0(mgs)/(pi*xdn(mgs,lr)))**2*( qhshr(mgs)**2/ chshrr(mgs)  )
+
+
+         IF ( temg(mgs) >= tfr ) THEN
+ !           zhshrr(mgs) =  g1*(6.*rho0(mgs)/(pi*xdn0(lr)))**2*( 2.*tmp * qhshr(mgs) - tmp**2 * chshrr(mgs)  )
+ !           IF ( zhshrr(mgs) > 0.0 ) THEN
+ !             zhshrr(mgs) =  g1*(6.*rho0(mgs)/(pi*xdn0(lr)))**2*( 2.*tmp * qhshr(mgs) - tmp**2 * chshr(mgs)  )
+ !           ENDIF
+           IF ( (shedalp + alpha(mgs,lh))*xdia(mgs,lh,1) < sheddiam ) THEN ! if not shedding small drops, then use alpha of hail
+             z1 = g1*(6.0*rho0(mgs)/(pi*xdn(mgs,lr)))**2*( qhshr(mgs)**2/ chshrr(mgs)  ) 
+           ELSE
+             z1 = g1shr*(6.0*rho0(mgs)/(pi*xdn(mgs,lr)))**2*( qhshr(mgs)**2/ chshrr(mgs)  ) ! should this be g1shr?
+           ENDIF
+           zhshrr(mgs) = z1
+!           z1 = g1mlr*(rho0(mgs)/(xdn(mgs,lr)))**2*( qhshr(mgs)**2/ chshrr(mgs)  ) ! should this be g1shr?
+!           zhshrr(mgs) = Max( z1, zhshrr(mgs))
+         ELSE
+          zhshrr(mgs) =  g1shr*(6.*rho0(mgs)/(pi*xdn(mgs,lr)))**2*( qhshr(mgs)**2/ chshrr(mgs)  )
+         ENDIF
+         
+         zhshrr(mgs) = Min( 0.0, zhshrr(mgs) )
+        ENDIF
+
+        IF ( zhshr(mgs) > 0.0 ) THEN
+          write(0,*) 'Problem with zhshr! zhshr,qhshr,chshr = ',zhshr(mgs),qhshr(mgs),chshr(mgs)
+          write(0,*) 'g1,tmp, qx,cx,zx = ',g1,tmp,qx(mgs,lh),cx(mgs,lh),zx(mgs,lh)
+          write(0,*) ( 2.*tmp * qhshr(mgs) - tmp**2 * chshr(mgs)  ),  2.*tmp * qhshr(mgs), - tmp**2 * chshr(mgs)
+          write(0,*) 'temcg = ',temcg(mgs),'chshr recalc = ',(cx(mgs,lh)/(qx(mgs,lh)+1.e-20))*qhshr(mgs)
+          
+          STOP
+        ENDIF
+
+
+!        zhshr(mgs) =  (xdn0(lr)/(xdn(mgs,lh)))**2*( zx(mgs,lh) * qhshr(mgs) )
+        
+        qtmp = qhdpv(mgs) + qhcev(mgs)
+        ctmp = chdpv(mgs) + chcev(mgs)
+
+        zhdsv(mgs) = g1*(6.*rho0(mgs)/(pi*xdn(mgs,lh)))**2*( 2.*( tmp ) * qtmp - tmp**2 * ctmp )
+
+          alp = Max( alphahacx, alpha(mgs,lh) )
+!          g1 = (6.0 + alp)*(5.0 + alp)*(4.0 + alp)/((3.0 + alp)*(2.0 + alp)*(1.0 + alp))
+          g1 = g1x(mgs,lh) ! (6.0 + alp)*(5.0 + alp)*(4.0 + alp)/((3.0 + alp)*(2.0 + alp)*(1.0 + alp))
+
+          IF ( .true. ) THEN  ! {
+          IF ( qhacr(mgs) .gt. 0.0 ) THEN
+!          zhacr(mgs) =  g1*(6.*rho0(mgs)/(pi*1000.))**2*( 2.*( qx(mgs,lh)/cx(mgs,lh)) * qhacr(mgs) )
+
+!          g1r = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
+!          zhacr(mgs) =  g1*(6.*rho0(mgs)/(pi*xdn(mgs,lh)))**2*( 2.*( qx(mgs,lh)/cx(mgs,lh)) * qhacr(mgs) )
+          zhacr(mgs) =  g1*(6.*rho0(mgs)/(pi*xdn(mgs,lh)))**2*( 2.*( qx(mgs,lh)/cx(mgs,lh)) * qhacr(mgs) )
+!          zhacrf(mgs) = g1*zhacr
+
+
+!          z = g1*(6.*rho0(mgs)/(pi*1000.))**2*( (qx(mgs,lh)+dtp*qhacr(mgs))**2)/(cx(mgs,lh))
+
+          IF ( z > zx(mgs,lh) ) THEN
+!            zhacr(mgs) = (z - zx(mgs,lh))*dtpinv
+          ELSE
+!            zhacr(mgs) = 0.0
+          ENDIF
+          ENDIF
+
+!        zhacr(mgs) =  g1*(6.*rho0(mgs)/(pi*1000.))**2*( 2.*( tmp ) * qhacr(mgs) )
+!        zhacr(mgs) =  g1*(6.*rho0(mgs)/(pi*1000.))**2*( 2.*( tmp ) * qhacr(mgs) - tmp**2 * chacr(mgs) )
+
+!          alp = Max( 1.0, alpha(mgs,lh)+1. )
+!          g1 = (6.0 + alp)*(5.0 + alp)*(4.0 + alp)/
+!     :         ((3.0 + alp)*(2.0 + alp)*(1.0 + alp))
+          IF ( qhacw(mgs) .gt. 0.0 ) THEN
+!          zhacw(mgs) =  g1*(6.*rho0(mgs)/(pi*1000.))**2*( 2.*( qx(mgs,lh)/cx(mgs,lh)) * qhacw(mgs) )
+          zhacw(mgs) =  g1*(6.*rho0(mgs)/(pi*xdn(mgs,lh)))**2*( 2.*( qx(mgs,lh)/cx(mgs,lh)) * qhacw(mgs) )
+
+!          z = g1*(6.*rho0(mgs)/(pi*1000.))**2*( (qx(mgs,lh)+dtp*(qhacw(mgs)-qhmul1(mgs)))**2)/(cx(mgs,lh))
+          IF ( z > zx(mgs,lh) ) THEN
+!            zhacw(mgs) = (z - zx(mgs,lh))*dtpinv
+          ENDIF
+          ENDIF
+
+          ELSE ! } { ! this is not used because of the 'true' above
+
+          IF ( qhacw(mgs) .gt. 0.0 .or. qhacr(mgs) .gt. 0.0 ) THEN
+          z = g1*(6.*rho0(mgs)/(pi*1000.))**2*( (qx(mgs,lh)+dtp*(qhacr(mgs) + qhacw(mgs)-qhmul1(mgs)))**2)/(cx(mgs,lh))
+!          zhacw(mgs) =  g1*(6.*rho0(mgs)/(pi*1000.))**2*( 2.*( qx(mgs,lh)/cx(mgs,lh)) * qhacw(mgs) )
+          IF ( z > zx(mgs,lh) ) THEN
+            zhacw(mgs) = (z - zx(mgs,lh))*dtpinv
+          ENDIF
+          ENDIF
+
+          ENDIF ! }
+
+          IF ( qhlcnh(mgs) .gt. 0.0 .and. ihlcnh < 2  ) THEN
+           zhlcnh(mgs) = g1*(6.*rho0(mgs)/(pi*xdn(mgs,lh)))**2*( 2.*( tmp ) * qhlcnh(mgs) - tmp**2 * chlcnh(mgs) )
+          ENDIF
+      ENDIF
+! qsplinter(mgs)
+      IF ( ffrzh*qiacrf(mgs) .gt. 0.0 .and. cx(mgs,lr) .gt. 0.0 .and. qx(mgs,lr) .gt. qxmin(lr) ) THEN
+            tmp = qx(mgs,lr)/cx(mgs,lr)
+!            alp = 3.0
+!            g1 = (6.0 + alp)*(5.0 + alp)*(4.0 + alp)/((3.0 + alp)*(2.0 + alp)*(1.0 + alp))
+            IF ( imurain == 3 ) THEN
+            ! note that 3.6476 = (6/pi)**2
+            ziacr(mgs) = 3.6476*rho0(mgs)**2*(alpha(mgs,lr)+2.)/(xdn0(lr)**2*(alpha(mgs,lr)+1.))*  &
+     &           ( 2.*tmp * qiacrf(mgs) - tmp**2 * ciacrf(mgs)  )
+            ELSE ! imurain == 1 
+            ziacr(mgs) = 3.6476*rho0(mgs)**2*g1x(mgs,lr)/(xdn0(lr)**2)*  &
+     &           ( 2.*tmp * qiacrf(mgs) - tmp**2 * ciacrf(mgs)  )
+            ENDIF
+            ziacr(mgs) = Min( ziacr(mgs), zxmxd(mgs,lr) )
+!            ziacrf(mgs) = (xdn(mgs,lr)/xdn(mgs,lh))**2 * ziacr(mgs)
+            ziacrf(mgs) = (xdn(mgs,lr)/xdnmx(lh))**2 * ziacr(mgs)
+!            z = g1*(6.*rho0(mgs)/(pi*1000.))**2*( 2.*tmp * (qiacrf(mgs) - qsplinter(mgs)) - tmp**2 * ciacrf(mgs)  )
+!            ziacrf(mgs) = Min(  ziacrf(mgs), z )
+      ENDIF
+      
+      
+      
+      IF ( ffrzh*qrfrzf(mgs) .gt. 0.0 .and. cx(mgs,lr) .gt. 0.0 ) THEN
+            tmp = qx(mgs,lr)/cx(mgs,lr)
+!            alp = 3.0
+!            g1 = (6.0 + alp)*(5.0 + alp)*(4.0 + alp)/((3.0 + alp)*(2.0 + alp)*(1.0 + alp))
+            IF ( imurain == 3 ) THEN
+            zrfrz(mgs) = 3.6476*rho0(mgs)**2*(alpha(mgs,lr)+2.)/(xdn0(lr)**2*(alpha(mgs,lr)+1.)) * &
+     &         ( 2.*tmp * qrfrzf(mgs) - tmp**2 * crfrzf(mgs)  )
+            zrfrzf(mgs) = (xdn(mgs,lr)/xdn(mgs,lh))**2 * zrfrz(mgs)
+            ELSEIF ( imurain == 1 .and. ibiggopt /= 2 ) THEN
+!            zrfrz(mgs) = 3.6476*rho0(mgs)**2*g1x(mgs,lr)/(xdn0(lr)**2) * &
+!     &         ( 2.*tmp * qrfrzf(mgs) - tmp**2 * crfrz(mgs)  )
+            zrfrz(mgs) = 3.6476*rho0(mgs)**2*g1x(mgs,lr)/(xdn0(lr)**2) * &
+     &         ( 2.*tmp * qrfrz(mgs) - tmp**2 * crfrz(mgs)  )
+            zrfrzf(mgs) = 3.6476*rho0(mgs)**2*g1x(mgs,lr)/(rhofrz**2) * &
+     &         ( 2.*tmp * qrfrzf(mgs) - tmp**2 * crfrzf(mgs)  )
+            ENDIF
+            zrfrz(mgs) = Min( zrfrz(mgs), Max(0.4,qrfrz(mgs)/qx(mgs,lr))*zx(mgs,lr)*dtpinv )
+!            zrfrzf(mgs) = (xdn(mgs,lr)/xdn(mgs,lh))**2 * zrfrz(mgs)
+!            zrfrzf(mgs) = (xdn(mgs,lr)/xdnmx(lh))**2 * zrfrz(mgs)
+!            z = g1*(6.*rho0(mgs)/(pi*1000.))**2*( 2.*tmp * (qrfrzf(mgs)-qsplinter2(mgs)) - tmp**2 * crfrzf(mgs)  )
+!             zrfrzf(mgs) = Min(  zrfrzf(mgs), z )
+      ! change this to be alpha=0?
+      ENDIF
+      
+      IF ( lhl > 1 .and. qhcnhl(mgs) .gt. 0.0 ) THEN
+        tmp = qx(mgs,lhl)/cx(mgs,lhl)
+        zhcnhl(mgs) = g1x(mgs,lhl)*(6.*rho0(mgs)/(pi*xdn(mgs,lhl)))**2*( 2.*( tmp ) * qhcnhl(mgs) - tmp**2 * chcnhl(mgs) )
+        
+      ENDIF
+      
+      IF ( qhcns(mgs) > 0.0 .and. chcns(mgs) > 0.0 .and. cx(mgs,ls) > cxmin .and. vhcns(mgs) > 0 ) THEN
+        tmp = qx(mgs,ls)/cx(mgs,ls)
+        r = rho0(mgs)*qhcns(mgs)/vhcns(mgs) ! density of new graupel particles
+        IF ( imusnow == 3 ) THEN
+        zhcns(mgs) = 3.6476*rho0(mgs)**2*(alpha(mgs,ls)+2.)/(r**2*(alpha(mgs,ls)+1.)) * &
+     &         ( 2.*tmp * qhcns(mgs) - tmp**2 * chcns(mgs)  )
+        ELSE
+         write(0,*) 'Value of imusnow not valid. Must be 3 (fix me for =1). imusnow = ',imusnow
+        STOP
+        ENDIF
+      ENDIF
+
+      IF ( qhcni(mgs) > 0.0 .and. chcni(mgs) > 0.0 .and. cx(mgs,li) > cxmin .and. vhcni(mgs) > 0 ) THEN
+        tmp = qx(mgs,li)/cx(mgs,li)
+        r = rho0(mgs)*qhcni(mgs)/vhcni(mgs) ! density of new graupel particles
+        zhcni(mgs) = 3.6476*rho0(mgs)**2*(alpha(mgs,li)+2.)/(r**2*(alpha(mgs,li)+1.)) * &
+     &         ( 2.*tmp * qhcni(mgs) - tmp**2 * chcni(mgs)  )
+      ENDIF
+ 
+
+      pzhwi(mgs) =   &
+     &  +ifrzg*ffrzh*(zrfrzf(mgs)   &
+     & +il5(mgs)*ifiacrg*(ziacrf(mgs) ) )   &
+!     : + zhcnsh(mgs) + zhcnih(mgs)   &
+     & + zhacw(mgs)   &
+     & + zhacr(mgs)   &
+     & + zhcnhl(mgs)  &
+     & + zhacs(mgs)   &
+     & + zhaci(mgs)   &
+     &  + f2h*zhcni(mgs) + f2h*zhcns(mgs) &
+     & + Max( 0.0, zhdsv(mgs) )
+
+      pzhwd(mgs) = 0.0   &
+     & + (1-il5(mgs))*zhmlr(mgs)   &
+     & + zhshr(mgs)   &
+!     >  + il5(mgs)*chsbv(mgs)   &
+     &  + Min( 0.0, zhdsv(mgs) )   &
+     &  - il5(mgs)*zhlcnh(mgs)
+
+
+           IF ( igs(mgs) == 44 .and. kgs(mgs) == 23 .or. dtp*( pqhwi(mgs) + pqhwd(mgs) ) > qxmin(lh) ) THEN
+!             write(0,*)  'i,k,time = ',igs(mgs),kgs(mgs),time_real
+!             write(0,*) 'pzhwi,d = ',pzhwi(mgs),pzhwd(mgs),dtp*( pzhwi(mgs) + pzhwd(mgs) ),zx(mgs,lh)
+!             write(0,*) 'pqhwi,d = ',pqhwi(mgs),pqhwd(mgs),dtp*( pqhwi(mgs) + pqhwd(mgs) ),qx(mgs,lh)
+!             write(0,*) 'pchwi,d = ',pchwi(mgs),pchwd(mgs),dtp*( pchwi(mgs) + pchwd(mgs) ),cx(mgs,lh)
+           ENDIF
+
+
+!        IF ( zhcnhl(mgs) < 0.0 ) THEN
+!          write(0,*) 'Problem with zhcnhl! zhcnhl,qhcnhl,chcnhl = ',zhcnhl(mgs),qhcnhl(mgs),chcnhl(mgs)
+!          write(0,*) 'g1,tmp = ',g1x(mgs,lhl),tmp
+!          write(0,*) ( 2.*( tmp ) * qhcnhl(mgs) - tmp**2 * chcnhl(mgs) )
+!          
+!!          STOP
+!        ENDIF
+      end do
+
+      if (ndebug .gt. 0 .and. my_rank>=0 ) write(0,*) my_rank, 'end graupel reflectivity'
+      
+      ENDIF
+
+!
+!  Hail reflectivity
+!
+
+      do mgs = 1,ngscnt
+      
+      zhldsv(mgs) = 0.0
+      zhlacr(mgs) = 0.0
+      zhlacw(mgs) = 0.0
+      
+      ENDDO
+
+      IF ( lzhl .gt. 1 .or. ( lzr > 1 .and. lnhl > 1 ) ) THEN ! also run for 2-moment hail for 3-moment rain sources
+
+      if (ndebug .gt. 0 .and. my_rank>=0 ) write(0,*) my_rank, 'hail reflectivity'
+
+      do mgs = 1,ngscnt
+      
+      IF ( qx(mgs,lhl) .gt. qxmin(lhl) .and. cx(mgs,lhl) .gt. 0.0 ) THEN
+          tmp = qx(mgs,lhl)/cx(mgs,lhl)
+          alp = Max( alphamin, alpha(mgs,lhl) )
+!          g1 = (6.0 + alp)*(5.0 + alp)*(4.0 + alp)/((3.0 + alp)*(2.0 + alp)*(1.0 + alp))
+          g1 = g1x(mgs,lhl) ! (6.0 + alp)*(5.0 + alp)*(4.0 + alp)/((3.0 + alp)*(2.0 + alp)*(1.0 + alp))
+        
+        IF ( .not. mixedphase .and. qhlmlr(mgs) /= 0.0 .and. chlmlr(mgs) /= 0.0 .and. ibinhlmlr < 1 ) THEN
+         zhlmlr(mgs) =  g1*(6.*rho0(mgs)/(pi*xdn(mgs,lhl)))**2*( 2.*tmp * qhlmlr(mgs) - tmp**2 * chlmlr(mgs)  )
+        ENDIF
+        
+        zhlshr(mgs) =  g1*(6.*rho0(mgs)/(pi*xdn(mgs,lhl)))**2*( 2.*tmp * qhlshr(mgs) - tmp**2 * chlshr(mgs)  )
+        IF ( lzr > 1 .and. qhlshr(mgs) /= 0.0 .and. chlshrr(mgs) /= 0.0 ) THEN
+         IF ( temg(mgs) >= tfr ) THEN
+ !           zhlshrr(mgs) =  g1*(6.*rho0(mgs)/(pi*xdn0(lr)))**2*( 2.*tmp * qhlshr(mgs) - tmp**2 * chlshrr(mgs)  )
+ !           IF ( zhlshrr(mgs) > 0.0 ) THEN
+ !             zhlshrr(mgs) =  g1*(6.*rho0(mgs)/(pi*xdn0(lr)))**2*( 2.*tmp * qhlshr(mgs) - tmp**2 * chlshr(mgs)  )
+ !           ENDIF
+           IF ( (shedalp + alpha(mgs,lhl))*xdia(mgs,lhl,1) < sheddiam ) THEN ! if not shedding small drops, then use alpha of hail
+             z1 = g1*(6.0*rho0(mgs)/(pi*xdn(mgs,lr)))**2*( qhlshr(mgs)**2/ chlshrr(mgs)  ) 
+           ELSE
+             z1 = g1shr*(6.0*rho0(mgs)/(pi*xdn(mgs,lr)))**2*( qhlshr(mgs)**2/ chlshrr(mgs)  ) ! should this be g1shr?
+           ENDIF
+           zhlshrr(mgs) = z1
+!           z1 = g1mlr*(rho0(mgs)/(xdn(mgs,lr)))**2*( qhlshr(mgs)**2/ chlshrr(mgs)  ) ! should this be g1shr?
+!           zhlshrr(mgs) = Max( z1, zhlshrr(mgs))
+         ELSE
+          zhlshrr(mgs) =  g1shr*(6.*rho0(mgs)/(pi*xdn(mgs,lr)))**2*( qhlshr(mgs)**2/ chlshrr(mgs)  )
+         ENDIF
+
+          zhlshrr(mgs) = Min( 0.0, zhlshrr(mgs) )
+        ENDIF
+
+        IF ( zhlshr(mgs) > 0.0 ) THEN
+          write(0,*) 'Problem with zhlshr! zhlshr,qhlshr,chlshr = ',zhlshr(mgs),qhlshr(mgs),chlshr(mgs)
+          write(0,*) 'g1,tmp, qx,cx,zx = ',g1,tmp,qx(mgs,lhl),cx(mgs,lhl),zx(mgs,lhl)
+          write(0,*) ( 2.*tmp * qhlshr(mgs) - tmp**2 * chlshr(mgs)  ),  2.*tmp * qhlshr(mgs), - tmp**2 * chlshr(mgs)
+          write(0,*) 'temcg = ',temcg(mgs),'chlshr recalc = ',(cx(mgs,lhl)/(qx(mgs,lhl)+1.e-20))*qhlshr(mgs)
+          
+          STOP
+        ENDIF
+!        zhlshr(mgs) = Min( 0.0, zhlshr(mgs) )
+
+!        zhlshr(mgs) =  (xdn0(lr)/(xdn(mgs,lhl)))**2*( zx(mgs,lhl) * qhlshr(mgs) )
+        
+        qtmp = qhldpv(mgs) + qhlcev(mgs)
+        ctmp = chldpv(mgs) + chlcev(mgs)
+        
+        zhldsv(mgs) = g1*(6.*rho0(mgs)/(pi*xdn(mgs,lhl)))**2*( 2.*( tmp ) * qtmp - tmp**2 * ctmp )
+
+          alp = Max( alphahacx, alpha(mgs,lhl) )
+!          g1 = (6.0 + alp)*(5.0 + alp)*(4.0 + alp)/((3.0 + alp)*(2.0 + alp)*(1.0 + alp))
+          g1 = g1x(mgs,lhl) ! (6.0 + alp)*(5.0 + alp)*(4.0 + alp)/((3.0 + alp)*(2.0 + alp)*(1.0 + alp))
+
+          IF ( .true. ) THEN ! {
+          IF ( qhlacr(mgs) .gt. 0.0 ) THEN
+!          z = g1*(6.*rho0(mgs)/(pi*1000.))**2*( (qx(mgs,lhl)+dtp*qhlacr(mgs))**2)/(cx(mgs,lhl))
+          zhlacr(mgs) =  g1*(6.*rho0(mgs)/(pi*xdn(mgs,lhl)))**2*( 2.*( tmp ) * qhlacr(mgs) )
+!          zhlacr(mgs) = Min( zxmxd(mgs,lr), zhlacr(mgs) )
+          
+!          IF ( z > zx(mgs,lhl) ) THEN
+!            zhlacr(mgs) = (z - zx(mgs,lhl))*dtpinv
+!          ELSE
+!            zhlacr(mgs) = 0.0
+!          ENDIF
+          ENDIF
+
+!        zhacr(mgs) =  g1*(6.*rho0(mgs)/(pi*1000.))**2*( 2.*( tmp ) * qhacr(mgs) )
+!        zhacr(mgs) =  g1*(6.*rho0(mgs)/(pi*1000.))**2*( 2.*( tmp ) * qhacr(mgs) - tmp**2 * chacr(mgs) )
+
+          IF ( qhlacw(mgs) .gt. 0.0 ) THEN
+          alp = Max( 3.0, alpha(mgs,lhl)+1. )
+          g1 = (6.0 + alp)*(5.0 + alp)*(4.0 + alp)/((3.0 + alp)*(2.0 + alp)*(1.0 + alp))
+          
+!          z = g1*(6.*rho0(mgs)/(pi*1000.))**2*( (qx(mgs,lhl)+dtp*(qhlacw(mgs)-qhlmul1(mgs)))**2)/(cx(mgs,lhl))
+!          zhlacw(mgs) =  g1*(6.*rho0(mgs)/(pi*1000.))**2*( 2.*( qx(mgs,lhl)/cx(mgs,lhl)) * qhlacw(mgs) )
+          zhlacw(mgs) =  g1*(6.*rho0(mgs)/(pi*xdn(mgs,lhl)))**2*( 2.*tmp * qhlacw(mgs) )
+
+!          IF ( z > zx(mgs,lhl) ) THEN
+!            zhlacw(mgs) = (z - zx(mgs,lhl))*dtpinv
+!          ENDIF
+          g1 = g1x(mgs,lhl) ! (6.0 + alp)*(5.0 + alp)*(4.0 + alp)/((3.0 + alp)*(2.0 + alp)*(1.0 + alp))
+          ENDIF
+          
+          ELSE ! }  .false. {
+
+          IF ( qhlacw(mgs) .gt. 0.0 .or. qhlacr(mgs) .gt. 0.0 ) THEN
+          z = g1*(6.*rho0(mgs)/(pi*1000.))**2*( (qx(mgs,lhl)+dtp*(qhlacr(mgs) + qhlacw(mgs)-qhlmul1(mgs)))**2)/(cx(mgs,lhl))
+!          zhlacw(mgs) =  g1*(6.*rho0(mgs)/(pi*1000.))**2*( 2.*( qx(mgs,lhl)/cx(mgs,lhl)) * qhlacw(mgs) )
+          IF ( z > zx(mgs,lhl) ) THEN
+            zhlacw(mgs) = (z - zx(mgs,lhl))*dtpinv
+          ENDIF
+          ENDIF
+          
+          ENDIF ! }
+        
+      ENDIF
+! qsplinter(mgs)
+      
+      IF ( lzhl > 1 ) THEN
+      pzhli(mgs) = ffrzh*(((1.0-ifrzg)*zrfrzf(mgs)   &
+     & +il5(mgs)*(1.0-ifiacrg)*ziacrf(mgs) )) &
+     &  + il5(mgs)*zhlcnh(mgs)   &
+     & + zhlacw(mgs)   &
+     & + zhlacr(mgs)   &
+!     : + zhlacs(mgs)   &
+     & + Max( 0.0, zhldsv(mgs) )
+
+      pzhld(mgs) = 0.0   &
+     & + (1-il5(mgs))*zhlmlr(mgs)   &
+     & + zhlshr(mgs)   &
+     & - zhcnhl(mgs)   &
+     &  + Min( 0.0, zhldsv(mgs) )
+      
+
+       IF ( .not. ( -1.0 < pzhli(mgs) .and. pzhli(mgs) < 1.e20 ) ) THEN
+         write(iunit,*) 'Problem with pzhli!'
+         write(iunit,*) 'zhlcnh,zhlacw,zhlacr,zhldsv = ',zhlcnh(mgs),zhlacw(mgs),zhlacr(mgs),zhldsv(mgs)
+       ENDIF
+
+       IF ( .not. ( -1.0e20 < pzhld(mgs) .and. pzhld(mgs) < 1. ) ) THEN
+         write(iunit,*) 'Problem with pzhld!'
+         write(iunit,*) 'zhlmlr,zhlshr,zhldsv = ',zhlmlr(mgs),zhlshr(mgs),zhldsv(mgs)
+       ENDIF
+       
+      ENDIF ! lzhl > 1
+      
+      end do
+      
+      ENDIF
+
+!
+!  rain reflectivity
+!
+      if (ndebug .gt. 0 ) write(0,*) 'WARMZIEG: dbg = 11'
+
+      IF ( lzr .gt. 1 ) THEN ! 
+       
+        DO mgs = 1,ngscnt
+        
+        zracw(mgs) = 0.0
+        zracr(mgs) = 0.0
+        zrcev(mgs) = 0.0
+        zrach(mgs) = 0.0
+        zrachl(mgs) = 0.0
+        zsshr(mgs) = 0.0
+        zsshrr(mgs) = 0.0
+        zsmlr(mgs) = 0.0
+        zsmlrr(mgs) = 0.0
+
+        IF ( qx(mgs,ls) .gt. qxmin(ls) .and. ( csmlr(mgs) /= 0.0 .or. csshr(mgs) /= 0.0 .or. &
+              csmlrr(mgs) /= 0.0 .or. csshrr(mgs) /= 0.0) ) THEN !{
+         tmp = qx(mgs,ls)/cx(mgs,ls)
+         g1 = 36.*(xnu(ls)+2.0)/((xnu(ls)+1.0)*pi**2)
+        IF ( .not. mixedphase ) THEN
+          zsmlr(mgs) =  (xdn(mgs,ls)/xdn(mgs,lr))**2*g1*(rho0(mgs)/(xdn(mgs,ls)))**2* &
+     &                 ( 2.*tmp * qsmlr(mgs) - tmp**2 * csmlr(mgs)  )
+
+          IF ( csmlrr(mgs) /= 0.0 ) THEN
+            z1 = g1smlr*(6.*rho0(mgs)/(pi*xdn(mgs,lr)))**2*( qsmlr(mgs)**2/ csmlrr(mgs)  )
+            zsmlrr(mgs) = z1
+          ENDIF
+        ENDIF
+        
+!        zsshr(mgs) =  (xdn(mgs,ls)/xdn(mgs,lr))**2*g1*(rho0(mgs)/(xdn(mgs,ls)))**2*  &
+!     &                 ( 2.*tmp * qsshr(mgs) - tmp**2 * csshr(mgs)  )
+
+         IF ( csshrr(mgs) /= 0.0 ) THEN
+          z1 = g1smlr*(6.*rho0(mgs)/(pi*xdn(mgs,lr)))**2*( qsshr(mgs)**2/ csshrr(mgs)  )
+          zsshrr(mgs) = z1
+         ENDIF
+        
+        ENDIF !}
+        
+        IF ( .not. mixedphase ) THEN !{
+          IF ( zhmlr(mgs) < 0.0 .and. chmlrr(mgs) /= 0.0 .and. ibinhmlr == 0 ) THEN !{
+          tmp = qx(mgs,lh)/cx(mgs,lh)
+!          zhmlrr(mgs) =  Min(0.0, (xdn(mgs,lh)/xdn(mgs,lr))**2 * &
+!     &       g1x(mgs,lh)*(6.*rho0(mgs)/(pi*xdn(mgs,lh)))**2*( 2.*tmp * qhmlr(mgs) - tmp**2 * chmlrr(mgs)  ) )
+            
+!            IF ( zhmlrr(mgs) >= 0. ) THEN
+!              zhmlrr(mgs) =  (xdn(mgs,lh)/xdn(mgs,lr))**2 * zhmlr(mgs)
+!            ENDIF
+           IF ( (shedalp + alpha(mgs,lh))*xdia(mgs,lh,1) < sheddiam ) THEN ! if not shedding small drops, then use alpha of graupel
+             z1 = g1x(mgs,lh)*(6.*rho0(mgs)/(pi*xdn(mgs,lr)))**2*( qhmlr(mgs)**2/ chmlrr(mgs)  ) 
+           ELSE ! assume drops are shed off, so use either alpha for shedding or graupel alpha, whichever gives the lower g-factor (i.e., larger alpha)
+             z1 = Min(g1x(mgs,lh),g1shr)*(6.*rho0(mgs)/(pi*xdn(mgs,lr)))**2*( qhmlr(mgs)**2/ chmlrr(mgs)  )
+           ENDIF
+           zhmlrr(mgs) = z1
+!           z1 = g1mlr*(rho0(mgs)/(xdn(mgs,lr)))**2*( qhmlr(mgs)**2/ chmlrr(mgs)  ) 
+!           zhmlrr(mgs) = Max( z1, zhmlrr(mgs))
+          ENDIF !}
+
+
+!          zhshrr(mgs) =  (xdn(mgs,lh)/xdn(mgs,lr))**2 * zhshr(mgs)
+
+         IF ( lhl > 1 .and. qhlmlr(mgs) /= 0 .and. ibinhlmlr == 0) THEN
+          tmp = qx(mgs,lhl)/cx(mgs,lhl)
+!          zhlmlrr(mgs) =  Min(0.0, (xdn(mgs,lhl)/xdn(mgs,lr))**2 * &
+!     &       g1x(mgs,lhl)*(6.*rho0(mgs)/(pi*xdn(mgs,lhl)))**2*( 2.*tmp * qhlmlr(mgs) - tmp**2 * chlmlrr(mgs)  ) )
+
+!          IF ( zhlmlrr(mgs) >= 0. ) THEN ! should be negative, if not, then use alternate calculation
+!           zhlmlrr(mgs) =  (xdn(mgs,lhl)/xdn(mgs,lr))**2 * zhlmlr(mgs)
+!          ENDIF
+
+           IF ( (shedalp + alpha(mgs,lhl))*xdia(mgs,lhl,1) < sheddiam ) THEN ! if not shedding small drops, then use alpha of hail
+             z1 = g1x(mgs,lhl)*(6.*rho0(mgs)/(pi*xdn(mgs,lr)))**2*( qhlmlr(mgs)**2/ chlmlrr(mgs)  ) 
+           ELSE ! assume drops are shed off, so use either alpha for shedding or graupel alpha, whichever gives the lower g-factor (i.e., larger alpha)
+             z1 = Min(g1x(mgs,lhl),g1shr)*(6.*rho0(mgs)/(pi*xdn(mgs,lr)))**2*( qhlmlr(mgs)**2/ chlmlrr(mgs)  )
+!             z1 = g1shr*(6.*rho0(mgs)/(pi*xdn(mgs,lr)))**2*( qhlmlr(mgs)**2/ chlmlrr(mgs)  )
+           ENDIF
+           zhlmlrr(mgs) = z1
+
+!           z1 = g1mlr*(rho0(mgs)/(xdn(mgs,lr)))**2*( qhlmlr(mgs)**2/ chlmlrr(mgs)  )
+!           zhlmlrr(mgs) = Max( z1, zhlmlrr(mgs))
+!         zhlmlr(mgs) =
+!          zhlshrr(mgs) =  (xdn(mgs,lhl)/xdn(mgs,lr))**2 * zhlshr(mgs)
+         ENDIF
+         
+         ENDIF ! }
+
+        IF ( qx(mgs,lr) .gt. qxmin(lr) .and. cx(mgs,lr) .gt. 0.0 ) THEN
+
+          tmp = qx(mgs,lr)/cx(mgs,lr)
+          g1 = g1x(mgs,lr) ! 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
+
+
+        IF ( qracw(mgs) > 0.0 .and. cx(mgs,lr) > 0.0 ) THEN
+         zracw(mgs) =  g1x(mgs,lr)*(6.*rho0(mgs)/(pi*1000.))**2*( 2.*tmp * qracw(mgs) )
+        ENDIF
+        
+        IF ( cracr(mgs) > 0.0 .and. cx(mgs,lr) > 0.0  ) THEN
+         zracr(mgs) =  g1x(mgs,lr)*(6.*rho0(mgs)/(pi*1000.))**2*( tmp**2 * cracr(mgs) )
+        ENDIF
+
+        qtmp = qrcev(mgs)
+        ctmp = crcev(mgs)
+        
+!        IF ( .false. .or. iferwisventr == 2 ) THEN
+!        zrcev(mgs) = Min(0.0, (12./(pii*xdn(mgs,lr)))*xdia(mgs,lr,1)**3*fvce(mgs)*rwcap(mgs)*rwventz(mgs) )
+!        ELSE
+        zrcev(mgs) = g1x(mgs,lr)*(6.*rho0(mgs)/(pi*xdn(mgs,lr)))**2*( 2.*( tmp ) * qtmp - tmp**2 * ctmp )
+
+        
+        IF (  iferwisventr == 2 ) THEN
+          vent1 = Min(0.0, (12./(pii*xdn(mgs,lr)))*xdia(mgs,lr,1)**3*fvce(mgs)*rwcap(mgs)*rwventz(mgs))
+          zrcev(mgs) = Max( zrcev(mgs), vent1 )
+        ENDIF
+!        IF ( ny == 2 .and. igs(mgs) == 20 ) THEN
+!          write(0,*) 'k,zrcevold,new,maxdep : ',kgs(mgs),zrcev(mgs),vent1,-zxmxd(mgs,lr),alpha(mgs,lr),cx(mgs,lr)
+!        ENDIF
+
+
+!        ENDIF
+        zrcev(mgs) = Max( zrcev(mgs), -zxmxd(mgs,lr) )
 
-      ELSEIF ( warmonly < 0.8 ) THEN
-!
-!  Graupel
-!
-      do mgs = 1,ngscnt
-      pqhwi(mgs) =    &
-     &  +il5(mgs)*ifrzg*(qrfrzf(mgs) )   &
-     &  +il5(mgs)*(qhdpv(mgs))   &
-     &  +qhacr(mgs)+qhacw(mgs)   
-      pqhwd(mgs) =     &
-     &   qhshr(mgs)                &    !null at this point when wet graupel included
-     &  - qhlcnh(mgs)   &
-     &  - qhmul1(mgs)   &
-     &  - qsplinter(mgs) - qsplinter2(mgs) &
-     &  +(1-il5(mgs))*qhmlr(mgs)        !null at this point when wet graupel included
-       end do
+        IF ( qhacr(mgs) > 0.0 ) THEN 
+          zrach(mgs) =  g1x(mgs,lr)*(6.*rho0(mgs)/(pi*xdn(mgs,lr)))**2* &
+     &     ( 2.*( qx(mgs,lr)/cx(mgs,lr)) * qhacr(mgs) - tmp**2 * chacr(mgs) )
+          zrach(mgs) = Min( zrach(mgs), zxmxd(mgs,lr) )
+         
+         ENDIF
 
-!
-!  Hail
-!
-      IF ( lhl .gt. 1 ) THEN
+        IF ( lhl > 1 .and. qhlacr(mgs) > 0.0 ) THEN 
+          zrachl(mgs) = g1x(mgs,lr)*(6.*rho0(mgs)/(pi*xdn(mgs,lr)))**2*   &
+     &     ( 2.*( qx(mgs,lr)/cx(mgs,lr)) * qhlacr(mgs) - tmp**2 * chlacr(mgs) )
+          zrachl(mgs) = Min( zrachl(mgs), zxmxd(mgs,lr) )
+         ENDIF
 
-      do mgs = 1,ngscnt
-      pqhli(mgs) =    &
-     &  +il5(mgs)*(qhldpv(mgs) ) & ! + (1.0-ifrzg)*(qiacrf(mgs)+qrfrzf(mgs)  + qracif(mgs)))   &
-     &  +il5(mgs)*(1.0-ifrzg)*(qrfrzf(mgs) )  &
-     &  +qhlacr(mgs)+qhlacw(mgs)   &
-!     &  +qhlacs(mgs)+qhlaci(mgs)   &
-     &  + qhlcnh(mgs)
-      pqhld(mgs) =     &
-     &   qhlshr(mgs)    &
-     &  +(1-il5(mgs))*qhlmlr(mgs)    &
-!     >  +il5(mgs)*qhlsbv(mgs)   &
-     &  + qhlsbv(mgs)   &
-     &  -qhlmul1(mgs) - qhcnhl(mgs)
 
-      end do
+        
+        ENDIF
 
-      ENDIF ! lhl
+         pzrwi(mgs) = zrcnw(mgs) + zracw(mgs) + zracr(mgs) &
+     &    + Max( 0.,zrcev(mgs) )  &
+     &  - (1-il5(mgs))*zsmlrr(mgs)   &
+     &  - zsshrr(mgs)   &
+     &  - (1-il5(mgs))*zhmlrr(mgs)   &
+     &  - zhshrr(mgs)   &
+     &  - (1-il5(mgs))*zhlmlrr(mgs)   &
+     &  - zhlshrr(mgs)   
 
-      ENDIF ! warmonly
 
-!
-!  Liquid water on snow and graupel
-!
+         pzrwd(mgs) = 0.0   &
+     &   +  Min(0.,zrcev(mgs) )  &
+     &    - zrach(mgs)  &
+     &    - zrachl(mgs)  &
+     &    - zrfrz(mgs)  &
+     &    - il5(mgs)*(ziacr(mgs) ) 
 
-      vhmlr(:) = 0.0
-      vhlmlr(:) = 0.0
-      vhfzh(:) = 0.0
-      vhlfzhl(:) = 0.0
 
-      IF ( mixedphase ) THEN
-      ELSE ! set arrays for non-mixedphase graupel
-      
-!        vhshdr(:) = 0.0
-        vhmlr(:) = qhmlr(:) ! not actually volume, but treated as q in rate equation
-!        vhsoak(:) = 0.0
+         IF ( zx(mgs,lr) + dtp*(pzrwi(mgs)+pzrwd(mgs))  <= 0.0  &
+              .and. qx(mgs,lr) > qxmin(lr) ) THEN
+           pzrwd(mgs) =  -zx(mgs,lr)*dtpinv - pzrwi(mgs)
+         ENDIF
 
-!        vhlshdr(:) = 0.0
-        vhlmlr(:) = qhlmlr(:) ! not actually volume, but treated as q in rate equation
-!        vhlmlr(:) = rho0(:)*qhlmlr(:)/xdn(:,lhl) 
-!        vhlsoak(:) = 0.0
+        ENDDO
 
-      ENDIF  ! mixedphase
+      ENDIF
 
 
 
@@ -18678,6 +21897,33 @@ subroutine nssl_2mom_gs   &
 !     >  + rho0(mgs)*qhshr(mgs)/xdn(mgs,lh) !xdn(mgs,lr)
 !      ENDIF
 
+       IF ( lzh > 1 .and. qx(mgs,lh) > qxmin(lh) ) THEN
+!       Calculate change in reflectivity due to density changes
+
+        xdn_new = rho0(mgs)*(qx(mgs,lh) + dtp*(pqhwi(mgs) + pqhwd(mgs) ))/   &
+     &   (vx(mgs,lh) + dtp*(pvhwi(mgs) + pvhwd(mgs))  )
+
+           IF ( mixedphase ) THEN 
+             IF ( qxw(mgs,lh) .gt. 0.0 ) THEN
+               dnmx = xdnmx(lr)
+             ELSE
+               dnmx = xdnmx(lh)
+             ENDIF
+           ELSE
+             dnmx = xdnmx(lh)
+           ENDIF
+
+        xdn_new = Max( Min( xdn_new, dnmx ), xdnmn(lh) )
+        
+        drhodt = (xdn_new - xdn(mgs,lh))*dtpinv
+        
+        zhwdn(mgs) = -2.*g1x(mgs,lh)*(rho0(mgs)*qx(mgs,lh)*6.*pii )**2/(cx(mgs,lh)*xdn(mgs,lh)**3)*drhodt
+        
+        pzhwi(mgs) = pzhwi(mgs) + Max(0.0, zhwdn(mgs))
+        pzhwd(mgs) = pzhwd(mgs) + Min(0.0, zhwdn(mgs))
+        
+       
+       ENDIF
       IF ( .false. .and. ny .eq. 2 .and. kgs(mgs) .eq. 9 .and. igs(mgs) .eq. 19 ) THEN
 
       write(iunit,*)
@@ -18760,6 +22006,32 @@ subroutine nssl_2mom_gs   &
      &   + rho0(mgs)*(1-il5(mgs))*vhlmlr(mgs)/xdn(mgs,lhl)  &
      &   + vhlshdr(mgs) - vhlsoak(mgs)
 
+       IF ( lzhl > 1 .and. qx(mgs,lhl) > qxmin(lhl) ) THEN
+!       Calculate change in reflectivity due to density changes
+
+        xdn_new = rho0(mgs)*(qx(mgs,lhl) + dtp*(pqhli(mgs) + pqhld(mgs) ))/   &
+     &   (vx(mgs,lhl) + dtp*(pvhli(mgs) + pvhld(mgs))  )
+        
+           IF ( mixedphase ) THEN 
+             IF ( qxw(mgs,lhl) .gt. 0.0 ) THEN
+               dnmx = xdnmx(lr)
+             ELSE
+               dnmx = xdnmx(lhl)
+             ENDIF
+           ELSE
+             dnmx = xdnmx(lhl)
+           ENDIF
+        xdn_new = Max( Min( xdn_new, dnmx ), xdnmn(lhl) )
+        
+        drhodt = (xdn_new - xdn(mgs,lhl))*dtpinv
+        
+        zhldn(mgs) = -2.*g1x(mgs,lhl)*(rho0(mgs)*qx(mgs,lhl)*6.*pii )**2/(cx(mgs,lhl)*xdn(mgs,lhl)**3)*drhodt
+        
+        pzhli(mgs) = pzhli(mgs) + Max(0.0, zhldn(mgs))
+        pzhld(mgs) = pzhld(mgs) + Min(0.0, zhldn(mgs))
+        
+       
+       ENDIF
 
       ENDDO
       
@@ -18989,7 +22261,7 @@ subroutine nssl_2mom_gs   &
       write(iunit,*)   -qracs(mgs)*(1-il2(mgs)) , qhacs(mgs) , qhlacs(mgs)   
       write(iunit,*)   -qhcns(mgs)   
       write(iunit,*)   +(1-il5(mgs))*qsmlr(mgs) , qsshr(mgs)     
-      write(iunit,*)   (qssbv(mgs))   
+      write(iunit,*)    qssbv(mgs)
       write(iunit,*)   Min(0.0, qscev(mgs))  
       write(iunit,*)   -qsmul(mgs)
 !
@@ -19061,33 +22333,37 @@ subroutine nssl_2mom_gs   &
       IF ( warmonly < 0.5 ) THEN
       pfrz(mgs) =    &
      &  (1-il5(mgs))*   &
-     &  (qhmlr(mgs)+qsmlr(mgs)+qhlmlr(mgs))   & !+qhmlh(mgs))   &
-     &  +il5(mgs)*(qhfzh(mgs)+qsfzs(mgs)+qhlfzhl(mgs))   &
+     &  (qhmlr(mgs)+    &
+     &   qsmlr(mgs)+qhlmlr(mgs))   & !+qhmlh(mgs))   &
      &  +il5(mgs)*(1-imixedphase)*(   &
      &   qsacw(mgs)+qhacw(mgs) + qhlacw(mgs)   &
      &  +qsacr(mgs)+qhacr(mgs) + qhlacr(mgs)   &
      &  +qsshr(mgs)   &
      &  +qhshr(mgs)   &
-     &  +qhlshr(mgs) +qrfrz(mgs)+qiacr(mgs)  &
+     &  +qhlshr(mgs)  &
+     &  +qrfrz(mgs)+qiacr(mgs)  &
      &  )  &
      &  +il5(mgs)*(qwfrz(mgs)    &
      &  +qwctfz(mgs)+qiihr(mgs)   &
      &  +qiacw(mgs))
       pmlt(mgs) =    &
      &  (1-il5(mgs))*   &
-     &  (qhmlr(mgs)+qsmlr(mgs)+qhlmlr(mgs))    !+qhmlh(mgs))   
+     &  (qhmlr(mgs)+qsmlr(mgs)+  &
+     &   qhlmlr(mgs))    !+qhmlh(mgs))   
       ! NOTE: psub is sum of sublimation and deposition
       psub(mgs) =    &
      &   il5(mgs)*(   &
      &  + qsdpv(mgs) + qhdpv(mgs)   &
      &  + qhldpv(mgs)    &
      &  + qidpv(mgs) + qisbv(mgs) )   &
-     &   + qssbv(mgs)  + qhsbv(mgs) + qhlsbv(mgs)   &
+     &   + qssbv(mgs)  + qhsbv(mgs) &
+     &  + qhlsbv(mgs)   &
      &  +il5(mgs)*(qiint(mgs))
       pvap(mgs) =    &
-     &   qrcev(mgs) + qhcev(mgs) + qscev(mgs) + qhlcev(mgs)
+     &   qrcev(mgs) + qhcev(mgs) + qscev(mgs) + qhlcev(mgs) + qfcev(mgs)
       pevap(mgs) =    &
-     &   Min(0.0,qrcev(mgs)) + Min(0.0,qhcev(mgs)) + Min(0.0,qscev(mgs)) + Min(0.0,qhlcev(mgs))
+     &   Min(0.0,qrcev(mgs)) + Min(0.0,qhcev(mgs)) + Min(0.0,qscev(mgs)) + Min(0.0,qhlcev(mgs)) &
+         +  Min(0.0,qfcev(mgs))
       ! NOTE: pdep is the deposition part only
       pdep(mgs) =    &
      &   il5(mgs)*(   &
@@ -19115,7 +22391,7 @@ subroutine nssl_2mom_gs   &
      &  + qidpv(mgs) + qisbv(mgs) )   &
      &  +il5(mgs)*(qiint(mgs))
       pvap(mgs) =    &
-     &   qrcev(mgs) + qhcev(mgs) + qhlcev(mgs) ! + qscev(mgs) 
+     &   qrcev(mgs) + qhcev(mgs) + qhlcev(mgs) + qfcev(mgs) 
       ELSE
       pfrz(mgs) = 0.0
       psub(mgs) = 0.0
@@ -19143,6 +22419,8 @@ subroutine nssl_2mom_gs   &
 !
 !
       do mgs = 1,ngscnt
+
+
       qwvp(mgs) = qwvp(mgs) +        &
      &   dtp*(pqwvi(mgs)+pqwvd(mgs))
       qx(mgs,lc) = qx(mgs,lc) +   &
@@ -19155,6 +22433,7 @@ subroutine nssl_2mom_gs   &
      &   dtp*(pqswi(mgs)+pqswd(mgs))
       qx(mgs,lh) = qx(mgs,lh) +    &
      &   dtp*(pqhwi(mgs)+pqhwd(mgs))
+
       IF ( lhl .gt. 1 ) THEN
       qx(mgs,lhl) = qx(mgs,lhl) +    &
      &   dtp*(pqhli(mgs)+pqhld(mgs))
@@ -19224,6 +22503,27 @@ subroutine nssl_2mom_gs   &
 
         
         
+       ENDIF
+      ENDIF
+      IF ( ipconc .ge. 6 ) THEN
+       IF ( lzr .gt. 1 ) THEN
+       zx(mgs,lr) = zx(mgs,lr) +    &
+     &   dtp*(pzrwi(mgs)+pzrwd(mgs))
+       ENDIF
+       IF ( lzs .gt. 1 ) THEN
+       zx(mgs,ls) = zx(mgs,ls) +    &
+     &   dtp*(pzswi(mgs)+pzswd(mgs))
+       ENDIF
+       IF ( lzh .gt. 1 ) THEN
+       zx(mgs,lh) = zx(mgs,lh) +    &
+     &   dtp*(pzhwi(mgs)+pzhwd(mgs))
+       ENDIF
+       IF ( lzhl .gt. 1 ) THEN
+        zx(mgs,lhl) = zx(mgs,lhl) +    &
+     &     dtp*(pzhli(mgs)+pzhld(mgs))
+!      IF ( pchli(mgs) .ne. 0. .or. pchld(mgs) .ne. 0 ) THEN
+!       write(0,*) 'dr: cx,pchli,pchld = ', cx(mgs,lhl),pchli(mgs),pchld(mgs), igs(mgs),kgs(mgs)
+!      ENDIF
        ENDIF
       ENDIF
       end do
@@ -19775,6 +23075,29 @@ subroutine nssl_2mom_gs   &
       ENDIF
 
 
+
+
+
+!
+!  6th moments
+!
+
+      IF ( ipconc .ge. 6 ) THEN
+       DO il = lr,lhab
+        IF ( lz(il) .gt. 1 ) THEN
+        IF ( lf > 1 .and. il == lf ) THEN 
+           lfsave(mgs,3) = an(igs(mgs),jy,kgs(mgs),lz(il))
+           lfsave(mgs,4) = zx(mgs,il)
+        ENDIF
+
+         an(igs(mgs),jy,kgs(mgs),lz(il)) = zx(mgs,il) +   &
+     &     min( an(igs(mgs),jy,kgs(mgs),lz(il)), 0.0 )
+         zx(mgs,il) = an(igs(mgs),jy,kgs(mgs),lz(il))
+         
+        ENDIF
+       ENDDO
+       
+      ENDIF
 !
       end do
 !
@@ -19839,6 +23162,447 @@ subroutine nssl_2mom_gs   &
             ENDIF !}
            ENDDO ! mgs
           
+          ELSE ! } { is three-moment, so have to adjust Z if size is too large
+           IF ( il == lr .and. imurain == 3 ) THEN ! { { RAIN
+
+!          rdmx = 
+!          rdmn = 
+
+          DO mgs = 1,ngscnt
+          
+
+         IF ( iresetmoments == 1 .or. iresetmoments == il  ) THEN
+         IF ( zx(mgs,lr) <= zxmin ) THEN
+           qx(mgs,lv) = qx(mgs,lv) + qx(mgs,il)
+           qx(mgs,lr) = 0.0
+           cx(mgs,lr) = 0.0
+           an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),lr)
+           an(igs(mgs),jgs,kgs(mgs),lr) = qx(mgs,lr)
+           an(igs(mgs),jgs,kgs(mgs),ln(lr)) = cx(mgs,lr)
+         ELSEIF ( cx(mgs,lr) <= cxmin ) THEN
+           qx(mgs,lv) = qx(mgs,lv) + qx(mgs,il)
+           zx(mgs,lr) = 0.0
+           qx(mgs,lr) = 0.0
+           an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),lr)
+           an(igs(mgs),jgs,kgs(mgs),lr) = qx(mgs,lr)
+           an(igs(mgs),jgs,kgs(mgs),lz(lr)) = zx(mgs,lr)
+         ENDIF
+         ENDIF
+         
+         IF ( qx(mgs,lr) .gt. qxmin(lr) ) THEN
+
+        xv(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(xdn(mgs,lr)*Max(1.0e-11,cx(mgs,lr)))
+        IF ( xv(mgs,lr) .gt. xvmx(lr) ) THEN
+!          xv(mgs,lr) = xvmx(lr)
+!          cx(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(xvmx(lr)*xdn(mgs,lr))
+        ELSEIF ( xv(mgs,lr) .lt. xvmn(lr) ) THEN
+          xv(mgs,lr) = xvmn(lr)
+          cx(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(xvmn(lr)*xdn(mgs,lr))
+        ENDIF
+
+          IF ( zx(mgs,il) > 0.0 .and. cx(mgs,il) <= 0.0 ) THEN
+!  have mass and reflectivity but no concentration, so set concentration, using default alpha
+            g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
+            z   = zx(mgs,il)
+            qr  = qx(mgs,il)
+            cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/(z*xdn(mgs,lr)**2)
+!            an(igs(mgs),jgs,kgs(mgs),ln(il)) = zx(mgs,il)
+           ELSEIF ( zx(mgs,il) <= 0.0 .and. cx(mgs,il) > 0.0 ) THEN
+!  have mass and concentration but no reflectivity, so set reflectivity, using default alpha
+            g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
+            chw = cx(mgs,il)
+            qr  = qx(mgs,il)
+            zx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/(xdn(mgs,lr)**2*chw)
+            an(igs(mgs),jgs,kgs(mgs),lz(lr)) = zx(mgs,lr)
+
+           ELSEIF ( zx(mgs,il) <= 0.0 .and. cx(mgs,il) <= 0.0 ) THEN
+!   How did this happen?
+         ! set values according to dBZ of -10, or Z = 0.1
+!              0.1 = 1.e18*0.224*an(ix,jy,kz,lzh)*(hwdn/rwdn)**2
+               zx(mgs,il) = 1.e-19/0.224*(xdn0(lr)/xdn0(il))**2
+               an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
+               
+            g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
+               z   = zx(mgs,il)
+               qr  = qx(mgs,il)
+               cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/(z*1000.*1000)
+               an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
+          ENDIF
+        
+          IF ( zx(mgs,lr) > 0.0 ) THEN
+            xv(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(1000.*cx(mgs,lr))
+            vr = xv(mgs,lr)
+!            z = 36.*(alpha(kz)+2.0)*a(ix,jy,kz,lnr)*vr**2/((alpha(kz)+1.0)*pi**2)
+           qr = qx(mgs,lr)
+           nrx = cx(mgs,lr)
+           z = zx(mgs,lr)
+
+!           xv = (db(1,kz)*a(1,1,kz,lr))**2/(a(1,1,kz,lnr))
+!           rd = z*(pi/6.*1000.)**2/xv
+
+! determine shape parameter alpha by iteration
+           IF ( z .gt. 0.0 ) THEN
+!           alpha(mgs,lr) = 3.
+           alp = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/(z*pi**2) - 1.
+!           write(0,*) 'kz, alp, alpha(kz) = ',kz,alp,alpha(kz),rd,z,xv
+           DO i = 1,20
+            IF ( Abs(alp - alpha(mgs,lr)) .lt. 0.01 ) EXIT
+             alpha(mgs,lr) = Max( rnumin, Min( rnumax, alp ) )
+           alp = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/(z*pi**2) - 1.
+             alp = Max( rnumin, Min( rnumax, alp ) )
+           ENDDO
+
+! check for artificial breakup (rain larger than allowed max size)
+        IF (  xv(mgs,il) .gt. xvmx(il) .or. (ioldlimiter == 2 .and. xv(mgs,il) .gt. xvmx(il)/8.) ) THEN
+          tmp = cx(mgs,il)
+!            write(0,*) 'MY limiter: xv: ',xv(mgs,il), xv(mgs,il)/(xvmx(il)/8.)
+!            STOP
+          IF ( ioldlimiter == 2 ) THEN ! MY-style active breakup
+            x = (6.*rho0(mgs)*qx(mgs,il)/(pi*xdn(mgs,il)*cx(mgs,il)))**(1./3.)
+            x1 = Max(0.0e-3, x - 3.0e-3)
+            x2 = Max(0.5, x/6.0e-3)
+            x3 = x2**3
+            cx(mgs,il) = cx(mgs,il)*Max((1.+2.222e3*x1**2), x3)
+            xv(mgs,il) = xv(mgs,il)/Max((1.+2.222e3*x1**2), x3)
+          ELSE ! simple cutoff 
+            xv(mgs,il) = Min( xvmx(il), Max( xvmn(il),xv(mgs,il) ) )
+            xmas(mgs,il) = xv(mgs,il)*xdn(mgs,il)
+            cx(mgs,il) = rho0(mgs)*qx(mgs,il)/(xmas(mgs,il))
+          ENDIF
+            !xmas(mgs,il) = xv(mgs,il)*xdn(mgs,il)
+            !cx(mgs,il) = rho0(mgs)*qx(mgs,il)/(xmas(mgs,il))
+          
+          
+          IF ( tmp < cx(mgs,il) ) THEN ! breakup
+
+            g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
+            zx(mgs,il) = zx(mgs,il) + g1*(rho0(mgs)/xdn(mgs,il))**2*( (qx(mgs,il)/tmp)**2 * (tmp-cx(mgs,il)) )
+            an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
+
+           vr = xv(mgs,lr)
+           qr = qx(mgs,lr)
+           nrx = cx(mgs,lr)
+           z = zx(mgs,lr)
+
+
+! determine shape parameter alpha by iteration
+           alp = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/(z*pi**2) - 1.
+           DO i = 1,20
+            IF ( Abs(alp - alpha(mgs,lr)) .lt. 0.01 ) EXIT
+             alpha(mgs,lr) = Max( rnumin, Min( rnumax, alp ) )
+           alp = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/(z*pi**2) - 1.
+             alp = Max( rnumin, Min( rnumax, alp ) )
+           ENDDO
+
+            
+          ENDIF
+        ENDIF
+
+!
+! Check whether the shape parameter is at or less than the minimum, and if it is, reset the 
+! concentration or reflectivity to match (prevents reflectivity from being out of balance with Q and N)
+!
+              g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
+           IF ( .true. .and. (alpha(mgs,il) <= rnumin .or. alp == rnumin .or. alp == rnumax) ) THEN
+
+            IF ( rescale_high_alpha .and. alp >= rnumax - 0.01  ) THEN  ! reset c at high alpha to prevent growth in Z
+              cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/z*(1./(xdn(mgs,il)))**2
+              an(igs(mgs),jy,kgs(mgs),ln(il)) = cx(mgs,il)
+            
+            ELSEIF ( rescale_low_alphar .and. alp <= rnumin ) THEN
+             z  = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/((alpha(mgs,lr)+1.0)*pi**2)
+             zx(mgs,il) = z
+             an(igs(mgs),jy,kgs(mgs),lz(il)) = zx(mgs,il)
+            ENDIF
+           ENDIF
+           
+
+           
+           ENDIF
+          ENDIF
+          
+          ENDIF
+          
+          ENDDO
+!        CALL cld_cpu('Z-MOMENT-1r')  
+           
+           
+           ELSEIF ( il == lh .or. il == lhl .or. il == lf .or. (il == lr .and. imurain == 1 )) THEN ! } { Rain, GRAUPEL OR HAIL
+
+        
+        
+        DO mgs = 1,ngscnt
+
+        IF ( lf > 1 .and. il == lf ) THEN 
+           lfsave(mgs,5) = an(igs(mgs),jy,kgs(mgs),ln(il))
+           lfsave(mgs,6) = cx(mgs,il)
+        ENDIF
+        
+        IF ( il == lhl .and. lnhlf > 1 ) THEN
+          IF ( cx(mgs,lhl) > cxmin ) THEN
+            frac = chxf(mgs,lhl)/cx(mgs,lhl)
+          ELSE
+            frac = 0.0
+          ENDIF
+        ENDIF
+
+        IF ( il == lh .and. lnhf > 1 ) THEN
+          IF ( cx(mgs,lh) > cxmin ) THEN
+            frach = chxf(mgs,lh)/cx(mgs,lh)
+          ELSE
+            frach = 0.0
+          ENDIF
+        ENDIF
+
+
+
+         IF ( iresetmoments == 1 .or. iresetmoments == il .or. iresetmoments == -1  ) THEN ! { .or. qx(mgs,il) <= qxmin(il) 
+         IF ( zx(mgs,il) <= zxmin ) THEN !  .and. qx(mgs,il) > 0.05e-3 
+!!            write(91,*) 'zx=0; qx,cx = ',1000.*qx(mgs,il),cx(mgs,il)
+           qx(mgs,il) = 0.0
+           cx(mgs,il) = 0.0
+           an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),il)
+           an(igs(mgs),jgs,kgs(mgs),il) = qx(mgs,il)
+           an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
+         ELSEIF ( iresetmoments == -1 .and. qx(mgs,il) < qxmin(il) ) THEN
+           zx(mgs,il) = 0.0
+           cx(mgs,il) = 0.0
+           an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),il)
+
+           qx(mgs,il) = 0.0
+           an(igs(mgs),jgs,kgs(mgs),il) = qx(mgs,il)
+           an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
+           an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
+         
+         ELSEIF ( cx(mgs,il) <= cxmin .and. iresetmoments /= -1 ) THEN !  .and. qx(mgs,il) > 0.05e-3  
+           qx(mgs,lv) = qx(mgs,lv) + qx(mgs,il)
+           zx(mgs,il) = 0.0
+           qx(mgs,il) = 0.0
+           an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),il)
+           an(igs(mgs),jgs,kgs(mgs),il) = qx(mgs,il)
+           an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
+         ENDIF
+         ELSE
+            IF ( zx(mgs,il) < 0.0 ) THEN !  .and. qx(mgs,il) > 0.05e-3 
+               zx(mgs,il) = 0.0
+             ENDIF
+         ENDIF !}
+
+
+         IF (  zx(mgs,il) <= zxmin .and. cx(mgs,il) <= cxmin ) THEN
+           zx(mgs,il) = 0.0
+           cx(mgs,il) = 0.0
+           an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),il)
+           qx(mgs,il) = 0.0
+           an(igs(mgs),jgs,kgs(mgs),il) = qx(mgs,il)
+           an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
+           an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
+         ENDIF
+        
+        IF ( qx(mgs,il) .gt. qxmin(il) ) THEN !{
+
+        xv(mgs,il) = rho0(mgs)*qx(mgs,il)/(xdn(mgs,il)*Max(1.0e-9,cx(mgs,il)))
+        xmas(mgs,il) = xv(mgs,il)*xdn(mgs,il)
+
+        IF ( xv(mgs,il) .lt. xvmn(il) ) THEN
+          xv(mgs,il) = Min( xvmx(il), Max( xvmn(il),xv(mgs,il) ) )
+          xmas(mgs,il) = xv(mgs,il)*xdn(mgs,il)
+          cx(mgs,il) = rho0(mgs)*qx(mgs,il)/(xmas(mgs,il))
+        ENDIF
+
+          IF ( zx(mgs,il) > 0.0 .and. cx(mgs,il) <= 0.0 ) THEN !{
+!  have mass and reflectivity but no concentration, so set concentration, using default alpha
+            g1 = (6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
+     &            ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il)))
+            z   = zx(mgs,il)
+            qr  = qx(mgs,il)
+!            cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/z
+            cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(6.*qr)**2/(z*(pi*xdn(mgs,il))**2)
+
+
+           ELSEIF ( zx(mgs,il) <= 0.0 .and. cx(mgs,il) > 0.0 ) THEN
+!  have mass and concentration but no reflectivity, so set reflectivity, using default alpha
+!            g1 = (6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
+!     &            ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il)))
+            chw = cx(mgs,il)
+            qr  = qx(mgs,il)
+!            zx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/chw
+!            zx(mgs,il) = Min(zxmin*1.1, g1*dn(igs(mgs),jy,kgs(mgs))**2*(6.*qr)**2/(chw*(pi*xdn(mgs,il))**2) )
+            g1 = (6.0 + alphamax)*(5.0 + alphamax)*(4.0 + alphamax)/ &
+     &            ((3.0 + alphamax)*(2.0 + alphamax)*(1.0 + alphamax))
+            zx(mgs,il) = Max(zxmin*1.1, g1*dn(igs(mgs),jy,kgs(mgs))**2*(6*qr)**2/(chw*(pi*xdn(mgs,il))**2) )
+            an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
+
+           ELSEIF ( zx(mgs,il) <= 0.0 .and. cx(mgs,il) <= 0.0 ) THEN
+!   How did this happen?
+         ! set values according to dBZ of -10, or Z = 0.1
+!              0.1 = 1.e18*0.224*an(ix,jy,kz,lzh)*(hwdn/rwdn)**2
+
+!               write(0,*) 'GS: moment problem! il,c,z,q = ',il,cx(mgs,il),zx(mgs,il),qx(mgs,il)
+               
+               zx(mgs,il) = 1.e-19/0.224*(xdn0(lr)/xdn0(il))**2
+               an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
+               
+               g1 = (6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
+     &            ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il)))
+               z   = zx(mgs,il)
+               qr  = qx(mgs,il)
+!               cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/z
+               cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(6.*qr)**2/(z*(pi*xdn(mgs,il))**2)
+               an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
+               
+!               write(0,*) 'GS: moment problem! reset il,c,z,q = ',il,cx(mgs,il),zx(mgs,il),qx(mgs,il)
+               
+           ELSE
+          ! have all valid moments, so find shape parameter
+          chw = cx(mgs,il)
+          qr  = qx(mgs,il)
+          z   = zx(mgs,il)
+
+          IF ( zx(mgs,il) .gt. 0. ) THEN !{
+           
+!            rdi = z*(pi/6.*1000.)**2*chw/((rho0(mgs)*qr)**2)
+            rdi = z*(pi/6.*xdn(mgs,il))**2*chw/((rho0(mgs)*qr)**2)
+
+!           alp = 1.e18*(6.+alpha(mgs,il))*(5.0+alpha(mgs,il))*(4.0+alpha(mgs,il))/
+!     :            ((3.0+alpha(mgs,il))*(2.0+alpha(mgs,il))*rdi) - 1.0
+           alp = (6.0+alpha(mgs,il))*(5.0+alpha(mgs,il))*(4.0+alpha(mgs,il))/   &
+     &            ((3.0+alpha(mgs,il))*(2.0+alpha(mgs,il))*rdi) - 1.0
+!           print*,'kz, alp, alpha(mgs,il) = ',kz,alp,alpha(mgs,il),rdi,z,xv
+           DO i = 1,10
+!            IF ( 100.*Abs(alp - alpha(mgs,il))/(Abs(alpha(mgs,il))+1.e-5) .lt. 1. ) EXIT
+             IF ( Abs(alp - alpha(mgs,il)) .lt. 0.01 ) EXIT
+             alpha(mgs,il) = Max( alphamin, Min( alphamax, alp ) )
+!             alp = 1.e18*(6.+alpha(mgs,il))*(5.0+alpha(mgs,il))*(4.0+alpha(mgs,il))/
+!     :            ((3.0+alpha(mgs,il))*(2.0+alpha(mgs,il))*rdi) - 1.0
+             alp = (6.+alpha(mgs,il))*(5.0+alpha(mgs,il))*(4.0+alpha(mgs,il))/   &
+     &            ((3.0+alpha(mgs,il))*(2.0+alpha(mgs,il))*rdi) - 1.0
+!           print*,'i,alp = ',i,alp
+             alp = Max( alphamin, Min( alphamax, alp ) )
+           ENDDO
+
+
+! check for artificial breakup (graupel/hail larger than allowed max size)
+        IF (  xv(mgs,il) .gt. xvmx(il) ) THEN !{
+          tmp = cx(mgs,il)
+
+
+          xv(mgs,il) = Min( xvmx(il), Max( xvmn(il),xv(mgs,il) ) )
+          xmas(mgs,il) = xv(mgs,il)*xdn(mgs,il)
+          cx(mgs,il) = rho0(mgs)*qx(mgs,il)/(xmas(mgs,il))
+          IF ( tmp < cx(mgs,il) ) THEN ! breakup
+            g1 = 36.*(6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
+     &            ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il))*pi**2)
+             zx(mgs,il) = zx(mgs,il) + g1*(rho0(mgs)/xdn(mgs,il))**2*( (qx(mgs,il)/tmp)**2 * (tmp-cx(mgs,il)) )
+             an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
+
+          chw = cx(mgs,il)
+          qr  = qx(mgs,il)
+          z   = zx(mgs,il)
+
+            rdi = z*(pi/6.*xdn(mgs,il))**2*chw/((rho0(mgs)*qr)**2)
+            alp = (6.0+alpha(mgs,il))*(5.0+alpha(mgs,il))*(4.0+alpha(mgs,il))/   &
+     &            ((3.0+alpha(mgs,il))*(2.0+alpha(mgs,il))*rdi) - 1.0
+           DO i = 1,10
+             IF ( Abs(alp - alpha(mgs,il)) .lt. 0.01 ) EXIT
+             alpha(mgs,il) = Max( alphamin, Min( alphamax, alp ) )
+             alp = (6.+alpha(mgs,il))*(5.0+alpha(mgs,il))*(4.0+alpha(mgs,il))/   &
+     &            ((3.0+alpha(mgs,il))*(2.0+alpha(mgs,il))*rdi) - 1.0
+             alp = Max( alphamin, Min( alphamax, alp ) )
+           ENDDO
+
+            
+          ENDIF
+        ENDIF !}
+
+!
+! Check whether the shape parameter is at or less than the minimum, and if it is, reset the 
+! concentration or reflectivity to match (prevents reflectivity from being out of balance with Q and N)
+!
+             g1 = (6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
+     &            ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il)))
+ 
+           IF ( ( lrescalelow(il) .or. rescale_high_alpha ) .and.  &
+     &          ( alpha(mgs,il) <= alphamin .or. alp == alphamin .or. alp == alphamax ) ) THEN !{
+
+            IF ( rescale_high_alpha .and. alp >= alphamax - 0.01  ) THEN  ! reset c at high alpha to prevent growth in Z
+              cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/z*(6./(pi*xdn(mgs,il)))**2
+              an(igs(mgs),jy,kgs(mgs),ln(il)) = cx(mgs,il)
+            
+            ELSEIF ( lrescalelow(il) .and. alp <= alphamin .and. .not. (il == lh .and. icvhl2h > 0 ) .and. &
+                     .not. ( il == lr .and. .not. rescale_low_alphar ) ) THEN ! alpha = alphamin, so reset Z to prevent growth in C
+             
+             wtest = .false.
+             IF ( irescalerainopt == 0 ) THEN
+               wtest = .false.
+             ELSEIF ( irescalerainopt == 1 ) THEN
+               wtest = qx(mgs,lc) > qxmin(lc) 
+             ELSEIF ( irescalerainopt == 2 ) THEN
+               wtest = qx(mgs,lc) > qxmin(lc) .and. wvel(mgs) < rescale_wthresh
+             ELSEIF ( irescalerainopt == 3 ) THEN
+               wtest = temcg(mgs) > rescale_tempthresh .and. qx(mgs,lc) > qxmin(lc) .and. wvel(mgs) < rescale_wthresh
+             ENDIF
+             
+             IF ( il == lr .and. ( wtest .or. .not. rescale_low_alphar ) ) THEN
+             ! certain situations where rain number is adjusted instead of Z. Helps avoid rain being 'zapped' by autoconverted 
+             ! drops (i.e., favor preserving Z when alpha tries to go negative)
+             chw = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/z*(6./(pi*xdn(mgs,il)))**2 ! g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/z1
+             cx(mgs,il) = chw
+             an(igs(mgs),jy,kgs(mgs),ln(il)) = chw
+             ELSE
+             ! Usual resetting of reflectivity moment to force consisntency between Q, N, Z, and alpha when alpha = alphamin
+             z1 = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/chw
+             z  = z1*(6./(pi*xdn(mgs,il)))**2
+             zx(mgs,il) = z
+             an(igs(mgs),jy,kgs(mgs),lz(il)) = z
+             ENDIF
+
+!             z1 = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/chw
+!             z  = z1*(6./(pi*xdn(mgs,il)))**2
+!             zx(mgs,il) = z
+!             an(igs(mgs),jy,kgs(mgs),lz(il)) = z
+            ENDIF
+
+           ENDIF !}
+          
+          
+           ENDIF !}
+          
+           
+           ENDIF ! !}
+ 
+          
+          
+          ENDIF !}
+
+        IF ( il == lhl .and. lnhlf > 1 ) THEN
+        ! update chxf in case cx has changed
+          chxf(mgs,lhl) = frac*cx(mgs,lhl)
+        ENDIF
+        IF ( il == lh .and. lnhf > 1 ) THEN
+        ! update chxf in case cx has changed
+          chxf(mgs,lh) = frach*cx(mgs,lh)
+        ENDIF
+
+
+!      IF ( lf > 0 .and. il == lf .and. kgs(mgs) <= 20 .and. ( cx(mgs,lf) + dtp*( pcfwi(mgs) + pcfwd(mgs) ) > 200. .or. cx(mgs,lf) > 400. )) THEN
+!        write(0,*) 'ix,jy, kz, cf = ',igs(mgs)+ixbeg,jy+jybeg,kgs(mgs), an(igs(mgs),jy,kgs(mgs),ln(lf)),lfsave(mgs,5),lfsave(mgs,6)
+!        write(0,*) 'qold,qxold,zold,zxold = ',lfsave(mgs,1),lfsave(mgs,2),lfsave(mgs,3),lfsave(mgs,4)
+!        write(0,*) 'cf_new,pcfwi,pcfwd = ',cx(mgs,lf),cx(mgs,lf) + dtp*( pcfwi(mgs) + pcfwd(mgs) ),pcfwi(mgs) + pcfwd(mgs)
+!      
+!      ENDIF
+        
+        ENDDO ! mgs
+
+!         CALL cld_cpu('Z-DELABK')  
+        
+
+!         CALL cld_cpu('Z-DELABK')  
+        
+        
+ 
+           
+           ENDIF ! } }
           
           ENDIF ! }}
           ENDIF ! }
diff --git a/physics/mp_nssl.F90 b/physics/mp_nssl.F90
index 4e0e323ce..9c7951542 100644
--- a/physics/mp_nssl.F90
+++ b/physics/mp_nssl.F90
@@ -32,7 +32,7 @@ subroutine mp_nssl_init(ncol, nlev, errflg, errmsg, threads, restart, &
                               imp_physics, imp_physics_nssl,  &
                               nssl_cccn, nssl_alphah, nssl_alphahl, &
                               nssl_alphar, nssl_ehw0_in, nssl_ehlw0_in,   &
-                              nssl_ccn_on, nssl_hail_on, nssl_invertccn ) 
+                              nssl_ccn_on, nssl_hail_on, nssl_invertccn, nssl_3moment ) 
                               
 
         use module_mp_nssl_2mom, only: nssl_2mom_init, nssl_2mom_init_const
@@ -54,12 +54,12 @@ subroutine mp_nssl_init(ncol, nlev, errflg, errmsg, threads, restart, &
          integer,                   intent(in)    :: imp_physics_nssl
          real(kind_phys),           intent(in)    :: nssl_cccn, nssl_alphah, nssl_alphahl
          real(kind_phys),           intent(in)    :: nssl_alphar, nssl_ehw0_in, nssl_ehlw0_in 
-         logical,                   intent(in)    :: nssl_ccn_on, nssl_hail_on, nssl_invertccn
+         logical,                   intent(in)    :: nssl_ccn_on, nssl_hail_on, nssl_invertccn, nssl_3moment
 
          ! Local variables: dimensions used in nssl_init
          integer               :: ims,ime, jms,jme, kms,kme, nx, nz, i,k
          real :: nssl_params(20)
-         integer :: ihailv
+         integer :: ihailv,ipc
          
 
  ! Initialize the CCPP error handling variables
@@ -104,9 +104,9 @@ subroutine mp_nssl_init(ncol, nlev, errflg, errmsg, threads, restart, &
 
 
          nssl_params(:) = 0.0
-         nssl_params(1)  = nssl_cccn
-         nssl_params(2)  = nssl_alphah
-         nssl_params(3)  = nssl_alphahl
+       !  nssl_params(1)  = nssl_cccn    ! use direct interface instead
+       !  nssl_params(2)  = nssl_alphah  ! use direct interface instead
+       !  nssl_params(3)  = nssl_alphahl ! use direct interface instead
          nssl_params(4)  = 4.e5 ! nssl_cnoh -- not used for 2-moment
          nssl_params(5)  = 4.e4 ! nssl_cnohl-- not used for 2-moment
          nssl_params(6)  = 4.e5 ! nssl_cnor-- not used for 2-moment
@@ -114,10 +114,6 @@ subroutine mp_nssl_init(ncol, nlev, errflg, errmsg, threads, restart, &
          nssl_params(8)  = 500. ! nssl_rho_qh
          nssl_params(9)  = 800. ! nssl_rho_qhl
          nssl_params(10) = 100. ! nssl_rho_qs
-         nssl_params(11) = 0 ! nssl_ipelec_tmp
-         nssl_params(12) = 11 ! nssl_isaund
-         nssl_params(13) = 0 ! 1= turn on cccna; 0 = turn off
-         nssl_params(14)  = nssl_alphar
          
          nssl_qccn = nssl_cccn/1.225
       !   if (mpirank==mpiroot) then
@@ -129,10 +125,21 @@ subroutine mp_nssl_init(ncol, nlev, errflg, errmsg, threads, restart, &
          ELSE
            ihailv = -1
          ENDIF
+         
+         IF ( nssl_3moment ) THEN
+           ipc = 8
+         ELSE
+           ipc = 5
+         ENDIF
 
 !           write(0,*) 'call nssl_2mom_init'
-         CALL nssl_2mom_init(ims,ime, jms,jme, kms,kme,nssl_params,ipctmp=5,mixphase=0, &
-                ihvol=ihailv,nssl_ehw0=nssl_ehw0_in,nssl_ehlw0=nssl_ehlw0_in,errmsg=errmsg,errflg=errflg,myrank=mpirank,mpiroot=mpiroot)
+         CALL nssl_2mom_init(ims,ime, jms,jme, kms,kme,nssl_params,ipctmp=ipc,mixphase=0,   &
+                ihvol=ihailv,nssl_ehw0=nssl_ehw0_in,nssl_ehlw0=nssl_ehlw0_in,errmsg=errmsg, &
+                nssl_alphar=nssl_alphar,                                                    &
+                nssl_alphah=nssl_alphah,                                                    &
+                nssl_alphahl=nssl_alphahl,                                                  &
+                nssl_cccn=nssl_cccn,                                                        &
+                errflg=errflg,myrank=mpirank,mpiroot=mpiroot)
 
          ! For restart runs, the init is done here
          if (restart) then
@@ -161,6 +168,7 @@ subroutine mp_nssl_run(ncol, nlev, con_g, con_rd, mpirank, &
 !                             spechum, cccn, qc, qr, qi, qs, qh, qhl,         &
                              spechum, cccn, cccna, qc, qr, qi, qs, qh, qhl,         &
                              ccw, crw, cci, csw, chw, chl, vh, vhl,          &
+                             zrw, zhw, zhl,                                  &
                               tgrs, prslk, prsl, phii, omega, dtp,           &
                               prcp, rain, graupel, ice, snow, sr,            &
                              refl_10cm, do_radar_ref, first_time_step, restart, &
@@ -168,7 +176,8 @@ subroutine mp_nssl_run(ncol, nlev, con_g, con_rd, mpirank, &
                              nleffr, nieffr, nseffr, nreffr,                 &
                              imp_physics, convert_dry_rho,                   &
                              imp_physics_nssl, nssl_ccn_on,                  &
-                             nssl_hail_on, nssl_invertccn, ntccn, ntccna,    &
+                             nssl_hail_on, nssl_invertccn, nssl_3moment,     &
+                             ntccn, ntccna,    &
                              errflg, errmsg)
 
         use module_mp_nssl_2mom, only: calcnfromq, na
@@ -197,6 +206,9 @@ subroutine mp_nssl_run(ncol, nlev, con_g, con_rd, mpirank, &
          real(kind_phys),           intent(inout) :: chl(:,:) !(1:ncol,1:nlev) hail number
          real(kind_phys),           intent(inout) :: vh (:,:) !(1:ncol,1:nlev) graupel volume 
          real(kind_phys),           intent(inout) :: vhl(:,:) !(1:ncol,1:nlev) hail volume
+         real(kind_phys),           intent(inout) :: zrw(:,:) !(1:ncol,1:nlev) rain reflectivity
+         real(kind_phys),           intent(inout) :: zhw(:,:) !(1:ncol,1:nlev) graupel reflectivity
+         real(kind_phys),           intent(inout) :: zhl(:,:) !(1:ncol,1:nlev) hail reflectivity
          ! State variables and timestep information
          real(kind_phys),           intent(inout) :: tgrs (:,:) !(1:ncol,1:nlev)
          real(kind_phys),           intent(in   ) :: prsl (:,:) !(1:ncol,1:nlev)
@@ -223,7 +235,7 @@ subroutine mp_nssl_run(ncol, nlev, con_g, con_rd, mpirank, &
          integer, intent(in) :: nleffr, nieffr, nseffr, nreffr
          integer,                   intent(in)    :: imp_physics
          integer,                   intent(in)    :: imp_physics_nssl
-         logical,                   intent(in)    :: nssl_ccn_on, nssl_hail_on, nssl_invertccn
+         logical,                   intent(in)    :: nssl_ccn_on, nssl_hail_on, nssl_invertccn, nssl_3moment
          integer,                   intent(in)    :: ntccn, ntccna
         
         integer,          intent(out)   :: errflg
@@ -256,6 +268,9 @@ subroutine mp_nssl_run(ncol, nlev, con_g, con_rd, mpirank, &
          ! create temporaries for hail in case it does not exist
          !real(kind_phys) :: chl_mp(1:ncol,1:nlev)           !< kg-1 (number mixing ratio)
          real(kind_phys) :: vhl_mp(1:ncol,1:nlev)           !< m3 kg-1 (volume mixing ratio)
+         real(kind_phys) :: zrw_mp(1:ncol,1:nlev)           !< m6 kg-1 (reflectivity)
+         real(kind_phys) :: zhw_mp(1:ncol,1:nlev)           !< m6 kg-1 (reflectivity)
+         real(kind_phys) :: zhl_mp(1:ncol,1:nlev)           !< m6 kg-1 (reflectivity)
          ! Vertical velocity and level width
          real(kind_phys) :: w(1:ncol,1:nlev)                !< m s-1
          real(kind_phys) :: dz(1:ncol,1:nlev)               !< m
@@ -342,10 +357,17 @@ subroutine mp_nssl_run(ncol, nlev, con_g, con_rd, mpirank, &
          ns_mp = csw/(1.0_kind_phys-spechum)
          nh_mp = chw/(1.0_kind_phys-spechum)
          vh_mp = vh/(1.0_kind_phys-spechum)
+         IF ( nssl_3moment ) THEN
+           zrw_mp = zrw/(1.0_kind_phys-spechum)
+           zhw_mp = zhw/(1.0_kind_phys-spechum)
+         ENDIF
          IF ( nssl_hail_on ) THEN
            qhl_mp = qhl/(1.0_kind_phys-spechum)
            nhl_mp = chl/(1.0_kind_phys-spechum)
            vhl_mp = vhl/(1.0_kind_phys-spechum)
+           IF ( nssl_3moment ) THEN
+             zhl_mp = zhl/(1.0_kind_phys-spechum)
+           ENDIF
          ENDIF
          ELSE
 !         qv_mp = spechum ! /(1.0_kind_phys-spechum)
@@ -361,10 +383,18 @@ subroutine mp_nssl_run(ncol, nlev, con_g, con_rd, mpirank, &
          ni_mp = cci
          ns_mp = csw
          nh_mp = chw
+         vh_mp = vh
+         IF ( nssl_3moment ) THEN
+           zrw_mp = zrw
+           zhw_mp = zhw
+         ENDIF
          IF ( nssl_hail_on ) THEN
            qhl_mp = qhl ! /(1.0_kind_phys-spechum)
            nhl_mp = chl
            vhl_mp = vhl
+           IF ( nssl_3moment ) THEN
+             zhl_mp = zhl
+           ENDIF
          ENDIF
          
          ENDIF
@@ -593,6 +623,9 @@ subroutine mp_nssl_run(ncol, nlev, con_g, con_rd, mpirank, &
                      VHW=vh_mp,                     &
                      VHL=vhl_mp,                     &
                      cn=cn_mp,                        &
+                     ZRW=zrw_mp,                     &
+                     ZHW=zhw_mp,                     &
+                     ZHL=zhl_mp,                     &
 !                     cna=cna_mp, f_cna=( ntccna > 0 ),  & ! for future use
                       cna=cna_mp, f_cna=.false. ,           &
                     PII=prslk,                         &
@@ -645,6 +678,9 @@ subroutine mp_nssl_run(ncol, nlev, con_g, con_rd, mpirank, &
                      CHL=nhl_mp,                       &
                      VHW=vh_mp,                     &
                      VHL=vhl_mp,                     &
+                     ZRW=zrw_mp,                     &
+                     ZHW=zhw_mp,                     &
+                     ZHL=zhl_mp,                     &
                 !     cn=cccn,                        &
                      PII=prslk,                         &
                      P=prsl,                                &
@@ -750,10 +786,17 @@ subroutine mp_nssl_run(ncol, nlev, con_g, con_rd, mpirank, &
          csw      = ns_mp/(1.0_kind_phys+qv_mp)
          chw      = nh_mp/(1.0_kind_phys+qv_mp)
          vh       = vh_mp/(1.0_kind_phys+qv_mp)
+          IF ( nssl_3moment ) THEN
+           zrw = zrw_mp/(1.0_kind_phys+qv_mp)
+           zhw = zhw_mp/(1.0_kind_phys+qv_mp)
+          ENDIF
          IF ( nssl_hail_on ) THEN
           qhl     = qhl_mp/(1.0_kind_phys+qv_mp)
           chl     = nhl_mp/(1.0_kind_phys+qv_mp)
           vhl     = vhl_mp/(1.0_kind_phys+qv_mp)
+          IF ( nssl_3moment ) THEN
+           zhl = zhl_mp/(1.0_kind_phys+qv_mp)
+          ENDIF
          ENDIF
          ELSE
 !         spechum = qv_mp ! /(1.0_kind_phys+qv_mp)
@@ -770,10 +813,17 @@ subroutine mp_nssl_run(ncol, nlev, con_g, con_rd, mpirank, &
          csw      = ns_mp
          chw      = nh_mp
          vh       = vh_mp
+          IF ( nssl_3moment ) THEN
+           zrw = zrw_mp
+           zhw = zhw_mp
+          ENDIF
          IF ( nssl_hail_on ) THEN
           qhl     = qhl_mp ! /(1.0_kind_phys+qv_mp)
           chl     = nhl_mp
           vhl     = vhl_mp
+          IF ( nssl_3moment ) THEN
+           zhl = zhl_mp
+          ENDIF
          ENDIF
          
          ENDIF
diff --git a/physics/mp_nssl.meta b/physics/mp_nssl.meta
index c7e398f0a..e628b0ff0 100644
--- a/physics/mp_nssl.meta
+++ b/physics/mp_nssl.meta
@@ -210,6 +210,13 @@
   dimensions = ()
   type = logical
   intent = in
+[nssl_3moment]
+  standard_name = nssl_3moment
+  long_name = 3-moment activation flag in NSSL microphysics scheme
+  units = flag
+  dimensions = ()
+  type = logical
+  intent = in
 ########################################################################
 [ccpp-arg-table]
   name = mp_nssl_run
@@ -387,6 +394,30 @@
   type = real
   kind = kind_phys
   intent = inout
+[zrw]
+  standard_name = reflectivity_of_rain_of_new_state
+  long_name = rain reflectivity
+  units = m6 kg-1
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = inout
+[zhw]
+  standard_name = reflectivity_of_graupel_of_new_state
+  long_name = graupel reflectivity
+  units = m6 kg-1
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = inout
+[zhl]
+  standard_name = reflectivity_of_hail_of_new_state
+  long_name = hail reflectivity
+  units = m6 kg-1
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = inout
 [tgrs]
   standard_name = air_temperature_of_new_state
   long_name = model layer mean temperature
@@ -614,6 +645,13 @@
   dimensions = ()
   type = logical
   intent = in
+[nssl_3moment]
+  standard_name = nssl_3moment
+  long_name = 3-moment activation flag in NSSL microphysics scheme
+  units = flag
+  dimensions = ()
+  type = logical
+  intent = in
 [ntccn]
   standard_name = index_of_cloud_condensation_nuclei_number_concentration_in_tracer_concentration_array
   long_name = tracer index for cloud condensation nuclei number concentration

From 4e7ca4ebfd25441c67f8fe4c36c26ee76ffa6b09 Mon Sep 17 00:00:00 2001
From: Ted Mansell <ted.mansell@noaa.gov>
Date: Sat, 15 Apr 2023 19:47:21 -0500
Subject: [PATCH 035/115]   Added NSSL 3-moment variables to pre/post tracer
 arrays

---
 physics/GFS_DCNV_generic_post.F90  |  8 +++--
 physics/GFS_DCNV_generic_post.meta | 21 +++++++++++++
 physics/GFS_DCNV_generic_pre.F90   |  7 +++--
 physics/GFS_DCNV_generic_pre.meta  | 21 +++++++++++++
 physics/GFS_PBL_generic_post.F90   | 29 +++++++++++++-----
 physics/GFS_PBL_generic_post.meta  | 28 +++++++++++++++++
 physics/GFS_PBL_generic_pre.F90    | 49 +++++++++++++++++++-----------
 physics/GFS_PBL_generic_pre.meta   | 28 +++++++++++++++++
 8 files changed, 162 insertions(+), 29 deletions(-)

diff --git a/physics/GFS_DCNV_generic_post.F90 b/physics/GFS_DCNV_generic_post.F90
index 51a228122..3b69849a7 100644
--- a/physics/GFS_DCNV_generic_post.F90
+++ b/physics/GFS_DCNV_generic_post.F90
@@ -15,7 +15,7 @@ subroutine GFS_DCNV_generic_post_run (im, levs, lssav, ldiag3d, qdiag3d, ras, &
       index_of_temperature, index_of_x_wind, index_of_y_wind, ntqv, gq0, save_q,  &
       cnvw, cnvc, cnvw_phy_f3d, cnvc_phy_f3d, flag_for_dcnv_generic_tend,         &
       ntcw,ntiw,ntclamt,ntrw,ntsw,ntrnc,ntsnc,ntgl,                               &
-      ntgnc, nthl, nthnc, nthv, ntgv, ntsigma, ntrac,clw,                         &
+      ntgnc, nthl, nthnc, nthv, ntgv, ntrz, ntgz, nthz, ntsigma, ntrac,clw,       &
       satmedmf, trans_trac, errmsg, errflg)
 
 
@@ -44,8 +44,9 @@ subroutine GFS_DCNV_generic_post_run (im, levs, lssav, ldiag3d, qdiag3d, ras, &
       real(kind=kind_phys), dimension(:,:,:), intent(inout) :: dtend
       integer, intent(in) :: dtidx(:,:), index_of_process_dcnv, index_of_temperature, &
            index_of_x_wind, index_of_y_wind, ntqv
-      integer, intent(in) :: ntcw,ntiw,ntclamt,ntrw,ntsw,ntrnc,ntsnc,ntgl,   &
-                             ntgnc, nthl, nthnc, nthv, ntgv, ntsigma, ntrac
+      integer, intent(in) :: ntcw,ntiw,ntclamt,ntrw,ntsw,ntrnc,ntsnc,ntgl,     &
+                             ntgnc, nthl, nthnc, nthv, ntgv, ntrz, ntgz, nthz, &
+                             ntsigma, ntrac
       real(kind=kind_phys), dimension(:,:,:), intent(in) :: clw
 
 
@@ -112,6 +113,7 @@ subroutine GFS_DCNV_generic_post_run (im, levs, lssav, ldiag3d, qdiag3d, ras, &
                      n /= ntrw  .and. n /= ntsw  .and. n /= ntrnc   .and. &
                      n /= ntsnc .and. n /= ntgl  .and. n /= ntgnc   .and. &
                      n /= nthl  .and. n /= nthnc .and. n /= nthv    .and. &
+                     n /= ntrz  .and. n /= ntgz  .and. n /= nthz    .and. &
                      n /= ntgv  .and. n /= ntsigma) then
                    tracers = tracers + 1
                    idtend = dtidx(100+n,index_of_process_dcnv)
diff --git a/physics/GFS_DCNV_generic_post.meta b/physics/GFS_DCNV_generic_post.meta
index 8428752ce..191e83a3a 100644
--- a/physics/GFS_DCNV_generic_post.meta
+++ b/physics/GFS_DCNV_generic_post.meta
@@ -454,6 +454,27 @@
   dimensions = ()
   type = integer
   intent = in
+[ntrz]
+  standard_name = index_of_reflectivity_of_rain_in_tracer_concentration_array
+  long_name = tracer index for rain reflectivity
+  units = index
+  dimensions = ()
+  type = integer
+  intent = in
+[ntgz]
+  standard_name = index_of_reflectivity_of_graupel_in_tracer_concentration_array
+  long_name = tracer index for graupel reflectivity
+  units = index
+  dimensions = ()
+  type = integer
+  intent = in
+[nthz]
+  standard_name = index_of_reflectivity_of_hail_in_tracer_concentration_array
+  long_name = tracer index for hail reflectivity
+  units = index
+  dimensions = ()
+  type = integer
+  intent = in
 [clw]
   standard_name = convective_transportable_tracers
   long_name = array to contain cloud water and other convective trans. tracers
diff --git a/physics/GFS_DCNV_generic_pre.F90 b/physics/GFS_DCNV_generic_pre.F90
index b31daf5d6..1dd3aafc7 100644
--- a/physics/GFS_DCNV_generic_pre.F90
+++ b/physics/GFS_DCNV_generic_pre.F90
@@ -13,7 +13,8 @@ subroutine GFS_DCNV_generic_pre_run (im, levs, ldiag3d, qdiag3d, do_cnvgwd, cplc
                                          gu0, gv0, gt0, gq0, nsamftrac, ntqv,            &
                                          save_u, save_v, save_t, save_q, clw,            &
                                          ntcw,ntiw,ntclamt,ntrw,ntsw,ntrnc,ntsnc,ntgl,   &
-                                         ntgnc, nthl, nthnc, nthv, ntgv,ntsigma,         &
+                                         ntgnc, nthl, nthnc, nthv, ntgv,                 &
+                                         ntrz, ntgz, nthz, ntsigma,                      &
                                          cscnv, satmedmf, trans_trac, ras, ntrac,        &
                                          dtidx, index_of_process_dcnv, errmsg, errflg)
 
@@ -22,7 +23,8 @@ subroutine GFS_DCNV_generic_pre_run (im, levs, ldiag3d, qdiag3d, do_cnvgwd, cplc
       implicit none
 
       integer, intent(in) :: im, levs, nsamftrac, ntqv, index_of_process_dcnv, dtidx(:,:), &
-           ntcw,ntiw,ntclamt,ntrw,ntsw,ntrnc,ntsnc,ntgl,ntrac,ntgnc,nthl,nthnc,nthv,ntgv,ntsigma
+           ntcw,ntiw,ntclamt,ntrw,ntsw,ntrnc,ntsnc,ntgl,ntrac,ntgnc,nthl,nthnc,nthv,ntgv,  &
+           ntrz, ntgz, nthz, ntsigma
       logical, intent(in) :: ldiag3d, qdiag3d, do_cnvgwd, cplchm
       real(kind=kind_phys), dimension(:,:),   intent(in)    :: gu0
       real(kind=kind_phys), dimension(:,:),   intent(in)    :: gv0
@@ -68,6 +70,7 @@ subroutine GFS_DCNV_generic_pre_run (im, levs, ldiag3d, qdiag3d, do_cnvgwd, cplc
                     n /= ntrw  .and. n /= ntsw  .and. n /= ntrnc   .and. &
                     n /= ntsnc .and. n /= ntgl  .and. n /= ntgnc   .and. &
                     n /= nthl  .and. n /= nthnc .and. n /= nthv    .and. &
+                    n /= ntrz  .and. n /= ntgz  .and. n /= nthz    .and. &
                     n /= ntgv  .and. n/= ntsigma) then
                   tracers = tracers + 1
                   if(dtidx(100+n,index_of_process_dcnv)>0) then
diff --git a/physics/GFS_DCNV_generic_pre.meta b/physics/GFS_DCNV_generic_pre.meta
index ee2050926..a9008436e 100644
--- a/physics/GFS_DCNV_generic_pre.meta
+++ b/physics/GFS_DCNV_generic_pre.meta
@@ -267,6 +267,27 @@
   dimensions = ()
   type = integer
   intent = in
+[ntrz]
+  standard_name = index_of_reflectivity_of_rain_in_tracer_concentration_array
+  long_name = tracer index for rain reflectivity
+  units = index
+  dimensions = ()
+  type = integer
+  intent = in
+[ntgz]
+  standard_name = index_of_reflectivity_of_graupel_in_tracer_concentration_array
+  long_name = tracer index for graupel reflectivity
+  units = index
+  dimensions = ()
+  type = integer
+  intent = in
+[nthz]
+  standard_name = index_of_reflectivity_of_hail_in_tracer_concentration_array
+  long_name = tracer index for hail reflectivity
+  units = index
+  dimensions = ()
+  type = integer
+  intent = in
 [clw]
   standard_name = convective_transportable_tracers
   long_name = array to contain cloud water and other convective trans. tracers
diff --git a/physics/GFS_PBL_generic_post.F90 b/physics/GFS_PBL_generic_post.F90
index 0d13dc5d8..a4e5f172a 100644
--- a/physics/GFS_PBL_generic_post.F90
+++ b/physics/GFS_PBL_generic_post.F90
@@ -10,9 +10,9 @@ module GFS_PBL_generic_post
 !!
       subroutine GFS_PBL_generic_post_run (im, levs, nvdiff, ntrac,                                                            &
         ntqv, ntcw, ntiw, ntrw, ntsw, ntlnc, ntinc, ntrnc, ntsnc, ntgnc, ntwa, ntia, ntgl, ntoz, ntke, ntkev,nqrimef,          &
-        trans_aero, ntchs, ntchm, ntccn, nthl, nthnc, ntgv, nthv,                                                              &
+        trans_aero, ntchs, ntchm, ntccn, nthl, nthnc, ntgv, nthv, ntrz, ntgz, nthz,                                            &
         imp_physics, imp_physics_gfdl, imp_physics_thompson, imp_physics_wsm6, imp_physics_zhao_carr, imp_physics_mg,          &
-        imp_physics_fer_hires, imp_physics_nssl, nssl_ccn_on, ltaerosol,   mraerosol, nssl_hail_on,                            &
+        imp_physics_fer_hires, imp_physics_nssl, nssl_ccn_on, ltaerosol, mraerosol, nssl_hail_on, nssl_3moment,                &
         cplflx, cplaqm, cplchm, lssav, flag_for_pbl_generic_tend, ldiag3d, lsidea, hybedmf, do_shoc, satmedmf,                 &
         shinhong, do_ysu, dvdftra, dusfc1, dvsfc1, dtsfc1, dqsfc1, dtf, dudt, dvdt, dtdt, htrsw, htrlw, xmu,                   &
         dqdt, dusfc_cpl, dvsfc_cpl, dtsfc_cpl, dtend, dtidx, index_of_temperature, index_of_x_wind, index_of_y_wind,           &
@@ -30,12 +30,12 @@ subroutine GFS_PBL_generic_post_run (im, levs, nvdiff, ntrac,
       integer, parameter  :: kp = kind_phys
       integer, intent(in) :: im, levs, nvdiff, ntrac, ntchs, ntchm, kdt
       integer, intent(in) :: ntqv, ntcw, ntiw, ntrw, ntsw, ntlnc, ntinc, ntrnc, ntsnc, ntgnc, ntwa, ntia, ntgl, ntoz, ntke, ntkev, nqrimef
-      integer, intent(in) :: ntccn, nthl, nthnc, ntgv, nthv
+      integer, intent(in) :: ntccn, nthl, nthnc, ntgv, nthv, ntrz, ntgz, nthz
       logical, intent(in) :: trans_aero
       integer, intent(in) :: imp_physics, imp_physics_gfdl, imp_physics_thompson, imp_physics_wsm6
       integer, intent(in) :: imp_physics_zhao_carr, imp_physics_mg, imp_physics_fer_hires
       integer, intent(in) :: imp_physics_nssl
-      logical, intent(in) :: nssl_ccn_on, nssl_hail_on
+      logical, intent(in) :: nssl_ccn_on, nssl_hail_on, nssl_3moment
       logical, intent(in) :: ltaerosol, cplflx, cplaqm, cplchm, lssav, ldiag3d, lsidea, use_med_flux, mraerosol
       logical, intent(in) :: hybedmf, do_shoc, satmedmf, shinhong, do_ysu
 
@@ -270,8 +270,16 @@ subroutine GFS_PBL_generic_post_run (im, levs, nvdiff, ntrac,
                dqdt(i,k,ntgv) = dvdftra(i,k,14) 
                dqdt(i,k,nthv) = dvdftra(i,k,15) 
                dqdt(i,k,ntoz) = dvdftra(i,k,16) 
+               n = 16
                IF ( nssl_ccn_on ) THEN
-               dqdt(i,k,ntccn) = dvdftra(i,k,17)
+                 dqdt(i,k,ntccn) = dvdftra(i,k,n+1)
+                 n = n+1
+               ENDIF
+               IF ( nssl_3moment ) THEN
+                 dqdt(i,k,ntrz) = dvdftra(i,k,n+1)
+                 dqdt(i,k,ntgz) = dvdftra(i,k,n+2)
+                 dqdt(i,k,nthz) = dvdftra(i,k,n+3)
+                 n = n+3
                ENDIF
               enddo
             enddo
@@ -292,9 +300,16 @@ subroutine GFS_PBL_generic_post_run (im, levs, nvdiff, ntrac,
                dqdt(i,k,ntsnc) = dvdftra(i,k,10)
                dqdt(i,k,ntgnc) = dvdftra(i,k,11)
                dqdt(i,k,ntgv) = dvdftra(i,k,12) 
-               dqdt(i,k,ntoz) = dvdftra(i,k,13) 
+               dqdt(i,k,ntoz) = dvdftra(i,k,13)
+               n = 13
                IF ( nssl_ccn_on ) THEN
-               dqdt(i,k,ntccn) = dvdftra(i,k,14)
+                 dqdt(i,k,ntccn) = dvdftra(i,k,n+1)
+                 n = n+1
+               ENDIF
+               IF ( nssl_3moment ) THEN
+                 dqdt(i,k,ntrz) = dvdftra(i,k,n+1)
+                 dqdt(i,k,ntgz) = dvdftra(i,k,n+2)
+                 n = n+2
                ENDIF
               enddo
             enddo
diff --git a/physics/GFS_PBL_generic_post.meta b/physics/GFS_PBL_generic_post.meta
index b20142991..a53acbc64 100644
--- a/physics/GFS_PBL_generic_post.meta
+++ b/physics/GFS_PBL_generic_post.meta
@@ -211,6 +211,27 @@
   dimensions = ()
   type = integer
   intent = in
+[ntrz]
+  standard_name = index_of_reflectivity_of_rain_in_tracer_concentration_array
+  long_name = tracer index for rain reflectivity
+  units = index
+  dimensions = ()
+  type = integer
+  intent = in
+[ntgz]
+  standard_name = index_of_reflectivity_of_graupel_in_tracer_concentration_array
+  long_name = tracer index for graupel reflectivity
+  units = index
+  dimensions = ()
+  type = integer
+  intent = in
+[nthz]
+  standard_name = index_of_reflectivity_of_hail_in_tracer_concentration_array
+  long_name = tracer index for hail reflectivity
+  units = index
+  dimensions = ()
+  type = integer
+  intent = in
 [imp_physics]
   standard_name = control_for_microphysics_scheme
   long_name = choice of microphysics scheme
@@ -295,6 +316,13 @@
   dimensions = ()
   type = logical
   intent = in
+[nssl_3moment]
+  standard_name = nssl_3moment
+  long_name = 3-moment activation flag in NSSL microphysics scheme
+  units = flag
+  dimensions = ()
+  type = logical
+  intent = in
 [cplflx]
   standard_name = flag_for_surface_flux_coupling
   long_name = flag controlling cplflx collection (default off)
diff --git a/physics/GFS_PBL_generic_pre.F90 b/physics/GFS_PBL_generic_pre.F90
index b9f7bb880..d8ed0f8fc 100644
--- a/physics/GFS_PBL_generic_pre.F90
+++ b/physics/GFS_PBL_generic_pre.F90
@@ -12,10 +12,10 @@ module GFS_PBL_generic_pre
       subroutine GFS_PBL_generic_pre_run (im, levs, nvdiff, ntrac, rtg_ozone_index,      &
         ntqv, ntcw, ntiw, ntrw, ntsw, ntlnc, ntinc, ntrnc, ntsnc, ntgnc,                 &
         ntwa, ntia, ntgl, ntoz, ntke, ntkev, nqrimef, trans_aero, ntchs, ntchm,          &
-        ntccn, nthl, nthnc, ntgv, nthv,                                                  &
+        ntccn, nthl, nthnc, ntgv, nthv, ntrz, ntgz, nthz,                                &
         imp_physics, imp_physics_gfdl, imp_physics_thompson, imp_physics_wsm6,           &
         imp_physics_zhao_carr, imp_physics_mg, imp_physics_fer_hires, imp_physics_nssl,  &
-        ltaerosol, mraerosol, nssl_ccn_on, nssl_hail_on,                                 &
+        ltaerosol, mraerosol, nssl_ccn_on, nssl_hail_on, nssl_3moment,                   &
         hybedmf, do_shoc, satmedmf, qgrs, vdftra, save_u, save_v, save_t, save_q,        &
         flag_for_pbl_generic_tend, ldiag3d, qdiag3d, lssav, ugrs, vgrs, tgrs, errmsg, errflg)
         
@@ -29,13 +29,13 @@ subroutine GFS_PBL_generic_pre_run (im, levs, nvdiff, ntrac, rtg_ozone_index,
       integer, intent(in) :: im, levs, nvdiff, ntrac
       integer, intent(in) :: ntqv, ntcw, ntiw, ntrw, ntsw, ntlnc, ntinc, ntrnc, ntsnc, ntgnc
       integer, intent(in) :: ntwa, ntia, ntgl, ntoz, ntke, ntkev, nqrimef,ntchs, ntchm
-      integer, intent(in) :: ntccn, nthl, nthnc, ntgv, nthv
+      integer, intent(in) :: ntccn, nthl, nthnc, ntgv, nthv, ntrz, ntgz, nthz
       logical, intent(in) :: trans_aero, ldiag3d, qdiag3d, lssav
       integer, intent(in) :: imp_physics, imp_physics_gfdl, imp_physics_thompson, imp_physics_wsm6
       integer, intent(in) :: imp_physics_zhao_carr, imp_physics_mg, imp_physics_fer_hires
       logical, intent(in) :: ltaerosol, hybedmf, do_shoc, satmedmf, flag_for_pbl_generic_tend, mraerosol
       integer, intent(in) :: imp_physics_nssl
-      logical, intent(in) :: nssl_hail_on, nssl_ccn_on
+      logical, intent(in) :: nssl_hail_on, nssl_ccn_on, nssl_3moment
 
       real(kind=kind_phys), dimension(:,:,:), intent(in) :: qgrs
       real(kind=kind_phys), dimension(:,:), intent(in) :: ugrs, vgrs, tgrs
@@ -215,15 +215,23 @@ subroutine GFS_PBL_generic_pre_run (im, levs, nvdiff, ntrac, rtg_ozone_index,
                 vdftra(i,k,7)  = qgrs(i,k,nthl)
                 vdftra(i,k,8)  = qgrs(i,k,ntlnc)
                 vdftra(i,k,9)  = qgrs(i,k,ntinc)
-                vdftra(i,k,10)  = qgrs(i,k,ntrnc)
-                vdftra(i,k,11)  = qgrs(i,k,ntsnc)
-                vdftra(i,k,12)  = qgrs(i,k,ntgnc)
-                vdftra(i,k,13)  = qgrs(i,k,nthnc)
-                vdftra(i,k,14)  = qgrs(i,k,ntgv)
-                vdftra(i,k,15)  = qgrs(i,k,nthv)
-                vdftra(i,k,16)  = qgrs(i,k,ntoz)
+                vdftra(i,k,10) = qgrs(i,k,ntrnc)
+                vdftra(i,k,11) = qgrs(i,k,ntsnc)
+                vdftra(i,k,12) = qgrs(i,k,ntgnc)
+                vdftra(i,k,13) = qgrs(i,k,nthnc)
+                vdftra(i,k,14) = qgrs(i,k,ntgv)
+                vdftra(i,k,15) = qgrs(i,k,nthv)
+                vdftra(i,k,16) = qgrs(i,k,ntoz)
+                n = 16
                 IF ( nssl_ccn_on ) THEN
-                 vdftra(i,k,17)  = qgrs(i,k,ntccn)
+                 vdftra(i,k,n+1)  = qgrs(i,k,ntccn)
+                 n = n+1
+                ENDIF
+                IF ( nssl_3moment ) THEN
+                 vdftra(i,k,n+1)  = qgrs(i,k,ntrz)
+                 vdftra(i,k,n+2)  = qgrs(i,k,ntgz)
+                 vdftra(i,k,n+3)  = qgrs(i,k,nthz)
+                 n = n+3
                 ENDIF
               enddo
             enddo
@@ -241,12 +249,19 @@ subroutine GFS_PBL_generic_pre_run (im, levs, nvdiff, ntrac, rtg_ozone_index,
                 vdftra(i,k,7)  = qgrs(i,k,ntlnc)
                 vdftra(i,k,8)  = qgrs(i,k,ntinc)
                 vdftra(i,k,9)  = qgrs(i,k,ntrnc)
-                vdftra(i,k,10)  = qgrs(i,k,ntsnc)
-                vdftra(i,k,11)  = qgrs(i,k,ntgnc)
-                vdftra(i,k,12)  = qgrs(i,k,ntgv)
-                vdftra(i,k,13)  = qgrs(i,k,ntoz)
+                vdftra(i,k,10) = qgrs(i,k,ntsnc)
+                vdftra(i,k,11) = qgrs(i,k,ntgnc)
+                vdftra(i,k,12) = qgrs(i,k,ntgv)
+                vdftra(i,k,13) = qgrs(i,k,ntoz)
+                 n = 13
                 IF ( nssl_ccn_on ) THEN
-                 vdftra(i,k,14)  = qgrs(i,k,ntccn)
+                 vdftra(i,k,n+1) = qgrs(i,k,ntccn)
+                 n = n+1
+                ENDIF
+                IF ( nssl_3moment ) THEN
+                 vdftra(i,k,n+1) = qgrs(i,k,ntrz)
+                 vdftra(i,k,n+2) = qgrs(i,k,ntgz)
+                 n = n+2
                 ENDIF
               enddo
             enddo
diff --git a/physics/GFS_PBL_generic_pre.meta b/physics/GFS_PBL_generic_pre.meta
index a09b34b48..995fac565 100644
--- a/physics/GFS_PBL_generic_pre.meta
+++ b/physics/GFS_PBL_generic_pre.meta
@@ -217,6 +217,27 @@
   dimensions = ()
   type = integer
   intent = in
+[ntrz]
+  standard_name = index_of_reflectivity_of_rain_in_tracer_concentration_array
+  long_name = tracer index for rain reflectivity
+  units = index
+  dimensions = ()
+  type = integer
+  intent = in
+[ntgz]
+  standard_name = index_of_reflectivity_of_graupel_in_tracer_concentration_array
+  long_name = tracer index for graupel reflectivity
+  units = index
+  dimensions = ()
+  type = integer
+  intent = in
+[nthz]
+  standard_name = index_of_reflectivity_of_hail_in_tracer_concentration_array
+  long_name = tracer index for hail reflectivity
+  units = index
+  dimensions = ()
+  type = integer
+  intent = in
 [imp_physics]
   standard_name = control_for_microphysics_scheme
   long_name = choice of microphysics scheme
@@ -301,6 +322,13 @@
   dimensions = ()
   type = logical
   intent = in
+[nssl_3moment]
+  standard_name = nssl_3moment
+  long_name = 3-moment activation flag in NSSL microphysics scheme
+  units = flag
+  dimensions = ()
+  type = logical
+  intent = in
 [hybedmf]
   standard_name = flag_for_hybrid_edmf_pbl_scheme
   long_name = flag for hybrid edmf pbl scheme (moninedmf)

From 7956ada51d49617acc7f1e03c0381dfafbf2ba25 Mon Sep 17 00:00:00 2001
From: Ted Mansell <ted.mansell@noaa.gov>
Date: Tue, 18 Apr 2023 16:48:30 -0500
Subject: [PATCH 036/115]  Turn off unneeded print statement

---
 physics/module_mp_nssl_2mom.F90 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/physics/module_mp_nssl_2mom.F90 b/physics/module_mp_nssl_2mom.F90
index f2f9707fb..cac1218a9 100644
--- a/physics/module_mp_nssl_2mom.F90
+++ b/physics/module_mp_nssl_2mom.F90
@@ -1326,7 +1326,7 @@ SUBROUTINE nssl_2mom_init(  &
 
 
 
-      IF ( .false. ) THEN ! set to true to enable internal namelist read
+      IF ( .true. ) THEN ! set to true to enable internal namelist read
       open(15,file='input.nml',status='old',form='formatted',action='read')
       rewind(15)
       read(15,NML=nssl_mp_params,iostat=istat)
@@ -1633,7 +1633,7 @@ SUBROUTINE nssl_2mom_init(  &
         lccnuf = ltmp
         denscale(lccnuf) = 1
       ENDIF
-      write(0,*) 'nsslwrf: lccnuf = ',lccnuf
+
       lccn= ltmp+1 ! 9
       lnc = ltmp+2 ! 10
       lnr = ltmp+3 ! 11

From f020a3a2ab44048bb9725639d1924a50c97a089c Mon Sep 17 00:00:00 2001
From: Greg Thompson <gthompsn@ucar.edu>
Date: Thu, 27 Apr 2023 07:37:58 -0600
Subject: [PATCH 037/115] bug fix for rain evaporation due to inconsistent
 usage of air density on multiple lines

---
 physics/module_mp_thompson.F90 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/physics/module_mp_thompson.F90 b/physics/module_mp_thompson.F90
index b828c9ab0..3844498d1 100644
--- a/physics/module_mp_thompson.F90
+++ b/physics/module_mp_thompson.F90
@@ -3716,13 +3716,13 @@ subroutine mp_thompson (qv1d, qc1d, qi1d, qr1d, qs1d, qg1d, ni1d,    &
           lamr = 1./ilamr(k)
 !>  - Rapidly eliminate near zero values when low humidity (<95%)
           if (qv(k)/qvs(k) .lt. 0.95 .AND. rr(k)*orho.le.1.E-8) then
-          prv_rev(k) = rr(k)*orho*odts
+          prv_rev(k) = rr(k)*odts
           else
           prv_rev(k) = t1_evap*diffu(k)*(-ssatw(k))*N0_r(k)*rvs &
               * (t1_qr_ev*ilamr(k)**cre(10) &
               + t2_qr_ev*vsc2(k)*rhof2(k)*((lamr+0.5*fv_r)**(-cre(11))))
-          rate_max = MIN((rr(k)*orho*odts), (qvs(k)-qv(k))*odts)
-          prv_rev(k) = MIN(DBLE(rate_max), prv_rev(k)*orho)
+          rate_max = MIN((rr(k)*odts), (qvs(k)-qv(k))*rho(k)*odts)
+          prv_rev(k) = MIN(DBLE(rate_max*orho), prv_rev(k)*orho)
 
 !..TEST: G. Thompson  10 May 2013
 !>  - Reduce the rain evaporation in same places as melting graupel occurs.

From c7f6d31bec5957c11e49662ebe8a36cf39c63de4 Mon Sep 17 00:00:00 2001
From: Greg Thompson <gthompsn@ucar.edu>
Date: Thu, 4 May 2023 10:23:44 -0600
Subject: [PATCH 038/115] three small fixes: max ice size bin made smaller
 (since snow min size was increased prev); make fewer explicit rain drop
 breakup from collisions with graupel when T above 0C; fix so snow/graupel
 only sublimate when not melting

---
 physics/module_mp_thompson.F90 | 44 ++++++++++++++++------------------
 1 file changed, 20 insertions(+), 24 deletions(-)

diff --git a/physics/module_mp_thompson.F90 b/physics/module_mp_thompson.F90
index b828c9ab0..38ee79dfa 100644
--- a/physics/module_mp_thompson.F90
+++ b/physics/module_mp_thompson.F90
@@ -708,9 +708,9 @@ SUBROUTINE thompson_init(is_aerosol_aware_in,       &
          dtc(n) = (Dc(n) - Dc(n-1))
       enddo
 
-!>  - Create bins of cloud ice (from min diameter up to 5x min snow size)
+!>  - Create bins of cloud ice (from min diameter up to 2x min snow size)
       xDx(1) = D0i*1.0d0
-      xDx(nbi+1) = 5.0d0*D0s
+      xDx(nbi+1) = 2.0d0*D0s
       do n = 2, nbi
          xDx(n) = DEXP(DFLOAT(n-1)/DFLOAT(nbi) &
                   *DLOG(xDx(nbi+1)/xDx(1)) +DLOG(xDx(1)))
@@ -2822,7 +2822,7 @@ subroutine mp_thompson (qv1d, qc1d, qi1d, qr1d, qs1d, qg1d, ni1d,    &
             prr_rcg(k) = MIN(DBLE(rg(k)*odts), prr_rcg(k))
             prg_rcg(k) = -prr_rcg(k)
 !>  - Put in explicit drop break-up due to collisions.
-            pnr_rcg(k) = -5.*tnr_gacr(idx_g1,idx_g,idx_r1,idx_r)         ! RAIN2M
+            pnr_rcg(k) = -1.5*tnr_gacr(idx_g1,idx_g,idx_r1,idx_r)        ! RAIN2M
            endif
           endif
          endif
@@ -3053,16 +3053,14 @@ subroutine mp_thompson (qv1d, qc1d, qi1d, qr1d, qs1d, qg1d, ni1d,    &
            if (prr_sml(k) .gt. 0.) then
               prr_sml(k) = prr_sml(k) + 4218.*olfus*tempc               &
                                       * (prr_rcs(k)+prs_scw(k))
-           endif
-           prr_sml(k) = MIN(DBLE(rs(k)*odts), MAX(0.D0, prr_sml(k)))
-           pnr_sml(k) = smo0(k)/rs(k)*prr_sml(k) * 10.0**(-0.25*tempc)      ! RAIN2M
-           pnr_sml(k) = MIN(DBLE(smo0(k)*odts), pnr_sml(k))
-
-           if (ssati(k).lt. 0.) then
-            prs_sde(k) = C_cube*t1_subl*diffu(k)*ssati(k)*rvs &
-                         * (t1_qs_sd*smo1(k) &
-                          + t2_qs_sd*rhof2(k)*vsc2(k)*smof(k))
-            prs_sde(k) = MAX(DBLE(-rs(k)*odts), prs_sde(k))
+              prr_sml(k) = MIN(DBLE(rs(k)*odts), prr_sml(k))
+              pnr_sml(k) = smo0(k)/rs(k)*prr_sml(k) * 10.0**(-0.25*tempc)   ! RAIN2M
+              pnr_sml(k) = MIN(DBLE(smo0(k)*odts), pnr_sml(k))
+           elseif (ssati(k).lt. 0.) then
+              prs_sde(k) = C_cube*t1_subl*diffu(k)*ssati(k)*rvs         &
+                         * (t1_qs_sd*smo1(k)                            &
+                         + t2_qs_sd*rhof2(k)*vsc2(k)*smof(k))
+              prs_sde(k) = MAX(DBLE(-rs(k)*odts), prs_sde(k))
            endif
           endif
 
@@ -3070,17 +3068,15 @@ subroutine mp_thompson (qv1d, qc1d, qi1d, qr1d, qs1d, qg1d, ni1d,    &
            prr_gml(k) = (tempc*tcond(k)-lvap0*diffu(k)*delQvs(k))       &
                       * N0_g(k)*(t1_qg_me*ilamg(k)**cge(10)             &
                       + t2_qg_me*rhof2(k)*vsc2(k)*ilamg(k)**cge(11))
-!-GT       prr_gml(k) = prr_gml(k) + 4218.*olfus*tempc &
-!-GT                               * (prr_rcg(k)+prg_gcw(k))
-           prr_gml(k) = MIN(DBLE(rg(k)*odts), MAX(0.D0, prr_gml(k)))
-           pnr_gml(k) = N0_g(k)*cgg(2)*ilamg(k)**cge(2) / rg(k)         &   ! RAIN2M
-                      * prr_gml(k) * 10.0**(-0.5*tempc)
-
-           if (ssati(k).lt. 0.) then
-            prg_gde(k) = C_cube*t1_subl*diffu(k)*ssati(k)*rvs &
-                * N0_g(k) * (t1_qg_sd*ilamg(k)**cge(10) &
-                + t2_qg_sd*vsc2(k)*rhof2(k)*ilamg(k)**cge(11))
-            prg_gde(k) = MAX(DBLE(-rg(k)*odts), prg_gde(k))
+           if (prr_gml(k) .gt. 0.) then
+              prr_gml(k) = MIN(DBLE(rg(k)*odts), prr_gml(k))
+              pnr_gml(k) = N0_g(k)*cgg(2)*ilamg(k)**cge(2) / rg(k)      &   ! RAIN2M
+                         * prr_gml(k) * 10.0**(-0.5*tempc)
+           elseif (ssati(k).lt. 0.) then
+              prg_gde(k) = C_cube*t1_subl*diffu(k)*ssati(k)*rvs         &
+                         * N0_g(k) * (t1_qg_sd*ilamg(k)**cge(10)        &
+                         + t2_qg_sd*vsc2(k)*rhof2(k)*ilamg(k)**cge(11))
+              prg_gde(k) = MAX(DBLE(-rg(k)*odts), prg_gde(k))
            endif
           endif
 

From 4c60a2f50b163cb52495c3815a41ade7e536de39 Mon Sep 17 00:00:00 2001
From: dustinswales <dswales@ucar.edu>
Date: Tue, 23 May 2023 14:00:52 -0600
Subject: [PATCH 039/115] Reorganize NRL ozone physics scheme into CCPP phases.
 Make scheme (memory) stateless.

---
 physics/GFS_phys_time_vary.fv3.F90  |  80 ++-----
 physics/GFS_phys_time_vary.fv3.meta |  76 +-----
 physics/GFS_phys_time_vary.scm.F90  |  68 ++----
 physics/GFS_phys_time_vary.scm.meta |  76 +-----
 physics/GFS_rrtmg_pre.F90           |  11 +-
 physics/GFS_rrtmg_pre.meta          |  30 +++
 physics/GFS_rrtmg_setup.F90         |   7 +-
 physics/GFS_rrtmg_setup.meta        |  21 ++
 physics/ozinterp.f90                | 212 -----------------
 physics/ozne_def.f                  |  24 --
 physics/ozne_def.meta               |  29 ---
 physics/ozphys_2015.F90             | 343 ++++++++++++++++++++++++++++
 physics/ozphys_2015.f               | 190 ---------------
 physics/ozphys_2015.meta            | 203 ++++++++++++++--
 physics/radiation_gases.f           |  13 +-
 15 files changed, 635 insertions(+), 748 deletions(-)
 delete mode 100644 physics/ozinterp.f90
 delete mode 100644 physics/ozne_def.f
 delete mode 100644 physics/ozne_def.meta
 create mode 100644 physics/ozphys_2015.F90
 delete mode 100644 physics/ozphys_2015.f

diff --git a/physics/GFS_phys_time_vary.fv3.F90 b/physics/GFS_phys_time_vary.fv3.F90
index 42f2bbc15..334228afe 100644
--- a/physics/GFS_phys_time_vary.fv3.F90
+++ b/physics/GFS_phys_time_vary.fv3.F90
@@ -2,7 +2,7 @@
 !!  Contains code related to GFS physics suite setup (physics part of time_vary_step)
 
 !>\defgroup mod_GFS_phys_time_vary GFS Physics Time Update
-!! This module contains GFS physics time vary subroutines including ozone, stratospheric water vapor,
+!! This module contains GFS physics time vary subroutines including stratospheric water vapor,
 !! aerosol, IN&CCN and surface properties updates.
    module GFS_phys_time_vary
 
@@ -14,9 +14,6 @@ module GFS_phys_time_vary
 
       use mersenne_twister, only: random_setseed, random_number
 
-      use ozne_def, only : levozp, oz_coeff, oz_lat, oz_pres, oz_time, ozplin
-      use ozinterp, only : read_o3data, setindxoz, ozinterpol
-
       use h2o_def,   only : levh2o, h2o_coeff, h2o_lat, h2o_pres, h2o_time, h2oplin
       use h2ointerp, only : read_h2odata, setindxh2o, h2ointerpol
 
@@ -66,9 +63,9 @@ module GFS_phys_time_vary
 !>\section gen_GFS_phys_time_vary_init GFS_phys_time_vary_init General Algorithm
 !> @{
       subroutine GFS_phys_time_vary_init (                                                         &
-              me, master, ntoz, h2o_phys, iaerclm, iccn, iaermdl, iflip, im, levs,                 &
+              me, master, h2o_phys, iaerclm, iccn, iaermdl, iflip, im, levs,                 &
               nx, ny, idate, xlat_d, xlon_d,                                                       &
-              jindx1_o3, jindx2_o3, ddy_o3, ozpl, jindx1_h, jindx2_h, ddy_h, h2opl,fhour,          &
+              jindx1_h, jindx2_h, ddy_h, h2opl,fhour,          &
               jindx1_aer, jindx2_aer, ddy_aer, iindx1_aer, iindx2_aer, ddx_aer, aer_nm,            &
               jindx1_ci, jindx2_ci, ddy_ci, iindx1_ci, iindx2_ci, ddx_ci, imap, jmap,              &
               do_ugwp_v1, jindx1_tau, jindx2_tau, ddy_j1tau, ddy_j2tau,                            &
@@ -85,15 +82,15 @@ subroutine GFS_phys_time_vary_init (
          implicit none
 
          ! Interface variables
-         integer,              intent(in)    :: me, master, ntoz, iccn, iflip, im, nx, ny, levs, iaermdl
+         integer,              intent(in)    :: me, master, iccn, iflip, im, nx, ny, levs, iaermdl
          logical,              intent(in)    :: h2o_phys, iaerclm, lsm_cold_start
          integer,              intent(in)    :: idate(:)
          real(kind_phys),      intent(in)    :: fhour
          real(kind_phys),      intent(in)    :: xlat_d(:), xlon_d(:)
 
-         integer,              intent(inout) :: jindx1_o3(:), jindx2_o3(:), jindx1_h(:), jindx2_h(:)
-         real(kind_phys),      intent(inout) :: ddy_o3(:),  ddy_h(:)
-         real(kind_phys),      intent(in)    :: ozpl(:,:,:), h2opl(:,:,:)
+         integer,              intent(inout) :: jindx1_h(:), jindx2_h(:)
+         real(kind_phys),      intent(inout) :: ddy_h(:)
+         real(kind_phys),      intent(in)    :: h2opl(:,:,:)
          integer,              intent(inout) :: jindx1_aer(:), jindx2_aer(:), iindx1_aer(:), iindx2_aer(:)
          real(kind_phys),      intent(inout) :: ddy_aer(:), ddx_aer(:)
          real(kind_phys),      intent(out)   :: aer_nm(:,:,:)
@@ -196,13 +193,12 @@ subroutine GFS_phys_time_vary_init (
          jamax=-999
 
 !$OMP parallel num_threads(nthrds) default(none)                                    &
-!$OMP          shared (me,master,ntoz,h2o_phys,im,nx,ny,levs,idate)                 &
+!$OMP          shared (me,master,h2o_phys,im,nx,ny,levs,idate)                      &
 !$OMP          shared (xlat_d,xlon_d,imap,jmap,errmsg,errflg)                       &
-!$OMP          shared (levozp,oz_coeff,oz_pres,ozpl)                                &
 !$OMP          shared (levh2o,h2o_coeff,h2o_pres,h2opl)                             &
 !$OMP          shared (iamin, iamax, jamin, jamax)                                  &
 !$OMP          shared (iaerclm,iaermdl,ntrcaer,aer_nm,iflip,iccn)                   &
-!$OMP          shared (jindx1_o3,jindx2_o3,ddy_o3,jindx1_h,jindx2_h,ddy_h)          &
+!$OMP          shared (jindx1_h,jindx2_h,ddy_h)                                     &
 !$OMP          shared (jindx1_aer,jindx2_aer,ddy_aer,iindx1_aer,iindx2_aer,ddx_aer) &
 !$OMP          shared (jindx1_ci,jindx2_ci,ddy_ci,iindx1_ci,iindx2_ci,ddx_ci)       &
 !$OMP          shared (do_ugwp_v1,jindx1_tau,jindx2_tau,ddy_j1tau,ddy_j2tau)        &
@@ -212,32 +208,12 @@ subroutine GFS_phys_time_vary_init (
 
 !$OMP sections
 
-!$OMP section
-!> - Call read_o3data() to read ozone data
-         call read_o3data (ntoz, me, master)
-
-         ! Consistency check that the hardcoded values for levozp and
-         ! oz_coeff in GFS_typedefs.F90 match what is set by read_o3data
-         ! in GFS_typedefs.F90: allocate (Tbd%ozpl (IM,levozp,oz_coeff))
-         if (size(ozpl, dim=2).ne.levozp) then
-            write(errmsg,'(2a,i0,a,i0)') "Value error in GFS_phys_time_vary_init: ",    &
-                  "levozp from read_o3data does not match value in GFS_typedefs.F90: ", &
-                  levozp, " /= ", size(ozpl, dim=2)
-            errflg = 1
-         end if
-         if (size(ozpl, dim=3).ne.oz_coeff) then
-            write(errmsg,'(2a,i0,a,i0)') "Value error in GFS_phys_time_vary_init: ",      &
-                  "oz_coeff from read_o3data does not match value in GFS_typedefs.F90: ", &
-                  oz_coeff, " /= ", size(ozpl, dim=3)
-            errflg = 1
-         end if
-
 !$OMP section
 !> - Call read_h2odata() to read stratospheric water vapor data
          call read_h2odata (h2o_phys, me, master)
 
          ! Consistency check that the hardcoded values for levh2o and
-         ! h2o_coeff in GFS_typedefs.F90 match what is set by read_o3data
+         ! h2o_coeff in GFS_typedefs.F90 match what is set by read_h2odata
          ! in GFS_typedefs.F90: allocate (Tbd%h2opl (IM,levh2o,h2o_coeff))
          if (size(h2opl, dim=2).ne.levh2o) then
             write(errmsg,'(2a,i0,a,i0)') "Value error in GFS_phys_time_vary_init: ",     &
@@ -295,12 +271,6 @@ subroutine GFS_phys_time_vary_init (
 
 !$OMP sections
 
-!$OMP section
-!> - Call setindxoz() to initialize ozone data
-         if (ntoz > 0) then
-           call setindxoz (im, xlat_d, jindx1_o3, jindx2_o3, ddy_o3)
-         endif
-
 !$OMP section
 !> - Call setindxh2o() to initialize stratospheric water vapor data
          if (h2o_phys) then
@@ -708,8 +678,8 @@ end subroutine GFS_phys_time_vary_init
 !> @{
       subroutine GFS_phys_time_vary_timestep_init (                                                 &
             me, master, cnx, cny, isc, jsc, nrcm, im, levs, kdt, idate, nsswr, fhswr, lsswr, fhour, &
-            imfdeepcnv, cal_pre, random_clds, nscyc, ntoz, h2o_phys, iaerclm, iccn, clstp,          &
-            jindx1_o3, jindx2_o3, ddy_o3, ozpl, jindx1_h, jindx2_h, ddy_h, h2opl, iflip,            &
+            imfdeepcnv, cal_pre, random_clds, nscyc, h2o_phys, iaerclm, iccn, clstp,          &
+            jindx1_h, jindx2_h, ddy_h, h2opl, iflip,            &
             jindx1_aer, jindx2_aer, ddy_aer, iindx1_aer, iindx2_aer, ddx_aer, aer_nm,               &
             jindx1_ci, jindx2_ci, ddy_ci, iindx1_ci, iindx2_ci, ddx_ci, in_nm, ccn_nm, fn_nml,      &
             imap, jmap, prsl, seed0, rann, nthrds, nx, ny, nsst, tile_num, nlunit, lsoil, lsoil_lsm,&
@@ -724,14 +694,14 @@ subroutine GFS_phys_time_vary_timestep_init (
 
          ! Interface variables
          integer,              intent(in)    :: me, master, cnx, cny, isc, jsc, nrcm, im, levs, kdt, &
-                                                nsswr, imfdeepcnv, iccn, nscyc, ntoz, iflip
+                                                nsswr, imfdeepcnv, iccn, nscyc, iflip
          integer,              intent(in)    :: idate(:)
          real(kind_phys),      intent(in)    :: fhswr, fhour
          logical,              intent(in)    :: lsswr, cal_pre, random_clds, h2o_phys, iaerclm
          real(kind_phys),      intent(out)   :: clstp
-         integer,              intent(in)    :: jindx1_o3(:), jindx2_o3(:), jindx1_h(:), jindx2_h(:)
-         real(kind_phys),      intent(in)    :: ddy_o3(:),  ddy_h(:)
-         real(kind_phys),      intent(inout) :: ozpl(:,:,:), h2opl(:,:,:)
+         integer,              intent(in)    :: jindx1_h(:), jindx2_h(:)
+         real(kind_phys),      intent(in)    :: ddy_h(:)
+         real(kind_phys),      intent(inout) :: h2opl(:,:,:)
          integer,              intent(in)    :: jindx1_aer(:), jindx2_aer(:), iindx1_aer(:), iindx2_aer(:)
          real(kind_phys),      intent(in)    :: ddy_aer(:), ddx_aer(:)
          real(kind_phys),      intent(inout) :: aer_nm(:,:,:)
@@ -788,8 +758,8 @@ subroutine GFS_phys_time_vary_timestep_init (
 !$OMP parallel num_threads(nthrds) default(none)                                         &
 !$OMP          shared(kdt,nsswr,lsswr,clstp,imfdeepcnv,cal_pre,random_clds)              &
 !$OMP          shared(fhswr,fhour,seed0,cnx,cny,nrcm,wrk,rannie,rndval)                  &
-!$OMP          shared(rann,im,isc,jsc,imap,jmap,ntoz,me,idate,jindx1_o3,jindx2_o3)       &
-!$OMP          shared(ozpl,ddy_o3,h2o_phys,jindx1_h,jindx2_h,h2opl,ddy_h,iaerclm,master) &
+!$OMP          shared(rann,im,isc,jsc,imap,jmap,me,idate)       &
+!$OMP          shared(h2o_phys,jindx1_h,jindx2_h,h2opl,ddy_h,iaerclm,master) &
 !$OMP          shared(levs,prsl,iccn,jindx1_ci,jindx2_ci,ddy_ci,iindx1_ci,iindx2_ci)     &
 !$OMP          shared(ddx_ci,in_nm,ccn_nm,do_ugwp_v1,jindx1_tau,jindx2_tau,ddy_j1tau)    &
 !$OMP          shared(ddy_j2tau,tau_amf,iflip)                                           &
@@ -842,14 +812,6 @@ subroutine GFS_phys_time_vary_timestep_init (
 
          endif  ! imfdeepcnv, cal_re, random_clds
 
-!$OMP section
-!> - Call ozinterpol() to make ozone interpolation
-         if (ntoz > 0) then
-           call ozinterpol (me, im, idate, fhour, &
-                            jindx1_o3, jindx2_o3, &
-                            ozpl, ddy_o3)
-         endif
-
 !$OMP section
 !> - Call h2ointerpol() to make stratospheric water vapor data interpolation
          if (h2o_phys) then
@@ -944,12 +906,6 @@ subroutine GFS_phys_time_vary_finalize(errmsg, errflg)
 
          if (.not.is_initialized) return
 
-         ! Deallocate ozone arrays
-         if (allocated(oz_lat)  ) deallocate(oz_lat)
-         if (allocated(oz_pres) ) deallocate(oz_pres)
-         if (allocated(oz_time) ) deallocate(oz_time)
-         if (allocated(ozplin)  ) deallocate(ozplin)
-
          ! Deallocate h2o arrays
          if (allocated(h2o_lat) ) deallocate(h2o_lat)
          if (allocated(h2o_pres)) deallocate(h2o_pres)
diff --git a/physics/GFS_phys_time_vary.fv3.meta b/physics/GFS_phys_time_vary.fv3.meta
index ce8c6c54b..654b5afd8 100644
--- a/physics/GFS_phys_time_vary.fv3.meta
+++ b/physics/GFS_phys_time_vary.fv3.meta
@@ -2,7 +2,7 @@
   name = GFS_phys_time_vary
   type = scheme
   dependencies = aerclm_def.F,aerinterp.F90,gcycle.F90,h2o_def.f,h2ointerp.f90,iccn_def.F,iccninterp.F90,machine.F,mersenne_twister.f
-  dependencies = namelist_soilveg.f,set_soilveg.f,ozinterp.f90,ozne_def.f,sfcsub.F,cires_tauamf_data.F90,noahmp_tables.f90
+  dependencies = namelist_soilveg.f,set_soilveg.f,sfcsub.F,cires_tauamf_data.F90,noahmp_tables.f90
 
 ########################################################################
 [ccpp-arg-table]
@@ -23,13 +23,6 @@
   dimensions = ()
   type = integer
   intent = in
-[ntoz]
-  standard_name = index_of_ozone_mixing_ratio_in_tracer_concentration_array
-  long_name = tracer index for ozone mixing ratio
-  units = index
-  dimensions = ()
-  type = integer
-  intent = in
 [h2o_phys]
   standard_name = flag_for_stratospheric_water_vapor_physics
   long_name = flag for stratospheric water vapor physics
@@ -116,36 +109,6 @@
   type = real
   kind = kind_phys
   intent = in
-[jindx1_o3]
-  standard_name = lower_latitude_index_of_ozone_forcing_for_interpolation
-  long_name = interpolation low index for ozone
-  units = index
-  dimensions = (horizontal_dimension)
-  type = integer
-  intent = inout
-[jindx2_o3]
-  standard_name = upper_latitude_index_of_ozone_forcing_for_interpolation
-  long_name = interpolation high index for ozone
-  units = index
-  dimensions = (horizontal_dimension)
-  type = integer
-  intent = inout
-[ddy_o3]
-  standard_name = latitude_interpolation_weight_for_ozone_forcing
-  long_name = interpolation high index for ozone
-  units = none
-  dimensions = (horizontal_dimension)
-  type = real
-  kind = kind_phys
-  intent = inout
-[ozpl]
-  standard_name = ozone_forcing
-  long_name = ozone forcing data
-  units = mixed
-  dimensions = (horizontal_dimension,vertical_dimension_of_ozone_forcing_data,number_of_coefficients_in_ozone_forcing_data)
-  type = real
-  kind = kind_phys
-  intent = in
 [jindx1_h]
   standard_name = lower_latitude_index_of_stratospheric_water_vapor_forcing_for_interpolation
   long_name = interpolation low index for stratospheric water vapor
@@ -1077,13 +1040,6 @@
   dimensions = ()
   type = integer
   intent = in
-[ntoz]
-  standard_name = index_of_ozone_mixing_ratio_in_tracer_concentration_array
-  long_name = tracer index for ozone mixing ratio
-  units = index
-  dimensions = ()
-  type = integer
-  intent = in
 [h2o_phys]
   standard_name = flag_for_stratospheric_water_vapor_physics
   long_name = flag for stratospheric water vapor physics
@@ -1113,36 +1069,6 @@
   type = real
   kind = kind_phys
   intent = out
-[jindx1_o3]
-  standard_name = lower_latitude_index_of_ozone_forcing_for_interpolation
-  long_name = interpolation low index for ozone
-  units = index
-  dimensions = (horizontal_dimension)
-  type = integer
-  intent = in
-[jindx2_o3]
-  standard_name = upper_latitude_index_of_ozone_forcing_for_interpolation
-  long_name = interpolation high index for ozone
-  units = index
-  dimensions = (horizontal_dimension)
-  type = integer
-  intent = in
-[ddy_o3]
-  standard_name = latitude_interpolation_weight_for_ozone_forcing
-  long_name = interpolation high index for ozone
-  units = none
-  dimensions = (horizontal_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[ozpl]
-  standard_name = ozone_forcing
-  long_name = ozone forcing data
-  units = mixed
-  dimensions = (horizontal_dimension,vertical_dimension_of_ozone_forcing_data,number_of_coefficients_in_ozone_forcing_data)
-  type = real
-  kind = kind_phys
-  intent = inout
 [jindx1_h]
   standard_name = lower_latitude_index_of_stratospheric_water_vapor_forcing_for_interpolation
   long_name = interpolation low index for stratospheric water vapor
diff --git a/physics/GFS_phys_time_vary.scm.F90 b/physics/GFS_phys_time_vary.scm.F90
index 74b34e974..97460ac98 100644
--- a/physics/GFS_phys_time_vary.scm.F90
+++ b/physics/GFS_phys_time_vary.scm.F90
@@ -2,7 +2,7 @@
 !!  Contains code related to GFS physics suite setup (physics part of time_vary_step)
 
 !>\defgroup mod_GFS_phys_time_vary GFS Physics Time Update
-!! This module contains GFS physics time vary subroutines including ozone, stratospheric water vapor,
+!! This module contains GFS physics time vary subroutines including, stratospheric water vapor,
 !! aerosol, IN&CCN and surface properties updates.
 !> @{
    module GFS_phys_time_vary
@@ -11,9 +11,6 @@ module GFS_phys_time_vary
 
       use mersenne_twister, only: random_setseed, random_number
 
-      use ozne_def, only : levozp, oz_coeff, oz_lat, oz_pres, oz_time, ozplin
-      use ozinterp, only : read_o3data, setindxoz, ozinterpol
-
       use h2o_def,   only : levh2o, h2o_coeff, h2o_lat, h2o_pres, h2o_time, h2oplin
       use h2ointerp, only : read_h2odata, setindxh2o, h2ointerpol
 
@@ -61,8 +58,8 @@ module GFS_phys_time_vary
 !>\section gen_GFS_phys_time_vary_init GFS_phys_time_vary_init General Algorithm
 !! @{
       subroutine GFS_phys_time_vary_init (                                                         &
-              me, master, ntoz, h2o_phys, iaerclm, iccn, iflip, im, nx, ny, idate, xlat_d, xlon_d, &
-              jindx1_o3, jindx2_o3, ddy_o3, ozpl, jindx1_h, jindx2_h, ddy_h, h2opl,fhour,          &
+              me, master, h2o_phys, iaerclm, iccn, iflip, im, nx, ny, idate, xlat_d, xlon_d, &
+              jindx1_h, jindx2_h, ddy_h, h2opl,fhour,          &
               jindx1_aer, jindx2_aer, ddy_aer, iindx1_aer, iindx2_aer, ddx_aer, aer_nm,            &
               jindx1_ci, jindx2_ci, ddy_ci, iindx1_ci, iindx2_ci, ddx_ci, imap, jmap,              &
               do_ugwp_v1, jindx1_tau, jindx2_tau, ddy_j1tau, ddy_j2tau,                            &
@@ -79,15 +76,15 @@ subroutine GFS_phys_time_vary_init (
          implicit none
 
          ! Interface variables
-         integer,              intent(in)    :: me, master, ntoz, iccn, iflip, im, nx, ny
+         integer,              intent(in)    :: me, master, iccn, iflip, im, nx, ny
          logical,              intent(in)    :: h2o_phys, iaerclm, lsm_cold_start
          integer,              intent(in)    :: idate(:)
          real(kind_phys),      intent(in)    :: fhour
          real(kind_phys),      intent(in)    :: xlat_d(:), xlon_d(:)
 
-         integer,              intent(inout) :: jindx1_o3(:), jindx2_o3(:), jindx1_h(:), jindx2_h(:)
-         real(kind_phys),      intent(inout) :: ddy_o3(:),  ddy_h(:)
-         real(kind_phys),      intent(in)    :: ozpl(:,:,:), h2opl(:,:,:)
+         integer,              intent(inout) :: jindx1_h(:), jindx2_h(:)
+         real(kind_phys),      intent(inout) :: ddy_h(:)
+         real(kind_phys),      intent(in)    :: h2opl(:,:,:)
          integer,              intent(inout) :: jindx1_aer(:), jindx2_aer(:), iindx1_aer(:), iindx2_aer(:)
          real(kind_phys),      intent(inout) :: ddy_aer(:), ddx_aer(:)
          real(kind_phys),      intent(in)    :: aer_nm(:,:,:)
@@ -189,30 +186,11 @@ subroutine GFS_phys_time_vary_init (
          jamin=999
          jamax=-999
 
-!> - Call read_o3data() to read ozone data 
-         call read_o3data (ntoz, me, master)
-
-         ! Consistency check that the hardcoded values for levozp and
-         ! oz_coeff in GFS_typedefs.F90 match what is set by read_o3data
-         ! in GFS_typedefs.F90: allocate (Tbd%ozpl (IM,levozp,oz_coeff))
-         if (size(ozpl, dim=2).ne.levozp) then
-            write(errmsg,'(2a,i0,a,i0)') "Value error in GFS_phys_time_vary_init: ",    &
-                  "levozp from read_o3data does not match value in GFS_typedefs.F90: ", &
-                  levozp, " /= ", size(ozpl, dim=2)
-            errflg = 1
-         end if
-         if (size(ozpl, dim=3).ne.oz_coeff) then
-            write(errmsg,'(2a,i0,a,i0)') "Value error in GFS_phys_time_vary_init: ",      &
-                  "oz_coeff from read_o3data does not match value in GFS_typedefs.F90: ", &
-                  oz_coeff, " /= ", size(ozpl, dim=3)
-            errflg = 1
-         end if
-
 !> - Call read_h2odata() to read stratospheric water vapor data
          call read_h2odata (h2o_phys, me, master)
 
          ! Consistency check that the hardcoded values for levh2o and
-         ! h2o_coeff in GFS_typedefs.F90 match what is set by read_o3data
+         ! h2o_coeff in GFS_typedefs.F90 match what is set by read_h2odata
          ! in GFS_typedefs.F90: allocate (Tbd%h2opl (IM,levh2o,h2o_coeff))
          if (size(h2opl, dim=2).ne.levh2o) then
             write(errmsg,'(2a,i0,a,i0)') "Value error in GFS_phys_time_vary_init: ",     &
@@ -266,11 +244,6 @@ subroutine GFS_phys_time_vary_init (
 !> - Initialize soil vegetation (needed for sncovr calculation further down)
          call set_soilveg(me, isot, ivegsrc, nlunit, errmsg, errflg)
 
-!> - Call setindxoz() to initialize ozone data
-         if (ntoz > 0) then
-           call setindxoz (im, xlat_d, jindx1_o3, jindx2_o3, ddy_o3)
-         endif
-
 !> - Call setindxh2o() to initialize stratospheric water vapor data
          if (h2o_phys) then
            call setindxh2o (im, xlat_d, jindx1_h, jindx2_h, ddy_h)
@@ -652,8 +625,8 @@ end subroutine GFS_phys_time_vary_init
 !! @{
       subroutine GFS_phys_time_vary_timestep_init (                                                 &
             me, master, cnx, cny, isc, jsc, nrcm, im, levs, kdt, idate, nsswr, fhswr, lsswr, fhour, &
-            imfdeepcnv, cal_pre, random_clds,        ntoz, h2o_phys, iaerclm, iccn, clstp,          &
-            jindx1_o3, jindx2_o3, ddy_o3, ozpl, jindx1_h, jindx2_h, ddy_h, h2opl, iflip,            &
+            imfdeepcnv, cal_pre, random_clds,         h2o_phys, iaerclm, iccn, clstp,          &
+            jindx1_h, jindx2_h, ddy_h, h2opl, iflip,            &
             jindx1_aer, jindx2_aer, ddy_aer, iindx1_aer, iindx2_aer, ddx_aer, aer_nm,               &
             jindx1_ci, jindx2_ci, ddy_ci, iindx1_ci, iindx2_ci, ddx_ci, in_nm, ccn_nm,              &
             imap, jmap, prsl, seed0, rann, do_ugwp_v1, jindx1_tau, jindx2_tau, ddy_j1tau, ddy_j2tau,&
@@ -663,14 +636,14 @@ subroutine GFS_phys_time_vary_timestep_init (
 
          ! Interface variables
          integer,              intent(in)    :: me, master, cnx, cny, isc, jsc, nrcm, im, levs, kdt, &
-                                                nsswr, imfdeepcnv, iccn, ntoz, iflip
+                                                nsswr, imfdeepcnv, iccn, iflip
          integer,              intent(in)    :: idate(:)
          real(kind_phys),      intent(in)    :: fhswr, fhour
          logical,              intent(in)    :: lsswr, cal_pre, random_clds, h2o_phys, iaerclm
          real(kind_phys),      intent(out)   :: clstp
-         integer,              intent(in)    :: jindx1_o3(:), jindx2_o3(:), jindx1_h(:), jindx2_h(:)
-         real(kind_phys),      intent(in)    :: ddy_o3(:),  ddy_h(:)
-         real(kind_phys),      intent(inout) :: ozpl(:,:,:), h2opl(:,:,:)
+         integer,              intent(in)    :: jindx1_h(:), jindx2_h(:)
+         real(kind_phys),      intent(in)    :: ddy_h(:)
+         real(kind_phys),      intent(inout) :: h2opl(:,:,:)
          integer,              intent(in)    :: jindx1_aer(:), jindx2_aer(:), iindx1_aer(:), iindx2_aer(:)
          real(kind_phys),      intent(in)    :: ddy_aer(:), ddx_aer(:)
          real(kind_phys),      intent(inout) :: aer_nm(:,:,:)
@@ -748,13 +721,6 @@ subroutine GFS_phys_time_vary_timestep_init (
 
          endif  ! imfdeepcnv, cal_re, random_clds
 
-!> - Call ozinterpol() to make ozone interpolation
-         if (ntoz > 0) then
-           call ozinterpol (me, im, idate, fhour, &
-                            jindx1_o3, jindx2_o3, &
-                            ozpl, ddy_o3)
-         endif
-
 !> - Call h2ointerpol() to make stratospheric water vapor data interpolation
          if (h2o_phys) then
            call h2ointerpol (me, im, idate, fhour, &
@@ -844,12 +810,6 @@ subroutine GFS_phys_time_vary_finalize(errmsg, errflg)
 
          if (.not.is_initialized) return
 
-         ! Deallocate ozone arrays
-         if (allocated(oz_lat)  ) deallocate(oz_lat)
-         if (allocated(oz_pres) ) deallocate(oz_pres)
-         if (allocated(oz_time) ) deallocate(oz_time)
-         if (allocated(ozplin)  ) deallocate(ozplin)
-
          ! Deallocate h2o arrays
          if (allocated(h2o_lat) ) deallocate(h2o_lat)
          if (allocated(h2o_pres)) deallocate(h2o_pres)
diff --git a/physics/GFS_phys_time_vary.scm.meta b/physics/GFS_phys_time_vary.scm.meta
index 8b59e4bed..21d1f2736 100644
--- a/physics/GFS_phys_time_vary.scm.meta
+++ b/physics/GFS_phys_time_vary.scm.meta
@@ -2,7 +2,7 @@
   name = GFS_phys_time_vary
   type = scheme
   dependencies = aerclm_def.F,aerinterp.F90,h2o_def.f,h2ointerp.f90,iccn_def.F,iccninterp.F90,machine.F,mersenne_twister.f
-  dependencies = namelist_soilveg.f,set_soilveg.f,ozinterp.f90,ozne_def.f,cires_tauamf_data.F90,noahmp_tables.f90
+  dependencies = namelist_soilveg.f,set_soilveg.f,cires_tauamf_data.F90,noahmp_tables.f90
 
 ########################################################################
 [ccpp-arg-table]
@@ -23,13 +23,6 @@
   dimensions = ()
   type = integer
   intent = in
-[ntoz]
-  standard_name = index_of_ozone_mixing_ratio_in_tracer_concentration_array
-  long_name = tracer index for ozone mixing ratio
-  units = index
-  dimensions = ()
-  type = integer
-  intent = in
 [h2o_phys]
   standard_name = flag_for_stratospheric_water_vapor_physics
   long_name = flag for stratospheric water vapor physics
@@ -102,36 +95,6 @@
   type = real
   kind = kind_phys
   intent = in
-[jindx1_o3]
-  standard_name = lower_latitude_index_of_ozone_forcing_for_interpolation
-  long_name = interpolation low index for ozone
-  units = index
-  dimensions = (horizontal_dimension)
-  type = integer
-  intent = inout
-[jindx2_o3]
-  standard_name = upper_latitude_index_of_ozone_forcing_for_interpolation
-  long_name = interpolation high index for ozone
-  units = index
-  dimensions = (horizontal_dimension)
-  type = integer
-  intent = inout
-[ddy_o3]
-  standard_name = latitude_interpolation_weight_for_ozone_forcing
-  long_name = interpolation high index for ozone
-  units = none
-  dimensions = (horizontal_dimension)
-  type = real
-  kind = kind_phys
-  intent = inout
-[ozpl]
-  standard_name = ozone_forcing
-  long_name = ozone forcing data
-  units = mixed
-  dimensions = (horizontal_dimension,vertical_dimension_of_ozone_forcing_data,number_of_coefficients_in_ozone_forcing_data)
-  type = real
-  kind = kind_phys
-  intent = in
 [jindx1_h]
   standard_name = lower_latitude_index_of_stratospheric_water_vapor_forcing_for_interpolation
   long_name = interpolation low index for stratospheric water vapor
@@ -1056,13 +1019,6 @@
   dimensions = ()
   type = logical
   intent = in
-[ntoz]
-  standard_name = index_of_ozone_mixing_ratio_in_tracer_concentration_array
-  long_name = tracer index for ozone mixing ratio
-  units = index
-  dimensions = ()
-  type = integer
-  intent = in
 [h2o_phys]
   standard_name = flag_for_stratospheric_water_vapor_physics
   long_name = flag for stratospheric water vapor physics
@@ -1092,36 +1048,6 @@
   type = real
   kind = kind_phys
   intent = out
-[jindx1_o3]
-  standard_name = lower_latitude_index_of_ozone_forcing_for_interpolation
-  long_name = interpolation low index for ozone
-  units = index
-  dimensions = (horizontal_dimension)
-  type = integer
-  intent = in
-[jindx2_o3]
-  standard_name = upper_latitude_index_of_ozone_forcing_for_interpolation
-  long_name = interpolation high index for ozone
-  units = index
-  dimensions = (horizontal_dimension)
-  type = integer
-  intent = in
-[ddy_o3]
-  standard_name = latitude_interpolation_weight_for_ozone_forcing
-  long_name = interpolation high index for ozone
-  units = none
-  dimensions = (horizontal_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[ozpl]
-  standard_name = ozone_forcing
-  long_name = ozone forcing data
-  units = mixed
-  dimensions = (horizontal_dimension,vertical_dimension_of_ozone_forcing_data,number_of_coefficients_in_ozone_forcing_data)
-  type = real
-  kind = kind_phys
-  intent = inout
 [jindx1_h]
   standard_name = lower_latitude_index_of_stratospheric_water_vapor_forcing_for_interpolation
   long_name = interpolation low index for stratospheric water vapor
diff --git a/physics/GFS_rrtmg_pre.F90 b/physics/GFS_rrtmg_pre.F90
index c45bec3e3..ae88ca0fc 100644
--- a/physics/GFS_rrtmg_pre.F90
+++ b/physics/GFS_rrtmg_pre.F90
@@ -45,7 +45,8 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp, lextop,&
         gasvmr_ccl4,  gasvmr_cfc113, aerodp,ext550, clouds6, clouds7, clouds8, &
         clouds9, cldsa, cldfra, cldfra2d, lwp_ex,iwp_ex, lwp_fc,iwp_fc,        &
         faersw1, faersw2, faersw3, faerlw1, faerlw2, faerlw3, alpha,           &
-        aero_dir_fdb, fdb_coef, spp_wts_rad, spp_rad, ico2, errmsg, errflg)
+        aero_dir_fdb, fdb_coef, spp_wts_rad, spp_rad, ico2, latsozp, levozp,   &
+        blatc, dphiozc, errmsg, errflg)
 
       use machine,                   only: kind_phys
 
@@ -101,7 +102,8 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp, lextop,&
                                            imp_physics_mg, imp_physics_wsm6,   &
                                            imp_physics_nssl,                   &
                                            imp_physics_fer_hires,              &
-                                           yearlen, icloud, iaermdl, iaerflg
+                                           yearlen, icloud, iaermdl, iaerflg,  &
+                                           latsozp, levozp
 
       integer,              intent(in)  ::                                     &
          iovr,                             & ! choice of cloud-overlap method
@@ -132,7 +134,7 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp, lextop,&
       integer,              intent(in) :: spp_rad
       real(kind_phys),      intent(in) :: spp_wts_rad(:,:)
 
-      real(kind=kind_phys), intent(in) :: fhswr, fhlwr, solhr, sup, julian, sppt_amp, dcorr_con
+      real(kind=kind_phys), intent(in) :: fhswr, fhlwr, solhr, sup, julian, sppt_amp, dcorr_con, blatc, dphiozc
       real(kind=kind_phys), intent(in) :: con_eps, epsm1, fvirt, rog, rocp, con_rd, con_pi, con_g, con_ttp, con_thgni
 
       real(kind=kind_phys), dimension(:), intent(in) :: xlat_d, xlat, xlon,    &
@@ -429,8 +431,7 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp, lextop,&
           enddo
         enddo
       else                                ! climatological ozone
-        call getozn (prslk1, xlat, im, lmk, top_at_1,    &     !  ---  inputs
-                     olyr)                                     !  ---  outputs
+        call getozn (prslk1, xlat, im, lmk, top_at_1, latsozp, levozp, blatc, dphiozc, olyr)
       endif                               ! end_if_ntoz
 
 !> - Call coszmn(), to compute cosine of zenith angle (only when SW is called)
diff --git a/physics/GFS_rrtmg_pre.meta b/physics/GFS_rrtmg_pre.meta
index d7feaeb3f..88363ef18 100644
--- a/physics/GFS_rrtmg_pre.meta
+++ b/physics/GFS_rrtmg_pre.meta
@@ -1496,6 +1496,36 @@
   dimensions = ()
   type = integer
   intent = in
+[latsozp]
+  standard_name = number_of_latitudes_in_ozone_data
+  long_name = number of latitude in ozone data
+  units = count
+  dimensions = ()
+  type = integer
+  intent = in
+[levozp]
+  standard_name = number_of_levels_in_ozone_data
+  long_name = number of levels in ozone data
+  units = count
+  dimensions = ()
+  type = integer
+  intent = in
+[dphiozc]
+  standard_name = ozone_data_parameter_1
+  long_name = ozone data parameter 1
+  units = none
+  dimensions = ()
+  type = real
+  kind = kind_phys
+  intent = in
+[blatc]
+  standard_name = ozone_data_parameter_2
+  long_name = ozone data parameter 2
+  units = none
+  dimensions = ()
+  type = real
+  kind = kind_phys
+  intent = in
 [errmsg]
   standard_name = ccpp_error_message
   long_name = error message for error handling in CCPP
diff --git a/physics/GFS_rrtmg_setup.F90 b/physics/GFS_rrtmg_setup.F90
index 384d5252d..30917b961 100644
--- a/physics/GFS_rrtmg_setup.F90
+++ b/physics/GFS_rrtmg_setup.F90
@@ -44,7 +44,7 @@ subroutine GFS_rrtmg_setup_init ( si, levr, ictm, isol, solar_file, ico2, &
         iaermdl, iaerflg, aeros_file, con_pi, con_t0c, con_c, con_boltz,     &
         con_plnk, con_solr_2008, con_solr_2002, con_g, con_rd, co2usr_file,  &
         co2cyc_file, rad_hr_units, inc_minor_gas, icliq_lw, isubcsw, isubclw,&
-        iswmode, ipsd0, ltp, lextop, errmsg, errflg)
+        iswmode, latsozp, levozp, timeozp, ipsd0, ltp, lextop, errmsg, errflg)
 ! =================   subprogram documentation block   ================ !
 !                                                                       !
 ! subprogram:   GFS_rrtmg_setup_init - a subprogram to initialize radiation !
@@ -155,7 +155,8 @@ subroutine GFS_rrtmg_setup_init ( si, levr, ictm, isol, solar_file, ico2, &
       integer, intent(in) :: levr, ictm, isol, ico2, iaer, ntcw, num_p3d, &
            ltp, npdf3d, ntoz, iovr, iovr_rand, iovr_maxrand, iovr_max,    &
            iovr_dcorr, iovr_exp, iovr_exprand, icliq_sw, imp_physics,     &
-           iflip, me, rad_hr_units, icliq_lw, isubcsw, isubclw, iswmode
+           iflip, me, rad_hr_units, icliq_lw, isubcsw, isubclw, iswmode,  &
+           latsozp, levozp, timeozp
       integer, intent(in) :: idate(:)
       logical, intent(in) :: lcrick, lcnorm, lnoprec, do_RRTMGP, lalw1bd, &
            inc_minor_gas, lextop
@@ -219,7 +220,7 @@ subroutine GFS_rrtmg_setup_init ( si, levr, ictm, isol, solar_file, ico2, &
       call aer_init ( levr, me, iaermdl, iaerflg, lalw1bd, aeros_file,  &
            con_pi, con_t0c, con_c, con_boltz, con_plnk, errflg, errmsg)
       call gas_init ( me, co2usr_file, co2cyc_file, ico2, ictm, ntoz,   &
-           con_pi, errflg, errmsg)
+           con_pi, latsozp, levozp, timeozp, errflg, errmsg)
       call cld_init ( si, levr, imp_physics, me, con_g, con_rd, errflg, errmsg)
       call rlwinit ( me, rad_hr_units, inc_minor_gas, icliq_lw, isubcsw, &
            iovr, iovr_rand, iovr_maxrand, iovr_max, iovr_dcorr,         &
diff --git a/physics/GFS_rrtmg_setup.meta b/physics/GFS_rrtmg_setup.meta
index adf6d8750..42b999c82 100644
--- a/physics/GFS_rrtmg_setup.meta
+++ b/physics/GFS_rrtmg_setup.meta
@@ -173,6 +173,27 @@
   dimensions = ()
   type = integer
   intent = in
+[levozp]
+  standard_name = number_of_levels_in_ozone_data
+  long_name = number of levels in ozone data
+  units = count
+  dimensions = ()
+  type = integer
+  intent = in
+[timeozp]
+  standard_name = number_of_times_in_ozone_data
+  long_name = number of times in ozone data
+  units = count
+  dimensions = ()
+  type = integer
+  intent = in
+[latsozp]
+  standard_name = number_of_latitudes_in_ozone_data
+  long_name = number of latitude in ozone data
+  units = count
+  dimensions = ()
+  type = integer
+  intent = in
 [icliq_sw]
   standard_name = control_for_shortwave_radiation_liquid_clouds
   long_name = sw optical property for liquid clouds
diff --git a/physics/ozinterp.f90 b/physics/ozinterp.f90
deleted file mode 100644
index 5b3149d61..000000000
--- a/physics/ozinterp.f90
+++ /dev/null
@@ -1,212 +0,0 @@
-!>\file ozinterp.f90
-!! This file contains ozone climatology interpolation subroutines.
-
-!>\ingroup mod_GFS_phys_time_vary
-!! This module contains subroutines of reading and interpolating ozone coefficients.
-module ozinterp
-
-   implicit none
-
-   private
-
-   public :: read_o3data, setindxoz, ozinterpol
-
-contains
-
-      SUBROUTINE read_o3data (ntoz, me, master)
-      use machine,  only: kind_phys
-      use ozne_def
-!--- in/out
-      integer, intent(in) :: ntoz
-      integer, intent(in) :: me
-      integer, intent(in) :: master
-!--- locals
-      integer :: i, n, k
-      real(kind=4), allocatable, dimension(:) :: oz_lat4, oz_pres4
-      real(kind=4), allocatable, dimension(:) :: oz_time4, tempin
-      real(kind=4) :: blatc4
-
-      if (ntoz <= 0) then      ! Diagnostic ozone
-        rewind (kozc)
-        read (kozc,end=101) latsozc, levozc, timeozc, blatc4
-  101   if (levozc  < 10 .or. levozc > 100) then
-          rewind (kozc)
-          levozc  = 17
-          latsozc = 18
-          blatc   = -85.0
-        else
-          blatc   = blatc4
-        endif
-        latsozp   = 2
-        levozp    = 1
-        timeoz    = 1
-        oz_coeff  = 0
-        dphiozc = -(blatc+blatc)/(latsozc-1)
-        return
-      endif
-
-      open(unit=kozpl,file='global_o3prdlos.f77', form='unformatted', convert='big_endian')
-
-!--- read in indices
-!---
-      read (kozpl) oz_coeff, latsozp, levozp, timeoz
-      if (me == master) then
-        write(*,*) 'Reading in o3data from global_o3prdlos.f77 '
-        write(*,*) '      oz_coeff = ', oz_coeff
-        write(*,*) '       latsozp = ', latsozp
-        write(*,*) '        levozp = ', levozp
-        write(*,*) '        timeoz = ', timeoz
-      endif
-
-!--- read in data
-!---   oz_lat   -  latitude of data        (-90 to 90)
-!---   oz_pres  -  vertical pressure level (mb)
-!---   oz_time  -  time coordinate         (days)
-!---
-      allocate (oz_lat(latsozp), oz_pres(levozp),oz_time(timeoz+1))
-      allocate (oz_lat4(latsozp), oz_pres4(levozp),oz_time4(timeoz+1))
-      rewind (kozpl)
-      read (kozpl) oz_coeff, latsozp, levozp, timeoz, oz_lat4, oz_pres4, oz_time4
-      oz_pres(:) = oz_pres4(:)
-!---  convert pressure levels from mb to ln(Pa)
-      oz_pres(:) = log(100.0*oz_pres(:))
-      oz_lat(:)  = oz_lat4(:)
-      oz_time(:) = oz_time4(:)
-      deallocate (oz_lat4, oz_pres4, oz_time4)
-
-!--- read in ozplin which is in order of (lattitudes, ozone levels, coeff number, time)
-!--- assume latitudes is on a uniform gaussian grid
-!---
-      allocate (tempin(latsozp))
-      allocate (ozplin(latsozp,levozp,oz_coeff,timeoz))
-      DO i=1,timeoz
-        DO n=1,oz_coeff
-          DO k=1,levozp
-            READ(kozpl) tempin
-            ozplin(:,k,n,i) = tempin(:)
-          ENDDO
-        ENDDO
-      ENDDO
-      deallocate (tempin)
-
-      close(kozpl)
-
-      END SUBROUTINE read_o3data
-!
-!**********************************************************************
-!
-      SUBROUTINE setindxoz(npts,dlat,jindx1,jindx2,ddy)
-!
-      USE MACHINE,  ONLY: kind_phys
-      USE OZNE_DEF, ONLY: jo3 => latsozp, oz_lat
-!
-      implicit none
-!
-      integer npts, JINDX1(npts),JINDX2(npts)
-      real(kind=kind_phys) dlat(npts),DDY(npts)
-!
-      integer i,j,lat
-!
-      DO J=1,npts
-        jindx2(j) = jo3 + 1
-        do i=1,jo3
-          if (dlat(j) < oz_lat(i)) then
-            jindx2(j) = i
-            exit
-          endif
-        enddo
-        jindx1(j) = max(jindx2(j)-1,1)
-        jindx2(j) = min(jindx2(j),jo3)
-        if (jindx2(j) .ne. jindx1(j)) then
-          DDY(j) = (dlat(j)           - oz_lat(jindx1(j))) &
-                 / (oz_lat(jindx2(j)) - oz_lat(jindx1(j)))
-        else
-          ddy(j) = 1.0
-        endif
-!       print *,' j=',j,' dlat=',dlat(j),' jindx12=',jindx1(j), &
-!         jjindx2(j),' oz_lat=',oz_lat(jindx1(j)),              &
-!         oz_lat(jindx2(j)),' ddy=',ddy(j)
-      ENDDO
- 
-      RETURN
-      END SUBROUTINE setindxoz
-!
-!**********************************************************************
-!
-      SUBROUTINE ozinterpol(me,npts,IDATE,FHOUR,jindx1,jindx2,ozplout,ddy)
-!
-      USE MACHINE,  ONLY : kind_phys
-      USE OZNE_DEF
-      implicit none
-      integer             iday,j,j1,j2,l,npts,nc,n1,n2
-      real(kind=kind_phys) fhour,tem, tx1, tx2
-!
- 
-      integer  JINDX1(npts), JINDX2(npts)
-      integer  me, idate(4), IDAT(8),JDAT(8)
-!
-      real(kind=kind_phys) DDY(npts)
-      real(kind=kind_phys) ozplout(npts,levozp,oz_coeff)
-      real(kind=kind_phys) rjday
-      integer jdow, jdoy, jday
-      real(8) rinc(5)
-      real(4) rinc4(5)
-      integer w3kindreal,w3kindint
-!
-      IDAT=0
-      IDAT(1)=IDATE(4)
-      IDAT(2)=IDATE(2)
-      IDAT(3)=IDATE(3)
-      IDAT(5)=IDATE(1)
-      RINC=0.
-      RINC(2)=FHOUR
-      call w3kind(w3kindreal,w3kindint)
-      if(w3kindreal==4) then
-        rinc4=rinc
-        CALL W3MOVDAT(RINC4,IDAT,JDAT)
-      else
-        CALL W3MOVDAT(RINC,IDAT,JDAT)
-      endif
-!
-      jdow = 0
-      jdoy = 0
-      jday = 0
-      call w3doxdat(jdat,jdow,jdoy,jday)
-      rjday = jdoy + jdat(5) / 24.
-      IF (RJDAY < oz_time(1)) RJDAY = RJDAY + 365.
-!
-      n2 = timeoz + 1
-      do j=2,timeoz
-        if (rjday < oz_time(j)) then
-          n2 = j
-          exit
-        endif
-      enddo
-      n1 = n2 - 1
-!
-!     if (me == 0) print *,' n1=',n1,' n2=',n2,' rjday=',rjday
-!    &,'oz_time=',oz_time(n1),oz_time(n2)
-!
-
-      tx1 = (oz_time(n2) - rjday) / (oz_time(n2) - oz_time(n1))
-      tx2 = 1.0 - tx1
-
-      if (n2 > timeoz) n2 = n2 - timeoz
-!
-      do nc=1,oz_coeff
-        DO L=1,levozp
-          DO J=1,npts
-            J1  = JINDX1(J)
-            J2  = JINDX2(J)
-            TEM = 1.0 - DDY(J)
-            ozplout(j,L,nc) = & 
-            tx1*(TEM*ozplin(J1,L,nc,n1)+DDY(J)*ozplin(J2,L,nc,n1)) & 
-          + tx2*(TEM*ozplin(J1,L,nc,n2)+DDY(J)*ozplin(J2,L,nc,n2))
-          ENDDO
-        ENDDO
-      enddo
-!
-      RETURN
-      END SUBROUTINE ozinterpol
-
-end module ozinterp
diff --git a/physics/ozne_def.f b/physics/ozne_def.f
deleted file mode 100644
index 8f3af6240..000000000
--- a/physics/ozne_def.f
+++ /dev/null
@@ -1,24 +0,0 @@
-!>\file ozne_def.f
-!! This file contains the ozone array definition used in ozone physics.
-
-!>\ingroup mod_GFS_phys_time_vary
-!! This module defines arrays in Ozone scheme.
-      module ozne_def
-
-!> \section arg_table_ozne_def
-!! \htmlinclude ozne_def.html
-!!
-
-      use machine , only : kind_phys
-      implicit none
-      
-      integer, parameter :: kozpl=28, kozc=48
-
-      integer latsozp, levozp, timeoz, latsozc, levozc, timeozc
-     &,       oz_coeff
-      real (kind=kind_phys) blatc, dphiozc
-      real (kind=kind_phys), allocatable :: oz_lat(:), oz_pres(:)
-     &,                                     oz_time(:)
-      real (kind=kind_phys), allocatable :: ozplin(:,:,:,:)
-
-      end module ozne_def
diff --git a/physics/ozne_def.meta b/physics/ozne_def.meta
deleted file mode 100644
index 3cad9c14d..000000000
--- a/physics/ozne_def.meta
+++ /dev/null
@@ -1,29 +0,0 @@
-[ccpp-table-properties]
-  name = ozne_def
-  type = module
-  dependencies = machine.F
-
-[ccpp-arg-table]
-  name = ozne_def
-  type = module
-
-[levozp]
-  standard_name = vertical_dimension_of_ozone_forcing_data
-  long_name = number of vertical layers in ozone forcing data
-  units = count
-  dimensions = ()
-  type = integer
-[oz_coeff]
-  standard_name = number_of_coefficients_in_ozone_forcing_data
-  long_name = number of coefficients in ozone forcing data
-  units = index
-  dimensions = ()
-  type = integer
-[oz_pres]
-  standard_name = natural_log_of_ozone_forcing_data_pressure_levels
-  long_name = natural log of ozone forcing data pressure levels in Pa
-  units = 1
-  dimensions = (vertical_dimension_of_ozone_forcing_data)
-  type = real
-  kind = kind_phys
-  active = (index_of_ozone_mixing_ratio_in_tracer_concentration_array>0)
diff --git a/physics/ozphys_2015.F90 b/physics/ozphys_2015.F90
new file mode 100644
index 000000000..17f2178a4
--- /dev/null
+++ b/physics/ozphys_2015.F90
@@ -0,0 +1,343 @@
+! ###########################################################################################
+!> \file ozphys_2015.F90
+!!
+! ###########################################################################################
+module ozphys_2015
+  use machine , only : kind_phys
+  implicit none
+  public ozphys_2015_init, ozphys_2015_timestep_init, ozphys_2015_run
+contains
+
+! ###########################################################################################
+!>\defgroup GFS_ozphys_2015 GFS Ozone Photochemistry (2015) Module
+!! This module contains the CCPP-compliant Ozone 2015 photochemistry scheme.
+!> @{
+!> \section arg_table_ozphys_2015_init Argument Table
+!! \htmlinclude ozphys_2015_init.html
+!!
+! ###########################################################################################
+  subroutine ozphys_2015_init(oz_phys_2015, nPts, latsozp, oz_lat, dlat, jindx1, jindx2,    &
+       ddy, errmsg, errflg)
+    ! Inputs
+    logical, intent(in) :: &
+         oz_phys_2015 ! Control flag for NRL 2015 ozone physics scheme
+    integer, intent(in) :: &
+         nPts,      & ! Horizontal dimension
+         latsozp      ! Number of latitudes in ozone data
+    real(kind_phys),  intent(in), dimension(:) :: &
+         oz_lat,    & ! Latitudes of ozone data
+         dlat         ! Latitudes of grid
+    ! Outputs
+    integer, intent(out), dimension(:) :: &
+         jindx1,    & ! Interpolation index (low) for ozone data
+         jindx2       ! Interpolation index (high) for ozone data
+    real(kind_phys), intent(out), dimension(:) :: &
+         ddy          ! Interpolation high index for ozone data
+    character(len=*), intent(out) :: &
+         errmsg       ! CCPP error message
+    integer, intent(out) :: &
+         errflg       ! CCPP error flag
+
+    ! Local
+    integer i,j
+
+    ! Initialize CCPP error handling variables
+    errmsg = ''
+    errflg = 0
+    
+    ! Sanity check
+    if (.not.oz_phys_2015) then
+       write (errmsg,'(*(a))') 'Logic error: oz_phys_2015 == .false.'
+       errflg = 1
+       return
+    endif
+
+    ! Set indices
+    do j=1,nPts
+       jindx2(j) = latsozp + 1
+       do i=1,latsozp
+          if (dlat(j) < oz_lat(i)) then
+             jindx2(j) = i
+             exit
+          endif
+       enddo
+       jindx1(j) = max(jindx2(j)-1,1)
+       jindx2(j) = min(jindx2(j),latsozp)
+       if (jindx2(j) .ne. jindx1(j)) then
+          ddy(j) = (dlat(j) - oz_lat(jindx1(j))) / (oz_lat(jindx2(j)) - oz_lat(jindx1(j)))
+       else
+          ddy(j) = 1.0
+       endif
+    enddo
+    
+  end subroutine ozphys_2015_init
+
+! ###########################################################################################
+!> \section arg_table_ozphys_2015_timestep_init Argument Table
+!! \htmlinclude ozphys_2015_timestep_init.html
+!!
+! ###########################################################################################
+  subroutine ozphys_2015_timestep_init(nPts, idate, fhour, jindx1, jindx2, latsozp, levozp, &
+       oz_coeff, timeoz, ozplin, oz_time, oz_pres, oz_lat, ddy, ozplout, errmsg, errflg)
+    ! Inputs
+    integer, intent(in) :: &
+         nPts,     & ! Horizontal dimension
+         latsozp,  & ! Number of latitudes in ozone data
+         levozp,   & ! Number of levels in ozone data
+         oz_coeff, & ! Number of coefficients in ozone data
+         timeoz      ! Number of times in ozone data
+    integer, intent(in),dimension(:) :: &
+         idate,    & ! Initial date with different size and ordering
+         jindx1,   & ! Interpolation index (low) for ozone
+         jindx2      ! Interpolation index (high) for ozone
+    real(kind_phys), intent(in) :: &
+         fhour       ! Forecast hour
+    real(kind_phys), intent(in), dimension(:) :: &
+         ddy,      & ! Interpolation high index for ozone data
+         oz_lat,   & ! Latitudes for ozone data
+         oz_pres,  & ! Levels for ozone data
+         oz_time     ! Time for ozone data
+    real(kind_phys), intent(in), dimension(:,:,:,:) :: &
+         ozplin      ! Ozone data
+
+    ! Outputs
+    real(kind_phys), intent(out), dimension(:,:,:) :: &
+         ozplout     ! Ozone forcing data
+    character(len=*), intent(out) :: &
+         errmsg      ! CCPP error message
+    integer,          intent(out) :: &
+         errflg      ! CCPP error flag
+
+    ! Local
+    integer :: idat(8),jdat(8),iday,j,j1,j2,l,nc,n1,n2,jdow,jdoy,&
+         jday,w3kindreal,w3kindint
+    real(kind_phys) :: tem, tx1, tx2, rjday
+    real(8) :: rinc(5)
+    real(4) :: rinc4(5)
+
+    ! Initialize CCPP error handling variables
+    errmsg = ''
+    errflg = 0
+
+    !
+    idat=0
+    idat(1)=idate(4)
+    idat(2)=idate(2)
+    idat(3)=idate(3)
+    idat(5)=idate(1)
+    rinc=0.
+    rinc(2)=fhour
+    call w3kind(w3kindreal,w3kindint)
+    if(w3kindreal==4) then
+       rinc4=rinc
+       CALL w3movdat(rinc4,idat,jdat)
+    else
+       CALL w3movdat(rinc,idat,jdat)
+    endif
+    !
+    jdow = 0
+    jdoy = 0
+    jday = 0
+    call w3doxdat(jdat,jdow,jdoy,jday)
+    rjday = jdoy + jdat(5) / 24.
+    IF (RJDAY < oz_time(1)) RJDAY = RJDAY + 365.
+    !
+    n2 = timeoz + 1
+    do j=2,timeoz
+       if (rjday < oz_time(j)) then
+          n2 = j
+          exit
+       endif
+    enddo
+    n1 = n2 - 1
+    
+    tx1 = (oz_time(n2) - rjday) / (oz_time(n2) - oz_time(n1))
+    tx2 = 1.0 - tx1
+    
+    if (n2 > timeoz) n2 = n2 - timeoz
+    !
+    do nc=1,oz_coeff
+       do L=1,levozp
+          do J=1,npts
+             J1  = jindx1(J)
+             J2  = jindx2(J)
+             TEM = 1.0 - ddy(J)
+             ozplout(j,L,nc) = tx1*(TEM*ozplin(J1,L,nc,n1)+ddy(J)*ozplin(J2,L,nc,n1)) & 
+                  + tx2*(TEM*ozplin(J1,L,nc,n2)+ddy(J)*ozplin(J2,L,nc,n2))
+          enddo
+       enddo
+    enddo
+
+    !
+    return
+
+  end subroutine ozphys_2015_timestep_init
+
+! ###########################################################################################  
+!> The operational GFS currently parameterizes ozone production and
+!! destruction based on monthly mean coefficients (
+!! \c ozprdlos_2015_new_sbuvO3_tclm15_nuchem.f77) provided by Naval
+!! Research Laboratory through CHEM2D chemistry model
+!! (McCormack et al. (2006) \cite mccormack_et_al_2006).
+!! \section arg_table_ozphys_2015_run Argument Table
+!! \htmlinclude ozphys_2015_run.html
+!!
+!> \section genal_ozphys_2015 GFS ozphys_2015_run General Algorithm
+!> -  This code assumes that both prsl and po3 are from bottom to top
+!!     as are all other variables.
+!> -  This code is specifically for NRL parameterization and
+!!     climatological T and O3 are in location 5 and 6 of prdout array
+!!\author June 2015 - Shrinivas Moorthi
+! ###########################################################################################
+  subroutine ozphys_2015_run ( im, levs, ko3, dt, oz, tin, po3, prsl, prdout, pl_coeff,     &
+       delp, ldiag3d, dtend, dtidx, ntoz, index_of_process_prod_loss,                       &
+       index_of_process_ozmix, index_of_process_temp, index_of_process_overhead_ozone,      &
+       con_g, errmsg, errflg)
+
+    ! Inputs
+    logical, intent(in) :: &
+         ldiag3d
+    real(kind_phys),intent(in) :: &
+         con_g
+    integer, intent(in) :: &
+         im,       & !
+         levs,     & !
+         ko3,      & !
+         pl_coeff, & !
+         ntoz,     & !
+         index_of_process_prod_loss, & !
+         index_of_process_ozmix,     & !
+         index_of_process_temp,      &
+         index_of_process_overhead_ozone
+    integer, intent(in), dimension(:,:) :: &
+         dtidx       !
+    real(kind_phys), intent(in) :: &
+         dt          !
+    real(kind_phys), intent(in), dimension(:) :: &
+         po3         !
+    real(kind_phys), intent(in), dimension(:,:) :: &
+         prsl,     & !
+         tin,      & !
+         delp        !
+    real(kind_phys), intent(in), dimension(:,:,:) :: &
+         prdout      !
+
+    ! In/Outs
+    real(kind=kind_phys), intent(inout), dimension(:,:,:) :: &
+         dtend       !
+
+    ! Outputs
+    real(kind=kind_phys), intent(inout), dimension(:,:) :: &
+         oz          !
+    character(len=*), intent(out) :: &
+         errmsg      ! CCPP error message
+    integer, intent(out) :: &
+         errflg      ! CCPP error flag
+
+    ! Locals
+    integer :: k, kmax, kmin, l, i, j
+    integer, dimension(4) :: idtend
+    logical, dimension(im) :: flg
+    real :: gravi
+    real(kind_phys) :: pmax, pmin, tem, temp
+    real(kind_phys), dimension(im) :: wk1, wk2, wk3, ozib
+    real(kind_phys), dimension(im,pl_coeff) :: prod
+    real(kind_phys), dimension(im,levs) :: ozi
+    real(kind_phys), dimension(im,levs+1) :: colo3, coloz
+
+    ! Initialize CCPP error handling variables
+    errmsg = ''
+    errflg = 0
+
+    ! Are UFS diagnostic tendencies requested? If so, set up bookeeping indices...
+    if(ldiag3d) then
+       idtend(1) = dtidx(100+ntoz,index_of_process_prod_loss)          ! was ozp1
+       idtend(2) = dtidx(100+ntoz,index_of_process_ozmix)              ! was ozp2
+       idtend(3) = dtidx(100+ntoz,index_of_process_temp)               ! was ozp3
+       idtend(4) = dtidx(100+ntoz,index_of_process_overhead_ozone)     ! was ozp4
+    else
+       idtend=0
+    endif
+
+    ! Temporaries
+    ozi = oz
+    gravi=1.0/con_g
+
+    colo3(:,levs+1) = 0.0
+    coloz(:,levs+1) = 0.0
+
+    do l=levs,1,-1
+       pmin =  1.0e10
+       pmax = -1.0e10
+
+       do i=1,im
+          wk1(i) = log(prsl(i,l))
+          pmin   = min(wk1(i), pmin)
+          pmax   = max(wk1(i), pmax)
+          prod(i,:) = 0.0
+       enddo
+       kmax = 1
+       kmin = 1
+       do k=1,ko3-1
+          if (pmin < po3(k)) kmax = k
+          if (pmax < po3(k)) kmin = k
+       enddo
+       !
+       do k=kmin,kmax
+          temp = 1.0 / (po3(k) - po3(k+1))
+          do i=1,im
+             flg(i) = .false.
+             if (wk1(i) < po3(k) .and. wk1(i) >= po3(k+1)) then
+                flg(i) = .true.
+                wk2(i) = (wk1(i) - po3(k+1)) * temp
+                wk3(i) = 1.0 - wk2(i)
+             endif
+          enddo
+          do j=1,pl_coeff
+             do i=1,im
+                if (flg(i)) then
+                   prod(i,j)  = wk2(i) * prdout(i,k,j) + wk3(i) * prdout(i,k+1,j)
+                endif
+             enddo
+          enddo
+       enddo
+
+       do j=1,pl_coeff
+          do i=1,im
+             if (wk1(i) < po3(ko3)) then
+                prod(i,j) = prdout(i,ko3,j)
+             endif
+             if (wk1(i) >= po3(1)) then
+                prod(i,j) = prdout(i,1,j)
+             endif
+          enddo
+       enddo
+       do i=1,im
+          colo3(i,l) = colo3(i,l+1) + ozi(i,l)  * delp(i,l)*gravi
+          coloz(i,l) = coloz(i,l+1) + prod(i,6) * delp(i,l)*gravi
+          prod(i,2)  = min(prod(i,2), 0.0)
+       enddo
+       do i=1,im
+          ozib(i)  = ozi(i,l)            ! no filling
+          tem      = prod(i,1) - prod(i,2) * prod(i,6) + prod(i,3) * (tin(i,l) - prod(i,5)) &
+                                                       + prod(i,4) * (colo3(i,l)-coloz(i,l))
+          oz(i,l) = (ozib(i)  + tem*dt) / (1.0 - prod(i,2)*dt)
+       enddo
+       if(idtend(1)>=1) then
+          dtend(:,l,idtend(1)) = dtend(:,l,idtend(1)) + (prod(:,1)-prod(:,2)*prod(:,6))*dt
+       endif
+       if(idtend(2)>=1) then
+          dtend(:,l,idtend(2)) = dtend(:,l,idtend(2)) + (oz(:,l) - ozib(:))
+       endif
+       if(idtend(3)>=1) then
+          dtend(:,l,idtend(3)) = dtend(:,l,idtend(3)) + prod(:,3)*(tin(:,l)-prod(:,5))*dt
+       endif
+       if(idtend(4)>=1) then
+          dtend(:,l,idtend(4)) = dtend(:,l,idtend(4)) + prod(:,4) * (colo3(:,l)-coloz(:,l))*dt
+       endif
+    enddo
+
+    return
+  end subroutine ozphys_2015_run
+!> @}
+end module ozphys_2015
diff --git a/physics/ozphys_2015.f b/physics/ozphys_2015.f
deleted file mode 100644
index 85c79f733..000000000
--- a/physics/ozphys_2015.f
+++ /dev/null
@@ -1,190 +0,0 @@
-!> \file ozphys_2015.f
-!! This file is ozone sources and sinks.
-
-
-      module ozphys_2015
-
-      contains
-
-!>\defgroup GFS_ozphys_2015 GFS Ozone Photochemistry (2015) Module
-!! This module contains the CCPP-compliant Ozone 2015 photochemistry scheme.
-!> @{
-!> \section arg_table_ozphys_2015_init Argument Table
-!! \htmlinclude ozphys_2015_init.html
-!!
-      subroutine ozphys_2015_init(oz_phys_2015, errmsg, errflg)
-
-      implicit none
-      logical,          intent(in)  :: oz_phys_2015
-      character(len=*), intent(out) :: errmsg
-      integer,          intent(out) :: errflg
-
-      ! Initialize CCPP error handling variables
-      errmsg = ''
-      errflg = 0
-
-      if (.not.oz_phys_2015) then
-        write (errmsg,'(*(a))') 'Logic error: oz_phys_2015 == .false.'
-        errflg = 1
-        return
-      endif
-
-      end subroutine ozphys_2015_init
-
-!> The operational GFS currently parameterizes ozone production and
-!! destruction based on monthly mean coefficients (
-!! \c ozprdlos_2015_new_sbuvO3_tclm15_nuchem.f77) provided by Naval
-!! Research Laboratory through CHEM2D chemistry model
-!! (McCormack et al. (2006) \cite mccormack_et_al_2006).
-!! \section arg_table_ozphys_2015_run Argument Table
-!! \htmlinclude ozphys_2015_run.html
-!!
-!> \section genal_ozphys_2015 GFS ozphys_2015_run General Algorithm
-!> -  This code assumes that both prsl and po3 are from bottom to top
-!!     as are all other variables.
-!> -  This code is specifically for NRL parameterization and
-!!     climatological T and O3 are in location 5 and 6 of prdout array
-!!\author June 2015 - Shrinivas Moorthi
-      subroutine ozphys_2015_run (                                      &
-     &     im, levs, ko3, dt, oz, tin, po3, prsl, prdout, pl_coeff,     &
-     &     delp, ldiag3d, dtend, dtidx, ntoz, index_of_process_prod_loss&
-     &     , index_of_process_ozmix, index_of_process_temp,             &
-     &     index_of_process_overhead_ozone, con_g, me, errmsg, errflg)
-!
-!
-      use machine , only : kind_phys
-      implicit none
-!
-      real(kind=kind_phys),intent(in) :: con_g
-      real :: gravi
-      integer, intent(in) :: im, levs, ko3, pl_coeff,me
-      real(kind=kind_phys), intent(in) :: po3(:),                       &
-     &                                    prsl(:,:), tin(:,:),          &
-     &                                    delp(:,:),                    &
-     &                                    prdout(:,:,:), dt
-      real(kind=kind_phys), intent(inout) :: dtend(:,:,:)
-      integer, intent(in) :: dtidx(:,:), ntoz,                          &
-     &  index_of_process_prod_loss, index_of_process_ozmix,             &
-     &  index_of_process_temp, index_of_process_overhead_ozone
-      real(kind=kind_phys), intent(inout) :: oz(im,levs)
-
-      character(len=*), intent(out) :: errmsg
-      integer,          intent(out) :: errflg
-
-      integer k,kmax,kmin,l,i,j, idtend(4)
-      logical              ldiag3d, flg(im), qdiag3d
-      real(kind=kind_phys) pmax, pmin, tem, temp
-      real(kind=kind_phys) wk1(im), wk2(im), wk3(im),prod(im,pl_coeff), &
-     &                     ozib(im), colo3(im,levs+1), coloz(im,levs+1),&
-     &                     ozi(im,levs)
-!
-      ! Initialize CCPP error handling variables
-      errmsg = ''
-      errflg = 0
-
-      if(ldiag3d) then
-         idtend(1) = dtidx(100+ntoz,index_of_process_prod_loss)          ! was ozp1
-         idtend(2) = dtidx(100+ntoz,index_of_process_ozmix)              ! was ozp2
-         idtend(3) = dtidx(100+ntoz,index_of_process_temp)               ! was ozp3
-         idtend(4) = dtidx(100+ntoz,index_of_process_overhead_ozone)     ! was ozp4
-      else
-         idtend=0
-      endif
-
-!ccpp: save input oz in ozi
-      ozi = oz
-      gravi=1.0/con_g
-
-        colo3(:,levs+1) = 0.0
-        coloz(:,levs+1) = 0.0
-!
-      do l=levs,1,-1
-        pmin =  1.0e10
-        pmax = -1.0e10
-!
-        do i=1,im
-          wk1(i) = log(prsl(i,l))
-          pmin   = min(wk1(i), pmin)
-          pmax   = max(wk1(i), pmax)
-          prod(i,:) = 0.0
-        enddo
-        kmax = 1
-        kmin = 1
-        do k=1,ko3-1
-          if (pmin < po3(k)) kmax = k
-          if (pmax < po3(k)) kmin = k
-        enddo
-!
-        do k=kmin,kmax
-          temp = 1.0 / (po3(k) - po3(k+1))
-          do i=1,im
-            flg(i) = .false.
-            if (wk1(i) < po3(k) .and. wk1(i) >= po3(k+1)) then
-              flg(i) = .true.
-              wk2(i) = (wk1(i) - po3(k+1)) * temp
-              wk3(i) = 1.0 - wk2(i)
-            endif
-          enddo
-          do j=1,pl_coeff
-            do i=1,im
-              if (flg(i)) then
-                prod(i,j)  = wk2(i) * prdout(i,k,j)
-     &                     + wk3(i) * prdout(i,k+1,j)
-              endif
-            enddo
-          enddo
-        enddo
-!
-        do j=1,pl_coeff
-          do i=1,im
-            if (wk1(i) < po3(ko3)) then
-              prod(i,j) = prdout(i,ko3,j)
-            endif
-            if (wk1(i) >= po3(1)) then
-              prod(i,j) = prdout(i,1,j)
-            endif
-          enddo
-        enddo
-        do i=1,im
-          colo3(i,l) = colo3(i,l+1) + ozi(i,l)  * delp(i,l)*gravi
-          coloz(i,l) = coloz(i,l+1) + prod(i,6) * delp(i,l)*gravi
-          prod(i,2)  = min(prod(i,2), 0.0)
-        enddo
-!       write(1000+me,*) ' colo3=',colo3(1,l),' coloz=',coloz(1,l)
-!    &,' l=',l
-        do i=1,im
-          ozib(i)  = ozi(i,l)            ! no filling
-          tem      = prod(i,1) - prod(i,2) * prod(i,6)
-     &             + prod(i,3) * (tin(i,l) - prod(i,5))
-     &             + prod(i,4) * (colo3(i,l)-coloz(i,l))
-
-!     if (me .eq. 0) print *,'ozphys_2015 tem=',tem,' prod=',prod(i,:)
-!    &,' ozib=',ozib(i),' l=',l,' tin=',tin(i,l),'colo3=',colo3(i,l+1)
-
-!ccpp            ozo(i,l) = (ozib(i)  + tem*dt) / (1.0 - prod(i,2)*dt)
-          oz(i,l) = (ozib(i)  + tem*dt) / (1.0 - prod(i,2)*dt)
-        enddo
-        if(idtend(1)>=1) then
-           dtend(:,l,idtend(1)) = dtend(:,l,idtend(1)) + ! was ozp1
-     &          (prod(:,1)-prod(:,2)*prod(:,6))*dt
-        endif
-        if(idtend(2)>=1) then
-           dtend(:,l,idtend(2)) = dtend(:,l,idtend(2)) + ! was ozp2
-     &          (oz(:,l) - ozib(:))
-        endif
-        if(idtend(3)>=1) then
-           dtend(:,l,idtend(3)) = dtend(:,l,idtend(3)) + ! was ozp3
-     &          prod(:,3)*(tin(:,l)-prod(:,5))*dt
-        endif
-        if(idtend(4)>=1) then
-           dtend(:,l,idtend(4)) = dtend(:,l,idtend(4)) + ! was ozp4
-     &       prod(:,4) * (colo3(:,l)-coloz(:,l))*dt
-        endif
-      enddo                                ! vertical loop
-!
-      return
-      end subroutine ozphys_2015_run
-
-!> @}
-
-      end module ozphys_2015
diff --git a/physics/ozphys_2015.meta b/physics/ozphys_2015.meta
index 8bce7defe..59621b386 100644
--- a/physics/ozphys_2015.meta
+++ b/physics/ozphys_2015.meta
@@ -7,6 +7,20 @@
 [ccpp-arg-table]
   name = ozphys_2015_init
   type = scheme
+[nPts]
+  standard_name = horizontal_dimension
+  long_name = horizontal dimension
+  units = count
+  dimensions = ()
+  type = integer
+  intent = in
+[latsozp]
+  standard_name = number_of_latitudes_in_ozone_data
+  long_name = number of latitude in ozone data
+  units = count
+  dimensions = ()
+  type = integer
+  intent = in
 [oz_phys_2015]
   standard_name = flag_for_nrl_2015_ozone_scheme
   long_name = flag for new (2015) ozone physics
@@ -14,6 +28,176 @@
   dimensions = ()
   type = logical
   intent = in
+[oz_lat]
+  standard_name = ozone_data_latitude
+  long_name = ozone data latitude
+  units = deg
+  dimensions = (number_of_latitudes_in_ozone_data)
+  type = real
+  kind = kind_phys
+  intent = in
+[dlat]
+  standard_name = latitude_in_degree
+  long_name = latitude in degree north
+  units = degree_north
+  dimensions = (horizontal_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[jindx1]
+  standard_name = lower_latitude_index_of_ozone_forcing_for_interpolation
+  long_name = interpolation low index for ozone
+  units = index
+  dimensions = (horizontal_dimension)
+  type = integer
+  intent = out
+[jindx2]
+  standard_name = upper_latitude_index_of_ozone_forcing_for_interpolation
+  long_name = interpolation high index for ozone
+  units = index
+  dimensions = (horizontal_dimension)
+  type = integer
+  intent = out
+[ddy]
+  standard_name = latitude_interpolation_weight_for_ozone_forcing
+  long_name = interpolation high index for ozone
+  units = none
+  dimensions = (horizontal_dimension)
+  type = real
+  kind = kind_phys
+  intent = out
+[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
+
+########################################################################
+[ccpp-arg-table]
+  name = ozphys_2015_timestep_init
+  type = scheme
+[nPts]
+  standard_name = horizontal_dimension
+  long_name = horizontal dimension
+  units = count
+  dimensions = ()
+  type = integer
+  intent = in
+[idate]
+  standard_name = date_and_time_at_model_initialization_in_united_states_order
+  long_name = initial date with different size and ordering
+  units = none
+  dimensions = (4)
+  type = integer
+  intent = in
+[fhour]
+  standard_name = forecast_time
+  long_name = current forecast time
+  units = h
+  dimensions = ()
+  type = real
+  kind = kind_phys
+  intent = in
+[jindx1]
+  standard_name = lower_latitude_index_of_ozone_forcing_for_interpolation
+  long_name = interpolation low index for ozone
+  units = index
+  dimensions = (horizontal_dimension)
+  type = integer
+  intent = in
+[jindx2]
+  standard_name = upper_latitude_index_of_ozone_forcing_for_interpolation
+  long_name = interpolation high index for ozone
+  units = index
+  dimensions = (horizontal_dimension)
+  type = integer
+  intent = in
+[latsozp]
+  standard_name = number_of_latitudes_in_ozone_data
+  long_name = number of latitude in ozone data
+  units = count
+  dimensions = ()
+  type = integer
+  intent = in
+[levozp]
+  standard_name = number_of_levels_in_ozone_data
+  long_name = number of levels in ozone data
+  units = count
+  dimensions = ()
+  type = integer
+  intent = in
+[oz_coeff]
+  standard_name = number_of_coefficients_in_ozone_data
+  long_name = number of coefficients in ozone data
+  units = count
+  dimensions = ()
+  type = integer
+  intent = in
+[timeoz]
+  standard_name = number_of_times_in_ozone_data
+  long_name = number of times in ozone data
+  units = count
+  dimensions = ()
+  type = integer
+  intent = in
+[ozplin]
+  standard_name = ozone_data
+  long_name = ozone data
+  units = 1
+  dimensions = (number_of_latitudes_in_ozone_data,number_of_levels_in_ozone_data,number_of_coefficients_in_ozone_data,number_of_times_in_ozone_data)
+  type = real
+  kind = kind_phys
+  intent = in
+[oz_time]
+  standard_name = ozone_data_time
+  long_name = ozone data time
+  units = none
+  dimensions = (13)
+  type = real
+  kind = kind_phys
+  intent = in
+[oz_pres]
+  standard_name = ozone_data_level_pressure
+  long_name = ozone data level pressure
+  units = Pa
+  dimensions = (number_of_levels_in_ozone_data)
+  type = real
+  kind = kind_phys
+  intent = in
+[oz_lat]
+  standard_name = ozone_data_latitude
+  long_name = ozone data latitude
+  units = deg
+  dimensions = (number_of_latitudes_in_ozone_data)
+  type = real
+  kind = kind_phys
+  intent = in
+[ddy]
+  standard_name = latitude_interpolation_weight_for_ozone_forcing
+  long_name = interpolation high index for ozone
+  units = none
+  dimensions = (horizontal_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[ozplout]
+  standard_name = ozone_forcing
+  long_name = ozone forcing data
+  units = mixed
+  dimensions = (horizontal_dimension,number_of_levels_in_ozone_data,number_of_coefficients_in_ozone_data)
+  type = real
+  kind = kind_phys
+  intent = out
 [errmsg]
   standard_name = ccpp_error_message
   long_name = error message for error handling in CCPP
@@ -49,7 +233,7 @@
   type = integer
   intent = in
 [ko3]
-  standard_name = vertical_dimension_of_ozone_forcing_data
+  standard_name = number_of_levels_in_ozone_data
   long_name = number of vertical layers in ozone forcing data
   units = count
   dimensions = ()
@@ -80,10 +264,10 @@
   kind = kind_phys
   intent = in
 [po3]
-  standard_name = natural_log_of_ozone_forcing_data_pressure_levels
+  standard_name = natural_log_of_ozone_data_pressure_levels
   long_name = natural log of ozone forcing data pressure levels
   units = 1
-  dimensions = (vertical_dimension_of_ozone_forcing_data)
+  dimensions = (number_of_levels_in_ozone_data)
   type = real
   kind = kind_phys
   intent = in
@@ -99,14 +283,14 @@
   standard_name = ozone_forcing
   long_name = ozone forcing data
   units = mixed
-  dimensions = (horizontal_loop_extent,vertical_dimension_of_ozone_forcing_data,number_of_coefficients_in_ozone_forcing_data)
+  dimensions = (horizontal_loop_extent,number_of_levels_in_ozone_data,number_of_coefficients_in_ozone_data)
   type = real
   kind = kind_phys
   intent = in
 [pl_coeff]
-  standard_name = number_of_coefficients_in_ozone_forcing_data
+  standard_name = number_of_coefficients_in_ozone_data
   long_name = number of coefficients in ozone forcing data
-  units = index
+  units = count
   dimensions = ()
   type = integer
   intent = in
@@ -183,13 +367,6 @@
   type = real
   kind = kind_phys
   intent = in
-[me]
-  standard_name = mpi_rank
-  long_name = rank of the current MPI task
-  units = index
-  dimensions = ()
-  type = integer
-  intent = in
 [errmsg]
   standard_name = ccpp_error_message
   long_name = error message for error handling in CCPP
diff --git a/physics/radiation_gases.f b/physics/radiation_gases.f
index ccc3b598a..5f017598f 100644
--- a/physics/radiation_gases.f
+++ b/physics/radiation_gases.f
@@ -142,9 +142,6 @@
       module module_radiation_gases      
       use machine,           only : kind_phys, kind_io4
       use funcphys,          only : fpkapx
-      use ozne_def,          only : JMR => latsozc, LOZ => levozc,      &
-     &                              blte => blatc, dlte=> dphiozc,      &
-     &                              timeozc => timeozc
       use module_iounitdef,  only : NIO3CLM, NICO2CN
 !
       implicit   none
@@ -233,7 +230,7 @@ module module_radiation_gases
 !>\section gas_init_gen gas_init General Algorithm
 !-----------------------------------
       subroutine gas_init( me, co2usr_file, co2cyc_file, ico2flg,       &
-     &     ictmflg, ioznflg, con_pi, errflg, errmsg)
+     &     ictmflg, ioznflg, con_pi, JMR, LOZ, timeozc, errflg, errmsg)
 
 !  ===================================================================  !
 !                                                                       !
@@ -283,8 +280,10 @@ subroutine gas_init( me, co2usr_file, co2cyc_file, ico2flg,       &
 
 !  ---  inputs:
       integer, intent(in) :: me, ictmflg, ioznflg, ico2flg
+      integer, intent(in) :: JMR, LOZ, timeozc
       character(len=26),intent(in) :: co2usr_file,co2cyc_file
       real(kind=kind_phys), intent(in) :: con_pi
+
 !  ---  output:
       character(len=*), intent(out) :: errmsg
       integer,          intent(out) :: errflg
@@ -1115,7 +1114,8 @@ end subroutine getgases
 !!                   ratio (g/g)
 !>\section getozn_gen getozn General Algorithm
 !-----------------------------------
-      subroutine getozn( prslk,xlat, IMAX, LM, top_at_1, o3mmr)
+      subroutine getozn( prslk,xlat, IMAX, LM, top_at_1, JMR, LOZ, blte,&
+     &     dlte, o3mmr)
 
 !  ===================================================================  !
 !                                                                       !
@@ -1144,7 +1144,8 @@ subroutine getozn( prslk,xlat, IMAX, LM, top_at_1, o3mmr)
       implicit none
 
 !  ---  inputs:
-      integer,  intent(in) :: IMAX, LM
+      integer,  intent(in) :: IMAX, LM, JMR, LOZ
+      real(kind=kind_phys), intent(in) :: blte, dlte
       logical,  intent(in) :: top_at_1
       real (kind=kind_phys), intent(in) :: prslk(:,:), xlat(:)
 

From 70b9d7e5ddaf8a4308415ea601a1f8366f62e9d1 Mon Sep 17 00:00:00 2001
From: dustinswales <dswales@ucar.edu>
Date: Thu, 25 May 2023 10:27:12 -0600
Subject: [PATCH 040/115] RRTMGP changes for refactored NRL ozone physics.

---
 physics/GFS_rrtmgp_pre.F90    | 13 +++++++---
 physics/GFS_rrtmgp_pre.meta   | 30 ++++++++++++++++++++++
 physics/GFS_rrtmgp_setup.F90  | 13 +++++-----
 physics/GFS_rrtmgp_setup.meta | 21 ++++++++++++++++
 physics/ozphys_2015.F90       | 47 ++++++++++++++++++-----------------
 5 files changed, 91 insertions(+), 33 deletions(-)

diff --git a/physics/GFS_rrtmgp_pre.F90 b/physics/GFS_rrtmgp_pre.F90
index 009eb8c38..e9cbc3d23 100644
--- a/physics/GFS_rrtmgp_pre.F90
+++ b/physics/GFS_rrtmgp_pre.F90
@@ -117,7 +117,7 @@ subroutine GFS_rrtmgp_pre_run(me, nCol, nLev, i_o3, doSWrad, doLWrad, fhswr, fhl
        vmr_n2o, vmr_co2, tsfg, tsfa, qs_lay, q_lay, tv_lay,                                 &
        relhum, deltaZ, deltaZc, deltaP, active_gases_array,                                 &
        tsfc_radtime, coszen, coszdg, top_at_1, iSFC, iTOA, nDay, idxday, semis,             &
-       sfc_emiss_byband, ico2, con_pi, errmsg, errflg)
+       sfc_emiss_byband, ico2, latsozp, levozp, blatc, dphiozc, con_pi, errmsg, errflg)
     
     ! Inputs   
     integer, intent(in)    :: &
@@ -125,13 +125,17 @@ subroutine GFS_rrtmgp_pre_run(me, nCol, nLev, i_o3, doSWrad, doLWrad, fhswr, fhl
          nCol,              & ! Number of horizontal grid points
          nLev,              & ! Number of vertical layers
          ico2,              & ! Flag for co2 radiation scheme 
-         i_o3                 ! Index into tracer array for ozone
+         i_o3,              & ! Index into tracer array for ozone
+         latsozp,           & !
+         levozp
     logical, intent(in) :: &
     	 doSWrad,           & ! Call SW radiation?
     	 doLWrad              ! Call LW radiation
     real(kind_phys), intent(in) :: &
          fhswr,             & ! Frequency of SW radiation call.
-         fhlwr                ! Frequency of LW radiation call.
+         fhlwr,             & ! Frequency of LW radiation call.
+         blatc,             & !
+         dphiozc
     real(kind_phys), intent(in) :: &
          con_g,             & ! Physical constant: gravitational constant
          con_rd,            & ! Physical constant: gas-constant for dry air
@@ -350,7 +354,8 @@ subroutine GFS_rrtmgp_pre_run(me, nCol, nLev, i_o3, doSWrad, doLWrad, fhswr, fhl
        enddo
     ! OR Use climatological ozone data
     else                               
-       call getozn (prslk(1:NCOL,:), xlat, nCol, nLev, top_at_1, o3_lay)
+       call getozn (prslk(1:NCOL,:), xlat, nCol, nLev, top_at_1, latsozp, levozp, blatc,    &
+            dphiozc, o3_lay)
     endif
 
     ! #######################################################################################
diff --git a/physics/GFS_rrtmgp_pre.meta b/physics/GFS_rrtmgp_pre.meta
index abb07b825..47980b513 100644
--- a/physics/GFS_rrtmgp_pre.meta
+++ b/physics/GFS_rrtmgp_pre.meta
@@ -503,6 +503,36 @@
   dimensions = (horizontal_loop_extent)
   type = integer
   intent = inout
+[latsozp]
+  standard_name = number_of_latitudes_in_ozone_data
+  long_name = number of latitude in ozone data
+  units = count
+  dimensions = ()
+  type = integer
+  intent = in
+[levozp]
+  standard_name = number_of_levels_in_ozone_data
+  long_name = number of levels in ozone data
+  units = count
+  dimensions = ()
+  type = integer
+  intent = in
+[dphiozc]
+  standard_name = ozone_data_parameter_1
+  long_name = ozone data parameter 1
+  units = none
+  dimensions = ()
+  type = real
+  kind = kind_phys
+  intent = in
+[blatc]
+  standard_name = ozone_data_parameter_2
+  long_name = ozone data parameter 2
+  units = none
+  dimensions = ()
+  type = real
+  kind = kind_phys
+  intent = in
 [errmsg]
   standard_name = ccpp_error_message
   long_name = error message for error handling in CCPP
diff --git a/physics/GFS_rrtmgp_setup.F90 b/physics/GFS_rrtmgp_setup.F90
index 76db14279..7b5479e60 100644
--- a/physics/GFS_rrtmgp_setup.F90
+++ b/physics/GFS_rrtmgp_setup.F90
@@ -37,9 +37,10 @@ module GFS_rrtmgp_setup
   subroutine GFS_rrtmgp_setup_init(do_RRTMGP, imp_physics, imp_physics_fer_hires,        &
        imp_physics_gfdl, imp_physics_thompson, imp_physics_wsm6, imp_physics_zhao_carr,  &
        imp_physics_zhao_carr_pdf, imp_physics_mg,  si, levr, ictm, isol, ico2, iaer,     &
-       ntcw, ntoz, iovr, isubc_sw, isubc_lw, lalw1bd, idate, me, aeros_file,             &
-       iaermdl, iaerflg, con_pi, con_t0c, con_c, con_boltz, con_plnk, solar_file,        &
-       con_solr_2008, con_solr_2002, co2usr_file, co2cyc_file, ipsd0, errmsg, errflg)
+       ntcw, ntoz, iovr, latsozp, levozp, timeozp, isubc_sw, isubc_lw, lalw1bd, idate,   &
+       me, aeros_file, iaermdl, iaerflg, con_pi, con_t0c, con_c, con_boltz, con_plnk,    &
+       solar_file, con_solr_2008, con_solr_2002, co2usr_file, co2cyc_file, ipsd0,        &
+       errmsg, errflg)
 
     ! Inputs
     logical, intent(in) :: do_RRTMGP
@@ -57,8 +58,7 @@ subroutine GFS_rrtmgp_setup_init(do_RRTMGP, imp_physics, imp_physics_fer_hires,
     real(kind_phys), dimension(:), intent(in) :: &
          si
     integer, intent(in) :: levr, ictm, isol, ico2, iaer, & 
-         ntcw, ntoz, iovr, isubc_sw, isubc_lw,  &
-         me
+         ntcw, ntoz, iovr, isubc_sw, isubc_lw, latsozp, levozp, timeozp, me
     logical, intent(in) :: &
          lalw1bd
     integer, intent(in), dimension(:) :: &
@@ -129,7 +129,8 @@ subroutine GFS_rrtmgp_setup_init(do_RRTMGP, imp_physics, imp_physics_fer_hires,
     call sol_init ( me, isol, solar_file, con_solr_2008, con_solr_2002, con_pi )
     call aer_init ( levr, me, iaermdl, iaerflg, lalw1bd, aeros_file, con_pi, con_t0c,    &
          con_c, con_boltz, con_plnk, errflg, errmsg)
-    call gas_init ( me, co2usr_file, co2cyc_file, ico2, ictm, ntoz, con_pi, errflg, errmsg )
+    call gas_init ( me, co2usr_file, co2cyc_file, ico2, ictm, ntoz, con_pi, latsozp,     &
+         levozp, timeozp, errflg, errmsg )
 
     if ( me == 0 ) then
        print *,' return from rad_initialize (GFS_rrtmgp_setup_init) - after calling radinit'
diff --git a/physics/GFS_rrtmgp_setup.meta b/physics/GFS_rrtmgp_setup.meta
index c4f7cfaa5..567294d4a 100644
--- a/physics/GFS_rrtmgp_setup.meta
+++ b/physics/GFS_rrtmgp_setup.meta
@@ -266,6 +266,27 @@
   dimensions =  ()
   type = integer
   intent = inout
+[levozp]
+  standard_name = number_of_levels_in_ozone_data
+  long_name = number of levels in ozone data
+  units = count
+  dimensions = ()
+  type = integer
+  intent = in
+[timeozp]
+  standard_name = number_of_times_in_ozone_data
+  long_name = number of times in ozone data
+  units = count
+  dimensions = ()
+  type = integer
+  intent = in
+[latsozp]
+  standard_name = number_of_latitudes_in_ozone_data
+  long_name = number of latitude in ozone data
+  units = count
+  dimensions = ()
+  type = integer
+  intent = in
 [iaermdl]
   standard_name = control_for_aerosol_radiation_scheme
   long_name = control of aerosol scheme in radiation
diff --git a/physics/ozphys_2015.F90 b/physics/ozphys_2015.F90
index 17f2178a4..4e73a5262 100644
--- a/physics/ozphys_2015.F90
+++ b/physics/ozphys_2015.F90
@@ -83,7 +83,7 @@ subroutine ozphys_2015_timestep_init(nPts, idate, fhour, jindx1, jindx2, latsozp
     integer, intent(in) :: &
          nPts,     & ! Horizontal dimension
          latsozp,  & ! Number of latitudes in ozone data
-         levozp,   & ! Number of levels in ozone data
+         levozp,   & ! Number of vertical layers in ozone data
          oz_coeff, & ! Number of coefficients in ozone data
          timeoz      ! Number of times in ozone data
     integer, intent(in),dimension(:) :: &
@@ -188,6 +188,7 @@ end subroutine ozphys_2015_timestep_init
 !> -  This code is specifically for NRL parameterization and
 !!     climatological T and O3 are in location 5 and 6 of prdout array
 !!\author June 2015 - Shrinivas Moorthi
+!!\author May 2023  - Dustin Swales
 ! ###########################################################################################
   subroutine ozphys_2015_run ( im, levs, ko3, dt, oz, tin, po3, prsl, prdout, pl_coeff,     &
        delp, ldiag3d, dtend, dtidx, ntoz, index_of_process_prod_loss,                       &
@@ -196,43 +197,43 @@ subroutine ozphys_2015_run ( im, levs, ko3, dt, oz, tin, po3, prsl, prdout, pl_c
 
     ! Inputs
     logical, intent(in) :: &
-         ldiag3d
+         ldiag3d                         ! Flag to output GFS diagnostic tendencies
     real(kind_phys),intent(in) :: &
-         con_g
+         con_g                           ! Physical constant: Gravitational acceleration (ms-2)
     integer, intent(in) :: &
-         im,       & !
-         levs,     & !
-         ko3,      & !
-         pl_coeff, & !
-         ntoz,     & !
-         index_of_process_prod_loss, & !
-         index_of_process_ozmix,     & !
-         index_of_process_temp,      &
-         index_of_process_overhead_ozone
+         im,                           & ! Horizontal dimension
+         levs,                         & ! Number of vertical layers
+         ko3,                          & ! Number of vertical layers in ozone forcing data
+         pl_coeff,                     & ! Number of coefficients in ozone forcing data
+         ntoz,                         & ! Index for ozone mixing ratio
+         index_of_process_prod_loss,   & ! Index for process in diagnostic tendency output
+         index_of_process_ozmix,       & ! Index for process in diagnostic tendency output
+         index_of_process_temp,        & ! Index for process in diagnostic tendency output
+         index_of_process_overhead_ozone ! Index for process in diagnostic tendency output
     integer, intent(in), dimension(:,:) :: &
-         dtidx       !
+         dtidx                           ! Bookkeeping indices for GFS diagnostic tendencies
     real(kind_phys), intent(in) :: &
-         dt          !
+         dt                              ! Physics timestep (seconds)
     real(kind_phys), intent(in), dimension(:) :: &
-         po3         !
+         po3                             ! Natural log of ozone forcing data pressure levels
     real(kind_phys), intent(in), dimension(:,:) :: &
-         prsl,     & !
-         tin,      & !
-         delp        !
+         prsl,                         & ! Air-pressure (Pa)
+         tin,                          & ! Temperature of new-state (K)
+         delp                            ! Difference between mid-layer pressures (Pa)
     real(kind_phys), intent(in), dimension(:,:,:) :: &
-         prdout      !
+         prdout                          ! Ozone forcing data
 
     ! In/Outs
     real(kind=kind_phys), intent(inout), dimension(:,:,:) :: &
-         dtend       !
+         dtend                           ! Diagnostic tendencies for state variables
 
     ! Outputs
     real(kind=kind_phys), intent(inout), dimension(:,:) :: &
-         oz          !
+         oz                              ! Ozone concentration updated by physics
     character(len=*), intent(out) :: &
-         errmsg      ! CCPP error message
+         errmsg                          ! CCPP error message
     integer, intent(out) :: &
-         errflg      ! CCPP error flag
+         errflg                          ! CCPP error flag
 
     ! Locals
     integer :: k, kmax, kmin, l, i, j

From 6ff8689d3e1ed9ccaec7c09db6d8b12f633e59c1 Mon Sep 17 00:00:00 2001
From: dustinswales <dswales@ucar.edu>
Date: Thu, 25 May 2023 11:34:29 -0600
Subject: [PATCH 041/115] Revert change to CI test from NCAR->UWM merge

---
 .github/workflows/ci_fv3_ccpp_prebuild.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/ci_fv3_ccpp_prebuild.yml b/.github/workflows/ci_fv3_ccpp_prebuild.yml
index b23c9977e..a5c2f8092 100644
--- a/.github/workflows/ci_fv3_ccpp_prebuild.yml
+++ b/.github/workflows/ci_fv3_ccpp_prebuild.yml
@@ -24,7 +24,7 @@ jobs:
       run: echo "GIT_REMOTE_HASH=`git rev-parse HEAD`" >> $GITHUB_ENV
 
     - name: Checkout latest fv3atm
-      run: git clone https://github.com/NCAR/fv3atm.git
+      run: git clone https://github.com/NOAA-EMC/fv3atm.git
 
     - name: Initialize submodules
       run: |

From 3682e476db2e1899f58f1ae4ace8996438ba6a3f Mon Sep 17 00:00:00 2001
From: Anders Jensen <anders.jensen@anjensen-lt.fsl.noaa.gov>
Date: Wed, 14 Jun 2023 13:23:10 -0600
Subject: [PATCH 042/115] Rollback changes to rain evaporation

---
 physics/module_mp_thompson.F90 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/physics/module_mp_thompson.F90 b/physics/module_mp_thompson.F90
index 9ef110b63..38ee79dfa 100644
--- a/physics/module_mp_thompson.F90
+++ b/physics/module_mp_thompson.F90
@@ -3712,13 +3712,13 @@ subroutine mp_thompson (qv1d, qc1d, qi1d, qr1d, qs1d, qg1d, ni1d,    &
           lamr = 1./ilamr(k)
 !>  - Rapidly eliminate near zero values when low humidity (<95%)
           if (qv(k)/qvs(k) .lt. 0.95 .AND. rr(k)*orho.le.1.E-8) then
-          prv_rev(k) = rr(k)*odts
+          prv_rev(k) = rr(k)*orho*odts
           else
           prv_rev(k) = t1_evap*diffu(k)*(-ssatw(k))*N0_r(k)*rvs &
               * (t1_qr_ev*ilamr(k)**cre(10) &
               + t2_qr_ev*vsc2(k)*rhof2(k)*((lamr+0.5*fv_r)**(-cre(11))))
-          rate_max = MIN((rr(k)*odts), (qvs(k)-qv(k))*rho(k)*odts)
-          prv_rev(k) = MIN(DBLE(rate_max*orho), prv_rev(k)*orho)
+          rate_max = MIN((rr(k)*orho*odts), (qvs(k)-qv(k))*odts)
+          prv_rev(k) = MIN(DBLE(rate_max), prv_rev(k)*orho)
 
 !..TEST: G. Thompson  10 May 2013
 !>  - Reduce the rain evaporation in same places as melting graupel occurs.

From 9859339985948e4d1fe2c721f7fab7830101dd72 Mon Sep 17 00:00:00 2001
From: dustinswales <dswales@ucar.edu>
Date: Thu, 15 Jun 2023 11:17:35 -0600
Subject: [PATCH 043/115] Some changes

---
 physics/GFS_rrtmg_pre.F90   |  6 +++---
 physics/GFS_rrtmg_pre.meta  | 12 ++++++------
 physics/GFS_rrtmgp_pre.F90  |  8 ++++----
 physics/GFS_rrtmgp_pre.meta | 12 ++++++------
 physics/ozphys_2015.F90     |  7 ++++---
 physics/ozphys_2015.meta    |  8 --------
 6 files changed, 23 insertions(+), 30 deletions(-)

diff --git a/physics/GFS_rrtmg_pre.F90 b/physics/GFS_rrtmg_pre.F90
index ae88ca0fc..cf9bbb6aa 100644
--- a/physics/GFS_rrtmg_pre.F90
+++ b/physics/GFS_rrtmg_pre.F90
@@ -45,7 +45,7 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp, lextop,&
         gasvmr_ccl4,  gasvmr_cfc113, aerodp,ext550, clouds6, clouds7, clouds8, &
         clouds9, cldsa, cldfra, cldfra2d, lwp_ex,iwp_ex, lwp_fc,iwp_fc,        &
         faersw1, faersw2, faersw3, faerlw1, faerlw2, faerlw3, alpha,           &
-        aero_dir_fdb, fdb_coef, spp_wts_rad, spp_rad, ico2, latsozp, levozp,   &
+        aero_dir_fdb, fdb_coef, spp_wts_rad, spp_rad, ico2, latsozc, levozc,   &
         blatc, dphiozc, errmsg, errflg)
 
       use machine,                   only: kind_phys
@@ -103,7 +103,7 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp, lextop,&
                                            imp_physics_nssl,                   &
                                            imp_physics_fer_hires,              &
                                            yearlen, icloud, iaermdl, iaerflg,  &
-                                           latsozp, levozp
+                                           latsozc, levozc
 
       integer,              intent(in)  ::                                     &
          iovr,                             & ! choice of cloud-overlap method
@@ -431,7 +431,7 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp, lextop,&
           enddo
         enddo
       else                                ! climatological ozone
-        call getozn (prslk1, xlat, im, lmk, top_at_1, latsozp, levozp, blatc, dphiozc, olyr)
+        call getozn (prslk1, xlat, im, lmk, top_at_1, latsozc, levozc, blatc, dphiozc, olyr)
       endif                               ! end_if_ntoz
 
 !> - Call coszmn(), to compute cosine of zenith angle (only when SW is called)
diff --git a/physics/GFS_rrtmg_pre.meta b/physics/GFS_rrtmg_pre.meta
index 88363ef18..3b4d35c6d 100644
--- a/physics/GFS_rrtmg_pre.meta
+++ b/physics/GFS_rrtmg_pre.meta
@@ -1496,16 +1496,16 @@
   dimensions = ()
   type = integer
   intent = in
-[latsozp]
-  standard_name = number_of_latitudes_in_ozone_data
-  long_name = number of latitude in ozone data
+[latsozc]
+  standard_name = number_of_latitudes_in_ozone_climotology_data
+  long_name = number of latitude in ozone climotology data
   units = count
   dimensions = ()
   type = integer
   intent = in
-[levozp]
-  standard_name = number_of_levels_in_ozone_data
-  long_name = number of levels in ozone data
+[levozc]
+  standard_name = number_of_levels_in_ozone_climotology_data
+  long_name = number of levels in ozone climotology data
   units = count
   dimensions = ()
   type = integer
diff --git a/physics/GFS_rrtmgp_pre.F90 b/physics/GFS_rrtmgp_pre.F90
index e9cbc3d23..dd72a6a1c 100644
--- a/physics/GFS_rrtmgp_pre.F90
+++ b/physics/GFS_rrtmgp_pre.F90
@@ -117,7 +117,7 @@ subroutine GFS_rrtmgp_pre_run(me, nCol, nLev, i_o3, doSWrad, doLWrad, fhswr, fhl
        vmr_n2o, vmr_co2, tsfg, tsfa, qs_lay, q_lay, tv_lay,                                 &
        relhum, deltaZ, deltaZc, deltaP, active_gases_array,                                 &
        tsfc_radtime, coszen, coszdg, top_at_1, iSFC, iTOA, nDay, idxday, semis,             &
-       sfc_emiss_byband, ico2, latsozp, levozp, blatc, dphiozc, con_pi, errmsg, errflg)
+       sfc_emiss_byband, ico2, latsozc, levozc, blatc, dphiozc, con_pi, errmsg, errflg)
     
     ! Inputs   
     integer, intent(in)    :: &
@@ -126,8 +126,8 @@ subroutine GFS_rrtmgp_pre_run(me, nCol, nLev, i_o3, doSWrad, doLWrad, fhswr, fhl
          nLev,              & ! Number of vertical layers
          ico2,              & ! Flag for co2 radiation scheme 
          i_o3,              & ! Index into tracer array for ozone
-         latsozp,           & !
-         levozp
+         latsozc,           & !
+         levozc
     logical, intent(in) :: &
     	 doSWrad,           & ! Call SW radiation?
     	 doLWrad              ! Call LW radiation
@@ -354,7 +354,7 @@ subroutine GFS_rrtmgp_pre_run(me, nCol, nLev, i_o3, doSWrad, doLWrad, fhswr, fhl
        enddo
     ! OR Use climatological ozone data
     else                               
-       call getozn (prslk(1:NCOL,:), xlat, nCol, nLev, top_at_1, latsozp, levozp, blatc,    &
+       call getozn (prslk(1:NCOL,:), xlat, nCol, nLev, top_at_1, latsozc, levozc, blatc,    &
             dphiozc, o3_lay)
     endif
 
diff --git a/physics/GFS_rrtmgp_pre.meta b/physics/GFS_rrtmgp_pre.meta
index 47980b513..1a96eee1b 100644
--- a/physics/GFS_rrtmgp_pre.meta
+++ b/physics/GFS_rrtmgp_pre.meta
@@ -503,16 +503,16 @@
   dimensions = (horizontal_loop_extent)
   type = integer
   intent = inout
-[latsozp]
-  standard_name = number_of_latitudes_in_ozone_data
-  long_name = number of latitude in ozone data
+[latsozc]
+  standard_name = number_of_latitudes_in_ozone_climotology_data
+  long_name = number of latitude in ozone climotology data
   units = count
   dimensions = ()
   type = integer
   intent = in
-[levozp]
-  standard_name = number_of_levels_in_ozone_data
-  long_name = number of levels in ozone data
+[levozc]
+  standard_name = number_of_levels_in_ozone_climotology_data
+  long_name = number of levels in ozone climotology data
   units = count
   dimensions = ()
   type = integer
diff --git a/physics/ozphys_2015.F90 b/physics/ozphys_2015.F90
index 4e73a5262..fda87611c 100644
--- a/physics/ozphys_2015.F90
+++ b/physics/ozphys_2015.F90
@@ -3,7 +3,7 @@
 !!
 ! ###########################################################################################
 module ozphys_2015
-  use machine , only : kind_phys
+  use machine, only : kind_phys, kind_dbl_prec, kind_sngl_prec
   implicit none
   public ozphys_2015_init, ozphys_2015_timestep_init, ozphys_2015_run
 contains
@@ -78,7 +78,7 @@ end subroutine ozphys_2015_init
 !!
 ! ###########################################################################################
   subroutine ozphys_2015_timestep_init(nPts, idate, fhour, jindx1, jindx2, latsozp, levozp, &
-       oz_coeff, timeoz, ozplin, oz_time, oz_pres, oz_lat, ddy, ozplout, errmsg, errflg)
+       oz_coeff, timeoz, ozplin, oz_time, oz_lat, ddy, ozplout, errmsg, errflg)
     ! Inputs
     integer, intent(in) :: &
          nPts,     & ! Horizontal dimension
@@ -95,7 +95,6 @@ subroutine ozphys_2015_timestep_init(nPts, idate, fhour, jindx1, jindx2, latsozp
     real(kind_phys), intent(in), dimension(:) :: &
          ddy,      & ! Interpolation high index for ozone data
          oz_lat,   & ! Latitudes for ozone data
-         oz_pres,  & ! Levels for ozone data
          oz_time     ! Time for ozone data
     real(kind_phys), intent(in), dimension(:,:,:,:) :: &
          ozplin      ! Ozone data
@@ -114,6 +113,8 @@ subroutine ozphys_2015_timestep_init(nPts, idate, fhour, jindx1, jindx2, latsozp
     real(kind_phys) :: tem, tx1, tx2, rjday
     real(8) :: rinc(5)
     real(4) :: rinc4(5)
+    !real(kind_dbl_prec) :: rinc(5)
+    !real(kind_sngl_prec) :: rinc4(5)
 
     ! Initialize CCPP error handling variables
     errmsg = ''
diff --git a/physics/ozphys_2015.meta b/physics/ozphys_2015.meta
index 59621b386..eab24baf1 100644
--- a/physics/ozphys_2015.meta
+++ b/physics/ozphys_2015.meta
@@ -166,14 +166,6 @@
   type = real
   kind = kind_phys
   intent = in
-[oz_pres]
-  standard_name = ozone_data_level_pressure
-  long_name = ozone data level pressure
-  units = Pa
-  dimensions = (number_of_levels_in_ozone_data)
-  type = real
-  kind = kind_phys
-  intent = in
 [oz_lat]
   standard_name = ozone_data_latitude
   long_name = ozone data latitude

From bb2af8cf67cd8c760cab8c72c022013ab43e3df0 Mon Sep 17 00:00:00 2001
From: "anning.cheng" <anning.cheng@noaa.gov>
Date: Wed, 28 Jun 2023 23:28:58 -0400
Subject: [PATCH 044/115] optimized the code and decrease the stratosphere warm
 bias for mraerosol=T

---
 physics/GFS_rrtmgp_cloud_mp.F90 |  7 +------
 physics/module_mp_thompson.F90  | 20 ++++++++++++--------
 physics/mp_thompson.F90         | 20 +++++++++++---------
 3 files changed, 24 insertions(+), 23 deletions(-)

diff --git a/physics/GFS_rrtmgp_cloud_mp.F90 b/physics/GFS_rrtmgp_cloud_mp.F90
index 32104b7f8..79ae1559a 100644
--- a/physics/GFS_rrtmgp_cloud_mp.F90
+++ b/physics/GFS_rrtmgp_cloud_mp.F90
@@ -875,17 +875,12 @@ subroutine cmp_reff_Thompson(nLev, nCol, i_cldliq, i_cldice, i_cldsnow, i_cldice
           qi_mp(iCol,iLay) = tracer(iCol,iLay,i_cldice)    / (1.-q_lay(iCol,iLay))
           qs_mp(iCol,iLay) = tracer(iCol,iLay,i_cldsnow)   / (1.-q_lay(iCol,iLay))
           ni_mp(iCol,iLay) = tracer(iCol,iLay,i_cldice_nc) / (1.-q_lay(iCol,iLay))
-          if (ltaerosol) then
+          if (ltaerosol .or. mraerosol) then
              nc_mp(iCol,iLay) = tracer(iCol,iLay,i_cldliq_nc) / (1.-q_lay(iCol,iLay))
              nwfa(iCol,iLay)  = tracer(iCol,iLay,i_twa)
              if (qc_mp(iCol,iLay) > 1.e-12 .and. nc_mp(iCol,iLay) < 100.) then
                nc_mp(iCol,iLay) = make_DropletNumber(qc_mp(iCol,iLay)*rho, nwfa(iCol,iLay)*rho) * orho
              endif
-          elseif (mraerosol) then
-             nc_mp(iCol,iLay) = tracer(iCol,iLay,i_cldliq_nc) / (1.-q_lay(iCol,iLay))
-             if (qc_mp(iCol,iLay) > 1.e-12 .and. nc_mp(iCol,iLay) < 100.) then
-               nc_mp(iCol,iLay) = make_DropletNumber(qc_mp(iCol,iLay)*rho, nwfa(iCol,iLay)*rho) * orho
-             endif
           else
              if (nint(lsmask(iCol)) == 1) then !land
                 nc_mp(iCol,iLay) = nt_c_l*orho
diff --git a/physics/module_mp_thompson.F90 b/physics/module_mp_thompson.F90
index 6a4ef5e02..0c708cb3d 100644
--- a/physics/module_mp_thompson.F90
+++ b/physics/module_mp_thompson.F90
@@ -3400,8 +3400,8 @@ subroutine mp_thompson (qv1d, qc1d, qi1d, qr1d, qs1d, qg1d, ni1d,    &
          tcond(k) = (5.69 + 0.0168*tempc)*1.0E-5 * 418.936
          ocp(k) = 1./(Cp*(1.+0.887*qv(k)))
          lvt2(k)=lvap(k)*lvap(k)*ocp(k)*oRv*otemp*otemp
-
-         nwfa(k) = MAX(11.1E6*rho(k), (nwfa1d(k) + nwfaten(k)*DT)*rho(k))
+         if (is_aerosol_aware)                                                 &
+           nwfa(k) = MAX(11.1E6*rho(k), (nwfa1d(k) + nwfaten(k)*DT)*rho(k))
       enddo
 
       do k = kts, kte
@@ -3654,7 +3654,8 @@ subroutine mp_thompson (qv1d, qc1d, qi1d, qr1d, qs1d, qg1d, ni1d,    &
           qvten(k) = qvten(k) - prw_vcd(k)
           qcten(k) = qcten(k) + prw_vcd(k)
           ncten(k) = ncten(k) + pnc_wcd(k)
-          nwfaten(k) = nwfaten(k) - pnc_wcd(k)
+          if (is_aerosol_aware)                                            &   
+            nwfaten(k) = nwfaten(k) - pnc_wcd(k)
           tten(k) = tten(k) + lvap(k)*ocp(k)*prw_vcd(k)*(1-IFDRY)
           rc(k) = MAX(R1, (qc1d(k) + DT*qcten(k))*rho(k))
           if (rc(k).eq.R1) L_qc(k) = .false.
@@ -3743,7 +3744,8 @@ subroutine mp_thompson (qv1d, qc1d, qi1d, qr1d, qs1d, qg1d, ni1d,    &
           qrten(k) = qrten(k) - prv_rev(k)
           qvten(k) = qvten(k) + prv_rev(k)
           nrten(k) = nrten(k) - pnr_rev(k)
-          nwfaten(k) = nwfaten(k) + pnr_rev(k)
+          if (is_aerosol_aware)                                            &
+            nwfaten(k) = nwfaten(k) + pnr_rev(k)
           tten(k) = tten(k) - lvap(k)*ocp(k)*prv_rev(k)*(1-IFDRY)
 
           rr(k) = MAX(R1, (qr1d(k) + DT*qrten(k))*rho(k))
@@ -4232,10 +4234,12 @@ subroutine mp_thompson (qv1d, qc1d, qi1d, qr1d, qs1d, qg1d, ni1d,    &
          qv1d(k) = MAX(1.E-10, qv1d(k) + qvten(k)*DT)
          qc1d(k) = qc1d(k) + qcten(k)*DT
          nc1d(k) = MAX(2./rho(k), MIN(nc1d(k) + ncten(k)*DT, Nt_c_max))
-         nwfa1d(k) = MAX(11.1E6, MIN(9999.E6,                           &
-                       (nwfa1d(k)+nwfaten(k)*DT)))
-         nifa1d(k) = MAX(naIN1*0.01, MIN(9999.E6,                       &
-                       (nifa1d(k)+nifaten(k)*DT)))
+         if (is_aerosol_aware) then
+           nwfa1d(k) = MAX(11.1E6, MIN(9999.E6,                           &
+                         (nwfa1d(k)+nwfaten(k)*DT)))
+           nifa1d(k) = MAX(naIN1*0.01, MIN(9999.E6,                       &
+                         (nifa1d(k)+nifaten(k)*DT)))
+         end if
          if (qc1d(k) .le. R1) then
            qc1d(k) = 0.0
            nc1d(k) = 0.0
diff --git a/physics/mp_thompson.F90 b/physics/mp_thompson.F90
index e62e8a596..6a95a706c 100644
--- a/physics/mp_thompson.F90
+++ b/physics/mp_thompson.F90
@@ -151,6 +151,10 @@ subroutine mp_thompson_init(ncol, nlev, con_g, con_rd, con_eps,      &
          !> - Convert specific humidity to water vapor mixing ratio.
          !> - Also, hydrometeor variables are mass or number mixing ratio
          !> - either kg of species per kg of dry air, or per kg of (dry + vapor).
+         if (merra2_aerosol_aware) then
+           call get_niwfa(aerfld, nifa, nwfa, ncol, nlev) 
+         end if
+
 
          qv = spechum/(1.0_kind_phys-spechum)
 
@@ -163,7 +167,7 @@ subroutine mp_thompson_init(ncol, nlev, con_g, con_rd, con_eps,      &
 
            ni = ni/(1.0_kind_phys-spechum)
            nr = nr/(1.0_kind_phys-spechum)
-           if (is_aerosol_aware) then
+           if (is_aerosol_aware .or. merra2_aerosol_aware) then
               nc = nc/(1.0_kind_phys-spechum)
               nwfa = nwfa/(1.0_kind_phys-spechum)
               nifa = nifa/(1.0_kind_phys-spechum)
@@ -208,8 +212,6 @@ subroutine mp_thompson_init(ncol, nlev, con_g, con_rd, con_eps,      &
                  nwfa(i,k) = naCCN1+naCCN0*exp(-((hgt(i,k)-hgt(i,1))/1000.)*niCCN3)
                enddo
              enddo
-           else if (merra2_aerosol_aware) then
-             call get_niwfa(aerfld, nifa, nwfa, ncol, nlev)
            else
              if (mpirank==mpiroot) write(*,*) ' Apparently initial CCN aerosols are present.'
              if (MAXVAL(nwfa2d) .lt. eps) then
@@ -555,6 +557,9 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd,        &
          else
             dtstep = dtp
          end if
+         if (merra2_aerosol_aware) then
+           call get_niwfa(aerfld, nifa, nwfa, ncol, nlev)
+         end if
 
          !> - Convert specific humidity to water vapor mixing ratio.
          !> - Also, hydrometeor variables are mass or number mixing ratio
@@ -574,7 +579,7 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd,        &
 
            ni = ni/(1.0_kind_phys-spechum)
            nr = nr/(1.0_kind_phys-spechum)
-           if (is_aerosol_aware) then
+           if (is_aerosol_aware .or. merra2_aerosol_aware) then
               nc = nc/(1.0_kind_phys-spechum)
               nwfa = nwfa/(1.0_kind_phys-spechum)
               nifa = nifa/(1.0_kind_phys-spechum)
@@ -681,9 +686,6 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd,        &
             ncten3     => diag3d(:,:,36:36)
             qcten3     => diag3d(:,:,37:37)
          end if set_extended_diagnostic_pointers
-         if (merra2_aerosol_aware) then
-           call get_niwfa(aerfld, nifa, nwfa, ncol, nlev)
-         end if
          !> - Call mp_gt_driver() with or without aerosols, with or without effective radii, ...
          if (is_aerosol_aware .or. merra2_aerosol_aware) then
             call mp_gt_driver(qv=qv, qc=qc, qr=qr, qi=qi, qs=qs, qg=qg, ni=ni, nr=nr,        &
@@ -921,8 +923,8 @@ subroutine get_niwfa(aerfld, nifa, nwfa, ncol, nlev)
               aerfld(:,:,4)/1011.5142+ aerfld(:,:,5)/5683.3501)*1.e15
 
          nwfa=((aerfld(:,:,6)/0.0045435214+aerfld(:,:,7)/0.2907854+aerfld(:,:,8)/12.91224+ &
-              aerfld(:,:,9)/206.2216+ aerfld(:,:,10)/4326.23)*1.+aerfld(:,:,11)/0.3053104*5+ &
-              aerfld(:,:,15)/0.3232698*1)*1.e15
+              aerfld(:,:,9)/206.2216+ aerfld(:,:,10)/4326.23)*9.+aerfld(:,:,11)/0.3053104*5+ &
+              aerfld(:,:,15)/0.3232698*8)*1.e15
       end subroutine get_niwfa
 
 end module mp_thompson

From 0c01b39356ede6fb4c653a4d76fc7c6fa50c18b3 Mon Sep 17 00:00:00 2001
From: Greg Thompson <gthompsn@ucar.edu>
Date: Wed, 5 Jul 2023 13:24:02 -0600
Subject: [PATCH 045/115] bug fix the snow and graupel melting terms set to
 zero when sublimation happens instead of melting

---
 physics/module_mp_thompson.F90 | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/physics/module_mp_thompson.F90 b/physics/module_mp_thompson.F90
index 59f2f8a65..41cdb7e94 100644
--- a/physics/module_mp_thompson.F90
+++ b/physics/module_mp_thompson.F90
@@ -3057,6 +3057,7 @@ subroutine mp_thompson (qv1d, qc1d, qi1d, qr1d, qs1d, qg1d, ni1d,    &
               pnr_sml(k) = smo0(k)/rs(k)*prr_sml(k) * 10.0**(-0.25*tempc)   ! RAIN2M
               pnr_sml(k) = MIN(DBLE(smo0(k)*odts), pnr_sml(k))
            elseif (ssati(k).lt. 0.) then
+              prr_sml(k) = 0.0
               prs_sde(k) = C_cube*t1_subl*diffu(k)*ssati(k)*rvs         &
                          * (t1_qs_sd*smo1(k)                            &
                          + t2_qs_sd*rhof2(k)*vsc2(k)*smof(k))
@@ -3073,6 +3074,7 @@ subroutine mp_thompson (qv1d, qc1d, qi1d, qr1d, qs1d, qg1d, ni1d,    &
               pnr_gml(k) = N0_g(k)*cgg(2)*ilamg(k)**cge(2) / rg(k)      &   ! RAIN2M
                          * prr_gml(k) * 10.0**(-0.5*tempc)
            elseif (ssati(k).lt. 0.) then
+              prr_gml(k) = 0.0
               prg_gde(k) = C_cube*t1_subl*diffu(k)*ssati(k)*rvs         &
                          * N0_g(k) * (t1_qg_sd*ilamg(k)**cge(10)        &
                          + t2_qg_sd*vsc2(k)*rhof2(k)*ilamg(k)**cge(11))

From 2b6a7a4e9bce9f33c122f8df14521a2d985e3985 Mon Sep 17 00:00:00 2001
From: Man Zhang <man.zhang@noaa.gov>
Date: Thu, 8 Jun 2023 09:21:49 -0600
Subject: [PATCH 046/115] Initiate SRW v3.0.0 SciDoc

---
 physics/clm_lake.f90                          | 1128 ++++++++---------
 physics/docs/ccppsrw3_doxyfile                |  557 ++++++++
 physics/docs/library.bib                      |  160 ++-
 physics/docs/pdftxt/CLM_LAKE.txt              |   59 +
 physics/docs/pdftxt/CU_GF_deep.txt            |   32 +-
 physics/docs/pdftxt/GFS_NOAHMP.txt            |   18 +-
 physics/docs/pdftxt/GFS_UGWPv0.txt            |   46 +
 physics/docs/pdftxt/GFS_v16_suite.txt         |    4 +-
 physics/docs/pdftxt/HRRR_suite.txt            |    2 +-
 physics/docs/pdftxt/NoahMP.txt                |   41 -
 physics/docs/pdftxt/RAP_suite.txt             |    2 +-
 .../docs/pdftxt/RE300/FV3_GFS_v16_input.nml   |  335 +++++
 physics/docs/pdftxt/RE300/FV3_HRRR_input.nml  |  293 +++++
 physics/docs/pdftxt/RE300/FV3_RAP_input.nml   |  300 +++++
 .../pdftxt/RE300/FV3_RRFS_v1beta_input.nml    |  285 +++++
 .../docs/pdftxt/RE300/FV3_WoFS_v0_input.nml   |  291 +++++
 .../namelists/input.nml.develop.FV3_GFS_v16   |  330 +++++
 .../namelists/input.nml.develop.FV3_HRRR      |  293 +++++
 .../RE300/namelists/input.nml.develop.FV3_RAP |  300 +++++
 .../input.nml.develop.FV3_RRFS_v1beta         |  285 +++++
 .../namelists/input.nml.develop.FV3_WoFS_v0   |  291 +++++
 .../RE300/namelists/input.nml.v21.FV3_GFS_v16 |  336 +++++
 .../RE300/namelists/input.nml.v21.FV3_HRRR    |  299 +++++
 .../namelists/input.nml.v21.FV3_RRFS_v1beta   |  291 +++++
 .../RE300/namelists/input.nml.v21.FV3_WoFS_v0 |  297 +++++
 .../docs/pdftxt/RE300/suite_FV3_GFS_v16.xml   |   94 ++
 physics/docs/pdftxt/RE300/suite_FV3_HRRR.xml  |   82 ++
 physics/docs/pdftxt/RE300/suite_FV3_RAP.xml   |   90 ++
 .../pdftxt/RE300/suite_FV3_RRFS_v1beta.xml    |   84 ++
 .../docs/pdftxt/RE300/suite_FV3_WoFS_v0.xml   |   80 ++
 physics/docs/pdftxt/RUCLSM.txt                |   93 +-
 physics/docs/pdftxt/SRW_all_shemes_list.txt   |    3 +
 physics/docs/pdftxt/SRW_mainpage.txt          |    5 +-
 physics/docs/pdftxt/THOMPSON.txt              |    9 +
 34 files changed, 6132 insertions(+), 683 deletions(-)
 create mode 100644 physics/docs/ccppsrw3_doxyfile
 create mode 100644 physics/docs/pdftxt/CLM_LAKE.txt
 delete mode 100644 physics/docs/pdftxt/NoahMP.txt
 create mode 100644 physics/docs/pdftxt/RE300/FV3_GFS_v16_input.nml
 create mode 100644 physics/docs/pdftxt/RE300/FV3_HRRR_input.nml
 create mode 100644 physics/docs/pdftxt/RE300/FV3_RAP_input.nml
 create mode 100644 physics/docs/pdftxt/RE300/FV3_RRFS_v1beta_input.nml
 create mode 100644 physics/docs/pdftxt/RE300/FV3_WoFS_v0_input.nml
 create mode 100644 physics/docs/pdftxt/RE300/namelists/input.nml.develop.FV3_GFS_v16
 create mode 100644 physics/docs/pdftxt/RE300/namelists/input.nml.develop.FV3_HRRR
 create mode 100644 physics/docs/pdftxt/RE300/namelists/input.nml.develop.FV3_RAP
 create mode 100644 physics/docs/pdftxt/RE300/namelists/input.nml.develop.FV3_RRFS_v1beta
 create mode 100644 physics/docs/pdftxt/RE300/namelists/input.nml.develop.FV3_WoFS_v0
 create mode 100644 physics/docs/pdftxt/RE300/namelists/input.nml.v21.FV3_GFS_v16
 create mode 100644 physics/docs/pdftxt/RE300/namelists/input.nml.v21.FV3_HRRR
 create mode 100644 physics/docs/pdftxt/RE300/namelists/input.nml.v21.FV3_RRFS_v1beta
 create mode 100644 physics/docs/pdftxt/RE300/namelists/input.nml.v21.FV3_WoFS_v0
 create mode 100644 physics/docs/pdftxt/RE300/suite_FV3_GFS_v16.xml
 create mode 100644 physics/docs/pdftxt/RE300/suite_FV3_HRRR.xml
 create mode 100644 physics/docs/pdftxt/RE300/suite_FV3_RAP.xml
 create mode 100644 physics/docs/pdftxt/RE300/suite_FV3_RRFS_v1beta.xml
 create mode 100644 physics/docs/pdftxt/RE300/suite_FV3_WoFS_v0.xml

diff --git a/physics/clm_lake.f90 b/physics/clm_lake.f90
index 4fc4112ce..1728d28b5 100644
--- a/physics/clm_lake.f90
+++ b/physics/clm_lake.f90
@@ -1,4 +1,4 @@
-!> \file clm_lake.F90
+!> \file clm_lake.f90
 !!  Contains code related to the CLM lake model
 !!
 !! This lake scheme was taken from module_sf_lake in WRF 4.3.1, and
@@ -7,7 +7,7 @@
 !! The original documentation said:
 !! 
 !! The lake scheme was retrieved from the Community Land Model version 4.5 
-!! (Oleson et al. 2013) with some modifications by Gu et al. (2013). It is a 
+!! (Oleson et al. (2013) \cite Oleson2013) with some modifications by Gu et al. (2015) \cite Gu2015. It is a 
 !! one-dimensional mass and energy balance scheme with 20-25 model layers, 
 !! including up to 5 snow layers on the lake ice, 10 water layers, and 10 soil 
 !! layers on the lake bottom. The lake scheme is used with actual lake points and 
@@ -15,15 +15,8 @@
 !! lake points and lake depth in WRF (lake_min_elev and lakedepth_default). 
 !! The lake scheme is independent of a land surface scheme and therefore 
 !! can be used with any land surface scheme embedded in WRF. The lake scheme 
-!! developments and evaluations were included in Subin et al. (2012) and Gu et al. (2013) 
-!!
-!!   Subin et al. 2012: Improved lake model for climate simulations, J. Adv. Model. 
-!!
-!!   Earth Syst., 4, M02001. DOI:10.1029/2011MS000072; 
-!!
-!!   Gu et al. 2013: Calibration and validation of lake surface temperature simulations 
-!!
-!!   with the coupled WRF-Lake model. Climatic Change, 1-13, 10.1007/s10584-013-0978-y. 
+!! developments and evaluations were included in Subin et al. (2012) \cite Subin_2012 
+!! and Gu et al. (2015) \cite Gu2015 . 
 
 MODULE clm_lake
   
@@ -46,26 +39,26 @@ MODULE clm_lake
     logical, parameter :: PERGRO = .false.
 
     logical, parameter :: USE_ETALAKE = .false.
-    real(kind_lake), parameter :: ETALAKE = 1.1925*50**(-0.424) ! Set this to your desired value if USE_ETALAKE=.true.
+    real(kind_lake), parameter :: ETALAKE = 1.1925*50**(-0.424) !< Set this to your desired value if USE_ETALAKE=.true.
 
     ! Level counts must be consistent with model (GFS_typedefs.F90)
-    integer, parameter :: nlevsoil     =  10   ! number of soil layers
-    integer, parameter :: nlevlake     =  10   ! number of lake layers
-    integer, parameter :: nlevsnow     =   5   ! maximum number of snow layers
-    real(kind_lake), parameter :: scalez  = 0.025_kind_lake   ! Soil layer thickness discretization (m)
+    integer, parameter :: nlevsoil     =  10   !< number of soil layers
+    integer, parameter :: nlevlake     =  10   !< number of lake layers
+    integer, parameter :: nlevsnow     =   5   !< maximum number of snow layers
+    real(kind_lake), parameter :: scalez  = 0.025_kind_lake   !< Soil layer thickness discretization (m)
 
-    integer,parameter  ::     lbp = 1                        ! pft-index bounds
+    integer,parameter  ::     lbp = 1                        !< pft-index bounds
     integer,parameter  ::     ubp = 1
-    integer,parameter  ::     lbc = 1                        ! column-index bounds
+    integer,parameter  ::     lbc = 1                        !< column-index bounds
     integer,parameter  ::     ubc = 1
-    integer,parameter  ::     num_shlakec       = 1          ! number of columns in lake filter
-    integer,parameter  ::     filter_shlakec(1) = 1          ! lake filter (columns)
-    integer,parameter  ::     num_shlakep       = 1          ! number of pfts in lake filter
-    integer,parameter  ::     filter_shlakep(1) = 1          ! lake filter (pfts)
+    integer,parameter  ::     num_shlakec       = 1          !< number of columns in lake filter
+    integer,parameter  ::     filter_shlakec(1) = 1          !< lake filter (columns)
+    integer,parameter  ::     num_shlakep       = 1          !< number of pfts in lake filter
+    integer,parameter  ::     filter_shlakep(1) = 1          !< lake filter (pfts)
     integer,parameter  ::     pcolumn(1)        = 1  
     integer,parameter  ::     pgridcell(1)      = 1  
-    integer,parameter  ::     cgridcell(1)      = 1          ! gridcell index of column
-    integer,parameter  ::     clandunit(1)      = 1          ! landunit index of column
+    integer,parameter  ::     cgridcell(1)      = 1          !< gridcell index of column
+    integer,parameter  ::     clandunit(1)      = 1          !< landunit index of column
   
     integer,parameter  ::     begg = 1
     integer,parameter  ::     endg = 1
@@ -80,44 +73,44 @@ MODULE clm_lake
     logical,parameter  ::     lakpoi(1) = .true.
    
     !Initialize physical constants not available from model:
-    real(kind_lake), parameter :: tcrit  = 2.5          !critical temperature to determine rain or snow
-    real(kind_lake), parameter :: tkwat  = 0.6          !thermal conductivity of water [W/m/k]
-    real(kind_lake), parameter :: tkice  = 2.290        !thermal conductivity of ice   [W/m/k]
-    real(kind_lake), parameter :: tkairc = 0.023        !thermal conductivity of air   [W/m/k]
-    real(kind_lake), parameter :: snow_bd = 250         !constant snow bulk density (only used in special case here) [kg/m^3]
+    real(kind_lake), parameter :: tcrit  = 2.5          !< critical temperature to determine rain or snow
+    real(kind_lake), parameter :: tkwat  = 0.6          !< thermal conductivity of water [W/m/k]
+    real(kind_lake), parameter :: tkice  = 2.290        !< thermal conductivity of ice   [W/m/k]
+    real(kind_lake), parameter :: tkairc = 0.023        !< thermal conductivity of air   [W/m/k]
+    real(kind_lake), parameter :: snow_bd = 250         !< constant snow bulk density (only used in special case here) [kg/m^3]
   
     ! Constants that are copied from model values by clm_lake_init:
-    real(kind_lake) :: pi                   !ratio of the circumference of a circle to its diameter
-    real(kind_lake) :: vkc                  !von Karman constant [-]
-    real(kind_lake) :: grav                 !gravity constant [m/s2]
-    real(kind_lake) :: sb                   !stefan-boltzmann constant  [W/m2/K4]
-    real(kind_lake) :: tfrz                 !freezing temperature [K]
-    real(kind_lake) :: denh2o               !density of liquid water [kg/m3]
-    real(kind_lake) :: denice               !density of ice [kg/m3]
-    real(kind_lake) :: cpice                !Specific heat of ice [J/kg-K]
-    real(kind_lake) :: cpliq                !Specific heat of water [J/kg-K]
-    real(kind_lake) :: hfus                 !Latent heat of fusion for ice [J/kg]
-    real(kind_lake) :: hvap                 !Latent heat of evap for water [J/kg]
-    real(kind_lake) :: hsub                 !Latent heat of sublimation    [J/kg]
-    real(kind_lake) :: invhvap              !1/hvap [kg/J]
-    real(kind_lake) :: invhsub              !1/hsub [kg/J]
-    real(kind_lake) :: rair                 !gas constant for dry air [J/kg/K]
-    real(kind_lake) :: cpair                !specific heat of dry air [J/kg/K]
-    real(kind_lake) :: con_eps              !ratio of gas constants of air and water vapor [unitless]
-    real(kind_lake) :: one_minus_con_eps    !1 - con_eps [unitless]
-    real(kind_lake) :: con_fvirt            !1/con_eps - 1 [unitless]
+    real(kind_lake) :: pi                   !< ratio of the circumference of a circle to its diameter
+    real(kind_lake) :: vkc                  !< von Karman constant [-]
+    real(kind_lake) :: grav                 !< gravity constant [m/s2]
+    real(kind_lake) :: sb                   !< stefan-boltzmann constant  [W/m2/K4]
+    real(kind_lake) :: tfrz                 !< freezing temperature [K]
+    real(kind_lake) :: denh2o               !< density of liquid water [kg/m3]
+    real(kind_lake) :: denice               !< density of ice [kg/m3]
+    real(kind_lake) :: cpice                !< Specific heat of ice [J/kg-K]
+    real(kind_lake) :: cpliq                !< Specific heat of water [J/kg-K]
+    real(kind_lake) :: hfus                 !< Latent heat of fusion for ice [J/kg]
+    real(kind_lake) :: hvap                 !< Latent heat of evap for water [J/kg]
+    real(kind_lake) :: hsub                 !< Latent heat of sublimation    [J/kg]
+    real(kind_lake) :: invhvap              !< 1/hvap [kg/J]
+    real(kind_lake) :: invhsub              !< 1/hsub [kg/J]
+    real(kind_lake) :: rair                 !< gas constant for dry air [J/kg/K]
+    real(kind_lake) :: cpair                !< specific heat of dry air [J/kg/K]
+    real(kind_lake) :: con_eps              !< ratio of gas constants of air and water vapor [unitless]
+    real(kind_lake) :: one_minus_con_eps    !< 1 - con_eps [unitless]
+    real(kind_lake) :: con_fvirt            !< 1/con_eps - 1 [unitless]
     
-    real(kind_lake), public, parameter :: spval = 1.e36 !special value for missing data (ocean)
-    real(kind_lake), parameter  ::     depth_c = 50.    !below the level t_lake3d will be 277.0  !mchen
-    real(kind_lake), parameter :: zero_h2o = 1e-12      !lower mixing ratio is is treated as zero
+    real(kind_lake), public, parameter :: spval = 1.e36 !< special value for missing data (ocean)
+    real(kind_lake), parameter  ::     depth_c = 50.    !< below the level t_lake3d will be 277.0  !mchen
+    real(kind_lake), parameter :: zero_h2o = 1e-12      !< lower mixing ratio is is treated as zero
     
    ! These are tunable constants
-    real(kind_lake), parameter :: wimp   = 0.05    !Water impermeable if porosity less than wimp
-    real(kind_lake), parameter :: ssi    = 0.033   !Irreducible water saturation of snow
-    real(kind_lake), parameter :: cnfac  = 0.5     !Crank Nicholson factor between 0 and 1
+    real(kind_lake), parameter :: wimp   = 0.05    !< Water impermeable if porosity less than wimp
+    real(kind_lake), parameter :: ssi    = 0.033   !< Irreducible water saturation of snow
+    real(kind_lake), parameter :: cnfac  = 0.5     !< Crank Nicholson factor between 0 and 1
 
    ! Initialize water type constants
-    integer,parameter :: istsoil = 1  !soil         "water" type
+    integer,parameter :: istsoil = 1               !<!soil         "water" type
 
     ! percent sand
     real(kind_lake), parameter :: sand(19) = &
@@ -128,11 +121,11 @@ MODULE clm_lake
          (/ 3., 5.,10.,15.,5.,18.,27.,33.,33.,41.,47.,58.,14.7,0., 0., 8.5,54.,  0., 3./)
 
     ! These are initialized in clm_lake_init and are not modified elsewhere
-    real(kind_lake) :: zlak(1:nlevlake)     !lake z  (layers)
-    real(kind_lake) :: dzlak(1:nlevlake)    !lake dz (thickness)
-    real(kind_lake) :: zsoi(1:nlevsoil)     !soil z  (layers)
-    real(kind_lake) :: dzsoi(1:nlevsoil)    !soil dz (thickness)
-    real(kind_lake) :: zisoi(0:nlevsoil)    !soil zi (interfaces)  
+    real(kind_lake) :: zlak(1:nlevlake)     !< lake z  (layers)
+    real(kind_lake) :: dzlak(1:nlevlake)    !< lake dz (thickness)
+    real(kind_lake) :: zsoi(1:nlevsoil)     !< soil z  (layers)
+    real(kind_lake) :: dzsoi(1:nlevsoil)    !< soil dz (thickness)
+    real(kind_lake) :: zisoi(0:nlevsoil)    !< soil zi (interfaces)  
 
     real, parameter :: SaltLk_T(1:25) = (/ 0.5,  0.,-0.5, 3., 4.,  7., 8., 12.,  13., 16., 19., 21., &
                                           23.5, 25., 26.,24.,23.,20.5,18., 15., 11.5,  8.,  4.,  1., 0.5/)
@@ -153,15 +146,15 @@ logical function limit_temperature_by_climatology(xlat_d,xlon_positive)
 
       limit_temperature_by_climatology=.false.
 
-      !tgs  - 7nov19 - salinity effect on freezing point (Tanya, Stan, Trevor).
-      ! --- The Great Salt Lake (GSL), Utah lat/long (39.5-42.0,-111.5- -117.7).
-      ! --- THe GSL's salinity is 270 ppt above ~41.22 N with freezing point of -24 C, 
-      ! --- and 150 ppt south of ~41.22 N with freezing point -10 C (info from Trevor Alcott). 
-      ! --- The fresh-water Willard Bay should be excluded from the box around the Great Salt
-      ! --- Lake: lat/long 41.3539, -112.102, HRRR i,j = 494,667 (info from Stan and Trevor).
-      ! ---
-      ! --- 1jun2020: reset the GSL freezing point to be -5 C,
-      ! --- and add a check (after call to LakeMain) to keep the lake ice free for the whole year.
+      !>tgs  - 7nov19 - salinity effect on freezing point (Tanya, Stan, Trevor).
+      !! The Great Salt Lake (GSL), Utah lat/long (39.5-42.0,-111.5- -117.7).
+      !! The GSL's salinity is 270 ppt above ~41.22 N with freezing point of -24 C, 
+      !! and 150 ppt south of ~41.22 N with freezing point -10 C (info from Trevor Alcott). 
+      !! The fresh-water Willard Bay should be excluded from the box around the Great Salt
+      !! Lake: lat/long 41.3539, -112.102, HRRR i,j = 494,667 (info from Stan and Trevor).
+      !! 
+      !! 1jun2020: reset the GSL freezing point to be -5 C,
+      !! and add a check (after call to LakeMain) to keep the lake ice free for the whole year.
       if ((xlon_d.gt.-117.7 .and. xlon_d.lt.-111.5) .and.    &
                                 ! excludes Willard Bay
            .not. (xlon_d.gt.-112.104 .and. xlon_d.lt.-112.100))then
@@ -800,69 +793,69 @@ SUBROUTINE LakeMain(forc_t,forc_pbot,forc_psrf,forc_hgt,forc_hgt_q,     & !I
 
     integer, intent(inout) :: errflg
     character(*), intent(inout) :: errmsg
-    real(kind_lake),intent(in) :: dtime              ! timestep
-    real(kind_lake),intent(in) :: xlat_d, xlon_d     ! grid location for debugging
-    real(kind_lake),intent(in) :: forc_t(1)          ! atmospheric temperature (Kelvin)
-    real(kind_lake),intent(in) :: forc_pbot(1)       ! atm bottom level pressure (Pa) 
-    real(kind_lake),intent(in) :: forc_psrf(1)       ! atmospheric surface pressure (Pa)
-    real(kind_lake),intent(in) :: forc_hgt(1)        ! atmospheric reference height (m)
-    real(kind_lake),intent(in) :: forc_hgt_q(1)      ! observational height of humidity [m]
-    real(kind_lake),intent(in) :: forc_hgt_t(1)      ! observational height of temperature [m]
-    real(kind_lake),intent(in) :: forc_hgt_u(1)      ! observational height of wind [m]
-    real(kind_lake),intent(in) :: forc_q(1)          ! atmospheric specific humidity (kg/kg)
-    real(kind_lake),intent(in) :: forc_u(1)          ! atmospheric wind speed in east direction (m/s)
-    real(kind_lake),intent(in) :: forc_v(1)          ! atmospheric wind speed in north direction (m/s)
+    real(kind_lake),intent(in) :: dtime              !< timestep
+    real(kind_lake),intent(in) :: xlat_d, xlon_d     !< grid location for debugging
+    real(kind_lake),intent(in) :: forc_t(1)          !< atmospheric temperature (Kelvin)
+    real(kind_lake),intent(in) :: forc_pbot(1)       !< atm bottom level pressure (Pa) 
+    real(kind_lake),intent(in) :: forc_psrf(1)       !< atmospheric surface pressure (Pa)
+    real(kind_lake),intent(in) :: forc_hgt(1)        !< atmospheric reference height (m)
+    real(kind_lake),intent(in) :: forc_hgt_q(1)      !< observational height of humidity [m]
+    real(kind_lake),intent(in) :: forc_hgt_t(1)      !< observational height of temperature [m]
+    real(kind_lake),intent(in) :: forc_hgt_u(1)      !< observational height of wind [m]
+    real(kind_lake),intent(in) :: forc_q(1)          !< atmospheric specific humidity (kg/kg)
+    real(kind_lake),intent(in) :: forc_u(1)          !< atmospheric wind speed in east direction (m/s)
+    real(kind_lake),intent(in) :: forc_v(1)          !< atmospheric wind speed in north direction (m/s)
    ! real(kind_lake),intent(in) :: forc_rho(1)        ! density (kg/m**3)
-    real(kind_lake),intent(in) :: forc_lwrad(1)      ! downward infrared (longwave) radiation (W/m**2)
-    real(kind_lake),intent(in) :: prec(1)               ! snow or rain rate [mm/s]
-    real(kind_lake),intent(in) :: sabg(1)            ! solar radiation absorbed by ground (W/m**2)
-    real(kind_lake),intent(in) :: lat(1)             ! latitude (radians)
-    real(kind_lake),intent(in) :: z_lake(1,nlevlake)  ! layer depth for lake (m)
-    real(kind_lake),intent(in) :: dz_lake(1,nlevlake)                  ! layer thickness for lake (m)
-    real(kind_lake),intent(out) :: ustar_out(1)       ! friction velocity [m/s]
-    real(kind_lake), intent(in) :: lakedepth(1)       ! column lake depth (m)
+    real(kind_lake),intent(in) :: forc_lwrad(1)      !< downward infrared (longwave) radiation (W/m**2)
+    real(kind_lake),intent(in) :: prec(1)               !< snow or rain rate [mm/s]
+    real(kind_lake),intent(in) :: sabg(1)            !< solar radiation absorbed by ground (W/m**2)
+    real(kind_lake),intent(in) :: lat(1)             !< latitude (radians)
+    real(kind_lake),intent(in) :: z_lake(1,nlevlake)  !< layer depth for lake (m)
+    real(kind_lake),intent(in) :: dz_lake(1,nlevlake)                  !< layer thickness for lake (m)
+    real(kind_lake),intent(out) :: ustar_out(1)       !< friction velocity [m/s]
+    real(kind_lake), intent(in) :: lakedepth(1)       !< column lake depth (m)
     !!!!!!!!!!!!!!!!tep(in),hydro(in)   
    ! real(kind_lake), intent(in) :: watsat(1,1:nlevsoil)      ! volumetric soil water at saturation (porosity)
     !!!!!!!!!!!!!!!!hydro
-    logical , intent(in) :: do_capsnow(1)     ! true => do snow capping
-    real(kind_lake), intent(in) :: watsat(1,nlevsoil)      ! volumetric soil water at saturation (porosity)
-    real(kind_lake), intent(in) :: tksatu(1,nlevsoil)      ! thermal conductivity, saturated soil [W/m-K]
-    real(kind_lake), intent(in) :: tkmg(1,nlevsoil)        ! thermal conductivity, soil minerals  [W/m-K]
-    real(kind_lake), intent(in) :: tkdry(1,nlevsoil)       ! thermal conductivity, dry soil (W/m/Kelvin)
-    real(kind_lake), intent(in) :: csol(1,nlevsoil)        ! heat capacity, soil solids (J/m**3/Kelvin)
+    logical , intent(in) :: do_capsnow(1)     !< true => do snow capping
+    real(kind_lake), intent(in) :: watsat(1,nlevsoil)      !< volumetric soil water at saturation (porosity)
+    real(kind_lake), intent(in) :: tksatu(1,nlevsoil)      !< thermal conductivity, saturated soil [W/m-K]
+    real(kind_lake), intent(in) :: tkmg(1,nlevsoil)        !< thermal conductivity, soil minerals  [W/m-K]
+    real(kind_lake), intent(in) :: tkdry(1,nlevsoil)       !< thermal conductivity, dry soil (W/m/Kelvin)
+    real(kind_lake), intent(in) :: csol(1,nlevsoil)        !< heat capacity, soil solids (J/m**3/Kelvin)
    
 
 
     !in&out
-    real(kind_lake),intent(inout) :: h2osoi_vol(1,-nlevsnow+1:nlevsoil)  ! volumetric soil water (0<=h2osoi_vol<=watsat)[m3/m3]
-    real(kind_lake),intent(inout) :: t_grnd(1)          ! ground temperature (Kelvin)
-    real(kind_lake),intent(inout) :: h2osno(1)          ! snow water (mm H2O)
-    real(kind_lake),intent(inout) :: snowdp(1)          ! snow height (m)
-    real(kind_lake),intent(inout) :: z(1,-nlevsnow+1:nlevsoil)             ! layer depth for snow & soil (m)
-    real(kind_lake),intent(inout) :: dz(1,-nlevsnow+1:nlevsoil)            ! layer thickness for soil or snow (m)
-    real(kind_lake),intent(inout) :: t_soisno(1,-nlevsnow+1:nlevsoil)      ! soil (or snow) temperature (Kelvin)
-    real(kind_lake),intent(inout) :: t_lake(1,nlevlake)                   ! lake temperature (Kelvin)
-    integer ,intent(inout) :: snl(1)                              ! number of snow layers
-    real(kind_lake),intent(inout) :: h2osoi_liq(1,-nlevsnow+1:nlevsoil)    ! liquid water (kg/m2)
-    real(kind_lake),intent(inout) :: h2osoi_ice(1,-nlevsnow+1:nlevsoil)    ! ice lens (kg/m2)
-    real(kind_lake),intent(inout) :: savedtke1(1)       ! top level eddy conductivity from previous timestep (W/m.K)
-    real(kind_lake),intent(inout) :: zi(1,-nlevsnow+0:nlevsoil)            ! interface level below a "z" level (m)
-    real(kind_lake),intent(inout) :: lake_icefrac(1,nlevlake)  ! mass fraction of lake layer that is frozen
+    real(kind_lake),intent(inout) :: h2osoi_vol(1,-nlevsnow+1:nlevsoil)  !< volumetric soil water (0<=h2osoi_vol<=watsat)[m3/m3]
+    real(kind_lake),intent(inout) :: t_grnd(1)          !< ground temperature (Kelvin)
+    real(kind_lake),intent(inout) :: h2osno(1)          !< snow water (mm H2O)
+    real(kind_lake),intent(inout) :: snowdp(1)          !< snow height (m)
+    real(kind_lake),intent(inout) :: z(1,-nlevsnow+1:nlevsoil)             !< layer depth for snow & soil (m)
+    real(kind_lake),intent(inout) :: dz(1,-nlevsnow+1:nlevsoil)            !< layer thickness for soil or snow (m)
+    real(kind_lake),intent(inout) :: t_soisno(1,-nlevsnow+1:nlevsoil)      !< soil (or snow) temperature (Kelvin)
+    real(kind_lake),intent(inout) :: t_lake(1,nlevlake)                   !< lake temperature (Kelvin)
+    integer ,intent(inout) :: snl(1)                              !< number of snow layers
+    real(kind_lake),intent(inout) :: h2osoi_liq(1,-nlevsnow+1:nlevsoil)    !< liquid water (kg/m2)
+    real(kind_lake),intent(inout) :: h2osoi_ice(1,-nlevsnow+1:nlevsoil)    !< ice lens (kg/m2)
+    real(kind_lake),intent(inout) :: savedtke1(1)       !< top level eddy conductivity from previous timestep (W/m.K)
+    real(kind_lake),intent(inout) :: zi(1,-nlevsnow+0:nlevsoil)            !< interface level below a "z" level (m)
+    real(kind_lake),intent(inout) :: lake_icefrac(1,nlevlake)  !< mass fraction of lake layer that is frozen
 
 
     !out:
-    real(kind_lake),intent(out) :: eflx_gnet(1)       !net heat flux into ground (W/m**2)
-    real(kind_lake),intent(out) :: eflx_lwrad_net(1)  ! net infrared (longwave) rad (W/m**2) [+ = to atm]
-    real(kind_lake),intent(out) :: eflx_sh_tot(1)     ! total sensible heat flux (W/m**2) [+ to atm]
-    real(kind_lake),intent(out) :: eflx_lh_tot(1)     ! total latent heat flux (W/m8*2)  [+ to atm]
-    real(kind_lake),intent(out) :: t_ref2m(1)         ! 2 m height surface air temperature (Kelvin)
-    real(kind_lake),intent(out) :: q_ref2m(1)         ! 2 m height surface specific humidity (kg/kg)
-    real(kind_lake),intent(out) :: taux(1)            ! wind (shear) stress: e-w (kg/m/s**2)
-    real(kind_lake),intent(out) :: tauy(1)            ! wind (shear) stress: n-s (kg/m/s**2)
-    real(kind_lake),intent(out) :: ram1(1)            ! aerodynamical resistance (s/m)
-                                               ! for calculation of decay of eddy diffusivity with depth
-                                               ! Change the type variable to pass back to WRF.
-    real(kind_lake),intent(out) :: z0mg(1)            ! roughness length over ground, momentum (m(
+    real(kind_lake),intent(out) :: eflx_gnet(1)       !< net heat flux into ground (W/m**2)
+    real(kind_lake),intent(out) :: eflx_lwrad_net(1)  !< net infrared (longwave) rad (W/m**2) [+ = to atm]
+    real(kind_lake),intent(out) :: eflx_sh_tot(1)     !< total sensible heat flux (W/m**2) [+ to atm]
+    real(kind_lake),intent(out) :: eflx_lh_tot(1)     !< total latent heat flux (W/m8*2)  [+ to atm]
+    real(kind_lake),intent(out) :: t_ref2m(1)         !< 2 m height surface air temperature (Kelvin)
+    real(kind_lake),intent(out) :: q_ref2m(1)         !< 2 m height surface specific humidity (kg/kg)
+    real(kind_lake),intent(out) :: taux(1)            !< wind (shear) stress: e-w (kg/m/s**2)
+    real(kind_lake),intent(out) :: tauy(1)            !< wind (shear) stress: n-s (kg/m/s**2)
+    real(kind_lake),intent(out) :: ram1(1)            !< aerodynamical resistance (s/m)
+                                                      !! for calculation of decay of eddy diffusivity with depth
+                                                      !! Change the type variable to pass back to WRF.
+    real(kind_lake),intent(out) :: z0mg(1)            !< roughness length over ground, momentum (m(
 
 
     !local output
@@ -989,6 +982,13 @@ SUBROUTINE LakeMain(forc_t,forc_pbot,forc_psrf,forc_hgt,forc_hgt_q,     & !I
    END SUBROUTINE LakeMain
 
 
+  ! DESCRIPTION:
+  !> Calculates lake temperatures and surface fluxes for shallow lakes.
+  !!
+  !! Shallow lakes have variable depth, possible snow layers above, freezing & thawing of lake water,
+  !! and soil layers with active temperature and gas diffusion below.        
+  !!                             
+  !! WARNING: This subroutine assumes lake columns have one and only one pft.
 SUBROUTINE ShalLakeFluxes(forc_t,forc_pbot,forc_psrf,forc_hgt,forc_hgt_q,           &  !i
                           forc_hgt_t,forc_hgt_u,forc_q,                   &
                           forc_u,forc_v,forc_lwrad,forc_snow,             &
@@ -1001,18 +1001,10 @@ SUBROUTINE ShalLakeFluxes(forc_t,forc_pbot,forc_psrf,forc_hgt,forc_hgt_q,
                           eflx_lh_grnd,t_veg,t_ref2m,q_ref2m,taux,tauy,   &
                           ram1,ws,ks,eflx_gnet,z0mg,ustar_out,errmsg,errflg,xlat_d,xlon_d)
   !==============================================================================
-  ! DESCRIPTION:
-  ! Calculates lake temperatures and surface fluxes for shallow lakes.
-  !
-  ! Shallow lakes have variable depth, possible snow layers above, freezing & thawing of lake water,
-  ! and soil layers with active temperature and gas diffusion below.
-  !
-  ! WARNING: This subroutine assumes lake columns have one and only one pft.
-  !
   ! REVISION HISTORY:
-  ! Created by Zack Subin, 2009
-  ! Reedited by Hongping Gu, 2010 
-  ! Updated for CCPP by Sam Trahan, 2022
+  ! - Created by Zack Subin, 2009
+  ! - Reedited by Hongping Gu, 2010 
+  ! - Updated for CCPP by Sam Trahan, 2022
   !==============================================================================
   
    ! implicit none
@@ -1021,62 +1013,62 @@ SUBROUTINE ShalLakeFluxes(forc_t,forc_pbot,forc_psrf,forc_hgt,forc_hgt_q,
 
     !in: 
 
-    integer, intent(inout) :: errflg
-    character(len=*), intent(inout) :: errmsg
-    real(kind_lake),intent(in) :: xlat_d,xlon_d
-    real(kind_lake),intent(in) :: forc_t(1)          ! atmospheric temperature (Kelvin)
-    real(kind_lake),intent(in) :: forc_pbot(1)       ! atmospheric pressure (Pa)
-    real(kind_lake),intent(in) :: forc_psrf(1)       ! atmospheric surface pressure (Pa)
-    real(kind_lake),intent(in) :: forc_hgt(1)        ! atmospheric reference height (m)
-    real(kind_lake),intent(in) :: forc_hgt_q(1)      ! observational height of humidity [m]
-    real(kind_lake),intent(in) :: forc_hgt_t(1)      ! observational height of temperature [m]
-    real(kind_lake),intent(in) :: forc_hgt_u(1)      ! observational height of wind [m]
-    real(kind_lake),intent(in) :: forc_q(1)          ! atmospheric specific humidity (kg/kg)
-    real(kind_lake),intent(in) :: forc_u(1)          ! atmospheric wind speed in east direction (m/s)
-    real(kind_lake),intent(in) :: forc_v(1)          ! atmospheric wind speed in north direction (m/s)
-    real(kind_lake),intent(in) :: forc_lwrad(1)      ! downward infrared (longwave) radiation (W/m**2)
+    integer, intent(inout) :: errflg                 !<
+    character(len=*), intent(inout) :: errmsg        !<
+    real(kind_lake),intent(in) :: xlat_d,xlon_d      !<
+    real(kind_lake),intent(in) :: forc_t(1)          !< atmospheric temperature (Kelvin)
+    real(kind_lake),intent(in) :: forc_pbot(1)       !< atmospheric pressure (Pa)
+    real(kind_lake),intent(in) :: forc_psrf(1)       !< atmospheric surface pressure (Pa)
+    real(kind_lake),intent(in) :: forc_hgt(1)        !< atmospheric reference height (m)
+    real(kind_lake),intent(in) :: forc_hgt_q(1)      !< observational height of humidity [m]
+    real(kind_lake),intent(in) :: forc_hgt_t(1)      !< observational height of temperature [m]
+    real(kind_lake),intent(in) :: forc_hgt_u(1)      !< observational height of wind [m]
+    real(kind_lake),intent(in) :: forc_q(1)          !< atmospheric specific humidity (kg/kg)
+    real(kind_lake),intent(in) :: forc_u(1)          !< atmospheric wind speed in east direction (m/s)
+    real(kind_lake),intent(in) :: forc_v(1)          !< atmospheric wind speed in north direction (m/s)
+    real(kind_lake),intent(in) :: forc_lwrad(1)      !< downward infrared (longwave) radiation (W/m**2)
    ! real(kind_lake),intent(in) :: forc_rho(1)        ! density (kg/m**3)
-    real(kind_lake),intent(in) :: forc_snow(1)       ! snow rate [mm/s]
-    real(kind_lake),intent(in) :: forc_rain(1)       ! rain rate [mm/s]
-    real(kind_lake),intent(in) :: h2osno(1)          ! snow water (mm H2O)
-    real(kind_lake),intent(in) :: snowdp(1)          ! snow height (m)
-    real(kind_lake),intent(in) :: sabg(1)            ! solar radiation absorbed by ground (W/m**2)
-    real(kind_lake),intent(in) :: lat(1)             ! latitude (radians)
-    real(kind_lake),intent(in) :: dz(1,-nlevsnow+1:nlevsoil)            ! layer thickness for soil or snow (m)
-    real(kind_lake),intent(in) :: dz_lake(1,nlevlake)                  ! layer thickness for lake (m)
-    real(kind_lake),intent(in) :: t_soisno(1,-nlevsnow+1:nlevsoil)      ! soil (or snow) temperature (Kelvin)
-    real(kind_lake),intent(in) :: t_lake(1,nlevlake)                   ! lake temperature (Kelvin)
-    integer ,intent(in) :: snl(1)                              ! number of snow layers
-    real(kind_lake),intent(in) :: h2osoi_liq(1,-nlevsnow+1:nlevsoil)    ! liquid water (kg/m2)
-    real(kind_lake),intent(in) :: h2osoi_ice(1,-nlevsnow+1:nlevsoil)    ! ice lens (kg/m2)
-    real(kind_lake),intent(in) :: savedtke1(1)       ! top level eddy conductivity from previous timestep (W/m.K)
+    real(kind_lake),intent(in) :: forc_snow(1)       !< snow rate [mm/s]
+    real(kind_lake),intent(in) :: forc_rain(1)       !< rain rate [mm/s]
+    real(kind_lake),intent(in) :: h2osno(1)          !< snow water (mm H2O)
+    real(kind_lake),intent(in) :: snowdp(1)          !< snow height (m)
+    real(kind_lake),intent(in) :: sabg(1)            !< solar radiation absorbed by ground (W/m**2)
+    real(kind_lake),intent(in) :: lat(1)             !< latitude (radians)
+    real(kind_lake),intent(in) :: dz(1,-nlevsnow+1:nlevsoil)           !< layer thickness for soil or snow (m)
+    real(kind_lake),intent(in) :: dz_lake(1,nlevlake)                  !< layer thickness for lake (m)
+    real(kind_lake),intent(in) :: t_soisno(1,-nlevsnow+1:nlevsoil)     !< soil (or snow) temperature (Kelvin)
+    real(kind_lake),intent(in) :: t_lake(1,nlevlake)                   !< lake temperature (Kelvin)
+    integer ,intent(in) :: snl(1)                              !< number of snow layers
+    real(kind_lake),intent(in) :: h2osoi_liq(1,-nlevsnow+1:nlevsoil)    !< liquid water (kg/m2)
+    real(kind_lake),intent(in) :: h2osoi_ice(1,-nlevsnow+1:nlevsoil)    !< ice lens (kg/m2)
+    real(kind_lake),intent(in) :: savedtke1(1)       !< top level eddy conductivity from previous timestep (W/m.K)
 
     !inout:
-    real(kind_lake),intent(inout) :: t_grnd(1)          ! ground temperature (Kelvin)
+    real(kind_lake),intent(inout) :: t_grnd(1)          !< ground temperature (Kelvin)
     !out:
-    real(kind_lake),intent(out):: ustar_out(1)       ! friction velocity [m/s]
-    real(kind_lake),intent(out):: qflx_prec_grnd(1)  ! water onto ground including canopy runoff [kg/(m2 s)]
-    real(kind_lake),intent(out):: qflx_evap_soi(1)   ! soil evaporation (mm H2O/s) (+ = to atm)
-    real(kind_lake),intent(out):: qflx_evap_tot(1)   ! qflx_evap_soi + qflx_evap_veg + qflx_tran_veg
-    real(kind_lake),intent(out):: eflx_sh_grnd(1)    ! sensible heat flux from ground (W/m**2) [+ to atm]
-    real(kind_lake),intent(out):: eflx_lwrad_out(1)  ! emitted infrared (longwave) radiation (W/m**2)
-    real(kind_lake),intent(out):: eflx_lwrad_net(1)  ! net infrared (longwave) rad (W/m**2) [+ = to atm]
-    real(kind_lake),intent(out):: eflx_soil_grnd(1)  ! soil heat flux (W/m**2) [+ = into soil]
-    real(kind_lake),intent(out):: eflx_sh_tot(1)     ! total sensible heat flux (W/m**2) [+ to atm]
-    real(kind_lake),intent(out):: eflx_lh_tot(1)     ! total latent heat flux (W/m8*2)  [+ to atm]
-    real(kind_lake),intent(out):: eflx_lh_grnd(1)    ! ground evaporation heat flux (W/m**2) [+ to atm]
-    real(kind_lake),intent(out):: t_veg(1)           ! vegetation temperature (Kelvin)
-    real(kind_lake),intent(out):: t_ref2m(1)         ! 2 m height surface air temperature (Kelvin)
-    real(kind_lake),intent(out):: q_ref2m(1)         ! 2 m height surface specific humidity (kg/kg)
-    real(kind_lake),intent(out):: taux(1)            ! wind (shear) stress: e-w (kg/m/s**2)
-    real(kind_lake),intent(out):: tauy(1)            ! wind (shear) stress: n-s (kg/m/s**2)
-    real(kind_lake),intent(out):: ram1(1)            ! aerodynamical resistance (s/m)
-    real(kind_lake),intent(out):: ws(1)              ! surface friction velocity (m/s)
-    real(kind_lake),intent(out):: ks(1)              ! coefficient passed to ShalLakeTemperature
-                                               ! for calculation of decay of eddy diffusivity with depth
-    real(kind_lake),intent(out):: eflx_gnet(1)       !net heat flux into ground (W/m**2)
-                                               ! Change the type variable to pass back to WRF.
-    real(kind_lake),intent(out):: z0mg(1)            ! roughness length over ground, momentum (m(
+    real(kind_lake),intent(out):: ustar_out(1)       !< friction velocity [m/s]
+    real(kind_lake),intent(out):: qflx_prec_grnd(1)  !< water onto ground including canopy runoff [kg/(m2 s)]
+    real(kind_lake),intent(out):: qflx_evap_soi(1)   !< soil evaporation (mm H2O/s) (+ = to atm)
+    real(kind_lake),intent(out):: qflx_evap_tot(1)   !< qflx_evap_soi + qflx_evap_veg + qflx_tran_veg
+    real(kind_lake),intent(out):: eflx_sh_grnd(1)    !< sensible heat flux from ground (W/m**2) [+ to atm]
+    real(kind_lake),intent(out):: eflx_lwrad_out(1)  !< emitted infrared (longwave) radiation (W/m**2)
+    real(kind_lake),intent(out):: eflx_lwrad_net(1)  !< net infrared (longwave) rad (W/m**2) [+ = to atm]
+    real(kind_lake),intent(out):: eflx_soil_grnd(1)  !< soil heat flux (W/m**2) [+ = into soil]
+    real(kind_lake),intent(out):: eflx_sh_tot(1)     !< total sensible heat flux (W/m**2) [+ to atm]
+    real(kind_lake),intent(out):: eflx_lh_tot(1)     !< total latent heat flux (W/m8*2)  [+ to atm]
+    real(kind_lake),intent(out):: eflx_lh_grnd(1)    !< ground evaporation heat flux (W/m**2) [+ to atm]
+    real(kind_lake),intent(out):: t_veg(1)           !< vegetation temperature (Kelvin)
+    real(kind_lake),intent(out):: t_ref2m(1)         !< 2 m height surface air temperature (Kelvin)
+    real(kind_lake),intent(out):: q_ref2m(1)         !< 2 m height surface specific humidity (kg/kg)
+    real(kind_lake),intent(out):: taux(1)            !< wind (shear) stress: e-w (kg/m/s**2)
+    real(kind_lake),intent(out):: tauy(1)            !< wind (shear) stress: n-s (kg/m/s**2)
+    real(kind_lake),intent(out):: ram1(1)            !< aerodynamical resistance (s/m)
+    real(kind_lake),intent(out):: ws(1)              !< surface friction velocity (m/s)
+    real(kind_lake),intent(out):: ks(1)              !< coefficient passed to ShalLakeTemperature
+                                                     !! for calculation of decay of eddy diffusivity with depth
+    real(kind_lake),intent(out):: eflx_gnet(1)       !< net heat flux into ground (W/m**2)
+                                                     !! Change the type variable to pass back to WRF.
+    real(kind_lake),intent(out):: z0mg(1)            !< roughness length over ground, momentum (m(
 
 
 
@@ -1566,22 +1558,22 @@ SUBROUTINE ShalLakeTemperature(t_grnd,h2osno,sabg,dz,dz_lake,z,zi,           & !
                                  watsat, tksatu, tkmg, tkdry, csol, dtime,   &
                                  frac_iceold,qflx_snomelt,imelt,errmsg,errflg)
   !=======================================================================================================
-  ! !DESCRIPTION:
-  ! Calculates temperatures in the 20-25 layer column of (possible) snow,
-  ! lake water, and soil beneath lake.
-  ! Snow and soil temperatures are determined as in SoilTemperature, except
-  ! for appropriate boundary conditions at the top of the snow (the flux is fixed
-  ! to be the ground heat flux calculated in ShalLakeFluxes), the bottom of the snow
-  ! (adjacent to top lake layer), and the top of the soil (adjacent to the bottom
-  ! lake layer). Also, the soil is assumed to be always fully saturated (ShalLakeHydrology
-  ! will have to insure this). The whole column is solved simultaneously as one tridiagonal matrix.
-  ! Lake temperatures are determined from the Hostetler model as before, except now:
-  !    i) Lake water layers can freeze by any fraction and release latent heat; thermal
-  !       and mechanical properties are adjusted for ice fraction.
-  !   ii) Convective mixing (though not eddy diffusion) still occurs for frozen lakes.
-  !  iii) No sunlight is absorbed in the lake if there are snow layers.
-  !   iv) Light is allowed to reach the top soil layer (where it is assumed to be completely absorbed).
-  !    v) Lakes have variable depth, set ultimately in surface data set but now in initShalLakeMod.
+  ! DESCRIPTION:
+  !< Calculates temperatures in the 20-25 layer column of (possible) snow,
+  !! lake water, and soil beneath lake.
+  !! Snow and soil temperatures are determined as in SoilTemperature, except
+  !! for appropriate boundary conditions at the top of the snow (the flux is fixed
+  !! to be the ground heat flux calculated in ShalLakeFluxes), the bottom of the snow
+  !! (adjacent to top lake layer), and the top of the soil (adjacent to the bottom
+  !! lake layer). Also, the soil is assumed to be always fully saturated (ShalLakeHydrology
+  !! will have to insure this). The whole column is solved simultaneously as one tridiagonal matrix.
+  !! Lake temperatures are determined from the Hostetler model as before, except now:
+  !!\n    i) Lake water layers can freeze by any fraction and release latent heat; thermal
+  !!       and mechanical properties are adjusted for ice fraction.
+  !!\n   ii) Convective mixing (though not eddy diffusion) still occurs for frozen lakes.
+  !!\n  iii) No sunlight is absorbed in the lake if there are snow layers.
+  !!\n   iv) Light is allowed to reach the top soil layer (where it is assumed to be completely absorbed).
+  !!\n    v) Lakes have variable depth, set ultimately in surface data set but now in initShalLakeMod.
   !
   ! Eddy + molecular diffusion:
   ! d ts    d            d ts     1 ds
@@ -1652,49 +1644,49 @@ SUBROUTINE ShalLakeTemperature(t_grnd,h2osno,sabg,dz,dz_lake,z,zi,           & !
     implicit none
 
     !in:
-    integer, intent(inout) :: errflg
-    real(kind_lake), intent(in) :: watsat(1,nlevsoil)      ! volumetric soil water at saturation (porosity)
-    real(kind_lake), intent(in) :: tksatu(1,nlevsoil)      ! thermal conductivity, saturated soil [W/m-K]
-    real(kind_lake), intent(in) :: tkmg(1,nlevsoil)        ! thermal conductivity, soil minerals  [W/m-K]
-    real(kind_lake), intent(in) :: tkdry(1,nlevsoil)       ! thermal conductivity, dry soil (W/m/Kelvin)
-    real(kind_lake), intent(in) :: csol(1,nlevsoil)        ! heat capacity, soil solids (J/m**3/Kelvin)
-    character(*), intent(inout) :: errmsg
-    real(kind_lake), intent(in) :: t_grnd(1)          ! ground temperature (Kelvin)
-    real(kind_lake), intent(inout) :: h2osno(1)          ! snow water (mm H2O)
-    real(kind_lake), intent(in) :: sabg(1)            ! solar radiation absorbed by ground (W/m**2)
-    real(kind_lake), intent(in) :: dz(1,-nlevsnow + 1:nlevsoil)          ! layer thickness for snow & soil (m)
-    real(kind_lake), intent(in) :: dz_lake(1,nlevlake)                  ! layer thickness for lake (m)
-    real(kind_lake), intent(in) :: z(1,-nlevsnow+1:nlevsoil)             ! layer depth for snow & soil (m)
-    real(kind_lake), intent(in) :: zi(1,-nlevsnow+0:nlevsoil)            ! interface level below a "z" level (m)
-                                                                ! the other z and dz variables
-    real(kind_lake), intent(in) :: z_lake(1,nlevlake)  ! layer depth for lake (m)
-    real(kind_lake), intent(in) :: ws(1)              ! surface friction velocity (m/s)
-    real(kind_lake), intent(in) :: ks(1)              ! coefficient passed to ShalLakeTemperature
-                                               ! for calculation of decay of eddy diffusivity with depth
-    integer , intent(in) :: snl(1)             ! negative of number of snow layers
-    real(kind_lake), intent(inout) :: eflx_gnet(1)       ! net heat flux into ground (W/m**2) at the surface interface
-    real(kind_lake), intent(in) :: lakedepth(1)       ! column lake depth (m)
+    integer, intent(inout) :: errflg                       !<
+    real(kind_lake), intent(in) :: watsat(1,nlevsoil)      !< volumetric soil water at saturation (porosity)
+    real(kind_lake), intent(in) :: tksatu(1,nlevsoil)      !< thermal conductivity, saturated soil [W/m-K]
+    real(kind_lake), intent(in) :: tkmg(1,nlevsoil)        !< thermal conductivity, soil minerals  [W/m-K]
+    real(kind_lake), intent(in) :: tkdry(1,nlevsoil)       !< thermal conductivity, dry soil (W/m/Kelvin)
+    real(kind_lake), intent(in) :: csol(1,nlevsoil)        !< heat capacity, soil solids (J/m**3/Kelvin)
+    character(*), intent(inout) :: errmsg                  !<
+    real(kind_lake), intent(in) :: t_grnd(1)               !< ground temperature (Kelvin)
+    real(kind_lake), intent(inout) :: h2osno(1)            !< snow water (mm H2O)
+    real(kind_lake), intent(in) :: sabg(1)                 !< solar radiation absorbed by ground (W/m**2)
+    real(kind_lake), intent(in) :: dz(1,-nlevsnow + 1:nlevsoil)         !< layer thickness for snow & soil (m)
+    real(kind_lake), intent(in) :: dz_lake(1,nlevlake)                  !< layer thickness for lake (m)
+    real(kind_lake), intent(in) :: z(1,-nlevsnow+1:nlevsoil)            !< layer depth for snow & soil (m)
+    real(kind_lake), intent(in) :: zi(1,-nlevsnow+0:nlevsoil)           !< interface level below a "z" level (m)
+                                                                        !! the other z and dz variables
+    real(kind_lake), intent(in) :: z_lake(1,nlevlake)  !< layer depth for lake (m)
+    real(kind_lake), intent(in) :: ws(1)               !< surface friction velocity (m/s)
+    real(kind_lake), intent(in) :: ks(1)               !< coefficient passed to ShalLakeTemperature
+                                                       !! for calculation of decay of eddy diffusivity with depth
+    integer , intent(in) :: snl(1)                     !< negative of number of snow layers
+    real(kind_lake), intent(inout) :: eflx_gnet(1)     !< net heat flux into ground (W/m**2) at the surface interface
+    real(kind_lake), intent(in) :: lakedepth(1)        !< column lake depth (m)
     
    ! real(kind_lake), intent(in) :: watsat(1,nlevsoil)      ! volumetric soil water at saturation (porosity)
-    real(kind_lake), intent(inout) :: snowdp(1)        !snow height (m)
-    real(kind_lake), intent(in) :: dtime               !timestep
+    real(kind_lake), intent(inout) :: snowdp(1)        !< snow height (m)
+    real(kind_lake), intent(in) :: dtime               !< timestep
     !out: 
 
-    real(kind_lake), intent(out) :: eflx_sh_grnd(1)    ! sensible heat flux from ground (W/m**2) [+ to atm]
-    real(kind_lake), intent(out) :: eflx_sh_tot(1)     ! total sensible heat flux (W/m**2) [+ to atm]
-    real(kind_lake), intent(out) :: eflx_soil_grnd(1)  ! heat flux into snow / lake (W/m**2) [+ = into soil]
-                                               ! Here this includes the whole lake radiation absorbed.
-    !real(kind_lake), intent(out) :: qmelt(1)           ! snow melt [mm/s] [temporary]
+    real(kind_lake), intent(out) :: eflx_sh_grnd(1)    !< sensible heat flux from ground (W/m**2) [+ to atm]
+    real(kind_lake), intent(out) :: eflx_sh_tot(1)     !< total sensible heat flux (W/m**2) [+ to atm]
+    real(kind_lake), intent(out) :: eflx_soil_grnd(1)  !< heat flux into snow / lake (W/m**2) [+ = into soil]
+                                                       !! Here this includes the whole lake radiation absorbed.
+    !real(kind_lake), intent(out) :: qmelt(1)          !< snow melt [mm/s] [temporary]
 
-    real(kind_lake), intent(inout) :: t_lake(1,nlevlake)                 ! lake temperature (Kelvin)
-    real(kind_lake), intent(inout) :: t_soisno(1,-nlevsnow+1:nlevsoil)    ! soil (or snow) temperature (Kelvin)
-    real(kind_lake), intent(inout) :: h2osoi_liq(1,-nlevsnow+1:nlevsoil)  ! liquid water (kg/m2) [for snow & soil layers]
-    real(kind_lake), intent(inout) :: h2osoi_ice(1,-nlevsnow+1:nlevsoil)  ! ice lens (kg/m2) [for snow & soil layers]
-    real(kind_lake), intent(inout) :: lake_icefrac(1,nlevlake)           ! mass fraction of lake layer that is frozen
-    real(kind_lake), intent(out) :: savedtke1(1)                      ! top level thermal conductivity (W/mK)
-    real(kind_lake), intent(out) :: frac_iceold(1,-nlevsnow+1:nlevsoil) ! fraction of ice relative to the tot water
-    real(kind_lake), intent(out) :: qflx_snomelt(1)  !snow melt (mm H2O /s)
-    integer, intent(out)  :: imelt(1,-nlevsnow+1:nlevsoil)        !flag for melting (=1), freezing (=2), Not=0 (new)
+    real(kind_lake), intent(inout) :: t_lake(1,nlevlake)                  !< lake temperature (Kelvin)
+    real(kind_lake), intent(inout) :: t_soisno(1,-nlevsnow+1:nlevsoil)    !< soil (or snow) temperature (Kelvin)
+    real(kind_lake), intent(inout) :: h2osoi_liq(1,-nlevsnow+1:nlevsoil)  !< liquid water (kg/m2) [for snow & soil layers]
+    real(kind_lake), intent(inout) :: h2osoi_ice(1,-nlevsnow+1:nlevsoil)  !< ice lens (kg/m2) [for snow & soil layers]
+    real(kind_lake), intent(inout) :: lake_icefrac(1,nlevlake)            !< mass fraction of lake layer that is frozen
+    real(kind_lake), intent(out) :: savedtke1(1)                          !< top level thermal conductivity (W/mK)
+    real(kind_lake), intent(out) :: frac_iceold(1,-nlevsnow+1:nlevsoil)   !< fraction of ice relative to the tot water
+    real(kind_lake), intent(out) :: qflx_snomelt(1)  !< snow melt (mm H2O /s)
+    integer, intent(out)  :: imelt(1,-nlevsnow+1:nlevsoil)        !< flag for melting (=1), freezing (=2), Not=0 (new)
 
 
     ! OTHER LOCAL VARIABLES:
@@ -2540,52 +2532,48 @@ end subroutine ShalLakeTemperature
   !
   ! ROUTINE: SoilThermProp_Lake
   !
-  ! !INTERFACE:
+  ! INTERFACE:
+    ! DESCRIPTION:  
+    !> Calculation of thermal conductivities and heat capacities of
+    !! snow/soil layers
+    !!\n (1) The volumetric heat capacity is calculated as a linear combination
+    !!     in terms of the volumetric fraction of the constituent phases.
+    !!    
+    !!\n (2) The thermal conductivity of soil is computed from the algorithm of
+    !!     Johansen (as reported by Farouki 1981), and of snow is from the
+    !!     formulation used in SNTHERM (Jordan 1991).
+    !! The thermal conductivities at the interfaces between two neighboring
+    !! layers (j, j+1) are derived from an assumption that the flux across
+    !! the interface is equal to that from the node j to the interface and the
+    !! flux from the interface to the node j+1.
+    !!
+    !! For lakes, the proper soil layers (not snow) should always be saturated.
   subroutine SoilThermProp_Lake (snl,dz,zi,z,t_soisno,h2osoi_liq,h2osoi_ice,    &
        watsat, tksatu, tkmg, tkdry, csol, tk, cv, tktopsoillay,errmsg,errflg)
 
-    !
-    ! !DESCRIPTION:
-    ! Calculation of thermal conductivities and heat capacities of
-    ! snow/soil layers
-    ! (1) The volumetric heat capacity is calculated as a linear combination
-    !     in terms of the volumetric fraction of the constituent phases.
-    !
-    ! (2) The thermal conductivity of soil is computed from the algorithm of
-    !     Johansen (as reported by Farouki 1981), and of snow is from the
-    !     formulation used in SNTHERM (Jordan 1991).
-    ! The thermal conductivities at the interfaces between two neighboring
-    ! layers (j, j+1) are derived from an assumption that the flux across
-    ! the interface is equal to that from the node j to the interface and the
-    ! flux from the interface to the node j+1.
-    !
-    ! For lakes, the proper soil layers (not snow) should always be saturated.
-    !
-    ! !USES:
-    
     implicit none
     !in
 
-    integer, intent(inout) :: errflg
-    character(*), intent(inout) :: errmsg
-    integer , intent(in) :: snl(1)           ! number of snow layers
-    !    real(kind_lake), intent(in) :: h2osno(1)        ! snow water (mm H2O)
-    real(kind_lake), intent(in) :: watsat(1,nlevsoil)      ! volumetric soil water at saturation (porosity)
-    real(kind_lake), intent(in) :: tksatu(1,nlevsoil)      ! thermal conductivity, saturated soil [W/m-K]
-    real(kind_lake), intent(in) :: tkmg(1,nlevsoil)        ! thermal conductivity, soil minerals  [W/m-K]
-    real(kind_lake), intent(in) :: tkdry(1,nlevsoil)       ! thermal conductivity, dry soil (W/m/Kelvin)
-    real(kind_lake), intent(in) :: csol(1,nlevsoil)        ! heat capacity, soil solids (J/m**3/Kelvin)
-    real(kind_lake), intent(in) :: dz(1,-nlevsnow+1:nlevsoil)          ! layer thickness (m)
-    real(kind_lake), intent(in) :: zi(1,-nlevsnow+0:nlevsoil)          ! interface level below a "z" level (m)
-    real(kind_lake), intent(in) :: z(1,-nlevsnow+1:nlevsoil)           ! layer depth (m)
-    real(kind_lake), intent(in) :: t_soisno(1,-nlevsnow+1:nlevsoil)    ! soil temperature (Kelvin)
-    real(kind_lake), intent(in) :: h2osoi_liq(1,-nlevsnow+1:nlevsoil)  ! liquid water (kg/m2)
-    real(kind_lake), intent(in) :: h2osoi_ice(1,-nlevsnow+1:nlevsoil)  ! ice lens (kg/m2)
+    integer, intent(inout) :: errflg                       
+    character(*), intent(inout) :: errmsg                  
+    integer , intent(in) :: snl(1)                         !< number of snow layers
+    !    real(kind_lake), intent(in) :: h2osno(1)          !< snow water (mm H2O)
+    real(kind_lake), intent(in) :: watsat(1,nlevsoil)      !< volumetric soil water at saturation (porosity)
+    real(kind_lake), intent(in) :: tksatu(1,nlevsoil)      !< thermal conductivity, saturated soil [W/m-K]
+    real(kind_lake), intent(in) :: tkmg(1,nlevsoil)        !< thermal conductivity, soil minerals  [W/m-K]
+    real(kind_lake), intent(in) :: tkdry(1,nlevsoil)       !< thermal conductivity, dry soil (W/m/Kelvin)
+    real(kind_lake), intent(in) :: csol(1,nlevsoil)        !< heat capacity, soil solids (J/m**3/Kelvin)
+    real(kind_lake), intent(in) :: dz(1,-nlevsnow+1:nlevsoil)          !< layer thickness (m)
+    real(kind_lake), intent(in) :: zi(1,-nlevsnow+0:nlevsoil)          !< interface level below a "z" level (m)
+    real(kind_lake), intent(in) :: z(1,-nlevsnow+1:nlevsoil)           !< layer depth (m)
+    real(kind_lake), intent(in) :: t_soisno(1,-nlevsnow+1:nlevsoil)    !< soil temperature (Kelvin)
+    real(kind_lake), intent(in) :: h2osoi_liq(1,-nlevsnow+1:nlevsoil)  !< liquid water (kg/m2)
+    real(kind_lake), intent(in) :: h2osoi_ice(1,-nlevsnow+1:nlevsoil)  !< ice lens (kg/m2)
 
     !out
-    real(kind_lake), intent(out) :: cv(lbc:ubc,-nlevsnow+1:nlevsoil) ! heat capacity [J/(m2 K)]
-    real(kind_lake), intent(out) :: tk(lbc:ubc,-nlevsnow+1:nlevsoil) ! thermal conductivity [W/(m K)]
-    real(kind_lake), intent(out) :: tktopsoillay(lbc:ubc)          ! thermal conductivity [W/(m K)]
+    real(kind_lake), intent(out) :: cv(lbc:ubc,-nlevsnow+1:nlevsoil) !< heat capacity [J/(m2 K)]
+    real(kind_lake), intent(out) :: tk(lbc:ubc,-nlevsnow+1:nlevsoil) !< thermal conductivity [W/(m K)]
+    real(kind_lake), intent(out) :: tktopsoillay(lbc:ubc)            !< thermal conductivity [W/(m K)]
     !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     ! !CALLED FROM:
     ! subroutine ShalLakeTemperature in this module.
@@ -2754,6 +2742,24 @@ end subroutine SoilThermProp_Lake
   ! ROUTINE: PhaseChange_Lake
   !
   ! !INTERFACE:
+
+    ! DESCRIPTION:
+    !> Calculation of the phase change within snow, soil, & lake layers:
+    !!\n (1) Check the conditions for which the phase change may take place,
+    !!     i.e., the layer temperature is great than the freezing point
+    !!     and the ice mass is not equal to zero (i.e. melting),       
+    !!     or the layer temperature is less than the freezing point    
+    !!     and the liquid water mass is greater than the allowable supercooled 
+    !!    (i.e. freezing).
+    !!\n (2) Assess the amount of phase change from the energy excess (or deficit)
+    !!     after setting the layer temperature to freezing point, depending on
+    !!     how much water or ice is available.
+    !!\n (3) Re-adjust the ice and liquid mass, and the layer temperature: either to
+    !!     the freezing point if enough water or ice is available to fully compensate,
+    !!     or to a remaining temperature.
+    !!
+    !! The specific heats are assumed constant. Potential cycling errors resulting from
+    !! this assumption will be trapped at the end of ShalLakeTemperature.
   subroutine PhaseChange_Lake (snl,h2osno,dz,dz_lake,                        & !i
                                t_soisno,h2osoi_liq,h2osoi_ice,               & !i&o
                                lake_icefrac,t_lake, snowdp,                  & !i&o
@@ -2761,28 +2767,12 @@ subroutine PhaseChange_Lake (snl,h2osno,dz,dz_lake,                        & !i
                                cv, cv_lake,                                  & !i&o
                                lhabs)                                          !o
     !=============================================================================================
-    ! !DESCRIPTION:
-    ! Calculation of the phase change within snow, soil, & lake layers:
-    ! (1) Check the conditions for which the phase change may take place,
-    !     i.e., the layer temperature is great than the freezing point
-    !     and the ice mass is not equal to zero (i.e. melting),
-    !     or the layer temperature is less than the freezing point
-    !     and the liquid water mass is greater than the allowable supercooled 
-    !    (i.e. freezing).
-    ! (2) Assess the amount of phase change from the energy excess (or deficit)
-    !     after setting the layer temperature to freezing point, depending on
-    !     how much water or ice is available.
-    ! (3) Re-adjust the ice and liquid mass, and the layer temperature: either to
-    !     the freezing point if enough water or ice is available to fully compensate,
-    !     or to a remaining temperature.
-    ! The specific heats are assumed constant. Potential cycling errors resulting from
-    ! this assumption will be trapped at the end of ShalLakeTemperature.
-    ! !CALLED FROM:
+    !CALLED FROM:
     ! subroutine ShalLakeTemperature in this module
     !
-    ! !REVISION HISTORY:
-    ! 04/2009 Zack Subin: Initial code
-    ! June 2022 Sam Trahan: Modified for CCPP
+    !REVISION HISTORY:
+    ! - 04/2009 Zack Subin: Initial code
+    ! - June 2022 Sam Trahan: Modified for CCPP
     !==============================================================================================
     ! !USES:
     !
@@ -2790,29 +2780,29 @@ subroutine PhaseChange_Lake (snl,h2osno,dz,dz_lake,                        & !i
     implicit none
     !in: 
 
-    integer , intent(in) :: snl(1)           !number of snow layers
-    real(kind_lake), intent(inout) :: h2osno(1)        !snow water (mm H2O)
-    real(kind_lake), intent(in) :: dz(1,-nlevsnow+1:nlevsoil)          !layer thickness (m)
-    real(kind_lake), intent(in) :: dz_lake(1,nlevlake)     !lake layer thickness (m)
+    integer , intent(in) :: snl(1)           !< number of snow layers
+    real(kind_lake), intent(inout) :: h2osno(1)        !< snow water (mm H2O)
+    real(kind_lake), intent(in) :: dz(1,-nlevsnow+1:nlevsoil)          !< layer thickness (m)
+    real(kind_lake), intent(in) :: dz_lake(1,nlevlake)     !< lake layer thickness (m)
     ! Needed in case snow height is less than critical value.
 
     !inout: 
 
-    real(kind_lake), intent(inout) :: snowdp(1)        !snow height (m)
-    real(kind_lake), intent(inout) :: t_soisno(1,-nlevsnow+1:nlevsoil)     !soil temperature (Kelvin)
-    real(kind_lake), intent(inout) :: h2osoi_liq(1,-nlevsnow+1:nlevsoil)   !liquid water (kg/m2)
-    real(kind_lake), intent(inout) :: h2osoi_ice(1,-nlevsnow+1:nlevsoil)   !ice lens (kg/m2)
-    real(kind_lake), intent(inout) :: lake_icefrac(1,nlevlake) ! mass fraction of lake layer that is frozen
-    real(kind_lake), intent(inout) :: t_lake(1,nlevlake)       ! lake temperature (Kelvin)
+    real(kind_lake), intent(inout) :: snowdp(1)        !< snow height (m)
+    real(kind_lake), intent(inout) :: t_soisno(1,-nlevsnow+1:nlevsoil)     !< soil temperature (Kelvin)
+    real(kind_lake), intent(inout) :: h2osoi_liq(1,-nlevsnow+1:nlevsoil)   !< liquid water (kg/m2)
+    real(kind_lake), intent(inout) :: h2osoi_ice(1,-nlevsnow+1:nlevsoil)   !< ice lens (kg/m2)
+    real(kind_lake), intent(inout) :: lake_icefrac(1,nlevlake) !<  mass fraction of lake layer that is frozen
+    real(kind_lake), intent(inout) :: t_lake(1,nlevlake)       !<  lake temperature (Kelvin)
     !out: 
 
-    real(kind_lake), intent(out) :: qflx_snomelt(1)  !snow melt (mm H2O /s)
-    real(kind_lake), intent(out) :: eflx_snomelt(1)  !snow melt heat flux (W/m**2)
-    integer, intent(out)  :: imelt(1,-nlevsnow+1:nlevsoil)        !flag for melting (=1), freezing (=2), Not=0 (new)
+    real(kind_lake), intent(out) :: qflx_snomelt(1)  !< snow melt (mm H2O /s)
+    real(kind_lake), intent(out) :: eflx_snomelt(1)  !< snow melt heat flux (W/m**2)
+    integer, intent(out)  :: imelt(1,-nlevsnow+1:nlevsoil)        !< flag for melting (=1), freezing (=2), Not=0 (new)
                                           !What's the sign of this? Is it just output?
-    real(kind_lake), intent(inout) :: cv(lbc:ubc,-nlevsnow+1:nlevsoil)       ! heat capacity [J/(m2 K)]
-    real(kind_lake), intent(inout) :: cv_lake (lbc:ubc,1:nlevlake)          ! heat capacity [J/(m2 K)]
-    real(kind_lake), intent(out):: lhabs(lbc:ubc)                       ! total per-column latent heat abs. (J/m^2)
+    real(kind_lake), intent(inout) :: cv(lbc:ubc,-nlevsnow+1:nlevsoil)       !< heat capacity [J/(m2 K)]
+    real(kind_lake), intent(inout) :: cv_lake (lbc:ubc,1:nlevlake)          !< heat capacity [J/(m2 K)]
+    real(kind_lake), intent(out):: lhabs(lbc:ubc)                       !<  total per-column latent heat abs. (J/m^2)
 
 
     ! OTHER LOCAL VARIABLES:
@@ -2972,7 +2962,19 @@ subroutine PhaseChange_Lake (snl,h2osno,dz,dz_lake,                        & !i
 
    end subroutine PhaseChange_Lake
 
-
+    ! DESCRIPTION:
+    !> Calculation of Shallow Lake Hydrology. Full hydrology of snow layers is
+    !! done. However, there is no infiltration, and the water budget is balanced with
+    !! qflx_qrgwl. Lake water mass is kept constant. The soil is simply maintained at
+    !! volumetric saturation if ice melting frees up pore space. Likewise, if the water
+    !! portion alone at some point exceeds pore capacity, it is reduced. This is consistent
+    !! with the possibility of initializing the soil layer with excess ice. The only
+    !! real error with that is that the thermal conductivity will ignore the excess ice
+    !! (and accompanying thickness change).
+    !!
+    !! If snow layers are present over an unfrozen lake, and the top layer of the lake
+    !! is capable of absorbing the latent heat without going below freezing,
+    !! the snow-water is runoff and the latent heat is subtracted from the lake.
   subroutine ShalLakeHydrology(dz_lake,forc_rain,forc_snow,                      & !i
                                begwb,qflx_evap_tot,forc_t,do_capsnow,            &
                                t_grnd,qflx_evap_soi,                             &
@@ -2991,19 +2993,6 @@ subroutine ShalLakeHydrology(dz_lake,forc_rain,forc_snow,                      &
                                dtime,errmsg,errflg)
                        
     !==================================================================================
-    ! !DESCRIPTION:
-    ! Calculation of Shallow Lake Hydrology. Full hydrology of snow layers is
-    ! done. However, there is no infiltration, and the water budget is balanced with 
-    ! qflx_qrgwl. Lake water mass is kept constant. The soil is simply maintained at
-    ! volumetric saturation if ice melting frees up pore space. Likewise, if the water
-    ! portion alone at some point exceeds pore capacity, it is reduced. This is consistent
-    ! with the possibility of initializing the soil layer with excess ice. The only
-    ! real error with that is that the thermal conductivity will ignore the excess ice
-    ! (and accompanying thickness change).
-    ! 
-    ! If snow layers are present over an unfrozen lake, and the top layer of the lake
-    ! is capable of absorbing the latent heat without going below freezing, 
-    ! the snow-water is runoff and the latent heat is subtracted from the lake.
     !
     ! WARNING: This subroutine assumes lake columns have one and only one pft.
     !
@@ -3034,79 +3023,79 @@ subroutine ShalLakeHydrology(dz_lake,forc_rain,forc_snow,                      &
     integer, intent(inout) :: errflg
     character(*), intent(inout) :: errmsg
 
-    real(kind_lake) :: watsat(1,nlevsoil)      ! volumetric soil water at saturation (porosity)
-    real(kind_lake) :: tksatu(1,nlevsoil)      ! thermal conductivity, saturated soil [W/m-K]
-    real(kind_lake) :: tkmg(1,nlevsoil)        ! thermal conductivity, soil minerals  [W/m-K]
-    real(kind_lake) :: tkdry(1,nlevsoil)       ! thermal conductivity, dry soil (W/m/Kelvin)
-    real(kind_lake) :: csol(1,nlevsoil)        ! heat capacity, soil solids (J/m**3/Kelvin)
-
-   ! integer , intent(in) :: clandunit(1)     ! column's landunit
-   ! integer , intent(in) :: ityplun(1)       ! landunit type
-    real(kind_lake), intent(in) :: dtime      ! timestep
-    real(kind_lake), intent(in) :: dz_lake(1,nlevlake)     ! layer thickness for lake (m)
-    real(kind_lake), intent(in) :: forc_rain(1)     ! rain rate [mm/s]
-    real(kind_lake), intent(in) :: forc_snow(1)     ! snow rate [mm/s]
-    real(kind_lake), intent(in) :: qflx_evap_tot(1) ! qflx_evap_soi + qflx_evap_veg + qflx_tran_veg
-    real(kind_lake), intent(in) :: forc_t(1)        ! atmospheric temperature (Kelvin)
-
-    !real(kind_lake), intent(in),optional :: flfall(1)        ! fraction of liquid water within falling precipitation (unused)
-
-    logical , intent(in) :: do_capsnow(1)     ! true => do snow capping
-    real(kind_lake), intent(in) :: t_grnd(1)          ! ground temperature (Kelvin)
-    real(kind_lake), intent(in) :: qflx_evap_soi(1)   ! soil evaporation (mm H2O/s) (+ = to atm)
-    real(kind_lake), intent(in) :: qflx_snomelt(1)     !snow melt (mm H2O /s)
-    integer,  intent(in) :: imelt(1,-nlevsnow+1:nlevsoil)        !flag for melting (=1), freezing (=2), Not=0
+    real(kind_lake) :: watsat(1,nlevsoil)      !< volumetric soil water at saturation (porosity)
+    real(kind_lake) :: tksatu(1,nlevsoil)      !< thermal conductivity, saturated soil [W/m-K]
+    real(kind_lake) :: tkmg(1,nlevsoil)        !< thermal conductivity, soil minerals  [W/m-K]
+    real(kind_lake) :: tkdry(1,nlevsoil)       !< thermal conductivity, dry soil (W/m/Kelvin)
+    real(kind_lake) :: csol(1,nlevsoil)        !< heat capacity, soil solids (J/m**3/Kelvin)
+
+   ! integer , intent(in) :: clandunit(1)     !< column's landunit
+   ! integer , intent(in) :: ityplun(1)       !< landunit type
+    real(kind_lake), intent(in) :: dtime      !< timestep
+    real(kind_lake), intent(in) :: dz_lake(1,nlevlake)     !< layer thickness for lake (m)
+    real(kind_lake), intent(in) :: forc_rain(1)     !< rain rate [mm/s]
+    real(kind_lake), intent(in) :: forc_snow(1)     !< snow rate [mm/s]
+    real(kind_lake), intent(in) :: qflx_evap_tot(1) !< qflx_evap_soi + qflx_evap_veg + qflx_tran_veg
+    real(kind_lake), intent(in) :: forc_t(1)        !< atmospheric temperature (Kelvin)
+
+    !real(kind_lake), intent(in),optional :: flfall(1)        !< fraction of liquid water within falling precipitation (unused)
+
+    logical , intent(in) :: do_capsnow(1)     !< true => do snow capping
+    real(kind_lake), intent(in) :: t_grnd(1)          !< ground temperature (Kelvin)
+    real(kind_lake), intent(in) :: qflx_evap_soi(1)   !< soil evaporation (mm H2O/s) (+ = to atm)
+    real(kind_lake), intent(in) :: qflx_snomelt(1)     !< snow melt (mm H2O /s)
+    integer,  intent(in) :: imelt(1,-nlevsnow+1:nlevsoil)        !< flag for melting (=1), freezing (=2), Not=0
 
     !inout:
 
-    real(kind_lake), intent(inout) :: begwb(1)         ! water mass begining of the time step
+    real(kind_lake), intent(inout) :: begwb(1)         !< water mass begining of the time step
 
     ! inout: 
 
     
-    real(kind_lake), intent(inout) :: z(1,-nlevsnow+1:nlevsoil)           ! layer depth  (m)
-    real(kind_lake), intent(inout) :: dz(1,-nlevsnow+1:nlevsoil)          ! layer thickness depth (m)
-    real(kind_lake), intent(inout) :: zi(1,-nlevsnow+0:nlevsoil)          ! interface depth (m)
-    integer , intent(inout) :: snl(1)           ! number of snow layers
-    real(kind_lake), intent(inout) :: h2osno(1)        ! snow water (mm H2O)
-    real(kind_lake), intent(inout) :: snowdp(1)        ! snow height (m)
-    real(kind_lake), intent(inout) :: lake_icefrac(1,nlevlake)  ! mass fraction of lake layer that is frozen
-    real(kind_lake), intent(inout) :: t_lake(1,nlevlake)        ! lake temperature (Kelvin)
-
-    real(kind_lake), intent(inout) :: frac_iceold(1,-nlevsnow+1:nlevsoil)      ! fraction of ice relative to the tot water
+    real(kind_lake), intent(inout) :: z(1,-nlevsnow+1:nlevsoil)           !< layer depth  (m)
+    real(kind_lake), intent(inout) :: dz(1,-nlevsnow+1:nlevsoil)          !< layer thickness depth (m)
+    real(kind_lake), intent(inout) :: zi(1,-nlevsnow+0:nlevsoil)          !< interface depth (m)
+    integer , intent(inout) :: snl(1)           !< number of snow layers
+    real(kind_lake), intent(inout) :: h2osno(1)        !< snow water (mm H2O)
+    real(kind_lake), intent(inout) :: snowdp(1)        !< snow height (m)
+    real(kind_lake), intent(inout) :: lake_icefrac(1,nlevlake)  !< mass fraction of lake layer that is frozen
+    real(kind_lake), intent(inout) :: t_lake(1,nlevlake)        !< lake temperature (Kelvin)
+
+    real(kind_lake), intent(inout) :: frac_iceold(1,-nlevsnow+1:nlevsoil)      !< fraction of ice relative to the tot water
     ! out: 
 
 
-    real(kind_lake), intent(out) :: endwb(1)         ! water mass end of the time step
-    real(kind_lake), intent(out) :: snowage(1)       ! non dimensional snow age [-]
-    real(kind_lake), intent(out) :: snowice(1)       ! average snow ice lens
-    real(kind_lake), intent(out) :: snowliq(1)       ! average snow liquid water
-    real(kind_lake), intent(out) :: t_snow(1)        ! vertically averaged snow temperature
-    real(kind_lake), intent(out) :: t_soisno(1,-nlevsnow+1:nlevsoil)    ! snow temperature (Kelvin)
-    real(kind_lake), intent(out) :: h2osoi_ice(1,-nlevsnow+1:nlevsoil)  ! ice lens (kg/m2)
-    real(kind_lake), intent(out) :: h2osoi_liq(1,-nlevsnow+1:nlevsoil)  ! liquid water (kg/m2)
-    real(kind_lake), intent(out) :: h2osoi_vol(1,-nlevsnow+1:nlevsoil)  ! volumetric soil water (0<=h2osoi_vol<=watsat)[m3/m3]
-    real(kind_lake), intent(out) :: qflx_drain(1)    ! sub-surface runoff (mm H2O /s)
-    real(kind_lake), intent(out) :: qflx_surf(1)     ! surface runoff (mm H2O /s)
-    real(kind_lake), intent(out) :: qflx_infl(1)     ! infiltration (mm H2O /s)
-    real(kind_lake), intent(out) :: qflx_qrgwl(1)    ! qflx_surf at glaciers, wetlands, lakes
-    real(kind_lake), intent(out) :: qcharge(1)       ! aquifer recharge rate (mm/s)
-    real(kind_lake), intent(out) :: qflx_prec_grnd(1)     ! water onto ground including canopy runoff [kg/(m2 s)]
-    real(kind_lake), intent(out) :: qflx_snowcap(1)       ! excess precipitation due to snow capping (mm H2O /s) [+]
-    real(kind_lake), intent(out) :: qflx_snowcap_col(1)   ! excess precipitation due to snow capping (mm H2O /s) [+]
-    real(kind_lake), intent(out) :: qflx_snow_grnd_pft(1) ! snow on ground after interception (mm H2O/s) [+]
-    real(kind_lake), intent(out) :: qflx_snow_grnd_col(1) ! snow on ground after interception (mm H2O/s) [+]
-    real(kind_lake), intent(out) :: qflx_rain_grnd(1)     ! rain on ground after interception (mm H2O/s) [+]
-    real(kind_lake), intent(out) :: qflx_evap_tot_col(1) !pft quantity averaged to the column (assuming one pft)
-    real(kind_lake) ,intent(out) :: soilalpha(1)     !factor that reduces ground saturated specific humidity (-)
-    real(kind_lake), intent(out) :: zwt(1)           !water table depth
-    real(kind_lake), intent(out) :: fcov(1)          !fractional area with water table at surface
-    real(kind_lake), intent(out) :: rootr_column(1,1:nlevsoil) !effective fraction of roots in each soil layer
-    real(kind_lake), intent(out) :: qflx_evap_grnd(1)  ! ground surface evaporation rate (mm H2O/s) [+]
-    real(kind_lake), intent(out) :: qflx_sub_snow(1)   ! sublimation rate from snow pack (mm H2O /s) [+]
-    real(kind_lake), intent(out) :: qflx_dew_snow(1)   ! surface dew added to snow pack (mm H2O /s) [+]
-    real(kind_lake), intent(out) :: qflx_dew_grnd(1)   ! ground surface dew formation (mm H2O /s) [+]
-    real(kind_lake), intent(out) :: qflx_rain_grnd_col(1)   !rain on ground after interception (mm H2O/s) [+]
+    real(kind_lake), intent(out) :: endwb(1)         !< water mass end of the time step
+    real(kind_lake), intent(out) :: snowage(1)       !< non dimensional snow age [-]
+    real(kind_lake), intent(out) :: snowice(1)       !< average snow ice lens
+    real(kind_lake), intent(out) :: snowliq(1)       !< average snow liquid water
+    real(kind_lake), intent(out) :: t_snow(1)        !< vertically averaged snow temperature
+    real(kind_lake), intent(out) :: t_soisno(1,-nlevsnow+1:nlevsoil)    !< snow temperature (Kelvin)
+    real(kind_lake), intent(out) :: h2osoi_ice(1,-nlevsnow+1:nlevsoil)  !< ice lens (kg/m2)
+    real(kind_lake), intent(out) :: h2osoi_liq(1,-nlevsnow+1:nlevsoil)  !< liquid water (kg/m2)
+    real(kind_lake), intent(out) :: h2osoi_vol(1,-nlevsnow+1:nlevsoil)  !< volumetric soil water (0<=h2osoi_vol<=watsat)[m3/m3]
+    real(kind_lake), intent(out) :: qflx_drain(1)    !< sub-surface runoff (mm H2O /s)
+    real(kind_lake), intent(out) :: qflx_surf(1)     !< surface runoff (mm H2O /s)
+    real(kind_lake), intent(out) :: qflx_infl(1)     !< infiltration (mm H2O /s)
+    real(kind_lake), intent(out) :: qflx_qrgwl(1)    !< qflx_surf at glaciers, wetlands, lakes
+    real(kind_lake), intent(out) :: qcharge(1)       !< aquifer recharge rate (mm/s)
+    real(kind_lake), intent(out) :: qflx_prec_grnd(1)     !< water onto ground including canopy runoff [kg/(m2 s)]
+    real(kind_lake), intent(out) :: qflx_snowcap(1)       !< excess precipitation due to snow capping (mm H2O /s) [+]
+    real(kind_lake), intent(out) :: qflx_snowcap_col(1)   !< excess precipitation due to snow capping (mm H2O /s) [+]
+    real(kind_lake), intent(out) :: qflx_snow_grnd_pft(1) !< snow on ground after interception (mm H2O/s) [+]
+    real(kind_lake), intent(out) :: qflx_snow_grnd_col(1) !< snow on ground after interception (mm H2O/s) [+]
+    real(kind_lake), intent(out) :: qflx_rain_grnd(1)     !< rain on ground after interception (mm H2O/s) [+]
+    real(kind_lake), intent(out) :: qflx_evap_tot_col(1) !< pft quantity averaged to the column (assuming one pft)
+    real(kind_lake) ,intent(out) :: soilalpha(1)     !< factor that reduces ground saturated specific humidity (-)
+    real(kind_lake), intent(out) :: zwt(1)           !< water table depth
+    real(kind_lake), intent(out) :: fcov(1)          !< fractional area with water table at surface
+    real(kind_lake), intent(out) :: rootr_column(1,1:nlevsoil) !< effective fraction of roots in each soil layer
+    real(kind_lake), intent(out) :: qflx_evap_grnd(1)  !< ground surface evaporation rate (mm H2O/s) [+]
+    real(kind_lake), intent(out) :: qflx_sub_snow(1)   !< sublimation rate from snow pack (mm H2O /s) [+]
+    real(kind_lake), intent(out) :: qflx_dew_snow(1)   !< surface dew added to snow pack (mm H2O /s) [+]
+    real(kind_lake), intent(out) :: qflx_dew_grnd(1)   !< ground surface dew formation (mm H2O /s) [+]
+    real(kind_lake), intent(out) :: qflx_rain_grnd_col(1)   !< rain on ground after interception (mm H2O/s) [+]
 
     ! Block of biogeochem currently not used.
     real(kind_lake), pointer :: sucsat(:,:)      ! minimum soil suction (mm)
@@ -3644,25 +3633,25 @@ subroutine ShalLakeHydrology(dz_lake,forc_rain,forc_snow,                      &
     
   end subroutine ShalLakeHydrology
 
+! DESCRIPTION:
+!> Computes saturation mixing ratio and the change in saturation
+!! mixing ratio with respect to temperature.
   subroutine QSat (T, p, es, esdT, qs, qsdT)
     !
-    ! !DESCRIPTION:
-    ! Computes saturation mixing ratio and the change in saturation
-    ! mixing ratio with respect to temperature.
     ! Reference:  Polynomial approximations from:
     !             Piotr J. Flatau, et al.,1992:  Polynomial fits to saturation
     !             vapor pressure.  Journal of Applied Meteorology, 31, 1507-1513.
     !
-    ! !USES:
+    ! USES:
     !
-    ! !ARGUMENTS:
+    ! ARGUMENTS:
     implicit none
-    real(kind_lake), intent(in)  :: T        ! temperature (K)
-    real(kind_lake), intent(in)  :: p        ! surface atmospheric pressure (pa)
-    real(kind_lake), intent(out) :: es       ! vapor pressure (pa)
-    real(kind_lake), intent(out) :: esdT     ! d(es)/d(T)
-    real(kind_lake), intent(out) :: qs       ! humidity (kg/kg)
-    real(kind_lake), intent(out) :: qsdT     ! d(qs)/d(T)
+    real(kind_lake), intent(in)  :: T        !< temperature (K)
+    real(kind_lake), intent(in)  :: p        !< surface atmospheric pressure (pa)
+    real(kind_lake), intent(out) :: es       !< vapor pressure (pa)
+    real(kind_lake), intent(out) :: esdT     !< d(es)/d(T)
+    real(kind_lake), intent(out) :: qs       !< humidity (kg/kg)
+    real(kind_lake), intent(out) :: qsdT     !< d(qs)/d(T)
     !
     ! !CALLED FROM:
     ! subroutine Biogeophysics1 in module Biogeophysics1Mod
@@ -3762,21 +3751,21 @@ end subroutine QSat
   subroutine Tridiagonal (lbc, ubc, lbj, ubj, jtop, numf, filter, &
                           a, b, c, r, u)
     !
-    ! !DESCRIPTION:
-    ! Tridiagonal matrix solution
+    ! DESCRIPTION:
+    !< Tridiagonal matrix solution
     !
-    ! !ARGUMENTS:
+    ! ARGUMENTS:
     implicit none
-    integer , intent(in)    :: lbc, ubc               ! lbinning and ubing column indices
-    integer , intent(in)    :: lbj, ubj               ! lbinning and ubing level indices
-    integer , intent(in)    :: jtop(lbc:ubc)          ! top level for each column
-    integer , intent(in)    :: numf                   ! filter dimension
-    integer , intent(in)    :: filter(1:numf)         ! filter
-    real(kind_lake), intent(in)    :: a(lbc:ubc, lbj:ubj)    ! "a" left off diagonal of tridiagonal matrix
-    real(kind_lake), intent(in)    :: b(lbc:ubc, lbj:ubj)    ! "b" diagonal column for tridiagonal matrix
-    real(kind_lake), intent(in)    :: c(lbc:ubc, lbj:ubj)    ! "c" right off diagonal tridiagonal matrix
-    real(kind_lake), intent(in)    :: r(lbc:ubc, lbj:ubj)    ! "r" forcing term of tridiagonal matrix
-    real(kind_lake), intent(inout) :: u(lbc:ubc, lbj:ubj)    ! solution
+    integer , intent(in)    :: lbc, ubc               !< lbinning and ubing column indices
+    integer , intent(in)    :: lbj, ubj               !< lbinning and ubing level indices
+    integer , intent(in)    :: jtop(lbc:ubc)          !< top level for each column
+    integer , intent(in)    :: numf                   !< filter dimension
+    integer , intent(in)    :: filter(1:numf)         !< filter
+    real(kind_lake), intent(in)    :: a(lbc:ubc, lbj:ubj)    !< "a" left off diagonal of tridiagonal matrix
+    real(kind_lake), intent(in)    :: b(lbc:ubc, lbj:ubj)    !< "b" diagonal column for tridiagonal matrix
+    real(kind_lake), intent(in)    :: c(lbc:ubc, lbj:ubj)    !< "c" right off diagonal tridiagonal matrix
+    real(kind_lake), intent(in)    :: r(lbc:ubc, lbj:ubj)    !< "r" forcing term of tridiagonal matrix
+    real(kind_lake), intent(inout) :: u(lbc:ubc, lbj:ubj)    !< solution
     !
     ! !CALLED FROM:
     ! subroutine BiogeophysicsLake in module BiogeophysicsLakeMod
@@ -3841,6 +3830,17 @@ subroutine Tridiagonal (lbc, ubc, lbj, ubj, jtop, numf, filter, &
   end subroutine Tridiagonal
 
 
+    ! DESCRIPTION:
+    !> Evaluate the change of snow mass and the snow water onto soil.
+    !! Water flow within snow is computed by an explicit and non-physical
+    !! based scheme, which permits a part of liquid water over the holding 
+    !! capacity (a tentative value is used, i.e. equal to 0.033*porosity) to
+    !! percolate into the underlying layer.  Except for cases where the
+    !! porosity of one of the two neighboring layers is less than 0.05, zero
+    !! flow is assumed. The water flow out of the bottom of the snow pack will
+    !! participate as the input of the soil water and runoff.  This subroutine
+    !! uses a filter for columns containing snow which must be constructed prior
+    !! to being called.
   subroutine SnowWater(lbc, ubc, num_snowc, filter_snowc,         & !i
                    num_nosnowc, filter_nosnowc,               & !i 
                    snl,do_capsnow,qflx_snomelt,qflx_rain_grnd,            & !i
@@ -3849,18 +3849,6 @@ subroutine SnowWater(lbc, ubc, num_snowc, filter_snowc,         & !i
                    h2osoi_ice,h2osoi_liq,                                 & !i&o 
                    qflx_top_soil)                                           !o                        
     !===============================================================================
-    ! !DESCRIPTION:
-    ! Evaluate the change of snow mass and the snow water onto soil.
-    ! Water flow within snow is computed by an explicit and non-physical
-    ! based scheme, which permits a part of liquid water over the holding
-    ! capacity (a tentative value is used, i.e. equal to 0.033*porosity) to
-    ! percolate into the underlying layer.  Except for cases where the
-    ! porosity of one of the two neighboring layers is less than 0.05, zero
-    ! flow is assumed. The water flow out of the bottom of the snow pack will
-    ! participate as the input of the soil water and runoff.  This subroutine
-    ! uses a filter for columns containing snow which must be constructed prior
-    ! to being called.
-    !
     ! !REVISION HISTORY:
     ! 15 September 1999: Yongjiu Dai; Initial code
     ! 15 December 1999:  Paul Houser and Jon Radakovich; F90 Revision
@@ -3873,32 +3861,32 @@ subroutine SnowWater(lbc, ubc, num_snowc, filter_snowc,         & !i
     implicit none
 
     !in:
-    integer, intent(in) :: lbc, ubc                    ! column bounds
-    integer, intent(in) :: num_snowc                   ! number of snow points in column filter
-    integer, intent(in) :: filter_snowc(ubc-lbc+1)     ! column filter for snow points
-    integer, intent(in) :: num_nosnowc                 ! number of non-snow points in column filter
-    integer, intent(in) :: filter_nosnowc(ubc-lbc+1)   ! column filter for non-snow points
-
-    integer , intent(in) :: snl(1)              !number of snow layers
-    logical , intent(in) :: do_capsnow(1)       !true => do snow capping
-    real(kind_lake), intent(in) :: dtime               !timestep
-    real(kind_lake), intent(in) :: qflx_snomelt(1)     !snow melt (mm H2O /s)
-    real(kind_lake), intent(in) :: qflx_rain_grnd(1)   !rain on ground after interception (mm H2O/s) [+]
-    real(kind_lake), intent(in) :: qflx_sub_snow(1)    !sublimation rate from snow pack (mm H2O /s) [+]
-    real(kind_lake), intent(in) :: qflx_evap_grnd(1)   !ground surface evaporation rate (mm H2O/s) [+]
-    real(kind_lake), intent(in) :: qflx_dew_snow(1)    !surface dew added to snow pack (mm H2O /s) [+]
-    real(kind_lake), intent(in) :: qflx_dew_grnd(1)    !ground surface dew formation (mm H2O /s) [+]
-    real(kind_lake), intent(in) :: dz(1,-nlevsnow+1:nlevsoil)             !layer depth (m)
+    integer, intent(in) :: lbc, ubc                    !< column bounds
+    integer, intent(in) :: num_snowc                   !< number of snow points in column filter
+    integer, intent(in) :: filter_snowc(ubc-lbc+1)     !< column filter for snow points
+    integer, intent(in) :: num_nosnowc                 !< number of non-snow points in column filter
+    integer, intent(in) :: filter_nosnowc(ubc-lbc+1)   !< column filter for non-snow points
+
+    integer , intent(in) :: snl(1)              !< number of snow layers
+    logical , intent(in) :: do_capsnow(1)       !< true => do snow capping
+    real(kind_lake), intent(in) :: dtime               !< timestep
+    real(kind_lake), intent(in) :: qflx_snomelt(1)     !< snow melt (mm H2O /s)
+    real(kind_lake), intent(in) :: qflx_rain_grnd(1)   !< rain on ground after interception (mm H2O/s) [+]
+    real(kind_lake), intent(in) :: qflx_sub_snow(1)    !< sublimation rate from snow pack (mm H2O /s) [+]
+    real(kind_lake), intent(in) :: qflx_evap_grnd(1)   !< ground surface evaporation rate (mm H2O/s) [+]
+    real(kind_lake), intent(in) :: qflx_dew_snow(1)    !< surface dew added to snow pack (mm H2O /s) [+]
+    real(kind_lake), intent(in) :: qflx_dew_grnd(1)    !< ground surface dew formation (mm H2O /s) [+]
+    real(kind_lake), intent(in) :: dz(1,-nlevsnow+1:nlevsoil)             !< layer depth (m)
 
 
     !inout: 
 
-    real(kind_lake), intent(inout) :: h2osoi_ice(1,-nlevsnow+1:nlevsoil)     !ice lens (kg/m2)
-    real(kind_lake), intent(inout) :: h2osoi_liq(1,-nlevsnow+1:nlevsoil)     !liquid water (kg/m2)
+    real(kind_lake), intent(inout) :: h2osoi_ice(1,-nlevsnow+1:nlevsoil)     !< ice lens (kg/m2)
+    real(kind_lake), intent(inout) :: h2osoi_liq(1,-nlevsnow+1:nlevsoil)     !< liquid water (kg/m2)
     
     !out:
     
-    real(kind_lake), intent(out) :: qflx_top_soil(1)     !net water input into soil from top (mm/s)
+    real(kind_lake), intent(out) :: qflx_top_soil(1)     !< net water input into soil from top (mm/s)
 
 
     ! OTHER LOCAL VARIABLES:
@@ -4006,6 +3994,13 @@ subroutine SnowWater(lbc, ubc, num_snowc, filter_snowc,         & !i
 
   end subroutine SnowWater
 
+!> Determine the change in snow layer thickness due to compaction and
+!! settling.
+!! Three metamorphisms of changing snow characteristics are implemented,
+!! i.e., destructive, overburden, and melt. The treatments of the former
+!! two are from SNTHERM.89 and SNTHERM.99 (1991, 1999). The contribution
+!! due to melt metamorphism is simply taken as a ratio of snow ice
+!! fraction after the melting versus before the melting.
   subroutine SnowCompaction(lbc, ubc, num_snowc, filter_snowc,   &!i  
                            snl,imelt,frac_iceold,t_soisno,                  &!i  
                            h2osoi_ice,h2osoi_liq,dtime,                     &!i  
@@ -4013,15 +4008,6 @@ subroutine SnowCompaction(lbc, ubc, num_snowc, filter_snowc,   &!i
 
     
     !================================================================================
-    ! !DESCRIPTION:
-    ! Determine the change in snow layer thickness due to compaction and
-    ! settling.
-    ! Three metamorphisms of changing snow characteristics are implemented,
-    ! i.e., destructive, overburden, and melt. The treatments of the former
-    ! two are from SNTHERM.89 and SNTHERM.99 (1991, 1999). The contribution
-    ! due to melt metamorphism is simply taken as a ratio of snow ice
-    ! fraction after the melting versus before the melting.
-    !
     ! CALLED FROM:
     ! subroutine Hydrology2 in module Hydrology2Mod
     !
@@ -4037,20 +4023,20 @@ subroutine SnowCompaction(lbc, ubc, num_snowc, filter_snowc,   &!i
     implicit none
 
     !in:
-    integer, intent(in) :: lbc, ubc                ! column bounds
-    integer, intent(in) :: num_snowc               ! number of column snow points in column filter
-    integer, intent(in) :: filter_snowc(ubc-lbc+1) ! column filter for snow points
-    integer,  intent(in) :: snl(1)             !number of snow layers
-    integer,  intent(in) :: imelt(1,-nlevsnow+1:nlevsoil)        !flag for melting (=1), freezing (=2), Not=0
-    real(kind_lake), intent(in) :: dtime
-    real(kind_lake), intent(in) :: frac_iceold(1,-nlevsnow+1:nlevsoil)  !fraction of ice relative to the tot water
-    real(kind_lake), intent(in) :: t_soisno(1,-nlevsnow+1:nlevsoil)     !soil temperature (Kelvin)
-    real(kind_lake), intent(in) :: h2osoi_ice(1,-nlevsnow+1:nlevsoil)   !ice lens (kg/m2)
-    real(kind_lake), intent(in) :: h2osoi_liq(1,-nlevsnow+1:nlevsoil)   !liquid water (kg/m2)
+    integer, intent(in) :: lbc, ubc                !< column bounds
+    integer, intent(in) :: num_snowc               !< number of column snow points in column filter
+    integer, intent(in) :: filter_snowc(ubc-lbc+1) !< column filter for snow points
+    integer,  intent(in) :: snl(1)             !< number of snow layers
+    integer,  intent(in) :: imelt(1,-nlevsnow+1:nlevsoil)        !< flag for melting (=1), freezing (=2), Not=0
+    real(kind_lake), intent(in) :: dtime                         !<
+    real(kind_lake), intent(in) :: frac_iceold(1,-nlevsnow+1:nlevsoil)  !< fraction of ice relative to the tot water
+    real(kind_lake), intent(in) :: t_soisno(1,-nlevsnow+1:nlevsoil)     !< soil temperature (Kelvin)
+    real(kind_lake), intent(in) :: h2osoi_ice(1,-nlevsnow+1:nlevsoil)   !< ice lens (kg/m2)
+    real(kind_lake), intent(in) :: h2osoi_liq(1,-nlevsnow+1:nlevsoil)   !< liquid water (kg/m2)
 
     !inout:
 
-    real(kind_lake), intent(inout) :: dz(1,-nlevsnow+1:nlevsoil)           !layer depth (m)
+    real(kind_lake), intent(inout) :: dz(1,-nlevsnow+1:nlevsoil)           !< layer depth (m)
 
     ! OTHER LOCAL VARIABLES:
 
@@ -4137,21 +4123,24 @@ subroutine SnowCompaction(lbc, ubc, num_snowc, filter_snowc,   &!i
 
   end subroutine SnowCompaction
 
+!> Combine snow layers that are less than a minimum thickness or mass
+!! If the snow element thickness or mass is less than a prescribed minimum,
+!! then it is combined with a neighboring element.        
   subroutine CombineSnowLayers(lbc, ubc,                            & !i
                               num_snowc, filter_snowc, & !i&o
                               snl,h2osno,snowdp,dz,zi,             & !i&o
                               t_soisno,h2osoi_ice,h2osoi_liq,      & !i&o
                               z)  !o
     !==========================================================================
-    ! !DESCRIPTION:
+    ! DESCRIPTION:
     ! Combine snow layers that are less than a minimum thickness or mass
     ! If the snow element thickness or mass is less than a prescribed minimum,
     ! then it is combined with a neighboring element.  The subroutine
     ! clm\_combo.f90 then executes the combination of mass and energy.
-    ! !CALLED FROM:
+    ! CALLED FROM:
     ! subroutine Hydrology2 in module Hydrology2Mod
     !
-    ! !REVISION HISTORY:
+    ! REVISION HISTORY:
     ! 15 September 1999: Yongjiu Dai; Initial code
     ! 15 December 1999:  Paul Houser and Jon Radakovich; F90 Revision
     ! 2/28/02, Peter Thornton: Migrated to new data structures.
@@ -4162,25 +4151,25 @@ subroutine CombineSnowLayers(lbc, ubc,                            & !i
     ! !ARGUMENTS:
     implicit none
     !in:
-    integer, intent(in)    :: lbc, ubc                    ! column bounds
+    integer, intent(in)    :: lbc, ubc                    !< column bounds
    ! integer, intent(in) :: clandunit(1)       !landunit index for each column
    ! integer, intent(in) :: ityplun(1)         !landunit type
 
     !inout:
-    integer, intent(inout) :: num_snowc                   ! number of column snow points in column filter
-    integer, intent(inout) :: filter_snowc(ubc-lbc+1)     ! column filter for snow points
-    integer , intent(inout) :: snl(1)            !number of snow layers
-    real(kind_lake), intent(inout) :: h2osno(1)         !snow water (mm H2O)
-    real(kind_lake), intent(inout) :: snowdp(1)         !snow height (m)
-    real(kind_lake), intent(inout) :: dz(1,-nlevsnow+1:nlevsoil)           !layer depth (m)
-    real(kind_lake), intent(inout) :: zi(1,-nlevsnow+0:nlevsoil)           !interface level below a "z" level (m)
-    real(kind_lake), intent(inout) :: t_soisno(1,-nlevsnow+1:nlevsoil)     !soil temperature (Kelvin)
-    real(kind_lake), intent(inout) :: h2osoi_ice(1,-nlevsnow+1:nlevsoil)   !ice lens (kg/m2)
-    real(kind_lake), intent(inout) :: h2osoi_liq(1,-nlevsnow+1:nlevsoil)   !liquid water (kg/m2)
+    integer, intent(inout) :: num_snowc                   !< number of column snow points in column filter
+    integer, intent(inout) :: filter_snowc(ubc-lbc+1)     !< column filter for snow points
+    integer , intent(inout) :: snl(1)            !< number of snow layers
+    real(kind_lake), intent(inout) :: h2osno(1)         !< snow water (mm H2O)
+    real(kind_lake), intent(inout) :: snowdp(1)         !< snow height (m)
+    real(kind_lake), intent(inout) :: dz(1,-nlevsnow+1:nlevsoil)           !< layer depth (m)
+    real(kind_lake), intent(inout) :: zi(1,-nlevsnow+0:nlevsoil)           !< interface level below a "z" level (m)
+    real(kind_lake), intent(inout) :: t_soisno(1,-nlevsnow+1:nlevsoil)     !< soil temperature (Kelvin)
+    real(kind_lake), intent(inout) :: h2osoi_ice(1,-nlevsnow+1:nlevsoil)   !< ice lens (kg/m2)
+    real(kind_lake), intent(inout) :: h2osoi_liq(1,-nlevsnow+1:nlevsoil)   !< liquid water (kg/m2)
 
     !out:
 
-    real(kind_lake), intent(out) :: z(1,-nlevsnow+1:nlevsoil)            !layer thickness (m)
+    real(kind_lake), intent(out) :: z(1,-nlevsnow+1:nlevsoil)            !< layer thickness (m)
     !
     !EOP
     !
@@ -4359,6 +4348,8 @@ subroutine CombineSnowLayers(lbc, ubc,                            & !i
 
   end subroutine CombineSnowLayers
 
+! DESCRIPTION:
+!> Subdivides snow layers if they exceed their prescribed maximum thickness.
   subroutine DivideSnowLayers(lbc, ubc,                             & !i
                              num_snowc, filter_snowc,  & !i&o
                              snl,dz,zi,t_soisno,                   & !i&o
@@ -4367,8 +4358,6 @@ subroutine DivideSnowLayers(lbc, ubc,                             & !i
 
 
     !============================================================================
-    ! !DESCRIPTION:
-    ! Subdivides snow layers if they exceed their prescribed maximum thickness.
     ! !CALLED FROM:
     ! subroutine Hydrology2 in module Hydrology2Mod
     !
@@ -4384,22 +4373,22 @@ subroutine DivideSnowLayers(lbc, ubc,                             & !i
     implicit none
 
     !in:
-    integer, intent(in)    :: lbc, ubc                    ! column bounds
+    integer, intent(in)    :: lbc, ubc                    !< column bounds
 
     !inout:
 
-    integer, intent(inout) :: num_snowc                   ! number of column snow points in column filter
-    integer, intent(inout) :: filter_snowc(ubc-lbc+1)     ! column filter for snow points
-    integer , intent(inout) :: snl(1)            !number of snow layers
-    real(kind_lake), intent(inout) :: dz(1,-nlevsnow+1:nlevsoil)           !layer depth (m)
-    real(kind_lake), intent(inout) :: zi(1,-nlevsnow+0:nlevsoil)           !interface level below a "z" level (m)
-    real(kind_lake), intent(inout) :: t_soisno(1,-nlevsnow+1:nlevsoil)     !soil temperature (Kelvin)
-    real(kind_lake), intent(inout) :: h2osoi_ice(1,-nlevsnow+1:nlevsoil)   !ice lens (kg/m2)
-    real(kind_lake), intent(inout) :: h2osoi_liq(1,-nlevsnow+1:nlevsoil)   !liquid water (kg/m2)
+    integer, intent(inout) :: num_snowc                   !< number of column snow points in column filter
+    integer, intent(inout) :: filter_snowc(ubc-lbc+1)     !< column filter for snow points
+    integer , intent(inout) :: snl(1)                     !< number of snow layers
+    real(kind_lake), intent(inout) :: dz(1,-nlevsnow+1:nlevsoil)           !< layer depth (m)
+    real(kind_lake), intent(inout) :: zi(1,-nlevsnow+0:nlevsoil)           !< interface level below a "z" level (m)
+    real(kind_lake), intent(inout) :: t_soisno(1,-nlevsnow+1:nlevsoil)     !< soil temperature (Kelvin)
+    real(kind_lake), intent(inout) :: h2osoi_ice(1,-nlevsnow+1:nlevsoil)   !< ice lens (kg/m2)
+    real(kind_lake), intent(inout) :: h2osoi_liq(1,-nlevsnow+1:nlevsoil)   !< liquid water (kg/m2)
 
     !out: 
 
-    real(kind_lake), intent(out) :: z(1,-nlevsnow+1:nlevsoil)            !layer thickness (m)
+    real(kind_lake), intent(out) :: z(1,-nlevsnow+1:nlevsoil)            !< layer thickness (m)
 
 
 
@@ -4587,11 +4576,13 @@ subroutine DivideSnowLayers(lbc, ubc,                             & !i
 
   end subroutine DivideSnowLayers
 
+!> Combines two elements and returns the following combined
+!! variables: dz, t, wliq, wice.
   subroutine Combo(dz,  wliq,  wice, t, dz2, wliq2, wice2, t2)
     !
-    ! !DESCRIPTION:
-    ! Combines two elements and returns the following combined
-    ! variables: dz, t, wliq, wice.
+    ! DESCRIPTION:
+    !> Combines two elements and returns the following combined
+    !! variables: dz, t, wliq, wice.
     ! The combined temperature is based on the equation:
     ! the sum of the enthalpies of the two elements =
     ! that of the combined element.
@@ -4600,14 +4591,14 @@ subroutine Combo(dz,  wliq,  wice, t, dz2, wliq2, wice2, t2)
     !
     ! !ARGUMENTS:
     implicit none
-    real(kind_lake), intent(in)    :: dz2   ! nodal thickness of 2 elements being combined [m]
-    real(kind_lake), intent(in)    :: wliq2 ! liquid water of element 2 [kg/m2]
-    real(kind_lake), intent(in)    :: wice2 ! ice of element 2 [kg/m2]
-    real(kind_lake), intent(in)    :: t2    ! nodal temperature of element 2 [K]
-    real(kind_lake), intent(inout) :: dz    ! nodal thickness of 1 elements being combined [m]
-    real(kind_lake), intent(inout) :: wliq  ! liquid water of element 1
-    real(kind_lake), intent(inout) :: wice  ! ice of element 1 [kg/m2]
-    real(kind_lake), intent(inout) :: t     ! nodel temperature of elment 1 [K]
+    real(kind_lake), intent(in)    :: dz2   !< nodal thickness of 2 elements being combined [m]
+    real(kind_lake), intent(in)    :: wliq2 !< liquid water of element 2 [kg/m2]
+    real(kind_lake), intent(in)    :: wice2 !< ice of element 2 [kg/m2]
+    real(kind_lake), intent(in)    :: t2    !< nodal temperature of element 2 [K]
+    real(kind_lake), intent(inout) :: dz    !< nodal thickness of 1 elements being combined [m]
+    real(kind_lake), intent(inout) :: wliq  !< liquid water of element 1
+    real(kind_lake), intent(inout) :: wice  !< ice of element 1 [kg/m2]
+    real(kind_lake), intent(inout) :: t     !< nodel temperature of elment 1 [K]
     !
     ! !CALLED FROM:
     ! subroutine CombineSnowLayers in this module
@@ -4653,26 +4644,27 @@ subroutine Combo(dz,  wliq,  wice, t, dz2, wliq2, wice2, t2)
 
   end subroutine Combo
 
+!> Constructs snow filter for use in vectorized loops for snow hydrology.
   subroutine BuildSnowFilter(lbc, ubc, num_nolakec, filter_nolakec,snl, & !i
                              num_snowc, filter_snowc, &                   !o
                              num_nosnowc, filter_nosnowc)                 !o
     !
-    ! !DESCRIPTION:
-    ! Constructs snow filter for use in vectorized loops for snow hydrology.
+    ! DESCRIPTION:
+    !> Constructs snow filter for use in vectorized loops for snow hydrology.
     !
     ! !USES:
     !    use clmtype
     !
     ! !ARGUMENTS:
     implicit none
-    integer, intent(in)  :: lbc, ubc                    ! column bounds
-    integer, intent(in)  :: num_nolakec                 ! number of column non-lake points in column filter
-    integer, intent(in)  :: filter_nolakec(ubc-lbc+1)   ! column filter for non-lake points
-    integer, intent(in)  :: snl(1)                        ! number of snow layers
-    integer, intent(out) :: num_snowc                   ! number of column snow points in column filter
-    integer, intent(out) :: filter_snowc(ubc-lbc+1)     ! column filter for snow points
-    integer, intent(out) :: num_nosnowc                 ! number of column non-snow points in column filter
-    integer, intent(out) :: filter_nosnowc(ubc-lbc+1)   ! column filter for non-snow points
+    integer, intent(in)  :: lbc, ubc                    !< column bounds
+    integer, intent(in)  :: num_nolakec                 !< number of column non-lake points in column filter
+    integer, intent(in)  :: filter_nolakec(ubc-lbc+1)   !< column filter for non-lake points
+    integer, intent(in)  :: snl(1)                        !< number of snow layers
+    integer, intent(out) :: num_snowc                   !< number of column snow points in column filter
+    integer, intent(out) :: filter_snowc(ubc-lbc+1)     !< column filter for snow points
+    integer, intent(out) :: num_nosnowc                 !< number of column non-snow points in column filter
+    integer, intent(out) :: filter_nosnowc(ubc-lbc+1)   !< column filter for non-snow points
     !
     ! !CALLED FROM:
     ! subroutine Hydrology2 in Hydrology2Mod
@@ -4710,7 +4702,13 @@ subroutine BuildSnowFilter(lbc, ubc, num_nolakec, filter_nolakec,snl, & !i
   end subroutine BuildSnowFilter
 
 
-
+  ! DESCRIPTION:               
+  !> Calculation of the friction velocity, relation for potential
+  !! temperature and humidity profiles of surface boundary layer.                
+  !! The scheme is based on the work of Zeng et al. (1998):
+  !! Intercomparison of bulk aerodynamic algorithms for the computation
+  !! of sea surface fluxes using TOGA CORE and TAO data. J. Climate,
+  !! Vol. 11, 2628-2644.       
 subroutine FrictionVelocity(pgridcell,forc_hgt,forc_hgt_u,        & !i 
                              forc_hgt_t,forc_hgt_q,                  & !i 
                              lbp, ubp, fn, filterp,                  & !i 
@@ -4721,15 +4719,7 @@ subroutine FrictionVelocity(pgridcell,forc_hgt,forc_hgt_u,        & !i
                              fm)  !i&o 
 
   !=============================================================================
-  ! !DESCRIPTION:
-  ! Calculation of the friction velocity, relation for potential
-  ! temperature and humidity profiles of surface boundary layer.
-  ! The scheme is based on the work of Zeng et al. (1998):
-  ! Intercomparison of bulk aerodynamic algorithms for the computation
-  ! of sea surface fluxes using TOGA CORE and TAO data. J. Climate,
-  ! Vol. 11, 2628-2644.
-  !
-  ! !REVISION HISTORY:
+  ! REVISION HISTORY:
   ! 15 September 1999: Yongjiu Dai; Initial code
   ! 15 December 1999:  Paul Houser and Jon Radakovich; F90 Revision
   ! 12/19/01, Peter Thornton
@@ -4746,35 +4736,35 @@ subroutine FrictionVelocity(pgridcell,forc_hgt,forc_hgt_u,        & !i
 
   !in:
 
-   integer , intent(in) :: pgridcell(1)   ! pft's gridcell index
-   real(kind_lake), intent(in) :: forc_hgt(1)    ! atmospheric reference height (m)
-   real(kind_lake), intent(in) :: forc_hgt_u(1)  ! observational height of wind [m]
-   real(kind_lake), intent(in) :: forc_hgt_t(1)  ! observational height of temperature [m]
-   real(kind_lake), intent(in) :: forc_hgt_q(1)  ! observational height of humidity [m]
-   integer , intent(in)  :: lbp, ubp         ! pft array bounds
-   integer , intent(in)  :: fn               ! number of filtered pft elements
-   integer , intent(in)  :: filterp(fn)      ! pft filter
-   real(kind_lake), intent(in)  :: displa(lbp:ubp)  ! displacement height (m)
-   real(kind_lake), intent(in)  :: z0m(lbp:ubp)     ! roughness length over vegetation, momentum [m]
-   real(kind_lake), intent(in)  :: z0h(lbp:ubp)     ! roughness length over vegetation, sensible heat [m]
-   real(kind_lake), intent(in)  :: z0q(lbp:ubp)     ! roughness length over vegetation, latent heat [m]
-   real(kind_lake), intent(in)  :: obu(lbp:ubp)     ! monin-obukhov length (m)
-   integer,  intent(in)  :: iter             ! iteration number
-   real(kind_lake), intent(in)  :: ur(lbp:ubp)      ! wind speed at reference height [m/s]
-   real(kind_lake), intent(in)  :: um(lbp:ubp)      ! wind speed including the stablity effect [m/s]
+   integer , intent(in) :: pgridcell(1)   !< pft's gridcell index
+   real(kind_lake), intent(in) :: forc_hgt(1)    !< atmospheric reference height (m)
+   real(kind_lake), intent(in) :: forc_hgt_u(1)  !< observational height of wind [m]
+   real(kind_lake), intent(in) :: forc_hgt_t(1)  !< observational height of temperature [m]
+   real(kind_lake), intent(in) :: forc_hgt_q(1)  !< observational height of humidity [m]
+   integer , intent(in)  :: lbp, ubp         !< pft array bounds
+   integer , intent(in)  :: fn               !< number of filtered pft elements
+   integer , intent(in)  :: filterp(fn)      !< pft filter
+   real(kind_lake), intent(in)  :: displa(lbp:ubp)  !< displacement height (m)
+   real(kind_lake), intent(in)  :: z0m(lbp:ubp)     !< roughness length over vegetation, momentum [m]
+   real(kind_lake), intent(in)  :: z0h(lbp:ubp)     !< roughness length over vegetation, sensible heat [m]
+   real(kind_lake), intent(in)  :: z0q(lbp:ubp)     !< roughness length over vegetation, latent heat [m]
+   real(kind_lake), intent(in)  :: obu(lbp:ubp)     !< monin-obukhov length (m)
+   integer,  intent(in)  :: iter             !< iteration number
+   real(kind_lake), intent(in)  :: ur(lbp:ubp)      !< wind speed at reference height [m/s]
+   real(kind_lake), intent(in)  :: um(lbp:ubp)      !< wind speed including the stablity effect [m/s]
 
    !out:
 
-   real(kind_lake), intent(out) :: ustar(lbp:ubp)   ! friction velocity [m/s]
-   real(kind_lake), intent(out) :: temp1(lbp:ubp)   ! relation for potential temperature profile
-   real(kind_lake), intent(out) :: temp12m(lbp:ubp) ! relation for potential temperature profile applied at 2-m
-   real(kind_lake), intent(out) :: temp2(lbp:ubp)   ! relation for specific humidity profile
-   real(kind_lake), intent(out) :: temp22m(lbp:ubp) ! relation for specific humidity profile applied at 2-m
-   real(kind_lake), intent(out) :: u10(1)         ! 10-m wind (m/s) (for dust model)
-   real(kind_lake), intent(out) :: fv(1)          ! friction velocity (m/s) (for dust model)
+   real(kind_lake), intent(out) :: ustar(lbp:ubp)   !< friction velocity [m/s]
+   real(kind_lake), intent(out) :: temp1(lbp:ubp)   !< relation for potential temperature profile
+   real(kind_lake), intent(out) :: temp12m(lbp:ubp) !< relation for potential temperature profile applied at 2-m
+   real(kind_lake), intent(out) :: temp2(lbp:ubp)   !< relation for specific humidity profile
+   real(kind_lake), intent(out) :: temp22m(lbp:ubp) !< relation for specific humidity profile applied at 2-m
+   real(kind_lake), intent(out) :: u10(1)         !< 10-m wind (m/s) (for dust model)
+   real(kind_lake), intent(out) :: fv(1)          !< friction velocity (m/s) (for dust model)
 
    !inout:
-   real(kind_lake), intent(inout) :: fm(lbp:ubp)    ! needed for DGVM only to diagnose 10m wind
+   real(kind_lake), intent(inout) :: fm(lbp:ubp)    !< needed for DGVM only to diagnose 10m wind
 
    ! OTHER LOCAL VARIABLES:
 
@@ -4990,8 +4980,8 @@ end subroutine FrictionVelocity
    ! !INTERFACE:
    real(kind_lake) function StabilityFunc1(zeta)
      !
-     ! !DESCRIPTION:
-     ! Stability function for rib < 0.
+     ! DESCRIPTION:
+     !> Stability function for rib < 0.
      !
      ! !USES:
      !      use shr_const_mod, only: SHR_CONST_PI
@@ -4999,7 +4989,7 @@ real(kind_lake) function StabilityFunc1(zeta)
      !
      ! !ARGUMENTS:
      implicit none
-      real(kind_lake), intent(in) :: zeta  ! dimensionless height used in Monin-Obukhov theory
+      real(kind_lake), intent(in) :: zeta  !< dimensionless height used in Monin-Obukhov theory
       !
       ! !CALLED FROM:
       ! subroutine FrictionVelocity in this module
@@ -5033,7 +5023,7 @@ end function StabilityFunc1
    real(kind_lake) function StabilityFunc2(zeta)
      !
      ! !DESCRIPTION:
-     ! Stability function for rib < 0.
+     !> Stability function for rib < 0.
      !
      ! !USES:
      !Removed by Zack Subin, 7/9/08
@@ -5041,7 +5031,7 @@ real(kind_lake) function StabilityFunc2(zeta)
      !
      ! !ARGUMENTS:
      implicit none
-     real(kind_lake), intent(in) :: zeta  ! dimensionless height used in Monin-Obukhov theory
+     real(kind_lake), intent(in) :: zeta  !< dimensionless height used in Monin-Obukhov theory
      !
      ! !CALLED FROM:
      ! subroutine FrictionVelocity in this module
@@ -5071,23 +5061,23 @@ end function StabilityFunc2
    subroutine MoninObukIni (ur, thv, dthv, zldis, z0m, um, obu)
      !
      ! !DESCRIPTION:
-     ! Initialization of the Monin-Obukhov length.
-     ! The scheme is based on the work of Zeng et al. (1998):
-     ! Intercomparison of bulk aerodynamic algorithms for the computation
-     ! of sea surface fluxes using TOGA CORE and TAO data. J. Climate,
-     ! Vol. 11, 2628-2644.
+     !> Initialization of the Monin-Obukhov length.
+     !! The scheme is based on the work of Zeng et al. (1998):
+     !! Intercomparison of bulk aerodynamic algorithms for the computation
+     !! of sea surface fluxes using TOGA CORE and TAO data. J. Climate,
+     !! Vol. 11, 2628-2644.
      !
      ! !USES:
      !
      ! !ARGUMENTS:
      implicit none
-    real(kind_lake), intent(in)  :: ur    ! wind speed at reference height [m/s]
-    real(kind_lake), intent(in)  :: thv   ! virtual potential temperature (kelvin)
-    real(kind_lake), intent(in)  :: dthv  ! diff of vir. poten. temp. between ref. height and surface
-    real(kind_lake), intent(in)  :: zldis ! reference height "minus" zero displacement heght [m]
-    real(kind_lake), intent(in)  :: z0m   ! roughness length, momentum [m]
-    real(kind_lake), intent(out) :: um    ! wind speed including the stability effect [m/s]
-    real(kind_lake), intent(out) :: obu   ! monin-obukhov length (m)
+    real(kind_lake), intent(in)  :: ur    !< wind speed at reference height [m/s]
+    real(kind_lake), intent(in)  :: thv   !< virtual potential temperature (kelvin)
+    real(kind_lake), intent(in)  :: dthv  !< diff of vir. poten. temp. between ref. height and surface
+    real(kind_lake), intent(in)  :: zldis !< reference height "minus" zero displacement heght [m]
+    real(kind_lake), intent(in)  :: z0m   !< roughness length, momentum [m]
+    real(kind_lake), intent(out) :: um    !< wind speed including the stability effect [m/s]
+    real(kind_lake), intent(out) :: obu   !< monin-obukhov length (m)
     !
     ! !CALLED FROM:
     ! subroutine BareGroundFluxes in module BareGroundFluxesMod.F90
@@ -5256,12 +5246,12 @@ SUBROUTINE lakeini(kdt,            ISLTYP,          gt0,             snowd,
                     sand3d,         clay3d,          tg3,             clm_lakedepth,  &
                     km,   me,       master,          errmsg,          errflg)
 
-   ! Some fields in lakeini are not available during initialization,
-   ! so clm_lake_init cannot complete the initialization. What is not
-   ! in clm_lake_init, is initialized in lakeini on points where
-   ! use_lake_model(i)>0. The clm_lake_initialized(i) guards against
-   ! initializing a point twice.  For that to work,
-   ! clm_lake_initialized must be a restart variable.
+   !> Some fields in lakeini are not available during initialization,
+   !! so clm_lake_init cannot complete the initialization. What is not
+   !! in clm_lake_init, is initialized in lakeini on points where
+   !! use_lake_model(i)>0. The clm_lake_initialized(i) guards against
+   !! initializing a point twice.  For that to work,
+   !! clm_lake_initialized must be a restart variable.
 
    !==============================================================================
    ! This subroutine was first edited by Hongping Gu for coupling
diff --git a/physics/docs/ccppsrw3_doxyfile b/physics/docs/ccppsrw3_doxyfile
new file mode 100644
index 000000000..b1cc3138c
--- /dev/null
+++ b/physics/docs/ccppsrw3_doxyfile
@@ -0,0 +1,557 @@
+# Doxyfile 1.9.3
+
+DOXYFILE_ENCODING      = UTF-8
+PROJECT_NAME           = "CCPP SciDoc for UFS-SRW v3.0.0"
+PROJECT_NUMBER         = "SRW v3.0.0"
+PROJECT_BRIEF          = "Common Community Physics Package Developed at DTC"
+PROJECT_LOGO           = img/dtc_logo.png
+OUTPUT_DIRECTORY       = doc
+CREATE_SUBDIRS         = NO
+ALLOW_UNICODE_NAMES    = NO
+OUTPUT_LANGUAGE        = English
+BRIEF_MEMBER_DESC      = YES
+REPEAT_BRIEF           = NO
+ABBREVIATE_BRIEF       =
+ALWAYS_DETAILED_SEC    = NO
+INLINE_INHERITED_MEMB  = NO
+FULL_PATH_NAMES        = NO
+STRIP_FROM_PATH        =
+STRIP_FROM_INC_PATH    =
+SHORT_NAMES            = NO
+JAVADOC_AUTOBRIEF      = NO
+JAVADOC_BANNER         = NO
+QT_AUTOBRIEF           = NO
+MULTILINE_CPP_IS_BRIEF = NO
+PYTHON_DOCSTRING       = YES
+INHERIT_DOCS           = YES
+SEPARATE_MEMBER_PAGES  = YES
+TAB_SIZE               = 4
+ALIASES                =
+OPTIMIZE_OUTPUT_FOR_C  = NO
+OPTIMIZE_OUTPUT_JAVA   = NO
+OPTIMIZE_FOR_FORTRAN   = YES
+OPTIMIZE_OUTPUT_VHDL   = NO
+OPTIMIZE_OUTPUT_SLICE  = NO
+EXTENSION_MAPPING      = .f=FortranFree \
+                         .F=FortranFree \
+                         .F90=FortranFree \
+                         .f90=FortranFree
+MARKDOWN_SUPPORT       = YES
+TOC_INCLUDE_HEADINGS   = 5
+AUTOLINK_SUPPORT       = YES
+BUILTIN_STL_SUPPORT    = NO
+CPP_CLI_SUPPORT        = NO
+SIP_SUPPORT            = NO
+IDL_PROPERTY_SUPPORT   = YES
+DISTRIBUTE_GROUP_DOC   = YES
+GROUP_NESTED_COMPOUNDS = NO
+SUBGROUPING            = YES
+INLINE_GROUPED_CLASSES = NO
+INLINE_SIMPLE_STRUCTS  = NO
+TYPEDEF_HIDES_STRUCT   = YES
+LOOKUP_CACHE_SIZE      = 0
+NUM_PROC_THREADS       = 1
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+EXTRACT_ALL            = YES
+EXTRACT_PRIVATE        = YES
+EXTRACT_PRIV_VIRTUAL   = NO
+EXTRACT_PACKAGE        = YES
+EXTRACT_STATIC         = YES
+EXTRACT_LOCAL_CLASSES  = YES
+EXTRACT_LOCAL_METHODS  = YES
+EXTRACT_ANON_NSPACES   = YES
+RESOLVE_UNNAMED_PARAMS = YES
+HIDE_UNDOC_MEMBERS     = NO
+HIDE_UNDOC_CLASSES     = NO
+HIDE_FRIEND_COMPOUNDS  = NO
+HIDE_IN_BODY_DOCS      = NO
+INTERNAL_DOCS          = YES
+CASE_SENSE_NAMES       = NO
+HIDE_SCOPE_NAMES       = NO
+HIDE_COMPOUND_REFERENCE= NO
+SHOW_HEADERFILE        = YES
+SHOW_INCLUDE_FILES     = NO
+SHOW_GROUPED_MEMB_INC  = NO
+FORCE_LOCAL_INCLUDES   = NO
+INLINE_INFO            = YES
+SORT_MEMBER_DOCS       = NO
+SORT_BRIEF_DOCS        = NO
+SORT_MEMBERS_CTORS_1ST = NO
+SORT_GROUP_NAMES       = NO
+SORT_BY_SCOPE_NAME     = NO
+STRICT_PROTO_MATCHING  = NO
+GENERATE_TODOLIST      = YES
+GENERATE_TESTLIST      = YES
+GENERATE_BUGLIST       = YES
+GENERATE_DEPRECATEDLIST= YES
+ENABLED_SECTIONS       = YES
+MAX_INITIALIZER_LINES  = 30
+SHOW_USED_FILES        = NO
+SHOW_FILES             = NO 
+SHOW_NAMESPACES        = YES
+FILE_VERSION_FILTER    =
+LAYOUT_FILE            = ccpp_dox_layout.xml
+CITE_BIB_FILES         = library.bib
+
+#---------------------------------------------------------------------------
+# Configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET                  = NO
+WARNINGS               = YES
+WARN_IF_UNDOCUMENTED   = NO
+WARN_IF_DOC_ERROR      = YES
+WARN_IF_INCOMPLETE_DOC = YES
+WARN_NO_PARAMDOC       = NO
+WARN_AS_ERROR          = NO
+WARN_FORMAT            =
+WARN_LOGFILE           = 
+
+#---------------------------------------------------------------------------
+# Configuration options related to the input files
+#---------------------------------------------------------------------------
+
+INPUT                  =  pdftxt/SRW_mainpage.txt              \
+                          pdftxt/SRW_all_shemes_list.txt     \
+                          pdftxt/GFS_v16_suite.txt       \
+                          pdftxt/HRRR_suite.txt          \
+                          pdftxt/RAP_suite.txt      \
+                          pdftxt/RRFS_v1beta_suite.txt   \
+                          pdftxt/WoFS_v0_suite.txt   \
+                          pdftxt/RRFS_SGSCLOUD.txt       \
+                          pdftxt/GFS_RRTMG.txt           \
+                          pdftxt/GFS_SFCLYR.txt   \
+                          pdftxt/MYNN_SFCLAYER.txt   \
+                          pdftxt/GFS_NSST.txt     \
+                          pdftxt/GFS_OCEAN.txt    \
+                          pdftxt/GFS_NOAH.txt     \
+                          pdftxt/GFS_SFCSICE.txt  \
+                          pdftxt/GFS_SATMEDMFVDIFQ.txt    \
+                          pdftxt/GFS_NOAHMP.txt    \
+                          pdftxt/GFS_UGWPv0.txt   \
+                          pdftxt/GFS_drag_suite.txt    \
+                          pdftxt/GFS_GWDPS.txt      \
+                          pdftxt/GFS_OZPHYS.txt   \
+                          pdftxt/GFS_H2OPHYS.txt  \
+                          pdftxt/GFS_SAMFdeep.txt \
+                          pdftxt/GFS_SAMFshal.txt \
+                          pdftxt/GFDL_cloud.txt   \
+                          pdftxt/NSSLMICRO.txt      \
+                          pdftxt/MYNN_EDMF.txt       \
+                          pdftxt/CU_GF_deep.txt      \
+                          pdftxt/RUCLSM.txt          \
+                          pdftxt/THOMPSON.txt        \
+                          pdftxt/suite_input.nml.txt    \
+                          pdftxt/CLM_LAKE.txt     \
+                          pdftxt/GFS_SPP.txt     \
+                        ../fv_sat_adj.F90    \
+                        ../GFS_time_vary_pre.fv3.F90 \
+                        ../GFS_rad_time_vary.fv3.F90  \
+                        ../GFS_phys_time_vary.fv3.F90 \
+                        ../get_prs_fv3.F90     \
+                        ../get_phi_fv3.F90        \
+                        ../ozne_def.f                 \
+                        ../ozinterp.f90               \
+                        ../h2o_def.f                 \
+                        ../h2ointerp.f90           \
+                        ../aerclm_def.F            \
+                        ../aerinterp.F90           \
+                        ../iccn_def.F              \
+                        ../iccninterp.F90          \
+                        ../sfcsub.F  \
+                        ../gcycle.F90                  \
+                        ../GFS_suite_interstitial_1.F90    \
+                        ../GFS_suite_interstitial_2.F90    \
+                        ../GFS_suite_interstitial_3.F90    \
+                        ../GFS_suite_interstitial_4.F90    \
+                        ../GFS_suite_interstitial_5.F90    \
+                        ../GFS_suite_interstitial_phys_reset.F90    \
+                        ../GFS_suite_interstitial_rad_reset.F90    \
+                        ../GFS_suite_stateout_reset.F90    \
+                        ../GFS_suite_stateout_update.F90     \
+                        ../GFS_surface_composites_inter.F90     \
+                        ../GFS_surface_composites_pre.F90      \
+                        ../GFS_surface_composites_post.F90      \
+                        ../GFS_surface_loop_control_part1.F90   \
+                        ../GFS_surface_loop_control_part2.F90   \
+                        ../GFS_radiation_surface.F90     \
+                        ../GFS_rrtmg_pre.F90             \
+                        ../GFS_rrtmg_post.F90           \
+                        ../GFS_rrtmg_setup.F90          \
+                        ../rad_sw_pre.F90              \
+                        ../sgscloud_radpre.F90    \
+                        ../sgscloud_radpost.F90   \
+                        ../radsw_main.F90                \
+                        ../rrtmg_sw_post.F90             \
+                        ../rrtmg_lw_pre.F90              \
+                        ../radlw_main.F90                  \
+                        ../rrtmg_lw_post.F90             \
+                        ../radiation_aerosols.f          \
+                        ../radiation_astronomy.f         \
+                        ../radiation_clouds.f            \
+                        ../radiation_cloud_overlap.F90    \
+                        ../radiation_gases.f             \
+                        ../radiation_surface.f           \
+                        ../radlw_param.f \
+                        ../radlw_datatb.f \
+                        ../radsw_param.f  \
+                        ../radsw_datatb.f  \
+                        ../GFS_cloud_diagnostics.F90     \
+                        ../dcyc2t3.f        \
+                        ../sfc_diff.f   \
+                        ../sfc_diag.f                \
+                        ../sfc_diag_post.F90          \
+                        ../sfc_nst.f                  \
+                        ../sfc_nst_pre.f              \
+                        ../sfc_nst_post.f             \
+                        ../sfc_ocean.F                \
+                        ../clm_lake.f90              \
+                        ../module_nst_model.f90       \
+                        ../module_nst_parameters.f90  \
+                        ../module_nst_water_prop.f90  \
+                        ../lsm_noah.f                  \
+                        ../sflx.f                     \
+                        ../namelist_soilveg.f   \
+                        ../set_soilveg.f        \
+                        ../noahmpdrv.F90           \
+                        ../module_sf_noahmplsm.f90    \
+                        ../module_sf_noahmp_glacier.f90  \
+                        ../noahmp_tables.f90          \
+                        ../GFS_surface_generic_pre.F90   \
+                        ../GFS_surface_generic_post.F90   \
+                        ../surface_perturbation.F90 \
+                        ../GFS_DCNV_generic_pre.F90      \
+                        ../GFS_DCNV_generic_post.F90   \
+                        ../GFS_SCNV_generic_pre.F90     \
+                        ../GFS_SCNV_generic_post.F90     \
+                        ../sfc_sice.f \
+                        ../satmedmfvdifq.F  \
+                        ../mfpbltq.f         \
+                        ../mfscuq.f          \
+                        ../tridi.f          \
+                        ../GFS_GWD_generic_pre.F90 \
+                        ../GFS_GWD_generic_post.F90   \
+                        ../unified_ugwp.F90         \
+                        ../drag_suite.F90           \
+                        ../cires_tauamf_data.F90    \
+                        ../cires_orowam2017.f     \
+                        ../cires_ugwp.F90           \
+                        ../cires_ugwp_initialize.F90     \
+                        ../cires_ugwp_module.F90       \
+                        ../cires_ugwp_post.F90         \
+                        ../cires_ugwp_triggers.F90     \
+                        ../cires_ugwp_module.F90      \
+                        ../gwdps.f                     \
+                        ../ugwp_driver_v0.F            \
+                        ../ozphys_2015.f               \
+                        ../h2ophys.f \
+                        ../samfdeepcnv.f \
+                        ../samfshalcnv.f \
+                        ../progsigma_calc.f90   \
+                        ../cnvc90.f \
+                        ../module_bfmicrophysics.f \
+                        ../gfdl_cloud_microphys.F90 \
+                        ../module_gfdl_cloud_microphys.F90 \
+                        ../GFS_MP_generic_pre.F90 \
+                        ../GFS_MP_generic_post.F90   \
+                        ../GFS_PBL_generic_common.F90    \
+                        ../GFS_PBL_generic_pre.F90      \
+                        ../GFS_PBL_generic_post.F90     \
+                        ../calpreciptype.f90   \
+                        ../GFS_stochastics.F90   \
+                        ../cu_gf_driver.F90 \
+                        ../cu_gf_driver_pre.F90 \
+                        ../cu_gf_deep.F90   \
+                        ../cu_gf_sh.F90     \
+                        ../cu_gf_driver_post.F90 \
+                        ../mynnedmf_wrapper.F90 \
+                        ../module_bl_mynn.F90   \
+                        ../bl_mynn_common.f90   \
+                        ../mynnsfc_wrapper.F90 \
+                        ../module_sf_mynn.F90  \
+                        ../lsm_ruc.F90   \
+                        ../module_sf_ruclsm.F90    \
+                        ../namelist_soilveg_ruc.F90 \
+                        ../set_soilveg_ruc.F90   \
+                        ../module_soil_pre.F90   \
+                        ../mp_thompson_pre.F90  \
+                        ../module_mp_thompson_make_number_concentrations.F90 \
+                        ../mp_thompson.F90    \
+                        ../module_mp_thompson.F90 \
+                        ../module_mp_radar.F90 \
+                        ../mp_thompson_post.F90  \
+                        ../mp_nssl.F90        \
+                        ../module_mp_nssl_2mom.F90    \
+                        ../funcphys.f90     \
+                        ../physcons.F90     \
+                        ../radcons.f90      \
+                        ../mersenne_twister.f \
+                        ../maximum_hourly_diagnostics.F90   \
+                        ../phys_tend.F90  
+
+INPUT_ENCODING         = UTF-8
+FILE_PATTERNS          = *.f \
+                         *.F \
+                         *.F90 \
+                         *.f90 \
+                         *.nml \
+                         *.txt
+RECURSIVE              = YES
+EXCLUDE                =
+EXCLUDE_SYMLINKS       = NO
+EXCLUDE_PATTERNS       =
+EXCLUDE_SYMBOLS        =
+EXAMPLE_PATH           = pdftxt/RE300 \
+                         doc/html
+EXAMPLE_PATTERNS       = 
+EXAMPLE_RECURSIVE      = NO
+IMAGE_PATH             = img
+INPUT_FILTER           =
+FILTER_PATTERNS        =
+FILTER_SOURCE_FILES    = NO
+FILTER_SOURCE_PATTERNS =
+USE_MDFILE_AS_MAINPAGE =
+
+#---------------------------------------------------------------------------
+# Configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+SOURCE_BROWSER         = NO
+INLINE_SOURCES         = NO
+STRIP_CODE_COMMENTS    = YES
+REFERENCED_BY_RELATION = YES
+REFERENCES_RELATION    = YES
+REFERENCES_LINK_SOURCE = YES
+SOURCE_TOOLTIPS        = YES
+USE_HTAGS              = NO
+VERBATIM_HEADERS       = YES
+CLANG_ASSISTED_PARSING = NO
+CLANG_ADD_INC_PATHS    = YES
+CLANG_OPTIONS          =
+CLANG_DATABASE_PATH    =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+ALPHABETICAL_INDEX     = NO
+IGNORE_PREFIX          =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+GENERATE_HTML          = YES
+HTML_OUTPUT            = html
+HTML_FILE_EXTENSION    = .html
+HTML_HEADER            = _doxygen/header.html
+HTML_FOOTER            = _doxygen/footer.html
+HTML_STYLESHEET        = 
+HTML_EXTRA_STYLESHEET  = _doxygen/doxygen-awesome.css  \
+                         _doxygen/doxygen-awesome-sidebar-only.css \
+                         _doxygen/doxygen-awesome-sidebar-only-darkmode-toggle.css    \
+                         _doxygen/doxygen-awesome-ccpp.css 
+HTML_EXTRA_FILES       = _doxygen/doxygen-awesome-darkmode-toggle.js \
+                         _doxygen/doxygen-awesome-ccpp.js
+HTML_COLORSTYLE_HUE    = 209
+HTML_COLORSTYLE_SAT    = 255
+HTML_COLORSTYLE_GAMMA  = 113
+HTML_TIMESTAMP         = NO
+HTML_DYNAMIC_MENUS     = YES
+HTML_DYNAMIC_SECTIONS  = NO
+HTML_INDEX_NUM_ENTRIES = 100
+GENERATE_DOCSET        = NO
+DOCSET_FEEDNAME        = "Doxygen generated docs"
+DOCSET_FEEDURL         =
+DOCSET_BUNDLE_ID       = org.doxygen.Project
+DOCSET_PUBLISHER_ID    = org.doxygen.Publisher
+DOCSET_PUBLISHER_NAME  = Publisher
+GENERATE_HTMLHELP      = NO
+CHM_FILE               =
+HHC_LOCATION           =
+GENERATE_CHI           = NO
+CHM_INDEX_ENCODING     =
+BINARY_TOC             = NO
+TOC_EXPAND             = NO
+GENERATE_QHP           = NO
+QCH_FILE               =
+QHP_NAMESPACE          = org.doxygen.Project
+QHP_VIRTUAL_FOLDER     = doc
+QHP_CUST_FILTER_NAME   =
+QHP_CUST_FILTER_ATTRS  =
+QHP_SECT_FILTER_ATTRS  =
+QHG_LOCATION           =
+GENERATE_ECLIPSEHELP   = NO
+ECLIPSE_DOC_ID         = org.doxygen.Project
+DISABLE_INDEX          = YES
+GENERATE_TREEVIEW      = YES
+FULL_SIDEBAR           = NO
+ENUM_VALUES_PER_LINE   = 4
+TREEVIEW_WIDTH         = 335
+EXT_LINKS_IN_WINDOW    = NO
+OBFUSCATE_EMAILS       = YES
+HTML_FORMULA_FORMAT    = SVG
+FORMULA_FONTSIZE       = 10
+FORMULA_TRANSPARENT    = YES
+FORMULA_MACROFILE      =
+USE_MATHJAX            = YES
+MATHJAX_VERSION        = MathJax_2
+MATHJAX_FORMAT         = HTML-CSS
+#MATHJAX_RELPATH        = https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2
+MATHJAX_RELPATH        = https://cdn.jsdelivr.net/npm/mathjax@2
+MATHJAX_EXTENSIONS     =
+MATHJAX_CODEFILE       =
+SEARCHENGINE           = YES
+SERVER_BASED_SEARCH    = NO
+EXTERNAL_SEARCH        = NO
+SEARCHENGINE_URL       =
+SEARCHDATA_FILE        = searchdata.xml
+EXTERNAL_SEARCH_ID     =
+EXTRA_SEARCH_MAPPINGS  =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+GENERATE_LATEX         = YES
+LATEX_OUTPUT           = latex
+LATEX_CMD_NAME         = latex
+MAKEINDEX_CMD_NAME     = makeindex
+LATEX_MAKEINDEX_CMD    = makeindex
+COMPACT_LATEX          = YES
+PAPER_TYPE             = a4
+EXTRA_PACKAGES         = amsmath
+LATEX_HEADER           =
+LATEX_FOOTER           =
+LATEX_EXTRA_STYLESHEET =
+LATEX_EXTRA_FILES      =
+PDF_HYPERLINKS         = YES
+USE_PDFLATEX           = YES
+LATEX_BATCHMODE        = NO
+LATEX_HIDE_INDICES     = YES
+LATEX_BIB_STYLE        = plainnat
+LATEX_TIMESTAMP        = NO
+LATEX_EMOJI_DIRECTORY  =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+GENERATE_RTF           = NO
+RTF_OUTPUT             = rtf
+COMPACT_RTF            = NO
+RTF_HYPERLINKS         = NO
+RTF_STYLESHEET_FILE    =
+RTF_EXTENSIONS_FILE    =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+GENERATE_MAN           = NO
+MAN_OUTPUT             = man
+MAN_EXTENSION          = .3
+MAN_SUBDIR             =
+MAN_LINKS              = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+GENERATE_XML           = NO
+XML_OUTPUT             = xml
+XML_PROGRAMLISTING     = YES
+XML_NS_MEMB_FILE_SCOPE = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the DOCBOOK output
+#---------------------------------------------------------------------------
+
+GENERATE_DOCBOOK       = NO
+DOCBOOK_OUTPUT         = docbook
+
+#---------------------------------------------------------------------------
+# Configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+GENERATE_AUTOGEN_DEF   = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+GENERATE_PERLMOD       = NO
+PERLMOD_LATEX          = NO
+PERLMOD_PRETTY         = YES
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+ENABLE_PREPROCESSING   = NO
+MACRO_EXPANSION        = NO
+EXPAND_ONLY_PREDEF     = NO
+SEARCH_INCLUDES        = YES
+INCLUDE_PATH           =
+INCLUDE_FILE_PATTERNS  =
+PREDEFINED             = CCPP \
+                         MULTI_GASES \
+                         0
+EXPAND_AS_DEFINED      =
+SKIP_FUNCTION_MACROS   = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to external references
+#---------------------------------------------------------------------------
+
+TAGFILES               =
+GENERATE_TAGFILE       =
+ALLEXTERNALS           = NO
+EXTERNAL_GROUPS        = YES
+EXTERNAL_PAGES         = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+DIA_PATH               =
+HIDE_UNDOC_RELATIONS   = YES
+HAVE_DOT               = YES
+DOT_NUM_THREADS        = 0
+DOT_FONTNAME           = Source Sans Pro
+DOT_FONTSIZE           = 
+DOT_FONTPATH           =
+CLASS_GRAPH            = YES
+COLLABORATION_GRAPH    = YES
+GROUP_GRAPHS           = YES
+UML_LOOK               = YES
+UML_LIMIT_NUM_FIELDS   = 10
+DOT_UML_DETAILS        = NO
+DOT_WRAP_THRESHOLD     = 17
+TEMPLATE_RELATIONS     = NO
+INCLUDE_GRAPH          = YES
+INCLUDED_BY_GRAPH      = NO
+CALL_GRAPH             = YES
+CALLER_GRAPH           = YES
+GRAPHICAL_HIERARCHY    = YES
+DIRECTORY_GRAPH        = YES
+DIR_GRAPH_MAX_DEPTH    = 1
+DOT_IMAGE_FORMAT       = SVG
+INTERACTIVE_SVG        = NO
+DOT_PATH               = /Users/man.zhang/homebrew/bin/dot 
+DOTFILE_DIRS           =
+MSCFILE_DIRS           =
+DIAFILE_DIRS           =
+PLANTUML_JAR_PATH      =
+PLANTUML_CFG_FILE      =
+PLANTUML_INCLUDE_PATH  =
+DOT_GRAPH_MAX_NODES    = 1000
+MAX_DOT_GRAPH_DEPTH    = 0
+DOT_TRANSPARENT        = YES
+DOT_MULTI_TARGETS      = YES
+GENERATE_LEGEND        = YES
+DOT_CLEANUP            = YES
diff --git a/physics/docs/library.bib b/physics/docs/library.bib
index b6109b12c..7c01fbc65 100644
--- a/physics/docs/library.bib
+++ b/physics/docs/library.bib
@@ -1,13 +1,159 @@
 %% This BibTeX bibliography file was created using BibDesk.
 %% https://bibdesk.sourceforge.io/
 
-%% Created for Man Zhang at 2022-10-13 16:15:17 -0600 
+%% Created for Man Zhang at 2023-06-07 10:17:09 -0600 
 
 
 %% Saved with string encoding Unicode (UTF-8) 
 
 
 
+@article{Lin_2022,
+	author = {Jialin Lin and Taotao Qian and Peter Bechtold and Georg Grell and Guang J. Zhang and Ping Zhu and Saulo R. Freitas and Hannah Barnes and Jongil Han},
+	date-added = {2023-06-07 10:16:46 -0600},
+	date-modified = {2023-06-07 10:16:46 -0600},
+	doi = {10.1080/07055900.2022.2082915},
+	journal = {Atmosphere-Ocean},
+	month = {jul},
+	number = {3-4},
+	pages = {422--476},
+	publisher = {Informa {UK} Limited},
+	title = {Atmospheric Convection},
+	url = {https://doi.org/10.1080%2F07055900.2022.2082915},
+	volume = {60},
+	year = 2022,
+	bdsk-url-1 = {https://doi.org/10.1080%2F07055900.2022.2082915},
+	bdsk-url-2 = {https://doi.org/10.1080/07055900.2022.2082915}}
+
+@techreport{He_2023,
+	author = {He, Cenlin and Valayamkunnath, Prasanth and Barlage, Michael and Chen, Fei and Gochis, David and Cabell, Ryan and Schneider, Tim and Rasmussen, Roy and Niu, Guo-Yue and Yang, Zong-Liang and Niyogi, Dev and Ek, Michael},
+	date-added = {2023-06-06 12:37:33 -0600},
+	date-modified = {2023-06-06 12:39:16 -0600},
+	doi = {10.5065/EW8G-YR95},
+	publisher = {NCAR/UCAR},
+	title = {The Community Noah-MP Land Surface Modeling System Technical Description Version 5.0},
+	url = {https://opensky.ucar.edu/islandora/object/technotes:599},
+	year = {2023},
+	bdsk-url-1 = {https://opensky.ucar.edu/islandora/object/technotes:599},
+	bdsk-url-2 = {https://doi.org/10.5065/EW8G-YR95}}
+
+@article{Niu_2007,
+	author = {Guo-Yue Niu and Zong-Liang Yang},
+	date-added = {2023-06-05 14:03:26 -0600},
+	date-modified = {2023-06-05 14:03:26 -0600},
+	doi = {10.1029/2007jd008674},
+	journal = {Journal of Geophysical Research},
+	month = {nov},
+	number = {D21},
+	publisher = {American Geophysical Union ({AGU})},
+	title = {An observation-based formulation of snow cover fraction and its evaluation over large North American river basins},
+	url = {https://doi.org/10.1029%2F2007jd008674},
+	volume = {112},
+	year = 2007,
+	bdsk-url-1 = {https://doi.org/10.1029%2F2007jd008674},
+	bdsk-url-2 = {https://doi.org/10.1029/2007jd008674}}
+
+@techreport{Oleson2013,
+	author = {Oleson, Keith and Lawrence, David and Bonan, Gordon and Drewniak, Beth and Huang, Maoyi and Koven, Charles and Levis, Samuel and Li, Fang and Riley, William and Subin, Zachary and Swenson, Sean and Thornton, Peter and Bozbiyik, Anil and Fisher, Rosie and Heald, Colette and Kluzek, Erik and Lamarque, Jean-Francois and Lawrence, Peter and Leung, L and Lipscomb, William and Muszala, Stefan and Ricciuto, Daniel and Sacks, William and Sun, Ying and Tang, Jinyun and Yang, Zong-Liang},
+	date-added = {2023-06-05 09:28:16 -0600},
+	date-modified = {2023-06-05 09:30:30 -0600},
+	doi = {10.5065/D6RR1W7M},
+	keywords = {Land surface model, Climate model, Biogeochemistry, Biogeophysics},
+	language = {en},
+	publisher = {UCAR/NCAR},
+	title = {Technical description of version 4.5 of the Community Land Model (CLM)},
+	url = {http://opensky.ucar.edu/islandora/object/technotes:515},
+	year = {2013},
+	bdsk-url-1 = {http://opensky.ucar.edu/islandora/object/technotes:515},
+	bdsk-url-2 = {https://doi.org/10.5065/D6RR1W7M}}
+
+@article{Kourzeneva_2012,
+	author = {Ekaterina Kourzeneva and Hermann Asensio and Eric Martin and Stephanie Faroux},
+	date-added = {2023-05-30 11:29:07 -0600},
+	date-modified = {2023-05-30 11:29:07 -0600},
+	doi = {10.3402/tellusa.v64i0.15640},
+	journal = {Tellus A: Dynamic Meteorology and Oceanography},
+	month = {dec},
+	number = {1},
+	pages = {15640},
+	publisher = {Stockholm University Press},
+	title = {Global gridded dataset of lake coverage and lake depth for use in numerical weather prediction and climate modelling},
+	url = {https://doi.org/10.3402%2Ftellusa.v64i0.15640},
+	volume = {64},
+	year = 2012,
+	bdsk-url-1 = {https://doi.org/10.3402%2Ftellusa.v64i0.15640},
+	bdsk-url-2 = {https://doi.org/10.3402/tellusa.v64i0.15640}}
+
+@article{Gu2015,
+	abstract = {A one-dimensional (1-D) physically based lake model was coupled to the Weather Research and Forecasting (WRF) model version 3.2 developed by the National Center for Atmospheric Research to dynamically simulate physical processes of lakes and their effects on weather and climate at local and regional scales. Our study area is focused on the Great Lakes. This coupled model realistically reproduces the lake surface temperature (LST) at a buoy station in a shallow lake (Lake Erie) while generating strong LST biases ranging from −20 to 20 {\textdegree}C at a buoy station in a deep lake (Lake Superior). Through many sensitivity tests, we find that the biases in the deep lake LST simulations result from the drastic underestimation of heat transfer between the lower and upper parts of the lake through unrealistic eddy diffusion. Additional tests were made to calibrate the eddy diffusivity in WRF-Lake. It is found that when this parameter is multiplied by a factor ranging from 102 to 105 for various lake depths deeper than 15 m, the LST simulations for the deep lake buoy station show good agreement with observations, and the bias range reduces to {\textpm}4 {\textdegree}C. Essentially, the enlarged eddy diffusivity strengthens heat transfer within the lake columns in the deep lake, which is significantly underestimated in the lake model without calibration. Validation simulations with the calibrated eddy diffusivity were carried out for the whole of Lake Superior and Lake Erie. The LST simulations still have a substantial bias reduction when compared with those produced with the original eddy diffusivity, indicating that the calibrated parameter is representative. In addition, the improved 1-D lake model with WRF reasonably reproduces the remotely sensed LST geographic distribution.},
+	author = {Gu, Hongping and Jin, Jiming and Wu, Yihua and Ek, Michael B. and Subin, Zachary M.},
+	date-added = {2023-05-24 14:45:55 -0600},
+	date-modified = {2023-05-24 14:45:55 -0600},
+	day = {01},
+	doi = {10.1007/s10584-013-0978-y},
+	issn = {1573-1480},
+	journal = {Climatic Change},
+	month = {Apr},
+	number = {3},
+	pages = {471--483},
+	title = {Calibration and validation of lake surface temperature simulations with the coupled WRF-lake model},
+	url = {https://link.springer.com/content/pdf/10.1007/s10584-013-0978-y.pdf},
+	volume = {129},
+	year = {2015},
+	bdsk-url-1 = {https://link.springer.com/content/pdf/10.1007/s10584-013-0978-y.pdf},
+	bdsk-url-2 = {https://doi.org/10.1007/s10584-013-0978-y}}
+
+@article{Subin_2012,
+	author = {Zachary M. Subin and William J. Riley and Dmitrii Mironov},
+	date-added = {2023-05-24 14:35:27 -0600},
+	date-modified = {2023-05-24 14:35:27 -0600},
+	doi = {10.1029/2011ms000072},
+	journal = {Journal of Advances in Modeling Earth Systems},
+	month = {feb},
+	publisher = {American Geophysical Union ({AGU})},
+	title = {An improved lake model for climate simulations: Model structure, evaluation, and sensitivity analyses in {CESM}1},
+	url = {https://doi.org/10.1029%2F2011ms000072},
+	volume = {4},
+	year = 2012,
+	bdsk-url-1 = {https://doi.org/10.1029%2F2011ms000072},
+	bdsk-url-2 = {https://doi.org/10.1029/2011ms000072}}
+
+@article{Lawrence_2019,
+	author = {David M. Lawrence and Rosie A. Fisher and Charles D. Koven and Keith W. Oleson and Sean C. Swenson and Gordon Bonan and Nathan Collier and Bardan Ghimire and Leo van Kampenhout and Daniel Kennedy and Erik Kluzek and Peter J. Lawrence and Fang Li and Hongyi Li and Danica Lombardozzi and William J. Riley and William J. Sacks and Mingjie Shi and Mariana Vertenstein and William R. Wieder and Chonggang Xu and Ashehad A. Ali and Andrew M. Badger and Gautam Bisht and Michiel van den Broeke and Michael A. Brunke and Sean P. Burns and Jonathan Buzan and Martyn Clark and Anthony Craig and Kyla Dahlin and Beth Drewniak and Joshua B. Fisher and Mark Flanner and Andrew M. Fox and Pierre Gentine and Forrest Hoffman and Gretchen Keppel-Aleks and Ryan Knox and Sanjiv Kumar and Jan Lenaerts and L. Ruby Leung and William H. Lipscomb and Yaqiong Lu and Ashutosh Pandey and Jon D. Pelletier and Justin Perket and James T. Randerson and Daniel M. Ricciuto and Benjamin M. Sanderson and Andrew Slater and Zachary M. Subin and Jinyun Tang and R. Quinn Thomas and Maria Val Martin and Xubin Zeng},
+	date-added = {2023-05-24 14:34:12 -0600},
+	date-modified = {2023-05-24 14:34:12 -0600},
+	doi = {10.1029/2018ms001583},
+	journal = {Journal of Advances in Modeling Earth Systems},
+	month = {dec},
+	number = {12},
+	pages = {4245--4287},
+	publisher = {American Geophysical Union ({AGU})},
+	title = {The Community Land Model Version 5: Description of New Features, Benchmarking, and Impact of Forcing Uncertainty},
+	url = {https://doi.org/10.1029%2F2018ms001583},
+	volume = {11},
+	year = 2019,
+	bdsk-url-1 = {https://doi.org/10.1029%2F2018ms001583},
+	bdsk-url-2 = {https://doi.org/10.1029/2018ms001583}}
+
+@article{cite-key,
+	date-added = {2023-05-24 11:18:09 -0600},
+	date-modified = {2023-05-24 11:18:09 -0600}}
+
+@article{gmd-15-6659-2022,
+	author = {Benjamin, S. G. and Smirnova, T. G. and James, E. P. and Anderson, E. J. and Fujisaki-Manome, A. and Kelley, J. G. W. and Mann, G. E. and Gronewold, A. D. and Chu, P. and Kelley, S. G. T.},
+	date-added = {2023-05-24 10:51:47 -0600},
+	date-modified = {2023-05-24 10:51:47 -0600},
+	doi = {10.5194/gmd-15-6659-2022},
+	journal = {Geoscientific Model Development},
+	number = {17},
+	pages = {6659--6676},
+	title = {Inland lake temperature initialization via coupled cycling with atmospheric data assimilation},
+	url = {https://gmd.copernicus.org/articles/15/6659/2022/},
+	volume = {15},
+	year = {2022},
+	bdsk-url-1 = {https://gmd.copernicus.org/articles/15/6659/2022/},
+	bdsk-url-2 = {https://doi.org/10.5194/gmd-15-6659-2022}}
+
 @article{Chaboureau_2005,
 	author = {Jean-Pierre Chaboureau},
 	date-added = {2022-10-13 16:14:54 -0600},
@@ -3663,6 +3809,18 @@ @article{tsiringakis_et_al_2017
 	year = {2017},
 	bdsk-url-1 = {https://doi.org/10.1002/qj.3021}}
 
+@article{sturm_1997,
+	author = {Sturm, Matthew and Holmgren, Jon and K{\"o}nig, Max and Morris, Kim},
+	doi = {10.3189/S0022143000002781},
+	journal = {Journal of Glaciology},
+	number = {143},
+	pages = {26--41},
+	publisher = {Cambridge University Press},
+	title = {The thermal conductivity of seasonal snow},
+	volume = {43},
+	year = {1997},
+	bdsk-url-1 = {https://doi.org/10.3189/S0022143000002781}}
+
 @comment{BibDesk Static Groups{
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
diff --git a/physics/docs/pdftxt/CLM_LAKE.txt b/physics/docs/pdftxt/CLM_LAKE.txt
new file mode 100644
index 000000000..c091d2b17
--- /dev/null
+++ b/physics/docs/pdftxt/CLM_LAKE.txt
@@ -0,0 +1,59 @@
+/**
+\page CLM_LAKE_model CLM Lake Model 
+\section des_clmlake  Description
+
+CLM lake model is a multi-level one-dimensional lake model that has been implemented within the operational 3-km HRRR and
+13-km RAP for small lakes (Benjamin et al. (2022) \cite gmd-15-6659-2022). It is the Community Land Model, version 4.5. 
+Subin et al. (2012) \cite Subin_2012 describe the  1-d CLM lake model as applied within the Community Earth System
+Model (CESM) as a component of the overall CESM CLM (Lawrence et al. (2019) \cite Lawrence_2019). Gu et al. (2015) \cite Gu2015 
+describe the introduction of the CLM lake model into the WRF model and inital experiments using its 1-d solution for both
+lakes Superior (average depth of 147 m) and Erie (average depth of 19 m).
+
+The atmospheric inputs into the model are temperature, water vapor, horizontal wind components from the lowest atmospheric level
+and short-wave and longwave radiative fluxes. The CLM lake model then provides latent heat and sensible heat fluxes back to the 
+atmosphere. It also computes 2-m temperature/moisture, skin temperature, lake temperature, ice fraction, ice thickness, snow water
+equivalent and snow depth. The CLM lake model divides the vertical lake profile into 10 layers driven by wind-driven eddies. The
+thickness of the top layer is fixed to 10-cm and the rest of the lake depth is divided evenly into the other 9 layers. Energy
+transfer (heat and kinetic energy) occurs between lake layers via eddy and molecular diffusion as a function of the vertical 
+temperature gradient. The CLM lake model also uses a 10-layer soil model beneath the lake, a multi-layer ice formation model and
+up to 5-layer snow-on-ice model. Multiple layers in lake model have the potential to better represent vertical mixing processes 
+in the lake.
+
+Testing of the CLM lake model within RAP/HRRR applications showed computational efficiency of the model with no change of even
+0.1% in run time. The lake/snow variables have to be continuously transfered within the CLM lake model from one forecast to another,
+constrained by the atmospheric data assimilation. The lake-cycling initialization in RAP/HRRR has been effective overall, owing to 
+accurate houly estimates of near-surface temperature, moisture and winds, and shortwave and longwave estimates provided to the 1-d CLM
+lake model every time step (Benjamin et al. (2022) \cite gmd-15-6659-2022). Cycling technique showed improvements over initializing
+lake temperatures from the SST analysis, problematic for small water bodies. The improvements are particularly eminent during transition 
+periods between cold and warm seasons, and in the regions with anomalies in weather conditions. The CLM lake model has the potential 
+to improve surface prediction in the vicinity of small lakes.
+
+The CLM lake model requires bathymetry for the lake points in the model domain. Grid points are assigned as lake points when the 
+fraction of lake coverage in the grid cell exceeds 50% and when this point is disconnected from oceans. The lake water mask is 
+therefore binary, set to either 1 or 0. This binary approach for models with higher horizontal resolution, for example, 3-km resolution in 
+the regional application of UFS (RRFS), is capable of capturing the effect of lakes on regional heat and moisture fluxes.
+
+Lake depths for the RRFS lake configuration (Fig.1) are assigned from a global dataset provided by Kourzeneva et al.(2012) \cite Kourzeneva_2012,
+this dataset is referred to as GLOBv3 bathymetry in the UFS_UTL.
+
+\image html Lake_depths_RRFS3km.png "Figure 1: Lake depths for lakes in the 3-km RRFS domain." width=600
+
+To cold-start the CLM lake model in RRFS:
+- Use the CLM option in the input.nml
+\n  - lkm = 1
+\n  - iopt_lake = 2
+- Lake temperature is initialized from interpolation between SST at the surface and \f$-4^oC\f$ at 50-m depth
+\n  - A special case is for the Great Salt Lake, the temperature is limited with +/- 3 K from the bi-weekly climatology
+- Temperature for soil under the lake is initialized from bottom lake temperature at the top to the substrate soil temperature at the bottom of soil layer
+- Lake ice at the top level is initialized from the GFS ice concentration
+
+The differences of surface variables from the RRFS 6-h forecast with/without CLM lake model are shown in Figure 2 for 2-m temperature and in Figure 3 for 2-m dewpoint.
+\image html diff_t2m_lake_rrfs.png "Figure 2: Differences of 2-m temperature between the RRFS coupled to the CLM model and the RRFS without CLM." width=600
+\image html diff_td2m_lake_rrfs.png "Figure 3: Differences of 2-m dew point between the RRFS coupled to the CLM model and the RRFS without CLM." width=600
+ 
+
+
+\section intra_clmlake Intraphysics Communication
+- \ref arg_table_clm_lake_run
+
+*/
diff --git a/physics/docs/pdftxt/CU_GF_deep.txt b/physics/docs/pdftxt/CU_GF_deep.txt
index 92b8c3b7c..f30cb28dc 100644
--- a/physics/docs/pdftxt/CU_GF_deep.txt
+++ b/physics/docs/pdftxt/CU_GF_deep.txt
@@ -3,26 +3,22 @@
 \section gfcu_descrip  Description
 
 The Grell-Freitas (GF) scheme, as described in Grell and Freitas (2014) \cite grell_and_freitas_2014,
-Freitas et al. (2018) \cite freitas_et_al_2018, Freitas et al. (2021) \cite freitas_et_al_2021, and Lin et al. (2022) 
-(under review) follows the mass flux approach published by Grell (1993) \cite grell_1993.
+Freitas et al. (2018) \cite freitas_et_al_2018, Freitas et al. (2021) \cite freitas_et_al_2021, and Lin et al. (2022) \cite Lin_2022
+follows the mass flux approach published by Grell (1993) \cite grell_1993.
 Further developments by Grell and \f$D\acute{e}v\acute{e}nyi\f$ (2002) \cite Grell_2002 included implementing 
-stochastics through allowing parameter perturbations. In GF1 scale awareness, and the aerosol dependence through rain generation (following
+stochastics through allowing parameter perturbations. In GF scale awareness, and the aerosol dependence through rain generation (following
 Berry (1968) \cite berry_1968 and evaporation formulations (following Jiang et al. (2010) \cite Jiang_2010 ), depending on the 
-cloud concentration nuclei at cloud base were added. FG included mixed phase physics impact, momentum transport (as in ECMWF),
+cloud concentration nuclei at cloud base were added. GF included mixed phase physics impact, momentum transport,
  a diurnal cycle closure (Bechtold et al. (2014) \cite bechtold_et_al_2014 ), and a trimodal spectral size to simulate the interaction
-and transition from shallow, congestus and deep convection regimes. In order for this trimodal size spectrum to be
-accurately represented, GF's deep and shallow convective schemes must be run together. 
-The vertical massflux distribution of shallow, congestus and
+and transition from shallow, congestus and deep convection regimes. The vertical massflux distribution of shallow, congestus and
 deep convection regimes is characterized by Probability Density Functions (PDF's). The three PDF's are meant to represent the average
 statistical mass flux characteristic of deep, congestus, and shallow (respectively) plumes in the grid area. Each PDF therefore represents
 a spectrum of plumes within the grid box. Forcing is different for each characteristic type. Entrainment and detrainment are derived 
-from the PDF's. The deep convection considers scale awareness (Arakawa et al. (2011) \cite Arakawa_2011 ), the congestus type convection 
-as well as the shallow convection are not scale-aware. Aerosol dependence is implemented through dependence of rain generation and 
+from the PDF's. The deep and congestus convection considers scale awareness (Arakawa et al. (2011) \cite Arakawa_2011 ), the shallow convection is not scale-aware. Aerosol dependence is implemented through dependence of rain generation and 
 evaporation formulations depending on the cloud concentration nuclei at cloud base (Berry 1968 \cite berry_1968, 
-Jiang et al.(2010) \cite Jiang_2010, and Lee and Feingold (2010) \cite lee_and_feingold_2010 ). Aerosol dependence is considered experimental and 
+Jiang et al.(2010) \cite Jiang_2010, and Lee and Feingold (2010) \cite lee_and_feingold_2010 ). Wet scavenging is considered to add a memory impact. Aerosol dependence is considered experimental and 
 is turned off at this point. GF is able to transport tracers.
 
-A paper describing the latest changes and modifications is in process and will be submitted to GMD.
 
 \section version_cugf_enh CCPP Physics Updates
 \version CCPP v6.0.0
@@ -42,6 +38,20 @@ transition as grid spacing decreases into a shallow convection scheme
   - Coupled to the grid scale precipitation and radiation schemes through passing of diagnosed cloud liquid and ice from simulated
 precipitating convective cloud and shallow convective clouds
 
+\version UFS-SRW v3.0.0
+- The choices of closures for deep/mid/shallow convection are now namelist options
+- Updates for aerosol-awareness
+
+\b The \b Implementation \b of \b GF \b in \b RRFS
+
+- Scale-awareness is turned off when explicit microphysics is not active anywhere in the column
+- GF completely is turned off at grid points when MYNN produces shallow convection at that point
+- Radar reflectivity considers mass flux PDF as well as whether scale-awareness is turned on at the grid point in equation.
+
+\b The \b implementation \b of \b GF \b in \b HAFS \b is \b undergoing.
+
+
+
 \section intra_rough_gf Intraphysics Communication
 The GF scheme passes cloud hydrometeors to the grid-scale microphysics scheme (\ref THOMPSON ) through detrainment from each 
 convective cloud layer containing convective cloud. The detrained condensate interacts with short- and longwave radiation by 
diff --git a/physics/docs/pdftxt/GFS_NOAHMP.txt b/physics/docs/pdftxt/GFS_NOAHMP.txt
index bc2c58457..83e8c0650 100644
--- a/physics/docs/pdftxt/GFS_NOAHMP.txt
+++ b/physics/docs/pdftxt/GFS_NOAHMP.txt
@@ -4,21 +4,17 @@
 
 This implementation of the NoahMP Land Surface Model (LSM) is adapted from the version implemented in WRF v3.7 with additions by NOAA EMC staff to work with the UFS Atmosphere model. Authoritative documentation of the NoahMP scheme can be accessed at the following links:
 
-[University of Texas at Austin NoahMP Documentation](http://www.jsg.utexas.edu/noah-mp "University of Texas at Austin NoahMP Documentation")
+Technical documentation freely available at He et al. (2023) \cite He_2023.
 
-[NCAR Research Application Laboratory NoahMP Documentation](https://ral.ucar.edu/solutions/products/noah-multiparameterization-land-surface-model-noah-mp-lsm "NCAR RAL NoahMP Documentation")
+To cite the technical documentation: He, C., P. Valayamkunnath, M. Barlage, F. Chen, D. Gochis, R. Cabell, T. Schneider, R. Rasmussen, G.-Y. Niu, Z.-L. Yang, D. Niyogi, and M. Ek (2023): The Community Noah-MP Land Surface Modeling System Technical Description Version 5.0, (No. NCAR/TN-575+STR). doi:10.5065/ew8g-yr95
 
 A primary reference for the NoahMP LSM is Niu et al. (2011) \cite niu_et_al_2011.
 
-The CCPP interface to the NoahMP LSM is a driving software layer on top of the actual NoahMP LSM. During the run sequence, code organization is as follows:
-+ \ref noahmpdrv_run() calls
- + \ref transfer_mp_parameters()
- + \ref noahmp_options()
- + \ref noahmp_options_glacier() and noahmp_glacier() if over the ice vegetation type (glacier)
- + \ref noahmp_sflx() if over other vegetation types
- + \ref penman()
- 
-Note that noahmp_glacer() and noahmp_sflx() are the actual NoahMP codes.
+\section noahmp_update CCPP Physics Updates
+\version UFS-SRW v3.0.0
+- As part of a larger-scale effort to unify how microphysics outputs (in particular snow) are used in the land models and outputs, an addition option for using the unified frozen precipitation fraction in NoahMP was added
+- Diagnostic 2-meter temperature and humidity are based on vegetation and bare-ground tiles
+- Bug fixes for GFS-based thermal roughness length scheme
  
 \section intra_noahmp Intraphysics Communication
  +  \ref arg_table_noahmpdrv_run
diff --git a/physics/docs/pdftxt/GFS_UGWPv0.txt b/physics/docs/pdftxt/GFS_UGWPv0.txt
index f2b3b143a..1b3f0166f 100644
--- a/physics/docs/pdftxt/GFS_UGWPv0.txt
+++ b/physics/docs/pdftxt/GFS_UGWPv0.txt
@@ -108,6 +108,52 @@ and dynamical instability of waves described by the linear
 (Lindzen 1981 \cite lindzen_1981) and nonlinear 
 (Weinstock 1984 \cite weinstock_1984; Hines 1997 \cite hines_1997) saturation theories.
 
+\section ugwp_updates CCPP Physics Updates
+\version UFS-SRW v3.0.0
+
+We have added optional diagnostic outputs for the various tendencies supplied by the UGWP.  They can be switched on by setting the two following input namelist variables equal to “.true.”:  \p ldiag3d and \p ldiag_ugwp.
+
+The optional diagnostic outputs are:
+- \b dws3dt_ogw: time-averaged wind speed tendency due to mesoscale gravity wave drag
+- \b dws3dt_obl: time-averaged wind speed tendency due to blocking drag
+- \b dws3dt_oss: time-averaged wind speed tendency due to small-scale gravity wave drag
+- \b dws3dt_ofd: time-averaged wind speed tendency due to turbulent orographic form drag
+- \b ldu3dt_ogw: time-averaged x wind tendency due to mesoscale orographic gravity wave drag
+- \b ldu3dt_obl: time-averaged x wind tendency due to blocking drag
+- \b ldu3dt_oss: time-averaged x wind tendency due to small scale gravity wave drag
+- \b ldu3dt_ofd: time-averaged x wind tendency due to form drag
+- \b ldu3dt_ngw: time-averaged u momentum tendency due to non-stationary gravity wave drag
+- \b ldv3dt_ngw: time-averaged v momentum tendency due to non-stationary gravity wave drag
+- \b ldt3dt_ngw: time-averaged temperature tendency due to non-stationary gravity wave drag
+- \b dudt_ogw: instantaneous x wind tendency from mesoscale orographic gravity wave drag
+- \b dvdt_ogw: instantaneous y wind tendency from mesoscale orographic gravity wave drag
+- \b dudt_obl: instantaneous x wind tendency from blocking drag
+- \b dvdt_obl: instantaneous y wind tendency from blocking drag
+- \b dudt_oss: instantaneous x wind tendency from small scale GWD
+- \b dvdt_oss: instantaneous y wind tendency from small scale GWD
+- \b dudt_ofd: instantaneous x wind tendency from form drag
+- \b dvdt_ofd: instantaneous y wind tendency from form drag
+- \b du_ogwcol: instantaneous integrated x momentum flux from mesoscale orographic gravity wave drag
+- \b dv_ogwcol: instantaneous integrated y momentum flux from mesoscale orographic gravity wave drag
+- \b du_oblcol: instantaneous integrated x momentum flux from blocking drag
+- \b dv_oblcol: instantaneous integrated y momentum flux from blocking drag
+- \b du_osscol: instantaneous integrated x momentum flux from small scale gwd
+- \b dv_osscol: instantaneous integrated y momentum flux from small scale gwd
+- \b du_ofdcol: instantaneous integrated x momentum flux from form drag
+- \b dv_ofdcol: instantaneous integrated y momentum flux from form drag
+- \b du3_ogwcol: time-averaged surface x momentum flux from mesoscale orographic gravity wave drag
+- \b dv3_ogwcol: time-averaged surface y momentum flux from mesoscale orographic gravity wave drag
+- \b du3_oblcol: time-averaged surface x momentum flux from blocking drag
+- \b dv3_oblcol: time-averaged surface y momentum flux from blocking drag
+- \b du3_osscol: time-averaged surface x momentum flux from small scale gravity wave drag
+- \b dv3_osscol: time-averaged surface y momentum flux from small scale gravity wave drag
+- \b du3_ofdcol: time-averaged surface x momentum flux from form drag
+- \b dv3_ofdcol: time-averaged surface y momentum flux from form drag
+
+Note that the relevant diag_table entries for these variables are included in:
+ufs-weather-model/tests/parm/diag_table/diag_table_rap
+
+
 \section intra_UGWPv0 Intraphysics Communication
 - \ref arg_table_cires_ugwp_run
 
diff --git a/physics/docs/pdftxt/GFS_v16_suite.txt b/physics/docs/pdftxt/GFS_v16_suite.txt
index 11e997bf1..8966d6be8 100644
--- a/physics/docs/pdftxt/GFS_v16_suite.txt
+++ b/physics/docs/pdftxt/GFS_v16_suite.txt
@@ -25,9 +25,9 @@ National Centers for Environmental Prediction (NCEP) in 2021. The GFS_v16 suite
 
 \section gfs16_nml_opt_des Namelist 
 \ref GFDL_cloud namelist options 
-\snippet RE210/FV3_GFS_v16_input.nml GFDL_CLOUD_MP_NML
+\snippet RE300/FV3_GFS_v16_input.nml GFDL_CLOUD_MP_NML
 Other namelist options
-\snippet RE210/FV3_GFS_v16_input.nml GFS_PHYSICS_NML
+\snippet RE300/FV3_GFS_v16_input.nml GFS_PHYSICS_NML
 
 - nstf_name = \f$[2,0,0,0,0]^1 [2,1,0,0,0]^2\f$
  - \f$^1\f$ NSST is on and coupled with spin up off
diff --git a/physics/docs/pdftxt/HRRR_suite.txt b/physics/docs/pdftxt/HRRR_suite.txt
index c08f50211..d8b529ada 100644
--- a/physics/docs/pdftxt/HRRR_suite.txt
+++ b/physics/docs/pdftxt/HRRR_suite.txt
@@ -28,6 +28,6 @@ The HRRR suite uses the parameterizations in the following order:
 \include suite_FV3_HRRR.xml
 
 \section hrrr_nml_option Namelist 
-\snippet RE210/FV3_HRRR_input.nml GFS_PHYSICS_NML
+\snippet FV3_HRRR_input.nml GFS_PHYSICS_NML
 
 */
diff --git a/physics/docs/pdftxt/NoahMP.txt b/physics/docs/pdftxt/NoahMP.txt
deleted file mode 100644
index f42aaaa00..000000000
--- a/physics/docs/pdftxt/NoahMP.txt
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
-\page NoahMP GFS NoahMP Land Surface Model
-\section des_noahmp  Description
-
-This implementation of the NoahMP Land Surface Model (LSM) is adapted from the version implemented in WRF v3.7 with additions by NOAA EMC staff to work with the UFS Atmosphere model. Authoritative documentation of the NoahMP scheme can be accessed at the following links:
-
-[University of Texas at Austin NoahMP Documentation](http://www.jsg.utexas.edu/noah-mp "University of Texas at Austin NoahMP Documentation")
-
-[NCAR Research Application Laboratory NoahMP Documentation](https://ral.ucar.edu/solutions/products/noah-multiparameterization-land-surface-model-noah-mp-lsm "NCAR RAL NoahMP Documentation")
-
-A primary reference for the NoahMP LSM is Niu et al. (2011) \cite niu_et_al_2011.
-
-The CCPP interface to the NoahMP LSM is a driving software layer on top of the actual NoahMP LSM. During the run sequence, code organization is as follows:
-+ \ref noahmpdrv_run() calls
- + \ref transfer_mp_parameters()
- + \ref noahmp_options()
- + \ref noahmp_options_glacier() and noahmp_glacier() if over the ice vegetation type (glacier)
- + \ref noahmp_sflx() if over other vegetation types
- + \ref penman()
- 
-Note that noahmp_glacer() and noahmp_sflx() are the actual NoahMP codes.
- 
-\section Default NoahMP LSM Options used in UFS atmosphere
-+ Dynamic Vegetation (opt_dveg): 2 [On]
-+ Canopy Stomatal Resistance (opt_crs): 1 [Ball-Berry]
-+ Soil Moisture Factor for Stomatal Resistance (opt_btr): 1 [Noah soil moisture]
-+ Runoff and Groundwater (opt_run): 1 [topmodel with groundwater (Niu et al. 2007 \cite niu_et_al_2007)]
-+ Surface Layer Drag Coeff (opt_sfc): 1 [Monin-Obukhov]
-+ Supercooled Liquid Water or Ice Fraction (opt_frz): 1 [no iteration (Niu and Yang, 2006 \cite niu_and_yang_2006)]
-+ Frozen Soil Permeability (opt_inf): 1 [linear effects, more permeable (Niu and Yang, 2006, \cite niu_and_yang_2006)]
-+ Radiation Transfer (opt_rad): 1 [modified two-stream (gap = f(solar angle, 3d structure ...)<1-fveg)]
-+ Ground Snow Surface Albedo (opt_alb): 2 [class]
-+ Partitioning Precipitation into Rainfall & Snowfall (opt_snf): 4 [use microphysics output]
-+ Lower Boundary Condition of Soil Temperature (opt_tbot): 2 [tbot at zbot (8m) read from a file (original Noah)]
-+ Snow/Soil Temperature Time Scheme (only layer 1) (opt_stc): 1 [semi-implicit; flux top boundary condition] 
-
-\section intra_noahmp Intraphysics Communication
- +  GFS NoahMP LSM Driver (\ref arg_table_noahmpdrv_run)
-\section gen_al_noahmp General Algorithm of Driver
-+ \ref general_noahmpdrv
-*/
diff --git a/physics/docs/pdftxt/RAP_suite.txt b/physics/docs/pdftxt/RAP_suite.txt
index 3b16315e7..425bf40ff 100644
--- a/physics/docs/pdftxt/RAP_suite.txt
+++ b/physics/docs/pdftxt/RAP_suite.txt
@@ -26,6 +26,6 @@ The RAP suite uses the parameterizations in the following order:
 \include suite_SCM_RAP.xml  
 
 \section RAP_nml_option Namelist
-\snippet RE210/SCM_RAP_input.nml GFS_PHYSICS_NML
+\snippet SCM_RAP_input.nml GFS_PHYSICS_NML
 
 */
diff --git a/physics/docs/pdftxt/RE300/FV3_GFS_v16_input.nml b/physics/docs/pdftxt/RE300/FV3_GFS_v16_input.nml
new file mode 100644
index 000000000..23ca37f9c
--- /dev/null
+++ b/physics/docs/pdftxt/RE300/FV3_GFS_v16_input.nml
@@ -0,0 +1,335 @@
+&amip_interp_nml
+    data_set = 'reynolds_oi'
+    date_out_of_range = 'climo'
+    interp_oi_sst = .true.
+    no_anom_sst = .false.
+    use_ncep_ice = .false.
+    use_ncep_sst = .true.
+/
+
+&atmos_model_nml
+    blocksize = 40
+    ccpp_suite = 'FV3_GFS_v16'
+    chksum_debug = .false.
+    dycore_only = .false.
+/
+
+&cires_ugwp_nml
+    knob_ugwp_azdir = 2, 4, 4, 4
+    knob_ugwp_doaxyz = 1
+    knob_ugwp_doheat = 1
+    knob_ugwp_dokdis = 1
+    knob_ugwp_effac = 1, 1, 1, 1
+    knob_ugwp_ndx4lh = 1
+    knob_ugwp_solver = 2
+    knob_ugwp_source = 1, 1, 0, 0
+    knob_ugwp_stoch = 0, 0, 0, 0
+    knob_ugwp_version = 0
+    knob_ugwp_wvspec = 1, 25, 25, 25
+    launch_level = 27
+/
+
+&diag_manager_nml
+    max_output_fields = 450
+    prepend_date = .false.
+/
+
+&external_ic_nml
+    checker_tr = .false.
+    filtered_terrain = .true.
+    gfs_dwinds = .true.
+    levp = 65
+    nt_checker = 0
+/
+
+&fms_io_nml
+    checksum_required = .false.
+    max_files_r = 100
+    max_files_w = 100
+/
+
+&fms_nml
+    clock_grain = 'ROUTINE'
+    domains_stack_size = 12000000
+    print_memory_usage = .false.
+/
+
+&fv_core_nml
+    a_imp = 1.0
+    adjust_dry_mass = .false.
+    agrid_vel_rst = .false.
+    bc_update_interval = 6
+    beta = 0.0
+    consv_am = .false.
+    consv_te = 0.0
+    d2_bg = 0.0
+    d2_bg_k1 = 0.2
+    d2_bg_k2 = 0.0
+    d4_bg = 0.12
+    d_con = 1.0
+    d_ext = 0.0
+    dddmp = 0.1
+    delt_max = 0.002
+    dnats = 1
+    do_sat_adj = .true.
+    do_schmidt = .true.
+    do_vort_damp = .true.
+    dwind_2d = .false.
+    dz_min = 6
+    external_eta = .true.
+    external_ic = .true.
+    fill = .true.
+    full_zs_filter = .false.
+    fv_debug = .false.
+    fv_sg_adj = 450
+    gfs_phil = .false.
+    hord_dp = -5
+    hord_mt = 5
+    hord_tm = 5
+    hord_tr = 10
+    hord_vt = 5
+    hydrostatic = .false.
+    io_layout = 1, 1
+    k_split = 6
+    ke_bg = 0.0
+    kord_mt = 9
+    kord_tm = -9
+    kord_tr = 9
+    kord_wz = 9
+    layout = 5, 2
+    make_nh = .false.
+    mountain = .false.
+    n_split = 6
+    n_sponge = 10
+    n_zs_filter = 0
+    na_init = 0
+    ncep_ic = .false.
+    nggps_ic = .true.
+    no_dycore = .false.
+    nord = 3
+    npx = 220
+    npy = 132
+    npz = 64
+    nrows_blend = 10
+    ntiles = 1
+    nudge_dz = .false.
+    nudge_qv = .true.
+    nwat = 6
+    p_fac = 0.1
+    phys_hydrostatic = .false.
+    print_freq = 6
+    psm_bc = 1
+    range_warn = .false.
+    read_increment = .false.
+    regional = .true.
+    regional_bcs_from_gsi = .false.
+    res_latlon_dynamics = ''
+    reset_eta = .false.
+    rf_cutoff = 750.0
+    stretch_fac = 0.999
+    target_lat = 38.5
+    target_lon = -97.5
+    tau = 10.0
+    use_hydro_pressure = .false.
+    vtdm4 = 0.02
+    warm_start = .false.
+    write_restart_with_bcs = .false.
+    z_tracer = .true.
+/
+
+&fv_grid_nml
+    grid_file = 'INPUT/grid_spec.nc'
+/
+
+!> [GFDL_CLOUD_MP_NML]
+&gfdl_cloud_microphysics_nml
+    c_cracw      = 0.8
+    c_paut       = 0.5
+    c_pgacs      = 0.01
+    c_psaci      = 0.05
+    ccn_l        = 300.0
+    ccn_o        = 100.0
+    const_vg     = .false.
+    const_vi     = .false.
+    const_vr     = .false.
+    const_vs     = .false.
+    de_ice       = .false.
+    do_qa        = .true.
+    do_sedi_heat = .false.
+    dw_land      = 0.16
+    dw_ocean     = 0.1
+    fast_sat_adj = .true.
+    fix_negative = .true.
+    icloud_f     = 1
+    mono_prof    = .true.
+    mp_time      = 150.0
+    prog_ccn     = .false.
+    qi0_crt      = 8e-05
+    qi_lim       = 1.0
+    ql_gen       = 0.001
+    ql_mlt       = 0.001
+    qs0_crt      = 0.001
+    rad_graupel  = .true.
+    rad_rain     = .true.
+    rad_snow     = .true.
+    reiflag      = 2
+    rh_inc       = 0.3
+    rh_inr       = 0.3
+    rh_ins       = 0.3
+    rthresh      = 1e-05
+    sedi_transport = .true.
+    tau_g2v      = 900.0
+    tau_i2s = 1000.0
+    tau_l2v = 225.0
+    tau_v2l = 150.0
+    use_ccn = .true.
+    use_ppm = .false.
+    vg_max = 12.0
+    vi_max = 1.0
+    vr_max = 12.0
+    vs_max = 2.0
+    z_slope_ice = .true.
+    z_slope_liq = .true.
+/
+!! [GFDL_CLOUD_MP_NML]
+
+
+!>[GFS_PHYSICS_NML]
+&gfs_physics_nml
+    cal_pre = .false.
+    cdmbgwd = 4.0, 0.15, 1.0, 1.0
+    cnvcld = .true.
+    cnvgwd = .true.
+    debug = .false.
+    do_tofd = .true.
+    do_ugwp = .false.
+    dspheat = .true.
+    effr_in = .true.
+    fhcyc = 0.0
+    fhlwr = 3600.0
+    fhswr = 3600.0
+    fhzero = 1.0
+    h2o_phys = .true.
+    hybedmf = .false.
+    iaer = 5111
+    ialb = 1
+    iau_inc_files = ''
+    icliq_sw = 2
+    ico2 = 2
+    iems = 1
+    imfdeepcnv = 2
+    imfshalcnv = 2
+    imp_physics = 11
+    iopt_alb = 2
+    iopt_btr = 1
+    iopt_crs = 1
+    iopt_dveg = 1
+    iopt_frz = 1
+    iopt_inf = 1
+    iopt_rad = 1
+    iopt_run = 1
+    iopt_sfc = 1
+    iopt_snf = 4
+    iopt_stc = 1
+    iopt_tbot = 2
+    iopt_trs = 2
+    iovr = 3
+    isatmedmf = 1
+    isol = 2
+    isot = 1
+    isubc_lw = 2
+    isubc_sw = 2
+    ivegsrc = 1
+    ldiag3d = .false.
+    ldiag_ugwp = .false.
+    lgfdlmprad = .true.
+    lheatstrg = .true.
+    lsm = 1
+    lsoil = 4
+    lwhtr = .true.
+    nsfullradar_diag = 3600
+    nst_anl = .true.
+    nstf_name = 2, 1, 0, 0, 0
+    oz_phys = .false.
+    oz_phys_2015 = .true.
+    pdfcld = .false.
+    prautco = 0.00015, 0.00015
+    pre_rad = .false.
+    print_diff_pgr = .false.
+    prslrd0 = 0.0
+    psautco = 0.0008, 0.0005
+    random_clds = .false.
+    redrag = .true.
+    satmedmf = .true.
+    sfclay_compute_flux = .false.
+    shal_cnv = .true.
+    swhtr = .true.
+    trans_trac = .true.
+    use_ufo = .true.
+/
+!! [GFS_PHYSICS_NML]
+
+&interpolator_nml
+    interp_method = 'conserve_great_circle'
+/
+
+&mpp_io_nml
+    deflate_level = 1
+    shuffle = 1
+/
+
+&nam_sfcperts
+/
+
+&nam_sppperts
+/
+
+&nam_stochy
+/
+
+&namsfc
+    fabsl = 99999
+    faisl = 99999
+    faiss = 99999
+    fnacna = ''
+    fnaisc = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/CFSR.SEAICE.1982.2012.monthly.clim.grb'
+    fnglac = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/global_glacier.2x2.grb'
+    fnmskh = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/seaice_newland.grb'
+    fnmxic = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/global_maxice.2x2.grb'
+    fnsmcc = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/global_soilmgldas.t126.384.190.grb'
+    fnsnoa = ''
+    fnsnoc = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/global_snoclim.1.875.grb'
+    fntsfa = ''
+    fntsfc = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/RTGSST.1982.2012.monthly.clim.grb'
+    fnzorc = 'igbp'
+    fsicl = 99999
+    fsics = 99999
+    fslpl = 99999
+    fsmcl = 99999, 99999, 99999
+    fsnol = 99999
+    fsnos = 99999
+    fsotl = 99999
+    ftsfl = 99999
+    ftsfs = 90
+    fvetl = 99999
+    fvmnl = 99999
+    fvmxl = 99999
+    landice = .true.
+    ldebug = .false.
+/
+
+&namsfc_dict
+    fnabsc = '../fix_lam/C403.maximum_snow_albedo.tileX.nc'
+    fnalbc = '../fix_lam/C403.snowfree_albedo.tileX.nc'
+    fnalbc2 = '../fix_lam/C403.facsf.tileX.nc'
+    fnslpc = '../fix_lam/C403.slope_type.tileX.nc'
+    fnsotc = '../fix_lam/C403.soil_type.tileX.nc'
+    fntg3c = '../fix_lam/C403.substrate_temperature.tileX.nc'
+    fnvegc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
+    fnvetc = '../fix_lam/C403.vegetation_type.tileX.nc'
+    fnvmnc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
+    fnvmxc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
+/
+
+&surf_map_nml
+/
diff --git a/physics/docs/pdftxt/RE300/FV3_HRRR_input.nml b/physics/docs/pdftxt/RE300/FV3_HRRR_input.nml
new file mode 100644
index 000000000..8a7d621f3
--- /dev/null
+++ b/physics/docs/pdftxt/RE300/FV3_HRRR_input.nml
@@ -0,0 +1,293 @@
+&amip_interp_nml
+    data_set = 'reynolds_oi'
+    date_out_of_range = 'climo'
+    interp_oi_sst = .true.
+    no_anom_sst = .false.
+    use_ncep_ice = .false.
+    use_ncep_sst = .true.
+/
+
+&atmos_model_nml
+    blocksize = 40
+    ccpp_suite = 'FV3_HRRR'
+    chksum_debug = .false.
+    dycore_only = .false.
+/
+
+&cires_ugwp_nml
+    knob_ugwp_azdir = 2, 4, 4, 4
+    knob_ugwp_doaxyz = 1
+    knob_ugwp_doheat = 1
+    knob_ugwp_dokdis = 1
+    knob_ugwp_effac = 1, 1, 1, 1
+    knob_ugwp_ndx4lh = 1
+    knob_ugwp_solver = 2
+    knob_ugwp_source = 1, 1, 0, 0
+    knob_ugwp_stoch = 0, 0, 0, 0
+    knob_ugwp_version = 0
+    knob_ugwp_wvspec = 1, 25, 25, 25
+    launch_level = 25
+/
+
+&diag_manager_nml
+    max_output_fields = 450
+    prepend_date = .false.
+/
+
+&external_ic_nml
+    checker_tr = .false.
+    filtered_terrain = .true.
+    gfs_dwinds = .true.
+    levp = 65
+    nt_checker = 0
+/
+
+&fms_io_nml
+    checksum_required = .false.
+    max_files_r = 100
+    max_files_w = 100
+/
+
+&fms_nml
+    clock_grain = 'ROUTINE'
+    domains_stack_size = 12000000
+    print_memory_usage = .false.
+/
+
+&fv_core_nml
+    a_imp = 1.0
+    adjust_dry_mass = .false.
+    bc_update_interval = 6
+    beta = 0.0
+    consv_am = .false.
+    consv_te = 0.0
+    d2_bg = 0.0
+    d2_bg_k1 = 0.2
+    d2_bg_k2 = 0.04
+    d4_bg = 0.12
+    d_con = 1.0
+    d_ext = 0.0
+    dddmp = 0.1
+    delt_max = 0.008
+    dnats = 0
+    do_sat_adj = .false.
+    do_schmidt = .true.
+    do_vort_damp = .true.
+    dwind_2d = .false.
+    dz_min = 2
+    external_eta = .true.
+    external_ic = .true.
+    fill = .true.
+    full_zs_filter = .false.
+    fv_debug = .false.
+    fv_sg_adj = 300
+    gfs_phil = .false.
+    hord_dp = -5
+    hord_mt = 5
+    hord_tm = 5
+    hord_tr = 10
+    hord_vt = 5
+    hydrostatic = .false.
+    io_layout = 1, 1
+    k_split = 2
+    ke_bg = 0.0
+    kord_mt = 9
+    kord_tm = -9
+    kord_tr = 9
+    kord_wz = 9
+    layout = 5, 2
+    make_nh = .true.
+    mountain = .false.
+    n_split = 5
+    n_sponge = 24
+    n_zs_filter = 0
+    na_init = 1
+    ncep_ic = .false.
+    nggps_ic = .true.
+    no_dycore = .false.
+    nord = 3
+    nord_tr = 2
+    npx = 220
+    npy = 132
+    npz = 64
+    nrows_blend = 10
+    ntiles = 1
+    nudge_qv = .false.
+    nwat = 6
+    p_fac = 0.1
+    phys_hydrostatic = .false.
+    print_freq = 6
+    psm_bc = 1
+    range_warn = .true.
+    read_increment = .false.
+    regional = .true.
+    regional_bcs_from_gsi = .false.
+    res_latlon_dynamics = 'fv3_increment.nc'
+    reset_eta = .false.
+    rf_cutoff = 2000.0
+    stretch_fac = 0.999
+    target_lat = 38.5
+    target_lon = -97.5
+    tau = 5.0
+    use_hydro_pressure = .false.
+    vtdm4 = 0.02
+    warm_start = .false.
+    write_restart_with_bcs = .false.
+    z_tracer = .true.
+/
+
+&fv_grid_nml
+    grid_file = 'INPUT/grid_spec.nc'
+/
+
+&gfs_physics_nml
+    bl_mynn_edmf = 1
+    bl_mynn_edmf_mom = 1
+    bl_mynn_tkeadvect = .true.
+    cal_pre = .false.
+    cdmbgwd = 3.5, 1.0
+    cnvcld = .false.
+    cnvgwd = .false.
+    cplflx = .false.
+    debug = .false.
+    do_deep = .false.
+    do_gsl_drag_ls_bl = .true.
+    do_gsl_drag_ss = .true.
+    do_gsl_drag_tofd = .true.
+    do_mynnedmf = .true.
+    do_mynnsfclay = .true.
+    dspheat = .true.
+    effr_in = .true.
+    fhcyc = 0.0
+    fhlwr = 1200.0
+    fhswr = 1200.0
+    fhzero = 1.0
+    gwd_opt = 3
+    h2o_phys = .true.
+    hybedmf = .false.
+    iaer = 5111
+    ialb = 1
+    iau_delthrs = 6
+    iau_inc_files = ''
+    iaufhrs = 30
+    icliq_sw = 2
+    icloud_bl = 1
+    ico2 = 2
+    iems = 1
+    imfdeepcnv = -1
+    imfshalcnv = -1
+    imp_physics = 8
+    iopt_alb = 2
+    iopt_btr = 1
+    iopt_crs = 1
+    iopt_dveg = 2
+    iopt_frz = 1
+    iopt_inf = 1
+    iopt_rad = 1
+    iopt_run = 1
+    iopt_sfc = 1
+    iopt_snf = 4
+    iopt_stc = 1
+    iopt_tbot = 2
+    iopt_trs = 2
+    iovr = 3
+    isol = 2
+    isot = 1
+    isubc_lw = 2
+    isubc_sw = 2
+    ivegsrc = 1
+    kice = 9
+    ldiag3d = .false.
+    lheatstrg = .false.
+    lradar = .true.
+    lsm = 3
+    lsoil = 4
+    lsoil_lsm = 9
+    ltaerosol = .true.
+    lwhtr = .true.
+    nsfullradar_diag = 3600
+    nst_anl = .true.
+    nstf_name = 2, 1, 0, 0, 0
+    oz_phys = .false.
+    oz_phys_2015 = .true.
+    pdfcld = .false.
+    pre_rad = .false.
+    print_diff_pgr = .false.
+    prslrd0 = 0.0
+    random_clds = .false.
+    redrag = .true.
+    satmedmf = .false.
+    sfclay_compute_flux = .true.
+    shal_cnv = .false.
+    swhtr = .true.
+    trans_trac = .true.
+    ttendlim = -999
+    use_ufo = .true.
+/
+
+&interpolator_nml
+    interp_method = 'conserve_great_circle'
+/
+
+&nam_sfcperts
+/
+
+&nam_sppperts
+/
+
+&nam_stochy
+/
+
+&namsfc
+    fabsl = 99999
+    faisl = 99999
+    faiss = 99999
+    fnacna = ''
+    fnaisc = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/CFSR.SEAICE.1982.2012.monthly.clim.grb'
+    fnglac = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/global_glacier.2x2.grb'
+    fnmskh = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/seaice_newland.grb'
+    fnmxic = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/global_maxice.2x2.grb'
+    fnsmcc = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/global_soilmgldas.t126.384.190.grb'
+    fnsnoa = ''
+    fnsnoc = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/global_snoclim.1.875.grb'
+    fntsfa = ''
+    fntsfc = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/RTGSST.1982.2012.monthly.clim.grb'
+    fnzorc = 'igbp'
+    fsicl = 99999
+    fsics = 99999
+    fslpl = 99999
+    fsmcl = 99999, 99999, 99999
+    fsnol = 99999
+    fsnos = 99999
+    fsotl = 99999
+    ftsfl = 99999
+    ftsfs = 90
+    fvetl = 99999
+    fvmnl = 99999
+    fvmxl = 99999
+    ldebug = .true.
+/
+
+&namsfc_dict
+    fnabsc = '../fix_lam/C403.maximum_snow_albedo.tileX.nc'
+    fnalbc = '../fix_lam/C403.snowfree_albedo.tileX.nc'
+    fnalbc2 = '../fix_lam/C403.facsf.tileX.nc'
+    fnslpc = '../fix_lam/C403.slope_type.tileX.nc'
+    fnsotc = '../fix_lam/C403.soil_type.tileX.nc'
+    fntg3c = '../fix_lam/C403.substrate_temperature.tileX.nc'
+    fnvegc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
+    fnvetc = '../fix_lam/C403.vegetation_type.tileX.nc'
+    fnvmnc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
+    fnvmxc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
+/
+
+&surf_map_nml
+    cd2 = -1
+    cd4 = 0.12
+    max_slope = 0.4
+    n_del2_strong = 0
+    n_del2_weak = 2
+    n_del4 = 1
+    peak_fac = 1.0
+    zero_ocean = .false.
+/
diff --git a/physics/docs/pdftxt/RE300/FV3_RAP_input.nml b/physics/docs/pdftxt/RE300/FV3_RAP_input.nml
new file mode 100644
index 000000000..ef3f44fc5
--- /dev/null
+++ b/physics/docs/pdftxt/RE300/FV3_RAP_input.nml
@@ -0,0 +1,300 @@
+&amip_interp_nml
+    data_set = 'reynolds_oi'
+    date_out_of_range = 'climo'
+    interp_oi_sst = .true.
+    no_anom_sst = .false.
+    use_ncep_ice = .false.
+    use_ncep_sst = .true.
+/
+
+&atmos_model_nml
+    blocksize = 40
+    ccpp_suite = 'FV3_RAP'
+    chksum_debug = .false.
+    dycore_only = .false.
+/
+
+&cires_ugwp_nml
+    knob_ugwp_azdir = 2, 4, 4, 4
+    knob_ugwp_doaxyz = 1
+    knob_ugwp_doheat = 1
+    knob_ugwp_dokdis = 1
+    knob_ugwp_effac = 1, 1, 1, 1
+    knob_ugwp_ndx4lh = 1
+    knob_ugwp_solver = 2
+    knob_ugwp_source = 1, 1, 0, 0
+    knob_ugwp_stoch = 0, 0, 0, 0
+    knob_ugwp_version = 0
+    knob_ugwp_wvspec = 1, 25, 25, 25
+    launch_level = 25
+/
+
+&diag_manager_nml
+    max_output_fields = 450
+    prepend_date = .false.
+/
+
+&external_ic_nml
+    checker_tr = .false.
+    filtered_terrain = .true.
+    gfs_dwinds = .true.
+    levp = 65
+    nt_checker = 0
+/
+
+&fms_io_nml
+    checksum_required = .false.
+    max_files_r = 100
+    max_files_w = 100
+/
+
+&fms_nml
+    clock_grain = 'ROUTINE'
+    domains_stack_size = 12000000
+    print_memory_usage = .false.
+/
+
+&fv_core_nml
+    a_imp = 1.0
+    adjust_dry_mass = .false.
+    bc_update_interval = 6
+    beta = 0.0
+    consv_am = .false.
+    consv_te = 0.0
+    d2_bg = 0.0
+    d2_bg_k1 = 0.2
+    d2_bg_k2 = 0.04
+    d4_bg = 0.12
+    d_con = 1.0
+    d_ext = 0.0
+    dddmp = 0.1
+    delt_max = 0.008
+    dnats = 0
+    do_sat_adj = .false.
+    do_schmidt = .true.
+    do_vort_damp = .true.
+    dwind_2d = .false.
+    dz_min = 2
+    external_eta = .true.
+    external_ic = .true.
+    fill = .true.
+    full_zs_filter = .false.
+    fv_debug = .false.
+    fv_sg_adj = 300
+    gfs_phil = .false.
+    hord_dp = -5
+    hord_mt = 5
+    hord_tm = 5
+    hord_tr = 10
+    hord_vt = 5
+    hydrostatic = .false.
+    io_layout = 1, 1
+    k_split = 2
+    ke_bg = 0.0
+    kord_mt = 9
+    kord_tm = -9
+    kord_tr = 9
+    kord_wz = 9
+    layout = 5, 2
+    make_nh = .true.
+    mountain = .false.
+    n_split = 5
+    n_sponge = 24
+    n_zs_filter = 0
+    na_init = 1
+    ncep_ic = .false.
+    nggps_ic = .true.
+    no_dycore = .false.
+    nord = 3
+    nord_tr = 2
+    npx = 220
+    npy = 132
+    npz = 64
+    nrows_blend = 10
+    ntiles = 1
+    nudge_qv = .false.
+    nwat = 6
+    p_fac = 0.1
+    phys_hydrostatic = .false.
+    print_freq = 6
+    psm_bc = 1
+    range_warn = .true.
+    read_increment = .false.
+    regional = .true.
+    regional_bcs_from_gsi = .false.
+    res_latlon_dynamics = 'fv3_increment.nc'
+    reset_eta = .false.
+    rf_cutoff = 2000.0
+    stretch_fac = 0.999
+    target_lat = 38.5
+    target_lon = -97.5
+    tau = 5.0
+    use_hydro_pressure = .false.
+    vtdm4 = 0.02
+    warm_start = .false.
+    write_restart_with_bcs = .false.
+    z_tracer = .true.
+/
+
+&fv_grid_nml
+    grid_file = 'INPUT/grid_spec.nc'
+/
+
+&gfs_physics_nml
+    bl_mynn_edmf = 1
+    bl_mynn_edmf_mom = 1
+    bl_mynn_tkeadvect = .true.
+    cal_pre = .false.
+    cdmbgwd = 3.5, 1.0
+    cnvcld = .false.
+    cnvgwd = .false.
+    cplflx = .false.
+    debug = .false.
+    do_deep = .true.
+    do_gsl_drag_ls_bl = .true.
+    do_gsl_drag_ss = .true.
+    do_gsl_drag_tofd = .true.
+    do_mynnedmf = .true.
+    do_mynnsfclay = .true.
+    do_shum = .false.
+    do_skeb = .false.
+    do_spp = .false.
+    do_sppt = .false.
+    dspheat = .true.
+    effr_in = .true.
+    fhcyc = 0
+    fhlwr = 1200.0
+    fhswr = 1200.0
+    fhzero = 1.0
+    gwd_opt = 3
+    h2o_phys = .true.
+    hybedmf = .false.
+    iaer = 5111
+    ialb = 1
+    iau_delthrs = 6
+    iau_inc_files = ''
+    iaufhrs = 30
+    icliq_sw = 2
+    icloud_bl = 1
+    ico2 = 2
+    iems = 1
+    imfdeepcnv = 3
+    imfshalcnv = 3
+    imp_physics = 8
+    iopt_alb = 2
+    iopt_btr = 1
+    iopt_crs = 1
+    iopt_dveg = 2
+    iopt_frz = 1
+    iopt_inf = 1
+    iopt_rad = 1
+    iopt_run = 1
+    iopt_sfc = 1
+    iopt_snf = 4
+    iopt_stc = 1
+    iopt_tbot = 2
+    iopt_trs = 2
+    iovr = 3
+    isol = 2
+    isot = 1
+    isubc_lw = 2
+    isubc_sw = 2
+    ivegsrc = 1
+    kice = 9
+    ldiag3d = .false.
+    lheatstrg = .false.
+    lndp_type = 0
+    lradar = .true.
+    lsm = 3
+    lsoil = 4
+    lsoil_lsm = 9
+    ltaerosol = .true.
+    lwhtr = .true.
+    n_var_lndp = 0
+    n_var_spp = 0
+    nsfullradar_diag = 3600
+    nst_anl = .true.
+    nstf_name = 2, 1, 0, 0, 0
+    oz_phys = .false.
+    oz_phys_2015 = .true.
+    pdfcld = .false.
+    pre_rad = .false.
+    print_diff_pgr = .false.
+    prslrd0 = 0.0
+    random_clds = .false.
+    redrag = .true.
+    satmedmf = .false.
+    sfclay_compute_flux = .false.
+    shal_cnv = .true.
+    swhtr = .true.
+    trans_trac = .true.
+    ttendlim = -999
+    use_ufo = .true.
+/
+
+&interpolator_nml
+    interp_method = 'conserve_great_circle'
+/
+
+&nam_sfcperts
+/
+
+&nam_sppperts
+/
+
+&nam_stochy
+/
+
+&namsfc
+    fabsl = 99999
+    faisl = 99999
+    faiss = 99999
+    fnacna = ''
+    fnaisc = '../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/CFSR.SEAICE.1982.2012.monthly.clim.grb'
+    fnglac = '../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/global_glacier.2x2.grb'
+    fnmskh = '../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/seaice_newland.grb'
+    fnmxic = '../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/global_maxice.2x2.grb'
+    fnsmcc = '../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/global_soilmgldas.t126.384.190.grb'
+    fnsnoa = ''
+    fnsnoc = '../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/global_snoclim.1.875.grb'
+    fntsfa = ''
+    fntsfc = '../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/RTGSST.1982.2012.monthly.clim.grb'
+    fnzorc = 'igbp'
+    fsicl = 99999
+    fsics = 99999
+    fslpl = 99999
+    fsmcl = 99999, 99999, 99999
+    fsnol = 99999
+    fsnos = 99999
+    fsotl = 99999
+    ftsfl = 99999
+    ftsfs = 90
+    fvetl = 99999
+    fvmnl = 99999
+    fvmxl = 99999
+    ldebug = .true.
+/
+
+&namsfc_dict
+    fnabsc = '../fix_lam/C403.maximum_snow_albedo.tileX.nc'
+    fnalbc = '../fix_lam/C403.snowfree_albedo.tileX.nc'
+    fnalbc2 = '../fix_lam/C403.facsf.tileX.nc'
+    fnslpc = '../fix_lam/C403.slope_type.tileX.nc'
+    fnsotc = '../fix_lam/C403.soil_type.tileX.nc'
+    fntg3c = '../fix_lam/C403.substrate_temperature.tileX.nc'
+    fnvegc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
+    fnvetc = '../fix_lam/C403.vegetation_type.tileX.nc'
+    fnvmnc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
+    fnvmxc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
+/
+
+&surf_map_nml
+    cd2 = -1
+    cd4 = 0.12
+    max_slope = 0.4
+    n_del2_strong = 0
+    n_del2_weak = 2
+    n_del4 = 1
+    peak_fac = 1.0
+    zero_ocean = .false.
+/
diff --git a/physics/docs/pdftxt/RE300/FV3_RRFS_v1beta_input.nml b/physics/docs/pdftxt/RE300/FV3_RRFS_v1beta_input.nml
new file mode 100644
index 000000000..97a0f1216
--- /dev/null
+++ b/physics/docs/pdftxt/RE300/FV3_RRFS_v1beta_input.nml
@@ -0,0 +1,285 @@
+&amip_interp_nml
+    data_set = 'reynolds_oi'
+    date_out_of_range = 'climo'
+    interp_oi_sst = .true.
+    no_anom_sst = .false.
+    use_ncep_ice = .false.
+    use_ncep_sst = .true.
+/
+
+&atmos_model_nml
+    blocksize = 40
+    ccpp_suite = 'FV3_RRFS_v1beta'
+    chksum_debug = .false.
+    dycore_only = .false.
+/
+
+&cires_ugwp_nml
+    knob_ugwp_azdir = 2, 4, 4, 4
+    knob_ugwp_doaxyz = 1
+    knob_ugwp_doheat = 1
+    knob_ugwp_dokdis = 1
+    knob_ugwp_effac = 1, 1, 1, 1
+    knob_ugwp_ndx4lh = 1
+    knob_ugwp_solver = 2
+    knob_ugwp_source = 1, 1, 0, 0
+    knob_ugwp_stoch = 0, 0, 0, 0
+    knob_ugwp_version = 0
+    knob_ugwp_wvspec = 1, 25, 25, 25
+    launch_level = 25
+/
+
+&diag_manager_nml
+    max_output_fields = 450
+    prepend_date = .false.
+/
+
+&external_ic_nml
+    checker_tr = .false.
+    filtered_terrain = .true.
+    gfs_dwinds = .true.
+    levp = 65
+    nt_checker = 0
+/
+
+&fms_io_nml
+    checksum_required = .false.
+    max_files_r = 100
+    max_files_w = 100
+/
+
+&fms_nml
+    clock_grain = 'ROUTINE'
+    domains_stack_size = 12000000
+    print_memory_usage = .false.
+/
+
+&fv_core_nml
+    a_imp = 1.0
+    adjust_dry_mass = .false.
+    bc_update_interval = 6
+    beta = 0.0
+    consv_am = .false.
+    consv_te = 0.0
+    d2_bg = 0.0
+    d2_bg_k1 = 0.2
+    d2_bg_k2 = 0.04
+    d4_bg = 0.12
+    d_con = 1.0
+    d_ext = 0.0
+    dddmp = 0.1
+    delt_max = 0.008
+    dnats = 0
+    do_sat_adj = .false.
+    do_schmidt = .true.
+    do_vort_damp = .true.
+    dwind_2d = .false.
+    dz_min = 2
+    external_eta = .true.
+    external_ic = .true.
+    fill = .true.
+    full_zs_filter = .false.
+    fv_debug = .false.
+    fv_sg_adj = 300
+    gfs_phil = .false.
+    hord_dp = 6
+    hord_mt = 6
+    hord_tm = 6
+    hord_tr = 10
+    hord_vt = 6
+    hydrostatic = .false.
+    io_layout = 1, 1
+    k_split = 2
+    ke_bg = 0.0
+    kord_mt = 9
+    kord_tm = -9
+    kord_tr = 9
+    kord_wz = 9
+    layout = 5, 2
+    make_nh = .true.
+    mountain = .false.
+    n_split = 5
+    n_sponge = 24
+    n_zs_filter = 0
+    na_init = 1
+    ncep_ic = .false.
+    nggps_ic = .true.
+    no_dycore = .false.
+    nord = 3
+    npx = 220
+    npy = 132
+    npz = 64
+    nrows_blend = 10
+    ntiles = 1
+    nudge_qv = .false.
+    nwat = 6
+    p_fac = 0.1
+    phys_hydrostatic = .false.
+    print_freq = 6
+    psm_bc = 1
+    range_warn = .true.
+    read_increment = .false.
+    regional = .true.
+    regional_bcs_from_gsi = .false.
+    res_latlon_dynamics = 'fv3_increment.nc'
+    reset_eta = .false.
+    rf_cutoff = 2000.0
+    stretch_fac = 0.999
+    target_lat = 38.5
+    target_lon = -97.5
+    tau = 5.0
+    use_hydro_pressure = .false.
+    vtdm4 = 0.02
+    warm_start = .false.
+    write_restart_with_bcs = .false.
+    z_tracer = .true.
+/
+
+&fv_grid_nml
+    grid_file = 'INPUT/grid_spec.nc'
+/
+
+&gfs_physics_nml
+    bl_mynn_edmf = 1
+    bl_mynn_edmf_mom = 1
+    bl_mynn_tkeadvect = .true.
+    cal_pre = .false.
+    cdmbgwd = 3.5, 0.25
+    cnvcld = .false.
+    cnvgwd = .false.
+    cplflx = .false.
+    debug = .false.
+    do_deep = .false.
+    do_mynnedmf = .true.
+    do_mynnsfclay = .true.
+    dspheat = .true.
+    effr_in = .true.
+    fhcyc = 0.0
+    fhlwr = 1200.0
+    fhswr = 1200.0
+    fhzero = 1.0
+    h2o_phys = .true.
+    hybedmf = .false.
+    iaer = 111
+    ialb = 1
+    iau_delthrs = 6
+    iau_inc_files = ''
+    iaufhrs = 30
+    icloud_bl = 1
+    ico2 = 2
+    iems = 1
+    imfdeepcnv = -1
+    imfshalcnv = -1
+    imp_physics = 8
+    iopt_alb = 2
+    iopt_btr = 1
+    iopt_crs = 1
+    iopt_dveg = 2
+    iopt_frz = 1
+    iopt_inf = 1
+    iopt_rad = 1
+    iopt_run = 1
+    iopt_sfc = 1
+    iopt_snf = 4
+    iopt_stc = 1
+    iopt_tbot = 2
+    iopt_trs = 2
+    isol = 2
+    isot = 1
+    isubc_lw = 2
+    isubc_sw = 2
+    ivegsrc = 1
+    ldiag3d = .false.
+    lheatstrg = .false.
+    lradar = .true.
+    lsm = 2
+    lsoil = 4
+    lsoil_lsm = 4
+    ltaerosol = .true.
+    lwhtr = .true.
+    nsfullradar_diag = 3600
+    nst_anl = .true.
+    nstf_name = 2, 1, 0, 0, 0
+    oz_phys = .false.
+    oz_phys_2015 = .true.
+    pdfcld = .false.
+    pre_rad = .false.
+    print_diff_pgr = .false.
+    prslrd0 = 0.0
+    random_clds = .false.
+    redrag = .true.
+    satmedmf = .false.
+    sfclay_compute_flux = .false.
+    shal_cnv = .false.
+    swhtr = .true.
+    trans_trac = .true.
+    ttendlim = -999
+    use_ufo = .true.
+/
+
+&interpolator_nml
+    interp_method = 'conserve_great_circle'
+/
+
+&nam_sfcperts
+/
+
+&nam_sppperts
+/
+
+&nam_stochy
+/
+
+&namsfc
+    fabsl = 99999
+    faisl = 99999
+    faiss = 99999
+    fnacna = ''
+    fnaisc = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/CFSR.SEAICE.1982.2012.monthly.clim.grb'
+    fnglac = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/global_glacier.2x2.grb'
+    fnmskh = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/seaice_newland.grb'
+    fnmxic = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/global_maxice.2x2.grb'
+    fnsmcc = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/global_soilmgldas.t126.384.190.grb'
+    fnsnoa = ''
+    fnsnoc = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/global_snoclim.1.875.grb'
+    fntsfa = ''
+    fntsfc = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/RTGSST.1982.2012.monthly.clim.grb'
+    fnzorc = 'igbp'
+    fsicl = 99999
+    fsics = 99999
+    fslpl = 99999
+    fsmcl = 99999, 99999, 99999
+    fsnol = 99999
+    fsnos = 99999
+    fsotl = 99999
+    ftsfl = 99999
+    ftsfs = 90
+    fvetl = 99999
+    fvmnl = 99999
+    fvmxl = 99999
+    ldebug = .true.
+/
+
+&namsfc_dict
+    fnabsc = '../fix_lam/C403.maximum_snow_albedo.tileX.nc'
+    fnalbc = '../fix_lam/C403.snowfree_albedo.tileX.nc'
+    fnalbc2 = '../fix_lam/C403.facsf.tileX.nc'
+    fnslpc = '../fix_lam/C403.slope_type.tileX.nc'
+    fnsotc = '../fix_lam/C403.soil_type.tileX.nc'
+    fntg3c = '../fix_lam/C403.substrate_temperature.tileX.nc'
+    fnvegc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
+    fnvetc = '../fix_lam/C403.vegetation_type.tileX.nc'
+    fnvmnc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
+    fnvmxc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
+/
+
+&surf_map_nml
+    cd2 = -1
+    cd4 = 0.12
+    max_slope = 0.4
+    n_del2_strong = 0
+    n_del2_weak = 2
+    n_del4 = 1
+    peak_fac = 1.0
+    zero_ocean = .false.
+/
diff --git a/physics/docs/pdftxt/RE300/FV3_WoFS_v0_input.nml b/physics/docs/pdftxt/RE300/FV3_WoFS_v0_input.nml
new file mode 100644
index 000000000..1236cde3b
--- /dev/null
+++ b/physics/docs/pdftxt/RE300/FV3_WoFS_v0_input.nml
@@ -0,0 +1,291 @@
+&amip_interp_nml
+    data_set = 'reynolds_oi'
+    date_out_of_range = 'climo'
+    interp_oi_sst = .true.
+    no_anom_sst = .false.
+    use_ncep_ice = .false.
+    use_ncep_sst = .true.
+/
+
+&atmos_model_nml
+    blocksize = 40
+    ccpp_suite = 'FV3_WoFS_v0'
+    chksum_debug = .false.
+    dycore_only = .false.
+/
+
+&cires_ugwp_nml
+    knob_ugwp_azdir = 2, 4, 4, 4
+    knob_ugwp_doaxyz = 1
+    knob_ugwp_doheat = 1
+    knob_ugwp_dokdis = 1
+    knob_ugwp_effac = 1, 1, 1, 1
+    knob_ugwp_ndx4lh = 1
+    knob_ugwp_solver = 2
+    knob_ugwp_source = 1, 1, 0, 0
+    knob_ugwp_stoch = 0, 0, 0, 0
+    knob_ugwp_version = 0
+    knob_ugwp_wvspec = 1, 25, 25, 25
+    launch_level = 25
+/
+
+&diag_manager_nml
+    max_output_fields = 450
+    prepend_date = .false.
+/
+
+&external_ic_nml
+    checker_tr = .false.
+    filtered_terrain = .true.
+    gfs_dwinds = .true.
+    levp = 65
+    nt_checker = 0
+/
+
+&fms_io_nml
+    checksum_required = .false.
+    max_files_r = 100
+    max_files_w = 100
+/
+
+&fms_nml
+    clock_grain = 'ROUTINE'
+    domains_stack_size = 12000000
+    print_memory_usage = .false.
+/
+
+&fv_core_nml
+    a_imp = 1.0
+    adjust_dry_mass = .false.
+    bc_update_interval = 6
+    beta = 0.0
+    consv_am = .false.
+    consv_te = 0.0
+    d2_bg = 0.0
+    d2_bg_k1 = 0.2
+    d2_bg_k2 = 0.04
+    d4_bg = 0.12
+    d_con = 1.0
+    d_ext = 0.0
+    dddmp = 0.1
+    delt_max = 0.008
+    dnats = 0
+    do_sat_adj = .false.
+    do_schmidt = .true.
+    do_vort_damp = .true.
+    dwind_2d = .false.
+    dz_min = 2
+    external_eta = .true.
+    external_ic = .true.
+    fill = .true.
+    full_zs_filter = .false.
+    fv_debug = .false.
+    fv_sg_adj = 300
+    gfs_phil = .false.
+    hord_dp = 6
+    hord_mt = 6
+    hord_tm = 6
+    hord_tr = 10
+    hord_vt = 6
+    hydrostatic = .false.
+    io_layout = 1, 1
+    k_split = 2
+    ke_bg = 0.0
+    kord_mt = 9
+    kord_tm = -9
+    kord_tr = 9
+    kord_wz = 9
+    layout = 5, 2
+    make_nh = .true.
+    mountain = .false.
+    n_split = 5
+    n_sponge = 24
+    n_zs_filter = 0
+    na_init = 1
+    ncep_ic = .false.
+    nggps_ic = .true.
+    no_dycore = .false.
+    nord = 3
+    npx = 220
+    npy = 132
+    npz = 64
+    nrows_blend = 10
+    ntiles = 1
+    nudge_qv = .false.
+    nwat = 7
+    p_fac = 0.1
+    phys_hydrostatic = .false.
+    print_freq = 6
+    psm_bc = 1
+    range_warn = .true.
+    read_increment = .false.
+    regional = .true.
+    regional_bcs_from_gsi = .false.
+    res_latlon_dynamics = 'fv3_increment.nc'
+    reset_eta = .false.
+    rf_cutoff = 2000.0
+    stretch_fac = 0.999
+    target_lat = 38.5
+    target_lon = -97.5
+    tau = 5.0
+    use_hydro_pressure = .false.
+    vtdm4 = 0.02
+    warm_start = .false.
+    write_restart_with_bcs = .false.
+    z_tracer = .true.
+/
+
+&fv_diagnostics_nml
+    do_hailcast = .true.
+/
+
+&fv_grid_nml
+    grid_file = 'INPUT/grid_spec.nc'
+/
+
+&gfs_physics_nml
+    bl_mynn_edmf = 1
+    bl_mynn_edmf_mom = 1
+    bl_mynn_tkeadvect = .true.
+    cal_pre = .false.
+    cdmbgwd = 3.5, 0.25
+    cnvcld = .false.
+    cnvgwd = .false.
+    cplflx = .false.
+    debug = .false.
+    do_deep = .false.
+    do_mynnedmf = .true.
+    do_mynnsfclay = .true.
+    dspheat = .true.
+    effr_in = .true.
+    fhcyc = 0.0
+    fhlwr = 1200.0
+    fhswr = 1200.0
+    fhzero = 1.0
+    h2o_phys = .true.
+    hybedmf = .false.
+    iaer = 111
+    ialb = 1
+    iau_delthrs = 6
+    iau_inc_files = ''
+    iaufhrs = 30
+    icloud_bl = 1
+    ico2 = 2
+    iems = 1
+    imfdeepcnv = -1
+    imfshalcnv = -1
+    imp_physics = 17
+    iopt_alb = 2
+    iopt_btr = 1
+    iopt_crs = 1
+    iopt_dveg = 2
+    iopt_frz = 1
+    iopt_inf = 1
+    iopt_rad = 1
+    iopt_run = 1
+    iopt_sfc = 1
+    iopt_snf = 4
+    iopt_stc = 1
+    iopt_tbot = 2
+    isol = 2
+    isot = 1
+    isubc_lw = 2
+    isubc_sw = 2
+    ivegsrc = 1
+    ldiag3d = .false.
+    lheatstrg = .false.
+    lradar = .true.
+    lsm = 1
+    lsoil = 4
+    lsoil_lsm = 4
+    ltaerosol = .true.
+    lwhtr = .true.
+    nsfullradar_diag = 3600
+    nssl_cccn = 600000000.0
+    nssl_ccn_on = .true.
+    nssl_hail_on = .true.
+    nst_anl = .true.
+    nstf_name = 2, 1, 0, 0, 0
+    oz_phys = .false.
+    oz_phys_2015 = .true.
+    pdfcld = .false.
+    pre_rad = .false.
+    print_diff_pgr = .false.
+    prslrd0 = 0.0
+    random_clds = .false.
+    redrag = .true.
+    satmedmf = .false.
+    sfclay_compute_flux = .false.
+    shal_cnv = .false.
+    swhtr = .true.
+    trans_trac = .true.
+    ttendlim = -999
+    use_ufo = .true.
+/
+
+&interpolator_nml
+    interp_method = 'conserve_great_circle'
+/
+
+&nam_sfcperts
+/
+
+&nam_sppperts
+/
+
+&nam_stochy
+/
+
+&namsfc
+    fabsl = 99999
+    faisl = 99999
+    faiss = 99999
+    fnacna = ''
+    fnaisc = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/CFSR.SEAICE.1982.2012.monthly.clim.grb'
+    fnglac = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/global_glacier.2x2.grb'
+    fnmskh = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/seaice_newland.grb'
+    fnmxic = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/global_maxice.2x2.grb'
+    fnsmcc = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/global_soilmgldas.t126.384.190.grb'
+    fnsnoa = ''
+    fnsnoc = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/global_snoclim.1.875.grb'
+    fntsfa = ''
+    fntsfc = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/RTGSST.1982.2012.monthly.clim.grb'
+    fnzorc = 'igbp'
+    fsicl = 99999
+    fsics = 99999
+    fslpl = 99999
+    fsmcl = 99999, 99999, 99999
+    fsnol = 99999
+    fsnos = 99999
+    fsotl = 99999
+    ftsfl = 99999
+    ftsfs = 90
+    fvetl = 99999
+    fvmnl = 99999
+    fvmxl = 99999
+    ldebug = .true.
+/
+
+&namsfc_dict
+    fnabsc = '../fix_lam/C403.maximum_snow_albedo.tileX.nc'
+    fnalbc = '../fix_lam/C403.snowfree_albedo.tileX.nc'
+    fnalbc2 = '../fix_lam/C403.facsf.tileX.nc'
+    fnslpc = '../fix_lam/C403.slope_type.tileX.nc'
+    fnsotc = '../fix_lam/C403.soil_type.tileX.nc'
+    fntg3c = '../fix_lam/C403.substrate_temperature.tileX.nc'
+    fnvegc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
+    fnvetc = '../fix_lam/C403.vegetation_type.tileX.nc'
+    fnvmnc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
+    fnvmxc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
+/
+
+&surf_map_nml
+    cd2 = -1
+    cd4 = 0.12
+    max_slope = 0.4
+    n_del2_strong = 0
+    n_del2_weak = 2
+    n_del4 = 1
+    peak_fac = 1.0
+    zero_ocean = .false.
+/
diff --git a/physics/docs/pdftxt/RE300/namelists/input.nml.develop.FV3_GFS_v16 b/physics/docs/pdftxt/RE300/namelists/input.nml.develop.FV3_GFS_v16
new file mode 100644
index 000000000..6dac0ecaf
--- /dev/null
+++ b/physics/docs/pdftxt/RE300/namelists/input.nml.develop.FV3_GFS_v16
@@ -0,0 +1,330 @@
+&amip_interp_nml
+    data_set = 'reynolds_oi'
+    date_out_of_range = 'climo'
+    interp_oi_sst = .true.
+    no_anom_sst = .false.
+    use_ncep_ice = .false.
+    use_ncep_sst = .true.
+/
+
+&atmos_model_nml
+    blocksize = 40
+    ccpp_suite = 'FV3_GFS_v16'
+    chksum_debug = .false.
+    dycore_only = .false.
+/
+
+&cires_ugwp_nml
+    knob_ugwp_azdir = 2, 4, 4, 4
+    knob_ugwp_doaxyz = 1
+    knob_ugwp_doheat = 1
+    knob_ugwp_dokdis = 1
+    knob_ugwp_effac = 1, 1, 1, 1
+    knob_ugwp_ndx4lh = 1
+    knob_ugwp_solver = 2
+    knob_ugwp_source = 1, 1, 0, 0
+    knob_ugwp_stoch = 0, 0, 0, 0
+    knob_ugwp_version = 0
+    knob_ugwp_wvspec = 1, 25, 25, 25
+    launch_level = 27
+/
+
+&diag_manager_nml
+    max_output_fields = 450
+    prepend_date = .false.
+/
+
+&external_ic_nml
+    checker_tr = .false.
+    filtered_terrain = .true.
+    gfs_dwinds = .true.
+    levp = 65
+    nt_checker = 0
+/
+
+&fms_io_nml
+    checksum_required = .false.
+    max_files_r = 100
+    max_files_w = 100
+/
+
+&fms_nml
+    clock_grain = 'ROUTINE'
+    domains_stack_size = 12000000
+    print_memory_usage = .false.
+/
+
+&fv_core_nml
+    a_imp = 1.0
+    adjust_dry_mass = .false.
+    agrid_vel_rst = .false.
+    bc_update_interval = 6
+    beta = 0.0
+    consv_am = .false.
+    consv_te = 0.0
+    d2_bg = 0.0
+    d2_bg_k1 = 0.2
+    d2_bg_k2 = 0.0
+    d4_bg = 0.12
+    d_con = 1.0
+    d_ext = 0.0
+    dddmp = 0.1
+    delt_max = 0.002
+    dnats = 1
+    do_sat_adj = .true.
+    do_schmidt = .true.
+    do_vort_damp = .true.
+    dwind_2d = .false.
+    dz_min = 6
+    external_eta = .true.
+    external_ic = .true.
+    fill = .true.
+    full_zs_filter = .false.
+    fv_debug = .false.
+    fv_sg_adj = 450
+    gfs_phil = .false.
+    hord_dp = -5
+    hord_mt = 5
+    hord_tm = 5
+    hord_tr = 10
+    hord_vt = 5
+    hydrostatic = .false.
+    io_layout = 1, 1
+    k_split = 6
+    ke_bg = 0.0
+    kord_mt = 9
+    kord_tm = -9
+    kord_tr = 9
+    kord_wz = 9
+    layout = 5, 2
+    make_nh = .false.
+    mountain = .false.
+    n_split = 6
+    n_sponge = 10
+    n_zs_filter = 0
+    na_init = 0
+    ncep_ic = .false.
+    nggps_ic = .true.
+    no_dycore = .false.
+    nord = 3
+    npx = 220
+    npy = 132
+    npz = 64
+    nrows_blend = 10
+    ntiles = 1
+    nudge_dz = .false.
+    nudge_qv = .true.
+    nwat = 6
+    p_fac = 0.1
+    phys_hydrostatic = .false.
+    print_freq = 6
+    psm_bc = 1
+    range_warn = .false.
+    read_increment = .false.
+    regional = .true.
+    regional_bcs_from_gsi = .false.
+    res_latlon_dynamics = ''
+    reset_eta = .false.
+    rf_cutoff = 750.0
+    stretch_fac = 0.999
+    target_lat = 38.5
+    target_lon = -97.5
+    tau = 10.0
+    use_hydro_pressure = .false.
+    vtdm4 = 0.02
+    warm_start = .false.
+    write_restart_with_bcs = .false.
+    z_tracer = .true.
+/
+
+&fv_grid_nml
+    grid_file = 'INPUT/grid_spec.nc'
+/
+
+&gfdl_cloud_microphysics_nml
+    c_cracw = 0.8
+    c_paut = 0.5
+    c_pgacs = 0.01
+    c_psaci = 0.05
+    ccn_l = 300.0
+    ccn_o = 100.0
+    const_vg = .false.
+    const_vi = .false.
+    const_vr = .false.
+    const_vs = .false.
+    de_ice = .false.
+    do_qa = .true.
+    do_sedi_heat = .false.
+    dw_land = 0.16
+    dw_ocean = 0.1
+    fast_sat_adj = .true.
+    fix_negative = .true.
+    icloud_f = 1
+    mono_prof = .true.
+    mp_time = 150.0
+    prog_ccn = .false.
+    qi0_crt = 8e-05
+    qi_lim = 1.0
+    ql_gen = 0.001
+    ql_mlt = 0.001
+    qs0_crt = 0.001
+    rad_graupel = .true.
+    rad_rain = .true.
+    rad_snow = .true.
+    reiflag = 2
+    rh_inc = 0.3
+    rh_inr = 0.3
+    rh_ins = 0.3
+    rthresh = 1e-05
+    sedi_transport = .true.
+    tau_g2v = 900.0
+    tau_i2s = 1000.0
+    tau_l2v = 225.0
+    tau_v2l = 150.0
+    use_ccn = .true.
+    use_ppm = .false.
+    vg_max = 12.0
+    vi_max = 1.0
+    vr_max = 12.0
+    vs_max = 2.0
+    z_slope_ice = .true.
+    z_slope_liq = .true.
+/
+
+&gfs_physics_nml
+    cal_pre = .false.
+    cdmbgwd = 4.0, 0.15, 1.0, 1.0
+    cnvcld = .true.
+    cnvgwd = .true.
+    debug = .false.
+    do_tofd = .true.
+    do_ugwp = .false.
+    dspheat = .true.
+    effr_in = .true.
+    fhcyc = 0.0
+    fhlwr = 3600.0
+    fhswr = 3600.0
+    fhzero = 1.0
+    h2o_phys = .true.
+    hybedmf = .false.
+    iaer = 5111
+    ialb = 1
+    iau_inc_files = ''
+    icliq_sw = 2
+    ico2 = 2
+    iems = 1
+    imfdeepcnv = 2
+    imfshalcnv = 2
+    imp_physics = 11
+    iopt_alb = 2
+    iopt_btr = 1
+    iopt_crs = 1
+    iopt_dveg = 1
+    iopt_frz = 1
+    iopt_inf = 1
+    iopt_rad = 1
+    iopt_run = 1
+    iopt_sfc = 1
+    iopt_snf = 4
+    iopt_stc = 1
+    iopt_tbot = 2
+    iopt_trs = 2
+    iovr = 3
+    isatmedmf = 1
+    isol = 2
+    isot = 1
+    isubc_lw = 2
+    isubc_sw = 2
+    ivegsrc = 1
+    ldiag3d = .false.
+    ldiag_ugwp = .false.
+    lgfdlmprad = .true.
+    lheatstrg = .true.
+    lsm = 1
+    lsoil = 4
+    lwhtr = .true.
+    nsfullradar_diag = 3600
+    nst_anl = .true.
+    nstf_name = 2, 1, 0, 0, 0
+    oz_phys = .false.
+    oz_phys_2015 = .true.
+    pdfcld = .false.
+    prautco = 0.00015, 0.00015
+    pre_rad = .false.
+    print_diff_pgr = .false.
+    prslrd0 = 0.0
+    psautco = 0.0008, 0.0005
+    random_clds = .false.
+    redrag = .true.
+    satmedmf = .true.
+    sfclay_compute_flux = .false.
+    shal_cnv = .true.
+    swhtr = .true.
+    trans_trac = .true.
+    use_ufo = .true.
+/
+
+&interpolator_nml
+    interp_method = 'conserve_great_circle'
+/
+
+&mpp_io_nml
+    deflate_level = 1
+    shuffle = 1
+/
+
+&nam_sfcperts
+/
+
+&nam_sppperts
+/
+
+&nam_stochy
+/
+
+&namsfc
+    fabsl = 99999
+    faisl = 99999
+    faiss = 99999
+    fnacna = ''
+    fnaisc = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/CFSR.SEAICE.1982.2012.monthly.clim.grb'
+    fnglac = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/global_glacier.2x2.grb'
+    fnmskh = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/seaice_newland.grb'
+    fnmxic = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/global_maxice.2x2.grb'
+    fnsmcc = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/global_soilmgldas.t126.384.190.grb'
+    fnsnoa = ''
+    fnsnoc = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/global_snoclim.1.875.grb'
+    fntsfa = ''
+    fntsfc = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/RTGSST.1982.2012.monthly.clim.grb'
+    fnzorc = 'igbp'
+    fsicl = 99999
+    fsics = 99999
+    fslpl = 99999
+    fsmcl = 99999, 99999, 99999
+    fsnol = 99999
+    fsnos = 99999
+    fsotl = 99999
+    ftsfl = 99999
+    ftsfs = 90
+    fvetl = 99999
+    fvmnl = 99999
+    fvmxl = 99999
+    landice = .true.
+    ldebug = .false.
+/
+
+&namsfc_dict
+    fnabsc = '../fix_lam/C403.maximum_snow_albedo.tileX.nc'
+    fnalbc = '../fix_lam/C403.snowfree_albedo.tileX.nc'
+    fnalbc2 = '../fix_lam/C403.facsf.tileX.nc'
+    fnslpc = '../fix_lam/C403.slope_type.tileX.nc'
+    fnsotc = '../fix_lam/C403.soil_type.tileX.nc'
+    fntg3c = '../fix_lam/C403.substrate_temperature.tileX.nc'
+    fnvegc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
+    fnvetc = '../fix_lam/C403.vegetation_type.tileX.nc'
+    fnvmnc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
+    fnvmxc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
+/
+
+&surf_map_nml
+/
diff --git a/physics/docs/pdftxt/RE300/namelists/input.nml.develop.FV3_HRRR b/physics/docs/pdftxt/RE300/namelists/input.nml.develop.FV3_HRRR
new file mode 100644
index 000000000..8a7d621f3
--- /dev/null
+++ b/physics/docs/pdftxt/RE300/namelists/input.nml.develop.FV3_HRRR
@@ -0,0 +1,293 @@
+&amip_interp_nml
+    data_set = 'reynolds_oi'
+    date_out_of_range = 'climo'
+    interp_oi_sst = .true.
+    no_anom_sst = .false.
+    use_ncep_ice = .false.
+    use_ncep_sst = .true.
+/
+
+&atmos_model_nml
+    blocksize = 40
+    ccpp_suite = 'FV3_HRRR'
+    chksum_debug = .false.
+    dycore_only = .false.
+/
+
+&cires_ugwp_nml
+    knob_ugwp_azdir = 2, 4, 4, 4
+    knob_ugwp_doaxyz = 1
+    knob_ugwp_doheat = 1
+    knob_ugwp_dokdis = 1
+    knob_ugwp_effac = 1, 1, 1, 1
+    knob_ugwp_ndx4lh = 1
+    knob_ugwp_solver = 2
+    knob_ugwp_source = 1, 1, 0, 0
+    knob_ugwp_stoch = 0, 0, 0, 0
+    knob_ugwp_version = 0
+    knob_ugwp_wvspec = 1, 25, 25, 25
+    launch_level = 25
+/
+
+&diag_manager_nml
+    max_output_fields = 450
+    prepend_date = .false.
+/
+
+&external_ic_nml
+    checker_tr = .false.
+    filtered_terrain = .true.
+    gfs_dwinds = .true.
+    levp = 65
+    nt_checker = 0
+/
+
+&fms_io_nml
+    checksum_required = .false.
+    max_files_r = 100
+    max_files_w = 100
+/
+
+&fms_nml
+    clock_grain = 'ROUTINE'
+    domains_stack_size = 12000000
+    print_memory_usage = .false.
+/
+
+&fv_core_nml
+    a_imp = 1.0
+    adjust_dry_mass = .false.
+    bc_update_interval = 6
+    beta = 0.0
+    consv_am = .false.
+    consv_te = 0.0
+    d2_bg = 0.0
+    d2_bg_k1 = 0.2
+    d2_bg_k2 = 0.04
+    d4_bg = 0.12
+    d_con = 1.0
+    d_ext = 0.0
+    dddmp = 0.1
+    delt_max = 0.008
+    dnats = 0
+    do_sat_adj = .false.
+    do_schmidt = .true.
+    do_vort_damp = .true.
+    dwind_2d = .false.
+    dz_min = 2
+    external_eta = .true.
+    external_ic = .true.
+    fill = .true.
+    full_zs_filter = .false.
+    fv_debug = .false.
+    fv_sg_adj = 300
+    gfs_phil = .false.
+    hord_dp = -5
+    hord_mt = 5
+    hord_tm = 5
+    hord_tr = 10
+    hord_vt = 5
+    hydrostatic = .false.
+    io_layout = 1, 1
+    k_split = 2
+    ke_bg = 0.0
+    kord_mt = 9
+    kord_tm = -9
+    kord_tr = 9
+    kord_wz = 9
+    layout = 5, 2
+    make_nh = .true.
+    mountain = .false.
+    n_split = 5
+    n_sponge = 24
+    n_zs_filter = 0
+    na_init = 1
+    ncep_ic = .false.
+    nggps_ic = .true.
+    no_dycore = .false.
+    nord = 3
+    nord_tr = 2
+    npx = 220
+    npy = 132
+    npz = 64
+    nrows_blend = 10
+    ntiles = 1
+    nudge_qv = .false.
+    nwat = 6
+    p_fac = 0.1
+    phys_hydrostatic = .false.
+    print_freq = 6
+    psm_bc = 1
+    range_warn = .true.
+    read_increment = .false.
+    regional = .true.
+    regional_bcs_from_gsi = .false.
+    res_latlon_dynamics = 'fv3_increment.nc'
+    reset_eta = .false.
+    rf_cutoff = 2000.0
+    stretch_fac = 0.999
+    target_lat = 38.5
+    target_lon = -97.5
+    tau = 5.0
+    use_hydro_pressure = .false.
+    vtdm4 = 0.02
+    warm_start = .false.
+    write_restart_with_bcs = .false.
+    z_tracer = .true.
+/
+
+&fv_grid_nml
+    grid_file = 'INPUT/grid_spec.nc'
+/
+
+&gfs_physics_nml
+    bl_mynn_edmf = 1
+    bl_mynn_edmf_mom = 1
+    bl_mynn_tkeadvect = .true.
+    cal_pre = .false.
+    cdmbgwd = 3.5, 1.0
+    cnvcld = .false.
+    cnvgwd = .false.
+    cplflx = .false.
+    debug = .false.
+    do_deep = .false.
+    do_gsl_drag_ls_bl = .true.
+    do_gsl_drag_ss = .true.
+    do_gsl_drag_tofd = .true.
+    do_mynnedmf = .true.
+    do_mynnsfclay = .true.
+    dspheat = .true.
+    effr_in = .true.
+    fhcyc = 0.0
+    fhlwr = 1200.0
+    fhswr = 1200.0
+    fhzero = 1.0
+    gwd_opt = 3
+    h2o_phys = .true.
+    hybedmf = .false.
+    iaer = 5111
+    ialb = 1
+    iau_delthrs = 6
+    iau_inc_files = ''
+    iaufhrs = 30
+    icliq_sw = 2
+    icloud_bl = 1
+    ico2 = 2
+    iems = 1
+    imfdeepcnv = -1
+    imfshalcnv = -1
+    imp_physics = 8
+    iopt_alb = 2
+    iopt_btr = 1
+    iopt_crs = 1
+    iopt_dveg = 2
+    iopt_frz = 1
+    iopt_inf = 1
+    iopt_rad = 1
+    iopt_run = 1
+    iopt_sfc = 1
+    iopt_snf = 4
+    iopt_stc = 1
+    iopt_tbot = 2
+    iopt_trs = 2
+    iovr = 3
+    isol = 2
+    isot = 1
+    isubc_lw = 2
+    isubc_sw = 2
+    ivegsrc = 1
+    kice = 9
+    ldiag3d = .false.
+    lheatstrg = .false.
+    lradar = .true.
+    lsm = 3
+    lsoil = 4
+    lsoil_lsm = 9
+    ltaerosol = .true.
+    lwhtr = .true.
+    nsfullradar_diag = 3600
+    nst_anl = .true.
+    nstf_name = 2, 1, 0, 0, 0
+    oz_phys = .false.
+    oz_phys_2015 = .true.
+    pdfcld = .false.
+    pre_rad = .false.
+    print_diff_pgr = .false.
+    prslrd0 = 0.0
+    random_clds = .false.
+    redrag = .true.
+    satmedmf = .false.
+    sfclay_compute_flux = .true.
+    shal_cnv = .false.
+    swhtr = .true.
+    trans_trac = .true.
+    ttendlim = -999
+    use_ufo = .true.
+/
+
+&interpolator_nml
+    interp_method = 'conserve_great_circle'
+/
+
+&nam_sfcperts
+/
+
+&nam_sppperts
+/
+
+&nam_stochy
+/
+
+&namsfc
+    fabsl = 99999
+    faisl = 99999
+    faiss = 99999
+    fnacna = ''
+    fnaisc = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/CFSR.SEAICE.1982.2012.monthly.clim.grb'
+    fnglac = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/global_glacier.2x2.grb'
+    fnmskh = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/seaice_newland.grb'
+    fnmxic = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/global_maxice.2x2.grb'
+    fnsmcc = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/global_soilmgldas.t126.384.190.grb'
+    fnsnoa = ''
+    fnsnoc = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/global_snoclim.1.875.grb'
+    fntsfa = ''
+    fntsfc = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/RTGSST.1982.2012.monthly.clim.grb'
+    fnzorc = 'igbp'
+    fsicl = 99999
+    fsics = 99999
+    fslpl = 99999
+    fsmcl = 99999, 99999, 99999
+    fsnol = 99999
+    fsnos = 99999
+    fsotl = 99999
+    ftsfl = 99999
+    ftsfs = 90
+    fvetl = 99999
+    fvmnl = 99999
+    fvmxl = 99999
+    ldebug = .true.
+/
+
+&namsfc_dict
+    fnabsc = '../fix_lam/C403.maximum_snow_albedo.tileX.nc'
+    fnalbc = '../fix_lam/C403.snowfree_albedo.tileX.nc'
+    fnalbc2 = '../fix_lam/C403.facsf.tileX.nc'
+    fnslpc = '../fix_lam/C403.slope_type.tileX.nc'
+    fnsotc = '../fix_lam/C403.soil_type.tileX.nc'
+    fntg3c = '../fix_lam/C403.substrate_temperature.tileX.nc'
+    fnvegc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
+    fnvetc = '../fix_lam/C403.vegetation_type.tileX.nc'
+    fnvmnc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
+    fnvmxc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
+/
+
+&surf_map_nml
+    cd2 = -1
+    cd4 = 0.12
+    max_slope = 0.4
+    n_del2_strong = 0
+    n_del2_weak = 2
+    n_del4 = 1
+    peak_fac = 1.0
+    zero_ocean = .false.
+/
diff --git a/physics/docs/pdftxt/RE300/namelists/input.nml.develop.FV3_RAP b/physics/docs/pdftxt/RE300/namelists/input.nml.develop.FV3_RAP
new file mode 100644
index 000000000..ef3f44fc5
--- /dev/null
+++ b/physics/docs/pdftxt/RE300/namelists/input.nml.develop.FV3_RAP
@@ -0,0 +1,300 @@
+&amip_interp_nml
+    data_set = 'reynolds_oi'
+    date_out_of_range = 'climo'
+    interp_oi_sst = .true.
+    no_anom_sst = .false.
+    use_ncep_ice = .false.
+    use_ncep_sst = .true.
+/
+
+&atmos_model_nml
+    blocksize = 40
+    ccpp_suite = 'FV3_RAP'
+    chksum_debug = .false.
+    dycore_only = .false.
+/
+
+&cires_ugwp_nml
+    knob_ugwp_azdir = 2, 4, 4, 4
+    knob_ugwp_doaxyz = 1
+    knob_ugwp_doheat = 1
+    knob_ugwp_dokdis = 1
+    knob_ugwp_effac = 1, 1, 1, 1
+    knob_ugwp_ndx4lh = 1
+    knob_ugwp_solver = 2
+    knob_ugwp_source = 1, 1, 0, 0
+    knob_ugwp_stoch = 0, 0, 0, 0
+    knob_ugwp_version = 0
+    knob_ugwp_wvspec = 1, 25, 25, 25
+    launch_level = 25
+/
+
+&diag_manager_nml
+    max_output_fields = 450
+    prepend_date = .false.
+/
+
+&external_ic_nml
+    checker_tr = .false.
+    filtered_terrain = .true.
+    gfs_dwinds = .true.
+    levp = 65
+    nt_checker = 0
+/
+
+&fms_io_nml
+    checksum_required = .false.
+    max_files_r = 100
+    max_files_w = 100
+/
+
+&fms_nml
+    clock_grain = 'ROUTINE'
+    domains_stack_size = 12000000
+    print_memory_usage = .false.
+/
+
+&fv_core_nml
+    a_imp = 1.0
+    adjust_dry_mass = .false.
+    bc_update_interval = 6
+    beta = 0.0
+    consv_am = .false.
+    consv_te = 0.0
+    d2_bg = 0.0
+    d2_bg_k1 = 0.2
+    d2_bg_k2 = 0.04
+    d4_bg = 0.12
+    d_con = 1.0
+    d_ext = 0.0
+    dddmp = 0.1
+    delt_max = 0.008
+    dnats = 0
+    do_sat_adj = .false.
+    do_schmidt = .true.
+    do_vort_damp = .true.
+    dwind_2d = .false.
+    dz_min = 2
+    external_eta = .true.
+    external_ic = .true.
+    fill = .true.
+    full_zs_filter = .false.
+    fv_debug = .false.
+    fv_sg_adj = 300
+    gfs_phil = .false.
+    hord_dp = -5
+    hord_mt = 5
+    hord_tm = 5
+    hord_tr = 10
+    hord_vt = 5
+    hydrostatic = .false.
+    io_layout = 1, 1
+    k_split = 2
+    ke_bg = 0.0
+    kord_mt = 9
+    kord_tm = -9
+    kord_tr = 9
+    kord_wz = 9
+    layout = 5, 2
+    make_nh = .true.
+    mountain = .false.
+    n_split = 5
+    n_sponge = 24
+    n_zs_filter = 0
+    na_init = 1
+    ncep_ic = .false.
+    nggps_ic = .true.
+    no_dycore = .false.
+    nord = 3
+    nord_tr = 2
+    npx = 220
+    npy = 132
+    npz = 64
+    nrows_blend = 10
+    ntiles = 1
+    nudge_qv = .false.
+    nwat = 6
+    p_fac = 0.1
+    phys_hydrostatic = .false.
+    print_freq = 6
+    psm_bc = 1
+    range_warn = .true.
+    read_increment = .false.
+    regional = .true.
+    regional_bcs_from_gsi = .false.
+    res_latlon_dynamics = 'fv3_increment.nc'
+    reset_eta = .false.
+    rf_cutoff = 2000.0
+    stretch_fac = 0.999
+    target_lat = 38.5
+    target_lon = -97.5
+    tau = 5.0
+    use_hydro_pressure = .false.
+    vtdm4 = 0.02
+    warm_start = .false.
+    write_restart_with_bcs = .false.
+    z_tracer = .true.
+/
+
+&fv_grid_nml
+    grid_file = 'INPUT/grid_spec.nc'
+/
+
+&gfs_physics_nml
+    bl_mynn_edmf = 1
+    bl_mynn_edmf_mom = 1
+    bl_mynn_tkeadvect = .true.
+    cal_pre = .false.
+    cdmbgwd = 3.5, 1.0
+    cnvcld = .false.
+    cnvgwd = .false.
+    cplflx = .false.
+    debug = .false.
+    do_deep = .true.
+    do_gsl_drag_ls_bl = .true.
+    do_gsl_drag_ss = .true.
+    do_gsl_drag_tofd = .true.
+    do_mynnedmf = .true.
+    do_mynnsfclay = .true.
+    do_shum = .false.
+    do_skeb = .false.
+    do_spp = .false.
+    do_sppt = .false.
+    dspheat = .true.
+    effr_in = .true.
+    fhcyc = 0
+    fhlwr = 1200.0
+    fhswr = 1200.0
+    fhzero = 1.0
+    gwd_opt = 3
+    h2o_phys = .true.
+    hybedmf = .false.
+    iaer = 5111
+    ialb = 1
+    iau_delthrs = 6
+    iau_inc_files = ''
+    iaufhrs = 30
+    icliq_sw = 2
+    icloud_bl = 1
+    ico2 = 2
+    iems = 1
+    imfdeepcnv = 3
+    imfshalcnv = 3
+    imp_physics = 8
+    iopt_alb = 2
+    iopt_btr = 1
+    iopt_crs = 1
+    iopt_dveg = 2
+    iopt_frz = 1
+    iopt_inf = 1
+    iopt_rad = 1
+    iopt_run = 1
+    iopt_sfc = 1
+    iopt_snf = 4
+    iopt_stc = 1
+    iopt_tbot = 2
+    iopt_trs = 2
+    iovr = 3
+    isol = 2
+    isot = 1
+    isubc_lw = 2
+    isubc_sw = 2
+    ivegsrc = 1
+    kice = 9
+    ldiag3d = .false.
+    lheatstrg = .false.
+    lndp_type = 0
+    lradar = .true.
+    lsm = 3
+    lsoil = 4
+    lsoil_lsm = 9
+    ltaerosol = .true.
+    lwhtr = .true.
+    n_var_lndp = 0
+    n_var_spp = 0
+    nsfullradar_diag = 3600
+    nst_anl = .true.
+    nstf_name = 2, 1, 0, 0, 0
+    oz_phys = .false.
+    oz_phys_2015 = .true.
+    pdfcld = .false.
+    pre_rad = .false.
+    print_diff_pgr = .false.
+    prslrd0 = 0.0
+    random_clds = .false.
+    redrag = .true.
+    satmedmf = .false.
+    sfclay_compute_flux = .false.
+    shal_cnv = .true.
+    swhtr = .true.
+    trans_trac = .true.
+    ttendlim = -999
+    use_ufo = .true.
+/
+
+&interpolator_nml
+    interp_method = 'conserve_great_circle'
+/
+
+&nam_sfcperts
+/
+
+&nam_sppperts
+/
+
+&nam_stochy
+/
+
+&namsfc
+    fabsl = 99999
+    faisl = 99999
+    faiss = 99999
+    fnacna = ''
+    fnaisc = '../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/CFSR.SEAICE.1982.2012.monthly.clim.grb'
+    fnglac = '../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/global_glacier.2x2.grb'
+    fnmskh = '../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/seaice_newland.grb'
+    fnmxic = '../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/global_maxice.2x2.grb'
+    fnsmcc = '../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/global_soilmgldas.t126.384.190.grb'
+    fnsnoa = ''
+    fnsnoc = '../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/global_snoclim.1.875.grb'
+    fntsfa = ''
+    fntsfc = '../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/RTGSST.1982.2012.monthly.clim.grb'
+    fnzorc = 'igbp'
+    fsicl = 99999
+    fsics = 99999
+    fslpl = 99999
+    fsmcl = 99999, 99999, 99999
+    fsnol = 99999
+    fsnos = 99999
+    fsotl = 99999
+    ftsfl = 99999
+    ftsfs = 90
+    fvetl = 99999
+    fvmnl = 99999
+    fvmxl = 99999
+    ldebug = .true.
+/
+
+&namsfc_dict
+    fnabsc = '../fix_lam/C403.maximum_snow_albedo.tileX.nc'
+    fnalbc = '../fix_lam/C403.snowfree_albedo.tileX.nc'
+    fnalbc2 = '../fix_lam/C403.facsf.tileX.nc'
+    fnslpc = '../fix_lam/C403.slope_type.tileX.nc'
+    fnsotc = '../fix_lam/C403.soil_type.tileX.nc'
+    fntg3c = '../fix_lam/C403.substrate_temperature.tileX.nc'
+    fnvegc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
+    fnvetc = '../fix_lam/C403.vegetation_type.tileX.nc'
+    fnvmnc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
+    fnvmxc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
+/
+
+&surf_map_nml
+    cd2 = -1
+    cd4 = 0.12
+    max_slope = 0.4
+    n_del2_strong = 0
+    n_del2_weak = 2
+    n_del4 = 1
+    peak_fac = 1.0
+    zero_ocean = .false.
+/
diff --git a/physics/docs/pdftxt/RE300/namelists/input.nml.develop.FV3_RRFS_v1beta b/physics/docs/pdftxt/RE300/namelists/input.nml.develop.FV3_RRFS_v1beta
new file mode 100644
index 000000000..97a0f1216
--- /dev/null
+++ b/physics/docs/pdftxt/RE300/namelists/input.nml.develop.FV3_RRFS_v1beta
@@ -0,0 +1,285 @@
+&amip_interp_nml
+    data_set = 'reynolds_oi'
+    date_out_of_range = 'climo'
+    interp_oi_sst = .true.
+    no_anom_sst = .false.
+    use_ncep_ice = .false.
+    use_ncep_sst = .true.
+/
+
+&atmos_model_nml
+    blocksize = 40
+    ccpp_suite = 'FV3_RRFS_v1beta'
+    chksum_debug = .false.
+    dycore_only = .false.
+/
+
+&cires_ugwp_nml
+    knob_ugwp_azdir = 2, 4, 4, 4
+    knob_ugwp_doaxyz = 1
+    knob_ugwp_doheat = 1
+    knob_ugwp_dokdis = 1
+    knob_ugwp_effac = 1, 1, 1, 1
+    knob_ugwp_ndx4lh = 1
+    knob_ugwp_solver = 2
+    knob_ugwp_source = 1, 1, 0, 0
+    knob_ugwp_stoch = 0, 0, 0, 0
+    knob_ugwp_version = 0
+    knob_ugwp_wvspec = 1, 25, 25, 25
+    launch_level = 25
+/
+
+&diag_manager_nml
+    max_output_fields = 450
+    prepend_date = .false.
+/
+
+&external_ic_nml
+    checker_tr = .false.
+    filtered_terrain = .true.
+    gfs_dwinds = .true.
+    levp = 65
+    nt_checker = 0
+/
+
+&fms_io_nml
+    checksum_required = .false.
+    max_files_r = 100
+    max_files_w = 100
+/
+
+&fms_nml
+    clock_grain = 'ROUTINE'
+    domains_stack_size = 12000000
+    print_memory_usage = .false.
+/
+
+&fv_core_nml
+    a_imp = 1.0
+    adjust_dry_mass = .false.
+    bc_update_interval = 6
+    beta = 0.0
+    consv_am = .false.
+    consv_te = 0.0
+    d2_bg = 0.0
+    d2_bg_k1 = 0.2
+    d2_bg_k2 = 0.04
+    d4_bg = 0.12
+    d_con = 1.0
+    d_ext = 0.0
+    dddmp = 0.1
+    delt_max = 0.008
+    dnats = 0
+    do_sat_adj = .false.
+    do_schmidt = .true.
+    do_vort_damp = .true.
+    dwind_2d = .false.
+    dz_min = 2
+    external_eta = .true.
+    external_ic = .true.
+    fill = .true.
+    full_zs_filter = .false.
+    fv_debug = .false.
+    fv_sg_adj = 300
+    gfs_phil = .false.
+    hord_dp = 6
+    hord_mt = 6
+    hord_tm = 6
+    hord_tr = 10
+    hord_vt = 6
+    hydrostatic = .false.
+    io_layout = 1, 1
+    k_split = 2
+    ke_bg = 0.0
+    kord_mt = 9
+    kord_tm = -9
+    kord_tr = 9
+    kord_wz = 9
+    layout = 5, 2
+    make_nh = .true.
+    mountain = .false.
+    n_split = 5
+    n_sponge = 24
+    n_zs_filter = 0
+    na_init = 1
+    ncep_ic = .false.
+    nggps_ic = .true.
+    no_dycore = .false.
+    nord = 3
+    npx = 220
+    npy = 132
+    npz = 64
+    nrows_blend = 10
+    ntiles = 1
+    nudge_qv = .false.
+    nwat = 6
+    p_fac = 0.1
+    phys_hydrostatic = .false.
+    print_freq = 6
+    psm_bc = 1
+    range_warn = .true.
+    read_increment = .false.
+    regional = .true.
+    regional_bcs_from_gsi = .false.
+    res_latlon_dynamics = 'fv3_increment.nc'
+    reset_eta = .false.
+    rf_cutoff = 2000.0
+    stretch_fac = 0.999
+    target_lat = 38.5
+    target_lon = -97.5
+    tau = 5.0
+    use_hydro_pressure = .false.
+    vtdm4 = 0.02
+    warm_start = .false.
+    write_restart_with_bcs = .false.
+    z_tracer = .true.
+/
+
+&fv_grid_nml
+    grid_file = 'INPUT/grid_spec.nc'
+/
+
+&gfs_physics_nml
+    bl_mynn_edmf = 1
+    bl_mynn_edmf_mom = 1
+    bl_mynn_tkeadvect = .true.
+    cal_pre = .false.
+    cdmbgwd = 3.5, 0.25
+    cnvcld = .false.
+    cnvgwd = .false.
+    cplflx = .false.
+    debug = .false.
+    do_deep = .false.
+    do_mynnedmf = .true.
+    do_mynnsfclay = .true.
+    dspheat = .true.
+    effr_in = .true.
+    fhcyc = 0.0
+    fhlwr = 1200.0
+    fhswr = 1200.0
+    fhzero = 1.0
+    h2o_phys = .true.
+    hybedmf = .false.
+    iaer = 111
+    ialb = 1
+    iau_delthrs = 6
+    iau_inc_files = ''
+    iaufhrs = 30
+    icloud_bl = 1
+    ico2 = 2
+    iems = 1
+    imfdeepcnv = -1
+    imfshalcnv = -1
+    imp_physics = 8
+    iopt_alb = 2
+    iopt_btr = 1
+    iopt_crs = 1
+    iopt_dveg = 2
+    iopt_frz = 1
+    iopt_inf = 1
+    iopt_rad = 1
+    iopt_run = 1
+    iopt_sfc = 1
+    iopt_snf = 4
+    iopt_stc = 1
+    iopt_tbot = 2
+    iopt_trs = 2
+    isol = 2
+    isot = 1
+    isubc_lw = 2
+    isubc_sw = 2
+    ivegsrc = 1
+    ldiag3d = .false.
+    lheatstrg = .false.
+    lradar = .true.
+    lsm = 2
+    lsoil = 4
+    lsoil_lsm = 4
+    ltaerosol = .true.
+    lwhtr = .true.
+    nsfullradar_diag = 3600
+    nst_anl = .true.
+    nstf_name = 2, 1, 0, 0, 0
+    oz_phys = .false.
+    oz_phys_2015 = .true.
+    pdfcld = .false.
+    pre_rad = .false.
+    print_diff_pgr = .false.
+    prslrd0 = 0.0
+    random_clds = .false.
+    redrag = .true.
+    satmedmf = .false.
+    sfclay_compute_flux = .false.
+    shal_cnv = .false.
+    swhtr = .true.
+    trans_trac = .true.
+    ttendlim = -999
+    use_ufo = .true.
+/
+
+&interpolator_nml
+    interp_method = 'conserve_great_circle'
+/
+
+&nam_sfcperts
+/
+
+&nam_sppperts
+/
+
+&nam_stochy
+/
+
+&namsfc
+    fabsl = 99999
+    faisl = 99999
+    faiss = 99999
+    fnacna = ''
+    fnaisc = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/CFSR.SEAICE.1982.2012.monthly.clim.grb'
+    fnglac = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/global_glacier.2x2.grb'
+    fnmskh = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/seaice_newland.grb'
+    fnmxic = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/global_maxice.2x2.grb'
+    fnsmcc = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/global_soilmgldas.t126.384.190.grb'
+    fnsnoa = ''
+    fnsnoc = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/global_snoclim.1.875.grb'
+    fntsfa = ''
+    fntsfc = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/RTGSST.1982.2012.monthly.clim.grb'
+    fnzorc = 'igbp'
+    fsicl = 99999
+    fsics = 99999
+    fslpl = 99999
+    fsmcl = 99999, 99999, 99999
+    fsnol = 99999
+    fsnos = 99999
+    fsotl = 99999
+    ftsfl = 99999
+    ftsfs = 90
+    fvetl = 99999
+    fvmnl = 99999
+    fvmxl = 99999
+    ldebug = .true.
+/
+
+&namsfc_dict
+    fnabsc = '../fix_lam/C403.maximum_snow_albedo.tileX.nc'
+    fnalbc = '../fix_lam/C403.snowfree_albedo.tileX.nc'
+    fnalbc2 = '../fix_lam/C403.facsf.tileX.nc'
+    fnslpc = '../fix_lam/C403.slope_type.tileX.nc'
+    fnsotc = '../fix_lam/C403.soil_type.tileX.nc'
+    fntg3c = '../fix_lam/C403.substrate_temperature.tileX.nc'
+    fnvegc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
+    fnvetc = '../fix_lam/C403.vegetation_type.tileX.nc'
+    fnvmnc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
+    fnvmxc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
+/
+
+&surf_map_nml
+    cd2 = -1
+    cd4 = 0.12
+    max_slope = 0.4
+    n_del2_strong = 0
+    n_del2_weak = 2
+    n_del4 = 1
+    peak_fac = 1.0
+    zero_ocean = .false.
+/
diff --git a/physics/docs/pdftxt/RE300/namelists/input.nml.develop.FV3_WoFS_v0 b/physics/docs/pdftxt/RE300/namelists/input.nml.develop.FV3_WoFS_v0
new file mode 100644
index 000000000..1236cde3b
--- /dev/null
+++ b/physics/docs/pdftxt/RE300/namelists/input.nml.develop.FV3_WoFS_v0
@@ -0,0 +1,291 @@
+&amip_interp_nml
+    data_set = 'reynolds_oi'
+    date_out_of_range = 'climo'
+    interp_oi_sst = .true.
+    no_anom_sst = .false.
+    use_ncep_ice = .false.
+    use_ncep_sst = .true.
+/
+
+&atmos_model_nml
+    blocksize = 40
+    ccpp_suite = 'FV3_WoFS_v0'
+    chksum_debug = .false.
+    dycore_only = .false.
+/
+
+&cires_ugwp_nml
+    knob_ugwp_azdir = 2, 4, 4, 4
+    knob_ugwp_doaxyz = 1
+    knob_ugwp_doheat = 1
+    knob_ugwp_dokdis = 1
+    knob_ugwp_effac = 1, 1, 1, 1
+    knob_ugwp_ndx4lh = 1
+    knob_ugwp_solver = 2
+    knob_ugwp_source = 1, 1, 0, 0
+    knob_ugwp_stoch = 0, 0, 0, 0
+    knob_ugwp_version = 0
+    knob_ugwp_wvspec = 1, 25, 25, 25
+    launch_level = 25
+/
+
+&diag_manager_nml
+    max_output_fields = 450
+    prepend_date = .false.
+/
+
+&external_ic_nml
+    checker_tr = .false.
+    filtered_terrain = .true.
+    gfs_dwinds = .true.
+    levp = 65
+    nt_checker = 0
+/
+
+&fms_io_nml
+    checksum_required = .false.
+    max_files_r = 100
+    max_files_w = 100
+/
+
+&fms_nml
+    clock_grain = 'ROUTINE'
+    domains_stack_size = 12000000
+    print_memory_usage = .false.
+/
+
+&fv_core_nml
+    a_imp = 1.0
+    adjust_dry_mass = .false.
+    bc_update_interval = 6
+    beta = 0.0
+    consv_am = .false.
+    consv_te = 0.0
+    d2_bg = 0.0
+    d2_bg_k1 = 0.2
+    d2_bg_k2 = 0.04
+    d4_bg = 0.12
+    d_con = 1.0
+    d_ext = 0.0
+    dddmp = 0.1
+    delt_max = 0.008
+    dnats = 0
+    do_sat_adj = .false.
+    do_schmidt = .true.
+    do_vort_damp = .true.
+    dwind_2d = .false.
+    dz_min = 2
+    external_eta = .true.
+    external_ic = .true.
+    fill = .true.
+    full_zs_filter = .false.
+    fv_debug = .false.
+    fv_sg_adj = 300
+    gfs_phil = .false.
+    hord_dp = 6
+    hord_mt = 6
+    hord_tm = 6
+    hord_tr = 10
+    hord_vt = 6
+    hydrostatic = .false.
+    io_layout = 1, 1
+    k_split = 2
+    ke_bg = 0.0
+    kord_mt = 9
+    kord_tm = -9
+    kord_tr = 9
+    kord_wz = 9
+    layout = 5, 2
+    make_nh = .true.
+    mountain = .false.
+    n_split = 5
+    n_sponge = 24
+    n_zs_filter = 0
+    na_init = 1
+    ncep_ic = .false.
+    nggps_ic = .true.
+    no_dycore = .false.
+    nord = 3
+    npx = 220
+    npy = 132
+    npz = 64
+    nrows_blend = 10
+    ntiles = 1
+    nudge_qv = .false.
+    nwat = 7
+    p_fac = 0.1
+    phys_hydrostatic = .false.
+    print_freq = 6
+    psm_bc = 1
+    range_warn = .true.
+    read_increment = .false.
+    regional = .true.
+    regional_bcs_from_gsi = .false.
+    res_latlon_dynamics = 'fv3_increment.nc'
+    reset_eta = .false.
+    rf_cutoff = 2000.0
+    stretch_fac = 0.999
+    target_lat = 38.5
+    target_lon = -97.5
+    tau = 5.0
+    use_hydro_pressure = .false.
+    vtdm4 = 0.02
+    warm_start = .false.
+    write_restart_with_bcs = .false.
+    z_tracer = .true.
+/
+
+&fv_diagnostics_nml
+    do_hailcast = .true.
+/
+
+&fv_grid_nml
+    grid_file = 'INPUT/grid_spec.nc'
+/
+
+&gfs_physics_nml
+    bl_mynn_edmf = 1
+    bl_mynn_edmf_mom = 1
+    bl_mynn_tkeadvect = .true.
+    cal_pre = .false.
+    cdmbgwd = 3.5, 0.25
+    cnvcld = .false.
+    cnvgwd = .false.
+    cplflx = .false.
+    debug = .false.
+    do_deep = .false.
+    do_mynnedmf = .true.
+    do_mynnsfclay = .true.
+    dspheat = .true.
+    effr_in = .true.
+    fhcyc = 0.0
+    fhlwr = 1200.0
+    fhswr = 1200.0
+    fhzero = 1.0
+    h2o_phys = .true.
+    hybedmf = .false.
+    iaer = 111
+    ialb = 1
+    iau_delthrs = 6
+    iau_inc_files = ''
+    iaufhrs = 30
+    icloud_bl = 1
+    ico2 = 2
+    iems = 1
+    imfdeepcnv = -1
+    imfshalcnv = -1
+    imp_physics = 17
+    iopt_alb = 2
+    iopt_btr = 1
+    iopt_crs = 1
+    iopt_dveg = 2
+    iopt_frz = 1
+    iopt_inf = 1
+    iopt_rad = 1
+    iopt_run = 1
+    iopt_sfc = 1
+    iopt_snf = 4
+    iopt_stc = 1
+    iopt_tbot = 2
+    isol = 2
+    isot = 1
+    isubc_lw = 2
+    isubc_sw = 2
+    ivegsrc = 1
+    ldiag3d = .false.
+    lheatstrg = .false.
+    lradar = .true.
+    lsm = 1
+    lsoil = 4
+    lsoil_lsm = 4
+    ltaerosol = .true.
+    lwhtr = .true.
+    nsfullradar_diag = 3600
+    nssl_cccn = 600000000.0
+    nssl_ccn_on = .true.
+    nssl_hail_on = .true.
+    nst_anl = .true.
+    nstf_name = 2, 1, 0, 0, 0
+    oz_phys = .false.
+    oz_phys_2015 = .true.
+    pdfcld = .false.
+    pre_rad = .false.
+    print_diff_pgr = .false.
+    prslrd0 = 0.0
+    random_clds = .false.
+    redrag = .true.
+    satmedmf = .false.
+    sfclay_compute_flux = .false.
+    shal_cnv = .false.
+    swhtr = .true.
+    trans_trac = .true.
+    ttendlim = -999
+    use_ufo = .true.
+/
+
+&interpolator_nml
+    interp_method = 'conserve_great_circle'
+/
+
+&nam_sfcperts
+/
+
+&nam_sppperts
+/
+
+&nam_stochy
+/
+
+&namsfc
+    fabsl = 99999
+    faisl = 99999
+    faiss = 99999
+    fnacna = ''
+    fnaisc = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/CFSR.SEAICE.1982.2012.monthly.clim.grb'
+    fnglac = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/global_glacier.2x2.grb'
+    fnmskh = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/seaice_newland.grb'
+    fnmxic = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/global_maxice.2x2.grb'
+    fnsmcc = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/global_soilmgldas.t126.384.190.grb'
+    fnsnoa = ''
+    fnsnoc = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/global_snoclim.1.875.grb'
+    fntsfa = ''
+    fntsfc = '../../../../../../../../../../../../scratch1/NCEPDEV/nems/role.epic/UFS_SRW_data/develop/fix/fix_am/RTGSST.1982.2012.monthly.clim.grb'
+    fnzorc = 'igbp'
+    fsicl = 99999
+    fsics = 99999
+    fslpl = 99999
+    fsmcl = 99999, 99999, 99999
+    fsnol = 99999
+    fsnos = 99999
+    fsotl = 99999
+    ftsfl = 99999
+    ftsfs = 90
+    fvetl = 99999
+    fvmnl = 99999
+    fvmxl = 99999
+    ldebug = .true.
+/
+
+&namsfc_dict
+    fnabsc = '../fix_lam/C403.maximum_snow_albedo.tileX.nc'
+    fnalbc = '../fix_lam/C403.snowfree_albedo.tileX.nc'
+    fnalbc2 = '../fix_lam/C403.facsf.tileX.nc'
+    fnslpc = '../fix_lam/C403.slope_type.tileX.nc'
+    fnsotc = '../fix_lam/C403.soil_type.tileX.nc'
+    fntg3c = '../fix_lam/C403.substrate_temperature.tileX.nc'
+    fnvegc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
+    fnvetc = '../fix_lam/C403.vegetation_type.tileX.nc'
+    fnvmnc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
+    fnvmxc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
+/
+
+&surf_map_nml
+    cd2 = -1
+    cd4 = 0.12
+    max_slope = 0.4
+    n_del2_strong = 0
+    n_del2_weak = 2
+    n_del4 = 1
+    peak_fac = 1.0
+    zero_ocean = .false.
+/
diff --git a/physics/docs/pdftxt/RE300/namelists/input.nml.v21.FV3_GFS_v16 b/physics/docs/pdftxt/RE300/namelists/input.nml.v21.FV3_GFS_v16
new file mode 100644
index 000000000..6dc85900b
--- /dev/null
+++ b/physics/docs/pdftxt/RE300/namelists/input.nml.v21.FV3_GFS_v16
@@ -0,0 +1,336 @@
+&amip_interp_nml
+    data_set = 'reynolds_oi'
+    date_out_of_range = 'climo'
+    interp_oi_sst = .true.
+    no_anom_sst = .false.
+    use_ncep_ice = .false.
+    use_ncep_sst = .true.
+/
+
+&atmos_model_nml
+    blocksize = 40
+    ccpp_suite = 'FV3_GFS_v16'
+    chksum_debug = .false.
+    dycore_only = .false.
+/
+
+&cires_ugwp_nml
+    knob_ugwp_azdir = 2, 4, 4, 4
+    knob_ugwp_doaxyz = 1
+    knob_ugwp_doheat = 1
+    knob_ugwp_dokdis = 1
+    knob_ugwp_effac = 1, 1, 1, 1
+    knob_ugwp_ndx4lh = 1
+    knob_ugwp_solver = 2
+    knob_ugwp_source = 1, 1, 0, 0
+    knob_ugwp_stoch = 0, 0, 0, 0
+    knob_ugwp_version = 0
+    knob_ugwp_wvspec = 1, 25, 25, 25
+    launch_level = 27
+/
+
+&diag_manager_nml
+    prepend_date = .false.
+/
+
+&external_ic_nml
+    checker_tr = .false.
+    filtered_terrain = .true.
+    gfs_dwinds = .true.
+    levp = 65
+    nt_checker = 0
+/
+
+&fms_io_nml
+    checksum_required = .false.
+    max_files_r = 100
+    max_files_w = 100
+/
+
+&fms_nml
+    clock_grain = 'ROUTINE'
+    domains_stack_size = 5000000
+    print_memory_usage = .false.
+/
+
+&fv_core_nml
+    a_imp = 1.0
+    adjust_dry_mass = .false.
+    agrid_vel_rst = .false.
+    bc_update_interval = 6
+    beta = 0.0
+    consv_am = .false.
+    consv_te = 0.0
+    d2_bg = 0.0
+    d2_bg_k1 = 0.2
+    d2_bg_k2 = 0.0
+    d4_bg = 0.12
+    d_con = 1.0
+    d_ext = 0.0
+    dddmp = 0.1
+    delt_max = 0.008
+    dnats = 1
+    do_sat_adj = .true.
+    do_schmidt = .true.
+    do_vort_damp = .true.
+    dwind_2d = .false.
+    dz_min = 2
+    external_eta = .true.
+    external_ic = .true.
+    fill = .true.
+    full_zs_filter = .false.
+    fv_debug = .false.
+    fv_sg_adj = 450
+    gfs_phil = .false.
+    hord_dp = -5
+    hord_mt = 5
+    hord_tm = 5
+    hord_tr = 10
+    hord_vt = 5
+    hydrostatic = .false.
+    io_layout = 1, 1
+    k_split = 6
+    ke_bg = 0.0
+    kord_mt = 9
+    kord_tm = -9
+    kord_tr = 9
+    kord_wz = 9
+    layout = 5, 2
+    make_nh = .false.
+    mountain = .false.
+    n_split = 6
+    n_sponge = 10
+    n_zs_filter = 0
+    na_init = 0
+    ncep_ic = .false.
+    nggps_ic = .true.
+    no_dycore = .false.
+    nord = 3
+    npx = 220
+    npy = 132
+    npz = 64
+    nrows_blend = 10
+    ntiles = 1
+    nudge_dz = .false.
+    nudge_qv = .true.
+    nwat = 6
+    p_fac = 0.1
+    phys_hydrostatic = .false.
+    print_freq = 6
+    psm_bc = 1
+    range_warn = .false.
+    read_increment = .false.
+    regional = .true.
+    regional_bcs_from_gsi = .false.
+    res_latlon_dynamics = ''
+    reset_eta = .false.
+    rf_cutoff = 750.0
+    stretch_fac = 0.999
+    target_lat = 38.5
+    target_lon = -97.5
+    tau = 10.0
+    use_hydro_pressure = .false.
+    vtdm4 = 0.02
+    warm_start = .false.
+    write_restart_with_bcs = .false.
+    z_tracer = .true.
+/
+
+&fv_grid_nml
+    grid_file = 'INPUT/grid_spec.nc'
+/
+
+&gfdl_cloud_microphysics_nml
+    c_cracw = 0.8
+    c_paut = 0.5
+    c_pgacs = 0.01
+    c_psaci = 0.05
+    ccn_l = 300.0
+    ccn_o = 100.0
+    const_vg = .false.
+    const_vi = .false.
+    const_vr = .false.
+    const_vs = .false.
+    de_ice = .false.
+    do_qa = .true.
+    do_sedi_heat = .false.
+    dw_land = 0.16
+    dw_ocean = 0.1
+    fast_sat_adj = .true.
+    fix_negative = .true.
+    icloud_f = 1
+    mono_prof = .true.
+    mp_time = 150.0
+    prog_ccn = .false.
+    qi0_crt = 8e-05
+    qi_lim = 1.0
+    ql_gen = 0.001
+    ql_mlt = 0.001
+    qs0_crt = 0.001
+    rad_graupel = .true.
+    rad_rain = .true.
+    rad_snow = .true.
+    reiflag = 2
+    rh_inc = 0.3
+    rh_inr = 0.3
+    rh_ins = 0.3
+    rthresh = 1e-05
+    sedi_transport = .true.
+    tau_g2v = 900.0
+    tau_i2s = 1000.0
+    tau_l2v = 225.0
+    tau_v2l = 150.0
+    use_ccn = .true.
+    use_ppm = .false.
+    vg_max = 12.0
+    vi_max = 1.0
+    vr_max = 12.0
+    vs_max = 2.0
+    z_slope_ice = .true.
+    z_slope_liq = .true.
+/
+
+&gfs_physics_nml
+    cal_pre = .false.
+    cdmbgwd = 4.0, 0.15, 1.0, 1.0
+    cnvcld = .true.
+    cnvgwd = .true.
+    debug = .false.
+    do_shum = .false.
+    do_skeb = .false.
+    do_spp = .false.
+    do_sppt = .false.
+    do_tofd = .true.
+    do_ugwp = .false.
+    dspheat = .true.
+    effr_in = .true.
+    fhcyc = 0
+    fhlwr = 3600.0
+    fhswr = 3600.0
+    fhzero = 1.0
+    h2o_phys = .true.
+    hybedmf = .false.
+    iaer = 5111
+    ialb = 1
+    iau_inc_files = ''
+    icliq_sw = 2
+    ico2 = 2
+    iems = 1
+    imfdeepcnv = 2
+    imfshalcnv = 2
+    imp_physics = 11
+    iopt_alb = 2
+    iopt_btr = 1
+    iopt_crs = 1
+    iopt_dveg = 1
+    iopt_frz = 1
+    iopt_inf = 1
+    iopt_rad = 1
+    iopt_run = 1
+    iopt_sfc = 1
+    iopt_snf = 4
+    iopt_stc = 1
+    iopt_tbot = 2
+    iopt_trs = 2
+    iovr = 3
+    isatmedmf = 1
+    isol = 2
+    isot = 1
+    isubc_lw = 2
+    isubc_sw = 2
+    ivegsrc = 1
+    ldiag3d = .false.
+    ldiag_ugwp = .false.
+    lgfdlmprad = .true.
+    lheatstrg = .true.
+    lndp_type = 0
+    lsm = 1
+    lsoil = 4
+    lwhtr = .true.
+    n_var_lndp = 0
+    n_var_spp = 0
+    nsradar_reset = 3600
+    nst_anl = .true.
+    nstf_name = 2, 1, 0, 0, 0
+    oz_phys = .false.
+    oz_phys_2015 = .true.
+    pdfcld = .false.
+    prautco = 0.00015, 0.00015
+    pre_rad = .false.
+    print_diff_pgr = .false.
+    prslrd0 = 0.0
+    psautco = 0.0008, 0.0005
+    random_clds = .false.
+    redrag = .true.
+    satmedmf = .true.
+    sfclay_compute_flux = .false.
+    shal_cnv = .true.
+    swhtr = .true.
+    trans_trac = .true.
+    use_ufo = .true.
+/
+
+&interpolator_nml
+    interp_method = 'conserve_great_circle'
+/
+
+&mpp_io_nml
+    deflate_level = 1
+    shuffle = 1
+/
+
+&nam_sfcperts
+/
+
+&nam_sppperts
+/
+
+&nam_stochy
+/
+
+&namsfc
+    fabsl = 99999
+    faisl = 99999
+    faiss = 99999
+    fnacna = ''
+    fnaisc = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/CFSR.SEAICE.1982.2012.monthly.clim.grb'
+    fnglac = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/global_glacier.2x2.grb'
+    fnmskh = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/seaice_newland.grb'
+    fnmxic = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/global_maxice.2x2.grb'
+    fnsmcc = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/global_soilmgldas.t126.384.190.grb'
+    fnsnoa = ''
+    fnsnoc = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/global_snoclim.1.875.grb'
+    fntsfa = ''
+    fntsfc = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/RTGSST.1982.2012.monthly.clim.grb'
+    fnzorc = 'igbp'
+    fsicl = 99999
+    fsics = 99999
+    fslpl = 99999
+    fsmcl = 99999, 99999, 99999
+    fsnol = 99999
+    fsnos = 99999
+    fsotl = 99999
+    ftsfl = 99999
+    ftsfs = 90
+    fvetl = 99999
+    fvmnl = 99999
+    fvmxl = 99999
+    landice = .true.
+    ldebug = .false.
+/
+
+&namsfc_dict
+    fnabsc = '../fix_lam/C403.maximum_snow_albedo.tileX.nc'
+    fnalbc = '../fix_lam/C403.snowfree_albedo.tileX.nc'
+    fnalbc2 = '../fix_lam/C403.facsf.tileX.nc'
+    fnslpc = '../fix_lam/C403.slope_type.tileX.nc'
+    fnsotc = '../fix_lam/C403.soil_type.tileX.nc'
+    fntg3c = '../fix_lam/C403.substrate_temperature.tileX.nc'
+    fnvegc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
+    fnvetc = '../fix_lam/C403.vegetation_type.tileX.nc'
+    fnvmnc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
+    fnvmxc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
+/
+
+&surf_map_nml
+/
diff --git a/physics/docs/pdftxt/RE300/namelists/input.nml.v21.FV3_HRRR b/physics/docs/pdftxt/RE300/namelists/input.nml.v21.FV3_HRRR
new file mode 100644
index 000000000..cd9408a4d
--- /dev/null
+++ b/physics/docs/pdftxt/RE300/namelists/input.nml.v21.FV3_HRRR
@@ -0,0 +1,299 @@
+&amip_interp_nml
+    data_set = 'reynolds_oi'
+    date_out_of_range = 'climo'
+    interp_oi_sst = .true.
+    no_anom_sst = .false.
+    use_ncep_ice = .false.
+    use_ncep_sst = .true.
+/
+
+&atmos_model_nml
+    blocksize = 40
+    ccpp_suite = 'FV3_HRRR'
+    chksum_debug = .false.
+    dycore_only = .false.
+/
+
+&cires_ugwp_nml
+    knob_ugwp_azdir = 2, 4, 4, 4
+    knob_ugwp_doaxyz = 1
+    knob_ugwp_doheat = 1
+    knob_ugwp_dokdis = 1
+    knob_ugwp_effac = 1, 1, 1, 1
+    knob_ugwp_ndx4lh = 1
+    knob_ugwp_solver = 2
+    knob_ugwp_source = 1, 1, 0, 0
+    knob_ugwp_stoch = 0, 0, 0, 0
+    knob_ugwp_version = 0
+    knob_ugwp_wvspec = 1, 25, 25, 25
+    launch_level = 25
+/
+
+&diag_manager_nml
+    prepend_date = .false.
+/
+
+&external_ic_nml
+    checker_tr = .false.
+    filtered_terrain = .true.
+    gfs_dwinds = .true.
+    levp = 65
+    nt_checker = 0
+/
+
+&fms_io_nml
+    checksum_required = .false.
+    max_files_r = 100
+    max_files_w = 100
+/
+
+&fms_nml
+    clock_grain = 'ROUTINE'
+    domains_stack_size = 5000000
+    print_memory_usage = .false.
+/
+
+&fv_core_nml
+    a_imp = 1.0
+    adjust_dry_mass = .false.
+    bc_update_interval = 6
+    beta = 0.0
+    consv_am = .false.
+    consv_te = 0.0
+    d2_bg = 0.0
+    d2_bg_k1 = 0.2
+    d2_bg_k2 = 0.04
+    d4_bg = 0.12
+    d_con = 1.0
+    d_ext = 0.0
+    dddmp = 0.1
+    delt_max = 0.008
+    dnats = 0
+    do_sat_adj = .false.
+    do_schmidt = .true.
+    do_vort_damp = .true.
+    dwind_2d = .false.
+    dz_min = 2
+    external_eta = .true.
+    external_ic = .true.
+    fill = .true.
+    full_zs_filter = .false.
+    fv_debug = .false.
+    fv_sg_adj = 300
+    gfs_phil = .false.
+    hord_dp = -5
+    hord_mt = 5
+    hord_tm = 5
+    hord_tr = 10
+    hord_vt = 5
+    hydrostatic = .false.
+    io_layout = 1, 1
+    k_split = 2
+    ke_bg = 0.0
+    kord_mt = 9
+    kord_tm = -9
+    kord_tr = 9
+    kord_wz = 9
+    layout = 5, 2
+    make_nh = .true.
+    mountain = .false.
+    n_split = 5
+    n_sponge = 24
+    n_zs_filter = 0
+    na_init = 1
+    ncep_ic = .false.
+    nggps_ic = .true.
+    no_dycore = .false.
+    nord = 3
+    nord_tr = 2
+    npx = 220
+    npy = 132
+    npz = 64
+    nrows_blend = 10
+    ntiles = 1
+    nudge_qv = .false.
+    nwat = 6
+    p_fac = 0.1
+    phys_hydrostatic = .false.
+    print_freq = 6
+    psm_bc = 1
+    range_warn = .true.
+    read_increment = .false.
+    regional = .true.
+    regional_bcs_from_gsi = .false.
+    res_latlon_dynamics = 'fv3_increment.nc'
+    reset_eta = .false.
+    rf_cutoff = 2000.0
+    stretch_fac = 0.999
+    target_lat = 38.5
+    target_lon = -97.5
+    tau = 5.0
+    use_hydro_pressure = .false.
+    vtdm4 = 0.02
+    warm_start = .false.
+    write_restart_with_bcs = .false.
+    z_tracer = .true.
+/
+
+&fv_grid_nml
+    grid_file = 'INPUT/grid_spec.nc'
+/
+
+&gfs_physics_nml
+    bl_mynn_edmf = 1
+    bl_mynn_edmf_mom = 1
+    bl_mynn_tkeadvect = .true.
+    cal_pre = .false.
+    cdmbgwd = 3.5, 1.0
+    cnvcld = .false.
+    cnvgwd = .false.
+    cplflx = .false.
+    debug = .false.
+    do_deep = .false.
+    do_gsl_drag_ls_bl = .true.
+    do_gsl_drag_ss = .true.
+    do_gsl_drag_tofd = .true.
+    do_mynnedmf = .true.
+    do_mynnsfclay = .true.
+    do_shum = .false.
+    do_skeb = .false.
+    do_spp = .false.
+    do_sppt = .false.
+    dspheat = .true.
+    effr_in = .true.
+    fhcyc = 0
+    fhlwr = 1200.0
+    fhswr = 1200.0
+    fhzero = 1.0
+    gwd_opt = 3
+    h2o_phys = .true.
+    hybedmf = .false.
+    iaer = 5111
+    ialb = 1
+    iau_delthrs = 6
+    iau_inc_files = ''
+    iaufhrs = 30
+    icliq_sw = 2
+    icloud_bl = 1
+    ico2 = 2
+    iems = 1
+    imfdeepcnv = -1
+    imfshalcnv = -1
+    imp_physics = 8
+    iopt_alb = 2
+    iopt_btr = 1
+    iopt_crs = 1
+    iopt_dveg = 2
+    iopt_frz = 1
+    iopt_inf = 1
+    iopt_rad = 1
+    iopt_run = 1
+    iopt_sfc = 1
+    iopt_snf = 4
+    iopt_stc = 1
+    iopt_tbot = 2
+    iopt_trs = 2
+    iovr = 3
+    isol = 2
+    isot = 1
+    isubc_lw = 2
+    isubc_sw = 2
+    ivegsrc = 1
+    kice = 9
+    ldiag3d = .false.
+    lheatstrg = .false.
+    lndp_type = 0
+    lradar = .true.
+    lsm = 3
+    lsoil = 4
+    lsoil_lsm = 9
+    ltaerosol = .true.
+    lwhtr = .true.
+    n_var_lndp = 0
+    n_var_spp = 0
+    nsradar_reset = 3600
+    nst_anl = .true.
+    nstf_name = 2, 1, 0, 0, 0
+    oz_phys = .false.
+    oz_phys_2015 = .true.
+    pdfcld = .false.
+    pre_rad = .false.
+    print_diff_pgr = .false.
+    prslrd0 = 0.0
+    random_clds = .false.
+    redrag = .true.
+    satmedmf = .false.
+    sfclay_compute_flux = .true.
+    shal_cnv = .false.
+    swhtr = .true.
+    trans_trac = .true.
+    ttendlim = -999
+    use_ufo = .true.
+/
+
+&interpolator_nml
+    interp_method = 'conserve_great_circle'
+/
+
+&nam_sfcperts
+/
+
+&nam_sppperts
+/
+
+&nam_stochy
+/
+
+&namsfc
+    fabsl = 99999
+    faisl = 99999
+    faiss = 99999
+    fnacna = ''
+    fnaisc = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/CFSR.SEAICE.1982.2012.monthly.clim.grb'
+    fnglac = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/global_glacier.2x2.grb'
+    fnmskh = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/seaice_newland.grb'
+    fnmxic = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/global_maxice.2x2.grb'
+    fnsmcc = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/global_soilmgldas.t126.384.190.grb'
+    fnsnoa = ''
+    fnsnoc = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/global_snoclim.1.875.grb'
+    fntsfa = ''
+    fntsfc = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/RTGSST.1982.2012.monthly.clim.grb'
+    fnzorc = 'igbp'
+    fsicl = 99999
+    fsics = 99999
+    fslpl = 99999
+    fsmcl = 99999, 99999, 99999
+    fsnol = 99999
+    fsnos = 99999
+    fsotl = 99999
+    ftsfl = 99999
+    ftsfs = 90
+    fvetl = 99999
+    fvmnl = 99999
+    fvmxl = 99999
+    ldebug = .true.
+/
+
+&namsfc_dict
+    fnabsc = '../fix_lam/C403.maximum_snow_albedo.tileX.nc'
+    fnalbc = '../fix_lam/C403.snowfree_albedo.tileX.nc'
+    fnalbc2 = '../fix_lam/C403.facsf.tileX.nc'
+    fnslpc = '../fix_lam/C403.slope_type.tileX.nc'
+    fnsotc = '../fix_lam/C403.soil_type.tileX.nc'
+    fntg3c = '../fix_lam/C403.substrate_temperature.tileX.nc'
+    fnvegc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
+    fnvetc = '../fix_lam/C403.vegetation_type.tileX.nc'
+    fnvmnc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
+    fnvmxc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
+/
+
+&surf_map_nml
+    cd2 = -1
+    cd4 = 0.12
+    max_slope = 0.4
+    n_del2_strong = 0
+    n_del2_weak = 2
+    n_del4 = 1
+    peak_fac = 1.0
+    zero_ocean = .false.
+/
diff --git a/physics/docs/pdftxt/RE300/namelists/input.nml.v21.FV3_RRFS_v1beta b/physics/docs/pdftxt/RE300/namelists/input.nml.v21.FV3_RRFS_v1beta
new file mode 100644
index 000000000..97e775107
--- /dev/null
+++ b/physics/docs/pdftxt/RE300/namelists/input.nml.v21.FV3_RRFS_v1beta
@@ -0,0 +1,291 @@
+&amip_interp_nml
+    data_set = 'reynolds_oi'
+    date_out_of_range = 'climo'
+    interp_oi_sst = .true.
+    no_anom_sst = .false.
+    use_ncep_ice = .false.
+    use_ncep_sst = .true.
+/
+
+&atmos_model_nml
+    blocksize = 40
+    ccpp_suite = 'FV3_RRFS_v1beta'
+    chksum_debug = .false.
+    dycore_only = .false.
+/
+
+&cires_ugwp_nml
+    knob_ugwp_azdir = 2, 4, 4, 4
+    knob_ugwp_doaxyz = 1
+    knob_ugwp_doheat = 1
+    knob_ugwp_dokdis = 1
+    knob_ugwp_effac = 1, 1, 1, 1
+    knob_ugwp_ndx4lh = 1
+    knob_ugwp_solver = 2
+    knob_ugwp_source = 1, 1, 0, 0
+    knob_ugwp_stoch = 0, 0, 0, 0
+    knob_ugwp_version = 0
+    knob_ugwp_wvspec = 1, 25, 25, 25
+    launch_level = 25
+/
+
+&diag_manager_nml
+    prepend_date = .false.
+/
+
+&external_ic_nml
+    checker_tr = .false.
+    filtered_terrain = .true.
+    gfs_dwinds = .true.
+    levp = 65
+    nt_checker = 0
+/
+
+&fms_io_nml
+    checksum_required = .false.
+    max_files_r = 100
+    max_files_w = 100
+/
+
+&fms_nml
+    clock_grain = 'ROUTINE'
+    domains_stack_size = 5000000
+    print_memory_usage = .false.
+/
+
+&fv_core_nml
+    a_imp = 1.0
+    adjust_dry_mass = .false.
+    bc_update_interval = 6
+    beta = 0.0
+    consv_am = .false.
+    consv_te = 0.0
+    d2_bg = 0.0
+    d2_bg_k1 = 0.2
+    d2_bg_k2 = 0.04
+    d4_bg = 0.12
+    d_con = 1.0
+    d_ext = 0.0
+    dddmp = 0.1
+    delt_max = 0.008
+    dnats = 0
+    do_sat_adj = .false.
+    do_schmidt = .true.
+    do_vort_damp = .true.
+    dwind_2d = .false.
+    dz_min = 2
+    external_eta = .true.
+    external_ic = .true.
+    fill = .true.
+    full_zs_filter = .false.
+    fv_debug = .false.
+    fv_sg_adj = 300
+    gfs_phil = .false.
+    hord_dp = 6
+    hord_mt = 6
+    hord_tm = 6
+    hord_tr = 10
+    hord_vt = 6
+    hydrostatic = .false.
+    io_layout = 1, 1
+    k_split = 2
+    ke_bg = 0.0
+    kord_mt = 9
+    kord_tm = -9
+    kord_tr = 9
+    kord_wz = 9
+    layout = 5, 2
+    make_nh = .true.
+    mountain = .false.
+    n_split = 5
+    n_sponge = 24
+    n_zs_filter = 0
+    na_init = 1
+    ncep_ic = .false.
+    nggps_ic = .true.
+    no_dycore = .false.
+    nord = 3
+    npx = 220
+    npy = 132
+    npz = 64
+    nrows_blend = 10
+    ntiles = 1
+    nudge_qv = .false.
+    nwat = 6
+    p_fac = 0.1
+    phys_hydrostatic = .false.
+    print_freq = 6
+    psm_bc = 1
+    range_warn = .true.
+    read_increment = .false.
+    regional = .true.
+    regional_bcs_from_gsi = .false.
+    res_latlon_dynamics = 'fv3_increment.nc'
+    reset_eta = .false.
+    rf_cutoff = 2000.0
+    stretch_fac = 0.999
+    target_lat = 38.5
+    target_lon = -97.5
+    tau = 5.0
+    use_hydro_pressure = .false.
+    vtdm4 = 0.02
+    warm_start = .false.
+    write_restart_with_bcs = .false.
+    z_tracer = .true.
+/
+
+&fv_grid_nml
+    grid_file = 'INPUT/grid_spec.nc'
+/
+
+&gfs_physics_nml
+    bl_mynn_edmf = 1
+    bl_mynn_edmf_mom = 1
+    bl_mynn_tkeadvect = .true.
+    cal_pre = .false.
+    cdmbgwd = 3.5, 0.25
+    cnvcld = .false.
+    cnvgwd = .false.
+    cplflx = .false.
+    debug = .false.
+    do_deep = .false.
+    do_mynnedmf = .true.
+    do_mynnsfclay = .true.
+    do_shum = .false.
+    do_skeb = .false.
+    do_spp = .false.
+    do_sppt = .false.
+    dspheat = .true.
+    effr_in = .true.
+    fhcyc = 0
+    fhlwr = 1200.0
+    fhswr = 1200.0
+    fhzero = 1.0
+    h2o_phys = .true.
+    hybedmf = .false.
+    iaer = 111
+    ialb = 1
+    iau_delthrs = 6
+    iau_inc_files = ''
+    iaufhrs = 30
+    icloud_bl = 1
+    ico2 = 2
+    iems = 1
+    imfdeepcnv = -1
+    imfshalcnv = -1
+    imp_physics = 8
+    iopt_alb = 2
+    iopt_btr = 1
+    iopt_crs = 1
+    iopt_dveg = 2
+    iopt_frz = 1
+    iopt_inf = 1
+    iopt_rad = 1
+    iopt_run = 1
+    iopt_sfc = 1
+    iopt_snf = 4
+    iopt_stc = 1
+    iopt_tbot = 2
+    iopt_trs = 2
+    isol = 2
+    isot = 1
+    isubc_lw = 2
+    isubc_sw = 2
+    ivegsrc = 1
+    ldiag3d = .false.
+    lheatstrg = .false.
+    lndp_type = 0
+    lradar = .true.
+    lsm = 2
+    lsoil = 4
+    lsoil_lsm = 4
+    ltaerosol = .true.
+    lwhtr = .true.
+    n_var_lndp = 0
+    n_var_spp = 0
+    nsradar_reset = 3600
+    nst_anl = .true.
+    nstf_name = 2, 1, 0, 0, 0
+    oz_phys = .false.
+    oz_phys_2015 = .true.
+    pdfcld = .false.
+    pre_rad = .false.
+    print_diff_pgr = .false.
+    prslrd0 = 0.0
+    random_clds = .false.
+    redrag = .true.
+    satmedmf = .false.
+    sfclay_compute_flux = .false.
+    shal_cnv = .false.
+    swhtr = .true.
+    trans_trac = .true.
+    ttendlim = -999
+    use_ufo = .true.
+/
+
+&interpolator_nml
+    interp_method = 'conserve_great_circle'
+/
+
+&nam_sfcperts
+/
+
+&nam_sppperts
+/
+
+&nam_stochy
+/
+
+&namsfc
+    fabsl = 99999
+    faisl = 99999
+    faiss = 99999
+    fnacna = ''
+    fnaisc = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/CFSR.SEAICE.1982.2012.monthly.clim.grb'
+    fnglac = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/global_glacier.2x2.grb'
+    fnmskh = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/seaice_newland.grb'
+    fnmxic = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/global_maxice.2x2.grb'
+    fnsmcc = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/global_soilmgldas.t126.384.190.grb'
+    fnsnoa = ''
+    fnsnoc = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/global_snoclim.1.875.grb'
+    fntsfa = ''
+    fntsfc = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/RTGSST.1982.2012.monthly.clim.grb'
+    fnzorc = 'igbp'
+    fsicl = 99999
+    fsics = 99999
+    fslpl = 99999
+    fsmcl = 99999, 99999, 99999
+    fsnol = 99999
+    fsnos = 99999
+    fsotl = 99999
+    ftsfl = 99999
+    ftsfs = 90
+    fvetl = 99999
+    fvmnl = 99999
+    fvmxl = 99999
+    ldebug = .true.
+/
+
+&namsfc_dict
+    fnabsc = '../fix_lam/C403.maximum_snow_albedo.tileX.nc'
+    fnalbc = '../fix_lam/C403.snowfree_albedo.tileX.nc'
+    fnalbc2 = '../fix_lam/C403.facsf.tileX.nc'
+    fnslpc = '../fix_lam/C403.slope_type.tileX.nc'
+    fnsotc = '../fix_lam/C403.soil_type.tileX.nc'
+    fntg3c = '../fix_lam/C403.substrate_temperature.tileX.nc'
+    fnvegc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
+    fnvetc = '../fix_lam/C403.vegetation_type.tileX.nc'
+    fnvmnc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
+    fnvmxc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
+/
+
+&surf_map_nml
+    cd2 = -1
+    cd4 = 0.12
+    max_slope = 0.4
+    n_del2_strong = 0
+    n_del2_weak = 2
+    n_del4 = 1
+    peak_fac = 1.0
+    zero_ocean = .false.
+/
diff --git a/physics/docs/pdftxt/RE300/namelists/input.nml.v21.FV3_WoFS_v0 b/physics/docs/pdftxt/RE300/namelists/input.nml.v21.FV3_WoFS_v0
new file mode 100644
index 000000000..94cc34d0f
--- /dev/null
+++ b/physics/docs/pdftxt/RE300/namelists/input.nml.v21.FV3_WoFS_v0
@@ -0,0 +1,297 @@
+&amip_interp_nml
+    data_set = 'reynolds_oi'
+    date_out_of_range = 'climo'
+    interp_oi_sst = .true.
+    no_anom_sst = .false.
+    use_ncep_ice = .false.
+    use_ncep_sst = .true.
+/
+
+&atmos_model_nml
+    blocksize = 40
+    ccpp_suite = 'FV3_WoFS_v0'
+    chksum_debug = .false.
+    dycore_only = .false.
+/
+
+&cires_ugwp_nml
+    knob_ugwp_azdir = 2, 4, 4, 4
+    knob_ugwp_doaxyz = 1
+    knob_ugwp_doheat = 1
+    knob_ugwp_dokdis = 1
+    knob_ugwp_effac = 1, 1, 1, 1
+    knob_ugwp_ndx4lh = 1
+    knob_ugwp_solver = 2
+    knob_ugwp_source = 1, 1, 0, 0
+    knob_ugwp_stoch = 0, 0, 0, 0
+    knob_ugwp_version = 0
+    knob_ugwp_wvspec = 1, 25, 25, 25
+    launch_level = 25
+/
+
+&diag_manager_nml
+    prepend_date = .false.
+/
+
+&external_ic_nml
+    checker_tr = .false.
+    filtered_terrain = .true.
+    gfs_dwinds = .true.
+    levp = 65
+    nt_checker = 0
+/
+
+&fms_io_nml
+    checksum_required = .false.
+    max_files_r = 100
+    max_files_w = 100
+/
+
+&fms_nml
+    clock_grain = 'ROUTINE'
+    domains_stack_size = 5000000
+    print_memory_usage = .false.
+/
+
+&fv_core_nml
+    a_imp = 1.0
+    adjust_dry_mass = .false.
+    bc_update_interval = 6
+    beta = 0.0
+    consv_am = .false.
+    consv_te = 0.0
+    d2_bg = 0.0
+    d2_bg_k1 = 0.2
+    d2_bg_k2 = 0.04
+    d4_bg = 0.12
+    d_con = 1.0
+    d_ext = 0.0
+    dddmp = 0.1
+    delt_max = 0.008
+    dnats = 0
+    do_sat_adj = .false.
+    do_schmidt = .true.
+    do_vort_damp = .true.
+    dwind_2d = .false.
+    dz_min = 2
+    external_eta = .true.
+    external_ic = .true.
+    fill = .true.
+    full_zs_filter = .false.
+    fv_debug = .false.
+    fv_sg_adj = 300
+    gfs_phil = .false.
+    hord_dp = 6
+    hord_mt = 6
+    hord_tm = 6
+    hord_tr = 10
+    hord_vt = 6
+    hydrostatic = .false.
+    io_layout = 1, 1
+    k_split = 2
+    ke_bg = 0.0
+    kord_mt = 9
+    kord_tm = -9
+    kord_tr = 9
+    kord_wz = 9
+    layout = 5, 2
+    make_nh = .true.
+    mountain = .false.
+    n_split = 5
+    n_sponge = 24
+    n_zs_filter = 0
+    na_init = 1
+    ncep_ic = .false.
+    nggps_ic = .true.
+    no_dycore = .false.
+    nord = 3
+    npx = 220
+    npy = 132
+    npz = 64
+    nrows_blend = 10
+    ntiles = 1
+    nudge_qv = .false.
+    nwat = 7
+    p_fac = 0.1
+    phys_hydrostatic = .false.
+    print_freq = 6
+    psm_bc = 1
+    range_warn = .true.
+    read_increment = .false.
+    regional = .true.
+    regional_bcs_from_gsi = .false.
+    res_latlon_dynamics = 'fv3_increment.nc'
+    reset_eta = .false.
+    rf_cutoff = 2000.0
+    stretch_fac = 0.999
+    target_lat = 38.5
+    target_lon = -97.5
+    tau = 5.0
+    use_hydro_pressure = .false.
+    vtdm4 = 0.02
+    warm_start = .false.
+    write_restart_with_bcs = .false.
+    z_tracer = .true.
+/
+
+&fv_diagnostics_nml
+    do_hailcast = .true.
+/
+
+&fv_grid_nml
+    grid_file = 'INPUT/grid_spec.nc'
+/
+
+&gfs_physics_nml
+    bl_mynn_edmf = 1
+    bl_mynn_edmf_mom = 1
+    bl_mynn_tkeadvect = .true.
+    cal_pre = .false.
+    cdmbgwd = 3.5, 0.25
+    cnvcld = .false.
+    cnvgwd = .false.
+    cplflx = .false.
+    debug = .false.
+    do_deep = .false.
+    do_mynnedmf = .true.
+    do_mynnsfclay = .true.
+    do_shum = .false.
+    do_skeb = .false.
+    do_spp = .false.
+    do_sppt = .false.
+    dspheat = .true.
+    effr_in = .true.
+    fhcyc = 0
+    fhlwr = 1200.0
+    fhswr = 1200.0
+    fhzero = 1.0
+    h2o_phys = .true.
+    hybedmf = .false.
+    iaer = 111
+    ialb = 1
+    iau_delthrs = 6
+    iau_inc_files = ''
+    iaufhrs = 30
+    icloud_bl = 1
+    ico2 = 2
+    iems = 1
+    imfdeepcnv = -1
+    imfshalcnv = -1
+    imp_physics = 17
+    iopt_alb = 2
+    iopt_btr = 1
+    iopt_crs = 1
+    iopt_dveg = 2
+    iopt_frz = 1
+    iopt_inf = 1
+    iopt_rad = 1
+    iopt_run = 1
+    iopt_sfc = 1
+    iopt_snf = 4
+    iopt_stc = 1
+    iopt_tbot = 2
+    isol = 2
+    isot = 1
+    isubc_lw = 2
+    isubc_sw = 2
+    ivegsrc = 1
+    ldiag3d = .false.
+    lheatstrg = .false.
+    lndp_type = 0
+    lradar = .true.
+    lsm = 1
+    lsoil = 4
+    lsoil_lsm = 4
+    ltaerosol = .true.
+    lwhtr = .true.
+    n_var_lndp = 0
+    n_var_spp = 0
+    nsradar_reset = 3600
+    nssl_cccn = 600000000.0
+    nssl_ccn_on = .true.
+    nssl_hail_on = .true.
+    nst_anl = .true.
+    nstf_name = 2, 1, 0, 0, 0
+    oz_phys = .false.
+    oz_phys_2015 = .true.
+    pdfcld = .false.
+    pre_rad = .false.
+    print_diff_pgr = .false.
+    prslrd0 = 0.0
+    random_clds = .false.
+    redrag = .true.
+    satmedmf = .false.
+    sfclay_compute_flux = .false.
+    shal_cnv = .false.
+    swhtr = .true.
+    trans_trac = .true.
+    ttendlim = -999
+    use_ufo = .true.
+/
+
+&interpolator_nml
+    interp_method = 'conserve_great_circle'
+/
+
+&nam_sfcperts
+/
+
+&nam_sppperts
+/
+
+&nam_stochy
+/
+
+&namsfc
+    fabsl = 99999
+    faisl = 99999
+    faiss = 99999
+    fnacna = ''
+    fnaisc = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/CFSR.SEAICE.1982.2012.monthly.clim.grb'
+    fnglac = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/global_glacier.2x2.grb'
+    fnmskh = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/seaice_newland.grb'
+    fnmxic = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/global_maxice.2x2.grb'
+    fnsmcc = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/global_soilmgldas.t126.384.190.grb'
+    fnsnoa = ''
+    fnsnoc = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/global_snoclim.1.875.grb'
+    fntsfa = ''
+    fntsfc = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/RTGSST.1982.2012.monthly.clim.grb'
+    fnzorc = 'igbp'
+    fsicl = 99999
+    fsics = 99999
+    fslpl = 99999
+    fsmcl = 99999, 99999, 99999
+    fsnol = 99999
+    fsnos = 99999
+    fsotl = 99999
+    ftsfl = 99999
+    ftsfs = 90
+    fvetl = 99999
+    fvmnl = 99999
+    fvmxl = 99999
+    ldebug = .true.
+/
+
+&namsfc_dict
+    fnabsc = '../fix_lam/C403.maximum_snow_albedo.tileX.nc'
+    fnalbc = '../fix_lam/C403.snowfree_albedo.tileX.nc'
+    fnalbc2 = '../fix_lam/C403.facsf.tileX.nc'
+    fnslpc = '../fix_lam/C403.slope_type.tileX.nc'
+    fnsotc = '../fix_lam/C403.soil_type.tileX.nc'
+    fntg3c = '../fix_lam/C403.substrate_temperature.tileX.nc'
+    fnvegc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
+    fnvetc = '../fix_lam/C403.vegetation_type.tileX.nc'
+    fnvmnc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
+    fnvmxc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
+/
+
+&surf_map_nml
+    cd2 = -1
+    cd4 = 0.12
+    max_slope = 0.4
+    n_del2_strong = 0
+    n_del2_weak = 2
+    n_del4 = 1
+    peak_fac = 1.0
+    zero_ocean = .false.
+/
diff --git a/physics/docs/pdftxt/RE300/suite_FV3_GFS_v16.xml b/physics/docs/pdftxt/RE300/suite_FV3_GFS_v16.xml
new file mode 100644
index 000000000..122b937e1
--- /dev/null
+++ b/physics/docs/pdftxt/RE300/suite_FV3_GFS_v16.xml
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<suite name="FV3_GFS_v16" version="1">
+  <!-- <init></init> -->
+  <group name="fast_physics">
+    <subcycle loop="1">
+      <scheme>fv_sat_adj</scheme>
+    </subcycle>
+  </group>
+  <group name="time_vary">
+    <subcycle loop="1">
+      <scheme>GFS_time_vary_pre</scheme>
+      <scheme>GFS_rrtmg_setup</scheme>
+      <scheme>GFS_rad_time_vary</scheme>
+      <scheme>GFS_phys_time_vary</scheme>
+    </subcycle>
+  </group>
+  <group name="radiation">
+    <subcycle loop="1">
+      <scheme>GFS_suite_interstitial_rad_reset</scheme>
+      <scheme>GFS_rrtmg_pre</scheme>
+      <scheme>GFS_radiation_surface</scheme>
+      <scheme>rad_sw_pre</scheme>
+      <scheme>rrtmg_sw</scheme>
+      <scheme>rrtmg_sw_post</scheme>
+      <scheme>rrtmg_lw_pre</scheme>
+      <scheme>rrtmg_lw</scheme>
+      <scheme>rrtmg_lw_post</scheme>
+      <scheme>GFS_rrtmg_post</scheme>
+    </subcycle>
+  </group>
+  <group name="physics">
+    <subcycle loop="1">
+      <scheme>GFS_suite_interstitial_phys_reset</scheme>
+      <scheme>GFS_suite_stateout_reset</scheme>
+      <scheme>get_prs_fv3</scheme>
+      <scheme>GFS_suite_interstitial_1</scheme>
+      <scheme>GFS_surface_generic_pre</scheme>
+      <scheme>GFS_surface_composites_pre</scheme>
+      <scheme>dcyc2t3</scheme>
+      <scheme>GFS_surface_composites_inter</scheme>
+      <scheme>GFS_suite_interstitial_2</scheme>
+    </subcycle>
+    <!-- Surface iteration loop -->
+    <subcycle loop="2">
+      <scheme>sfc_diff</scheme>
+      <scheme>GFS_surface_loop_control_part1</scheme>
+      <scheme>sfc_nst_pre</scheme>
+      <scheme>sfc_nst</scheme>
+      <scheme>sfc_nst_post</scheme>
+      <scheme>lsm_noah</scheme>
+      <scheme>sfc_sice</scheme>
+      <scheme>GFS_surface_loop_control_part2</scheme>
+    </subcycle>
+    <!-- End of surface iteration loop -->
+    <subcycle loop="1">
+      <scheme>GFS_surface_composites_post</scheme>
+      <scheme>sfc_diag</scheme>
+      <scheme>sfc_diag_post</scheme>
+      <scheme>GFS_surface_generic_post</scheme>
+      <scheme>GFS_PBL_generic_pre</scheme>
+      <scheme>satmedmfvdifq</scheme>
+      <scheme>GFS_PBL_generic_post</scheme>
+      <scheme>GFS_GWD_generic_pre</scheme>
+      <scheme>cires_ugwp</scheme>
+      <scheme>cires_ugwp_post</scheme>
+      <scheme>GFS_GWD_generic_post</scheme>
+      <scheme>GFS_suite_stateout_update</scheme>
+      <scheme>ozphys_2015</scheme>
+      <scheme>h2ophys</scheme>
+      <scheme>get_phi_fv3</scheme>
+      <scheme>GFS_suite_interstitial_3</scheme>
+      <scheme>GFS_DCNV_generic_pre</scheme>
+      <scheme>samfdeepcnv</scheme>
+      <scheme>GFS_DCNV_generic_post</scheme>
+      <scheme>GFS_SCNV_generic_pre</scheme>
+      <scheme>samfshalcnv</scheme>
+      <scheme>GFS_SCNV_generic_post</scheme>
+      <scheme>GFS_suite_interstitial_4</scheme>
+      <scheme>cnvc90</scheme>
+      <scheme>GFS_MP_generic_pre</scheme>
+      <scheme>gfdl_cloud_microphys</scheme>
+      <scheme>GFS_MP_generic_post</scheme>
+      <scheme>maximum_hourly_diagnostics</scheme>
+      <scheme>phys_tend</scheme>
+    </subcycle>
+  </group>
+  <group name="stochastics">
+    <subcycle loop="1">
+      <scheme>GFS_stochastics</scheme>
+    </subcycle>
+  </group>
+  <!-- <finalize></finalize> -->
+</suite>
diff --git a/physics/docs/pdftxt/RE300/suite_FV3_HRRR.xml b/physics/docs/pdftxt/RE300/suite_FV3_HRRR.xml
new file mode 100644
index 000000000..6ac35db14
--- /dev/null
+++ b/physics/docs/pdftxt/RE300/suite_FV3_HRRR.xml
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<suite name="FV3_HRRR" version="1">
+  <!-- <init></init> -->
+  <group name="time_vary">
+    <subcycle loop="1">
+      <scheme>GFS_time_vary_pre</scheme>
+      <scheme>GFS_rrtmg_setup</scheme>
+      <scheme>GFS_rad_time_vary</scheme>
+      <scheme>GFS_phys_time_vary</scheme>
+    </subcycle>
+  </group>
+  <group name="radiation">
+    <subcycle loop="1">
+      <scheme>GFS_suite_interstitial_rad_reset</scheme>
+      <scheme>sgscloud_radpre</scheme>
+      <scheme>GFS_rrtmg_pre</scheme>
+      <scheme>GFS_radiation_surface</scheme>
+      <scheme>rad_sw_pre</scheme>
+      <scheme>rrtmg_sw</scheme>
+      <scheme>rrtmg_sw_post</scheme>
+      <scheme>rrtmg_lw_pre</scheme>
+      <scheme>rrtmg_lw</scheme>
+      <scheme>sgscloud_radpost</scheme>
+      <scheme>rrtmg_lw_post</scheme>
+      <scheme>GFS_rrtmg_post</scheme>
+    </subcycle>
+  </group>
+  <group name="physics">
+    <subcycle loop="1">
+      <scheme>GFS_suite_interstitial_phys_reset</scheme>
+      <scheme>GFS_suite_stateout_reset</scheme>
+      <scheme>get_prs_fv3</scheme>
+      <scheme>GFS_suite_interstitial_1</scheme>
+      <scheme>GFS_surface_generic_pre</scheme>
+      <scheme>GFS_surface_composites_pre</scheme>
+      <scheme>dcyc2t3</scheme>
+      <scheme>GFS_surface_composites_inter</scheme>
+      <scheme>GFS_suite_interstitial_2</scheme>
+    </subcycle>
+    <!-- Surface iteration loop -->
+    <subcycle loop="2">
+      <scheme>mynnsfc_wrapper</scheme>
+      <scheme>GFS_surface_loop_control_part1</scheme>
+      <scheme>lsm_ruc</scheme>
+      <scheme>clm_lake</scheme>
+      <scheme>GFS_surface_loop_control_part2</scheme>
+    </subcycle>
+    <!-- End of surface iteration loop -->
+    <subcycle loop="1">
+      <scheme>GFS_surface_composites_post</scheme>
+      <scheme>sfc_diag</scheme>
+      <scheme>sfc_diag_post</scheme>
+      <scheme>GFS_surface_generic_post</scheme>
+      <scheme>rrfs_smoke_wrapper</scheme>
+      <scheme>mynnedmf_wrapper</scheme>
+      <scheme>rrfs_smoke_postpbl</scheme>
+      <scheme>GFS_GWD_generic_pre</scheme>
+      <scheme>drag_suite</scheme>
+      <scheme>GFS_GWD_generic_post</scheme>
+      <scheme>GFS_suite_stateout_update</scheme>
+      <scheme>ozphys_2015</scheme>
+      <scheme>h2ophys</scheme>
+      <scheme>get_phi_fv3</scheme>
+      <scheme>GFS_suite_interstitial_3</scheme>
+      <scheme>GFS_suite_interstitial_4</scheme>
+      <scheme>GFS_MP_generic_pre</scheme>
+      <scheme>mp_thompson_pre</scheme>
+      <scheme>mp_thompson</scheme>
+      <scheme>mp_thompson_post</scheme>
+      <scheme>GFS_MP_generic_post</scheme>
+      <scheme>maximum_hourly_diagnostics</scheme>
+      <scheme>phys_tend</scheme>
+    </subcycle>
+  </group>
+  <group name="stochastics">
+    <subcycle loop="1">
+      <scheme>GFS_stochastics</scheme>
+    </subcycle>
+  </group>
+  <!-- <finalize></finalize> -->
+</suite>
diff --git a/physics/docs/pdftxt/RE300/suite_FV3_RAP.xml b/physics/docs/pdftxt/RE300/suite_FV3_RAP.xml
new file mode 100644
index 000000000..f03c1a1e8
--- /dev/null
+++ b/physics/docs/pdftxt/RE300/suite_FV3_RAP.xml
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<suite name="FV3_RAP" version="1">
+  <!-- <init></init> -->
+  <group name="time_vary">
+    <subcycle loop="1">
+      <scheme>GFS_time_vary_pre</scheme>
+      <scheme>GFS_rrtmg_setup</scheme>
+      <scheme>GFS_rad_time_vary</scheme>
+      <scheme>GFS_phys_time_vary</scheme>
+    </subcycle>
+  </group>
+  <group name="radiation">
+    <subcycle loop="1">
+      <scheme>GFS_suite_interstitial_rad_reset</scheme>
+      <scheme>sgscloud_radpre</scheme>
+      <scheme>GFS_rrtmg_pre</scheme>
+      <scheme>GFS_radiation_surface</scheme>
+      <scheme>rad_sw_pre</scheme>
+      <scheme>rrtmg_sw</scheme>
+      <scheme>rrtmg_sw_post</scheme>
+      <scheme>rrtmg_lw_pre</scheme>
+      <scheme>rrtmg_lw</scheme>
+      <scheme>sgscloud_radpost</scheme>
+      <scheme>rrtmg_lw_post</scheme>
+      <scheme>GFS_rrtmg_post</scheme>
+    </subcycle>
+  </group>
+  <group name="physics">
+    <subcycle loop="1">
+      <scheme>GFS_suite_interstitial_phys_reset</scheme>
+      <scheme>GFS_suite_stateout_reset</scheme>
+      <scheme>get_prs_fv3</scheme>
+      <scheme>GFS_suite_interstitial_1</scheme>
+      <scheme>GFS_surface_generic_pre</scheme>
+      <scheme>GFS_surface_composites_pre</scheme>
+      <scheme>dcyc2t3</scheme>
+      <scheme>GFS_surface_composites_inter</scheme>
+      <scheme>GFS_suite_interstitial_2</scheme>
+    </subcycle>
+    <!-- Surface iteration loop -->
+    <subcycle loop="2">
+      <scheme>mynnsfc_wrapper</scheme>
+      <scheme>GFS_surface_loop_control_part1</scheme>
+      <scheme>sfc_nst_pre</scheme>
+      <scheme>sfc_nst</scheme>
+      <scheme>sfc_nst_post</scheme>
+      <scheme>lsm_ruc</scheme>
+      <scheme>GFS_surface_loop_control_part2</scheme>
+    </subcycle>
+    <!-- End of surface iteration loop -->
+    <subcycle loop="1">
+      <scheme>GFS_surface_composites_post</scheme>
+      <scheme>sfc_diag</scheme>
+      <scheme>sfc_diag_post</scheme>
+      <scheme>GFS_surface_generic_post</scheme>
+      <scheme>mynnedmf_wrapper</scheme>
+      <scheme>GFS_GWD_generic_pre</scheme>
+      <scheme>drag_suite</scheme>
+      <scheme>GFS_GWD_generic_post</scheme>
+      <scheme>GFS_suite_stateout_update</scheme>
+      <scheme>ozphys_2015</scheme>
+      <scheme>h2ophys</scheme>
+      <scheme>get_phi_fv3</scheme>
+      <scheme>GFS_suite_interstitial_3</scheme>
+      <scheme>GFS_DCNV_generic_pre</scheme>
+      <scheme>cu_gf_driver_pre</scheme>
+      <scheme>cu_gf_driver</scheme>
+      <scheme>GFS_DCNV_generic_post</scheme>
+      <scheme>GFS_SCNV_generic_pre</scheme>
+      <scheme>GFS_SCNV_generic_post</scheme>
+      <scheme>GFS_suite_interstitial_4</scheme>
+      <scheme>cnvc90</scheme>
+      <scheme>GFS_MP_generic_pre</scheme>
+      <scheme>mp_thompson_pre</scheme>
+      <scheme>mp_thompson</scheme>
+      <scheme>mp_thompson_post</scheme>
+      <scheme>GFS_MP_generic_post</scheme>
+      <scheme>cu_gf_driver_post</scheme>
+      <scheme>maximum_hourly_diagnostics</scheme>
+      <scheme>phys_tend</scheme>
+    </subcycle>
+  </group>
+  <group name="stochastics">
+    <subcycle loop="1">
+      <scheme>GFS_stochastics</scheme>
+    </subcycle>
+  </group>
+  <!-- <finalize></finalize> -->
+</suite>
diff --git a/physics/docs/pdftxt/RE300/suite_FV3_RRFS_v1beta.xml b/physics/docs/pdftxt/RE300/suite_FV3_RRFS_v1beta.xml
new file mode 100644
index 000000000..97228c0a6
--- /dev/null
+++ b/physics/docs/pdftxt/RE300/suite_FV3_RRFS_v1beta.xml
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<suite name="FV3_RRFS_v1beta" version="1">
+  <!-- <init></init> -->
+  <group name="time_vary">
+    <subcycle loop="1">
+      <scheme>GFS_time_vary_pre</scheme>
+      <scheme>GFS_rrtmg_setup</scheme>
+      <scheme>GFS_rad_time_vary</scheme>
+      <scheme>GFS_phys_time_vary</scheme>
+    </subcycle>
+  </group>
+  <group name="radiation">
+    <subcycle loop="1">
+      <scheme>GFS_suite_interstitial_rad_reset</scheme>
+      <scheme>sgscloud_radpre</scheme>
+      <scheme>GFS_rrtmg_pre</scheme>
+      <scheme>GFS_radiation_surface</scheme>
+      <scheme>rad_sw_pre</scheme>
+      <scheme>rrtmg_sw</scheme>
+      <scheme>rrtmg_sw_post</scheme>
+      <scheme>rrtmg_lw_pre</scheme>
+      <scheme>rrtmg_lw</scheme>
+      <scheme>sgscloud_radpost</scheme>
+      <scheme>rrtmg_lw_post</scheme>
+      <scheme>GFS_rrtmg_post</scheme>
+    </subcycle>
+  </group>
+  <group name="physics">
+    <subcycle loop="1">
+      <scheme>GFS_suite_interstitial_phys_reset</scheme>
+      <scheme>GFS_suite_stateout_reset</scheme>
+      <scheme>get_prs_fv3</scheme>
+      <scheme>GFS_suite_interstitial_1</scheme>
+      <scheme>GFS_surface_generic_pre</scheme>
+      <scheme>GFS_surface_composites_pre</scheme>
+      <scheme>dcyc2t3</scheme>
+      <scheme>GFS_surface_composites_inter</scheme>
+      <scheme>GFS_suite_interstitial_2</scheme>
+    </subcycle>
+    <!-- Surface iteration loop -->
+    <subcycle loop="2">
+      <scheme>mynnsfc_wrapper</scheme>
+      <scheme>GFS_surface_loop_control_part1</scheme>
+      <scheme>sfc_nst_pre</scheme>
+      <scheme>sfc_nst</scheme>
+      <scheme>sfc_nst_post</scheme>
+      <scheme>noahmpdrv</scheme>
+      <scheme>sfc_sice</scheme>
+      <scheme>GFS_surface_loop_control_part2</scheme>
+    </subcycle>
+    <!-- End of surface iteration loop -->
+    <subcycle loop="1">
+      <scheme>GFS_surface_composites_post</scheme>
+      <scheme>sfc_diag</scheme>
+      <scheme>sfc_diag_post</scheme>
+      <scheme>GFS_surface_generic_post</scheme>
+      <scheme>mynnedmf_wrapper</scheme>
+      <scheme>GFS_GWD_generic_pre</scheme>
+      <scheme>cires_ugwp</scheme>
+      <scheme>cires_ugwp_post</scheme>
+      <scheme>GFS_GWD_generic_post</scheme>
+      <scheme>GFS_suite_stateout_update</scheme>
+      <scheme>ozphys_2015</scheme>
+      <scheme>h2ophys</scheme>
+      <scheme>get_phi_fv3</scheme>
+      <scheme>GFS_suite_interstitial_3</scheme>
+      <scheme>GFS_suite_interstitial_4</scheme>
+      <scheme>GFS_MP_generic_pre</scheme>
+      <scheme>mp_thompson_pre</scheme>
+      <scheme>mp_thompson</scheme>
+      <scheme>mp_thompson_post</scheme>
+      <scheme>GFS_MP_generic_post</scheme>
+      <scheme>maximum_hourly_diagnostics</scheme>
+      <scheme>phys_tend</scheme>
+    </subcycle>
+  </group>
+  <group name="stochastics">
+    <subcycle loop="1">
+      <scheme>GFS_stochastics</scheme>
+    </subcycle>
+  </group>
+  <!-- <finalize></finalize> -->
+</suite>
diff --git a/physics/docs/pdftxt/RE300/suite_FV3_WoFS_v0.xml b/physics/docs/pdftxt/RE300/suite_FV3_WoFS_v0.xml
new file mode 100644
index 000000000..1a34ba1a1
--- /dev/null
+++ b/physics/docs/pdftxt/RE300/suite_FV3_WoFS_v0.xml
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<suite name="FV3_WoFS_v0"  version="1">
+  <!-- <init></init> -->
+  <group name="time_vary">
+    <subcycle loop="1">
+      <scheme>GFS_time_vary_pre</scheme>
+      <scheme>GFS_rrtmg_setup</scheme>
+      <scheme>GFS_rad_time_vary</scheme>
+      <scheme>GFS_phys_time_vary</scheme>
+    </subcycle>
+  </group>
+  <group name="radiation">
+    <subcycle loop="1">
+      <scheme>GFS_suite_interstitial_rad_reset</scheme>
+      <scheme>sgscloud_radpre</scheme>
+      <scheme>GFS_rrtmg_pre</scheme>
+      <scheme>GFS_radiation_surface</scheme>
+      <scheme>rad_sw_pre</scheme>
+      <scheme>rrtmg_sw</scheme>
+      <scheme>rrtmg_sw_post</scheme>
+      <scheme>rrtmg_lw_pre</scheme>
+      <scheme>rrtmg_lw</scheme>
+      <scheme>sgscloud_radpost</scheme>
+      <scheme>rrtmg_lw_post</scheme>
+      <scheme>GFS_rrtmg_post</scheme>
+    </subcycle>
+  </group>
+  <group name="physics">
+    <subcycle loop="1">
+      <scheme>GFS_suite_interstitial_phys_reset</scheme>
+      <scheme>GFS_suite_stateout_reset</scheme>
+      <scheme>get_prs_fv3</scheme>
+      <scheme>GFS_suite_interstitial_1</scheme>
+      <scheme>GFS_surface_generic_pre</scheme>
+      <scheme>GFS_surface_composites_pre</scheme>
+      <scheme>dcyc2t3</scheme>
+      <scheme>GFS_surface_composites_inter</scheme>
+      <scheme>GFS_suite_interstitial_2</scheme>
+    </subcycle>
+    <!-- Surface iteration loop -->
+    <subcycle loop="2">
+      <scheme>mynnsfc_wrapper</scheme>
+      <scheme>GFS_surface_loop_control_part1</scheme>
+      <scheme>sfc_nst_pre</scheme>
+      <scheme>sfc_nst</scheme>
+      <scheme>sfc_nst_post</scheme>
+      <scheme>lsm_noah</scheme>
+      <scheme>sfc_sice</scheme>
+      <scheme>GFS_surface_loop_control_part2</scheme>
+    </subcycle>
+    <!-- End of surface iteration loop -->
+    <subcycle loop="1">
+      <scheme>GFS_surface_composites_post</scheme>
+      <scheme>sfc_diag</scheme>
+      <scheme>sfc_diag_post</scheme>
+      <scheme>GFS_surface_generic_post</scheme>
+      <scheme>mynnedmf_wrapper</scheme>
+      <scheme>GFS_GWD_generic_pre</scheme>
+      <scheme>cires_ugwp</scheme>
+      <scheme>cires_ugwp_post</scheme>
+      <scheme>GFS_GWD_generic_post</scheme>
+      <scheme>GFS_suite_stateout_update</scheme>
+      <scheme>ozphys_2015</scheme>
+      <scheme>h2ophys</scheme>
+      <scheme>get_phi_fv3</scheme>
+      <scheme>GFS_MP_generic_pre</scheme>
+      <scheme>mp_nssl</scheme>
+      <scheme>GFS_MP_generic_post</scheme>
+      <scheme>maximum_hourly_diagnostics</scheme>
+      <scheme>phys_tend</scheme>
+    </subcycle>
+  </group>
+  <group name="stochastics">
+    <subcycle loop="1">
+      <scheme>GFS_stochastics</scheme>
+    </subcycle>
+  </group>
+  <!-- <finalize></finalize> -->
+</suite>
diff --git a/physics/docs/pdftxt/RUCLSM.txt b/physics/docs/pdftxt/RUCLSM.txt
index 00b064e5f..461348aa4 100644
--- a/physics/docs/pdftxt/RUCLSM.txt
+++ b/physics/docs/pdftxt/RUCLSM.txt
@@ -9,11 +9,11 @@ as part of the RAP from 2012 through the present and as part of HRRR from 2014 t
 processes in the RUC LSM (Smirnova et al. 2016 \cite Smirnova_2016 ) have proven to be physically robust and capable of realistically representing 
 the evolution of soil moisture, soil temperature, and snow in cycled models. Extension of the RAP domain to encompass all of North America and 
 adjacent high-latitude ocean areas necessitated further development of the RUC LSM for application in the tundra permafrost regions and over Arctic 
-sea ice (Smirnova et al. 2000 \cite Smirnova_2000). Other modifications include refinements in the snow model and a more accurate specification of 
-albedo, roughness length, and other surface properties. These recent modifications in the RUC LSM are described and evaluated in 
+sea ice (Smirnova et al. 2000 \cite Smirnova_2000). Other modifications include refinements in the snow model (snow "mosaic" approach, improvements in computation of snow cover fraction and snow thermal conductivity) and a more accurate specification of 
+albedo, roughness length, and other surface properties. Some of these recent modifications in the RUC LSM are described and evaluated in 
 Smirnova et al. 2016 \cite Smirnova_2016 .
 
-The parameterizations in the RUC LSM describe complicated atmosphere–land surface interactions in an intentionally simplified fashion to avoid 
+The parameterizations in the RUC LSM describe complicated atmosphere–land surface interactions (Fig.1) in an intentionally simplified fashion to avoid 
 excessive sensitivity to multiple uncertain surface parameters. Nevertheless, the RUC LSM, when coupled with the hourly-assimilating atmospheric model, 
 demonstrated over years of ongoing cycling (Benjamin et al. 2004a,b \cite Benjamin_2004a \cite Benjamin_2004b ; Berbery et al. 1999 \cite Berbery_1999) 
 that it can produce a realistic evolution of hydrologic and time-varying soil fields (i.e., soil moisture and temperature) that cannot be directly 
@@ -28,88 +28,93 @@ included in phase 2(d) of the Project for the Intercomparison of Land Surface Pr
 Luo et al. 2003 \cite Luo_2003 ). The RUC LSM was also tested during the Snow Models Intercomparison Project (SnowMIP, SnowMIP2, ESM-SnowMIP), 
 with emphasis on snow parameterizations for both grassland and forest locations in different parts of the world 
 (Etchevers et al. 2002, 2004 \cite Etchevers_2002 \cite Etchevers_2004; Essery et al. 2009 \cite Essery_2009 ; Rutter et al. 2009 \cite Rutter_2009 , 
-Krinner et al. 2018 \cite Krinner_2018 ). The analysis of RUC LSM performance over 10 reference sites in ESM-SnowMIP rated it on the 5th place 
+Krinner et al. 2018 \cite Krinner_2018 ). The analysis of RUC LSM performance over 10 reference sites in ESM-SnowMIP rated it on the 4th place 
 among the 26 participating models. The results were published in Menard et al.(2021) \cite Menard_2021 and Essery et al. (2020) \cite essery_et_al_2020.
 RUC LSM received high rankings in ESM-SnowMIP experiement in terms of multi-year snow cover and surface temperature simulations
-for several sites located in different parts of the world (Menard et al.2021 \cite Menard_2021).
+for several sites located in different parts of the world (Fig.2, Menard et al.2021 \cite Menard_2021).
 
-RUC LSM is used in several weather prediction models around the world (Austria, New Zealand, Switzerland, RAP/HRRR in US). Recent RUC LSM implementation in the high-resolution model in the Swiss Alps led to some small modifications and adjustments to the snow model.
-These adjustments will be available in the next CCPP public release.
+RUC LSM is used in several weather prediction models around the world (Austria, New Zealand, Switzerland, RAP/HRRR in US). Recent RUC LSM implementation in the 1km-resolution model over Europe revealed some issues in the snow-covered high terrain (Swiss Alps), and this led to some small modifications and adjustments to the snow model.
+These adjustments are available in the current CCPP public release.
 
-
-Coupling of the RUC LSM to physically-based stochastic snow model (He et al.(2021) \cite he_et_al_2021) will be implemented in the next public release.
+Coupling of the RUC LSM to physically-based stochastic snow model (He et al.(2021) \cite he_et_al_2021) is also available in the current public release.
 
 The sensitivity of surface fluxes and turbine-height winds to the RUC LSM parameters has been explored by Geng Xia, NREL. This study
 will determine the uncertainty range for the selected parameters in the RUC LSM and will be described in the journal paper.
 ## RUC LSM characteristics that differ from NOAH LSM:
-\image html ruc_lsm_veg_soil.png "Figure 1. RUC LSM Vegetation and Soil Model (Courtesy of T.G. Smirnova) " width=900
+\image html ruc_lsm_veg_soil.png "Figure 1: RUC LSM Vegetation and Soil Model (Courtesy of T.G. Smirnova) " width=900
+\image html ruc_ranking.png "Figure 2: Model ranking as a function of normalized root mean square error of snow water equivalent and surface temperature (Courtesy of C. Menard)" width=900
 - \b Implicit \b solution of energy and moisture budgets in the layer spanning the ground surface
 - \b 9 \b soil \b levels with high vertical resolution near surface
-RUC LSM has more levels in oil than \ref GFS_NOAH model with higher resolution near the interface with the atmosphere
+RUC LSM has more levels in soil than \ref GFS_NOAH model with higher resolution near the interface with the atmosphere
 - \b Prognostic \b soil moisture variable (\f$\theta-\theta_r\f$)
 The prognostic variables for soil moisture is volumetric soil moisture content minus residual value of soil moisture which is tied
 to soil particles and does not participate in moisture transport.
 - \b Frozen \b soil \b physics algorithm
 RUC LSM has a different approach to take into account freezing and thawing processes in soil.
-- Treatment of \b mixed \b phase \b precipitation
-It accounts for mixed phase precipitation provided by \ref THOMPSON used in RAP and HRRR.
-- Simple treatment of \b sea \c ice which solves heat diffusion in sea ice and allows evolving snow cover on top of sea ice
-- sub-grid-scale \b heterogeneity of surface parameters in RUC LSM
+- Treatment of \b mixed \b phase \b precipitation accounts for mixed phase precipitation provided by \ref THOMPSON used in RAP and HRRR.
+- Simple treatment of \b sea \b ice which solves heat diffusion in sea ice and allows evolving snow cover on top of sea ice
+- Sub-grid-scale \b heterogeneity of surface parameters in RUC LSM (Fig.3).
 With the certain level of confidence in the skill of the model, the next requirement is to provide land static fields and surface 
-parameters with the best possible accuracy. RAP and HRRR use the same datasets as \ref GFS_NOAH. But instead of specifying surface
-parameters for the dominant soil and land-use category in the grid box, RUC LSM takes into account the sub-grid scale heterogeneity
+parameters with the best possible accuracy. RAP and HRRR use the same soil/vegetation calssifications as \ref GFS_NOAH. But in addition to 
+specifying surface
+parameters for the dominant soil and land-use category in the grid box, RUC LSM has an option to take into account the sub-grid scale heterogeneity
 in the computation of such parameters as roughness length, emissivity, soil porosity, soil heat capacity and others. The difference in
-roughness between the mosaic and dominant category presented on figure 2 is positive from contribution of the forests, which helped to 
-reduce high biases of surface wind speeds in these regions. Roughness lenghth has also seasonal variability in the cropland regions,
-which again helped to improve the wind forecasts during the warm season.
-\image html  ruc_lsm_heterogeneity.png "Figure 2:  sub-grid scale heterogeneity of surface parameters in RUC LSM (Courtesy of T.G. Smirnova)" width=900
+roughness between the mosaic and dominant category presented on Figure 3, is positive from contribution of the forests, which helped to 
+reduce high biases of surface wind speeds in these regions. In the cropland regions, roughness lenghth has also a seasonal variability depending on the growing phase of the plants. This again helped to improve the wind forecasts during the warm season.
+Turning on sub-grid-scale heterogeneity option requries: \p mosaic_lu = 1 and \p mosaic_soil = 1 in the namelist, and fractions of soil and vegetation types in a grid cell.
+\image html  ruc_lsm_heterogeneity.png "Figure 3:  sub-grid scale heterogeneity of surface parameters in RUC LSM (Courtesy of T.G. Smirnova)" width=900
 
-- New: simple irrigation in the cropland area
+- New: simple irrigation in the cropland area with \p mosaic_lu = 1
 - New: water/snow intercepted by canopy as function of vegetation fraction and leaf area index (LAI)
 
 ## RUC snow model characteristics:
 Snow forms additional two layers on top of soil in RUC LSM
-- \b 2-layer \b snow model: when SWE < 1.6 cm - snow layer is combined with top soil layer
-- Fractional snow cover (SWE < 3 cm):
-- weighted average of snow-covered and snow-free areas to compute snow paramters (roughness, albedo)
-- New: "mosaic" approach for patchy snow
-  - Seperate treatment of energy and moisture budgets for snow-covered and snow-free portions of the grid cell
+- \b 2-layer \b snow model: when SWE < 1.6 cm - snow layer is combined with top soil layer;
+- Fractional snow cover (SWE < 3 cm);
+- Weighted average of snow-covered and snow-free areas to compute snow parameters (roughness, albedo);
+- "Mosaic" approach for patchy snow (Fig.4):
+  - Separate treatment of energy and moisture budgets for snow-covered and snow-free portions of the grid cell
   - Aggregate solutions at the end of time step
-  - Reduced cold bias for areas with thin snow
-\image html ruc_lsm_mosaic.png "Figure 3: recent development: mosaic approach for patchy snow (Courtesy of T.G. Smirnova) " width=900
-- Iterative snow melting algorithm
-- Density of snow on the ground - a function of compaction parameter and snow depth and temperature
-- Snow albedo - a function of temperature and snow fraction
-- Snow interception by canopy - a function of vegetation fraction and LAI
-- Density of falling snow/graupel/ice precipitation  
+  - Outcome: reduced cold bias for areas with thin snow
+\image html ruc_lsm_mosaic.png "Figure 4: 'Mosaic' approach for patchy snow (Courtesy of T.G. Smirnova) " width=900
+  - New: additional options to compute snow cover fraction (\p isncovr_opt =2 and 3, Niu and Yang (2007) \cite Niu_2007). These options allowed to reduce overprediction of number of grid cells fully covered with snow which further reduced cold-biases over snow. Figure 5 demonstrates that option 3 of snow cover fraction computation (\p isncovr_opt = 3) in the UFS-based regional model matches better the satellite data for the test case on 6 February 2022.
+- New: added an option to use of a new formulation of snow thermal conductivity (\p isncond_opt = 2, Sturm et al. (1997) \cite sturm_1997);
+\image html sncov_rrfs_ruc.png "Figure 5: Snow cover fraction from MODIS (a,b), Regional UFS-based system (RRFS) original (c), and modified with isncover_opt=3 (d), 6 February 2022. (Courtesy of T.G. Smirnova)"  width=900
+- Iterative snow melting algorithm;
+- Density of snow on the ground - a function of compaction parameter and snow depth and temperature;
+- Snow albedo - a function of temperature and snow fraction;
+- Snow interception by canopy - a function of vegetation fraction and leaf area index (LAI);
+- Density of falling snow/graupel/ice precipitation (Fig.6) 
   - The density of falling snow/graupel/ice is computed inside RUC LSM using empirical temperature-dependent equations;
   - Averaged density of frozen precipitation is defined from weighted contribution of each hydrometeor species:
 \f[
  \rho_{fr}=\rho_{sn}*\alpha_{sn}+\rho_{gr}*\alpha_{gr}+\rho_{ice}*\alpha_{ice}
+ 
 \f]
+Where subscripts sn, gr, ice - snow, graupel and ice precipitation, respectively.
 - The depth of new snow is defined from its liquid equivalent and \f$\rho_{fr}\f$
-\image html ruc_lsm_frozen_precip.png "Figure 4: HRRR 23-h forecasts of snow accumulation, valid 08 UTC, 29 Dec 2015 (Courtesy of T.G. Smirnova)" width=900
+\image html ruc_lsm_frozen_precip.png "Figure 6: HRRR 23-h forecasts of snow accumulation, valid 08 UTC, 29 Dec 2015 (Courtesy of T.G. Smirnova)" width=900
 
-snow accumulation with variable density is provided as an additional product in the model guidance. Figure 4 shows one example of this product
+Snow accumulation with variable density is provided as an additional product in the model guidance. Figure 6 shows one example of this product
 from the 23-h HRRR forecast for snowstorm on 29 Dec 2015. This product is in the middle panel. The panel on the left uses traditional 10:1 ratio,
-and the right panel is oberved snow accumulation. We can see that the new product in the middle here has a better, further north location of maximum
-snow accumulation, and high ammounts of snow in the product with 10:1 ratio are trimmed in central and southern Iowa where both observed and model 
+and the right panel is observed snow accumulation. We can see that the new product in the middle here has a better, further north location of maximum
+snow accumulation, and high amounts of snow in the product with 10:1 ratio are trimmed in central and southern Iowa where both observed and model 
 precipitation had a high content of sleet. There is even larger improvement in the Chicago area, where observed and model precipitation were almost 
 totally sleet. 
 
 \section v6_updates_ruc Physics Updates
-\version CCPP V6.0.0
+\version UFS-SRW v3.0.0 
 - Initialization of land and ice emissivity with consideration of partial snow cover
 - Initialization of land and ice albedo with consideration of partial snow cover
 - Initialization of water vapor mixing ratio over land and ice
+- Initialization of fractions of soil and vegetation types in a grid cell
 - Changes in the computation of a flag for sea ice: it is set to true only if \p flag_cice = .false. (uncoupled sea ice model)
 - Introduced separate variables for sea ice, for example: \p showfallac is replaced with \p snowfallac_ice
-- Added accomodation of fractional surface grid (land and ice fractions are possible within the grid cell)
-- Introduced solar angle dependence of albedo for snow-free land
-- Introduced a SPP option for stochastic perturbations for emissivity, albedo and vegetation fraction
-- Bug fix in hydraulic conductivity
+- Added accommodation of fractional surface grid (land and ice fractions are possible within the grid cell)
+- Solar angle dependence of albedo for snow-free land
+- SPP option for stochastic perturbations for emissivity, albedo and vegetation fraction
 - Based on RRFS testing, the coefficient in the soil resistance formulation (Sakaguchi and Zeng (2009) \cite sakaguchi_and_zeng_2009)
-was increased from 0.5 to 0.7 to increase soil resistance to evaporation
+was increased from 0.7 to 1.0 to increase soil resistance to evaporation
 
 
 \section intra_ruclsm Intraphysics Communication
diff --git a/physics/docs/pdftxt/SRW_all_shemes_list.txt b/physics/docs/pdftxt/SRW_all_shemes_list.txt
index bb320008e..db9683579 100644
--- a/physics/docs/pdftxt/SRW_all_shemes_list.txt
+++ b/physics/docs/pdftxt/SRW_all_shemes_list.txt
@@ -46,6 +46,9 @@ The UFS-SRW App. assembles the parameterizations in suites.
  - \subpage GFS_OCEAN 
  - \subpage GFS_SFCSICE 
 
+\b CLM \b Lake \b Model
+ - \subpage CLM_LAKE_model 
+
 \b Others
  - \subpage GFS_SPP
 
diff --git a/physics/docs/pdftxt/SRW_mainpage.txt b/physics/docs/pdftxt/SRW_mainpage.txt
index 154b1b0eb..59b551d55 100644
--- a/physics/docs/pdftxt/SRW_mainpage.txt
+++ b/physics/docs/pdftxt/SRW_mainpage.txt
@@ -1,15 +1,16 @@
 /**
 \mainpage Introduction 
 
-Welcome to the scientific documentation for the physical parameterizations available in the  <a href="https://ufscommunity.org/about/what-is-ufs/">Unified Forecast System (UFS)</a> Short-Range Weather (SRW) Application version 2.1.0 (available through https://github.com/ufs-community/ufs-srweather-app/) and the suites that can be configured using them. The SRW app targets predictions of atmospheric behavior on a 
+Welcome to the scientific documentation for the physical parameterizations available in the  <a href="https://ufscommunity.org/about/what-is-ufs/">Unified Forecast System (UFS)</a> Short-Range Weather (SRW) Application version 3.0 (available through https://github.com/ufs-community/ufs-srweather-app/) and the suites that can be configured using them. The SRW app targets predictions of atmospheric behavior on a 
 limited spatial domain and on time scales from less than an hour out to several days. 
 
-The CCPP parameterizations are aggregated in suites by the host models. In this release, the UFS Short-Range Weather Application 2.1.0 
+The CCPP parameterizations are aggregated in suites by the host models. In this release, the UFS Short-Range Weather Application 3.0 
 supports suites:
 - \ref GFS_v16_page
 - \ref HRRR_suite_page
 - \ref RRFS_v1beta_page 
 - \ref WoFS_v0_page
+- \ref rap_suite_page
 
 
 */
diff --git a/physics/docs/pdftxt/THOMPSON.txt b/physics/docs/pdftxt/THOMPSON.txt
index 60a873de9..fed003ebd 100644
--- a/physics/docs/pdftxt/THOMPSON.txt
+++ b/physics/docs/pdftxt/THOMPSON.txt
@@ -84,6 +84,15 @@ increases numerical stability by applying the subtime step only to sedimentation
 Two namelist variables control the usage of the semi-Lagrangian sedimentation, \p sedi_semi and \p decfl. 
 \p sedi_semi is set to ‘true’ to activate the method. Decfl is a parameter that needs to avoid deformation of the arriving grids, currently, "10". 
 
+\version SRW v3.0.0
+
+- The ice generation supersaturation requirement for nonaerosol option is reduced from 0.25 to 0.15. The purpose is to generate more ice in
+the upper level and reduce the OLR bias.
+
+- For the non-aerosol option of the scheme, the cloud number concentration is divided into two parts (over land and others). The number 
+concentration over the ocean is reduced to a smaller numer (50/L) from its default (100/L). The purpose is to reduce the bias in surface
+downward shortwave radiative flux off the coastal regional including the Southeast Pacific. 
+
 \section intra_thompson Intraphysics Communication
 - \ref arg_table_mp_thompson_run
 

From 7ec1eb82fc1f3caccb37e52102840efdfa52c814 Mon Sep 17 00:00:00 2001
From: Man Zhang <man.zhang@noaa.gov>
Date: Fri, 9 Jun 2023 11:32:06 -0600
Subject: [PATCH 047/115] Some format and file size adjustments

---
 physics/docs/pdftxt/HRRR_suite.txt            |   1 +
 physics/docs/pdftxt/RAP_suite.txt             |   4 +-
 .../docs/pdftxt/RE300/FV3_GFS_v16_input.nml   | 152 +++++++--------
 physics/docs/pdftxt/RE300/FV3_HRRR_input.nml  | 164 ++++++++--------
 physics/docs/pdftxt/RE300/FV3_RAP_input.nml   | 174 ++++++++---------
 .../pdftxt/RE300/FV3_RRFS_v1beta_input.nml    | 172 ++++++++---------
 .../docs/pdftxt/RE300/FV3_WoFS_v0_input.nml   | 176 +++++++++---------
 physics/docs/pdftxt/SRW_all_shemes_list.txt   |  30 ++-
 physics/docs/pdftxt/SRW_mainpage.txt          |   4 +-
 9 files changed, 444 insertions(+), 433 deletions(-)

diff --git a/physics/docs/pdftxt/HRRR_suite.txt b/physics/docs/pdftxt/HRRR_suite.txt
index d8b529ada..33a1eb0b8 100644
--- a/physics/docs/pdftxt/HRRR_suite.txt
+++ b/physics/docs/pdftxt/HRRR_suite.txt
@@ -17,6 +17,7 @@ The HRRR suite uses the parameterizations in the following order:
  - \ref SFC_MYNNSFL
  - \ref GFS_NSST
  - \ref RUCLSM
+ - \ref CLM_LAKE_model
  - \ref MYNNEDMF
  - \ref GFS_drag_suite
  - \ref GFS_OZPHYS
diff --git a/physics/docs/pdftxt/RAP_suite.txt b/physics/docs/pdftxt/RAP_suite.txt
index 425bf40ff..0371050b0 100644
--- a/physics/docs/pdftxt/RAP_suite.txt
+++ b/physics/docs/pdftxt/RAP_suite.txt
@@ -23,9 +23,9 @@ The RAP suite uses the parameterizations in the following order:
  - \ref THOMPSON
 
 \section sdf_gsdsuite Suite Definition File 
-\include suite_SCM_RAP.xml  
+\include suite_FV3_RAP.xml  
 
 \section RAP_nml_option Namelist
-\snippet SCM_RAP_input.nml GFS_PHYSICS_NML
+\snippet FV3_RAP_input.nml GFS_PHYSICS_NML
 
 */
diff --git a/physics/docs/pdftxt/RE300/FV3_GFS_v16_input.nml b/physics/docs/pdftxt/RE300/FV3_GFS_v16_input.nml
index 23ca37f9c..6fd84ec22 100644
--- a/physics/docs/pdftxt/RE300/FV3_GFS_v16_input.nml
+++ b/physics/docs/pdftxt/RE300/FV3_GFS_v16_input.nml
@@ -179,93 +179,93 @@
     rthresh      = 1e-05
     sedi_transport = .true.
     tau_g2v      = 900.0
-    tau_i2s = 1000.0
-    tau_l2v = 225.0
-    tau_v2l = 150.0
-    use_ccn = .true.
-    use_ppm = .false.
-    vg_max = 12.0
-    vi_max = 1.0
-    vr_max = 12.0
-    vs_max = 2.0
-    z_slope_ice = .true.
-    z_slope_liq = .true.
+    tau_i2s      = 1000.0
+    tau_l2v      = 225.0
+    tau_v2l      = 150.0
+    use_ccn      = .true.
+    use_ppm      = .false.
+    vg_max       = 12.0
+    vi_max       = 1.0
+    vr_max       = 12.0
+    vs_max       = 2.0
+    z_slope_ice  = .true.
+    z_slope_liq  = .true.
 /
 !! [GFDL_CLOUD_MP_NML]
 
 
 !>[GFS_PHYSICS_NML]
 &gfs_physics_nml
-    cal_pre = .false.
-    cdmbgwd = 4.0, 0.15, 1.0, 1.0
-    cnvcld = .true.
-    cnvgwd = .true.
-    debug = .false.
-    do_tofd = .true.
-    do_ugwp = .false.
-    dspheat = .true.
-    effr_in = .true.
-    fhcyc = 0.0
-    fhlwr = 3600.0
-    fhswr = 3600.0
-    fhzero = 1.0
-    h2o_phys = .true.
-    hybedmf = .false.
-    iaer = 5111
-    ialb = 1
+    cal_pre      = .false.
+    cdmbgwd      = 4.0, 0.15, 1.0, 1.0
+    cnvcld       = .true.
+    cnvgwd       = .true.
+    debug        = .false.
+    do_tofd      = .true.
+    do_ugwp      = .false.
+    dspheat      = .true.
+    effr_in      = .true.
+    fhcyc        = 0.0
+    fhlwr        = 3600.0
+    fhswr        = 3600.0
+    fhzero       = 1.0
+    h2o_phys     = .true.
+    hybedmf      = .false.
+    iaer         = 5111
+    ialb         = 1
     iau_inc_files = ''
-    icliq_sw = 2
-    ico2 = 2
-    iems = 1
-    imfdeepcnv = 2
-    imfshalcnv = 2
-    imp_physics = 11
-    iopt_alb = 2
-    iopt_btr = 1
-    iopt_crs = 1
-    iopt_dveg = 1
-    iopt_frz = 1
-    iopt_inf = 1
-    iopt_rad = 1
-    iopt_run = 1
-    iopt_sfc = 1
-    iopt_snf = 4
-    iopt_stc = 1
-    iopt_tbot = 2
-    iopt_trs = 2
-    iovr = 3
-    isatmedmf = 1
-    isol = 2
-    isot = 1
-    isubc_lw = 2
-    isubc_sw = 2
-    ivegsrc = 1
-    ldiag3d = .false.
-    ldiag_ugwp = .false.
-    lgfdlmprad = .true.
-    lheatstrg = .true.
-    lsm = 1
-    lsoil = 4
-    lwhtr = .true.
+    icliq_sw     = 2
+    ico2         = 2
+    iems         = 1
+    imfdeepcnv   = 2
+    imfshalcnv   = 2
+    imp_physics  = 11
+    iopt_alb     = 2
+    iopt_btr     = 1
+    iopt_crs     = 1
+    iopt_dveg    = 1
+    iopt_frz     = 1
+    iopt_inf     = 1
+    iopt_rad     = 1
+    iopt_run     = 1
+    iopt_sfc     = 1
+    iopt_snf     = 4
+    iopt_stc     = 1
+    iopt_tbot    = 2
+    iopt_trs     = 2
+    iovr         = 3
+    isatmedmf    = 1
+    isol         = 2
+    isot         = 1
+    isubc_lw     = 2
+    isubc_sw     = 2
+    ivegsrc      = 1
+    ldiag3d      = .false.
+    ldiag_ugwp   = .false.
+    lgfdlmprad   = .true.
+    lheatstrg    = .true.
+    lsm          = 1
+    lsoil        = 4
+    lwhtr        = .true.
     nsfullradar_diag = 3600
-    nst_anl = .true.
-    nstf_name = 2, 1, 0, 0, 0
-    oz_phys = .false.
+    nst_anl      = .true.
+    nstf_name    = 2, 1, 0, 0, 0
+    oz_phys      = .false.
     oz_phys_2015 = .true.
-    pdfcld = .false.
-    prautco = 0.00015, 0.00015
-    pre_rad = .false.
+    pdfcld       = .false.
+    prautco      = 0.00015, 0.00015
+    pre_rad      = .false.
     print_diff_pgr = .false.
-    prslrd0 = 0.0
-    psautco = 0.0008, 0.0005
-    random_clds = .false.
-    redrag = .true.
-    satmedmf = .true.
+    prslrd0      = 0.0
+    psautco      = 0.0008, 0.0005
+    random_clds  = .false.
+    redrag       = .true.
+    satmedmf     = .true.
     sfclay_compute_flux = .false.
-    shal_cnv = .true.
-    swhtr = .true.
-    trans_trac = .true.
-    use_ufo = .true.
+    shal_cnv     = .true.
+    swhtr        = .true.
+    trans_trac   = .true.
+    use_ufo      = .true.
 /
 !! [GFS_PHYSICS_NML]
 
diff --git a/physics/docs/pdftxt/RE300/FV3_HRRR_input.nml b/physics/docs/pdftxt/RE300/FV3_HRRR_input.nml
index 8a7d621f3..9a89b9a1f 100644
--- a/physics/docs/pdftxt/RE300/FV3_HRRR_input.nml
+++ b/physics/docs/pdftxt/RE300/FV3_HRRR_input.nml
@@ -140,90 +140,92 @@
     grid_file = 'INPUT/grid_spec.nc'
 /
 
+!>[GFS_PHYSICS_NML]
 &gfs_physics_nml
-    bl_mynn_edmf = 1
-    bl_mynn_edmf_mom = 1
-    bl_mynn_tkeadvect = .true.
-    cal_pre = .false.
-    cdmbgwd = 3.5, 1.0
-    cnvcld = .false.
-    cnvgwd = .false.
-    cplflx = .false.
-    debug = .false.
-    do_deep = .false.
-    do_gsl_drag_ls_bl = .true.
-    do_gsl_drag_ss = .true.
-    do_gsl_drag_tofd = .true.
-    do_mynnedmf = .true.
-    do_mynnsfclay = .true.
-    dspheat = .true.
-    effr_in = .true.
-    fhcyc = 0.0
-    fhlwr = 1200.0
-    fhswr = 1200.0
-    fhzero = 1.0
-    gwd_opt = 3
-    h2o_phys = .true.
-    hybedmf = .false.
-    iaer = 5111
-    ialb = 1
-    iau_delthrs = 6
-    iau_inc_files = ''
-    iaufhrs = 30
-    icliq_sw = 2
-    icloud_bl = 1
-    ico2 = 2
-    iems = 1
-    imfdeepcnv = -1
-    imfshalcnv = -1
-    imp_physics = 8
-    iopt_alb = 2
-    iopt_btr = 1
-    iopt_crs = 1
-    iopt_dveg = 2
-    iopt_frz = 1
-    iopt_inf = 1
-    iopt_rad = 1
-    iopt_run = 1
-    iopt_sfc = 1
-    iopt_snf = 4
-    iopt_stc = 1
-    iopt_tbot = 2
-    iopt_trs = 2
-    iovr = 3
-    isol = 2
-    isot = 1
-    isubc_lw = 2
-    isubc_sw = 2
-    ivegsrc = 1
-    kice = 9
-    ldiag3d = .false.
-    lheatstrg = .false.
-    lradar = .true.
-    lsm = 3
-    lsoil = 4
-    lsoil_lsm = 9
-    ltaerosol = .true.
-    lwhtr = .true.
-    nsfullradar_diag = 3600
-    nst_anl = .true.
-    nstf_name = 2, 1, 0, 0, 0
-    oz_phys = .false.
-    oz_phys_2015 = .true.
-    pdfcld = .false.
-    pre_rad = .false.
-    print_diff_pgr = .false.
-    prslrd0 = 0.0
-    random_clds = .false.
-    redrag = .true.
-    satmedmf = .false.
+    bl_mynn_edmf       = 1
+    bl_mynn_edmf_mom   = 1
+    bl_mynn_tkeadvect  = .true.
+    cal_pre            = .false.
+    cdmbgwd            = 3.5, 1.0
+    cnvcld             = .false.
+    cnvgwd             = .false.
+    cplflx             = .false.
+    debug              = .false.
+    do_deep            = .false.
+    do_gsl_drag_ls_bl  = .true.
+    do_gsl_drag_ss     = .true.
+    do_gsl_drag_tofd   = .true.
+    do_mynnedmf        = .true.
+    do_mynnsfclay      = .true.
+    dspheat            = .true.
+    effr_in            = .true.
+    fhcyc              = 0.0
+    fhlwr              = 1200.0
+    fhswr              = 1200.0
+    fhzero             = 1.0
+    gwd_opt            = 3
+    h2o_phys           = .true.
+    hybedmf            = .false.
+    iaer               = 5111
+    ialb               = 1
+    iau_delthrs        = 6
+    iau_inc_files      = ''
+    iaufhrs            = 30
+    icliq_sw           = 2
+    icloud_bl          = 1
+    ico2               = 2
+    iems               = 1
+    imfdeepcnv         = -1
+    imfshalcnv         = -1
+    imp_physics        = 8
+    iopt_alb           = 2
+    iopt_btr           = 1
+    iopt_crs           = 1
+    iopt_dveg          = 2
+    iopt_frz           = 1
+    iopt_inf           = 1
+    iopt_rad           = 1
+    iopt_run           = 1
+    iopt_sfc           = 1
+    iopt_snf           = 4
+    iopt_stc           = 1
+    iopt_tbot          = 2
+    iopt_trs           = 2
+    iovr               = 3
+    isol               = 2
+    isot               = 1
+    isubc_lw           = 2
+    isubc_sw           = 2
+    ivegsrc            = 1
+    kice               = 9
+    ldiag3d            = .false.
+    lheatstrg          = .false.
+    lradar             = .true.
+    lsm                = 3
+    lsoil              = 4
+    lsoil_lsm          = 9
+    ltaerosol          = .true.
+    lwhtr              = .true.
+    nsfullradar_diag   = 3600
+    nst_anl            = .true.
+    nstf_name          = 2, 1, 0, 0, 0
+    oz_phys            = .false.
+    oz_phys_2015       = .true.
+    pdfcld             = .false.
+    pre_rad            = .false.
+    print_diff_pgr     = .false.
+    prslrd0            = 0.0
+    random_clds        = .false.
+    redrag             = .true.
+    satmedmf           = .false.
     sfclay_compute_flux = .true.
-    shal_cnv = .false.
-    swhtr = .true.
-    trans_trac = .true.
-    ttendlim = -999
-    use_ufo = .true.
+    shal_cnv           = .false.
+    swhtr              = .true.
+    trans_trac         = .true.
+    ttendlim           = -999
+    use_ufo            = .true.
 /
+!![GFS_PHYSICS_NML]
 
 &interpolator_nml
     interp_method = 'conserve_great_circle'
diff --git a/physics/docs/pdftxt/RE300/FV3_RAP_input.nml b/physics/docs/pdftxt/RE300/FV3_RAP_input.nml
index ef3f44fc5..aa80cac21 100644
--- a/physics/docs/pdftxt/RE300/FV3_RAP_input.nml
+++ b/physics/docs/pdftxt/RE300/FV3_RAP_input.nml
@@ -140,97 +140,99 @@
     grid_file = 'INPUT/grid_spec.nc'
 /
 
+!>[GFS_PHYSICS_NML]
 &gfs_physics_nml
-    bl_mynn_edmf = 1
-    bl_mynn_edmf_mom = 1
+    bl_mynn_edmf      = 1
+    bl_mynn_edmf_mom  = 1
     bl_mynn_tkeadvect = .true.
-    cal_pre = .false.
-    cdmbgwd = 3.5, 1.0
-    cnvcld = .false.
-    cnvgwd = .false.
-    cplflx = .false.
-    debug = .false.
-    do_deep = .true.
+    cal_pre           = .false.
+    cdmbgwd           = 3.5, 1.0
+    cnvcld            = .false.
+    cnvgwd            = .false.
+    cplflx            = .false.
+    debug             = .false.
+    do_deep           = .true.
     do_gsl_drag_ls_bl = .true.
-    do_gsl_drag_ss = .true.
-    do_gsl_drag_tofd = .true.
-    do_mynnedmf = .true.
-    do_mynnsfclay = .true.
-    do_shum = .false.
-    do_skeb = .false.
-    do_spp = .false.
-    do_sppt = .false.
-    dspheat = .true.
-    effr_in = .true.
-    fhcyc = 0
-    fhlwr = 1200.0
-    fhswr = 1200.0
-    fhzero = 1.0
-    gwd_opt = 3
-    h2o_phys = .true.
-    hybedmf = .false.
-    iaer = 5111
-    ialb = 1
-    iau_delthrs = 6
-    iau_inc_files = ''
-    iaufhrs = 30
-    icliq_sw = 2
-    icloud_bl = 1
-    ico2 = 2
-    iems = 1
-    imfdeepcnv = 3
-    imfshalcnv = 3
-    imp_physics = 8
-    iopt_alb = 2
-    iopt_btr = 1
-    iopt_crs = 1
-    iopt_dveg = 2
-    iopt_frz = 1
-    iopt_inf = 1
-    iopt_rad = 1
-    iopt_run = 1
-    iopt_sfc = 1
-    iopt_snf = 4
-    iopt_stc = 1
-    iopt_tbot = 2
-    iopt_trs = 2
-    iovr = 3
-    isol = 2
-    isot = 1
-    isubc_lw = 2
-    isubc_sw = 2
-    ivegsrc = 1
-    kice = 9
-    ldiag3d = .false.
-    lheatstrg = .false.
-    lndp_type = 0
-    lradar = .true.
-    lsm = 3
-    lsoil = 4
-    lsoil_lsm = 9
-    ltaerosol = .true.
-    lwhtr = .true.
-    n_var_lndp = 0
-    n_var_spp = 0
-    nsfullradar_diag = 3600
-    nst_anl = .true.
-    nstf_name = 2, 1, 0, 0, 0
-    oz_phys = .false.
-    oz_phys_2015 = .true.
-    pdfcld = .false.
-    pre_rad = .false.
-    print_diff_pgr = .false.
-    prslrd0 = 0.0
-    random_clds = .false.
-    redrag = .true.
-    satmedmf = .false.
+    do_gsl_drag_ss    = .true.
+    do_gsl_drag_tofd  = .true.
+    do_mynnedmf       = .true.
+    do_mynnsfclay     = .true.
+    do_shum           = .false.
+    do_skeb           = .false.
+    do_spp            = .false.
+    do_sppt           = .false.
+    dspheat           = .true.
+    effr_in           = .true.
+    fhcyc             = 0
+    fhlwr             = 1200.0
+    fhswr             = 1200.0
+    fhzero            = 1.0
+    gwd_opt           = 3
+    h2o_phys          = .true.
+    hybedmf           = .false.
+    iaer              = 5111
+    ialb              = 1
+    iau_delthrs       = 6
+    iau_inc_files     = ''
+    iaufhrs           = 30
+    icliq_sw          = 2
+    icloud_bl         = 1
+    ico2              = 2
+    iems              = 1
+    imfdeepcnv        = 3
+    imfshalcnv        = 3
+    imp_physics       = 8
+    iopt_alb          = 2
+    iopt_btr          = 1
+    iopt_crs          = 1
+    iopt_dveg         = 2
+    iopt_frz          = 1
+    iopt_inf          = 1
+    iopt_rad          = 1
+    iopt_run          = 1
+    iopt_sfc          = 1
+    iopt_snf          = 4
+    iopt_stc          = 1
+    iopt_tbot         = 2
+    iopt_trs          = 2
+    iovr              = 3
+    isol              = 2
+    isot              = 1
+    isubc_lw          = 2
+    isubc_sw          = 2
+    ivegsrc           = 1
+    kice              = 9
+    ldiag3d           = .false.
+    lheatstrg         = .false.
+    lndp_type         = 0
+    lradar            = .true.
+    lsm               = 3
+    lsoil             = 4
+    lsoil_lsm         = 9
+    ltaerosol         = .true.
+    lwhtr             = .true.
+    n_var_lndp        = 0
+    n_var_spp         = 0
+    nsfullradar_diag  = 3600
+    nst_anl           = .true.
+    nstf_name         = 2, 1, 0, 0, 0
+    oz_phys           = .false.
+    oz_phys_2015      = .true.
+    pdfcld            = .false.
+    pre_rad           = .false.
+    print_diff_pgr    = .false.
+    prslrd0           = 0.0
+    random_clds       = .false.
+    redrag            = .true.
+    satmedmf          = .false.
     sfclay_compute_flux = .false.
-    shal_cnv = .true.
-    swhtr = .true.
-    trans_trac = .true.
-    ttendlim = -999
-    use_ufo = .true.
+    shal_cnv          = .true.
+    swhtr             = .true.
+    trans_trac        = .true.
+    ttendlim          = -999
+    use_ufo           = .true.
 /
+!![GFS_PHYSICS_NML]
 
 &interpolator_nml
     interp_method = 'conserve_great_circle'
diff --git a/physics/docs/pdftxt/RE300/FV3_RRFS_v1beta_input.nml b/physics/docs/pdftxt/RE300/FV3_RRFS_v1beta_input.nml
index 97a0f1216..aff1b47a5 100644
--- a/physics/docs/pdftxt/RE300/FV3_RRFS_v1beta_input.nml
+++ b/physics/docs/pdftxt/RE300/FV3_RRFS_v1beta_input.nml
@@ -14,20 +14,22 @@
     dycore_only = .false.
 /
 
+!>[CIRES_UGWP_NML]
 &cires_ugwp_nml
-    knob_ugwp_azdir = 2, 4, 4, 4
-    knob_ugwp_doaxyz = 1
-    knob_ugwp_doheat = 1
-    knob_ugwp_dokdis = 1
-    knob_ugwp_effac = 1, 1, 1, 1
-    knob_ugwp_ndx4lh = 1
-    knob_ugwp_solver = 2
-    knob_ugwp_source = 1, 1, 0, 0
-    knob_ugwp_stoch = 0, 0, 0, 0
+    knob_ugwp_azdir   = 2, 4, 4, 4
+    knob_ugwp_doaxyz  = 1
+    knob_ugwp_doheat  = 1
+    knob_ugwp_dokdis  = 1
+    knob_ugwp_effac   = 1, 1, 1, 1
+    knob_ugwp_ndx4lh  = 1
+    knob_ugwp_solver  = 2
+    knob_ugwp_source  = 1, 1, 0, 0
+    knob_ugwp_stoch   = 0, 0, 0, 0
     knob_ugwp_version = 0
-    knob_ugwp_wvspec = 1, 25, 25, 25
-    launch_level = 25
+    knob_ugwp_wvspec  = 1, 25, 25, 25
+    launch_level      = 25
 /
+!![CIRES_UGWP_NML]
 
 &diag_manager_nml
     max_output_fields = 450
@@ -139,83 +141,85 @@
     grid_file = 'INPUT/grid_spec.nc'
 /
 
+!>[GFS_PHYSICS_NML]
 &gfs_physics_nml
-    bl_mynn_edmf = 1
-    bl_mynn_edmf_mom = 1
+    bl_mynn_edmf      = 1
+    bl_mynn_edmf_mom  = 1
     bl_mynn_tkeadvect = .true.
-    cal_pre = .false.
-    cdmbgwd = 3.5, 0.25
-    cnvcld = .false.
-    cnvgwd = .false.
-    cplflx = .false.
-    debug = .false.
-    do_deep = .false.
-    do_mynnedmf = .true.
-    do_mynnsfclay = .true.
-    dspheat = .true.
-    effr_in = .true.
-    fhcyc = 0.0
-    fhlwr = 1200.0
-    fhswr = 1200.0
-    fhzero = 1.0
-    h2o_phys = .true.
-    hybedmf = .false.
-    iaer = 111
-    ialb = 1
-    iau_delthrs = 6
-    iau_inc_files = ''
-    iaufhrs = 30
-    icloud_bl = 1
-    ico2 = 2
-    iems = 1
-    imfdeepcnv = -1
-    imfshalcnv = -1
-    imp_physics = 8
-    iopt_alb = 2
-    iopt_btr = 1
-    iopt_crs = 1
-    iopt_dveg = 2
-    iopt_frz = 1
-    iopt_inf = 1
-    iopt_rad = 1
-    iopt_run = 1
-    iopt_sfc = 1
-    iopt_snf = 4
-    iopt_stc = 1
-    iopt_tbot = 2
-    iopt_trs = 2
-    isol = 2
-    isot = 1
-    isubc_lw = 2
-    isubc_sw = 2
-    ivegsrc = 1
-    ldiag3d = .false.
-    lheatstrg = .false.
-    lradar = .true.
-    lsm = 2
-    lsoil = 4
-    lsoil_lsm = 4
-    ltaerosol = .true.
-    lwhtr = .true.
-    nsfullradar_diag = 3600
-    nst_anl = .true.
-    nstf_name = 2, 1, 0, 0, 0
-    oz_phys = .false.
-    oz_phys_2015 = .true.
-    pdfcld = .false.
-    pre_rad = .false.
-    print_diff_pgr = .false.
-    prslrd0 = 0.0
-    random_clds = .false.
-    redrag = .true.
-    satmedmf = .false.
+    cal_pre           = .false.
+    cdmbgwd           = 3.5, 0.25
+    cnvcld            = .false.
+    cnvgwd            = .false.
+    cplflx            = .false.
+    debug             = .false.
+    do_deep           = .false.
+    do_mynnedmf       = .true.
+    do_mynnsfclay     = .true.
+    dspheat           = .true.
+    effr_in           = .true.
+    fhcyc             = 0.0
+    fhlwr             = 1200.0
+    fhswr             = 1200.0
+    fhzero            = 1.0
+    h2o_phys          = .true.
+    hybedmf           = .false.
+    iaer              = 111
+    ialb              = 1
+    iau_delthrs       = 6
+    iau_inc_files     = ''
+    iaufhrs           = 30
+    icloud_bl         = 1
+    ico2              = 2
+    iems              = 1
+    imfdeepcnv        = -1
+    imfshalcnv        = -1
+    imp_physics       = 8
+    iopt_alb          = 2
+    iopt_btr          = 1
+    iopt_crs          = 1
+    iopt_dveg         = 2
+    iopt_frz          = 1
+    iopt_inf          = 1
+    iopt_rad          = 1
+    iopt_run          = 1
+    iopt_sfc          = 1
+    iopt_snf          = 4
+    iopt_stc          = 1
+    iopt_tbot         = 2
+    iopt_trs          = 2
+    isol              = 2
+    isot              = 1
+    isubc_lw          = 2
+    isubc_sw          = 2
+    ivegsrc           = 1
+    ldiag3d           = .false.
+    lheatstrg         = .false.
+    lradar            = .true.
+    lsm               = 2
+    lsoil             = 4
+    lsoil_lsm         = 4
+    ltaerosol         = .true.
+    lwhtr             = .true.
+    nsfullradar_diag  = 3600
+    nst_anl           = .true.
+    nstf_name         = 2, 1, 0, 0, 0
+    oz_phys           = .false.
+    oz_phys_2015      = .true.
+    pdfcld            = .false.
+    pre_rad           = .false.
+    print_diff_pgr    = .false.
+    prslrd0           = 0.0
+    random_clds       = .false.
+    redrag            = .true.
+    satmedmf          = .false.
     sfclay_compute_flux = .false.
-    shal_cnv = .false.
-    swhtr = .true.
-    trans_trac = .true.
-    ttendlim = -999
-    use_ufo = .true.
+    shal_cnv          = .false.
+    swhtr             = .true.
+    trans_trac        = .true.
+    ttendlim          = -999
+    use_ufo           = .true.
 /
+!![GFS_PHYSICS_NML]
 
 &interpolator_nml
     interp_method = 'conserve_great_circle'
diff --git a/physics/docs/pdftxt/RE300/FV3_WoFS_v0_input.nml b/physics/docs/pdftxt/RE300/FV3_WoFS_v0_input.nml
index 1236cde3b..70206c335 100644
--- a/physics/docs/pdftxt/RE300/FV3_WoFS_v0_input.nml
+++ b/physics/docs/pdftxt/RE300/FV3_WoFS_v0_input.nml
@@ -14,20 +14,22 @@
     dycore_only = .false.
 /
 
+!>[CIRES_UGWP_NML]
 &cires_ugwp_nml
-    knob_ugwp_azdir = 2, 4, 4, 4
-    knob_ugwp_doaxyz = 1
-    knob_ugwp_doheat = 1
-    knob_ugwp_dokdis = 1
-    knob_ugwp_effac = 1, 1, 1, 1
-    knob_ugwp_ndx4lh = 1
-    knob_ugwp_solver = 2
-    knob_ugwp_source = 1, 1, 0, 0
-    knob_ugwp_stoch = 0, 0, 0, 0
+    knob_ugwp_azdir   = 2, 4, 4, 4
+    knob_ugwp_doaxyz  = 1
+    knob_ugwp_doheat  = 1
+    knob_ugwp_dokdis  = 1
+    knob_ugwp_effac   = 1, 1, 1, 1
+    knob_ugwp_ndx4lh  = 1
+    knob_ugwp_solver  = 2
+    knob_ugwp_source  = 1, 1, 0, 0
+    knob_ugwp_stoch   = 0, 0, 0, 0
     knob_ugwp_version = 0
-    knob_ugwp_wvspec = 1, 25, 25, 25
-    launch_level = 25
+    knob_ugwp_wvspec  = 1, 25, 25, 25
+    launch_level      = 25
 /
+!![CIRES_UGWP_NML]
 
 &diag_manager_nml
     max_output_fields = 450
@@ -143,85 +145,87 @@
     grid_file = 'INPUT/grid_spec.nc'
 /
 
+!>[GFS_PHYSICS_NML]
 &gfs_physics_nml
-    bl_mynn_edmf = 1
-    bl_mynn_edmf_mom = 1
+    bl_mynn_edmf      = 1
+    bl_mynn_edmf_mom  = 1
     bl_mynn_tkeadvect = .true.
-    cal_pre = .false.
-    cdmbgwd = 3.5, 0.25
-    cnvcld = .false.
-    cnvgwd = .false.
-    cplflx = .false.
-    debug = .false.
-    do_deep = .false.
-    do_mynnedmf = .true.
-    do_mynnsfclay = .true.
-    dspheat = .true.
-    effr_in = .true.
-    fhcyc = 0.0
-    fhlwr = 1200.0
-    fhswr = 1200.0
-    fhzero = 1.0
-    h2o_phys = .true.
-    hybedmf = .false.
-    iaer = 111
-    ialb = 1
-    iau_delthrs = 6
-    iau_inc_files = ''
-    iaufhrs = 30
-    icloud_bl = 1
-    ico2 = 2
-    iems = 1
-    imfdeepcnv = -1
-    imfshalcnv = -1
-    imp_physics = 17
-    iopt_alb = 2
-    iopt_btr = 1
-    iopt_crs = 1
-    iopt_dveg = 2
-    iopt_frz = 1
-    iopt_inf = 1
-    iopt_rad = 1
-    iopt_run = 1
-    iopt_sfc = 1
-    iopt_snf = 4
-    iopt_stc = 1
-    iopt_tbot = 2
-    isol = 2
-    isot = 1
-    isubc_lw = 2
-    isubc_sw = 2
-    ivegsrc = 1
-    ldiag3d = .false.
-    lheatstrg = .false.
-    lradar = .true.
-    lsm = 1
-    lsoil = 4
-    lsoil_lsm = 4
-    ltaerosol = .true.
-    lwhtr = .true.
-    nsfullradar_diag = 3600
-    nssl_cccn = 600000000.0
-    nssl_ccn_on = .true.
-    nssl_hail_on = .true.
-    nst_anl = .true.
-    nstf_name = 2, 1, 0, 0, 0
-    oz_phys = .false.
-    oz_phys_2015 = .true.
-    pdfcld = .false.
-    pre_rad = .false.
-    print_diff_pgr = .false.
-    prslrd0 = 0.0
-    random_clds = .false.
-    redrag = .true.
-    satmedmf = .false.
+    cal_pre           = .false.
+    cdmbgwd           = 3.5, 0.25
+    cnvcld            = .false.
+    cnvgwd            = .false.
+    cplflx            = .false.
+    debug             = .false.
+    do_deep           = .false.
+    do_mynnedmf       = .true.
+    do_mynnsfclay     = .true.
+    dspheat           = .true.
+    effr_in           = .true.
+    fhcyc             = 0.0
+    fhlwr             = 1200.0
+    fhswr             = 1200.0
+    fhzero            = 1.0
+    h2o_phys          = .true.
+    hybedmf           = .false.
+    iaer              = 111
+    ialb              = 1
+    iau_delthrs       = 6
+    iau_inc_files     = ''
+    iaufhrs           = 30
+    icloud_bl         = 1
+    ico2              = 2
+    iems              = 1
+    imfdeepcnv        = -1
+    imfshalcnv        = -1
+    imp_physics       = 17
+    iopt_alb          = 2
+    iopt_btr          = 1
+    iopt_crs          = 1
+    iopt_dveg         = 2
+    iopt_frz          = 1
+    iopt_inf          = 1
+    iopt_rad          = 1
+    iopt_run          = 1
+    iopt_sfc          = 1
+    iopt_snf          = 4
+    iopt_stc          = 1
+    iopt_tbot         = 2
+    isol              = 2
+    isot              = 1
+    isubc_lw          = 2
+    isubc_sw          = 2
+    ivegsrc           = 1
+    ldiag3d           = .false.
+    lheatstrg         = .false.
+    lradar            = .true.
+    lsm               = 1
+    lsoil             = 4
+    lsoil_lsm         = 4
+    ltaerosol         = .true.
+    lwhtr             = .true.
+    nsfullradar_diag  = 3600
+    nssl_cccn         = 600000000.0
+    nssl_ccn_on       = .true.
+    nssl_hail_on      = .true.
+    nst_anl           = .true.
+    nstf_name         = 2, 1, 0, 0, 0
+    oz_phys           = .false.
+    oz_phys_2015      = .true.
+    pdfcld            = .false.
+    pre_rad           = .false.
+    print_diff_pgr    = .false.
+    prslrd0           = 0.0
+    random_clds       = .false.
+    redrag            = .true.
+    satmedmf          = .false.
     sfclay_compute_flux = .false.
-    shal_cnv = .false.
-    swhtr = .true.
-    trans_trac = .true.
-    ttendlim = -999
-    use_ufo = .true.
+    shal_cnv          = .false.
+    swhtr             = .true.
+    trans_trac        = .true.
+    ttendlim          = -999
+    use_ufo           = .true.
 /
+!![GFS_PHYSICS_NML]
 
 &interpolator_nml
     interp_method = 'conserve_great_circle'
diff --git a/physics/docs/pdftxt/SRW_all_shemes_list.txt b/physics/docs/pdftxt/SRW_all_shemes_list.txt
index db9683579..16a1727e6 100644
--- a/physics/docs/pdftxt/SRW_all_shemes_list.txt
+++ b/physics/docs/pdftxt/SRW_all_shemes_list.txt
@@ -16,6 +16,7 @@ The UFS-SRW App. assembles the parameterizations in suites.
  - \subpage GFS_NOAH 
  - \subpage RUCLSM 
  - \subpage NoahMP 
+ - \subpage CLM_LAKE_model
 
 \b Cumulus \b Parameterizations
  - \subpage GFS_SAMFdeep 
@@ -46,9 +47,6 @@ The UFS-SRW App. assembles the parameterizations in suites.
  - \subpage GFS_OCEAN 
  - \subpage GFS_SFCSICE 
 
-\b CLM \b Lake \b Model
- - \subpage CLM_LAKE_model 
-
 \b Others
  - \subpage GFS_SPP
 
@@ -70,21 +68,21 @@ to the parameterization.
 - If the in-core saturation adjustment is used (\p do_sat_adj=.true.), it is invoked at shorter timesteps along with the dynamical solver.
 
 
-The UFS Short Range Weather Application (SRW App) v2.1.0 supports four physicsphysics suites.
+The UFS Short Range Weather Application (SRW App) v3.0.0 supports four physicsphysics suites.
 
-Table 1.  Physics suites and primary schemes supported in SRW v2.1.0  
+Table 1.  Physics suites and primary schemes supported in SRW v3.0.0  
 \tableofcontents
-| Physics suites   |     GFS_v16        |       HRRR                     |   RRFS_v1beta      |   WoFS_v0     |         
-|------------------|--------------------|--------------------------------|--------------------|---------------|
-|\b Deep \b Cu     | \ref GFS_SAMFdeep  |   \a  off                      |   \a off           |   \a off      |
-|\b Shallow \b Cu  | \ref GFS_SAMFshal  |   \ref MYNNEDMF                | \ref MYNNEDMF      |  \ref MYNNEDMF |
-|\b Microphysics   | \ref GFDL_cloud    |   \ref THOMPSON    | \ref THOMPSON      | \ref NSSLMICRO_page     |
-|\b PBL/TURB       | \ref GFS_SATMEDMFVDIFQ     |  \ref MYNNEDMF    | \ref MYNNEDMF     |   \ref MYNNEDMF    |
-|\b Radiation      | \ref GFS_RRTMG     |   \ref GFS_RRTMG              | \ref GFS_RRTMG     |   \ref GFS_RRTMG    |
-|\b Surface \b Layer | \ref GFS_SFCLYR  |   \ref SFC_MYNNSFL            | \ref SFC_MYNNSFL   |   \ref SFC_MYNNSFL  |
-|\b LSM            | \ref GFS_NOAH      |   \ref RUCLSM                 |   \ref NoahMP      | \ref GFS_NOAH   |
-|\b Gravity \b Wave \b Drag| \ref GFS_UGWP_v0  |   \ref GFS_drag_suite | \ref  GFS_UGWP_v0  |   \ref GFS_UGWP_v0   |
-|\b Sea \b Ice     | \ref GFS_SFCSICE   |   \ref RUCLSM                | \ref GFS_SFCSICE   |   \ref GFS_SFCSICE     |  
+| Physics suites     |     GFS_v16        |       HRRR                     |   RRFS_v1beta      |   WoFS_v0     |    RAP        |         
+|--------------------|--------------------|--------------------------------|--------------------|---------------|---------------|
+|\b Deep \b Cu       | \ref GFS_SAMFdeep  |   \a  off                      |   \a off           |   \a off      |  \ref CU_GF   |
+|\b Shallow \b Cu    | \ref GFS_SAMFshal  |   \ref MYNNEDMF                | \ref MYNNEDMF      |  \ref MYNNEDMF | \ref CU_GF   |
+|\b Microphysics     | \ref GFDL_cloud    |   \ref THOMPSON    | \ref THOMPSON      | \ref NSSLMICRO_page     |    \ref THOMPSON|
+|\b PBL/TURB         | \ref GFS_SATMEDMFVDIFQ     |  \ref MYNNEDMF    | \ref MYNNEDMF     |   \ref MYNNEDMF    | \ref MYNNEDMF |
+|\b Radiation        | \ref GFS_RRTMG     |   \ref GFS_RRTMG              | \ref GFS_RRTMG     |   \ref GFS_RRTMG    | \ref GFS_RRTMG |
+|\b Surface \b Layer | \ref GFS_SFCLYR  |   \ref SFC_MYNNSFL            | \ref SFC_MYNNSFL   |   \ref SFC_MYNNSFL  | \ref SFC_MYNNSFL |
+|\b LSM              | \ref GFS_NOAH      |   \ref RUCLSM  and \ref CLM_LAKE_model |   \ref NoahMP      | \ref GFS_NOAH   | \ref RUCLSM |
+|\b Gravity \b Wave \b Drag| \ref GFS_UGWP_v0  |   \ref GFS_drag_suite | \ref  GFS_UGWP_v0  |   \ref GFS_UGWP_v0   | \ref GFS_drag_suite |
+|\b Ice and \b Snow       | \ref GFS_SFCSICE   |   \ref RUCLSM                | \ref GFS_SFCSICE   |   \ref GFS_SFCSICE     | \ref RUCLSM | 
 \tableofcontents
 
 
diff --git a/physics/docs/pdftxt/SRW_mainpage.txt b/physics/docs/pdftxt/SRW_mainpage.txt
index 59b551d55..8b3791c07 100644
--- a/physics/docs/pdftxt/SRW_mainpage.txt
+++ b/physics/docs/pdftxt/SRW_mainpage.txt
@@ -1,10 +1,10 @@
 /**
 \mainpage Introduction 
 
-Welcome to the scientific documentation for the physical parameterizations available in the  <a href="https://ufscommunity.org/about/what-is-ufs/">Unified Forecast System (UFS)</a> Short-Range Weather (SRW) Application version 3.0 (available through https://github.com/ufs-community/ufs-srweather-app/) and the suites that can be configured using them. The SRW app targets predictions of atmospheric behavior on a 
+Welcome to the scientific documentation for the physical parameterizations available in the  <a href="https://ufscommunity.org/about/what-is-ufs/">Unified Forecast System (UFS)</a> Short-Range Weather (SRW) Application version 3.0.0 (available through https://github.com/ufs-community/ufs-srweather-app/) and the suites that can be configured using them. The SRW app targets predictions of atmospheric behavior on a 
 limited spatial domain and on time scales from less than an hour out to several days. 
 
-The CCPP parameterizations are aggregated in suites by the host models. In this release, the UFS Short-Range Weather Application 3.0 
+The CCPP parameterizations are aggregated in suites by the host models. In this release, the UFS Short-Range Weather Application 3.0.0 
 supports suites:
 - \ref GFS_v16_page
 - \ref HRRR_suite_page

From c901390c8e758f63d1e2122d917579230d1def6d Mon Sep 17 00:00:00 2001
From: Man Zhang <man.zhang@noaa.gov>
Date: Thu, 15 Jun 2023 11:43:23 -0600
Subject: [PATCH 048/115] address some review comments

---
 physics/docs/pdftxt/CLM_LAKE.txt          |  8 +++---
 physics/docs/pdftxt/CU_GF_deep.txt        | 17 ++++++-------
 physics/docs/pdftxt/GFS_NOAHMP.txt        |  6 ++---
 physics/docs/pdftxt/GFS_SAMFdeep.txt      |  3 +--
 physics/docs/pdftxt/HRRR_suite.txt        |  4 +--
 physics/docs/pdftxt/RAP_suite.txt         |  6 ++---
 physics/docs/pdftxt/RRFS_v1beta_suite.txt |  4 +--
 physics/docs/pdftxt/RUCLSM.txt            |  9 ++++---
 physics/docs/pdftxt/SRW_mainpage.txt      | 10 +++++++-
 physics/docs/pdftxt/WoFS_v0_suite.txt     |  5 ++--
 physics/docs/pdftxt/suite_input.nml.txt   | 30 ++++++++++++++++++-----
 11 files changed, 63 insertions(+), 39 deletions(-)

diff --git a/physics/docs/pdftxt/CLM_LAKE.txt b/physics/docs/pdftxt/CLM_LAKE.txt
index c091d2b17..e0a8d9209 100644
--- a/physics/docs/pdftxt/CLM_LAKE.txt
+++ b/physics/docs/pdftxt/CLM_LAKE.txt
@@ -2,7 +2,7 @@
 \page CLM_LAKE_model CLM Lake Model 
 \section des_clmlake  Description
 
-CLM lake model is a multi-level one-dimensional lake model that has been implemented within the operational 3-km HRRR and
+The Community Land Model (CLM) lake model is a multi-level one-dimensional lake model that has been implemented within the operational 3-km HRRR and
 13-km RAP for small lakes (Benjamin et al. (2022) \cite gmd-15-6659-2022). It is the Community Land Model, version 4.5. 
 Subin et al. (2012) \cite Subin_2012 describe the  1-d CLM lake model as applied within the Community Earth System
 Model (CESM) as a component of the overall CESM CLM (Lawrence et al. (2019) \cite Lawrence_2019). Gu et al. (2015) \cite Gu2015 
@@ -31,14 +31,14 @@ to improve surface prediction in the vicinity of small lakes.
 The CLM lake model requires bathymetry for the lake points in the model domain. Grid points are assigned as lake points when the 
 fraction of lake coverage in the grid cell exceeds 50% and when this point is disconnected from oceans. The lake water mask is 
 therefore binary, set to either 1 or 0. This binary approach for models with higher horizontal resolution, for example, 3-km resolution in 
-the regional application of UFS (RRFS), is capable of capturing the effect of lakes on regional heat and moisture fluxes.
+in the UFS SRW App, is capable of capturing the effect of lakes on regional heat and moisture fluxes.
 
 Lake depths for the RRFS lake configuration (Fig.1) are assigned from a global dataset provided by Kourzeneva et al.(2012) \cite Kourzeneva_2012,
 this dataset is referred to as GLOBv3 bathymetry in the UFS_UTL.
 
 \image html Lake_depths_RRFS3km.png "Figure 1: Lake depths for lakes in the 3-km RRFS domain." width=600
 
-To cold-start the CLM lake model in RRFS:
+To cold-start the CLM lake model in the UFS SRW App:
 - Use the CLM option in the input.nml
 \n  - lkm = 1
 \n  - iopt_lake = 2
@@ -47,7 +47,7 @@ To cold-start the CLM lake model in RRFS:
 - Temperature for soil under the lake is initialized from bottom lake temperature at the top to the substrate soil temperature at the bottom of soil layer
 - Lake ice at the top level is initialized from the GFS ice concentration
 
-The differences of surface variables from the RRFS 6-h forecast with/without CLM lake model are shown in Figure 2 for 2-m temperature and in Figure 3 for 2-m dewpoint.
+The differences of surface variables from the experimental RRFS 6-h forecast with/without CLM lake model are shown in Figure 2 for 2-m temperature and in Figure 3 for 2-m dewpoint.
 \image html diff_t2m_lake_rrfs.png "Figure 2: Differences of 2-m temperature between the RRFS coupled to the CLM model and the RRFS without CLM." width=600
 \image html diff_td2m_lake_rrfs.png "Figure 3: Differences of 2-m dew point between the RRFS coupled to the CLM model and the RRFS without CLM." width=600
  
diff --git a/physics/docs/pdftxt/CU_GF_deep.txt b/physics/docs/pdftxt/CU_GF_deep.txt
index f30cb28dc..365ba9ae0 100644
--- a/physics/docs/pdftxt/CU_GF_deep.txt
+++ b/physics/docs/pdftxt/CU_GF_deep.txt
@@ -8,20 +8,18 @@ follows the mass flux approach published by Grell (1993) \cite grell_1993.
 Further developments by Grell and \f$D\acute{e}v\acute{e}nyi\f$ (2002) \cite Grell_2002 included implementing 
 stochastics through allowing parameter perturbations. In GF scale awareness, and the aerosol dependence through rain generation (following
 Berry (1968) \cite berry_1968 and evaporation formulations (following Jiang et al. (2010) \cite Jiang_2010 ), depending on the 
-cloud concentration nuclei at cloud base were added. GF included mixed phase physics impact, momentum transport,
+cloud concentration nuclei at cloud base were added. The GF scheme includes mixed phase physics impact, momentum transport,
  a diurnal cycle closure (Bechtold et al. (2014) \cite bechtold_et_al_2014 ), and a trimodal spectral size to simulate the interaction
-and transition from shallow, congestus and deep convection regimes. The vertical massflux distribution of shallow, congestus and
-deep convection regimes is characterized by Probability Density Functions (PDF's). The three PDF's are meant to represent the average
+and transition from shallow, congestus and deep convection regimes. The vertical mass flux distribution of shallow, congestus and
+deep convection regimes is characterized by Probability Density Functions (PDFs). The three PDF's are meant to represent the average
 statistical mass flux characteristic of deep, congestus, and shallow (respectively) plumes in the grid area. Each PDF therefore represents
 a spectrum of plumes within the grid box. Forcing is different for each characteristic type. Entrainment and detrainment are derived 
-from the PDF's. The deep and congestus convection considers scale awareness (Arakawa et al. (2011) \cite Arakawa_2011 ), the shallow convection is not scale-aware. Aerosol dependence is implemented through dependence of rain generation and 
+from the PDF's. The deep and congestus convection considers scale awareness (Arakawa et al. (2011) \cite Arakawa_2011 ). However, the shallow convection is not scale-aware. Aerosol dependence is implemented through dependence of rain generation and 
 evaporation formulations depending on the cloud concentration nuclei at cloud base (Berry 1968 \cite berry_1968, 
 Jiang et al.(2010) \cite Jiang_2010, and Lee and Feingold (2010) \cite lee_and_feingold_2010 ). Wet scavenging is considered to add a memory impact. Aerosol dependence is considered experimental and 
 is turned off at this point. GF is able to transport tracers.
 
-
-\section version_cugf_enh CCPP Physics Updates
-\version CCPP v6.0.0
+\b CCPP \b v6.0.0 \b Updates:
 
 - GPU capabilities have been added
 - Cap suppressing (\p do_cap_suppress) based on radar data assimilation has been added. This is used only for the RAP suite
@@ -38,9 +36,10 @@ transition as grid spacing decreases into a shallow convection scheme
   - Coupled to the grid scale precipitation and radiation schemes through passing of diagnosed cloud liquid and ice from simulated
 precipitating convective cloud and shallow convective clouds
 
+\section version_cugf_enh CCPP Physics Updates
+
 \version UFS-SRW v3.0.0
-- The choices of closures for deep/mid/shallow convection are now namelist options
-- Updates for aerosol-awareness
+- Updates for aerosol-awareness (experimental)
 
 \b The \b Implementation \b of \b GF \b in \b RRFS
 
diff --git a/physics/docs/pdftxt/GFS_NOAHMP.txt b/physics/docs/pdftxt/GFS_NOAHMP.txt
index 83e8c0650..386ae816c 100644
--- a/physics/docs/pdftxt/GFS_NOAHMP.txt
+++ b/physics/docs/pdftxt/GFS_NOAHMP.txt
@@ -4,11 +4,9 @@
 
 This implementation of the NoahMP Land Surface Model (LSM) is adapted from the version implemented in WRF v3.7 with additions by NOAA EMC staff to work with the UFS Atmosphere model. Authoritative documentation of the NoahMP scheme can be accessed at the following links:
 
-Technical documentation freely available at He et al. (2023) \cite He_2023.
+- Technical documentation freely available at He et al. (2023) \cite He_2023.
 
-To cite the technical documentation: He, C., P. Valayamkunnath, M. Barlage, F. Chen, D. Gochis, R. Cabell, T. Schneider, R. Rasmussen, G.-Y. Niu, Z.-L. Yang, D. Niyogi, and M. Ek (2023): The Community Noah-MP Land Surface Modeling System Technical Description Version 5.0, (No. NCAR/TN-575+STR). doi:10.5065/ew8g-yr95
-
-A primary reference for the NoahMP LSM is Niu et al. (2011) \cite niu_et_al_2011.
+- A primary reference for the NoahMP LSM is Niu et al. (2011) \cite niu_et_al_2011.
 
 \section noahmp_update CCPP Physics Updates
 \version UFS-SRW v3.0.0
diff --git a/physics/docs/pdftxt/GFS_SAMFdeep.txt b/physics/docs/pdftxt/GFS_SAMFdeep.txt
index 346637b3b..d41763c37 100644
--- a/physics/docs/pdftxt/GFS_SAMFdeep.txt
+++ b/physics/docs/pdftxt/GFS_SAMFdeep.txt
@@ -65,8 +65,7 @@
  rain conversion rate, entrainment and detrainment rates, overshooting layers,
  and maximum allowable cloudbase mass flux (as of June 2018).
 
-\section v6_enh CCPP Physics Updates
-\version CCPP v6.0.0
+\b CCPP \b v6.0.0 \b Updates
 
 \subsection ca_page Cellular Automata Stochastic Convective Organization Scheme 
 
diff --git a/physics/docs/pdftxt/HRRR_suite.txt b/physics/docs/pdftxt/HRRR_suite.txt
index 33a1eb0b8..93601b62b 100644
--- a/physics/docs/pdftxt/HRRR_suite.txt
+++ b/physics/docs/pdftxt/HRRR_suite.txt
@@ -3,10 +3,10 @@
 
 \section HRRR_suite_overview Overview
 
-The HRRR suite contains the parameterizations used in the NOAA operational 
+The HRRR suite contains the evolving parameterizations used in the NOAA operational 
 High-Resolution Rapid Refresh (HRRR) model, which runs at 3-km resolution.
 This suite is most applicable for runs at 3-km resolution since it does not 
-parameterize deep convection.
+parameterize deep convection. It is one of the primary suite candidates for RRFS v1 operational implementation.
 
 For additional information about the HRRR model, visit: 
 https://rapidrefresh.noaa.gov/hrrr/.
diff --git a/physics/docs/pdftxt/RAP_suite.txt b/physics/docs/pdftxt/RAP_suite.txt
index 0371050b0..26b9d31f3 100644
--- a/physics/docs/pdftxt/RAP_suite.txt
+++ b/physics/docs/pdftxt/RAP_suite.txt
@@ -3,9 +3,9 @@
 
 \section rap_suite_overview Overview
 
-The RAP suite contains the parameterizations used in the NOAA operational Rapid Refresh (RAP) model
-which runs at 13-km resolution. Currently, the RAP suite is supported in SCM only. For additional 
-information about the RAP model, visit: https://rapidrefresh.noaa.gov.
+The RAP suite contains the evolving parameterizations used in the NOAA operational Rapid Refresh (RAP) model
+which runs at 13-km resolution.  For additional 
+information about the RAP model, visit: https://rapidrefresh.noaa.gov.  It is one of the primary suite candidates for RRFS v1 operational implementation.
 
 The RAP suite uses the parameterizations in the following order:
  - \ref SGSCLOUD_page
diff --git a/physics/docs/pdftxt/RRFS_v1beta_suite.txt b/physics/docs/pdftxt/RRFS_v1beta_suite.txt
index 2731e227e..ae400b982 100644
--- a/physics/docs/pdftxt/RRFS_v1beta_suite.txt
+++ b/physics/docs/pdftxt/RRFS_v1beta_suite.txt
@@ -3,8 +3,8 @@
 
 \section RRFS_v1beta_suite_overview Overview
 
-The RRFS_v1beta suite is the primary suite target for the upcoming operational implementation of
-the Rapid Refresh Forecast System (RRFS), which is used in the UFS SRW App.  This suite is most 
+The RRFS_v1beta suite is one of candicates for the future operational implementation of
+the Rapid Refresh Forecast System (RRFS), which can be configured using the UFS SRW App.  This suite is most 
 applicable for runs at 3-km resolution since it does not parameterize
 deep convection. 
 
diff --git a/physics/docs/pdftxt/RUCLSM.txt b/physics/docs/pdftxt/RUCLSM.txt
index 461348aa4..7a39faf84 100644
--- a/physics/docs/pdftxt/RUCLSM.txt
+++ b/physics/docs/pdftxt/RUCLSM.txt
@@ -10,7 +10,7 @@ processes in the RUC LSM (Smirnova et al. 2016 \cite Smirnova_2016 ) have proven
 the evolution of soil moisture, soil temperature, and snow in cycled models. Extension of the RAP domain to encompass all of North America and 
 adjacent high-latitude ocean areas necessitated further development of the RUC LSM for application in the tundra permafrost regions and over Arctic 
 sea ice (Smirnova et al. 2000 \cite Smirnova_2000). Other modifications include refinements in the snow model (snow "mosaic" approach, improvements in computation of snow cover fraction and snow thermal conductivity) and a more accurate specification of 
-albedo, roughness length, and other surface properties. Some of these recent modifications in the RUC LSM are described and evaluated in 
+albedo, roughness length, and other surface properties. Some of these modifications in the RUC LSM are described and evaluated in 
 Smirnova et al. 2016 \cite Smirnova_2016 .
 
 The parameterizations in the RUC LSM describe complicated atmosphere–land surface interactions (Fig.1) in an intentionally simplified fashion to avoid 
@@ -38,9 +38,10 @@ These adjustments are available in the current CCPP public release.
 
 Coupling of the RUC LSM to physically-based stochastic snow model (He et al.(2021) \cite he_et_al_2021) is also available in the current public release.
 
-The sensitivity of surface fluxes and turbine-height winds to the RUC LSM parameters has been explored by Geng Xia, NREL. This study
-will determine the uncertainty range for the selected parameters in the RUC LSM and will be described in the journal paper.
-## RUC LSM characteristics that differ from NOAH LSM:
+The sensitivity of surface fluxes and turbine-height winds to the RUC LSM parameters has been explored by Geng Xia, NREL 
+to determine the uncertainty range for the selected parameters in the RUC LSM.
+
+## RUC LSM characteristics that differ from Noah LSM:
 \image html ruc_lsm_veg_soil.png "Figure 1: RUC LSM Vegetation and Soil Model (Courtesy of T.G. Smirnova) " width=900
 \image html ruc_ranking.png "Figure 2: Model ranking as a function of normalized root mean square error of snow water equivalent and surface temperature (Courtesy of C. Menard)" width=900
 - \b Implicit \b solution of energy and moisture budgets in the layer spanning the ground surface
diff --git a/physics/docs/pdftxt/SRW_mainpage.txt b/physics/docs/pdftxt/SRW_mainpage.txt
index 8b3791c07..5e854034c 100644
--- a/physics/docs/pdftxt/SRW_mainpage.txt
+++ b/physics/docs/pdftxt/SRW_mainpage.txt
@@ -1,7 +1,7 @@
 /**
 \mainpage Introduction 
 
-Welcome to the scientific documentation for the physical parameterizations available in the  <a href="https://ufscommunity.org/about/what-is-ufs/">Unified Forecast System (UFS)</a> Short-Range Weather (SRW) Application version 3.0.0 (available through https://github.com/ufs-community/ufs-srweather-app/) and the suites that can be configured using them. The SRW app targets predictions of atmospheric behavior on a 
+Welcome to the scientific documentation for the physical parameterizations available in the  <a href="https://ufscommunity.org/about/what-is-ufs/">Unified Forecast System (UFS)</a> Short-Range Weather (SRW) Application version 3.0.0 (available through https://github.com/ufs-community/ufs-srweather-app/) and the suites that can be configured using them. The SRW App targets predictions of atmospheric behavior on a 
 limited spatial domain and on time scales from less than an hour out to several days. 
 
 The CCPP parameterizations are aggregated in suites by the host models. In this release, the UFS Short-Range Weather Application 3.0.0 
@@ -12,5 +12,13 @@ supports suites:
 - \ref WoFS_v0_page
 - \ref rap_suite_page
 
+\attention Here all supported suites are a recent snapshot of 
+<a href="https://github.com/ufs-community/ccpp-physics"> 
+the UFS fork for CCPP </a>. In this regard, GFS_v16 Suite is 
+not the same code as in the operational GFS v16. First of all, the operational GFS_v16 does not use CCPP at all. 
+Secondly, most of physics schemes hosted in CCPP repository have marched ahead since GFS was updated to version 16.0 on 22 March 2021. 
+This implication should be also applied to all other suites: as such, RAP/HRRR suites in this release are 
+the evolving version of the RAP/HRRR physics in operations. 
+
 
 */
diff --git a/physics/docs/pdftxt/WoFS_v0_suite.txt b/physics/docs/pdftxt/WoFS_v0_suite.txt
index 8259ab770..4561109fa 100644
--- a/physics/docs/pdftxt/WoFS_v0_suite.txt
+++ b/physics/docs/pdftxt/WoFS_v0_suite.txt
@@ -4,8 +4,9 @@
 \section wofs_v0_suite_overview Overview
 
 The WoFS_v0 suite is targeted for use in the upcoming operational implementation
-of the NOAA's Warn-on-Forecast System (WoFS). This suite is most applicable for 
-runs at 3-km resolution since it does not parameterize deep convection.
+of the NOAA's Warn-on-Forecast System (WoFS) and for the RRFS ensemble. 
+This suite is most applicable for runs at 3-km resolution since it does 
+not parameterize deep convection.
 
 The WoFS suite uses the parameterizations in the following order:
  - \ref SGSCLOUD_page
diff --git a/physics/docs/pdftxt/suite_input.nml.txt b/physics/docs/pdftxt/suite_input.nml.txt
index be3785b74..11d33db1c 100644
--- a/physics/docs/pdftxt/suite_input.nml.txt
+++ b/physics/docs/pdftxt/suite_input.nml.txt
@@ -50,9 +50,9 @@ show some variables in the namelist that must match the SDF.
 <tr><td>do_sfcperts       <td>gfs_rrtmg_pre  <td>flag for stochastic surface perturbations option       <td>.false.
 <tr><td>imp_physics     <td>choice of microphysics scheme      <td>choice of microphysics scheme: \n                
                                                       <ul>
-                                                      <li> 11: GFDL microphysics scheme 
                                                       <li> 8: Thompson microphysics scheme   
                                                       <li> 10: Morrison-Gettelman microphysics scheme
+                                                      <li> 11: GFDL microphysics scheme
                                                       <li> 17: NSSL microphysics scheme with background CCN
                                                       <li> 18: NSSL microphysics scheme with predicted CCN (compatibility)
                                                       </ul>
@@ -258,7 +258,7 @@ show some variables in the namelist that must match the SDF.
                                                       <li> true: activate TKE advection 
                                                       </ul>  
                                                       <td>.false. 
-<tr><td>bl_mynn_tkebudget  <td>mynnedmf_wrapper  <td>flag to activate TKE budget                  <td>0
+<tr><td>tke_budget  <td>mynnedmf_wrapper  <td>flag to activating TKE budget                  <td>0
 <tr><td>bl_mynn_cloudpdf   <td>mynnedmf_wrapper  <td>flag to determine which cloud PDF to use \n 
                                                       <ul>
                                                       <li> 0: use Sommeria-Deardorff subgrid cloud PDF 
@@ -384,6 +384,9 @@ show some variables in the namelist that must match the SDF.
 <tr><td>t_sub             <td>gfdl_cloud_microphys       <td>temperature threshold for sublimation. Cloud ice, snow or graupel stops(starts) sublimation when temperature is lower(higher) then \p t_sub         <td>184.
 <tr><td>mp_print          <td>gfdl_cloud_microphys       <td>\a .true. to turn on GFDL cloud microphysics debugging print out. (not supported in GFS physics)       <td>.false.
 <tr><td>ltaerosol       <td>mp_thompson               <td>flag for using aerosol climotology in Thompson MP scheme          <td>.false.
+<tr><td>mraerosol       <td>                          <td>flag for merra2 aerosol aware                  <td>.false.
+<tr><td>lradar          <td>                          <td>flag for radar reflectivity                    <td>.false.
+<tr><td>nsfullradar_diag <td>                         <td>seconds between resetting radar reflectivity calculation   <td>.-999.0
 <tr><td>ttendlim        <td>mp_thompson               <td>temperature tendency limiter per time step in K/s, set to < 0 to deactivate   <td>-999.0
 <tr><td>ext_diag_thompson   <td>mp_thompson           <td>flag for extended diagnostic output from Thompson MP           <td>.false.
 <tr><td>thompson_ext_ndiag3d  <td>mp_thompson         <td>number of 3d arrays for extended diagnostic output from Thompson MP   <td> 37      
@@ -394,9 +397,11 @@ show some variables in the namelist that must match the SDF.
 <tr><td>cnvcld          <td>see \a GFS_typedefs.F90          <td>flag for convective cloud                      <td>.false.
 <tr><td>lgfdlmprad      <td>gfs_rrtmg_pre          <td>flag for GFDL mp scheme and radiation consistency     <td>.false.
 <tr><td>nssl_cccn       <td>mp_nssl          <td>CCN concentration (m^-3)                  <td>0.6e9 
-<tr><td>nssl_alphar     <td>mp_nssl          <td>rain PSD shape parameter                        <td>0.0
-<tr><td>nssl_alphah     <td>mp_nssl          <td>graupel PSD shape parameter                     <td>0.0
-<tr><td>nssl_alphahl    <td>mp_nssl          <td>hail PSD shape parameter                        <td>1.0
+<tr><td>nssl_alphah     <td>mp_nssl          <td>graupel shape parameter                         <td>0.0
+<tr><td>nssl_alphahl    <td>mp_nssl          <td>hail shape parameter                            <td>1.0
+<tr><td>nssl_alphar     <td>mp_nssl          <td>shape paramter for rain (imurain=1 only)         <td>0.0
+<tr><td>nssl_ehw0_in    <td>mp_nssl          <td>constant or max assumed graupel-droplet collection efficiency          <td>0.9
+<tr><td>nssl_ehlw0_in   <td>mp_nssl          <td>constant or max assumed hail-droplet collection efficiency          <td>0.9
 <tr><td>nssl_hail_on    <td>mp_nssl          <td>NSSL flag to activate the hail category         <td>.false.
 <tr><td>nssl_ccn_on     <td>mp_nssl          <td>NSSL flag to activate the CCN category          <td>.true.
 <tr><td>nssl_invertccn  <td>mp_nssl          <td>NSSL flag to treat CCN as activated or unactivated      <td>.true.
@@ -508,15 +513,20 @@ show some variables in the namelist that must match the SDF.
                                                       <li> 0: USGS 
                                                       <li> 1: IGBP(20 category): IGBP must be selected if NoahMP is used 
                                                       <li> 2: UMD (13 category) 
+                                                      <li> 3: NLCD40 (40 category, NOAH WRFv4 only)
+                                                      <li> 4: USGS-RUC (28 category, NOAH WRFv4 only)
+                                                      <li> 5: MODIS-RUC (21 category, NOAH WRFv4 only)
                                                       </ul>
                                                       <td>2
+<tr><td>nvegcat
 <tr><td>isot            <td> lsm_noah, lsm_ruc, \ref noahmpdrv          <td>flag for soil type dataset choice:\n 
                                                       <ul> 
                                                       <li> 0: Zobler soil type (9 category) 
                                                       <li> 1: STATSGO soil type (19 category): STATSGO must be selected if NoahMP is used
+                                                      <li> 2: STAS-RUC soil type (19 category, NOAH WRFv4 only
                                                       </ul>
                                                       <td>0
-
+<tr><td>exticeden       <td> lsm_noah,lsm_ruc     <td>flag for calculating frozen precip ice density outside of the LSM   <td>.false.
 <tr><td>iopt_dveg         <td> \ref noahmpdrv         <td>options for dynamic vegetation  \n
                                                          <ul>
                                                          <li>1: off (use table LAI; use FVEG = SHDFAC from input)
@@ -613,7 +623,15 @@ show some variables in the namelist that must match the SDF.
                                                       <li>4: kb inversed 
                                                       </ul>
                                                       <td>2
+<tr><td>mosaic_lu
+<tr><td>mosaic_soil
+<tr><td>isncond_opt
+<tr><td>isncovr_opt
 <tr><td colspan="4" align= center>\b Parameters \b related \b to \b other \b surface \b scheme \b options
+<tr><td>lkm
+<tr><td>iopt_lake
+<tr><td>lakedepth_threshold
+<tr><td>lakefrac_threshold
 <tr><td>nstf_name(5)    <td>sfc_nst                   <td>NSST related paramters:\n                                                         
                                                       <ul>
                                                       <li> nstf_name(1): 0=NSST off, 1= NSST on but uncoupled, 2= NSST on and coupled

From 57f72fbc73b9704a23285867645b8927fedc87fb Mon Sep 17 00:00:00 2001
From: Man Zhang <man.zhang@noaa.gov>
Date: Wed, 5 Jul 2023 14:54:28 -0600
Subject: [PATCH 049/115] Scidoc updates

---
 physics/cu_gf_deep.F90                    |  1 +
 physics/docs/library.bib                  | 19 +++++++-
 physics/docs/pdftxt/CU_GF_deep.txt        | 28 +++--------
 physics/docs/pdftxt/GFS_SATMEDMFVDIFQ.txt | 33 ++++++++-----
 physics/docs/pdftxt/suite_input.nml.txt   | 58 ++++++++++++++++-------
 physics/satmedmfvdifq.F                   | 12 +++--
 6 files changed, 92 insertions(+), 59 deletions(-)

diff --git a/physics/cu_gf_deep.F90 b/physics/cu_gf_deep.F90
index 67dd9bd3f..1b30063bd 100644
--- a/physics/cu_gf_deep.F90
+++ b/physics/cu_gf_deep.F90
@@ -28,6 +28,7 @@ module cu_gf_deep
      integer, parameter :: autoconv=1 !2
      integer, parameter :: aeroevap=1 !3
      real(kind=kind_phys), parameter :: scav_factor = 0.5
+
      real(kind=kind_phys), parameter :: dx_thresh = 6500.
 !> still 16 ensembles for clousres
      integer, parameter:: maxens3=16
diff --git a/physics/docs/library.bib b/physics/docs/library.bib
index 7c01fbc65..34bb54e8f 100644
--- a/physics/docs/library.bib
+++ b/physics/docs/library.bib
@@ -1,13 +1,30 @@
 %% This BibTeX bibliography file was created using BibDesk.
 %% https://bibdesk.sourceforge.io/
 
-%% Created for Man Zhang at 2023-06-07 10:17:09 -0600 
+%% Created for Man Zhang at 2023-06-28 14:13:48 -0600 
 
 
 %% Saved with string encoding Unicode (UTF-8) 
 
 
 
+@article{Chen_2022,
+	author = {Xiaomin Chen and George H. Bryan and Andrew Hazelton and Frank D. Marks and Pat Fitzpatrick},
+	date-added = {2023-06-28 14:13:19 -0600},
+	date-modified = {2023-06-28 14:13:19 -0600},
+	doi = {10.1175/waf-d-21-0168.1},
+	journal = {Weather and Forecasting},
+	month = {jun},
+	number = {6},
+	pages = {935--951},
+	publisher = {American Meteorological Society},
+	title = {Evaluation and Improvement of a {TKE}-Based Eddy-Diffusivity Mass-Flux ({EDMF}) Planetary Boundary Layer Scheme in Hurricane Conditions},
+	url = {https://doi.org/10.1175%2Fwaf-d-21-0168.1},
+	volume = {37},
+	year = 2022,
+	bdsk-url-1 = {https://doi.org/10.1175%2Fwaf-d-21-0168.1},
+	bdsk-url-2 = {https://doi.org/10.1175/waf-d-21-0168.1}}
+
 @article{Lin_2022,
 	author = {Jialin Lin and Taotao Qian and Peter Bechtold and Georg Grell and Guang J. Zhang and Ping Zhu and Saulo R. Freitas and Hannah Barnes and Jongil Han},
 	date-added = {2023-06-07 10:16:46 -0600},
diff --git a/physics/docs/pdftxt/CU_GF_deep.txt b/physics/docs/pdftxt/CU_GF_deep.txt
index 365ba9ae0..1a02516f7 100644
--- a/physics/docs/pdftxt/CU_GF_deep.txt
+++ b/physics/docs/pdftxt/CU_GF_deep.txt
@@ -16,41 +16,25 @@ statistical mass flux characteristic of deep, congestus, and shallow (respective
 a spectrum of plumes within the grid box. Forcing is different for each characteristic type. Entrainment and detrainment are derived 
 from the PDF's. The deep and congestus convection considers scale awareness (Arakawa et al. (2011) \cite Arakawa_2011 ). However, the shallow convection is not scale-aware. Aerosol dependence is implemented through dependence of rain generation and 
 evaporation formulations depending on the cloud concentration nuclei at cloud base (Berry 1968 \cite berry_1968, 
-Jiang et al.(2010) \cite Jiang_2010, and Lee and Feingold (2010) \cite lee_and_feingold_2010 ). Wet scavenging is considered to add a memory impact. Aerosol dependence is considered experimental and 
-is turned off at this point. GF is able to transport tracers.
+Jiang et al.(2010) \cite Jiang_2010, and Lee and Feingold (2010) \cite lee_and_feingold_2010 ). Wet scavenging is considered to add a memory impact. Aerosol dependence is considered experimental and is turned off at this point. GF is able to transport tracers.
+Recently, GPU capabilities and cap suppressing (\p do_cap_suppress) based on radar data assimilation have been added,and they are used only for the RAP suite.
 
-\b CCPP \b v6.0.0 \b Updates:
-
-- GPU capabilities have been added
-- Cap suppressing (\p do_cap_suppress) based on radar data assimilation has been added. This is used only for the RAP suite
-- Some fixed parameters have been made scale-aware
-- Updated coupling between radiation and convection has been implemented 
-
-\b Operational \b Impacts \b in \b RAP/HRRR
-
-  - Uses mass-flux schemes, which are more physically realistic than (sounding) adjustment schemes
-  - Takes parameterization uncertainty into account by allowing parameters from multiple convective schemes which can be perturbed 
-internally or with temporal and spatial correlation patterns
-  - For higher resolutions (less than 10 km), in addition to scale awareness as in Arakawa et al. (2011) \cite Arakawa_2011 GF can
-transition as grid spacing decreases into a shallow convection scheme
-  - Coupled to the grid scale precipitation and radiation schemes through passing of diagnosed cloud liquid and ice from simulated
-precipitating convective cloud and shallow convective clouds
+The impacts of GF scheme in operational RAP/HRRR include:(a)uses mass-flux schemes, which are more physically realistic than (sounding) adjustment schemes;
+(b)takes parameterization uncertainty into account by allowing parameters from multiple convective schemes which can be perturbed 
+internally or with temporal and spatial correlation patterns; (c)for higher resolutions (less than 10 km), in addition to scale awareness as in Arakawa et al. (2011) \cite Arakawa_2011 GF can transition as grid spacing decreases into a shallow convection scheme; (d)Coupled to the grid scale precipitation and radiation schemes through passing of diagnosed cloud liquid and ice from simulated precipitating convective cloud and shallow convective clouds.
 
 \section version_cugf_enh CCPP Physics Updates
 
 \version UFS-SRW v3.0.0
-- Updates for aerosol-awareness (experimental)
 
 \b The \b Implementation \b of \b GF \b in \b RRFS
-
+- Updates for aerosol-awareness (experimental)
 - Scale-awareness is turned off when explicit microphysics is not active anywhere in the column
 - GF completely is turned off at grid points when MYNN produces shallow convection at that point
 - Radar reflectivity considers mass flux PDF as well as whether scale-awareness is turned on at the grid point in equation.
 
 \b The \b implementation \b of \b GF \b in \b HAFS \b is \b undergoing.
 
-
-
 \section intra_rough_gf Intraphysics Communication
 The GF scheme passes cloud hydrometeors to the grid-scale microphysics scheme (\ref THOMPSON ) through detrainment from each 
 convective cloud layer containing convective cloud. The detrained condensate interacts with short- and longwave radiation by 
diff --git a/physics/docs/pdftxt/GFS_SATMEDMFVDIFQ.txt b/physics/docs/pdftxt/GFS_SATMEDMFVDIFQ.txt
index 4e00d7c3c..3ae1a0234 100644
--- a/physics/docs/pdftxt/GFS_SATMEDMFVDIFQ.txt
+++ b/physics/docs/pdftxt/GFS_SATMEDMFVDIFQ.txt
@@ -25,27 +25,34 @@ to take into account nonlocal transport by large eddies(mfpbltq.f)
 - A new mass-flux paramterization for stratocumulus-top-induced turbulence mixing has been introduced (mfscuq.f; previously,
 it was an eddy diffusion form)
 - For local turbulence mixing, a TKE closure model is used.
-
-
-\section v6_pbl_enh CCPP Physics Updates
-\version CCPP v6.0.0
-
-- Wind shear effect in characteristic mixing length calculation is included, which 
+- Wind shear effect in characteristic mixing length calculation is included, which
 reduces the mixing length in a strong shear environment such as a hurricane.
-- To better predict surface inversion as well as capping inversion near the PBL top, 
-background diffusivity in the inversion layers is reduced as a function of surface 
+- To better predict surface inversion as well as capping inversion near the PBL top,
+background diffusivity in the inversion layers is reduced as a function of surface
 roughness and green vegetation fraction.
-- To reduce the PBL overgrowth, the PBL updraft overshoot is not only limited by 
-bulk Richardson number-based-PBL depth, but the virtual potential temperature at 
-top of the surface layer rather than that at the model first layer is also used as 
-the near-surface virtual potential temperature in the bulk-Richardson number 
+- To reduce the PBL overgrowth, the PBL updraft overshoot is not only limited by
+bulk Richardson number-based-PBL depth, but the virtual potential temperature at
+top of the surface layer rather than that at the model first layer is also used as
+the near-surface virtual potential temperature in the bulk-Richardson number
 computation. This helps to largely suppress the unrealistic widespread popcorn-like precipitation.
 - Updraft entrainment rates for moisture, hydrometeors, and tracers are increased by about 30%.
-- A positive definite total variation diminishing (TVD) mass-flux transport scheme for moisture, hydrometeors, 
+- A positive definite total variation diminishing (TVD) mass-flux transport scheme for moisture, hydrometeors,
 and tracers and a method for removing negative tracer mixing ratio values have been implemented.
 
 \sa NCEP Office Note 505 \cite https://doi.org/10.25923/cybh-w893 and 506 \cite https://doi.org/10.25923/5051-3r70
 
+
+\section v6_pbl_enh CCPP Physics Updates
+\version UFS-SRW v3.0.0
+- To reduce the negative hurricane intensity biases, a parameterization for environmental wind shear effect
+is included in the GFS TKE-EDMF PBL and cumulus schemes. In addition, the entrainment rates are enhanced 
+proportional to the sub-cloud or PBL mean TKE (turbulent kinetic energy) when TKE is larger than a threshold
+value. 
+
+- To enhance the underestimated CAPE forecasts in the GFS, the entrainment rate in the TKE-EDMF PBL scheme is
+increased as a function of vegetation fraction and surface roughness length.
+
+
 \section intra_satmedmfvdifq Intraphysics Communication
 - \ref arg_table_satmedmfvdifq_run
 
diff --git a/physics/docs/pdftxt/suite_input.nml.txt b/physics/docs/pdftxt/suite_input.nml.txt
index 11d33db1c..e986fc322 100644
--- a/physics/docs/pdftxt/suite_input.nml.txt
+++ b/physics/docs/pdftxt/suite_input.nml.txt
@@ -222,10 +222,13 @@ show some variables in the namelist that must match the SDF.
 <tr><td>xkzm_h          <td> \ref satmedmfvdifq          <td>background vertical diffusion for heat and q        <td>1.0d0
 <tr><td>xkzm_m          <td> \ref satmedmfvdifq           <td>background vertical diffusion for momentum          <td>1.0d0
 <tr><td>xkzm_s          <td> \ref satmedmfvdifq           <td>sigma threshold for background mom. diffusion       <td>1.0d0
-<tr><td>dspfac          <td> \ref satmedmfvdifq     <td>TKE dissipative heating factor                    <td>1.0
+<tr><td>dspfac          <td> \ref satmedmfvdifq           <td>TKE dissipative heating factor                    <td>1.0
 <tr><td>bl_upfr         <td> \ref satmedmfvdifq             <td>updraft fraction in boundary layer mass flux scheme       <td>0.13
 <tr><td>bl_dnfr         <td> \ref satmedmfvdifq             <td>downdraft fraction in boundary layer mass flux scheme     <td>0.1  
-<tr><td>grav_settling   <td>mynnedmf_wrapper          <td>flag to activate gravitational settling of cloud droplets as described in Nakanishi (2000) \cite nakanishi_2000 <td>0
+<tr><td>rlmx            <td> \ref satmedmfvdifq           <td>maximum allowed mixing length in boundary layer mass flux scheme <td>300.
+<tr><td>elmx            <td> \ref satmedmfvdifq           <td>maximum allowed dissipation mixing length in boundary layer mass flux scheme <td>300.
+<tr><td>sfc_rlm         <td> \ref satmedmfvdifq           <td>choice of near surface mixing lenghth in boundary layer mass flux scheme     <td>0
+<tr><td>tc_pbl          <td> \ref satmedmfvdifq           <td>control for TC applications in the PBL scheme           <td>0
 <tr><td>bl_mynn_mixlength    <td>mynnedmf_wrapper     <td>flag for different version of mixing length formulation \n 
                                                       <ul>
                                                       <li> 0: Original form from Nakanishi and Niino (2009) \cite NAKANISHI_2009 . NO scale-awareness is applied to the master mixing length, regardless of "scaleware" setting 
@@ -518,7 +521,6 @@ show some variables in the namelist that must match the SDF.
                                                       <li> 5: MODIS-RUC (21 category, NOAH WRFv4 only)
                                                       </ul>
                                                       <td>2
-<tr><td>nvegcat
 <tr><td>isot            <td> lsm_noah, lsm_ruc, \ref noahmpdrv          <td>flag for soil type dataset choice:\n 
                                                       <ul> 
                                                       <li> 0: Zobler soil type (9 category) 
@@ -616,22 +618,42 @@ show some variables in the namelist that must match the SDF.
                                                          </ul>
                                                          <td>1
 <tr><td>iopt_trs    <td>\ref noahmpdrv                   <td>options for thermal roughness scheme:\n 
-                                                      <ul>
-                                                      <li>1: z0h=z0m  
-                                                      <li>2: canopy based czil
-                                                      <li>3: ec 
-                                                      <li>4: kb inversed 
-                                                      </ul>
-                                                      <td>2
-<tr><td>mosaic_lu
-<tr><td>mosaic_soil
-<tr><td>isncond_opt
-<tr><td>isncovr_opt
+                                                         <ul>
+                                                         <li>1: z0h=z0m  
+                                                         <li>2: canopy based czil
+                                                         <li>3: ec 
+                                                         <li>4: kb inversed 
+                                                         </ul>
+                                                         <td>2
+<tr><td>mosaic_lu        <td>\ref lsm_ruc                <td> control for use of fractional landuse in RUC land surface model    
+                                                         <ul>
+                                                         <li>1: use of fractional landuse in RUC LSM
+                                                         </ul>
+                                                         <td>0
+<tr><td>mosaic_soil      <td>\ref lsm_ruc                <td> control for use of fractional soil in RUC land surface model       
+                                                         <ul>
+                                                         <li>1: use of fractional soil in RUC LSM
+                                                         </ul>
+                                                         <td>0
+<tr><td>isncond_opt      <td>\ref lsm_ruc                <td> control for soil thermal conductivity option in RUC land surface model    
+                                                         <ul>
+                                                         <li>1: constant
+                                                         <li>2: Sturm et al.(1997) \cite sturm_1997
+                                                         </ul>
+                                                         <td>1
+<tr><td>isncovr_opt      <td>\ref lsm_ruc                <td> control for snow cover fraction option in RUC land surface model 
+                                                         <ul>
+                                                         <li>1: original formulation using threshold snow depth to compute snow fraction 
+                                                         <li>2: Niu-Yang(2007) \cite Niu_2007
+                                                         <li>3: updated Niu-Yang similar to Noah MP
+                                                         </ul>
+                                                         <td>1
 <tr><td colspan="4" align= center>\b Parameters \b related \b to \b other \b surface \b scheme \b options
-<tr><td>lkm
-<tr><td>iopt_lake
-<tr><td>lakedepth_threshold
-<tr><td>lakefrac_threshold
+<tr><td>lkm              <td>\ref clm_lake                         <td>0: no lake; 1: lake; 2: lake&nsst             <td>0
+<tr><td>iopt_lake        <td>\ref clm_lake                         <td>1: flake; 2: CLM lake                         <td>2
+<tr><td>lakedepth_threshold     <td>\ref clm_lake                  <td> lakedepth must be greater than this value to enable a lake model    <td>1.0
+<tr><td>lakefrac_threshold      <td>\ref clm_lake                  <td> lakefrac must be greater than this value to enable a lake model     <td>0.0
+<tr><td>use_lake2m              <td>\ref clm_lake                  <td> use 2m T&Q from CLM lake model      <td>.false.
 <tr><td>nstf_name(5)    <td>sfc_nst                   <td>NSST related paramters:\n                                                         
                                                       <ul>
                                                       <li> nstf_name(1): 0=NSST off, 1= NSST on but uncoupled, 2= NSST on and coupled
diff --git a/physics/satmedmfvdifq.F b/physics/satmedmfvdifq.F
index 75925a5f3..73fc4aff8 100644
--- a/physics/satmedmfvdifq.F
+++ b/physics/satmedmfvdifq.F
@@ -22,7 +22,7 @@ module satmedmfvdifq
 !! and to reduce the negative wind speed bias in upper troposphere
 !!
 !! Incorporate the LES-based changes for TC simulation
-!! (Chen et al.,2022, https://doi.org/10.1175/WAF-D-21-0168.1)
+!! (Chen et al.,2022 \cite Chen_2022)
 !! with additional improvements on MF working with Cu schemes
 !! Xiaomin Chen, 5/2/2022
 !!
@@ -443,7 +443,9 @@ subroutine satmedmfvdifq_run(im,km,ntrac,ntcw,ntrw,               &
          endif
       enddo
 !           
-! compute a function for green vegetation fraction and surface roughness
+!>  - Compute a function for green vegetation fraction and surface roughness.
+!! Entrainment rate in updraft is a function of vegetation fraction and surface
+!! roughness length
 !       
       do i = 1,im
         tem = (sigmaf(i) - vegflo) / (vegfup - vegflo)
@@ -745,7 +747,7 @@ subroutine satmedmfvdifq_run(im,km,ntrac,ntcw,ntrw,               &
         endif
       enddo
 !
-!  compute mean tke within pbl
+!>  - Compute mean tke within pbl
 !
       do i = 1, im
         sumx(i) = 0.
@@ -766,8 +768,8 @@ subroutine satmedmfvdifq_run(im,km,ntrac,ntcw,ntrw,               &
         endif
       enddo
 !
-!  compute wind shear term as a sink term for updraft and downdraft
-!  velocity
+!>  - Compute wind shear term as a sink term for updraft and downdraft
+!!  velocity
 !
       kps = max(kmpbl, kmscu)
       do k = 2, kps

From 8cd25865431326adcb0baba7cf692124abcea5d7 Mon Sep 17 00:00:00 2001
From: Man Zhang <man.zhang@noaa.gov>
Date: Thu, 13 Jul 2023 10:45:18 -0600
Subject: [PATCH 050/115] narrative description for previous update

---
 physics/docs/pdftxt/GFS_SAMFdeep.txt | 2 --
 physics/docs/pdftxt/THOMPSON.txt     | 9 ++++-----
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/physics/docs/pdftxt/GFS_SAMFdeep.txt b/physics/docs/pdftxt/GFS_SAMFdeep.txt
index d41763c37..1112cb05c 100644
--- a/physics/docs/pdftxt/GFS_SAMFdeep.txt
+++ b/physics/docs/pdftxt/GFS_SAMFdeep.txt
@@ -65,8 +65,6 @@
  rain conversion rate, entrainment and detrainment rates, overshooting layers,
  and maximum allowable cloudbase mass flux (as of June 2018).
 
-\b CCPP \b v6.0.0 \b Updates
-
 \subsection ca_page Cellular Automata Stochastic Convective Organization Scheme 
 
 \b Scientific \b Background
diff --git a/physics/docs/pdftxt/THOMPSON.txt b/physics/docs/pdftxt/THOMPSON.txt
index fed003ebd..4ad481887 100644
--- a/physics/docs/pdftxt/THOMPSON.txt
+++ b/physics/docs/pdftxt/THOMPSON.txt
@@ -70,10 +70,8 @@ for the model to provide useful guidance for aircraft icing forecasts
 
 - Can account for cloud phase changes and provides a sound physical basis for diagnosing precipitation type reaching the ground
 
-\section v6_enh_thompson CCPP Physics Updates
-\version CCPP v6.0.0
 
-Three mechanisms are available improve the stability of the scheme for weather forecast applications: 
+Recently, three mechanisms have been implemented to improve the stability of the scheme for weather forecast applications: 
 \a inner \a loop, \a subcycle, and \a semi-Lagrangian \a sedimentation \a of \a rain \a and \a graupel. 
 The inner loop  and the subcycle are similar in that the physics time step is subdivided and the scheme 
 is activated more often than others in the physics suite. However, they differ in implementation. 
@@ -82,9 +80,10 @@ Conversely, the subcycle method is controlled by CCPP Framework through the "sub
 The two methods should be used exclusively. The Semi-Lagrangian sedimentation of rain and graupel (based on Juang and Hong 2010 \cite Henry_Juang_2010 ) 
 increases numerical stability by applying the subtime step only to sedimentation computation. 
 Two namelist variables control the usage of the semi-Lagrangian sedimentation, \p sedi_semi and \p decfl. 
-\p sedi_semi is set to ‘true’ to activate the method. Decfl is a parameter that needs to avoid deformation of the arriving grids, currently, "10". 
+\p sedi_semi is set to ‘true’ to activate the method. \p Decfl is a parameter that needs to avoid deformation of the arriving grids, currently, "10". 
 
-\version SRW v3.0.0
+\section v6_enh_thompson CCPP Physics Updates
+\version UFS-SRW v3.0.0
 
 - The ice generation supersaturation requirement for nonaerosol option is reduced from 0.25 to 0.15. The purpose is to generate more ice in
 the upper level and reduce the OLR bias.

From 2a56d372655acc6bf0a7da4fa0ccff3beb6727cf Mon Sep 17 00:00:00 2001
From: "Michael Kavulich, Jr" <kavulich@ucar.edu>
Date: Fri, 30 Jun 2023 13:39:16 -0600
Subject: [PATCH 051/115] Host large images remotely

---
 physics/docs/pdftxt/CLM_LAKE.txt | 6 +++---
 physics/docs/pdftxt/RUCLSM.txt   | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/physics/docs/pdftxt/CLM_LAKE.txt b/physics/docs/pdftxt/CLM_LAKE.txt
index e0a8d9209..d78244cb2 100644
--- a/physics/docs/pdftxt/CLM_LAKE.txt
+++ b/physics/docs/pdftxt/CLM_LAKE.txt
@@ -36,7 +36,7 @@ in the UFS SRW App, is capable of capturing the effect of lakes on regional heat
 Lake depths for the RRFS lake configuration (Fig.1) are assigned from a global dataset provided by Kourzeneva et al.(2012) \cite Kourzeneva_2012,
 this dataset is referred to as GLOBv3 bathymetry in the UFS_UTL.
 
-\image html Lake_depths_RRFS3km.png "Figure 1: Lake depths for lakes in the 3-km RRFS domain." width=600
+@image html https://user-images.githubusercontent.com/12705538/250180794-76af93a2-a7ba-4e9a-9478-5657198862b8.png "Figure 1: Lake depths for lakes in the 3-km RRFS domain." width=600
 
 To cold-start the CLM lake model in the UFS SRW App:
 - Use the CLM option in the input.nml
@@ -48,8 +48,8 @@ To cold-start the CLM lake model in the UFS SRW App:
 - Lake ice at the top level is initialized from the GFS ice concentration
 
 The differences of surface variables from the experimental RRFS 6-h forecast with/without CLM lake model are shown in Figure 2 for 2-m temperature and in Figure 3 for 2-m dewpoint.
-\image html diff_t2m_lake_rrfs.png "Figure 2: Differences of 2-m temperature between the RRFS coupled to the CLM model and the RRFS without CLM." width=600
-\image html diff_td2m_lake_rrfs.png "Figure 3: Differences of 2-m dew point between the RRFS coupled to the CLM model and the RRFS without CLM." width=600
+@image html https://user-images.githubusercontent.com/12705538/250180790-63159300-33f6-4b34-9e9c-b65885213c30.png "Figure 2: Differences of 2-m temperature between the RRFS coupled to the CLM model and the RRFS without CLM." width=600
+@image html https://user-images.githubusercontent.com/12705538/250180787-8fc9a820-5f80-4f06-b50a-88b2d20ebc53.png "Figure 3: Differences of 2-m dew point between the RRFS coupled to the CLM model and the RRFS without CLM." width=600
  
 
 
diff --git a/physics/docs/pdftxt/RUCLSM.txt b/physics/docs/pdftxt/RUCLSM.txt
index 7a39faf84..a836e7b93 100644
--- a/physics/docs/pdftxt/RUCLSM.txt
+++ b/physics/docs/pdftxt/RUCLSM.txt
@@ -43,7 +43,7 @@ to determine the uncertainty range for the selected parameters in the RUC LSM.
 
 ## RUC LSM characteristics that differ from Noah LSM:
 \image html ruc_lsm_veg_soil.png "Figure 1: RUC LSM Vegetation and Soil Model (Courtesy of T.G. Smirnova) " width=900
-\image html ruc_ranking.png "Figure 2: Model ranking as a function of normalized root mean square error of snow water equivalent and surface temperature (Courtesy of C. Menard)" width=900
+@image html https://user-images.githubusercontent.com/12705538/250180784-d50a3d4c-93db-4d8d-b12d-2c0ca22da5c3.png "Figure 2: Model ranking as a function of normalized root mean square error of snow water equivalent and surface temperature (Courtesy of C. Menard)" width=900
 - \b Implicit \b solution of energy and moisture budgets in the layer spanning the ground surface
 - \b 9 \b soil \b levels with high vertical resolution near surface
 RUC LSM has more levels in soil than \ref GFS_NOAH model with higher resolution near the interface with the atmosphere
@@ -80,7 +80,7 @@ Snow forms additional two layers on top of soil in RUC LSM
 \image html ruc_lsm_mosaic.png "Figure 4: 'Mosaic' approach for patchy snow (Courtesy of T.G. Smirnova) " width=900
   - New: additional options to compute snow cover fraction (\p isncovr_opt =2 and 3, Niu and Yang (2007) \cite Niu_2007). These options allowed to reduce overprediction of number of grid cells fully covered with snow which further reduced cold-biases over snow. Figure 5 demonstrates that option 3 of snow cover fraction computation (\p isncovr_opt = 3) in the UFS-based regional model matches better the satellite data for the test case on 6 February 2022.
 - New: added an option to use of a new formulation of snow thermal conductivity (\p isncond_opt = 2, Sturm et al. (1997) \cite sturm_1997);
-\image html sncov_rrfs_ruc.png "Figure 5: Snow cover fraction from MODIS (a,b), Regional UFS-based system (RRFS) original (c), and modified with isncover_opt=3 (d), 6 February 2022. (Courtesy of T.G. Smirnova)"  width=900
+@image html https://user-images.githubusercontent.com/12705538/250180782-925303ec-7751-4d7e-be8f-b3f1323f35d4.png "Figure 5: Snow cover fraction from MODIS (a,b), Regional UFS-based system (RRFS) original (c), and modified with isncover_opt=3 (d), 6 February 2022. (Courtesy of T.G. Smirnova)"  width=900
 - Iterative snow melting algorithm;
 - Density of snow on the ground - a function of compaction parameter and snow depth and temperature;
 - Snow albedo - a function of temperature and snow fraction;

From 9e35de10adecef6bdb21a53ea6d9e5350384c60c Mon Sep 17 00:00:00 2001
From: "samuel.trahan" <Samuel.Trahan@noaa.gov>
Date: Mon, 24 Jul 2023 15:03:57 +0000
Subject: [PATCH 052/115] Changes to logging and initialization of the CLM Lake
 Model.

1. Use ice thickness hice(i) to find the level in the lake where ice is
   zero.
2. Do not allow lake temperature to be below freezing point if there is
   no ice.
3. If there is no snow or ice, do not allow surface lake temperature to
   be below freezing point.
   These changes fixed the problem with large errors in the energy budget
   at the beginning of the cold-start run with lakes.
4. Added flag to turn on debug print statements in the CLM lake model.
---
 physics/clm_lake.f90         | 295 ++++++++++++++++++++++++-----------
 physics/clm_lake.meta        |  14 ++
 physics/module_sf_ruclsm.F90 |   2 +
 3 files changed, 223 insertions(+), 88 deletions(-)

diff --git a/physics/clm_lake.f90 b/physics/clm_lake.f90
index 4fc4112ce..21843af58 100644
--- a/physics/clm_lake.f90
+++ b/physics/clm_lake.f90
@@ -42,6 +42,7 @@ MODULE clm_lake
     integer, parameter, public :: kind_lake = kind_dbl_prec
 
     logical :: LAKEDEBUG = .false. ! Enable lots of checks and debug prints and errors
+    logical :: DEBUG_PRINT = .false. ! Enable lots of checks and debug prints and errors
 
     logical, parameter :: PERGRO = .false.
 
@@ -167,7 +168,7 @@ logical function limit_temperature_by_climatology(xlat_d,xlon_positive)
            .not. (xlon_d.gt.-112.104 .and. xlon_d.lt.-112.100))then
 
          if(xlat_d.gt.39.5 .and. xlat_d.lt.41.22) then
-            if(lakedebug) then
+            if(debug_print) then
                print *,'The Great Salt Lake south of 41.22 N, lat,lon',xlat_d,xlon_d
             endif
             limit_temperature_by_climatology = .true.
@@ -175,7 +176,7 @@ logical function limit_temperature_by_climatology(xlat_d,xlon_positive)
          elseif(( xlat_d.ge.41.22 .and. xlat_d.lt.42.) .and. .not. &
                                 ! excludes Willard Bay
               (xlat_d.gt.41.352 .and. xlat_d.lt.41.354)) then
-            if(lakedebug) then
+            if(debug_print) then
                print *,'The Great Salt Lake north of 41.22 N xlat_d,xlon_d ',xlat_d,xlon_d
             endif
             !print *,'Ice fraction on the GSL ', i,j,lake_icefrac3d(i,:,j)
@@ -200,30 +201,31 @@ subroutine is_salty(xlat_d,xlon_positive, cannot_freeze, salty)
       xlon_d = xlon_positive
       if(xlon_d>180) xlon_d = xlon_d - 360
 
+      ! for the Great Salt Lake
       cannot_freeze = limit_temperature_by_climatology(xlat_d,xlon_d)
       salty = cannot_freeze
 
-     other_locations: if(include_all_salty_locations) then
       ! --- The Mono Lake in California, salinity is 75 ppt with freezing point at
       ! --- -4.2 C (Stan). The Mono Lake lat/long (37.9-38.2, -119.3 - 118.8)
       if (xlon_d.gt.-119.3.and. xlon_d.lt.-118.8) then  
          if(xlat_d.gt.37.9 .and. xlat_d.lt.38.2) then
             salty = .true.
-            if(lakedebug) then
+            if(debug_print) then
                print *,'Salty Mono Lake, i,j',xlat_d,xlon_d
             endif
          endif ! xlat_d
       endif ! xlon_d
 
+     other_locations: if(include_all_salty_locations) then
       ! --- Caspian Sea and Dead Sea are salty too (Sam, Tanya)
       if ( xlat_d>36.5_kind_phys .and. xlat_d<47.1_kind_phys .and. xlon_d>46.8_kind_phys .and. xlon_d<55.0_kind_phys ) then
-         if(lakedebug) then
+         if(debug_print) then
             print *,'Salty Caspian Sea ',xlat_d,xlon_d
          endif
          salty = .true.
       end if 
       if ( xlon_d>35.3 .and. xlon_d<35.6 .and. xlat_d>31.3 .and. xlat_d<31.8) then
-         if(lakedebug) then
+         if(debug_print) then
             print *,'Salty Dead Sea ',xlat_d,xlon_d
          endif
          salty = .true.
@@ -239,7 +241,7 @@ end subroutine is_salty
     !!
     SUBROUTINE clm_lake_run( &
          ! Model time and metadata:
-         im, km, me, master, fhour, IDATE, kdt,                                   &
+         flag_restart, im, km, me, master, fhour, IDATE, kdt,                     &
 
          ! Configuration and initialization:
          iopt_lake, iopt_lake_clm, min_lakeice, lakedepth_default, use_lakedepth, &
@@ -280,6 +282,7 @@ SUBROUTINE clm_lake_run( &
     !
     ! Model time and metadata:
     !
+    LOGICAL , INTENT (IN) :: flag_restart
     INTEGER , INTENT (IN) :: im,km,me,master
     INTEGER, INTENT(IN) :: IDATE(4), kdt
     REAL(KIND_PHYS), INTENT(IN) :: fhour
@@ -300,7 +303,7 @@ SUBROUTINE clm_lake_run( &
     !
     REAL(KIND_PHYS), DIMENSION(:), INTENT(IN):: &
          tg3, pgr, zlvl, qvcurr, xlat_d, xlon_d, ch, cm, &
-         dlwsfci, dswsfci, oro_lakedepth, wind, rho0, tsfc, &
+         dlwsfci, dswsfci, oro_lakedepth, wind, rho0, &
          rainncprv, raincprv
     REAL(KIND_PHYS), DIMENSION(:,:), INTENT(in) :: gu0, gv0, prsi, gt0, phii
     LOGICAL, DIMENSION(:), INTENT(IN) :: flag_iter
@@ -311,7 +314,7 @@ SUBROUTINE clm_lake_run( &
     !
     REAL(KIND_PHYS), DIMENSION(:), INTENT(INOUT) :: &
          evap_wat,     evap_ice,   hflx_wat,    hflx_ice,  gflx_wat, gflx_ice,    &
-         ep1d_water,   ep1d_ice,   tsurf_water, tsurf_ice, tsfc_wat, tisfc,       &
+         ep1d_water,   ep1d_ice,   tsurf_water, tsurf_ice, tsfc_wat, tisfc, tsfc, &
          weasdi,       snodi,      hice,        qss_water, qss_ice,               &
          cmm_water,    cmm_ice,    chh_water,   chh_ice,                          &
          uustar_water, uustar_ice, lake_t_snow, albedo,    zorlw,                 &
@@ -451,6 +454,7 @@ SUBROUTINE clm_lake_run( &
       dtime=dtp
 
         ! Initialize any uninitialized lake points.
+       if(.not.flag_restart) then
         call lakeini(kdt=kdt, ISLTYP=ISLTYP, gt0=gt0, snowd=snowd, weasd=weasd,           &
                               lakedepth_default=lakedepth_default, fhour=fhour,           &
              oro_lakedepth=oro_lakedepth, savedtke12d=savedtke12d, snowdp2d=snowdp2d,     &
@@ -458,7 +462,7 @@ SUBROUTINE clm_lake_run( &
              lake_icefrac3d=lake_icefrac3d, z_lake3d=z_lake3d, dz_lake3d=dz_lake3d,       &
              t_soisno3d=t_soisno3d, h2osoi_ice3d=h2osoi_ice3d, h2osoi_liq3d=h2osoi_liq3d, &
              h2osoi_vol3d=h2osoi_vol3d, z3d=z3d, dz3d=dz3d, zi3d=zi3d, watsat3d=watsat3d, &
-             csol3d=csol3d, tkmg3d=tkmg3d, fice=fice, min_lakeice=min_lakeice,            &
+             csol3d=csol3d, tkmg3d=tkmg3d, fice=fice, hice=hice, min_lakeice=min_lakeice, &
              tsfc=tsfc,                                                                   &
              use_lake_model=use_lake_model, use_lakedepth=use_lakedepth, tkdry3d=tkdry3d, &
              tksatu3d=tksatu3d, im=im, prsi=prsi, xlat_d=xlat_d, xlon_d=xlon_d,           &
@@ -480,6 +484,7 @@ SUBROUTINE clm_lake_run( &
           errflg=1
           return
         endif
+      endif ! .not. restart
 
       lake_points=0
       snow_points=0
@@ -498,14 +503,14 @@ SUBROUTINE clm_lake_run( &
 
         wght2 = day_of_month/month_length(month)
         if(wght2<0 .or. wght2>1) then
-          if(lakedebug) then
+          if(debug_print) then
             write(0,*) 'Warning: wght2 is not 0..1: ',wght2
           endif
           wght2 = max(0.0_kind_lake,min(1.0_kind_lake,wght2))
         endif
         wght1 = 1.0_kind_lake - wght2
   
-        if(LAKEDEBUG .and. me==0) then
+        if(debug_print ) then
           print *,'month,num1,num2,wght1,wght2',month,num1,num2,wght1,wght2
         endif
       
@@ -516,13 +521,13 @@ SUBROUTINE clm_lake_run( &
           call is_salty(xlat_d(i),xlon_d(i),salty_flag,cannot_freeze_flag)
 
            if(salty_flag) then
-              salty(i) = 1
+              salty(i) = 1 ! The Great Salt Lake and Mono Lake
            else
               salty(i) = 0
            endif
 
            if(cannot_freeze_flag) then
-              cannot_freeze(i) = 1
+              cannot_freeze(i) = 1 ! only the Great Salt Lake
            else
               cannot_freeze(i) = 0
            endif
@@ -570,13 +575,7 @@ SUBROUTINE clm_lake_run( &
             t_grnd(c)              = t_grnd2d(i)
             do k = 1,nlevlake
                t_lake(c,k)        = t_lake3d(i,k)
-               !-- If T of salty lakes is above the freezing point, keep them ice free
-               if(salty(i)==1 .and. t_lake(c,k) > tfrz .and.  lake_icefrac3d(i,k) > 0.) then
-                  lake_icefrac(c,k)  = 0.
-               else
-                  lake_icefrac(c,k)  = lake_icefrac3d(i,k)
-               endif
-               !lake_icefrac(c,k)  = lake_icefrac3d(i,k)
+               lake_icefrac(c,k)  = lake_icefrac3d(i,k)
                z_lake(c,k)        = z_lake3d(i,k)
                dz_lake(c,k)       = dz_lake3d(i,k)
             enddo
@@ -633,23 +632,29 @@ SUBROUTINE clm_lake_run( &
            do c = 1,column
 
             if(cannot_freeze(i) == 1) then
-              t_grnd(c) = max(274.5_kind_lake,t_grnd(c))
+            !  The Great Salt Lake
               do k = 1,nlevlake
-                t_lake(c,k) = max(274.5_kind_lake,t_lake(c,k))
-                lake_icefrac(c,k) = 0.
+                lake_icefrac(c,k) = 0._kind_lake
               enddo
-            endif
-
-            if(salty(i)/=0) then
-             Tclim = tfrz + wght1*saltlk_T(num1)  &
-                          + wght2*saltlk_T(num2)
-             if(lakedebug) print *,'Tclim,tsfc,t_lake3d',i,Tclim,t_grnd(c),t_lake(c,:),t_soisno(c,:)
-             t_grnd(c) = min(Tclim+3.0_kind_lake,(max(t_grnd(c),Tclim-3.0_kind_lake)))
-             do k = 1,nlevlake
-               t_lake(c,k) = min(Tclim+3.0_kind_lake,(max(t_lake(c,k),Tclim-3.0_kind_lake)))
-             enddo
-             t_soisno(c,1) = min(Tclim+3.0_kind_lake,(max(t_soisno(c,1),Tclim-3.0_kind_lake)))
-             if(lakedebug) print *,'After Tclim,tsfc,t_lake3d',i,Tclim,t_grnd(c),t_lake(c,:),t_soisno(c,:)
+              !  bound lake temperture with the climatology
+              Tclim = tfrz + wght1*saltlk_T(num1)  &
+                           + wght2*saltlk_T(num2)
+              if(debug_print) print *,'GSL - Tclim,tsfc,t_lake3d',i,Tclim,t_grnd(c),t_lake(c,:),t_soisno(c,:)
+              t_grnd(c) = min(Tclim+3.0_kind_lake,(max(t_grnd(c),Tclim-3.0_kind_lake)))
+              do k = 1,nlevlake
+                t_lake(c,k) = min(Tclim+3.0_kind_lake,(max(t_lake(c,k),Tclim-3.0_kind_lake)))
+              enddo
+              t_soisno(c,1) = min(Tclim+3.0_kind_lake,(max(t_soisno(c,1),Tclim-3.0_kind_lake)))
+              if(debug_print) print *,'GSL - after Tclim,tsfc,t_lake3d',i,Tclim,t_grnd(c),t_lake(c,:),t_soisno(c,:)
+            elseif(salty(i) == 1) then
+            ! Mono Lake never freezes, its temperature is above freezing point = -4.2 C
+                t_grnd(c) = max(tfrz-4.2_kind_lake,t_grnd(c))
+              do k = 1,nlevlake
+                lake_icefrac(c,k) = 0._kind_lake
+                t_lake(c,k) = max(tfrz-4.2_kind_lake,t_lake(c,k))
+              enddo
+              t_soisno(c,1) = max(tfrz-4.2_kind_lake,t_soisno(c,1))
+              if(debug_print) print *,'Mono - tsfc,t_lake3d',i,t_grnd(c),t_lake(c,:),t_soisno(c,:)
             endif 
            
             savedtke12d(i)         = savedtke1(c)
@@ -689,7 +694,10 @@ SUBROUTINE clm_lake_run( &
                 gflx_wat(I)     = eflx_gnet(c)              ![W/m/m]   upward_heat_flux_in_soil_over_water
                 ep1d_water(i)   = eflx_lh_tot(c)            ![W/m/m]   surface_upward_potential_latent_heat_flux_over_water
                 tsurf_water(I)  = t_grnd(c)                 ![K]       surface skin temperature after iteration over water
+                tsurf_ice(i)    = t_grnd(i)                 ! surface_skin_temperature_after_iteration_over_ice
                 tsfc_wat(i)     = t_grnd(c)                 ![K]       surface skin temperature over water
+                tisfc(i)        = t_grnd(c)
+                tsfc(i)         = t_grnd(c)
                 lake_t2m(I)     = t_ref2m(c)                ![K]       temperature_at_2m_from_clm_lake
                 lake_q2m(I)     = q_ref2m(c)                ! [frac] specific_humidity_at_2m_from_clm_lake
                 albedo(i)       = ( 0.6 * lake_icefrac3d(i,1) ) + &  ! mid_day_surface_albedo_over_lake
@@ -716,7 +724,9 @@ SUBROUTINE clm_lake_run( &
                 cmm_water(i)    = cm(i)*wind(i)             ! surface_drag_wind_speed_for_momentum_in_air_over_water
 
                 ice_point: if(fice(i)>=min_lakeice) then
+                  ! Icy lake
                   ! Most ice variables are identical to water variables.
+                  if(debug_print) print *,'Icy xlat_d(i),xlon_d(i),frac_ice,frac_grid ',xlat_d(i),xlon_d(i),frac_ice,frac_grid
                   if(frac_ice .or. frac_grid) then
                     evap_ice(i)   = evap_wat(i)               ! kinematic_surface_upward_latent_heat_flux_over_ice
                     hflx_ice(i)   = hflx_wat(i)               ! kinematic_surface_upward_sensible_heat_flux_over_ice
@@ -728,11 +738,13 @@ SUBROUTINE clm_lake_run( &
 !                    uustar_ice(i) = uustar_water(i)           ! surface_friction_velocity_over_ice
                   endif
 
-                  tsurf_ice(i)  = tsurf_water(i)            ! surface_skin_temperature_after_iteration_over_ice
+                  tsurf_ice(i)  = t_grnd(i)                 ! surface_skin_temperature_after_iteration_over_ice
                   tisfc(i)      = t_grnd(c)                 ! surface_skin_temperature_over_ice
+                  tsfc(i)       = t_grnd(c)                 ! surface_skin_temperature_over_ice
                   weasdi(i)     = h2osno(c)                 ! water_equivalent_accumulated_snow_depth_over_ice
-                  snodi(i)      = snowdp(c)                 ! surface_snow_thickness_water_equivalent_over_ice
-                  tsurf_ice(i)  = t_grnd(c)                 ! surface_skin_temperature_after_iteration_over_ice
+                  snodi(i)      = snowdp(c)*1.e3            ! surface_snow_thickness_water_equivalent_over_ice
+                  weasd(i)      = weasdi(i)
+                  snowd(i)      = snodi(c)                  ! surface_snow_thickness_water_equivalent_over_ice
 
                   ! Ice points are icy:
                   icy(i)=.true.                             ! flag_nonzero_sea_ice_surface_fraction
@@ -754,8 +766,11 @@ SUBROUTINE clm_lake_run( &
                   icy(i)=.false.
                   weasdi(i) = 0
                   snodi(i) = 0
+                  weasd(i) = 0
+                  snowd(i) = 0
                   tisfc(i) = t_grnd(c)
                   tsurf_ice(i) = tisfc(i)
+                  tsfc(i) = t_grnd(c)
                   hice(i) = 0
                   fice(i) = 0
                 endif ice_point
@@ -774,7 +789,7 @@ SUBROUTINE clm_lake_run( &
         endif if_lake_is_here
         ENDDO lake_top_loop
 
-        if(LAKEDEBUG .and. lake_points>0 .and. (kdt<3 .or. mod(kdt,30)==3)) then
+        if(debug_print .and. lake_points>0 .and. (kdt<3 .or. mod(kdt,30)==3)) then
 3082       format('lake points processed in timestep ',I0,' by rank ',I0,' = ',I0,' snow=',I0,' ice=',I0)
            print 3082,kdt,me,lake_points,snow_points,ice_points
         endif
@@ -956,7 +971,7 @@ SUBROUTINE LakeMain(forc_t,forc_pbot,forc_psrf,forc_hgt,forc_hgt_q,     & !I
                                  t_lake,t_soisno,h2osoi_liq,                 &
                                  h2osoi_ice,savedtke1,                       &
                                  watsat, tksatu, tkmg, tkdry, csol, dtime,   &
-                                 frac_iceold,qflx_snomelt,imelt,errmsg,errflg)
+                                 frac_iceold,qflx_snomelt,imelt,errmsg,errflg,xlat_d,xlon_d)
     if(errflg/=0) then
       return ! State is invalid now, so pass error to caller.
     endif
@@ -1486,7 +1501,7 @@ SUBROUTINE ShalLakeFluxes(forc_t,forc_pbot,forc_psrf,forc_hgt,forc_hgt_q,
        qflx_evap_tot(p) = qflx_evap_soi(p)
        eflx_lh_tot(p)   = htvp(c)*qflx_evap_soi(p)
        eflx_lh_grnd(p)  = htvp(c)*qflx_evap_soi(p)
-       if(LAKEDEBUG) then
+       if(debug_print) then
 1604     format('CLM_Lake ShalLakeFluxes: c=',I0,' sensible heat = ',F12.4,' latent heat =',F12.4, &
                 ' ground temp = ', F12.4, ' h2osno = ', F12.4, ' at xlat_d=',F10.3,' xlon_d=',F10.3)
          print 1604, c, eflx_sh_tot(p), eflx_lh_tot(p), t_grnd(c), h2osno(c),xlat_d,xlon_d
@@ -1564,7 +1579,7 @@ SUBROUTINE ShalLakeTemperature(t_grnd,h2osno,sabg,dz,dz_lake,z,zi,           & !
                                  t_lake,t_soisno,h2osoi_liq,                 &
                                  h2osoi_ice,savedtke1,                       &
                                  watsat, tksatu, tkmg, tkdry, csol, dtime,   &
-                                 frac_iceold,qflx_snomelt,imelt,errmsg,errflg)
+                                 frac_iceold,qflx_snomelt,imelt,errmsg,errflg,xlat_d,xlon_d)
   !=======================================================================================================
   ! !DESCRIPTION:
   ! Calculates temperatures in the 20-25 layer column of (possible) snow,
@@ -1652,6 +1667,7 @@ SUBROUTINE ShalLakeTemperature(t_grnd,h2osno,sabg,dz,dz_lake,z,zi,           & !
     implicit none
 
     !in:
+    real(kind_lake),intent(in) :: xlat_d,xlon_d
     integer, intent(inout) :: errflg
     real(kind_lake), intent(in) :: watsat(1,nlevsoil)      ! volumetric soil water at saturation (porosity)
     real(kind_lake), intent(in) :: tksatu(1,nlevsoil)      ! thermal conductivity, saturated soil [W/m-K]
@@ -2015,6 +2031,15 @@ SUBROUTINE ShalLakeTemperature(t_grnd,h2osno,sabg,dz,dz_lake,z,zi,           & !
                    + cfus*dz_lake(c,j)*(1._kind_lake-lake_icefrac(c,j)) !&
           !                   + (cwat-cice_eff)*lake_icefrac(c)*tfrz*dz_lake(c,j) !enthalpy reconciliation term
           t_lake_bef(c,j) = t_lake(c,j)
+         if(debug_print) then
+           if (abs(xlat_d-52.1152).lt.0.1 .and.     &
+            abs(xlon_d-260.405).lt.0.1)then
+            print *,' ocvts(c) at xlat_d,xlon_d',xlat_d,xlon_d
+            print *,'j,dz_lake(c,j) ', j,dz_lake(c,j)
+            print*,'cv_lake(c,j),lake_icefrac(c,j),t_lake(c,j),cfus,ocvts(c)', &
+                    cv_lake(c,j),lake_icefrac(c,j),t_lake(c,j),cfus,ocvts(c)
+           endif
+         endif
        end do
     end do
 
@@ -2030,6 +2055,15 @@ SUBROUTINE ShalLakeTemperature(t_grnd,h2osno,sabg,dz,dz_lake,z,zi,           & !
              ocvts(c) = ocvts(c) + cv(c,j)*(t_soisno(c,j)-tfrz) &
                       + hfus*h2osoi_liq(c,j) !&
              !                      + (cpliq-cpice)*h2osoi_ice(c,j)*tfrz !enthalpy reconciliation term
+         if(debug_print) then
+           if (abs(xlat_d-52.1152).lt.0.1 .and.     &
+               abs(xlon_d-260.405).lt.0.1)then
+             print *,' ocvts(c) at xlat_d,xlon_d',xlat_d,xlon_d
+             print *,' j,jtop(c)',j,jtop(c),'h2osoi_liq(c,j) ',h2osoi_liq(c,j),'h2osoi_ice(c,j)',h2osoi_ice(c,j)
+             print *,' cv(c,j),t_soisno(c,j),hfus,ocvts(c)',c,j,cv(c,j),t_soisno(c,j),hfus,ocvts(c)
+             print *,' h2osno(c)',h2osno(c)
+           endif
+         endif
              if (j == 1 .and. h2osno(c) > 0._kind_lake .and. j == jtop(c)) then
                 ocvts(c) = ocvts(c) - h2osno(c)*hfus
              end if
@@ -2373,9 +2407,9 @@ SUBROUTINE ShalLakeTemperature(t_grnd,h2osno,sabg,dz,dz_lake,z,zi,           & !
              c = filter_shlakec(fc)
              if (rhow(c,j) > rhow(c,j+1) .or. &
                 (lake_icefrac(c,j) < 1._kind_lake .and. lake_icefrac(c,j+1) > 0._kind_lake) ) then
-               if(LAKEDEBUG) then
+               if(debug_print) then
                  if (i==1)  then
-                   print *, 'Convective Mixing in column ', c, '.'
+                   print *, 'Convective Ice Mixing in column ', c, 'lake_icefrac(c,j) ',lake_icefrac(c,j),lake_icefrac(c,j+1)
                  endif
                endif
                 qav(c) = qav(c) + dz_lake(c,i)*(t_lake(c,i)-tfrz) * & 
@@ -2447,6 +2481,8 @@ SUBROUTINE ShalLakeTemperature(t_grnd,h2osno,sabg,dz,dz_lake,z,zi,           & !
                 rhow(c,i) = (1._kind_lake - lake_icefrac(c,i)) * & 
                             1000._kind_lake*( 1.0_kind_lake - 1.9549e-05_kind_lake*(abs(t_lake(c,i)-277._kind_lake))**1.68_kind_lake ) &
                           + lake_icefrac(c,i)*denice
+                if (debug_print .and. lake_icefrac(c,j) > 0.)print *,'rhow(c,i),lake_icefrac(c,i),t_lake(c,i)',  &
+                                                                    i,rhow(c,i),lake_icefrac(c,i),t_lake(c,i),denice
              end if
           end do
        end do
@@ -2462,7 +2498,7 @@ SUBROUTINE ShalLakeTemperature(t_grnd,h2osno,sabg,dz,dz_lake,z,zi,           & !
           c = filter_shlakec(fc)
 
           cv_lake(c,j) = dz_lake(c,j) * (cwat*(1._kind_lake-lake_icefrac(c,j)) + cice_eff*lake_icefrac(c,j))
-          if (LAKEDEBUG) then
+          if (debug_print .and. lake_icefrac(c,j) > 0.) then
             print *,'Lake Ice Fraction, c, level:', c, j, lake_icefrac(c,j)
           endif
        end do
@@ -2485,6 +2521,15 @@ SUBROUTINE ShalLakeTemperature(t_grnd,h2osno,sabg,dz,dz_lake,z,zi,           & !
                    + cfus*dz_lake(c,j)*(1._kind_lake-lake_icefrac(c,j)) !&
           !                   + (cwat-cice_eff)*lake_icefrac(c)*tfrz*dz_lake(c,j) !enthalpy reconciliation term
           fin(c) = fin(c) + phi(c,j)
+         if(debug_print) then
+           if (abs(xlat_d-52.1152).lt.0.1 .and.     &
+               abs(xlon_d-260.405).lt.0.1)then
+             print *,' ncvts(c) at  xlat_d,xlon_d',xlat_d,xlon_d
+             print *,' new cv_lake(c,j),t_lake(c,j),cfus,lake_icefrac(c,j),ncvts(c),fin(c)', &
+                         j,cv_lake(c,j),t_lake(c,j),cfus,lake_icefrac(c,j),ncvts(c),fin(c)
+             print *,' new dz_lake(c,j),fin(c),phi(c,j)',c,dz_lake(c,j),fin(c),phi(c,j)
+           endif
+         endif
        end do
     end do
 
@@ -2499,6 +2544,15 @@ SUBROUTINE ShalLakeTemperature(t_grnd,h2osno,sabg,dz,dz_lake,z,zi,           & !
              ncvts(c) = ncvts(c) + cv(c,j)*(t_soisno(c,j)-tfrz) &
                       + hfus*h2osoi_liq(c,j) !&
              !                      + (cpliq-cpice)*h2osoi_ice(c,j)*tfrz !enthalpy reconciliation term
+          if(debug_print) then
+            if (abs(xlat_d-52.1152).lt.0.1 .and.     &
+                abs(xlon_d-260.405).lt.0.1)then
+              print *,' ncvts(c) at xlat_d,xlon_d',xlat_d,xlon_d
+              print *,'new j,jtop(c)',j,jtop(c),'h2osoi_liq(c,j) ',h2osoi_liq(c,j),'h2osoi_ice(c,j)',h2osoi_ice(c,j)
+              print *,'new cv(c,j),t_soisno(c,j),hfus,ncvts(c)',c,j,cv(c,j),t_soisno(c,j),hfus,ncvts(c)
+              print *,'new h2osno(c)',h2osno(c)
+            endif
+          endif
              if (j == 1 .and. h2osno(c) > 0._kind_lake .and. j == jtop(c)) then
                 ncvts(c) = ncvts(c) - h2osno(c)*hfus
              end if
@@ -2514,21 +2568,44 @@ SUBROUTINE ShalLakeTemperature(t_grnd,h2osno,sabg,dz,dz_lake,z,zi,           & !
        p = filter_shlakep(fp)
        c = pcolumn(p)
        errsoi(c) = (ncvts(c)-ocvts(c)) / dtime - fin(c)
-       if( (LAKEDEBUG .and. abs(errsoi(c)) < 1._kind_lake) ) then
-!            .or. (.not.LAKEDEBUG .and. abs(errsoi(c)) < 10._kind_lake)) then
+      if(debug_print) then
+        if (abs(xlat_d-52.1152).lt.0.1 .and.     &
+            abs(xlon_d-260.405).lt.0.1)then
+          print *,'xlat_d,xlon_d',xlat_d,xlon_d
+          print *,'errsoi(c),fin(c),ncvts(c),ocvts(c),dtime,lake_icefrac(c,:),h2osno(c)', &
+                   errsoi(c),fin(c),ncvts(c),ocvts(c),dtime,lake_icefrac(c,:),h2osno(c)
+        endif
+      endif
+      if( .not.LAKEDEBUG ) then
+       if (abs(errsoi(c)) < 10._kind_lake)  then
+          eflx_sh_tot(p) = eflx_sh_tot(p) - errsoi(c)
+          eflx_sh_grnd(p) = eflx_sh_grnd(p) - errsoi(c)
+          eflx_soil_grnd(p) = eflx_soil_grnd(p) + errsoi(c)
+          eflx_gnet(p) = eflx_gnet(p) + errsoi(c)
+          if(debug_print) then
+            if (abs(errsoi(c)) > 1.e-1_kind_lake) then
+              print *,'errsoi incorporated at xlat_d,xlon_d',xlat_d,xlon_d
+              print *,'errsoi incorporated into sensible heat in ShalLakeTemperature: c, (W/m^2):', c, errsoi(c)
+            end if
+          endif
+          errsoi(c) = 0._kind_lake
+       endif
+      elseif ( LAKEDEBUG) then
+        if (abs(errsoi(c)) < 1._kind_lake)  then
           eflx_sh_tot(p) = eflx_sh_tot(p) - errsoi(c)
           eflx_sh_grnd(p) = eflx_sh_grnd(p) - errsoi(c)
           eflx_soil_grnd(p) = eflx_soil_grnd(p) + errsoi(c)
           eflx_gnet(p) = eflx_gnet(p) + errsoi(c)
-          !          if (abs(errsoi(c)) > 1.e-3_kind_lake) then
           if (abs(errsoi(c)) > 1.e-1_kind_lake) then
              print *,'errsoi incorporated into sensible heat in ShalLakeTemperature: c, (W/m^2):', c, errsoi(c)
           end if
           errsoi(c) = 0._kind_lake
-       else if(LAKEDEBUG) then
+        else
           print *,'Soil Energy Balance Error at column, ', c, 'G, fintotal, column E tendency = ', &
-             eflx_gnet(p), fin(c), (ncvts(c)-ocvts(c)) / dtime
-       end if
+             eflx_gnet(p), fin(c), (ncvts(c)-ocvts(c)) / dtime,'xlat_d,xlon_d',xlat_d,xlon_d
+          print *,'ncvts(c),ocvts(c),dtime,errsoi(c)',ncvts(c),ocvts(c),dtime,errsoi(c),'xlat_d,xlon_d',xlat_d,xlon_d
+        end if
+      end if ! LAKEDEBUG
     end do
     ! This loop assumes only one point per column.
 
@@ -3483,7 +3560,7 @@ subroutine ShalLakeHydrology(dz_lake,forc_rain,forc_snow,                      &
                 h2osno(c) = 0._kind_lake
                 snl(c) = 0
                 ! The rest of the bookkeeping for the removed snow will be done below.
-                if (LAKEDEBUG) then
+                if (debug_print) then
                   print *,'Snow layers removed above unfrozen lake for column, snowice:', &
                        c, sumsnowice(c)
                 endif
@@ -3633,7 +3710,7 @@ subroutine ShalLakeHydrology(dz_lake,forc_rain,forc_snow,                      &
 
        ! Insure water balance using qflx_qrgwl
        qflx_qrgwl(c)     = forc_rain(g) + forc_snow(g) - qflx_evap_tot(p) - (endwb(c)-begwb(c))/dtime
-       if (LAKEDEBUG) then
+       if (debug_print) then
          print *,'c, rain, snow, evap, endwb, begwb, qflx_qrgwl:', &
               c, forc_rain(g), forc_snow(g), qflx_evap_tot(p), endwb(c), begwb(c), qflx_qrgwl(c)
        endif
@@ -5141,18 +5218,19 @@ end subroutine MoninObukIni
   !!
   subroutine clm_lake_init(con_pi,karman,con_g,con_sbc,con_t0c,rhowater,con_csol,con_cliq, &
                            con_hfus,con_hvap,con_rd,con_cp,rholakeice,clm_lake_debug, &
-                           con_eps_model,con_fvirt_model,errmsg,errflg)
+                           clm_debug_print,con_eps_model,con_fvirt_model,errmsg,errflg)
     implicit none
     real(kind_phys), intent(in) :: con_pi,karman,con_g,con_sbc,con_t0c, &
          rhowater,con_csol,con_cliq, con_hfus,con_hvap,con_rd,con_cp, &
          rholakeice,con_eps_model,con_fvirt_model
     INTEGER, INTENT(OUT) :: errflg
     CHARACTER(*), INTENT(OUT) :: errmsg
-    logical, intent(in) :: clm_lake_debug
+    logical, intent(in) :: clm_lake_debug,clm_debug_print
     integer :: i, j
 
     LAKEDEBUG = clm_lake_debug
-    if(LAKEDEBUG) then
+    DEBUG_PRINT = clm_debug_print
+    if(debug_print) then
       write(0,*) 'clm_lake_init'
     endif
 
@@ -5249,7 +5327,7 @@ SUBROUTINE lakeini(kdt,            ISLTYP,          gt0,             snowd,
                     z_lake3d,       dz_lake3d,       t_soisno3d,      h2osoi_ice3d,   &
                     h2osoi_liq3d,   h2osoi_vol3d,    z3d,             dz3d,           &
                     zi3d,           watsat3d,        csol3d,          tkmg3d,         &
-                                    fice,            min_lakeice,     tsfc,           &
+                    fice,           hice,            min_lakeice,     tsfc,           &
                     use_lake_model, use_lakedepth,                                    &
                     tkdry3d,        tksatu3d,        im,              prsi,           &
                     xlat_d,         xlon_d,          clm_lake_initialized,            &
@@ -5276,7 +5354,7 @@ SUBROUTINE lakeini(kdt,            ISLTYP,          gt0,             snowd,
 
   INTEGER , INTENT (IN)    :: im, me, master, km, kdt
   REAL(KIND_PHYS),     INTENT(IN)  :: min_lakeice, fhour
-  REAL(KIND_PHYS), DIMENSION(IM), INTENT(INOUT)::   FICE
+  REAL(KIND_PHYS), DIMENSION(IM), INTENT(INOUT)::   FICE, hice
   REAL(KIND_PHYS), DIMENSION(IM), INTENT(IN)::   TG3, xlat_d, xlon_d
   REAL(KIND_PHYS), DIMENSION(IM), INTENT(IN)::     tsfc
   REAL(KIND_PHYS), DIMENSION(IM)  ,INTENT(INOUT)  :: clm_lake_initialized
@@ -5343,6 +5421,8 @@ SUBROUTINE lakeini(kdt,            ISLTYP,          gt0,             snowd,
   integer                  :: numb_lak    ! for debug
   character*256 :: message
   real(kind_lake) :: ht
+  real(kind_lake) :: rhosn
+  real(kind_lake) :: depth
 
   logical :: climatology_limits
 
@@ -5385,45 +5465,45 @@ SUBROUTINE lakeini(kdt,            ISLTYP,          gt0,             snowd,
       cycle
     endif
 
-    snowdp2d(i)         = snowd(i)*1e-3   ! SNOW in kg/m^2 and snowdp in m
-    h2osno2d(i)         = weasd(i)   ! mm 
-
     snl2d(i)                   = defval
     do k = -nlevsnow+1,nlevsoil
         h2osoi_liq3d(i,k)      = defval
         h2osoi_ice3d(i,k)      = defval
-	t_soisno3d(i,k)        = defval
+        h2osoi_vol3d(i,k)      = defval
+        t_soisno3d(i,k)        = defval
         z3d(i,k)               = defval 
         dz3d(i,k)              = defval                           
     enddo
     do k = 1,nlevlake 
-	t_lake3d(i,k)          = defval
+        t_lake3d(i,k)          = defval
         lake_icefrac3d(i,k)    = defval
         z_lake3d(i,k)          = defval
         dz_lake3d(i,k)         = defval
     enddo
     
-    if(fice(i)>min_lakeice) then
-      lake_icefrac3d(i,1) = fice(i)
-      snowdp2d(i)         = snowd(i)*1e-3   ! SNOW in kg/m^2 and snowdp in m
-      h2osno2d(i)         = weasd(i)   ! mm 
-    else
-      fice(i)             = 0.
-      snowd(i)            = 0.
-      weasd(i)            = 0.
-      snowdp2d(i)         = 0.
-      h2osno2d(i)         = 0.
-    endif
+    if (use_lake_model(i) == 1) then
+    !  for lake points only
+      z3d(i,:)             = 0.0
+      dz3d(i,:)            = 0.0
+      zi3d(i,:)            = 0.0
+      h2osoi_liq3d(i,:)    = 0.0
+      h2osoi_ice3d(i,:)    = 0.0
+      lake_icefrac3d(i,:)  = 0.0
+      h2osoi_vol3d(i,:)    = 0.0
+      snl2d(i)             = 0.0
+
+      if(fice(i)>min_lakeice) then
+        lake_icefrac3d(i,1) = fice(i)
+        snowdp2d(i)         = snowd(i)*1e-3   ! SNOW in kg/m^2 and snowdp in m
+        h2osno2d(i)         = weasd(i)   ! mm 
+      else
+        fice(i)             = 0.
+        snowd(i)            = 0.
+        weasd(i)            = 0.
+        snowdp2d(i)         = 0.
+        h2osno2d(i)         = 0.
+      endif
     
-    z3d(i,:)             = 0.0
-    dz3d(i,:)            = 0.0
-    zi3d(i,:)            = 0.0
-    h2osoi_liq3d(i,:)    = 0.0
-    h2osoi_ice3d(i,:)    = 0.0
-    lake_icefrac3d(i,:)  = 0.0
-    h2osoi_vol3d(i,:)    = 0.0
-    snl2d(i)             = 0.0
-
     ! Soil hydraulic and thermal properties
     isl = ISLTYP(i)   
     if (isl == 0  ) isl = 14
@@ -5559,19 +5639,45 @@ SUBROUTINE lakeini(kdt,            ISLTYP,          gt0,             snowd,
        return
      endif
 
+     if(lake_icefrac3d(i,1) > 0.) then
+       depth = 0.
+       do k=2,nlevlake
+         depth = depth + dz_lake3d(i,k)
+         if(hice(i) >= depth) then
+           lake_icefrac3d(i,k) = max(0.,lake_icefrac3d(i,1)+(0.-lake_icefrac3d(i,1))/z_lake3d(i,nlevlake)*depth)
+         else
+           lake_icefrac3d(i,k) = 0.
+         endif
+       end do
+     endif
 
      t_lake3d(i,1)        = tsfc(i)
      t_grnd2d(i)          = tsfc(i)
+     if (lake_icefrac3d(i,1) <= 0.) then
+       t_lake3d(i,1)        = max(tfrz,tsfc(i))
+       t_grnd2d(i)          = max(tfrz,tsfc(i))
+     endif
      do k = 2, nlevlake
        if(z_lake3d(i,k).le.depth_c) then
-         t_lake3d(i,k) = tsfc(i)+(277.0-tsfc(i))/depth_c*z_lake3d(i,k)
+         t_lake3d(i,k) = tsfc(i)+(277.2_kind_lake-tsfc(i))/depth_c*z_lake3d(i,k)
        else
-         t_lake3d(i,k) = 277.0
+         t_lake3d(i,k) = 277.2_kind_lake
        end if
+       if (lake_icefrac3d(i,k) <= 0.) then
+         t_lake3d(i,k) = max(tfrz,t_lake3d(i,k))
+       endif
      enddo
 
      ! initial t_soisno3d
-     t_soisno3d(i,1)         = t_lake3d(i,nlevlake)
+     ! in snow
+     if(snowdp2d(i) > 0.) then
+       do k = snl2d(i)+1, 0
+         t_soisno3d(i,k) =min(tfrz,tsfc(i))
+       enddo
+     endif
+
+     ! in soil
+     t_soisno3d(i,1)        = t_lake3d(i,nlevlake)
      t_soisno3d(i,nlevsoil) = tg3(i)
      do k = 2, nlevsoil-1
         t_soisno3d(i,k)=t_soisno3d(i,1)+(t_soisno3d(i,nlevsoil)-t_soisno3d(i,1))*dzsoi(k)
@@ -5599,6 +5705,17 @@ SUBROUTINE lakeini(kdt,            ISLTYP,          gt0,             snowd,
       endif
     enddo
 
+    !tgs - in RAP and HRRR applications with cycled snow depth and snow
+    !water equivalent, the actual snow density could be computed. This is
+    !not used for now for consistency with the main Lake subroutine, where
+    !constant snow density (250.) is used.
+    if(h2osno2d(i).gt.0. .and. snowdp2d(i).gt.0.) then
+       rhosn = h2osno2d(i)/snowdp2d(i)
+    else
+       rhosn = snow_bd ! bdsno=250.
+    endif
+
+
     do k = -nlevsnow+1, 0
       if (k > snl2d(i)) then
         h2osoi_ice3d(i,k) = dz3d(i,k)*snow_bd
@@ -5607,10 +5724,12 @@ SUBROUTINE lakeini(kdt,            ISLTYP,          gt0,             snowd,
     end do
 
     clm_lake_initialized(i) = 1
+
+    endif  !if ( use_lakedepth ) then
   ENDDO do_init
 
 
-  if(LAKEDEBUG .and. init_points>0) then
+  if(debug_print .and. init_points>0) then
     print *,'points initialized in clm_lake',init_points
   end if
 
diff --git a/physics/clm_lake.meta b/physics/clm_lake.meta
index bbaaded16..3de543078 100644
--- a/physics/clm_lake.meta
+++ b/physics/clm_lake.meta
@@ -7,6 +7,13 @@
 [ccpp-arg-table]
   name = clm_lake_run
   type = scheme
+[flag_restart]
+  standard_name = flag_for_restart
+  long_name = flag for restart (warmstart) or coldstart
+  units = flag
+  dimensions = ()
+  type = logical
+  intent = in
 [im]
   standard_name = horizontal_loop_extent
   long_name = horizontal loop extent
@@ -935,6 +942,13 @@
   type = logical
   active = (control_for_lake_model_selection == 3)
   intent = in
+[clm_debug_print]
+  standard_name = flag_for_printing_in_clm_lake_model
+  long_name = flag for printing in clm lake model
+  units = flag
+  dimensions = ()
+  type = logical
+  intent = in
 [errmsg]
   standard_name = ccpp_error_message
   long_name = error message for error handling in CCPP
diff --git a/physics/module_sf_ruclsm.F90 b/physics/module_sf_ruclsm.F90
index 6294bc068..160127e43 100644
--- a/physics/module_sf_ruclsm.F90
+++ b/physics/module_sf_ruclsm.F90
@@ -991,10 +991,12 @@ SUBROUTINE LSMRUC(xlat,xlon,                                 &
     if(mosaic_lu == 1) then
       ! greenness factor: between 0 for min greenness and 1 for max greenness.
       factor = max(zero,min(one,(vegfra(i,j)-shdmin(i,j))/max(one,(shdmax(i,j)-shdmin(i,j)))))
+           if (debug_print ) then
              if (abs(xlat-testptlat).lt.0.1 .and. &
                  abs(xlon-testptlon).lt.0.1)then
                  print *,'  lat,lon=',xlat,xlon,' factor=',factor
              endif
+           endif
 
       if((ivgtyp(i,j) == natural .or. ivgtyp(i,j) == crop) .and. factor > 0.75) then
       ! cropland or grassland, apply irrigation during the growing seaspon when fraction 

From 1fae3bc76e90a167e9929b28ec451586cdc42da4 Mon Sep 17 00:00:00 2001
From: "samuel.trahan" <Samuel.Trahan@noaa.gov>
Date: Thu, 27 Jul 2023 19:15:15 +0000
Subject: [PATCH 053/115] some missing changes from last commit

---
 physics/clm_lake.f90 | 51 +++++++++++++++++++++++++++-----------------
 1 file changed, 31 insertions(+), 20 deletions(-)

diff --git a/physics/clm_lake.f90 b/physics/clm_lake.f90
index 21843af58..c07773a57 100644
--- a/physics/clm_lake.f90
+++ b/physics/clm_lake.f90
@@ -454,7 +454,6 @@ SUBROUTINE clm_lake_run( &
       dtime=dtp
 
         ! Initialize any uninitialized lake points.
-       if(.not.flag_restart) then
         call lakeini(kdt=kdt, ISLTYP=ISLTYP, gt0=gt0, snowd=snowd, weasd=weasd,           &
                               lakedepth_default=lakedepth_default, fhour=fhour,           &
              oro_lakedepth=oro_lakedepth, savedtke12d=savedtke12d, snowdp2d=snowdp2d,     &
@@ -484,7 +483,6 @@ SUBROUTINE clm_lake_run( &
           errflg=1
           return
         endif
-      endif ! .not. restart
 
       lake_points=0
       snow_points=0
@@ -2032,8 +2030,8 @@ SUBROUTINE ShalLakeTemperature(t_grnd,h2osno,sabg,dz,dz_lake,z,zi,           & !
           !                   + (cwat-cice_eff)*lake_icefrac(c)*tfrz*dz_lake(c,j) !enthalpy reconciliation term
           t_lake_bef(c,j) = t_lake(c,j)
          if(debug_print) then
-           if (abs(xlat_d-52.1152).lt.0.1 .and.     &
-            abs(xlon_d-260.405).lt.0.1)then
+           if (abs(xlat_d-51.393).lt.0.1 .and.     &
+               abs(xlon_d-261.117).lt.0.1)then
             print *,' ocvts(c) at xlat_d,xlon_d',xlat_d,xlon_d
             print *,'j,dz_lake(c,j) ', j,dz_lake(c,j)
             print*,'cv_lake(c,j),lake_icefrac(c,j),t_lake(c,j),cfus,ocvts(c)', &
@@ -2056,8 +2054,8 @@ SUBROUTINE ShalLakeTemperature(t_grnd,h2osno,sabg,dz,dz_lake,z,zi,           & !
                       + hfus*h2osoi_liq(c,j) !&
              !                      + (cpliq-cpice)*h2osoi_ice(c,j)*tfrz !enthalpy reconciliation term
          if(debug_print) then
-           if (abs(xlat_d-52.1152).lt.0.1 .and.     &
-               abs(xlon_d-260.405).lt.0.1)then
+           if (abs(xlat_d-51.393).lt.0.1 .and.     &
+               abs(xlon_d-261.117).lt.0.1)then
              print *,' ocvts(c) at xlat_d,xlon_d',xlat_d,xlon_d
              print *,' j,jtop(c)',j,jtop(c),'h2osoi_liq(c,j) ',h2osoi_liq(c,j),'h2osoi_ice(c,j)',h2osoi_ice(c,j)
              print *,' cv(c,j),t_soisno(c,j),hfus,ocvts(c)',c,j,cv(c,j),t_soisno(c,j),hfus,ocvts(c)
@@ -2522,8 +2520,8 @@ SUBROUTINE ShalLakeTemperature(t_grnd,h2osno,sabg,dz,dz_lake,z,zi,           & !
           !                   + (cwat-cice_eff)*lake_icefrac(c)*tfrz*dz_lake(c,j) !enthalpy reconciliation term
           fin(c) = fin(c) + phi(c,j)
          if(debug_print) then
-           if (abs(xlat_d-52.1152).lt.0.1 .and.     &
-               abs(xlon_d-260.405).lt.0.1)then
+            if (abs(xlat_d-51.393).lt.0.1 .and.     &
+                abs(xlon_d-261.117).lt.0.1)then
              print *,' ncvts(c) at  xlat_d,xlon_d',xlat_d,xlon_d
              print *,' new cv_lake(c,j),t_lake(c,j),cfus,lake_icefrac(c,j),ncvts(c),fin(c)', &
                          j,cv_lake(c,j),t_lake(c,j),cfus,lake_icefrac(c,j),ncvts(c),fin(c)
@@ -2545,8 +2543,8 @@ SUBROUTINE ShalLakeTemperature(t_grnd,h2osno,sabg,dz,dz_lake,z,zi,           & !
                       + hfus*h2osoi_liq(c,j) !&
              !                      + (cpliq-cpice)*h2osoi_ice(c,j)*tfrz !enthalpy reconciliation term
           if(debug_print) then
-            if (abs(xlat_d-52.1152).lt.0.1 .and.     &
-                abs(xlon_d-260.405).lt.0.1)then
+            if (abs(xlat_d-51.393).lt.0.1 .and.     &
+                abs(xlon_d-261.117).lt.0.1)then
               print *,' ncvts(c) at xlat_d,xlon_d',xlat_d,xlon_d
               print *,'new j,jtop(c)',j,jtop(c),'h2osoi_liq(c,j) ',h2osoi_liq(c,j),'h2osoi_ice(c,j)',h2osoi_ice(c,j)
               print *,'new cv(c,j),t_soisno(c,j),hfus,ncvts(c)',c,j,cv(c,j),t_soisno(c,j),hfus,ncvts(c)
@@ -2569,8 +2567,8 @@ SUBROUTINE ShalLakeTemperature(t_grnd,h2osno,sabg,dz,dz_lake,z,zi,           & !
        c = pcolumn(p)
        errsoi(c) = (ncvts(c)-ocvts(c)) / dtime - fin(c)
       if(debug_print) then
-        if (abs(xlat_d-52.1152).lt.0.1 .and.     &
-            abs(xlon_d-260.405).lt.0.1)then
+        if (abs(xlat_d-51.393).lt.0.1 .and.     &
+            abs(xlon_d-261.117).lt.0.1)then
           print *,'xlat_d,xlon_d',xlat_d,xlon_d
           print *,'errsoi(c),fin(c),ncvts(c),ocvts(c),dtime,lake_icefrac(c,:),h2osno(c)', &
                    errsoi(c),fin(c),ncvts(c),ocvts(c),dtime,lake_icefrac(c,:),h2osno(c)
@@ -2603,7 +2601,9 @@ SUBROUTINE ShalLakeTemperature(t_grnd,h2osno,sabg,dz,dz_lake,z,zi,           & !
         else
           print *,'Soil Energy Balance Error at column, ', c, 'G, fintotal, column E tendency = ', &
              eflx_gnet(p), fin(c), (ncvts(c)-ocvts(c)) / dtime,'xlat_d,xlon_d',xlat_d,xlon_d
-          print *,'ncvts(c),ocvts(c),dtime,errsoi(c)',ncvts(c),ocvts(c),dtime,errsoi(c),'xlat_d,xlon_d',xlat_d,xlon_d
+          print *,'errsoi(c),ncvts(c),ocvts(c)',errsoi(c),ncvts(c),ocvts(c),'xlat_d,xlon_d',xlat_d,xlon_d
+          print *,'lake_icefrac(c,:),h2osno(c)', lake_icefrac(c,:),h2osno(c)
+          print *,'t_lake(c,:),t_soisno(c,:)',t_lake(c,:),t_soisno(c,:)
         end if
       end if ! LAKEDEBUG
     end do
@@ -5653,23 +5653,34 @@ SUBROUTINE lakeini(kdt,            ISLTYP,          gt0,             snowd,
 
      t_lake3d(i,1)        = tsfc(i)
      t_grnd2d(i)          = tsfc(i)
+
+     ! initial lake temperature
      if (lake_icefrac3d(i,1) <= 0.) then
-       t_lake3d(i,1)        = max(tfrz,tsfc(i))
-       t_grnd2d(i)          = max(tfrz,tsfc(i))
+     ! no ice
+       t_lake3d(i,1)        = max(tfrz,t_lake3d(i,1))
+       t_grnd2d(i)          = t_lake3d(i,1)
+     elseif (lake_icefrac3d(i,1) > 0. .and. lake_icefrac3d(i,1) < 1.) then
+     ! fractional ice
+       t_lake3d(i,1)        = tfrz
      endif
+
      do k = 2, nlevlake
        if(z_lake3d(i,k).le.depth_c) then
-         t_lake3d(i,k) = tsfc(i)+(277.2_kind_lake-tsfc(i))/depth_c*z_lake3d(i,k)
+         t_lake3d(i,k) = t_lake3d(i,1)+(277.2_kind_lake-t_lake3d(i,1))/depth_c*z_lake3d(i,k)
+         if (lake_icefrac3d(i,1) <= 0.) then
+         ! no ice
+           t_lake3d(i,k)        = max(tfrz,t_lake3d(i,k))
+         elseif (lake_icefrac3d(i,1) > 0. .and. lake_icefrac3d(i,1) < 1.) then
+         ! fractional ice
+           t_lake3d(i,k)        = tfrz
+         endif
        else
          t_lake3d(i,k) = 277.2_kind_lake
        end if
-       if (lake_icefrac3d(i,k) <= 0.) then
-         t_lake3d(i,k) = max(tfrz,t_lake3d(i,k))
-       endif
      enddo
 
      ! initial t_soisno3d
-     ! in snow
+     ! in snow on ice
      if(snowdp2d(i) > 0.) then
        do k = snl2d(i)+1, 0
          t_soisno3d(i,k) =min(tfrz,tsfc(i))

From 180c43b9ccd6dc268d79fccfafcb83cf5b4917f6 Mon Sep 17 00:00:00 2001
From: "samuel.trahan" <Samuel.Trahan@noaa.gov>
Date: Thu, 27 Jul 2023 21:09:05 +0000
Subject: [PATCH 054/115] yet more changes missing in prior commits

---
 physics/clm_lake.f90 | 45 +++++++++++++++++---------------------------
 1 file changed, 17 insertions(+), 28 deletions(-)

diff --git a/physics/clm_lake.f90 b/physics/clm_lake.f90
index c07773a57..262bad4e6 100644
--- a/physics/clm_lake.f90
+++ b/physics/clm_lake.f90
@@ -2030,8 +2030,8 @@ SUBROUTINE ShalLakeTemperature(t_grnd,h2osno,sabg,dz,dz_lake,z,zi,           & !
           !                   + (cwat-cice_eff)*lake_icefrac(c)*tfrz*dz_lake(c,j) !enthalpy reconciliation term
           t_lake_bef(c,j) = t_lake(c,j)
          if(debug_print) then
-           if (abs(xlat_d-51.393).lt.0.1 .and.     &
-               abs(xlon_d-261.117).lt.0.1)then
+           if (abs(xlat_d-52.1152).lt.0.1 .and.     &
+            abs(xlon_d-260.405).lt.0.1)then
             print *,' ocvts(c) at xlat_d,xlon_d',xlat_d,xlon_d
             print *,'j,dz_lake(c,j) ', j,dz_lake(c,j)
             print*,'cv_lake(c,j),lake_icefrac(c,j),t_lake(c,j),cfus,ocvts(c)', &
@@ -2054,8 +2054,8 @@ SUBROUTINE ShalLakeTemperature(t_grnd,h2osno,sabg,dz,dz_lake,z,zi,           & !
                       + hfus*h2osoi_liq(c,j) !&
              !                      + (cpliq-cpice)*h2osoi_ice(c,j)*tfrz !enthalpy reconciliation term
          if(debug_print) then
-           if (abs(xlat_d-51.393).lt.0.1 .and.     &
-               abs(xlon_d-261.117).lt.0.1)then
+           if (abs(xlat_d-52.1152).lt.0.1 .and.     &
+               abs(xlon_d-260.405).lt.0.1)then
              print *,' ocvts(c) at xlat_d,xlon_d',xlat_d,xlon_d
              print *,' j,jtop(c)',j,jtop(c),'h2osoi_liq(c,j) ',h2osoi_liq(c,j),'h2osoi_ice(c,j)',h2osoi_ice(c,j)
              print *,' cv(c,j),t_soisno(c,j),hfus,ocvts(c)',c,j,cv(c,j),t_soisno(c,j),hfus,ocvts(c)
@@ -2520,8 +2520,8 @@ SUBROUTINE ShalLakeTemperature(t_grnd,h2osno,sabg,dz,dz_lake,z,zi,           & !
           !                   + (cwat-cice_eff)*lake_icefrac(c)*tfrz*dz_lake(c,j) !enthalpy reconciliation term
           fin(c) = fin(c) + phi(c,j)
          if(debug_print) then
-            if (abs(xlat_d-51.393).lt.0.1 .and.     &
-                abs(xlon_d-261.117).lt.0.1)then
+           if (abs(xlat_d-52.1152).lt.0.1 .and.     &
+               abs(xlon_d-260.405).lt.0.1)then
              print *,' ncvts(c) at  xlat_d,xlon_d',xlat_d,xlon_d
              print *,' new cv_lake(c,j),t_lake(c,j),cfus,lake_icefrac(c,j),ncvts(c),fin(c)', &
                          j,cv_lake(c,j),t_lake(c,j),cfus,lake_icefrac(c,j),ncvts(c),fin(c)
@@ -2543,8 +2543,8 @@ SUBROUTINE ShalLakeTemperature(t_grnd,h2osno,sabg,dz,dz_lake,z,zi,           & !
                       + hfus*h2osoi_liq(c,j) !&
              !                      + (cpliq-cpice)*h2osoi_ice(c,j)*tfrz !enthalpy reconciliation term
           if(debug_print) then
-            if (abs(xlat_d-51.393).lt.0.1 .and.     &
-                abs(xlon_d-261.117).lt.0.1)then
+            if (abs(xlat_d-52.1152).lt.0.1 .and.     &
+                abs(xlon_d-260.405).lt.0.1)then
               print *,' ncvts(c) at xlat_d,xlon_d',xlat_d,xlon_d
               print *,'new j,jtop(c)',j,jtop(c),'h2osoi_liq(c,j) ',h2osoi_liq(c,j),'h2osoi_ice(c,j)',h2osoi_ice(c,j)
               print *,'new cv(c,j),t_soisno(c,j),hfus,ncvts(c)',c,j,cv(c,j),t_soisno(c,j),hfus,ncvts(c)
@@ -2567,8 +2567,8 @@ SUBROUTINE ShalLakeTemperature(t_grnd,h2osno,sabg,dz,dz_lake,z,zi,           & !
        c = pcolumn(p)
        errsoi(c) = (ncvts(c)-ocvts(c)) / dtime - fin(c)
       if(debug_print) then
-        if (abs(xlat_d-51.393).lt.0.1 .and.     &
-            abs(xlon_d-261.117).lt.0.1)then
+        if (abs(xlat_d-52.1152).lt.0.1 .and.     &
+            abs(xlon_d-260.405).lt.0.1)then
           print *,'xlat_d,xlon_d',xlat_d,xlon_d
           print *,'errsoi(c),fin(c),ncvts(c),ocvts(c),dtime,lake_icefrac(c,:),h2osno(c)', &
                    errsoi(c),fin(c),ncvts(c),ocvts(c),dtime,lake_icefrac(c,:),h2osno(c)
@@ -5653,34 +5653,23 @@ SUBROUTINE lakeini(kdt,            ISLTYP,          gt0,             snowd,
 
      t_lake3d(i,1)        = tsfc(i)
      t_grnd2d(i)          = tsfc(i)
-
-     ! initial lake temperature
      if (lake_icefrac3d(i,1) <= 0.) then
-     ! no ice
-       t_lake3d(i,1)        = max(tfrz,t_lake3d(i,1))
-       t_grnd2d(i)          = t_lake3d(i,1)
-     elseif (lake_icefrac3d(i,1) > 0. .and. lake_icefrac3d(i,1) < 1.) then
-     ! fractional ice
-       t_lake3d(i,1)        = tfrz
+       t_lake3d(i,1)        = max(tfrz,tsfc(i))
+       t_grnd2d(i)          = max(tfrz,tsfc(i))
      endif
-
      do k = 2, nlevlake
        if(z_lake3d(i,k).le.depth_c) then
-         t_lake3d(i,k) = t_lake3d(i,1)+(277.2_kind_lake-t_lake3d(i,1))/depth_c*z_lake3d(i,k)
-         if (lake_icefrac3d(i,1) <= 0.) then
-         ! no ice
-           t_lake3d(i,k)        = max(tfrz,t_lake3d(i,k))
-         elseif (lake_icefrac3d(i,1) > 0. .and. lake_icefrac3d(i,1) < 1.) then
-         ! fractional ice
-           t_lake3d(i,k)        = tfrz
-         endif
+         t_lake3d(i,k) = tsfc(i)+(277.2_kind_lake-tsfc(i))/depth_c*z_lake3d(i,k)
        else
          t_lake3d(i,k) = 277.2_kind_lake
        end if
+       if (lake_icefrac3d(i,k) <= 0.) then
+         t_lake3d(i,k) = max(tfrz,t_lake3d(i,k))
+       endif
      enddo
 
      ! initial t_soisno3d
-     ! in snow on ice
+     ! in snow
      if(snowdp2d(i) > 0.) then
        do k = snl2d(i)+1, 0
          t_soisno3d(i,k) =min(tfrz,tsfc(i))

From ace56af857fd760e29c50f67850f3620ed2bdda4 Mon Sep 17 00:00:00 2001
From: "samuel.trahan" <Samuel.Trahan@noaa.gov>
Date: Fri, 28 Jul 2023 03:12:46 +0000
Subject: [PATCH 055/115] t_grnd(i) should be t_grnd(c)

---
 physics/clm_lake.f90 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/physics/clm_lake.f90 b/physics/clm_lake.f90
index 262bad4e6..844c4ce71 100644
--- a/physics/clm_lake.f90
+++ b/physics/clm_lake.f90
@@ -692,7 +692,7 @@ SUBROUTINE clm_lake_run( &
                 gflx_wat(I)     = eflx_gnet(c)              ![W/m/m]   upward_heat_flux_in_soil_over_water
                 ep1d_water(i)   = eflx_lh_tot(c)            ![W/m/m]   surface_upward_potential_latent_heat_flux_over_water
                 tsurf_water(I)  = t_grnd(c)                 ![K]       surface skin temperature after iteration over water
-                tsurf_ice(i)    = t_grnd(i)                 ! surface_skin_temperature_after_iteration_over_ice
+                tsurf_ice(i)    = t_grnd(c)                 ! surface_skin_temperature_after_iteration_over_ice
                 tsfc_wat(i)     = t_grnd(c)                 ![K]       surface skin temperature over water
                 tisfc(i)        = t_grnd(c)
                 tsfc(i)         = t_grnd(c)

From c0c253f9fcec4c871b954533d912b1f3ec28b420 Mon Sep 17 00:00:00 2001
From: "samuel.trahan" <Samuel.Trahan@noaa.gov>
Date: Fri, 28 Jul 2023 15:19:25 +0000
Subject: [PATCH 056/115] fix another typo

---
 physics/clm_lake.f90 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/physics/clm_lake.f90 b/physics/clm_lake.f90
index 844c4ce71..edd9e2bd5 100644
--- a/physics/clm_lake.f90
+++ b/physics/clm_lake.f90
@@ -736,7 +736,7 @@ SUBROUTINE clm_lake_run( &
 !                    uustar_ice(i) = uustar_water(i)           ! surface_friction_velocity_over_ice
                   endif
 
-                  tsurf_ice(i)  = t_grnd(i)                 ! surface_skin_temperature_after_iteration_over_ice
+                  tsurf_ice(i)  = t_grnd(c)                 ! surface_skin_temperature_after_iteration_over_ice
                   tisfc(i)      = t_grnd(c)                 ! surface_skin_temperature_over_ice
                   tsfc(i)       = t_grnd(c)                 ! surface_skin_temperature_over_ice
                   weasdi(i)     = h2osno(c)                 ! water_equivalent_accumulated_snow_depth_over_ice

From 102d664840f70a86cab380295ac518bbcb58cbe4 Mon Sep 17 00:00:00 2001
From: "Michael Kavulich, Jr" <kavulich@ucar.edu>
Date: Mon, 31 Jul 2023 12:24:02 -0600
Subject: [PATCH 057/115] Some housekeeping: overwrite ccppsrw_doxyfile (no
 need to keep separate "v3" file), correct misspelled pages "shemes" -->
 "schemes"

---
 physics/docs/ccpp_doxyfile                    |   2 +-
 physics/docs/ccppsrw3_doxyfile                | 557 ------------------
 physics/docs/ccppsrw_doxyfile                 |  14 +-
 ...emes_list.txt => SRW_all_schemes_list.txt} |   0
 ...l_shemes_list.txt => all_schemes_list.txt} |   0
 5 files changed, 9 insertions(+), 564 deletions(-)
 delete mode 100644 physics/docs/ccppsrw3_doxyfile
 rename physics/docs/pdftxt/{SRW_all_shemes_list.txt => SRW_all_schemes_list.txt} (100%)
 rename physics/docs/pdftxt/{all_shemes_list.txt => all_schemes_list.txt} (100%)

diff --git a/physics/docs/ccpp_doxyfile b/physics/docs/ccpp_doxyfile
index 595ba2d85..9beb66ece 100644
--- a/physics/docs/ccpp_doxyfile
+++ b/physics/docs/ccpp_doxyfile
@@ -115,7 +115,7 @@ WARN_LOGFILE           =
 #---------------------------------------------------------------------------
 
 INPUT                  =  pdftxt/mainpage.txt              \
-                          pdftxt/all_shemes_list.txt     \
+                          pdftxt/all_schemes_list.txt     \
                           pdftxt/GFS_v16_suite.txt       \
                           pdftxt/GFS_v17_p8_suite.txt    \
                           pdftxt/RAP_suite.txt           \
diff --git a/physics/docs/ccppsrw3_doxyfile b/physics/docs/ccppsrw3_doxyfile
deleted file mode 100644
index b1cc3138c..000000000
--- a/physics/docs/ccppsrw3_doxyfile
+++ /dev/null
@@ -1,557 +0,0 @@
-# Doxyfile 1.9.3
-
-DOXYFILE_ENCODING      = UTF-8
-PROJECT_NAME           = "CCPP SciDoc for UFS-SRW v3.0.0"
-PROJECT_NUMBER         = "SRW v3.0.0"
-PROJECT_BRIEF          = "Common Community Physics Package Developed at DTC"
-PROJECT_LOGO           = img/dtc_logo.png
-OUTPUT_DIRECTORY       = doc
-CREATE_SUBDIRS         = NO
-ALLOW_UNICODE_NAMES    = NO
-OUTPUT_LANGUAGE        = English
-BRIEF_MEMBER_DESC      = YES
-REPEAT_BRIEF           = NO
-ABBREVIATE_BRIEF       =
-ALWAYS_DETAILED_SEC    = NO
-INLINE_INHERITED_MEMB  = NO
-FULL_PATH_NAMES        = NO
-STRIP_FROM_PATH        =
-STRIP_FROM_INC_PATH    =
-SHORT_NAMES            = NO
-JAVADOC_AUTOBRIEF      = NO
-JAVADOC_BANNER         = NO
-QT_AUTOBRIEF           = NO
-MULTILINE_CPP_IS_BRIEF = NO
-PYTHON_DOCSTRING       = YES
-INHERIT_DOCS           = YES
-SEPARATE_MEMBER_PAGES  = YES
-TAB_SIZE               = 4
-ALIASES                =
-OPTIMIZE_OUTPUT_FOR_C  = NO
-OPTIMIZE_OUTPUT_JAVA   = NO
-OPTIMIZE_FOR_FORTRAN   = YES
-OPTIMIZE_OUTPUT_VHDL   = NO
-OPTIMIZE_OUTPUT_SLICE  = NO
-EXTENSION_MAPPING      = .f=FortranFree \
-                         .F=FortranFree \
-                         .F90=FortranFree \
-                         .f90=FortranFree
-MARKDOWN_SUPPORT       = YES
-TOC_INCLUDE_HEADINGS   = 5
-AUTOLINK_SUPPORT       = YES
-BUILTIN_STL_SUPPORT    = NO
-CPP_CLI_SUPPORT        = NO
-SIP_SUPPORT            = NO
-IDL_PROPERTY_SUPPORT   = YES
-DISTRIBUTE_GROUP_DOC   = YES
-GROUP_NESTED_COMPOUNDS = NO
-SUBGROUPING            = YES
-INLINE_GROUPED_CLASSES = NO
-INLINE_SIMPLE_STRUCTS  = NO
-TYPEDEF_HIDES_STRUCT   = YES
-LOOKUP_CACHE_SIZE      = 0
-NUM_PROC_THREADS       = 1
-
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-
-EXTRACT_ALL            = YES
-EXTRACT_PRIVATE        = YES
-EXTRACT_PRIV_VIRTUAL   = NO
-EXTRACT_PACKAGE        = YES
-EXTRACT_STATIC         = YES
-EXTRACT_LOCAL_CLASSES  = YES
-EXTRACT_LOCAL_METHODS  = YES
-EXTRACT_ANON_NSPACES   = YES
-RESOLVE_UNNAMED_PARAMS = YES
-HIDE_UNDOC_MEMBERS     = NO
-HIDE_UNDOC_CLASSES     = NO
-HIDE_FRIEND_COMPOUNDS  = NO
-HIDE_IN_BODY_DOCS      = NO
-INTERNAL_DOCS          = YES
-CASE_SENSE_NAMES       = NO
-HIDE_SCOPE_NAMES       = NO
-HIDE_COMPOUND_REFERENCE= NO
-SHOW_HEADERFILE        = YES
-SHOW_INCLUDE_FILES     = NO
-SHOW_GROUPED_MEMB_INC  = NO
-FORCE_LOCAL_INCLUDES   = NO
-INLINE_INFO            = YES
-SORT_MEMBER_DOCS       = NO
-SORT_BRIEF_DOCS        = NO
-SORT_MEMBERS_CTORS_1ST = NO
-SORT_GROUP_NAMES       = NO
-SORT_BY_SCOPE_NAME     = NO
-STRICT_PROTO_MATCHING  = NO
-GENERATE_TODOLIST      = YES
-GENERATE_TESTLIST      = YES
-GENERATE_BUGLIST       = YES
-GENERATE_DEPRECATEDLIST= YES
-ENABLED_SECTIONS       = YES
-MAX_INITIALIZER_LINES  = 30
-SHOW_USED_FILES        = NO
-SHOW_FILES             = NO 
-SHOW_NAMESPACES        = YES
-FILE_VERSION_FILTER    =
-LAYOUT_FILE            = ccpp_dox_layout.xml
-CITE_BIB_FILES         = library.bib
-
-#---------------------------------------------------------------------------
-# Configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-QUIET                  = NO
-WARNINGS               = YES
-WARN_IF_UNDOCUMENTED   = NO
-WARN_IF_DOC_ERROR      = YES
-WARN_IF_INCOMPLETE_DOC = YES
-WARN_NO_PARAMDOC       = NO
-WARN_AS_ERROR          = NO
-WARN_FORMAT            =
-WARN_LOGFILE           = 
-
-#---------------------------------------------------------------------------
-# Configuration options related to the input files
-#---------------------------------------------------------------------------
-
-INPUT                  =  pdftxt/SRW_mainpage.txt              \
-                          pdftxt/SRW_all_shemes_list.txt     \
-                          pdftxt/GFS_v16_suite.txt       \
-                          pdftxt/HRRR_suite.txt          \
-                          pdftxt/RAP_suite.txt      \
-                          pdftxt/RRFS_v1beta_suite.txt   \
-                          pdftxt/WoFS_v0_suite.txt   \
-                          pdftxt/RRFS_SGSCLOUD.txt       \
-                          pdftxt/GFS_RRTMG.txt           \
-                          pdftxt/GFS_SFCLYR.txt   \
-                          pdftxt/MYNN_SFCLAYER.txt   \
-                          pdftxt/GFS_NSST.txt     \
-                          pdftxt/GFS_OCEAN.txt    \
-                          pdftxt/GFS_NOAH.txt     \
-                          pdftxt/GFS_SFCSICE.txt  \
-                          pdftxt/GFS_SATMEDMFVDIFQ.txt    \
-                          pdftxt/GFS_NOAHMP.txt    \
-                          pdftxt/GFS_UGWPv0.txt   \
-                          pdftxt/GFS_drag_suite.txt    \
-                          pdftxt/GFS_GWDPS.txt      \
-                          pdftxt/GFS_OZPHYS.txt   \
-                          pdftxt/GFS_H2OPHYS.txt  \
-                          pdftxt/GFS_SAMFdeep.txt \
-                          pdftxt/GFS_SAMFshal.txt \
-                          pdftxt/GFDL_cloud.txt   \
-                          pdftxt/NSSLMICRO.txt      \
-                          pdftxt/MYNN_EDMF.txt       \
-                          pdftxt/CU_GF_deep.txt      \
-                          pdftxt/RUCLSM.txt          \
-                          pdftxt/THOMPSON.txt        \
-                          pdftxt/suite_input.nml.txt    \
-                          pdftxt/CLM_LAKE.txt     \
-                          pdftxt/GFS_SPP.txt     \
-                        ../fv_sat_adj.F90    \
-                        ../GFS_time_vary_pre.fv3.F90 \
-                        ../GFS_rad_time_vary.fv3.F90  \
-                        ../GFS_phys_time_vary.fv3.F90 \
-                        ../get_prs_fv3.F90     \
-                        ../get_phi_fv3.F90        \
-                        ../ozne_def.f                 \
-                        ../ozinterp.f90               \
-                        ../h2o_def.f                 \
-                        ../h2ointerp.f90           \
-                        ../aerclm_def.F            \
-                        ../aerinterp.F90           \
-                        ../iccn_def.F              \
-                        ../iccninterp.F90          \
-                        ../sfcsub.F  \
-                        ../gcycle.F90                  \
-                        ../GFS_suite_interstitial_1.F90    \
-                        ../GFS_suite_interstitial_2.F90    \
-                        ../GFS_suite_interstitial_3.F90    \
-                        ../GFS_suite_interstitial_4.F90    \
-                        ../GFS_suite_interstitial_5.F90    \
-                        ../GFS_suite_interstitial_phys_reset.F90    \
-                        ../GFS_suite_interstitial_rad_reset.F90    \
-                        ../GFS_suite_stateout_reset.F90    \
-                        ../GFS_suite_stateout_update.F90     \
-                        ../GFS_surface_composites_inter.F90     \
-                        ../GFS_surface_composites_pre.F90      \
-                        ../GFS_surface_composites_post.F90      \
-                        ../GFS_surface_loop_control_part1.F90   \
-                        ../GFS_surface_loop_control_part2.F90   \
-                        ../GFS_radiation_surface.F90     \
-                        ../GFS_rrtmg_pre.F90             \
-                        ../GFS_rrtmg_post.F90           \
-                        ../GFS_rrtmg_setup.F90          \
-                        ../rad_sw_pre.F90              \
-                        ../sgscloud_radpre.F90    \
-                        ../sgscloud_radpost.F90   \
-                        ../radsw_main.F90                \
-                        ../rrtmg_sw_post.F90             \
-                        ../rrtmg_lw_pre.F90              \
-                        ../radlw_main.F90                  \
-                        ../rrtmg_lw_post.F90             \
-                        ../radiation_aerosols.f          \
-                        ../radiation_astronomy.f         \
-                        ../radiation_clouds.f            \
-                        ../radiation_cloud_overlap.F90    \
-                        ../radiation_gases.f             \
-                        ../radiation_surface.f           \
-                        ../radlw_param.f \
-                        ../radlw_datatb.f \
-                        ../radsw_param.f  \
-                        ../radsw_datatb.f  \
-                        ../GFS_cloud_diagnostics.F90     \
-                        ../dcyc2t3.f        \
-                        ../sfc_diff.f   \
-                        ../sfc_diag.f                \
-                        ../sfc_diag_post.F90          \
-                        ../sfc_nst.f                  \
-                        ../sfc_nst_pre.f              \
-                        ../sfc_nst_post.f             \
-                        ../sfc_ocean.F                \
-                        ../clm_lake.f90              \
-                        ../module_nst_model.f90       \
-                        ../module_nst_parameters.f90  \
-                        ../module_nst_water_prop.f90  \
-                        ../lsm_noah.f                  \
-                        ../sflx.f                     \
-                        ../namelist_soilveg.f   \
-                        ../set_soilveg.f        \
-                        ../noahmpdrv.F90           \
-                        ../module_sf_noahmplsm.f90    \
-                        ../module_sf_noahmp_glacier.f90  \
-                        ../noahmp_tables.f90          \
-                        ../GFS_surface_generic_pre.F90   \
-                        ../GFS_surface_generic_post.F90   \
-                        ../surface_perturbation.F90 \
-                        ../GFS_DCNV_generic_pre.F90      \
-                        ../GFS_DCNV_generic_post.F90   \
-                        ../GFS_SCNV_generic_pre.F90     \
-                        ../GFS_SCNV_generic_post.F90     \
-                        ../sfc_sice.f \
-                        ../satmedmfvdifq.F  \
-                        ../mfpbltq.f         \
-                        ../mfscuq.f          \
-                        ../tridi.f          \
-                        ../GFS_GWD_generic_pre.F90 \
-                        ../GFS_GWD_generic_post.F90   \
-                        ../unified_ugwp.F90         \
-                        ../drag_suite.F90           \
-                        ../cires_tauamf_data.F90    \
-                        ../cires_orowam2017.f     \
-                        ../cires_ugwp.F90           \
-                        ../cires_ugwp_initialize.F90     \
-                        ../cires_ugwp_module.F90       \
-                        ../cires_ugwp_post.F90         \
-                        ../cires_ugwp_triggers.F90     \
-                        ../cires_ugwp_module.F90      \
-                        ../gwdps.f                     \
-                        ../ugwp_driver_v0.F            \
-                        ../ozphys_2015.f               \
-                        ../h2ophys.f \
-                        ../samfdeepcnv.f \
-                        ../samfshalcnv.f \
-                        ../progsigma_calc.f90   \
-                        ../cnvc90.f \
-                        ../module_bfmicrophysics.f \
-                        ../gfdl_cloud_microphys.F90 \
-                        ../module_gfdl_cloud_microphys.F90 \
-                        ../GFS_MP_generic_pre.F90 \
-                        ../GFS_MP_generic_post.F90   \
-                        ../GFS_PBL_generic_common.F90    \
-                        ../GFS_PBL_generic_pre.F90      \
-                        ../GFS_PBL_generic_post.F90     \
-                        ../calpreciptype.f90   \
-                        ../GFS_stochastics.F90   \
-                        ../cu_gf_driver.F90 \
-                        ../cu_gf_driver_pre.F90 \
-                        ../cu_gf_deep.F90   \
-                        ../cu_gf_sh.F90     \
-                        ../cu_gf_driver_post.F90 \
-                        ../mynnedmf_wrapper.F90 \
-                        ../module_bl_mynn.F90   \
-                        ../bl_mynn_common.f90   \
-                        ../mynnsfc_wrapper.F90 \
-                        ../module_sf_mynn.F90  \
-                        ../lsm_ruc.F90   \
-                        ../module_sf_ruclsm.F90    \
-                        ../namelist_soilveg_ruc.F90 \
-                        ../set_soilveg_ruc.F90   \
-                        ../module_soil_pre.F90   \
-                        ../mp_thompson_pre.F90  \
-                        ../module_mp_thompson_make_number_concentrations.F90 \
-                        ../mp_thompson.F90    \
-                        ../module_mp_thompson.F90 \
-                        ../module_mp_radar.F90 \
-                        ../mp_thompson_post.F90  \
-                        ../mp_nssl.F90        \
-                        ../module_mp_nssl_2mom.F90    \
-                        ../funcphys.f90     \
-                        ../physcons.F90     \
-                        ../radcons.f90      \
-                        ../mersenne_twister.f \
-                        ../maximum_hourly_diagnostics.F90   \
-                        ../phys_tend.F90  
-
-INPUT_ENCODING         = UTF-8
-FILE_PATTERNS          = *.f \
-                         *.F \
-                         *.F90 \
-                         *.f90 \
-                         *.nml \
-                         *.txt
-RECURSIVE              = YES
-EXCLUDE                =
-EXCLUDE_SYMLINKS       = NO
-EXCLUDE_PATTERNS       =
-EXCLUDE_SYMBOLS        =
-EXAMPLE_PATH           = pdftxt/RE300 \
-                         doc/html
-EXAMPLE_PATTERNS       = 
-EXAMPLE_RECURSIVE      = NO
-IMAGE_PATH             = img
-INPUT_FILTER           =
-FILTER_PATTERNS        =
-FILTER_SOURCE_FILES    = NO
-FILTER_SOURCE_PATTERNS =
-USE_MDFILE_AS_MAINPAGE =
-
-#---------------------------------------------------------------------------
-# Configuration options related to source browsing
-#---------------------------------------------------------------------------
-
-SOURCE_BROWSER         = NO
-INLINE_SOURCES         = NO
-STRIP_CODE_COMMENTS    = YES
-REFERENCED_BY_RELATION = YES
-REFERENCES_RELATION    = YES
-REFERENCES_LINK_SOURCE = YES
-SOURCE_TOOLTIPS        = YES
-USE_HTAGS              = NO
-VERBATIM_HEADERS       = YES
-CLANG_ASSISTED_PARSING = NO
-CLANG_ADD_INC_PATHS    = YES
-CLANG_OPTIONS          =
-CLANG_DATABASE_PATH    =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-
-ALPHABETICAL_INDEX     = NO
-IGNORE_PREFIX          =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the HTML output
-#---------------------------------------------------------------------------
-
-GENERATE_HTML          = YES
-HTML_OUTPUT            = html
-HTML_FILE_EXTENSION    = .html
-HTML_HEADER            = _doxygen/header.html
-HTML_FOOTER            = _doxygen/footer.html
-HTML_STYLESHEET        = 
-HTML_EXTRA_STYLESHEET  = _doxygen/doxygen-awesome.css  \
-                         _doxygen/doxygen-awesome-sidebar-only.css \
-                         _doxygen/doxygen-awesome-sidebar-only-darkmode-toggle.css    \
-                         _doxygen/doxygen-awesome-ccpp.css 
-HTML_EXTRA_FILES       = _doxygen/doxygen-awesome-darkmode-toggle.js \
-                         _doxygen/doxygen-awesome-ccpp.js
-HTML_COLORSTYLE_HUE    = 209
-HTML_COLORSTYLE_SAT    = 255
-HTML_COLORSTYLE_GAMMA  = 113
-HTML_TIMESTAMP         = NO
-HTML_DYNAMIC_MENUS     = YES
-HTML_DYNAMIC_SECTIONS  = NO
-HTML_INDEX_NUM_ENTRIES = 100
-GENERATE_DOCSET        = NO
-DOCSET_FEEDNAME        = "Doxygen generated docs"
-DOCSET_FEEDURL         =
-DOCSET_BUNDLE_ID       = org.doxygen.Project
-DOCSET_PUBLISHER_ID    = org.doxygen.Publisher
-DOCSET_PUBLISHER_NAME  = Publisher
-GENERATE_HTMLHELP      = NO
-CHM_FILE               =
-HHC_LOCATION           =
-GENERATE_CHI           = NO
-CHM_INDEX_ENCODING     =
-BINARY_TOC             = NO
-TOC_EXPAND             = NO
-GENERATE_QHP           = NO
-QCH_FILE               =
-QHP_NAMESPACE          = org.doxygen.Project
-QHP_VIRTUAL_FOLDER     = doc
-QHP_CUST_FILTER_NAME   =
-QHP_CUST_FILTER_ATTRS  =
-QHP_SECT_FILTER_ATTRS  =
-QHG_LOCATION           =
-GENERATE_ECLIPSEHELP   = NO
-ECLIPSE_DOC_ID         = org.doxygen.Project
-DISABLE_INDEX          = YES
-GENERATE_TREEVIEW      = YES
-FULL_SIDEBAR           = NO
-ENUM_VALUES_PER_LINE   = 4
-TREEVIEW_WIDTH         = 335
-EXT_LINKS_IN_WINDOW    = NO
-OBFUSCATE_EMAILS       = YES
-HTML_FORMULA_FORMAT    = SVG
-FORMULA_FONTSIZE       = 10
-FORMULA_TRANSPARENT    = YES
-FORMULA_MACROFILE      =
-USE_MATHJAX            = YES
-MATHJAX_VERSION        = MathJax_2
-MATHJAX_FORMAT         = HTML-CSS
-#MATHJAX_RELPATH        = https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2
-MATHJAX_RELPATH        = https://cdn.jsdelivr.net/npm/mathjax@2
-MATHJAX_EXTENSIONS     =
-MATHJAX_CODEFILE       =
-SEARCHENGINE           = YES
-SERVER_BASED_SEARCH    = NO
-EXTERNAL_SEARCH        = NO
-SEARCHENGINE_URL       =
-SEARCHDATA_FILE        = searchdata.xml
-EXTERNAL_SEARCH_ID     =
-EXTRA_SEARCH_MAPPINGS  =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-
-GENERATE_LATEX         = YES
-LATEX_OUTPUT           = latex
-LATEX_CMD_NAME         = latex
-MAKEINDEX_CMD_NAME     = makeindex
-LATEX_MAKEINDEX_CMD    = makeindex
-COMPACT_LATEX          = YES
-PAPER_TYPE             = a4
-EXTRA_PACKAGES         = amsmath
-LATEX_HEADER           =
-LATEX_FOOTER           =
-LATEX_EXTRA_STYLESHEET =
-LATEX_EXTRA_FILES      =
-PDF_HYPERLINKS         = YES
-USE_PDFLATEX           = YES
-LATEX_BATCHMODE        = NO
-LATEX_HIDE_INDICES     = YES
-LATEX_BIB_STYLE        = plainnat
-LATEX_TIMESTAMP        = NO
-LATEX_EMOJI_DIRECTORY  =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the RTF output
-#---------------------------------------------------------------------------
-
-GENERATE_RTF           = NO
-RTF_OUTPUT             = rtf
-COMPACT_RTF            = NO
-RTF_HYPERLINKS         = NO
-RTF_STYLESHEET_FILE    =
-RTF_EXTENSIONS_FILE    =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the man page output
-#---------------------------------------------------------------------------
-
-GENERATE_MAN           = NO
-MAN_OUTPUT             = man
-MAN_EXTENSION          = .3
-MAN_SUBDIR             =
-MAN_LINKS              = NO
-
-#---------------------------------------------------------------------------
-# Configuration options related to the XML output
-#---------------------------------------------------------------------------
-
-GENERATE_XML           = NO
-XML_OUTPUT             = xml
-XML_PROGRAMLISTING     = YES
-XML_NS_MEMB_FILE_SCOPE = NO
-
-#---------------------------------------------------------------------------
-# Configuration options related to the DOCBOOK output
-#---------------------------------------------------------------------------
-
-GENERATE_DOCBOOK       = NO
-DOCBOOK_OUTPUT         = docbook
-
-#---------------------------------------------------------------------------
-# Configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-
-GENERATE_AUTOGEN_DEF   = NO
-
-#---------------------------------------------------------------------------
-# Configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-
-GENERATE_PERLMOD       = NO
-PERLMOD_LATEX          = NO
-PERLMOD_PRETTY         = YES
-PERLMOD_MAKEVAR_PREFIX =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-
-ENABLE_PREPROCESSING   = NO
-MACRO_EXPANSION        = NO
-EXPAND_ONLY_PREDEF     = NO
-SEARCH_INCLUDES        = YES
-INCLUDE_PATH           =
-INCLUDE_FILE_PATTERNS  =
-PREDEFINED             = CCPP \
-                         MULTI_GASES \
-                         0
-EXPAND_AS_DEFINED      =
-SKIP_FUNCTION_MACROS   = YES
-
-#---------------------------------------------------------------------------
-# Configuration options related to external references
-#---------------------------------------------------------------------------
-
-TAGFILES               =
-GENERATE_TAGFILE       =
-ALLEXTERNALS           = NO
-EXTERNAL_GROUPS        = YES
-EXTERNAL_PAGES         = YES
-
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-
-DIA_PATH               =
-HIDE_UNDOC_RELATIONS   = YES
-HAVE_DOT               = YES
-DOT_NUM_THREADS        = 0
-DOT_FONTNAME           = Source Sans Pro
-DOT_FONTSIZE           = 
-DOT_FONTPATH           =
-CLASS_GRAPH            = YES
-COLLABORATION_GRAPH    = YES
-GROUP_GRAPHS           = YES
-UML_LOOK               = YES
-UML_LIMIT_NUM_FIELDS   = 10
-DOT_UML_DETAILS        = NO
-DOT_WRAP_THRESHOLD     = 17
-TEMPLATE_RELATIONS     = NO
-INCLUDE_GRAPH          = YES
-INCLUDED_BY_GRAPH      = NO
-CALL_GRAPH             = YES
-CALLER_GRAPH           = YES
-GRAPHICAL_HIERARCHY    = YES
-DIRECTORY_GRAPH        = YES
-DIR_GRAPH_MAX_DEPTH    = 1
-DOT_IMAGE_FORMAT       = SVG
-INTERACTIVE_SVG        = NO
-DOT_PATH               = /Users/man.zhang/homebrew/bin/dot 
-DOTFILE_DIRS           =
-MSCFILE_DIRS           =
-DIAFILE_DIRS           =
-PLANTUML_JAR_PATH      =
-PLANTUML_CFG_FILE      =
-PLANTUML_INCLUDE_PATH  =
-DOT_GRAPH_MAX_NODES    = 1000
-MAX_DOT_GRAPH_DEPTH    = 0
-DOT_TRANSPARENT        = YES
-DOT_MULTI_TARGETS      = YES
-GENERATE_LEGEND        = YES
-DOT_CLEANUP            = YES
diff --git a/physics/docs/ccppsrw_doxyfile b/physics/docs/ccppsrw_doxyfile
index 09ebccf86..5c9c797b5 100644
--- a/physics/docs/ccppsrw_doxyfile
+++ b/physics/docs/ccppsrw_doxyfile
@@ -1,8 +1,8 @@
 # Doxyfile 1.9.3
 
 DOXYFILE_ENCODING      = UTF-8
-PROJECT_NAME           = "CCPP Scidoc for SRW v2.1.0"
-PROJECT_NUMBER         = "SRW v2.1.0"
+PROJECT_NAME           = "CCPP SciDoc for UFS-SRW v3.0.0"
+PROJECT_NUMBER         = "SRW v3.0.0"
 PROJECT_BRIEF          = "Common Community Physics Package Developed at DTC"
 PROJECT_LOGO           = img/dtc_logo.png
 OUTPUT_DIRECTORY       = doc
@@ -115,9 +115,10 @@ WARN_LOGFILE           =
 #---------------------------------------------------------------------------
 
 INPUT                  =  pdftxt/SRW_mainpage.txt              \
-                          pdftxt/SRW_all_shemes_list.txt     \
+                          pdftxt/SRW_all_schemes_list.txt     \
                           pdftxt/GFS_v16_suite.txt       \
                           pdftxt/HRRR_suite.txt          \
+                          pdftxt/RAP_suite.txt      \
                           pdftxt/RRFS_v1beta_suite.txt   \
                           pdftxt/WoFS_v0_suite.txt   \
                           pdftxt/RRFS_SGSCLOUD.txt       \
@@ -144,6 +145,7 @@ INPUT                  =  pdftxt/SRW_mainpage.txt              \
                           pdftxt/RUCLSM.txt          \
                           pdftxt/THOMPSON.txt        \
                           pdftxt/suite_input.nml.txt    \
+                          pdftxt/CLM_LAKE.txt     \
                           pdftxt/GFS_SPP.txt     \
                         ../fv_sat_adj.F90    \
                         ../GFS_time_vary_pre.fv3.F90 \
@@ -206,6 +208,7 @@ INPUT                  =  pdftxt/SRW_mainpage.txt              \
                         ../sfc_nst_pre.f              \
                         ../sfc_nst_post.f             \
                         ../sfc_ocean.F                \
+                        ../clm_lake.f90              \
                         ../module_nst_model.f90       \
                         ../module_nst_parameters.f90  \
                         ../module_nst_water_prop.f90  \
@@ -283,7 +286,6 @@ INPUT                  =  pdftxt/SRW_mainpage.txt              \
                         ../mp_nssl.F90        \
                         ../module_mp_nssl_2mom.F90    \
                         ../funcphys.f90     \
-                        ../physparam.f      \
                         ../physcons.F90     \
                         ../radcons.f90      \
                         ../mersenne_twister.f \
@@ -302,7 +304,7 @@ EXCLUDE                =
 EXCLUDE_SYMLINKS       = NO
 EXCLUDE_PATTERNS       =
 EXCLUDE_SYMBOLS        =
-EXAMPLE_PATH           = pdftxt/RE210 \
+EXAMPLE_PATH           = pdftxt/RE300 \
                          doc/html
 EXAMPLE_PATTERNS       = 
 EXAMPLE_RECURSIVE      = NO
@@ -540,7 +542,7 @@ DIRECTORY_GRAPH        = YES
 DIR_GRAPH_MAX_DEPTH    = 1
 DOT_IMAGE_FORMAT       = SVG
 INTERACTIVE_SVG        = NO
-DOT_PATH               = 
+DOT_PATH               = /Users/man.zhang/homebrew/bin/dot 
 DOTFILE_DIRS           =
 MSCFILE_DIRS           =
 DIAFILE_DIRS           =
diff --git a/physics/docs/pdftxt/SRW_all_shemes_list.txt b/physics/docs/pdftxt/SRW_all_schemes_list.txt
similarity index 100%
rename from physics/docs/pdftxt/SRW_all_shemes_list.txt
rename to physics/docs/pdftxt/SRW_all_schemes_list.txt
diff --git a/physics/docs/pdftxt/all_shemes_list.txt b/physics/docs/pdftxt/all_schemes_list.txt
similarity index 100%
rename from physics/docs/pdftxt/all_shemes_list.txt
rename to physics/docs/pdftxt/all_schemes_list.txt

From 0154a658ba4752da9c00f1ab24b1a039787e3a7f Mon Sep 17 00:00:00 2001
From: "Michael Kavulich, Jr" <kavulich@ucar.edu>
Date: Tue, 1 Aug 2023 10:20:26 -0600
Subject: [PATCH 058/115] Remove old namelists, remove "develop" from names

---
 ...elop.FV3_GFS_v16 => input.nml.FV3_GFS_v16} |   0
 ...ml.develop.FV3_HRRR => input.nml.FV3_HRRR} |   0
 ....nml.develop.FV3_RAP => input.nml.FV3_RAP} |   0
 ..._RRFS_v1beta => input.nml.FV3_RRFS_v1beta} |   0
 ...elop.FV3_WoFS_v0 => input.nml.FV3_WoFS_v0} |   0
 .../RE300/namelists/input.nml.v21.FV3_GFS_v16 | 336 ------------------
 .../RE300/namelists/input.nml.v21.FV3_HRRR    | 299 ----------------
 .../namelists/input.nml.v21.FV3_RRFS_v1beta   | 291 ---------------
 .../RE300/namelists/input.nml.v21.FV3_WoFS_v0 | 297 ----------------
 9 files changed, 1223 deletions(-)
 rename physics/docs/pdftxt/RE300/namelists/{input.nml.develop.FV3_GFS_v16 => input.nml.FV3_GFS_v16} (100%)
 rename physics/docs/pdftxt/RE300/namelists/{input.nml.develop.FV3_HRRR => input.nml.FV3_HRRR} (100%)
 rename physics/docs/pdftxt/RE300/namelists/{input.nml.develop.FV3_RAP => input.nml.FV3_RAP} (100%)
 rename physics/docs/pdftxt/RE300/namelists/{input.nml.develop.FV3_RRFS_v1beta => input.nml.FV3_RRFS_v1beta} (100%)
 rename physics/docs/pdftxt/RE300/namelists/{input.nml.develop.FV3_WoFS_v0 => input.nml.FV3_WoFS_v0} (100%)
 delete mode 100644 physics/docs/pdftxt/RE300/namelists/input.nml.v21.FV3_GFS_v16
 delete mode 100644 physics/docs/pdftxt/RE300/namelists/input.nml.v21.FV3_HRRR
 delete mode 100644 physics/docs/pdftxt/RE300/namelists/input.nml.v21.FV3_RRFS_v1beta
 delete mode 100644 physics/docs/pdftxt/RE300/namelists/input.nml.v21.FV3_WoFS_v0

diff --git a/physics/docs/pdftxt/RE300/namelists/input.nml.develop.FV3_GFS_v16 b/physics/docs/pdftxt/RE300/namelists/input.nml.FV3_GFS_v16
similarity index 100%
rename from physics/docs/pdftxt/RE300/namelists/input.nml.develop.FV3_GFS_v16
rename to physics/docs/pdftxt/RE300/namelists/input.nml.FV3_GFS_v16
diff --git a/physics/docs/pdftxt/RE300/namelists/input.nml.develop.FV3_HRRR b/physics/docs/pdftxt/RE300/namelists/input.nml.FV3_HRRR
similarity index 100%
rename from physics/docs/pdftxt/RE300/namelists/input.nml.develop.FV3_HRRR
rename to physics/docs/pdftxt/RE300/namelists/input.nml.FV3_HRRR
diff --git a/physics/docs/pdftxt/RE300/namelists/input.nml.develop.FV3_RAP b/physics/docs/pdftxt/RE300/namelists/input.nml.FV3_RAP
similarity index 100%
rename from physics/docs/pdftxt/RE300/namelists/input.nml.develop.FV3_RAP
rename to physics/docs/pdftxt/RE300/namelists/input.nml.FV3_RAP
diff --git a/physics/docs/pdftxt/RE300/namelists/input.nml.develop.FV3_RRFS_v1beta b/physics/docs/pdftxt/RE300/namelists/input.nml.FV3_RRFS_v1beta
similarity index 100%
rename from physics/docs/pdftxt/RE300/namelists/input.nml.develop.FV3_RRFS_v1beta
rename to physics/docs/pdftxt/RE300/namelists/input.nml.FV3_RRFS_v1beta
diff --git a/physics/docs/pdftxt/RE300/namelists/input.nml.develop.FV3_WoFS_v0 b/physics/docs/pdftxt/RE300/namelists/input.nml.FV3_WoFS_v0
similarity index 100%
rename from physics/docs/pdftxt/RE300/namelists/input.nml.develop.FV3_WoFS_v0
rename to physics/docs/pdftxt/RE300/namelists/input.nml.FV3_WoFS_v0
diff --git a/physics/docs/pdftxt/RE300/namelists/input.nml.v21.FV3_GFS_v16 b/physics/docs/pdftxt/RE300/namelists/input.nml.v21.FV3_GFS_v16
deleted file mode 100644
index 6dc85900b..000000000
--- a/physics/docs/pdftxt/RE300/namelists/input.nml.v21.FV3_GFS_v16
+++ /dev/null
@@ -1,336 +0,0 @@
-&amip_interp_nml
-    data_set = 'reynolds_oi'
-    date_out_of_range = 'climo'
-    interp_oi_sst = .true.
-    no_anom_sst = .false.
-    use_ncep_ice = .false.
-    use_ncep_sst = .true.
-/
-
-&atmos_model_nml
-    blocksize = 40
-    ccpp_suite = 'FV3_GFS_v16'
-    chksum_debug = .false.
-    dycore_only = .false.
-/
-
-&cires_ugwp_nml
-    knob_ugwp_azdir = 2, 4, 4, 4
-    knob_ugwp_doaxyz = 1
-    knob_ugwp_doheat = 1
-    knob_ugwp_dokdis = 1
-    knob_ugwp_effac = 1, 1, 1, 1
-    knob_ugwp_ndx4lh = 1
-    knob_ugwp_solver = 2
-    knob_ugwp_source = 1, 1, 0, 0
-    knob_ugwp_stoch = 0, 0, 0, 0
-    knob_ugwp_version = 0
-    knob_ugwp_wvspec = 1, 25, 25, 25
-    launch_level = 27
-/
-
-&diag_manager_nml
-    prepend_date = .false.
-/
-
-&external_ic_nml
-    checker_tr = .false.
-    filtered_terrain = .true.
-    gfs_dwinds = .true.
-    levp = 65
-    nt_checker = 0
-/
-
-&fms_io_nml
-    checksum_required = .false.
-    max_files_r = 100
-    max_files_w = 100
-/
-
-&fms_nml
-    clock_grain = 'ROUTINE'
-    domains_stack_size = 5000000
-    print_memory_usage = .false.
-/
-
-&fv_core_nml
-    a_imp = 1.0
-    adjust_dry_mass = .false.
-    agrid_vel_rst = .false.
-    bc_update_interval = 6
-    beta = 0.0
-    consv_am = .false.
-    consv_te = 0.0
-    d2_bg = 0.0
-    d2_bg_k1 = 0.2
-    d2_bg_k2 = 0.0
-    d4_bg = 0.12
-    d_con = 1.0
-    d_ext = 0.0
-    dddmp = 0.1
-    delt_max = 0.008
-    dnats = 1
-    do_sat_adj = .true.
-    do_schmidt = .true.
-    do_vort_damp = .true.
-    dwind_2d = .false.
-    dz_min = 2
-    external_eta = .true.
-    external_ic = .true.
-    fill = .true.
-    full_zs_filter = .false.
-    fv_debug = .false.
-    fv_sg_adj = 450
-    gfs_phil = .false.
-    hord_dp = -5
-    hord_mt = 5
-    hord_tm = 5
-    hord_tr = 10
-    hord_vt = 5
-    hydrostatic = .false.
-    io_layout = 1, 1
-    k_split = 6
-    ke_bg = 0.0
-    kord_mt = 9
-    kord_tm = -9
-    kord_tr = 9
-    kord_wz = 9
-    layout = 5, 2
-    make_nh = .false.
-    mountain = .false.
-    n_split = 6
-    n_sponge = 10
-    n_zs_filter = 0
-    na_init = 0
-    ncep_ic = .false.
-    nggps_ic = .true.
-    no_dycore = .false.
-    nord = 3
-    npx = 220
-    npy = 132
-    npz = 64
-    nrows_blend = 10
-    ntiles = 1
-    nudge_dz = .false.
-    nudge_qv = .true.
-    nwat = 6
-    p_fac = 0.1
-    phys_hydrostatic = .false.
-    print_freq = 6
-    psm_bc = 1
-    range_warn = .false.
-    read_increment = .false.
-    regional = .true.
-    regional_bcs_from_gsi = .false.
-    res_latlon_dynamics = ''
-    reset_eta = .false.
-    rf_cutoff = 750.0
-    stretch_fac = 0.999
-    target_lat = 38.5
-    target_lon = -97.5
-    tau = 10.0
-    use_hydro_pressure = .false.
-    vtdm4 = 0.02
-    warm_start = .false.
-    write_restart_with_bcs = .false.
-    z_tracer = .true.
-/
-
-&fv_grid_nml
-    grid_file = 'INPUT/grid_spec.nc'
-/
-
-&gfdl_cloud_microphysics_nml
-    c_cracw = 0.8
-    c_paut = 0.5
-    c_pgacs = 0.01
-    c_psaci = 0.05
-    ccn_l = 300.0
-    ccn_o = 100.0
-    const_vg = .false.
-    const_vi = .false.
-    const_vr = .false.
-    const_vs = .false.
-    de_ice = .false.
-    do_qa = .true.
-    do_sedi_heat = .false.
-    dw_land = 0.16
-    dw_ocean = 0.1
-    fast_sat_adj = .true.
-    fix_negative = .true.
-    icloud_f = 1
-    mono_prof = .true.
-    mp_time = 150.0
-    prog_ccn = .false.
-    qi0_crt = 8e-05
-    qi_lim = 1.0
-    ql_gen = 0.001
-    ql_mlt = 0.001
-    qs0_crt = 0.001
-    rad_graupel = .true.
-    rad_rain = .true.
-    rad_snow = .true.
-    reiflag = 2
-    rh_inc = 0.3
-    rh_inr = 0.3
-    rh_ins = 0.3
-    rthresh = 1e-05
-    sedi_transport = .true.
-    tau_g2v = 900.0
-    tau_i2s = 1000.0
-    tau_l2v = 225.0
-    tau_v2l = 150.0
-    use_ccn = .true.
-    use_ppm = .false.
-    vg_max = 12.0
-    vi_max = 1.0
-    vr_max = 12.0
-    vs_max = 2.0
-    z_slope_ice = .true.
-    z_slope_liq = .true.
-/
-
-&gfs_physics_nml
-    cal_pre = .false.
-    cdmbgwd = 4.0, 0.15, 1.0, 1.0
-    cnvcld = .true.
-    cnvgwd = .true.
-    debug = .false.
-    do_shum = .false.
-    do_skeb = .false.
-    do_spp = .false.
-    do_sppt = .false.
-    do_tofd = .true.
-    do_ugwp = .false.
-    dspheat = .true.
-    effr_in = .true.
-    fhcyc = 0
-    fhlwr = 3600.0
-    fhswr = 3600.0
-    fhzero = 1.0
-    h2o_phys = .true.
-    hybedmf = .false.
-    iaer = 5111
-    ialb = 1
-    iau_inc_files = ''
-    icliq_sw = 2
-    ico2 = 2
-    iems = 1
-    imfdeepcnv = 2
-    imfshalcnv = 2
-    imp_physics = 11
-    iopt_alb = 2
-    iopt_btr = 1
-    iopt_crs = 1
-    iopt_dveg = 1
-    iopt_frz = 1
-    iopt_inf = 1
-    iopt_rad = 1
-    iopt_run = 1
-    iopt_sfc = 1
-    iopt_snf = 4
-    iopt_stc = 1
-    iopt_tbot = 2
-    iopt_trs = 2
-    iovr = 3
-    isatmedmf = 1
-    isol = 2
-    isot = 1
-    isubc_lw = 2
-    isubc_sw = 2
-    ivegsrc = 1
-    ldiag3d = .false.
-    ldiag_ugwp = .false.
-    lgfdlmprad = .true.
-    lheatstrg = .true.
-    lndp_type = 0
-    lsm = 1
-    lsoil = 4
-    lwhtr = .true.
-    n_var_lndp = 0
-    n_var_spp = 0
-    nsradar_reset = 3600
-    nst_anl = .true.
-    nstf_name = 2, 1, 0, 0, 0
-    oz_phys = .false.
-    oz_phys_2015 = .true.
-    pdfcld = .false.
-    prautco = 0.00015, 0.00015
-    pre_rad = .false.
-    print_diff_pgr = .false.
-    prslrd0 = 0.0
-    psautco = 0.0008, 0.0005
-    random_clds = .false.
-    redrag = .true.
-    satmedmf = .true.
-    sfclay_compute_flux = .false.
-    shal_cnv = .true.
-    swhtr = .true.
-    trans_trac = .true.
-    use_ufo = .true.
-/
-
-&interpolator_nml
-    interp_method = 'conserve_great_circle'
-/
-
-&mpp_io_nml
-    deflate_level = 1
-    shuffle = 1
-/
-
-&nam_sfcperts
-/
-
-&nam_sppperts
-/
-
-&nam_stochy
-/
-
-&namsfc
-    fabsl = 99999
-    faisl = 99999
-    faiss = 99999
-    fnacna = ''
-    fnaisc = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/CFSR.SEAICE.1982.2012.monthly.clim.grb'
-    fnglac = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/global_glacier.2x2.grb'
-    fnmskh = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/seaice_newland.grb'
-    fnmxic = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/global_maxice.2x2.grb'
-    fnsmcc = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/global_soilmgldas.t126.384.190.grb'
-    fnsnoa = ''
-    fnsnoc = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/global_snoclim.1.875.grb'
-    fntsfa = ''
-    fntsfc = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/RTGSST.1982.2012.monthly.clim.grb'
-    fnzorc = 'igbp'
-    fsicl = 99999
-    fsics = 99999
-    fslpl = 99999
-    fsmcl = 99999, 99999, 99999
-    fsnol = 99999
-    fsnos = 99999
-    fsotl = 99999
-    ftsfl = 99999
-    ftsfs = 90
-    fvetl = 99999
-    fvmnl = 99999
-    fvmxl = 99999
-    landice = .true.
-    ldebug = .false.
-/
-
-&namsfc_dict
-    fnabsc = '../fix_lam/C403.maximum_snow_albedo.tileX.nc'
-    fnalbc = '../fix_lam/C403.snowfree_albedo.tileX.nc'
-    fnalbc2 = '../fix_lam/C403.facsf.tileX.nc'
-    fnslpc = '../fix_lam/C403.slope_type.tileX.nc'
-    fnsotc = '../fix_lam/C403.soil_type.tileX.nc'
-    fntg3c = '../fix_lam/C403.substrate_temperature.tileX.nc'
-    fnvegc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
-    fnvetc = '../fix_lam/C403.vegetation_type.tileX.nc'
-    fnvmnc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
-    fnvmxc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
-/
-
-&surf_map_nml
-/
diff --git a/physics/docs/pdftxt/RE300/namelists/input.nml.v21.FV3_HRRR b/physics/docs/pdftxt/RE300/namelists/input.nml.v21.FV3_HRRR
deleted file mode 100644
index cd9408a4d..000000000
--- a/physics/docs/pdftxt/RE300/namelists/input.nml.v21.FV3_HRRR
+++ /dev/null
@@ -1,299 +0,0 @@
-&amip_interp_nml
-    data_set = 'reynolds_oi'
-    date_out_of_range = 'climo'
-    interp_oi_sst = .true.
-    no_anom_sst = .false.
-    use_ncep_ice = .false.
-    use_ncep_sst = .true.
-/
-
-&atmos_model_nml
-    blocksize = 40
-    ccpp_suite = 'FV3_HRRR'
-    chksum_debug = .false.
-    dycore_only = .false.
-/
-
-&cires_ugwp_nml
-    knob_ugwp_azdir = 2, 4, 4, 4
-    knob_ugwp_doaxyz = 1
-    knob_ugwp_doheat = 1
-    knob_ugwp_dokdis = 1
-    knob_ugwp_effac = 1, 1, 1, 1
-    knob_ugwp_ndx4lh = 1
-    knob_ugwp_solver = 2
-    knob_ugwp_source = 1, 1, 0, 0
-    knob_ugwp_stoch = 0, 0, 0, 0
-    knob_ugwp_version = 0
-    knob_ugwp_wvspec = 1, 25, 25, 25
-    launch_level = 25
-/
-
-&diag_manager_nml
-    prepend_date = .false.
-/
-
-&external_ic_nml
-    checker_tr = .false.
-    filtered_terrain = .true.
-    gfs_dwinds = .true.
-    levp = 65
-    nt_checker = 0
-/
-
-&fms_io_nml
-    checksum_required = .false.
-    max_files_r = 100
-    max_files_w = 100
-/
-
-&fms_nml
-    clock_grain = 'ROUTINE'
-    domains_stack_size = 5000000
-    print_memory_usage = .false.
-/
-
-&fv_core_nml
-    a_imp = 1.0
-    adjust_dry_mass = .false.
-    bc_update_interval = 6
-    beta = 0.0
-    consv_am = .false.
-    consv_te = 0.0
-    d2_bg = 0.0
-    d2_bg_k1 = 0.2
-    d2_bg_k2 = 0.04
-    d4_bg = 0.12
-    d_con = 1.0
-    d_ext = 0.0
-    dddmp = 0.1
-    delt_max = 0.008
-    dnats = 0
-    do_sat_adj = .false.
-    do_schmidt = .true.
-    do_vort_damp = .true.
-    dwind_2d = .false.
-    dz_min = 2
-    external_eta = .true.
-    external_ic = .true.
-    fill = .true.
-    full_zs_filter = .false.
-    fv_debug = .false.
-    fv_sg_adj = 300
-    gfs_phil = .false.
-    hord_dp = -5
-    hord_mt = 5
-    hord_tm = 5
-    hord_tr = 10
-    hord_vt = 5
-    hydrostatic = .false.
-    io_layout = 1, 1
-    k_split = 2
-    ke_bg = 0.0
-    kord_mt = 9
-    kord_tm = -9
-    kord_tr = 9
-    kord_wz = 9
-    layout = 5, 2
-    make_nh = .true.
-    mountain = .false.
-    n_split = 5
-    n_sponge = 24
-    n_zs_filter = 0
-    na_init = 1
-    ncep_ic = .false.
-    nggps_ic = .true.
-    no_dycore = .false.
-    nord = 3
-    nord_tr = 2
-    npx = 220
-    npy = 132
-    npz = 64
-    nrows_blend = 10
-    ntiles = 1
-    nudge_qv = .false.
-    nwat = 6
-    p_fac = 0.1
-    phys_hydrostatic = .false.
-    print_freq = 6
-    psm_bc = 1
-    range_warn = .true.
-    read_increment = .false.
-    regional = .true.
-    regional_bcs_from_gsi = .false.
-    res_latlon_dynamics = 'fv3_increment.nc'
-    reset_eta = .false.
-    rf_cutoff = 2000.0
-    stretch_fac = 0.999
-    target_lat = 38.5
-    target_lon = -97.5
-    tau = 5.0
-    use_hydro_pressure = .false.
-    vtdm4 = 0.02
-    warm_start = .false.
-    write_restart_with_bcs = .false.
-    z_tracer = .true.
-/
-
-&fv_grid_nml
-    grid_file = 'INPUT/grid_spec.nc'
-/
-
-&gfs_physics_nml
-    bl_mynn_edmf = 1
-    bl_mynn_edmf_mom = 1
-    bl_mynn_tkeadvect = .true.
-    cal_pre = .false.
-    cdmbgwd = 3.5, 1.0
-    cnvcld = .false.
-    cnvgwd = .false.
-    cplflx = .false.
-    debug = .false.
-    do_deep = .false.
-    do_gsl_drag_ls_bl = .true.
-    do_gsl_drag_ss = .true.
-    do_gsl_drag_tofd = .true.
-    do_mynnedmf = .true.
-    do_mynnsfclay = .true.
-    do_shum = .false.
-    do_skeb = .false.
-    do_spp = .false.
-    do_sppt = .false.
-    dspheat = .true.
-    effr_in = .true.
-    fhcyc = 0
-    fhlwr = 1200.0
-    fhswr = 1200.0
-    fhzero = 1.0
-    gwd_opt = 3
-    h2o_phys = .true.
-    hybedmf = .false.
-    iaer = 5111
-    ialb = 1
-    iau_delthrs = 6
-    iau_inc_files = ''
-    iaufhrs = 30
-    icliq_sw = 2
-    icloud_bl = 1
-    ico2 = 2
-    iems = 1
-    imfdeepcnv = -1
-    imfshalcnv = -1
-    imp_physics = 8
-    iopt_alb = 2
-    iopt_btr = 1
-    iopt_crs = 1
-    iopt_dveg = 2
-    iopt_frz = 1
-    iopt_inf = 1
-    iopt_rad = 1
-    iopt_run = 1
-    iopt_sfc = 1
-    iopt_snf = 4
-    iopt_stc = 1
-    iopt_tbot = 2
-    iopt_trs = 2
-    iovr = 3
-    isol = 2
-    isot = 1
-    isubc_lw = 2
-    isubc_sw = 2
-    ivegsrc = 1
-    kice = 9
-    ldiag3d = .false.
-    lheatstrg = .false.
-    lndp_type = 0
-    lradar = .true.
-    lsm = 3
-    lsoil = 4
-    lsoil_lsm = 9
-    ltaerosol = .true.
-    lwhtr = .true.
-    n_var_lndp = 0
-    n_var_spp = 0
-    nsradar_reset = 3600
-    nst_anl = .true.
-    nstf_name = 2, 1, 0, 0, 0
-    oz_phys = .false.
-    oz_phys_2015 = .true.
-    pdfcld = .false.
-    pre_rad = .false.
-    print_diff_pgr = .false.
-    prslrd0 = 0.0
-    random_clds = .false.
-    redrag = .true.
-    satmedmf = .false.
-    sfclay_compute_flux = .true.
-    shal_cnv = .false.
-    swhtr = .true.
-    trans_trac = .true.
-    ttendlim = -999
-    use_ufo = .true.
-/
-
-&interpolator_nml
-    interp_method = 'conserve_great_circle'
-/
-
-&nam_sfcperts
-/
-
-&nam_sppperts
-/
-
-&nam_stochy
-/
-
-&namsfc
-    fabsl = 99999
-    faisl = 99999
-    faiss = 99999
-    fnacna = ''
-    fnaisc = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/CFSR.SEAICE.1982.2012.monthly.clim.grb'
-    fnglac = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/global_glacier.2x2.grb'
-    fnmskh = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/seaice_newland.grb'
-    fnmxic = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/global_maxice.2x2.grb'
-    fnsmcc = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/global_soilmgldas.t126.384.190.grb'
-    fnsnoa = ''
-    fnsnoc = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/global_snoclim.1.875.grb'
-    fntsfa = ''
-    fntsfc = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/RTGSST.1982.2012.monthly.clim.grb'
-    fnzorc = 'igbp'
-    fsicl = 99999
-    fsics = 99999
-    fslpl = 99999
-    fsmcl = 99999, 99999, 99999
-    fsnol = 99999
-    fsnos = 99999
-    fsotl = 99999
-    ftsfl = 99999
-    ftsfs = 90
-    fvetl = 99999
-    fvmnl = 99999
-    fvmxl = 99999
-    ldebug = .true.
-/
-
-&namsfc_dict
-    fnabsc = '../fix_lam/C403.maximum_snow_albedo.tileX.nc'
-    fnalbc = '../fix_lam/C403.snowfree_albedo.tileX.nc'
-    fnalbc2 = '../fix_lam/C403.facsf.tileX.nc'
-    fnslpc = '../fix_lam/C403.slope_type.tileX.nc'
-    fnsotc = '../fix_lam/C403.soil_type.tileX.nc'
-    fntg3c = '../fix_lam/C403.substrate_temperature.tileX.nc'
-    fnvegc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
-    fnvetc = '../fix_lam/C403.vegetation_type.tileX.nc'
-    fnvmnc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
-    fnvmxc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
-/
-
-&surf_map_nml
-    cd2 = -1
-    cd4 = 0.12
-    max_slope = 0.4
-    n_del2_strong = 0
-    n_del2_weak = 2
-    n_del4 = 1
-    peak_fac = 1.0
-    zero_ocean = .false.
-/
diff --git a/physics/docs/pdftxt/RE300/namelists/input.nml.v21.FV3_RRFS_v1beta b/physics/docs/pdftxt/RE300/namelists/input.nml.v21.FV3_RRFS_v1beta
deleted file mode 100644
index 97e775107..000000000
--- a/physics/docs/pdftxt/RE300/namelists/input.nml.v21.FV3_RRFS_v1beta
+++ /dev/null
@@ -1,291 +0,0 @@
-&amip_interp_nml
-    data_set = 'reynolds_oi'
-    date_out_of_range = 'climo'
-    interp_oi_sst = .true.
-    no_anom_sst = .false.
-    use_ncep_ice = .false.
-    use_ncep_sst = .true.
-/
-
-&atmos_model_nml
-    blocksize = 40
-    ccpp_suite = 'FV3_RRFS_v1beta'
-    chksum_debug = .false.
-    dycore_only = .false.
-/
-
-&cires_ugwp_nml
-    knob_ugwp_azdir = 2, 4, 4, 4
-    knob_ugwp_doaxyz = 1
-    knob_ugwp_doheat = 1
-    knob_ugwp_dokdis = 1
-    knob_ugwp_effac = 1, 1, 1, 1
-    knob_ugwp_ndx4lh = 1
-    knob_ugwp_solver = 2
-    knob_ugwp_source = 1, 1, 0, 0
-    knob_ugwp_stoch = 0, 0, 0, 0
-    knob_ugwp_version = 0
-    knob_ugwp_wvspec = 1, 25, 25, 25
-    launch_level = 25
-/
-
-&diag_manager_nml
-    prepend_date = .false.
-/
-
-&external_ic_nml
-    checker_tr = .false.
-    filtered_terrain = .true.
-    gfs_dwinds = .true.
-    levp = 65
-    nt_checker = 0
-/
-
-&fms_io_nml
-    checksum_required = .false.
-    max_files_r = 100
-    max_files_w = 100
-/
-
-&fms_nml
-    clock_grain = 'ROUTINE'
-    domains_stack_size = 5000000
-    print_memory_usage = .false.
-/
-
-&fv_core_nml
-    a_imp = 1.0
-    adjust_dry_mass = .false.
-    bc_update_interval = 6
-    beta = 0.0
-    consv_am = .false.
-    consv_te = 0.0
-    d2_bg = 0.0
-    d2_bg_k1 = 0.2
-    d2_bg_k2 = 0.04
-    d4_bg = 0.12
-    d_con = 1.0
-    d_ext = 0.0
-    dddmp = 0.1
-    delt_max = 0.008
-    dnats = 0
-    do_sat_adj = .false.
-    do_schmidt = .true.
-    do_vort_damp = .true.
-    dwind_2d = .false.
-    dz_min = 2
-    external_eta = .true.
-    external_ic = .true.
-    fill = .true.
-    full_zs_filter = .false.
-    fv_debug = .false.
-    fv_sg_adj = 300
-    gfs_phil = .false.
-    hord_dp = 6
-    hord_mt = 6
-    hord_tm = 6
-    hord_tr = 10
-    hord_vt = 6
-    hydrostatic = .false.
-    io_layout = 1, 1
-    k_split = 2
-    ke_bg = 0.0
-    kord_mt = 9
-    kord_tm = -9
-    kord_tr = 9
-    kord_wz = 9
-    layout = 5, 2
-    make_nh = .true.
-    mountain = .false.
-    n_split = 5
-    n_sponge = 24
-    n_zs_filter = 0
-    na_init = 1
-    ncep_ic = .false.
-    nggps_ic = .true.
-    no_dycore = .false.
-    nord = 3
-    npx = 220
-    npy = 132
-    npz = 64
-    nrows_blend = 10
-    ntiles = 1
-    nudge_qv = .false.
-    nwat = 6
-    p_fac = 0.1
-    phys_hydrostatic = .false.
-    print_freq = 6
-    psm_bc = 1
-    range_warn = .true.
-    read_increment = .false.
-    regional = .true.
-    regional_bcs_from_gsi = .false.
-    res_latlon_dynamics = 'fv3_increment.nc'
-    reset_eta = .false.
-    rf_cutoff = 2000.0
-    stretch_fac = 0.999
-    target_lat = 38.5
-    target_lon = -97.5
-    tau = 5.0
-    use_hydro_pressure = .false.
-    vtdm4 = 0.02
-    warm_start = .false.
-    write_restart_with_bcs = .false.
-    z_tracer = .true.
-/
-
-&fv_grid_nml
-    grid_file = 'INPUT/grid_spec.nc'
-/
-
-&gfs_physics_nml
-    bl_mynn_edmf = 1
-    bl_mynn_edmf_mom = 1
-    bl_mynn_tkeadvect = .true.
-    cal_pre = .false.
-    cdmbgwd = 3.5, 0.25
-    cnvcld = .false.
-    cnvgwd = .false.
-    cplflx = .false.
-    debug = .false.
-    do_deep = .false.
-    do_mynnedmf = .true.
-    do_mynnsfclay = .true.
-    do_shum = .false.
-    do_skeb = .false.
-    do_spp = .false.
-    do_sppt = .false.
-    dspheat = .true.
-    effr_in = .true.
-    fhcyc = 0
-    fhlwr = 1200.0
-    fhswr = 1200.0
-    fhzero = 1.0
-    h2o_phys = .true.
-    hybedmf = .false.
-    iaer = 111
-    ialb = 1
-    iau_delthrs = 6
-    iau_inc_files = ''
-    iaufhrs = 30
-    icloud_bl = 1
-    ico2 = 2
-    iems = 1
-    imfdeepcnv = -1
-    imfshalcnv = -1
-    imp_physics = 8
-    iopt_alb = 2
-    iopt_btr = 1
-    iopt_crs = 1
-    iopt_dveg = 2
-    iopt_frz = 1
-    iopt_inf = 1
-    iopt_rad = 1
-    iopt_run = 1
-    iopt_sfc = 1
-    iopt_snf = 4
-    iopt_stc = 1
-    iopt_tbot = 2
-    iopt_trs = 2
-    isol = 2
-    isot = 1
-    isubc_lw = 2
-    isubc_sw = 2
-    ivegsrc = 1
-    ldiag3d = .false.
-    lheatstrg = .false.
-    lndp_type = 0
-    lradar = .true.
-    lsm = 2
-    lsoil = 4
-    lsoil_lsm = 4
-    ltaerosol = .true.
-    lwhtr = .true.
-    n_var_lndp = 0
-    n_var_spp = 0
-    nsradar_reset = 3600
-    nst_anl = .true.
-    nstf_name = 2, 1, 0, 0, 0
-    oz_phys = .false.
-    oz_phys_2015 = .true.
-    pdfcld = .false.
-    pre_rad = .false.
-    print_diff_pgr = .false.
-    prslrd0 = 0.0
-    random_clds = .false.
-    redrag = .true.
-    satmedmf = .false.
-    sfclay_compute_flux = .false.
-    shal_cnv = .false.
-    swhtr = .true.
-    trans_trac = .true.
-    ttendlim = -999
-    use_ufo = .true.
-/
-
-&interpolator_nml
-    interp_method = 'conserve_great_circle'
-/
-
-&nam_sfcperts
-/
-
-&nam_sppperts
-/
-
-&nam_stochy
-/
-
-&namsfc
-    fabsl = 99999
-    faisl = 99999
-    faiss = 99999
-    fnacna = ''
-    fnaisc = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/CFSR.SEAICE.1982.2012.monthly.clim.grb'
-    fnglac = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/global_glacier.2x2.grb'
-    fnmskh = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/seaice_newland.grb'
-    fnmxic = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/global_maxice.2x2.grb'
-    fnsmcc = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/global_soilmgldas.t126.384.190.grb'
-    fnsnoa = ''
-    fnsnoc = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/global_snoclim.1.875.grb'
-    fntsfa = ''
-    fntsfc = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/RTGSST.1982.2012.monthly.clim.grb'
-    fnzorc = 'igbp'
-    fsicl = 99999
-    fsics = 99999
-    fslpl = 99999
-    fsmcl = 99999, 99999, 99999
-    fsnol = 99999
-    fsnos = 99999
-    fsotl = 99999
-    ftsfl = 99999
-    ftsfs = 90
-    fvetl = 99999
-    fvmnl = 99999
-    fvmxl = 99999
-    ldebug = .true.
-/
-
-&namsfc_dict
-    fnabsc = '../fix_lam/C403.maximum_snow_albedo.tileX.nc'
-    fnalbc = '../fix_lam/C403.snowfree_albedo.tileX.nc'
-    fnalbc2 = '../fix_lam/C403.facsf.tileX.nc'
-    fnslpc = '../fix_lam/C403.slope_type.tileX.nc'
-    fnsotc = '../fix_lam/C403.soil_type.tileX.nc'
-    fntg3c = '../fix_lam/C403.substrate_temperature.tileX.nc'
-    fnvegc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
-    fnvetc = '../fix_lam/C403.vegetation_type.tileX.nc'
-    fnvmnc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
-    fnvmxc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
-/
-
-&surf_map_nml
-    cd2 = -1
-    cd4 = 0.12
-    max_slope = 0.4
-    n_del2_strong = 0
-    n_del2_weak = 2
-    n_del4 = 1
-    peak_fac = 1.0
-    zero_ocean = .false.
-/
diff --git a/physics/docs/pdftxt/RE300/namelists/input.nml.v21.FV3_WoFS_v0 b/physics/docs/pdftxt/RE300/namelists/input.nml.v21.FV3_WoFS_v0
deleted file mode 100644
index 94cc34d0f..000000000
--- a/physics/docs/pdftxt/RE300/namelists/input.nml.v21.FV3_WoFS_v0
+++ /dev/null
@@ -1,297 +0,0 @@
-&amip_interp_nml
-    data_set = 'reynolds_oi'
-    date_out_of_range = 'climo'
-    interp_oi_sst = .true.
-    no_anom_sst = .false.
-    use_ncep_ice = .false.
-    use_ncep_sst = .true.
-/
-
-&atmos_model_nml
-    blocksize = 40
-    ccpp_suite = 'FV3_WoFS_v0'
-    chksum_debug = .false.
-    dycore_only = .false.
-/
-
-&cires_ugwp_nml
-    knob_ugwp_azdir = 2, 4, 4, 4
-    knob_ugwp_doaxyz = 1
-    knob_ugwp_doheat = 1
-    knob_ugwp_dokdis = 1
-    knob_ugwp_effac = 1, 1, 1, 1
-    knob_ugwp_ndx4lh = 1
-    knob_ugwp_solver = 2
-    knob_ugwp_source = 1, 1, 0, 0
-    knob_ugwp_stoch = 0, 0, 0, 0
-    knob_ugwp_version = 0
-    knob_ugwp_wvspec = 1, 25, 25, 25
-    launch_level = 25
-/
-
-&diag_manager_nml
-    prepend_date = .false.
-/
-
-&external_ic_nml
-    checker_tr = .false.
-    filtered_terrain = .true.
-    gfs_dwinds = .true.
-    levp = 65
-    nt_checker = 0
-/
-
-&fms_io_nml
-    checksum_required = .false.
-    max_files_r = 100
-    max_files_w = 100
-/
-
-&fms_nml
-    clock_grain = 'ROUTINE'
-    domains_stack_size = 5000000
-    print_memory_usage = .false.
-/
-
-&fv_core_nml
-    a_imp = 1.0
-    adjust_dry_mass = .false.
-    bc_update_interval = 6
-    beta = 0.0
-    consv_am = .false.
-    consv_te = 0.0
-    d2_bg = 0.0
-    d2_bg_k1 = 0.2
-    d2_bg_k2 = 0.04
-    d4_bg = 0.12
-    d_con = 1.0
-    d_ext = 0.0
-    dddmp = 0.1
-    delt_max = 0.008
-    dnats = 0
-    do_sat_adj = .false.
-    do_schmidt = .true.
-    do_vort_damp = .true.
-    dwind_2d = .false.
-    dz_min = 2
-    external_eta = .true.
-    external_ic = .true.
-    fill = .true.
-    full_zs_filter = .false.
-    fv_debug = .false.
-    fv_sg_adj = 300
-    gfs_phil = .false.
-    hord_dp = 6
-    hord_mt = 6
-    hord_tm = 6
-    hord_tr = 10
-    hord_vt = 6
-    hydrostatic = .false.
-    io_layout = 1, 1
-    k_split = 2
-    ke_bg = 0.0
-    kord_mt = 9
-    kord_tm = -9
-    kord_tr = 9
-    kord_wz = 9
-    layout = 5, 2
-    make_nh = .true.
-    mountain = .false.
-    n_split = 5
-    n_sponge = 24
-    n_zs_filter = 0
-    na_init = 1
-    ncep_ic = .false.
-    nggps_ic = .true.
-    no_dycore = .false.
-    nord = 3
-    npx = 220
-    npy = 132
-    npz = 64
-    nrows_blend = 10
-    ntiles = 1
-    nudge_qv = .false.
-    nwat = 7
-    p_fac = 0.1
-    phys_hydrostatic = .false.
-    print_freq = 6
-    psm_bc = 1
-    range_warn = .true.
-    read_increment = .false.
-    regional = .true.
-    regional_bcs_from_gsi = .false.
-    res_latlon_dynamics = 'fv3_increment.nc'
-    reset_eta = .false.
-    rf_cutoff = 2000.0
-    stretch_fac = 0.999
-    target_lat = 38.5
-    target_lon = -97.5
-    tau = 5.0
-    use_hydro_pressure = .false.
-    vtdm4 = 0.02
-    warm_start = .false.
-    write_restart_with_bcs = .false.
-    z_tracer = .true.
-/
-
-&fv_diagnostics_nml
-    do_hailcast = .true.
-/
-
-&fv_grid_nml
-    grid_file = 'INPUT/grid_spec.nc'
-/
-
-&gfs_physics_nml
-    bl_mynn_edmf = 1
-    bl_mynn_edmf_mom = 1
-    bl_mynn_tkeadvect = .true.
-    cal_pre = .false.
-    cdmbgwd = 3.5, 0.25
-    cnvcld = .false.
-    cnvgwd = .false.
-    cplflx = .false.
-    debug = .false.
-    do_deep = .false.
-    do_mynnedmf = .true.
-    do_mynnsfclay = .true.
-    do_shum = .false.
-    do_skeb = .false.
-    do_spp = .false.
-    do_sppt = .false.
-    dspheat = .true.
-    effr_in = .true.
-    fhcyc = 0
-    fhlwr = 1200.0
-    fhswr = 1200.0
-    fhzero = 1.0
-    h2o_phys = .true.
-    hybedmf = .false.
-    iaer = 111
-    ialb = 1
-    iau_delthrs = 6
-    iau_inc_files = ''
-    iaufhrs = 30
-    icloud_bl = 1
-    ico2 = 2
-    iems = 1
-    imfdeepcnv = -1
-    imfshalcnv = -1
-    imp_physics = 17
-    iopt_alb = 2
-    iopt_btr = 1
-    iopt_crs = 1
-    iopt_dveg = 2
-    iopt_frz = 1
-    iopt_inf = 1
-    iopt_rad = 1
-    iopt_run = 1
-    iopt_sfc = 1
-    iopt_snf = 4
-    iopt_stc = 1
-    iopt_tbot = 2
-    isol = 2
-    isot = 1
-    isubc_lw = 2
-    isubc_sw = 2
-    ivegsrc = 1
-    ldiag3d = .false.
-    lheatstrg = .false.
-    lndp_type = 0
-    lradar = .true.
-    lsm = 1
-    lsoil = 4
-    lsoil_lsm = 4
-    ltaerosol = .true.
-    lwhtr = .true.
-    n_var_lndp = 0
-    n_var_spp = 0
-    nsradar_reset = 3600
-    nssl_cccn = 600000000.0
-    nssl_ccn_on = .true.
-    nssl_hail_on = .true.
-    nst_anl = .true.
-    nstf_name = 2, 1, 0, 0, 0
-    oz_phys = .false.
-    oz_phys_2015 = .true.
-    pdfcld = .false.
-    pre_rad = .false.
-    print_diff_pgr = .false.
-    prslrd0 = 0.0
-    random_clds = .false.
-    redrag = .true.
-    satmedmf = .false.
-    sfclay_compute_flux = .false.
-    shal_cnv = .false.
-    swhtr = .true.
-    trans_trac = .true.
-    ttendlim = -999
-    use_ufo = .true.
-/
-
-&interpolator_nml
-    interp_method = 'conserve_great_circle'
-/
-
-&nam_sfcperts
-/
-
-&nam_sppperts
-/
-
-&nam_stochy
-/
-
-&namsfc
-    fabsl = 99999
-    faisl = 99999
-    faiss = 99999
-    fnacna = ''
-    fnaisc = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/CFSR.SEAICE.1982.2012.monthly.clim.grb'
-    fnglac = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/global_glacier.2x2.grb'
-    fnmskh = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/seaice_newland.grb'
-    fnmxic = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/global_maxice.2x2.grb'
-    fnsmcc = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/global_soilmgldas.t126.384.190.grb'
-    fnsnoa = ''
-    fnsnoc = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/global_snoclim.1.875.grb'
-    fntsfa = ''
-    fntsfc = '../../../../../../../../../../det/UFS_SRW_App/v2p0/fix/fix_am/RTGSST.1982.2012.monthly.clim.grb'
-    fnzorc = 'igbp'
-    fsicl = 99999
-    fsics = 99999
-    fslpl = 99999
-    fsmcl = 99999, 99999, 99999
-    fsnol = 99999
-    fsnos = 99999
-    fsotl = 99999
-    ftsfl = 99999
-    ftsfs = 90
-    fvetl = 99999
-    fvmnl = 99999
-    fvmxl = 99999
-    ldebug = .true.
-/
-
-&namsfc_dict
-    fnabsc = '../fix_lam/C403.maximum_snow_albedo.tileX.nc'
-    fnalbc = '../fix_lam/C403.snowfree_albedo.tileX.nc'
-    fnalbc2 = '../fix_lam/C403.facsf.tileX.nc'
-    fnslpc = '../fix_lam/C403.slope_type.tileX.nc'
-    fnsotc = '../fix_lam/C403.soil_type.tileX.nc'
-    fntg3c = '../fix_lam/C403.substrate_temperature.tileX.nc'
-    fnvegc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
-    fnvetc = '../fix_lam/C403.vegetation_type.tileX.nc'
-    fnvmnc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
-    fnvmxc = '../fix_lam/C403.vegetation_greenness.tileX.nc'
-/
-
-&surf_map_nml
-    cd2 = -1
-    cd4 = 0.12
-    max_slope = 0.4
-    n_del2_strong = 0
-    n_del2_weak = 2
-    n_del4 = 1
-    peak_fac = 1.0
-    zero_ocean = .false.
-/

From 8f447558d9638c713be4c5aa285d6d6e4f3f09d6 Mon Sep 17 00:00:00 2001
From: "Michael Kavulich, Jr" <kavulich@ucar.edu>
Date: Tue, 1 Aug 2023 10:40:35 -0600
Subject: [PATCH 059/115] Incorporate changes to FV3_HRRR namelist suggested by
 Tanya

---
 .../pdftxt/RE300/namelists/input.nml.FV3_HRRR | 29 +++++++++++--------
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/physics/docs/pdftxt/RE300/namelists/input.nml.FV3_HRRR b/physics/docs/pdftxt/RE300/namelists/input.nml.FV3_HRRR
index 8a7d621f3..e30bd44c6 100644
--- a/physics/docs/pdftxt/RE300/namelists/input.nml.FV3_HRRR
+++ b/physics/docs/pdftxt/RE300/namelists/input.nml.FV3_HRRR
@@ -65,7 +65,7 @@
     d2_bg_k1 = 0.2
     d2_bg_k2 = 0.04
     d4_bg = 0.12
-    d_con = 1.0
+    d_con = 0.5
     d_ext = 0.0
     dddmp = 0.1
     delt_max = 0.008
@@ -82,11 +82,11 @@
     fv_debug = .false.
     fv_sg_adj = 300
     gfs_phil = .false.
-    hord_dp = -5
-    hord_mt = 5
-    hord_tm = 5
-    hord_tr = 10
-    hord_vt = 5
+    hord_dp = 6
+    hord_mt = 6
+    hord_tm = 6
+    hord_tr = 8
+    hord_vt = 6
     hydrostatic = .false.
     io_layout = 1, 1
     k_split = 2
@@ -99,14 +99,14 @@
     make_nh = .true.
     mountain = .false.
     n_split = 5
-    n_sponge = 24
+    n_sponge = 9
     n_zs_filter = 0
     na_init = 1
     ncep_ic = .false.
     nggps_ic = .true.
     no_dycore = .false.
     nord = 3
-    nord_tr = 2
+    nord_tr = 0
     npx = 220
     npy = 132
     npz = 64
@@ -150,6 +150,7 @@
     cnvgwd = .false.
     cplflx = .false.
     debug = .false.
+    diag_log = .true.
     do_deep = .false.
     do_gsl_drag_ls_bl = .true.
     do_gsl_drag_ss = .true.
@@ -166,14 +167,14 @@
     h2o_phys = .true.
     hybedmf = .false.
     iaer = 5111
-    ialb = 1
+    ialb = 2
     iau_delthrs = 6
     iau_inc_files = ''
     iaufhrs = 30
     icliq_sw = 2
     icloud_bl = 1
     ico2 = 2
-    iems = 1
+    iems = 2
     imfdeepcnv = -1
     imfshalcnv = -1
     imp_physics = 8
@@ -191,12 +192,15 @@
     iopt_tbot = 2
     iopt_trs = 2
     iovr = 3
+    isncond_opt = 2
+    isncovr_opt = 3
     isol = 2
     isot = 1
     isubc_lw = 2
     isubc_sw = 2
     ivegsrc = 1
     kice = 9
+    kice = 9
     ldiag3d = .false.
     lheatstrg = .false.
     lradar = .true.
@@ -205,9 +209,9 @@
     lsoil_lsm = 9
     ltaerosol = .true.
     lwhtr = .true.
+    mosaic_lu = 0
+    mosaic_soil = 0
     nsfullradar_diag = 3600
-    nst_anl = .true.
-    nstf_name = 2, 1, 0, 0, 0
     oz_phys = .false.
     oz_phys_2015 = .true.
     pdfcld = .false.
@@ -220,6 +224,7 @@
     sfclay_compute_flux = .true.
     shal_cnv = .false.
     swhtr = .true.
+    thsfc_loc = .false.
     trans_trac = .true.
     ttendlim = -999
     use_ufo = .true.

From aaa02d82af9309ea3df4880ad9d5eb9eb949b25d Mon Sep 17 00:00:00 2001
From: "Michael Kavulich, Jr" <kavulich@ucar.edu>
Date: Tue, 1 Aug 2023 11:02:55 -0600
Subject: [PATCH 060/115] Address Ligia/Weiwei's comments

---
 physics/docs/pdftxt/CU_GF_deep.txt        | 8 ++++----
 physics/docs/pdftxt/RRFS_v1beta_suite.txt | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/physics/docs/pdftxt/CU_GF_deep.txt b/physics/docs/pdftxt/CU_GF_deep.txt
index 1a02516f7..3b01a05a4 100644
--- a/physics/docs/pdftxt/CU_GF_deep.txt
+++ b/physics/docs/pdftxt/CU_GF_deep.txt
@@ -6,17 +6,17 @@ The Grell-Freitas (GF) scheme, as described in Grell and Freitas (2014) \cite gr
 Freitas et al. (2018) \cite freitas_et_al_2018, Freitas et al. (2021) \cite freitas_et_al_2021, and Lin et al. (2022) \cite Lin_2022
 follows the mass flux approach published by Grell (1993) \cite grell_1993.
 Further developments by Grell and \f$D\acute{e}v\acute{e}nyi\f$ (2002) \cite Grell_2002 included implementing 
-stochastics through allowing parameter perturbations. In GF scale awareness, and the aerosol dependence through rain generation (following
+stochastics through allowing parameter perturbations. The GF scheme takes into account aerosol dependence through rain generation (following
 Berry (1968) \cite berry_1968 and evaporation formulations (following Jiang et al. (2010) \cite Jiang_2010 ), depending on the 
 cloud concentration nuclei at cloud base were added. The GF scheme includes mixed phase physics impact, momentum transport,
  a diurnal cycle closure (Bechtold et al. (2014) \cite bechtold_et_al_2014 ), and a trimodal spectral size to simulate the interaction
 and transition from shallow, congestus and deep convection regimes. The vertical mass flux distribution of shallow, congestus and
-deep convection regimes is characterized by Probability Density Functions (PDFs). The three PDF's are meant to represent the average
+deep convection regimes is characterized by Probability Density Functions (PDFs). The three PDFs are meant to represent the average
 statistical mass flux characteristic of deep, congestus, and shallow (respectively) plumes in the grid area. Each PDF therefore represents
 a spectrum of plumes within the grid box. Forcing is different for each characteristic type. Entrainment and detrainment are derived 
-from the PDF's. The deep and congestus convection considers scale awareness (Arakawa et al. (2011) \cite Arakawa_2011 ). However, the shallow convection is not scale-aware. Aerosol dependence is implemented through dependence of rain generation and 
+from the PDFs. Aerosol dependence (considered experimental and not supported in this release) is implemented through dependence of rain generation and 
 evaporation formulations depending on the cloud concentration nuclei at cloud base (Berry 1968 \cite berry_1968, 
-Jiang et al.(2010) \cite Jiang_2010, and Lee and Feingold (2010) \cite lee_and_feingold_2010 ). Wet scavenging is considered to add a memory impact. Aerosol dependence is considered experimental and is turned off at this point. GF is able to transport tracers.
+Jiang et al.(2010) \cite Jiang_2010, and Lee and Feingold (2010) \cite lee_and_feingold_2010 ). Wet scavenging is considered to add a memory impact. GF is able to transport tracers.
 Recently, GPU capabilities and cap suppressing (\p do_cap_suppress) based on radar data assimilation have been added,and they are used only for the RAP suite.
 
 The impacts of GF scheme in operational RAP/HRRR include:(a)uses mass-flux schemes, which are more physically realistic than (sounding) adjustment schemes;
diff --git a/physics/docs/pdftxt/RRFS_v1beta_suite.txt b/physics/docs/pdftxt/RRFS_v1beta_suite.txt
index ae400b982..b2e4ba676 100644
--- a/physics/docs/pdftxt/RRFS_v1beta_suite.txt
+++ b/physics/docs/pdftxt/RRFS_v1beta_suite.txt
@@ -3,7 +3,7 @@
 
 \section RRFS_v1beta_suite_overview Overview
 
-The RRFS_v1beta suite is one of candicates for the future operational implementation of
+The RRFS_v1beta suite is one of the candidates for the future operational implementation of
 the Rapid Refresh Forecast System (RRFS), which can be configured using the UFS SRW App.  This suite is most 
 applicable for runs at 3-km resolution since it does not parameterize
 deep convection. 

From dbcd50fee66582d9b58fb03872b4ce34ab23531d Mon Sep 17 00:00:00 2001
From: "Michael Kavulich, Jr" <kavulich@ucar.edu>
Date: Tue, 1 Aug 2023 15:08:15 -0600
Subject: [PATCH 061/115] Remove hard-coded path in doxyfile

---
 physics/docs/ccppsrw_doxyfile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/physics/docs/ccppsrw_doxyfile b/physics/docs/ccppsrw_doxyfile
index 5c9c797b5..a45fad88f 100644
--- a/physics/docs/ccppsrw_doxyfile
+++ b/physics/docs/ccppsrw_doxyfile
@@ -542,7 +542,7 @@ DIRECTORY_GRAPH        = YES
 DIR_GRAPH_MAX_DEPTH    = 1
 DOT_IMAGE_FORMAT       = SVG
 INTERACTIVE_SVG        = NO
-DOT_PATH               = /Users/man.zhang/homebrew/bin/dot 
+DOT_PATH               =
 DOTFILE_DIRS           =
 MSCFILE_DIRS           =
 DIAFILE_DIRS           =

From 8188e26897b91083b315a0c8f83e32f54209c96d Mon Sep 17 00:00:00 2001
From: dustinswales <dswales@ucar.edu>
Date: Tue, 1 Aug 2023 16:01:38 -0600
Subject: [PATCH 062/115] Split ozone physics into time_vary and run components

---
 physics/GFS_rrtmg_setup.meta  |  12 +-
 physics/GFS_rrtmgp_setup.meta |  12 +-
 physics/ozphys_2015.F90       | 181 ++---------------------------
 physics/ozphys_2015.meta      | 205 +--------------------------------
 physics/ozphys_time_vary.F90  | 177 +++++++++++++++++++++++++++++
 physics/ozphys_time_vary.meta | 207 ++++++++++++++++++++++++++++++++++
 6 files changed, 406 insertions(+), 388 deletions(-)
 create mode 100644 physics/ozphys_time_vary.F90
 create mode 100644 physics/ozphys_time_vary.meta

diff --git a/physics/GFS_rrtmg_setup.meta b/physics/GFS_rrtmg_setup.meta
index 42b999c82..f92d6f8db 100644
--- a/physics/GFS_rrtmg_setup.meta
+++ b/physics/GFS_rrtmg_setup.meta
@@ -174,22 +174,22 @@
   type = integer
   intent = in
 [levozp]
-  standard_name = number_of_levels_in_ozone_data
-  long_name = number of levels in ozone data
+  standard_name = number_of_levels_in_ozone_climotology_data
+  long_name = number of levels in ozone climotology data
   units = count
   dimensions = ()
   type = integer
   intent = in
 [timeozp]
-  standard_name = number_of_times_in_ozone_data
-  long_name = number of times in ozone data
+  standard_name = number_of_times_in_ozone_climotology_data
+  long_name = number of times in ozone climotology data
   units = count
   dimensions = ()
   type = integer
   intent = in
 [latsozp]
-  standard_name = number_of_latitudes_in_ozone_data
-  long_name = number of latitude in ozone data
+  standard_name = number_of_latitudes_in_ozone_climotology_data
+  long_name = number of latitude in ozone climotology data
   units = count
   dimensions = ()
   type = integer
diff --git a/physics/GFS_rrtmgp_setup.meta b/physics/GFS_rrtmgp_setup.meta
index 567294d4a..c8ed60650 100644
--- a/physics/GFS_rrtmgp_setup.meta
+++ b/physics/GFS_rrtmgp_setup.meta
@@ -267,22 +267,22 @@
   type = integer
   intent = inout
 [levozp]
-  standard_name = number_of_levels_in_ozone_data
-  long_name = number of levels in ozone data
+  standard_name = number_of_levels_in_ozone_climotology_data
+  long_name = number of levels in ozone climotology data
   units = count
   dimensions = ()
   type = integer
   intent = in
 [timeozp]
-  standard_name = number_of_times_in_ozone_data
-  long_name = number of times in ozone data
+  standard_name = number_of_times_in_ozone_climotology_data
+  long_name = number of times in ozone climotology data
   units = count
   dimensions = ()
   type = integer
   intent = in
 [latsozp]
-  standard_name = number_of_latitudes_in_ozone_data
-  long_name = number of latitude in ozone data
+  standard_name = number_of_latitudes_in_ozone_climotology_data
+  long_name = number of latitude in ozone climotology data
   units = count
   dimensions = ()
   type = integer
diff --git a/physics/ozphys_2015.F90 b/physics/ozphys_2015.F90
index fda87611c..82ade0cbd 100644
--- a/physics/ozphys_2015.F90
+++ b/physics/ozphys_2015.F90
@@ -5,176 +5,13 @@
 module ozphys_2015
   use machine, only : kind_phys, kind_dbl_prec, kind_sngl_prec
   implicit none
-  public ozphys_2015_init, ozphys_2015_timestep_init, ozphys_2015_run
+  public ozphys_2015_run
 contains
 
 ! ###########################################################################################
 !>\defgroup GFS_ozphys_2015 GFS Ozone Photochemistry (2015) Module
 !! This module contains the CCPP-compliant Ozone 2015 photochemistry scheme.
 !> @{
-!> \section arg_table_ozphys_2015_init Argument Table
-!! \htmlinclude ozphys_2015_init.html
-!!
-! ###########################################################################################
-  subroutine ozphys_2015_init(oz_phys_2015, nPts, latsozp, oz_lat, dlat, jindx1, jindx2,    &
-       ddy, errmsg, errflg)
-    ! Inputs
-    logical, intent(in) :: &
-         oz_phys_2015 ! Control flag for NRL 2015 ozone physics scheme
-    integer, intent(in) :: &
-         nPts,      & ! Horizontal dimension
-         latsozp      ! Number of latitudes in ozone data
-    real(kind_phys),  intent(in), dimension(:) :: &
-         oz_lat,    & ! Latitudes of ozone data
-         dlat         ! Latitudes of grid
-    ! Outputs
-    integer, intent(out), dimension(:) :: &
-         jindx1,    & ! Interpolation index (low) for ozone data
-         jindx2       ! Interpolation index (high) for ozone data
-    real(kind_phys), intent(out), dimension(:) :: &
-         ddy          ! Interpolation high index for ozone data
-    character(len=*), intent(out) :: &
-         errmsg       ! CCPP error message
-    integer, intent(out) :: &
-         errflg       ! CCPP error flag
-
-    ! Local
-    integer i,j
-
-    ! Initialize CCPP error handling variables
-    errmsg = ''
-    errflg = 0
-    
-    ! Sanity check
-    if (.not.oz_phys_2015) then
-       write (errmsg,'(*(a))') 'Logic error: oz_phys_2015 == .false.'
-       errflg = 1
-       return
-    endif
-
-    ! Set indices
-    do j=1,nPts
-       jindx2(j) = latsozp + 1
-       do i=1,latsozp
-          if (dlat(j) < oz_lat(i)) then
-             jindx2(j) = i
-             exit
-          endif
-       enddo
-       jindx1(j) = max(jindx2(j)-1,1)
-       jindx2(j) = min(jindx2(j),latsozp)
-       if (jindx2(j) .ne. jindx1(j)) then
-          ddy(j) = (dlat(j) - oz_lat(jindx1(j))) / (oz_lat(jindx2(j)) - oz_lat(jindx1(j)))
-       else
-          ddy(j) = 1.0
-       endif
-    enddo
-    
-  end subroutine ozphys_2015_init
-
-! ###########################################################################################
-!> \section arg_table_ozphys_2015_timestep_init Argument Table
-!! \htmlinclude ozphys_2015_timestep_init.html
-!!
-! ###########################################################################################
-  subroutine ozphys_2015_timestep_init(nPts, idate, fhour, jindx1, jindx2, latsozp, levozp, &
-       oz_coeff, timeoz, ozplin, oz_time, oz_lat, ddy, ozplout, errmsg, errflg)
-    ! Inputs
-    integer, intent(in) :: &
-         nPts,     & ! Horizontal dimension
-         latsozp,  & ! Number of latitudes in ozone data
-         levozp,   & ! Number of vertical layers in ozone data
-         oz_coeff, & ! Number of coefficients in ozone data
-         timeoz      ! Number of times in ozone data
-    integer, intent(in),dimension(:) :: &
-         idate,    & ! Initial date with different size and ordering
-         jindx1,   & ! Interpolation index (low) for ozone
-         jindx2      ! Interpolation index (high) for ozone
-    real(kind_phys), intent(in) :: &
-         fhour       ! Forecast hour
-    real(kind_phys), intent(in), dimension(:) :: &
-         ddy,      & ! Interpolation high index for ozone data
-         oz_lat,   & ! Latitudes for ozone data
-         oz_time     ! Time for ozone data
-    real(kind_phys), intent(in), dimension(:,:,:,:) :: &
-         ozplin      ! Ozone data
-
-    ! Outputs
-    real(kind_phys), intent(out), dimension(:,:,:) :: &
-         ozplout     ! Ozone forcing data
-    character(len=*), intent(out) :: &
-         errmsg      ! CCPP error message
-    integer,          intent(out) :: &
-         errflg      ! CCPP error flag
-
-    ! Local
-    integer :: idat(8),jdat(8),iday,j,j1,j2,l,nc,n1,n2,jdow,jdoy,&
-         jday,w3kindreal,w3kindint
-    real(kind_phys) :: tem, tx1, tx2, rjday
-    real(8) :: rinc(5)
-    real(4) :: rinc4(5)
-    !real(kind_dbl_prec) :: rinc(5)
-    !real(kind_sngl_prec) :: rinc4(5)
-
-    ! Initialize CCPP error handling variables
-    errmsg = ''
-    errflg = 0
-
-    !
-    idat=0
-    idat(1)=idate(4)
-    idat(2)=idate(2)
-    idat(3)=idate(3)
-    idat(5)=idate(1)
-    rinc=0.
-    rinc(2)=fhour
-    call w3kind(w3kindreal,w3kindint)
-    if(w3kindreal==4) then
-       rinc4=rinc
-       CALL w3movdat(rinc4,idat,jdat)
-    else
-       CALL w3movdat(rinc,idat,jdat)
-    endif
-    !
-    jdow = 0
-    jdoy = 0
-    jday = 0
-    call w3doxdat(jdat,jdow,jdoy,jday)
-    rjday = jdoy + jdat(5) / 24.
-    IF (RJDAY < oz_time(1)) RJDAY = RJDAY + 365.
-    !
-    n2 = timeoz + 1
-    do j=2,timeoz
-       if (rjday < oz_time(j)) then
-          n2 = j
-          exit
-       endif
-    enddo
-    n1 = n2 - 1
-    
-    tx1 = (oz_time(n2) - rjday) / (oz_time(n2) - oz_time(n1))
-    tx2 = 1.0 - tx1
-    
-    if (n2 > timeoz) n2 = n2 - timeoz
-    !
-    do nc=1,oz_coeff
-       do L=1,levozp
-          do J=1,npts
-             J1  = jindx1(J)
-             J2  = jindx2(J)
-             TEM = 1.0 - ddy(J)
-             ozplout(j,L,nc) = tx1*(TEM*ozplin(J1,L,nc,n1)+ddy(J)*ozplin(J2,L,nc,n1)) & 
-                  + tx2*(TEM*ozplin(J1,L,nc,n2)+ddy(J)*ozplin(J2,L,nc,n2))
-          enddo
-       enddo
-    enddo
-
-    !
-    return
-
-  end subroutine ozphys_2015_timestep_init
-
-! ###########################################################################################  
 !> The operational GFS currently parameterizes ozone production and
 !! destruction based on monthly mean coefficients (
 !! \c ozprdlos_2015_new_sbuvO3_tclm15_nuchem.f77) provided by Naval
@@ -187,11 +24,11 @@ end subroutine ozphys_2015_timestep_init
 !> -  This code assumes that both prsl and po3 are from bottom to top
 !!     as are all other variables.
 !> -  This code is specifically for NRL parameterization and
-!!     climatological T and O3 are in location 5 and 6 of prdout array
-!!\author June 2015 - Shrinivas Moorthi
-!!\author May 2023  - Dustin Swales
+!!     climatological T and O3 are in location 5 and 6 of oz_data array
+!!\author   June 2015 - Shrinivas Moorthi
+!!\modified May  2023 - Dustin Swales
 ! ###########################################################################################
-  subroutine ozphys_2015_run ( im, levs, ko3, dt, oz, tin, po3, prsl, prdout, pl_coeff,     &
+  subroutine ozphys_2015_run ( im, levs, ko3, dt, oz, tin, po3, prsl, oz_data, pl_coeff,    &
        delp, ldiag3d, dtend, dtidx, ntoz, index_of_process_prod_loss,                       &
        index_of_process_ozmix, index_of_process_temp, index_of_process_overhead_ozone,      &
        con_g, errmsg, errflg)
@@ -222,7 +59,7 @@ subroutine ozphys_2015_run ( im, levs, ko3, dt, oz, tin, po3, prsl, prdout, pl_c
          tin,                          & ! Temperature of new-state (K)
          delp                            ! Difference between mid-layer pressures (Pa)
     real(kind_phys), intent(in), dimension(:,:,:) :: &
-         prdout                          ! Ozone forcing data
+         oz_data                          ! Ozone forcing data
 
     ! In/Outs
     real(kind=kind_phys), intent(inout), dimension(:,:,:) :: &
@@ -298,7 +135,7 @@ subroutine ozphys_2015_run ( im, levs, ko3, dt, oz, tin, po3, prsl, prdout, pl_c
           do j=1,pl_coeff
              do i=1,im
                 if (flg(i)) then
-                   prod(i,j)  = wk2(i) * prdout(i,k,j) + wk3(i) * prdout(i,k+1,j)
+                   prod(i,j)  = wk2(i) * oz_data(i,k,j) + wk3(i) * oz_data(i,k+1,j)
                 endif
              enddo
           enddo
@@ -307,10 +144,10 @@ subroutine ozphys_2015_run ( im, levs, ko3, dt, oz, tin, po3, prsl, prdout, pl_c
        do j=1,pl_coeff
           do i=1,im
              if (wk1(i) < po3(ko3)) then
-                prod(i,j) = prdout(i,ko3,j)
+                prod(i,j) = oz_data(i,ko3,j)
              endif
              if (wk1(i) >= po3(1)) then
-                prod(i,j) = prdout(i,1,j)
+                prod(i,j) = oz_data(i,1,j)
              endif
           enddo
        enddo
diff --git a/physics/ozphys_2015.meta b/physics/ozphys_2015.meta
index eab24baf1..ea82defaa 100644
--- a/physics/ozphys_2015.meta
+++ b/physics/ozphys_2015.meta
@@ -3,209 +3,6 @@
   type = scheme
   dependencies = machine.F
 
-########################################################################
-[ccpp-arg-table]
-  name = ozphys_2015_init
-  type = scheme
-[nPts]
-  standard_name = horizontal_dimension
-  long_name = horizontal dimension
-  units = count
-  dimensions = ()
-  type = integer
-  intent = in
-[latsozp]
-  standard_name = number_of_latitudes_in_ozone_data
-  long_name = number of latitude in ozone data
-  units = count
-  dimensions = ()
-  type = integer
-  intent = in
-[oz_phys_2015]
-  standard_name = flag_for_nrl_2015_ozone_scheme
-  long_name = flag for new (2015) ozone physics
-  units = flag
-  dimensions = ()
-  type = logical
-  intent = in
-[oz_lat]
-  standard_name = ozone_data_latitude
-  long_name = ozone data latitude
-  units = deg
-  dimensions = (number_of_latitudes_in_ozone_data)
-  type = real
-  kind = kind_phys
-  intent = in
-[dlat]
-  standard_name = latitude_in_degree
-  long_name = latitude in degree north
-  units = degree_north
-  dimensions = (horizontal_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[jindx1]
-  standard_name = lower_latitude_index_of_ozone_forcing_for_interpolation
-  long_name = interpolation low index for ozone
-  units = index
-  dimensions = (horizontal_dimension)
-  type = integer
-  intent = out
-[jindx2]
-  standard_name = upper_latitude_index_of_ozone_forcing_for_interpolation
-  long_name = interpolation high index for ozone
-  units = index
-  dimensions = (horizontal_dimension)
-  type = integer
-  intent = out
-[ddy]
-  standard_name = latitude_interpolation_weight_for_ozone_forcing
-  long_name = interpolation high index for ozone
-  units = none
-  dimensions = (horizontal_dimension)
-  type = real
-  kind = kind_phys
-  intent = out
-[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
-
-########################################################################
-[ccpp-arg-table]
-  name = ozphys_2015_timestep_init
-  type = scheme
-[nPts]
-  standard_name = horizontal_dimension
-  long_name = horizontal dimension
-  units = count
-  dimensions = ()
-  type = integer
-  intent = in
-[idate]
-  standard_name = date_and_time_at_model_initialization_in_united_states_order
-  long_name = initial date with different size and ordering
-  units = none
-  dimensions = (4)
-  type = integer
-  intent = in
-[fhour]
-  standard_name = forecast_time
-  long_name = current forecast time
-  units = h
-  dimensions = ()
-  type = real
-  kind = kind_phys
-  intent = in
-[jindx1]
-  standard_name = lower_latitude_index_of_ozone_forcing_for_interpolation
-  long_name = interpolation low index for ozone
-  units = index
-  dimensions = (horizontal_dimension)
-  type = integer
-  intent = in
-[jindx2]
-  standard_name = upper_latitude_index_of_ozone_forcing_for_interpolation
-  long_name = interpolation high index for ozone
-  units = index
-  dimensions = (horizontal_dimension)
-  type = integer
-  intent = in
-[latsozp]
-  standard_name = number_of_latitudes_in_ozone_data
-  long_name = number of latitude in ozone data
-  units = count
-  dimensions = ()
-  type = integer
-  intent = in
-[levozp]
-  standard_name = number_of_levels_in_ozone_data
-  long_name = number of levels in ozone data
-  units = count
-  dimensions = ()
-  type = integer
-  intent = in
-[oz_coeff]
-  standard_name = number_of_coefficients_in_ozone_data
-  long_name = number of coefficients in ozone data
-  units = count
-  dimensions = ()
-  type = integer
-  intent = in
-[timeoz]
-  standard_name = number_of_times_in_ozone_data
-  long_name = number of times in ozone data
-  units = count
-  dimensions = ()
-  type = integer
-  intent = in
-[ozplin]
-  standard_name = ozone_data
-  long_name = ozone data
-  units = 1
-  dimensions = (number_of_latitudes_in_ozone_data,number_of_levels_in_ozone_data,number_of_coefficients_in_ozone_data,number_of_times_in_ozone_data)
-  type = real
-  kind = kind_phys
-  intent = in
-[oz_time]
-  standard_name = ozone_data_time
-  long_name = ozone data time
-  units = none
-  dimensions = (13)
-  type = real
-  kind = kind_phys
-  intent = in
-[oz_lat]
-  standard_name = ozone_data_latitude
-  long_name = ozone data latitude
-  units = deg
-  dimensions = (number_of_latitudes_in_ozone_data)
-  type = real
-  kind = kind_phys
-  intent = in
-[ddy]
-  standard_name = latitude_interpolation_weight_for_ozone_forcing
-  long_name = interpolation high index for ozone
-  units = none
-  dimensions = (horizontal_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[ozplout]
-  standard_name = ozone_forcing
-  long_name = ozone forcing data
-  units = mixed
-  dimensions = (horizontal_dimension,number_of_levels_in_ozone_data,number_of_coefficients_in_ozone_data)
-  type = real
-  kind = kind_phys
-  intent = out
-[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
-
 ########################################################################
 [ccpp-arg-table]
   name = ozphys_2015_run
@@ -271,7 +68,7 @@
   type = real
   kind = kind_phys
   intent = in
-[prdout]
+[oz_data]
   standard_name = ozone_forcing
   long_name = ozone forcing data
   units = mixed
diff --git a/physics/ozphys_time_vary.F90 b/physics/ozphys_time_vary.F90
new file mode 100644
index 000000000..5b36f88b9
--- /dev/null
+++ b/physics/ozphys_time_vary.F90
@@ -0,0 +1,177 @@
+! ###########################################################################################
+!> \file ozphys_time_vary.F90
+!!
+! ###########################################################################################
+module ozphys_time_vary
+  use machine, only : kind_phys, kind_dbl_prec, kind_sngl_prec
+  implicit none
+  public ozphys_time_vary_init, ozphys_time_vary_timestep_init
+contains
+
+! ###########################################################################################
+!>\defgroup GFS Ozone Photochemistry (2015) Module
+!! This module contains the CCPP-compliant Ozone 2015 photochemistry scheme.
+!> @{
+!> \section arg_table_ozphys_time_vary_init Argument Table
+!! \htmlinclude ozphys_time_vary_init.html
+!!
+! ###########################################################################################
+  subroutine ozphys_time_vary_init(oz_phys, nPts, latsozp, oz_lat, dlat, jindx1, jindx2,    &
+       ddy, errmsg, errflg)
+    ! Inputs
+    logical, intent(in) :: &
+         oz_phys      ! Control flag for NRL ozone scheme
+    integer, intent(in) :: &
+         nPts,      & ! Horizontal dimension
+         latsozp      ! Number of latitudes in ozone data
+    real(kind_phys),  intent(in), dimension(:) :: &
+         oz_lat,    & ! Latitudes of ozone data
+         dlat         ! Latitudes of grid
+    ! Outputs
+    integer, intent(inout), dimension(:) :: &
+         jindx1,    & ! Interpolation index (low) for ozone data
+         jindx2       ! Interpolation index (high) for ozone data
+    real(kind_phys), intent(inout), dimension(:) :: &
+         ddy          ! Interpolation high index for ozone data
+    character(len=*), intent(out) :: &
+         errmsg       ! CCPP error message
+    integer, intent(out) :: &
+         errflg       ! CCPP error flag
+
+    ! Local
+    integer i,j
+
+    ! Initialize CCPP error handling variables
+    errmsg = ''
+    errflg = 0
+    
+    ! Sanity check
+    if (.not.oz_phys) then
+       write (errmsg,'(*(a))') 'Logic error: oz_phys == .false.'
+       errflg = 1
+       return
+    endif
+
+    ! Set indices
+    do j=1,nPts
+       jindx2(j) = latsozp + 1
+       do i=1,latsozp
+          if (dlat(j) < oz_lat(i)) then
+             jindx2(j) = i
+             exit
+          endif
+       enddo
+       jindx1(j) = max(jindx2(j)-1,1)
+       jindx2(j) = min(jindx2(j),latsozp)
+       if (jindx2(j) .ne. jindx1(j)) then
+          ddy(j) = (dlat(j) - oz_lat(jindx1(j))) / (oz_lat(jindx2(j)) - oz_lat(jindx1(j)))
+       else
+          ddy(j) = 1.0
+       endif
+    enddo
+    
+  end subroutine ozphys_time_vary_init
+
+! ###########################################################################################
+!> \section arg_table_ozphys_time_vary_timestep_init Argument Table
+!! \htmlinclude ozphys_time_vary_timestep_init.html
+!!
+! ###########################################################################################
+  subroutine ozphys_time_vary_timestep_init(nPts, idate, fhour, jindx1, jindx2, latsozp,    &
+       levozp, oz_coeff, timeoz, ozplin, oz_time, oz_lat, ddy, oz_data, errmsg, errflg)
+    ! Inputs
+    integer, intent(in) :: &
+         nPts,     & ! Horizontal dimension
+         latsozp,  & ! Number of latitudes in ozone data
+         levozp,   & ! Number of vertical layers in ozone data
+         oz_coeff, & ! Number of coefficients in ozone data
+         timeoz      ! Number of times in ozone data
+    integer, intent(in),dimension(:) :: &
+         idate,    & ! Initial date with different size and ordering
+         jindx1,   & ! Interpolation index (low) for ozone
+         jindx2      ! Interpolation index (high) for ozone
+    real(kind_phys), intent(in) :: &
+         fhour       ! Forecast hour
+    real(kind_phys), intent(in), dimension(:) :: &
+         ddy,      & ! Interpolation high index for ozone data
+         oz_lat,   & ! Latitudes for ozone data
+         oz_time     ! Time for ozone data
+    real(kind_phys), intent(in), dimension(:,:,:,:) :: &
+         ozplin      ! Ozone data
+
+    ! Outputs
+    real(kind_phys), intent(inout), dimension(:,:,:) :: &
+         oz_data     ! Ozone forcing data
+    character(len=*), intent(out) :: &
+         errmsg      ! CCPP error message
+    integer,          intent(out) :: &
+         errflg      ! CCPP error flag
+
+    ! Local
+    integer :: idat(8),jdat(8),iday,j,j1,j2,l,nc,n1,n2,jdow,jdoy,&
+         jday,w3kindreal,w3kindint
+    real(kind_phys) :: tem, tx1, tx2, rjday
+    real(8) :: rinc(5)
+    real(4) :: rinc4(5)
+    !real(kind_dbl_prec) :: rinc(5)
+    !real(kind_sngl_prec) :: rinc4(5)
+
+    ! Initialize CCPP error handling variables
+    errmsg = ''
+    errflg = 0
+
+    !
+    idat=0
+    idat(1)=idate(4)
+    idat(2)=idate(2)
+    idat(3)=idate(3)
+    idat(5)=idate(1)
+    rinc=0.
+    rinc(2)=fhour
+    call w3kind(w3kindreal,w3kindint)
+    if(w3kindreal==4) then
+       rinc4=rinc
+       CALL w3movdat(rinc4,idat,jdat)
+    else
+       CALL w3movdat(rinc,idat,jdat)
+    endif
+    !
+    jdow = 0
+    jdoy = 0
+    jday = 0
+    call w3doxdat(jdat,jdow,jdoy,jday)
+    rjday = jdoy + jdat(5) / 24.
+    IF (RJDAY < oz_time(1)) RJDAY = RJDAY + 365.
+    !
+    n2 = timeoz + 1
+    do j=2,timeoz
+       if (rjday < oz_time(j)) then
+          n2 = j
+          exit
+       endif
+    enddo
+    n1 = n2 - 1
+    
+    tx1 = (oz_time(n2) - rjday) / (oz_time(n2) - oz_time(n1))
+    tx2 = 1.0 - tx1
+    
+    if (n2 > timeoz) n2 = n2 - timeoz
+    !
+    do nc=1,oz_coeff
+       do L=1,levozp
+          do J=1,npts
+             J1  = jindx1(J)
+             J2  = jindx2(J)
+             TEM = 1.0 - ddy(J)
+             oz_data(j,L,nc) = tx1*(TEM*ozplin(J1,L,nc,n1)+ddy(J)*ozplin(J2,L,nc,n1)) & 
+                  + tx2*(TEM*ozplin(J1,L,nc,n2)+ddy(J)*ozplin(J2,L,nc,n2))
+          enddo
+       enddo
+    enddo
+
+    !
+    return
+
+  end subroutine ozphys_time_vary_timestep_init
+!> @}
+end module ozphys_time_vary
diff --git a/physics/ozphys_time_vary.meta b/physics/ozphys_time_vary.meta
new file mode 100644
index 000000000..93aa4a3b0
--- /dev/null
+++ b/physics/ozphys_time_vary.meta
@@ -0,0 +1,207 @@
+[ccpp-table-properties]
+  name = ozphys_time_vary
+  type = scheme
+  dependencies = machine.F
+
+########################################################################
+[ccpp-arg-table]
+  name = ozphys_time_vary_init
+  type = scheme
+[nPts]
+  standard_name = horizontal_dimension
+  long_name = horizontal dimension
+  units = count
+  dimensions = ()
+  type = integer
+  intent = in
+[latsozp]
+  standard_name = number_of_latitudes_in_ozone_data
+  long_name = number of latitude in ozone data
+  units = count
+  dimensions = ()
+  type = integer
+  intent = in
+[oz_phys]
+  standard_name = flag_for_nrl_2015_ozone_scheme
+  long_name = flag for new (2015) ozone physics
+  units = flag
+  dimensions = ()
+  type = logical
+  intent = in
+[oz_lat]
+  standard_name = ozone_data_latitude
+  long_name = ozone data latitude
+  units = deg
+  dimensions = (number_of_latitudes_in_ozone_data)
+  type = real
+  kind = kind_phys
+  intent = in
+[dlat]
+  standard_name = latitude_in_degree
+  long_name = latitude in degree north
+  units = degree_north
+  dimensions = (horizontal_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[jindx1]
+  standard_name = lower_latitude_index_of_ozone_forcing_for_interpolation
+  long_name = interpolation low index for ozone
+  units = index
+  dimensions = (horizontal_dimension)
+  type = integer
+  intent = inout
+[jindx2]
+  standard_name = upper_latitude_index_of_ozone_forcing_for_interpolation
+  long_name = interpolation high index for ozone
+  units = index
+  dimensions = (horizontal_dimension)
+  type = integer
+  intent = inout
+[ddy]
+  standard_name = latitude_interpolation_weight_for_ozone_forcing
+  long_name = interpolation high index for ozone
+  units = none
+  dimensions = (horizontal_dimension)
+  type = real
+  kind = kind_phys
+  intent = inout
+[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
+
+########################################################################
+[ccpp-arg-table]
+  name = ozphys_time_vary_timestep_init
+  type = scheme
+[nPts]
+  standard_name = horizontal_dimension
+  long_name = horizontal dimension
+  units = count
+  dimensions = ()
+  type = integer
+  intent = in
+[idate]
+  standard_name = date_and_time_at_model_initialization_in_united_states_order
+  long_name = initial date with different size and ordering
+  units = none
+  dimensions = (4)
+  type = integer
+  intent = in
+[fhour]
+  standard_name = forecast_time
+  long_name = current forecast time
+  units = h
+  dimensions = ()
+  type = real
+  kind = kind_phys
+  intent = in
+[jindx1]
+  standard_name = lower_latitude_index_of_ozone_forcing_for_interpolation
+  long_name = interpolation low index for ozone
+  units = index
+  dimensions = (horizontal_dimension)
+  type = integer
+  intent = in
+[jindx2]
+  standard_name = upper_latitude_index_of_ozone_forcing_for_interpolation
+  long_name = interpolation high index for ozone
+  units = index
+  dimensions = (horizontal_dimension)
+  type = integer
+  intent = in
+[latsozp]
+  standard_name = number_of_latitudes_in_ozone_data
+  long_name = number of latitude in ozone data
+  units = count
+  dimensions = ()
+  type = integer
+  intent = in
+[levozp]
+  standard_name = number_of_levels_in_ozone_data
+  long_name = number of levels in ozone data
+  units = count
+  dimensions = ()
+  type = integer
+  intent = in
+[oz_coeff]
+  standard_name = number_of_coefficients_in_ozone_data
+  long_name = number of coefficients in ozone data
+  units = count
+  dimensions = ()
+  type = integer
+  intent = in
+[timeoz]
+  standard_name = number_of_times_in_ozone_data
+  long_name = number of times in ozone data
+  units = count
+  dimensions = ()
+  type = integer
+  intent = in
+[ozplin]
+  standard_name = ozone_data
+  long_name = ozone data
+  units = 1
+  dimensions = (number_of_latitudes_in_ozone_data,number_of_levels_in_ozone_data,number_of_coefficients_in_ozone_data,number_of_times_in_ozone_data)
+  type = real
+  kind = kind_phys
+  intent = in
+[oz_time]
+  standard_name = ozone_data_time
+  long_name = ozone data time
+  units = none
+  dimensions = (13)
+  type = real
+  kind = kind_phys
+  intent = in
+[oz_lat]
+  standard_name = ozone_data_latitude
+  long_name = ozone data latitude
+  units = deg
+  dimensions = (number_of_latitudes_in_ozone_data)
+  type = real
+  kind = kind_phys
+  intent = in
+[ddy]
+  standard_name = latitude_interpolation_weight_for_ozone_forcing
+  long_name = interpolation high index for ozone
+  units = none
+  dimensions = (horizontal_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[oz_data]
+  standard_name = ozone_forcing
+  long_name = ozone forcing data
+  units = mixed
+  dimensions = (horizontal_dimension,number_of_levels_in_ozone_data,number_of_coefficients_in_ozone_data)
+  type = real
+  kind = kind_phys
+  intent = inout
+[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

From 39dccc8e2ade0918f1823b6d7bdb5abb0d101898 Mon Sep 17 00:00:00 2001
From: "Michael Kavulich, Jr" <kavulich@ucar.edu>
Date: Tue, 1 Aug 2023 16:06:29 -0600
Subject: [PATCH 063/115] Various formatting fixes, grammar and wording changes

---
 physics/clm_lake.f90                      |  2 +-
 physics/docs/pdftxt/CLM_LAKE.txt          | 16 ++++++++--------
 physics/docs/pdftxt/CU_GF_deep.txt        | 12 ++++++------
 physics/docs/pdftxt/GFS_NOAHMP.txt        |  2 +-
 physics/docs/pdftxt/GFS_SATMEDMFVDIFQ.txt |  4 ++--
 physics/docs/pdftxt/RUCLSM.txt            |  6 +++---
 physics/docs/pdftxt/WoFS_v0_suite.txt     |  2 +-
 7 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/physics/clm_lake.f90 b/physics/clm_lake.f90
index 1728d28b5..093fb407c 100644
--- a/physics/clm_lake.f90
+++ b/physics/clm_lake.f90
@@ -2746,7 +2746,7 @@ end subroutine SoilThermProp_Lake
     ! DESCRIPTION:
     !> Calculation of the phase change within snow, soil, & lake layers:
     !!\n (1) Check the conditions for which the phase change may take place,
-    !!     i.e., the layer temperature is great than the freezing point
+    !!     i.e., the layer temperature is greater than the freezing point
     !!     and the ice mass is not equal to zero (i.e. melting),       
     !!     or the layer temperature is less than the freezing point    
     !!     and the liquid water mass is greater than the allowable supercooled 
diff --git a/physics/docs/pdftxt/CLM_LAKE.txt b/physics/docs/pdftxt/CLM_LAKE.txt
index d78244cb2..e22b096ec 100644
--- a/physics/docs/pdftxt/CLM_LAKE.txt
+++ b/physics/docs/pdftxt/CLM_LAKE.txt
@@ -3,14 +3,14 @@
 \section des_clmlake  Description
 
 The Community Land Model (CLM) lake model is a multi-level one-dimensional lake model that has been implemented within the operational 3-km HRRR and
-13-km RAP for small lakes (Benjamin et al. (2022) \cite gmd-15-6659-2022). It is the Community Land Model, version 4.5. 
+13-km RAP for small lakes (Benjamin et al. (2022) \cite gmd-15-6659-2022). This implementation is from the Community Land Model version 4.5 (Oleson et al. (2013) \cite Oleson2013). 
 Subin et al. (2012) \cite Subin_2012 describe the  1-d CLM lake model as applied within the Community Earth System
 Model (CESM) as a component of the overall CESM CLM (Lawrence et al. (2019) \cite Lawrence_2019). Gu et al. (2015) \cite Gu2015 
 describe the introduction of the CLM lake model into the WRF model and inital experiments using its 1-d solution for both
 lakes Superior (average depth of 147 m) and Erie (average depth of 19 m).
 
 The atmospheric inputs into the model are temperature, water vapor, horizontal wind components from the lowest atmospheric level
-and short-wave and longwave radiative fluxes. The CLM lake model then provides latent heat and sensible heat fluxes back to the 
+and shortwave and longwave radiative fluxes. The CLM lake model then provides latent heat and sensible heat fluxes back to the 
 atmosphere. It also computes 2-m temperature/moisture, skin temperature, lake temperature, ice fraction, ice thickness, snow water
 equivalent and snow depth. The CLM lake model divides the vertical lake profile into 10 layers driven by wind-driven eddies. The
 thickness of the top layer is fixed to 10-cm and the rest of the lake depth is divided evenly into the other 9 layers. Energy
@@ -23,22 +23,22 @@ Testing of the CLM lake model within RAP/HRRR applications showed computational
 0.1% in run time. The lake/snow variables have to be continuously transfered within the CLM lake model from one forecast to another,
 constrained by the atmospheric data assimilation. The lake-cycling initialization in RAP/HRRR has been effective overall, owing to 
 accurate houly estimates of near-surface temperature, moisture and winds, and shortwave and longwave estimates provided to the 1-d CLM
-lake model every time step (Benjamin et al. (2022) \cite gmd-15-6659-2022). Cycling technique showed improvements over initializing
-lake temperatures from the SST analysis, problematic for small water bodies. The improvements are particularly eminent during transition 
-periods between cold and warm seasons, and in the regions with anomalies in weather conditions. The CLM lake model has the potential 
+lake model every time step (Benjamin et al. (2022) \cite gmd-15-6659-2022). Cycling techniques showed improvements over initializing
+lake temperatures from the SST analysis, which is problematic for small water bodies. The improvements are particularly eminent during transition 
+periods between cold and warm seasons, and in the regions with anomalous weather conditions. The CLM lake model has the potential 
 to improve surface prediction in the vicinity of small lakes.
 
 The CLM lake model requires bathymetry for the lake points in the model domain. Grid points are assigned as lake points when the 
 fraction of lake coverage in the grid cell exceeds 50% and when this point is disconnected from oceans. The lake water mask is 
-therefore binary, set to either 1 or 0. This binary approach for models with higher horizontal resolution, for example, 3-km resolution in 
-in the UFS SRW App, is capable of capturing the effect of lakes on regional heat and moisture fluxes.
+therefore binary, set to either 1 or 0. This binary approach for models with higher horizontal resolution --- for example, 3-km resolution in 
+in the UFS SRW App --- is capable of capturing the effect of lakes on regional heat and moisture fluxes.
 
 Lake depths for the RRFS lake configuration (Fig.1) are assigned from a global dataset provided by Kourzeneva et al.(2012) \cite Kourzeneva_2012,
 this dataset is referred to as GLOBv3 bathymetry in the UFS_UTL.
 
 @image html https://user-images.githubusercontent.com/12705538/250180794-76af93a2-a7ba-4e9a-9478-5657198862b8.png "Figure 1: Lake depths for lakes in the 3-km RRFS domain." width=600
 
-To cold-start the CLM lake model in the UFS SRW App:
+To cold-start the CLM lake model in the UFS weather model:
 - Use the CLM option in the input.nml
 \n  - lkm = 1
 \n  - iopt_lake = 2
diff --git a/physics/docs/pdftxt/CU_GF_deep.txt b/physics/docs/pdftxt/CU_GF_deep.txt
index 3b01a05a4..4b504863d 100644
--- a/physics/docs/pdftxt/CU_GF_deep.txt
+++ b/physics/docs/pdftxt/CU_GF_deep.txt
@@ -17,23 +17,23 @@ a spectrum of plumes within the grid box. Forcing is different for each characte
 from the PDFs. Aerosol dependence (considered experimental and not supported in this release) is implemented through dependence of rain generation and 
 evaporation formulations depending on the cloud concentration nuclei at cloud base (Berry 1968 \cite berry_1968, 
 Jiang et al.(2010) \cite Jiang_2010, and Lee and Feingold (2010) \cite lee_and_feingold_2010 ). Wet scavenging is considered to add a memory impact. GF is able to transport tracers.
-Recently, GPU capabilities and cap suppressing (\p do_cap_suppress) based on radar data assimilation have been added,and they are used only for the RAP suite.
+Recently, GPU capabilities and cap suppressing (\p do_cap_suppress) based on radar data assimilation have been added, and they are used only for the RAP suite.
 
-The impacts of GF scheme in operational RAP/HRRR include:(a)uses mass-flux schemes, which are more physically realistic than (sounding) adjustment schemes;
+The impacts of GF scheme in operational RAP/HRRR include: (a)uses mass-flux schemes, which are more physically realistic than (sounding) adjustment schemes;
 (b)takes parameterization uncertainty into account by allowing parameters from multiple convective schemes which can be perturbed 
-internally or with temporal and spatial correlation patterns; (c)for higher resolutions (less than 10 km), in addition to scale awareness as in Arakawa et al. (2011) \cite Arakawa_2011 GF can transition as grid spacing decreases into a shallow convection scheme; (d)Coupled to the grid scale precipitation and radiation schemes through passing of diagnosed cloud liquid and ice from simulated precipitating convective cloud and shallow convective clouds.
+internally or with temporal and spatial correlation patterns; (c)for higher resolutions (less than 10 km), in addition to scale awareness as in Arakawa et al. (2011) \cite Arakawa_2011 GF can transition as grid spacing decreases into a shallow convection scheme; (d)Coupled to the grid-scale precipitation and radiation schemes through passing of diagnosed cloud liquid and ice from simulated precipitating convective cloud and shallow convective clouds.
 
 \section version_cugf_enh CCPP Physics Updates
 
 \version UFS-SRW v3.0.0
 
-\b The \b Implementation \b of \b GF \b in \b RRFS
+<b>The Implementation of GF in RRFS prototypes</b>
 - Updates for aerosol-awareness (experimental)
 - Scale-awareness is turned off when explicit microphysics is not active anywhere in the column
-- GF completely is turned off at grid points when MYNN produces shallow convection at that point
+- GF is completely turned off at grid points when MYNN produces shallow convection at that point
 - Radar reflectivity considers mass flux PDF as well as whether scale-awareness is turned on at the grid point in equation.
 
-\b The \b implementation \b of \b GF \b in \b HAFS \b is \b undergoing.
+<b>The implementation of GF in HAFS is ongoing.</b>
 
 \section intra_rough_gf Intraphysics Communication
 The GF scheme passes cloud hydrometeors to the grid-scale microphysics scheme (\ref THOMPSON ) through detrainment from each 
diff --git a/physics/docs/pdftxt/GFS_NOAHMP.txt b/physics/docs/pdftxt/GFS_NOAHMP.txt
index 386ae816c..e48b7cafc 100644
--- a/physics/docs/pdftxt/GFS_NOAHMP.txt
+++ b/physics/docs/pdftxt/GFS_NOAHMP.txt
@@ -10,7 +10,7 @@ This implementation of the NoahMP Land Surface Model (LSM) is adapted from the v
 
 \section noahmp_update CCPP Physics Updates
 \version UFS-SRW v3.0.0
-- As part of a larger-scale effort to unify how microphysics outputs (in particular snow) are used in the land models and outputs, an addition option for using the unified frozen precipitation fraction in NoahMP was added
+- As part of a larger-scale effort to unify how microphysics outputs (in particular snow) are used in the land models and outputs, an additional option for using the unified frozen precipitation fraction in NoahMP was added
 - Diagnostic 2-meter temperature and humidity are based on vegetation and bare-ground tiles
 - Bug fixes for GFS-based thermal roughness length scheme
  
diff --git a/physics/docs/pdftxt/GFS_SATMEDMFVDIFQ.txt b/physics/docs/pdftxt/GFS_SATMEDMFVDIFQ.txt
index 3ae1a0234..d5bc9489c 100644
--- a/physics/docs/pdftxt/GFS_SATMEDMFVDIFQ.txt
+++ b/physics/docs/pdftxt/GFS_SATMEDMFVDIFQ.txt
@@ -31,8 +31,8 @@ reduces the mixing length in a strong shear environment such as a hurricane.
 background diffusivity in the inversion layers is reduced as a function of surface
 roughness and green vegetation fraction.
 - To reduce the PBL overgrowth, the PBL updraft overshoot is not only limited by
-bulk Richardson number-based-PBL depth, but the virtual potential temperature at
-top of the surface layer rather than that at the model first layer is also used as
+bulk Richardson number-based PBL depth, but the virtual potential temperature at
+the top of the surface layer rather than that at the model first layer is also used as
 the near-surface virtual potential temperature in the bulk-Richardson number
 computation. This helps to largely suppress the unrealistic widespread popcorn-like precipitation.
 - Updraft entrainment rates for moisture, hydrometeors, and tracers are increased by about 30%.
diff --git a/physics/docs/pdftxt/RUCLSM.txt b/physics/docs/pdftxt/RUCLSM.txt
index a836e7b93..e8212df21 100644
--- a/physics/docs/pdftxt/RUCLSM.txt
+++ b/physics/docs/pdftxt/RUCLSM.txt
@@ -17,7 +17,7 @@ The parameterizations in the RUC LSM describe complicated atmosphere–land surf
 excessive sensitivity to multiple uncertain surface parameters. Nevertheless, the RUC LSM, when coupled with the hourly-assimilating atmospheric model, 
 demonstrated over years of ongoing cycling (Benjamin et al. 2004a,b \cite Benjamin_2004a \cite Benjamin_2004b ; Berbery et al. 1999 \cite Berbery_1999) 
 that it can produce a realistic evolution of hydrologic and time-varying soil fields (i.e., soil moisture and temperature) that cannot be directly 
-observed over large areas, as well as the evolution of snow  cover on the ground surface. This result is possible only if the soil–vegetation–snow 
+observed over large areas, as well as the evolution of snow cover on the ground surface. This result is possible only if the soil–vegetation–snow 
 component of the coupled model, constrained only by atmospheric boundary conditions and the specification of surface characteristics, has sufficient 
 skill to avoid long-term drift.
 
@@ -28,7 +28,7 @@ included in phase 2(d) of the Project for the Intercomparison of Land Surface Pr
 Luo et al. 2003 \cite Luo_2003 ). The RUC LSM was also tested during the Snow Models Intercomparison Project (SnowMIP, SnowMIP2, ESM-SnowMIP), 
 with emphasis on snow parameterizations for both grassland and forest locations in different parts of the world 
 (Etchevers et al. 2002, 2004 \cite Etchevers_2002 \cite Etchevers_2004; Essery et al. 2009 \cite Essery_2009 ; Rutter et al. 2009 \cite Rutter_2009 , 
-Krinner et al. 2018 \cite Krinner_2018 ). The analysis of RUC LSM performance over 10 reference sites in ESM-SnowMIP rated it on the 4th place 
+Krinner et al. 2018 \cite Krinner_2018 ). The analysis of RUC LSM performance over 10 reference sites in ESM-SnowMIP rated it 4th place 
 among the 26 participating models. The results were published in Menard et al.(2021) \cite Menard_2021 and Essery et al. (2020) \cite essery_et_al_2020.
 RUC LSM received high rankings in ESM-SnowMIP experiement in terms of multi-year snow cover and surface temperature simulations
 for several sites located in different parts of the world (Fig.2, Menard et al.2021 \cite Menard_2021).
@@ -61,7 +61,7 @@ specifying surface
 parameters for the dominant soil and land-use category in the grid box, RUC LSM has an option to take into account the sub-grid scale heterogeneity
 in the computation of such parameters as roughness length, emissivity, soil porosity, soil heat capacity and others. The difference in
 roughness between the mosaic and dominant category presented on Figure 3, is positive from contribution of the forests, which helped to 
-reduce high biases of surface wind speeds in these regions. In the cropland regions, roughness lenghth has also a seasonal variability depending on the growing phase of the plants. This again helped to improve the wind forecasts during the warm season.
+reduce high biases of surface wind speeds in these regions. In cropland regions, roughness length also has a seasonal variability depending on the growing phase of the plants. This again helped to improve the wind forecasts during the warm season.
 Turning on sub-grid-scale heterogeneity option requries: \p mosaic_lu = 1 and \p mosaic_soil = 1 in the namelist, and fractions of soil and vegetation types in a grid cell.
 \image html  ruc_lsm_heterogeneity.png "Figure 3:  sub-grid scale heterogeneity of surface parameters in RUC LSM (Courtesy of T.G. Smirnova)" width=900
 
diff --git a/physics/docs/pdftxt/WoFS_v0_suite.txt b/physics/docs/pdftxt/WoFS_v0_suite.txt
index 4561109fa..385ad7b7d 100644
--- a/physics/docs/pdftxt/WoFS_v0_suite.txt
+++ b/physics/docs/pdftxt/WoFS_v0_suite.txt
@@ -5,7 +5,7 @@
 
 The WoFS_v0 suite is targeted for use in the upcoming operational implementation
 of the NOAA's Warn-on-Forecast System (WoFS) and for the RRFS ensemble. 
-This suite is most applicable for runs at 3-km resolution since it does 
+This suite is most applicable for runs at 3-km resolution and higher since it does 
 not parameterize deep convection.
 
 The WoFS suite uses the parameterizations in the following order:

From 6b12f193deb43fc42915b85a731564f716fcf03b Mon Sep 17 00:00:00 2001
From: "Michael Kavulich, Jr" <kavulich@ucar.edu>
Date: Tue, 1 Aug 2023 16:16:15 -0600
Subject: [PATCH 064/115] Less ambiguous wording regarding resolution

---
 physics/docs/pdftxt/WoFS_v0_suite.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/physics/docs/pdftxt/WoFS_v0_suite.txt b/physics/docs/pdftxt/WoFS_v0_suite.txt
index 385ad7b7d..788c98323 100644
--- a/physics/docs/pdftxt/WoFS_v0_suite.txt
+++ b/physics/docs/pdftxt/WoFS_v0_suite.txt
@@ -5,7 +5,7 @@
 
 The WoFS_v0 suite is targeted for use in the upcoming operational implementation
 of the NOAA's Warn-on-Forecast System (WoFS) and for the RRFS ensemble. 
-This suite is most applicable for runs at 3-km resolution and higher since it does 
+This suite is most applicable for runs at <=3-km resolution and higher since it does 
 not parameterize deep convection.
 
 The WoFS suite uses the parameterizations in the following order:

From 6884732dc149a496e53354079f2d931fb7b265f1 Mon Sep 17 00:00:00 2001
From: "Michael Kavulich, Jr" <kavulich@ucar.edu>
Date: Tue, 1 Aug 2023 16:18:41 -0600
Subject: [PATCH 065/115] *actually* fix ambiguous wording

---
 physics/docs/pdftxt/WoFS_v0_suite.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/physics/docs/pdftxt/WoFS_v0_suite.txt b/physics/docs/pdftxt/WoFS_v0_suite.txt
index 788c98323..bf868a461 100644
--- a/physics/docs/pdftxt/WoFS_v0_suite.txt
+++ b/physics/docs/pdftxt/WoFS_v0_suite.txt
@@ -4,8 +4,8 @@
 \section wofs_v0_suite_overview Overview
 
 The WoFS_v0 suite is targeted for use in the upcoming operational implementation
-of the NOAA's Warn-on-Forecast System (WoFS) and for the RRFS ensemble. 
-This suite is most applicable for runs at <=3-km resolution and higher since it does 
+of the NOAA's Warn-on-Forecast System (WoFS) and for the RRFS ensemble.
+This suite is most applicable for runs at <= 3-km resolution since it does
 not parameterize deep convection.
 
 The WoFS suite uses the parameterizations in the following order:

From 0bfac2ac51d8c460b84cc49fd5240407bcaea6ba Mon Sep 17 00:00:00 2001
From: Dustin Swales <dustin.swales@noaa.gov>
Date: Wed, 2 Aug 2023 17:03:36 +0000
Subject: [PATCH 066/115] Some cleanup. Now working

---
 physics/GFS_rrtmg_pre.F90     |  2 +-
 physics/ozphys_2015.F90       | 52 +++++++++++++++++++++++++++++++----
 physics/ozphys_2015.meta      | 34 +++++++++++++++++++++++
 physics/ozphys_time_vary.F90  | 22 ++++-----------
 physics/ozphys_time_vary.meta |  7 -----
 5 files changed, 87 insertions(+), 30 deletions(-)

diff --git a/physics/GFS_rrtmg_pre.F90 b/physics/GFS_rrtmg_pre.F90
index 4a2c3b290..f2183919f 100644
--- a/physics/GFS_rrtmg_pre.F90
+++ b/physics/GFS_rrtmg_pre.F90
@@ -44,7 +44,7 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp, lextop,&
         gasvmr_o2, gasvmr_co, gasvmr_cfc11, gasvmr_cfc12, gasvmr_cfc22,        &
         gasvmr_ccl4,  gasvmr_cfc113, aerodp,ext550, clouds6, clouds7, clouds8, &
         clouds9, cldsa, cldfra, cldfra2d, lwp_ex,iwp_ex, lwp_fc,iwp_fc,        &
-        faersw1, faersw2, faersw3, faerlw1, faerlw2, faerlw3, alpha, rrfs_sd   &
+        faersw1, faersw2, faersw3, faerlw1, faerlw2, faerlw3, alpha, rrfs_sd,  &
         aero_dir_fdb, fdb_coef, spp_wts_rad, spp_rad, ico2, latsozc, levozc,   &
         blatc, dphiozc, errmsg, errflg)
 
diff --git a/physics/ozphys_2015.F90 b/physics/ozphys_2015.F90
index 82ade0cbd..110ba02e2 100644
--- a/physics/ozphys_2015.F90
+++ b/physics/ozphys_2015.F90
@@ -5,7 +5,7 @@
 module ozphys_2015
   use machine, only : kind_phys, kind_dbl_prec, kind_sngl_prec
   implicit none
-  public ozphys_2015_run
+  public ozphys_2015_init, ozphys_2015_run
 contains
 
 ! ###########################################################################################
@@ -17,8 +17,6 @@ module ozphys_2015
 !! \c ozprdlos_2015_new_sbuvO3_tclm15_nuchem.f77) provided by Naval
 !! Research Laboratory through CHEM2D chemistry model
 !! (McCormack et al. (2006) \cite mccormack_et_al_2006).
-!! \section arg_table_ozphys_2015_run Argument Table
-!! \htmlinclude ozphys_2015_run.html
 !!
 !> \section genal_ozphys_2015 GFS ozphys_2015_run General Algorithm
 !> -  This code assumes that both prsl and po3 are from bottom to top
@@ -28,13 +26,50 @@ module ozphys_2015
 !!\author   June 2015 - Shrinivas Moorthi
 !!\modified May  2023 - Dustin Swales
 ! ###########################################################################################
-  subroutine ozphys_2015_run ( im, levs, ko3, dt, oz, tin, po3, prsl, oz_data, pl_coeff,    &
-       delp, ldiag3d, dtend, dtidx, ntoz, index_of_process_prod_loss,                       &
+
+! ###########################################################################################
+! SUBROUTINE ozphys_2015_init
+! ###########################################################################################
+!! \section arg_table_ozphys_2015_init Argument Table
+!! \htmlinclude ozphys_2015_init.html
+!!
+  subroutine ozphys_2015_init(oz_phys, errmsg, errflg)
+    ! Inputs
+    logical, intent(in) :: &
+         oz_phys
+    ! Outputs
+    character(len=*), intent(out) :: &
+         errmsg
+    integer, intent(out) :: &
+         errflg
+
+    ! Initialize CCPP error handling variables
+    errmsg = ''
+    errflg = 0
+
+    ! Sanity check
+    if (.not.oz_phys) then
+       write (errmsg,'(*(a))') 'Logic error: oz_phys_2015 == .false.'
+       errflg = 1
+       return
+    endif
+
+  end subroutine ozphys_2015_init
+
+! ###########################################################################################
+! SUBROUTINE ozphys_2015_run
+! ###########################################################################################
+!! \section arg_table_ozphys_2015_run Argument Table
+!! \htmlinclude ozphys_2015_run.html
+!!
+  subroutine ozphys_2015_run (oz_phys, im, levs, ko3, dt, oz, tin, po3, prsl, oz_data,      &
+       pl_coeff, delp, ldiag3d, dtend, dtidx, ntoz, index_of_process_prod_loss,             &
        index_of_process_ozmix, index_of_process_temp, index_of_process_overhead_ozone,      &
        con_g, errmsg, errflg)
 
     ! Inputs
     logical, intent(in) :: &
+         oz_phys,                      & !
          ldiag3d                         ! Flag to output GFS diagnostic tendencies
     real(kind_phys),intent(in) :: &
          con_g                           ! Physical constant: Gravitational acceleration (ms-2)
@@ -88,6 +123,13 @@ subroutine ozphys_2015_run ( im, levs, ko3, dt, oz, tin, po3, prsl, oz_data, pl_
     errmsg = ''
     errflg = 0
 
+    ! Sanity checkt
+    if (.not.oz_phys) then
+       write (errmsg,'(*(a))') 'Logic error: oz_phys_2015 == .false.'
+       errflg = 1
+       return
+    endif
+
     ! Are UFS diagnostic tendencies requested? If so, set up bookeeping indices...
     if(ldiag3d) then
        idtend(1) = dtidx(100+ntoz,index_of_process_prod_loss)          ! was ozp1
diff --git a/physics/ozphys_2015.meta b/physics/ozphys_2015.meta
index ea82defaa..4b19f2c04 100644
--- a/physics/ozphys_2015.meta
+++ b/physics/ozphys_2015.meta
@@ -3,10 +3,44 @@
   type = scheme
   dependencies = machine.F
 
+########################################################################
+[ccpp-arg-table]
+  name = ozphys_2015_init
+  type = scheme
+[oz_phys]
+  standard_name = flag_for_nrl_2015_ozone_scheme
+  long_name = flag for new (2015) ozone physics
+  units = flag
+  dimensions = ()
+  type = logical
+  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
+
 ########################################################################
 [ccpp-arg-table]
   name = ozphys_2015_run
   type = scheme
+[oz_phys]
+  standard_name = flag_for_nrl_2015_ozone_scheme
+  long_name = flag for new (2015) ozone physics
+  units = flag
+  dimensions = ()
+  type = logical
+  intent = in
 [im]
   standard_name = horizontal_loop_extent
   long_name = horizontal loop extent
diff --git a/physics/ozphys_time_vary.F90 b/physics/ozphys_time_vary.F90
index 5b36f88b9..a0a778c36 100644
--- a/physics/ozphys_time_vary.F90
+++ b/physics/ozphys_time_vary.F90
@@ -9,18 +9,16 @@ module ozphys_time_vary
 contains
 
 ! ###########################################################################################
-!>\defgroup GFS Ozone Photochemistry (2015) Module
-!! This module contains the CCPP-compliant Ozone 2015 photochemistry scheme.
+!>\defgroup GFS Ozone Data Module
+!! This module updates the ozone data used by physics.
 !> @{
 !> \section arg_table_ozphys_time_vary_init Argument Table
 !! \htmlinclude ozphys_time_vary_init.html
 !!
 ! ###########################################################################################
-  subroutine ozphys_time_vary_init(oz_phys, nPts, latsozp, oz_lat, dlat, jindx1, jindx2,    &
+  subroutine ozphys_time_vary_init(nPts, latsozp, oz_lat, dlat, jindx1, jindx2,    &
        ddy, errmsg, errflg)
     ! Inputs
-    logical, intent(in) :: &
-         oz_phys      ! Control flag for NRL ozone scheme
     integer, intent(in) :: &
          nPts,      & ! Horizontal dimension
          latsozp      ! Number of latitudes in ozone data
@@ -44,13 +42,6 @@ subroutine ozphys_time_vary_init(oz_phys, nPts, latsozp, oz_lat, dlat, jindx1, j
     ! Initialize CCPP error handling variables
     errmsg = ''
     errflg = 0
-    
-    ! Sanity check
-    if (.not.oz_phys) then
-       write (errmsg,'(*(a))') 'Logic error: oz_phys == .false.'
-       errflg = 1
-       return
-    endif
 
     ! Set indices
     do j=1,nPts
@@ -111,10 +102,8 @@ subroutine ozphys_time_vary_timestep_init(nPts, idate, fhour, jindx1, jindx2, la
     integer :: idat(8),jdat(8),iday,j,j1,j2,l,nc,n1,n2,jdow,jdoy,&
          jday,w3kindreal,w3kindint
     real(kind_phys) :: tem, tx1, tx2, rjday
-    real(8) :: rinc(5)
-    real(4) :: rinc4(5)
-    !real(kind_dbl_prec) :: rinc(5)
-    !real(kind_sngl_prec) :: rinc4(5)
+    real(kind_dbl_prec) :: rinc(5)
+    real(kind_sngl_prec) :: rinc4(5)
 
     ! Initialize CCPP error handling variables
     errmsg = ''
@@ -169,7 +158,6 @@ subroutine ozphys_time_vary_timestep_init(nPts, idate, fhour, jindx1, jindx2, la
        enddo
     enddo
 
-    !
     return
 
   end subroutine ozphys_time_vary_timestep_init
diff --git a/physics/ozphys_time_vary.meta b/physics/ozphys_time_vary.meta
index 93aa4a3b0..75b8b8e4f 100644
--- a/physics/ozphys_time_vary.meta
+++ b/physics/ozphys_time_vary.meta
@@ -21,13 +21,6 @@
   dimensions = ()
   type = integer
   intent = in
-[oz_phys]
-  standard_name = flag_for_nrl_2015_ozone_scheme
-  long_name = flag for new (2015) ozone physics
-  units = flag
-  dimensions = ()
-  type = logical
-  intent = in
 [oz_lat]
   standard_name = ozone_data_latitude
   long_name = ozone data latitude

From 724c20ff7d71ed26899642a810e84b294482cc7f Mon Sep 17 00:00:00 2001
From: "Michael Kavulich, Jr" <kavulich@ucar.edu>
Date: Thu, 3 Aug 2023 16:39:29 -0600
Subject: [PATCH 067/115] Weiwei's suggested changes

---
 physics/docs/pdftxt/CLM_LAKE.txt   |  3 ++-
 physics/docs/pdftxt/CU_GF_deep.txt | 16 ++++------------
 2 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/physics/docs/pdftxt/CLM_LAKE.txt b/physics/docs/pdftxt/CLM_LAKE.txt
index e22b096ec..f80e55b25 100644
--- a/physics/docs/pdftxt/CLM_LAKE.txt
+++ b/physics/docs/pdftxt/CLM_LAKE.txt
@@ -38,7 +38,8 @@ this dataset is referred to as GLOBv3 bathymetry in the UFS_UTL.
 
 @image html https://user-images.githubusercontent.com/12705538/250180794-76af93a2-a7ba-4e9a-9478-5657198862b8.png "Figure 1: Lake depths for lakes in the 3-km RRFS domain." width=600
 
-To cold-start the CLM lake model in the UFS weather model:
+To cold-start the CLM lake model in regional configurations of the UFS:
+
 - Use the CLM option in the input.nml
 \n  - lkm = 1
 \n  - iopt_lake = 2
diff --git a/physics/docs/pdftxt/CU_GF_deep.txt b/physics/docs/pdftxt/CU_GF_deep.txt
index 4b504863d..412dab5f0 100644
--- a/physics/docs/pdftxt/CU_GF_deep.txt
+++ b/physics/docs/pdftxt/CU_GF_deep.txt
@@ -6,18 +6,10 @@ The Grell-Freitas (GF) scheme, as described in Grell and Freitas (2014) \cite gr
 Freitas et al. (2018) \cite freitas_et_al_2018, Freitas et al. (2021) \cite freitas_et_al_2021, and Lin et al. (2022) \cite Lin_2022
 follows the mass flux approach published by Grell (1993) \cite grell_1993.
 Further developments by Grell and \f$D\acute{e}v\acute{e}nyi\f$ (2002) \cite Grell_2002 included implementing 
-stochastics through allowing parameter perturbations. The GF scheme takes into account aerosol dependence through rain generation (following
-Berry (1968) \cite berry_1968 and evaporation formulations (following Jiang et al. (2010) \cite Jiang_2010 ), depending on the 
-cloud concentration nuclei at cloud base were added. The GF scheme includes mixed phase physics impact, momentum transport,
- a diurnal cycle closure (Bechtold et al. (2014) \cite bechtold_et_al_2014 ), and a trimodal spectral size to simulate the interaction
-and transition from shallow, congestus and deep convection regimes. The vertical mass flux distribution of shallow, congestus and
-deep convection regimes is characterized by Probability Density Functions (PDFs). The three PDFs are meant to represent the average
-statistical mass flux characteristic of deep, congestus, and shallow (respectively) plumes in the grid area. Each PDF therefore represents
-a spectrum of plumes within the grid box. Forcing is different for each characteristic type. Entrainment and detrainment are derived 
-from the PDFs. Aerosol dependence (considered experimental and not supported in this release) is implemented through dependence of rain generation and 
-evaporation formulations depending on the cloud concentration nuclei at cloud base (Berry 1968 \cite berry_1968, 
-Jiang et al.(2010) \cite Jiang_2010, and Lee and Feingold (2010) \cite lee_and_feingold_2010 ). Wet scavenging is considered to add a memory impact. GF is able to transport tracers.
-Recently, GPU capabilities and cap suppressing (\p do_cap_suppress) based on radar data assimilation have been added, and they are used only for the RAP suite.
+stochastics through allowing parameter perturbations.
+The GF scheme includes mixed phase physics impact, momentum transport, a diurnal cycle closure (Bechtold et al. (2014) \cite bechtold_et_al_2014 ), and a trimodal spectral size to simulate the interaction and transition from shallow, congestus and deep convection regimes.
+The vertical mass flux distribution of shallow, congestus and deep convection regimes is characterized by Probability Density Functions (PDFs). The three PDFs are meant to represent the average statistical mass flux characteristic of deep, congestus, and shallow (respectively) plumes in the grid area. Each PDF therefore represents a spectrum of plumes within the grid box. Forcing is different for each characteristic type. Entrainment and detrainment are derived from the PDFs. 
+The GF scheme takes into account aerosol dependence (considered experimental and not supported in this release), which is implemented through rain generation (following Berry (1968) \cite berry_1968 and evaporation formulations depending on the cloud concentration nuclei at cloud base (Jiang et al. (2010) \cite Jiang_2010, and Lee and Feingold (2010) \cite lee_and_feingold_2010). Wet scavenging is considered to add a memory impact. GF is able to transport tracers. Recently, GPU capabilities and cap suppressing (\p do_cap_suppress) based on radar data assimilation have been added, and they are used only for the RAP suite.
 
 The impacts of GF scheme in operational RAP/HRRR include: (a)uses mass-flux schemes, which are more physically realistic than (sounding) adjustment schemes;
 (b)takes parameterization uncertainty into account by allowing parameters from multiple convective schemes which can be perturbed 

From bea77c8dd21b60b8af7603e494aed45abcccec40 Mon Sep 17 00:00:00 2001
From: Dustin Swales <dustin.swales@noaa.gov>
Date: Thu, 10 Aug 2023 17:32:59 +0000
Subject: [PATCH 068/115] More reorganization.

---
 physics/GFS_physics_diagnostics.F90  |  97 +++++++++++++++++++
 physics/GFS_physics_diagnostics.meta | 140 +++++++++++++++++++++++++++
 physics/ozphys_2015.F90              |  80 ++++++---------
 physics/ozphys_2015.meta             |  91 +++++++----------
 physics/ozphys_time_vary.F90         |   4 +-
 physics/physcons.F90                 |   1 +
 6 files changed, 300 insertions(+), 113 deletions(-)
 create mode 100644 physics/GFS_physics_diagnostics.F90
 create mode 100644 physics/GFS_physics_diagnostics.meta

diff --git a/physics/GFS_physics_diagnostics.F90 b/physics/GFS_physics_diagnostics.F90
new file mode 100644
index 000000000..0c6197bc2
--- /dev/null
+++ b/physics/GFS_physics_diagnostics.F90
@@ -0,0 +1,97 @@
+! ###########################################################################################
+!> \file GFS_physics_diagnostics.F90
+!!
+! ###########################################################################################
+module GFS_physics_diagnostics
+  use machine, only : kind_phys, kind_dbl_prec, kind_sngl_prec
+  implicit none
+  public GFS_physics_diagnostics_init, GFS_physics_diagnostics_run
+contains
+
+! ########################################################################################### 
+! SUBROUTINE GFS_physics_diagnostics_init
+! ###########################################################################################
+!! \section arg_table_GFS_physics_diagnostics_init Argument Table
+!! \htmlinclude GFS_physics_diagnostics_init.html
+!!
+  subroutine GFS_physics_diagnostics_init(errmsg, errflg)
+
+    ! Outputs
+    character(len=*), intent(out) :: &
+         errmsg         ! CCPP error message
+    integer, intent(out) :: &
+         errflg         ! CCPP error flag
+
+  end subroutine GFS_physics_diagnostics_init
+
+! ###########################################################################################
+! SUBROUTINE GFS_physics_diagnostics_run
+! ###########################################################################################
+!! \section arg_table_GFS_physics_diagnostics_run Argument Table
+!! \htmlinclude GFS_physics_diagnostics_run.html
+!!
+  subroutine GFS_physics_diagnostics_run(nCol, nLev, ntoz, dtidx, ip_prod_loss, ip_ozmix,   &
+       ip_temp, ip_overhead_ozone, do3_dt_prd, do3_dt_ozmx, do3_dt_temp, do3_dt_ohoz, dtend,&
+       errmsg, errflg)
+    ! Inputs
+    integer, intent(in) :: &
+         nCol,           & ! Horizontal dimension
+         nLev,           & ! Number of vertical layers
+         ntoz,           & ! Index for ozone mixing ratio
+         ip_prod_loss,   & ! Index for process in diagnostic tendency output
+         ip_ozmix,       & ! Index for process in diagnostic tendency output
+         ip_temp,        & ! Index for process in diagnostic tendency output
+         ip_overhead_ozone ! Index for process in diagnostic tendency output    
+    integer, intent(in), dimension(:,:) :: &
+         dtidx             ! Bookkeeping indices for GFS diagnostic tendencies
+
+    ! Inputs (optional)
+    real(kind=kind_phys), intent(in), dimension(:,:), pointer, optional :: &
+         do3_dt_prd,  & ! Physics tendency: production and loss effect
+         do3_dt_ozmx, & ! Physics tendency: ozone mixing ratio effect
+         do3_dt_temp, & ! Physics tendency: temperature effect
+         do3_dt_ohoz    ! Physics tendency: overhead ozone effect
+
+    ! Outputs
+    real(kind=kind_phys), intent(inout), dimension(:,:,:) :: &
+         dtend          ! Diagnostic tendencies for state variables
+    character(len=*), intent(out) :: &
+         errmsg         ! CCPP error message
+    integer, intent(out) :: &
+         errflg         ! CCPP error flag
+
+    ! Locals
+    integer :: idtend
+    
+    ! Initialize CCPP error handling variables
+    errmsg = ''
+    errflg = 0
+
+    ! #######################################################################################
+    !
+    ! Ozone physics diagnostics
+    !
+    ! #######################################################################################
+    idtend = dtidx(100+ntoz,ip_prod_loss)
+    if (idtend >= 1 .and. associated(do3_dt_prd)) then  
+       dtend(:,:,idtend) = dtend(:,:,idtend) + do3_dt_prd
+    endif
+    !
+    idtend = dtidx(100+ntoz,ip_ozmix)
+    if (idtend >= 1 .and. associated(do3_dt_ozmx)) then
+       dtend(:,:,idtend) = dtend(:,:,idtend) + do3_dt_ozmx
+    endif
+    !
+    idtend = dtidx(100+ntoz,ip_temp)
+    if (idtend >= 1 .and. associated(do3_dt_temp)) then
+       dtend(:,:,idtend) = dtend(:,:,idtend) + do3_dt_temp
+    endif
+    !
+    idtend = dtidx(100+ntoz,ip_overhead_ozone)
+    if (idtend >= 1 .and. associated(do3_dt_ohoz)) then
+       dtend(:,:,idtend) = dtend(:,:,idtend) + do3_dt_ohoz
+    endif
+
+  end subroutine GFS_physics_diagnostics_run
+
+end module GFS_physics_diagnostics
diff --git a/physics/GFS_physics_diagnostics.meta b/physics/GFS_physics_diagnostics.meta
new file mode 100644
index 000000000..b6036b0c9
--- /dev/null
+++ b/physics/GFS_physics_diagnostics.meta
@@ -0,0 +1,140 @@
+[ccpp-table-properties]
+  name = GFS_physics_diagnostics
+  type = scheme
+  dependencies = machine.F
+
+########################################################################
+[ccpp-arg-table]
+  name = GFS_physics_diagnostics_init
+  type = scheme
+[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
+
+########################################################################
+[ccpp-arg-table]
+  name = GFS_physics_diagnostics_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 layers
+  units = count
+  dimensions = ()
+  type = integer
+  intent = in
+[dtend]
+  standard_name = cumulative_change_of_state_variables
+  long_name = diagnostic tendencies for state variables
+  units = mixed
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension,cumulative_change_of_state_variables_outer_index_max)
+  type = real
+  kind = kind_phys
+  intent = inout
+[dtidx]
+  standard_name = cumulative_change_of_state_variables_outer_index
+  long_name = index of state-variable and process in last dimension of diagnostic tendencies array AKA cumulative_change_index
+  units = index
+  dimensions = (number_of_tracers_plus_one_hundred,number_of_cumulative_change_processes)
+  type = integer
+  intent = in
+[ntoz]
+  standard_name = index_of_ozone_mixing_ratio_in_tracer_concentration_array
+  long_name = tracer index for ozone mixing ratio
+  units = index
+  dimensions = ()
+  type = integer
+  intent = in
+[ip_prod_loss]
+  standard_name = index_of_production_and_loss_process_in_cumulative_change_index
+  long_name = index of production and loss effect in photochemistry process in second dimension of array cumulative change index
+  units = index
+  dimensions = ()
+  type = integer
+  intent = in
+[ip_ozmix]
+  standard_name = index_of_ozone_mixing_ratio_process_in_cumulative_change_index
+  long_name = index of ozone mixing ratio effect in photochemistry process in second dimension of array cumulative change index
+  units = index
+  dimensions = ()
+  type = integer
+  intent = in
+[ip_temp]
+  standard_name = index_of_temperature_process_in_cumulative_change_index
+  long_name = index of temperature effect in photochemistry process in second dimension of array cumulative change index
+  units = index
+  dimensions = ()
+  type = integer
+  intent = in
+[ip_overhead_ozone]
+  standard_name = index_of_overhead_process_in_cumulative_change_index
+  long_name = index of overhead ozone effect in photochemistry process in second dimension of array cumulative change index
+  units = index
+  dimensions = ()
+  type = integer
+  intent = in
+[do3_dt_prd]
+  standard_name = ozone_tendency_due_to_production_and_loss_rate
+  long_name = ozone tendency due to production and loss rate
+  units = kg kg-1 s-1
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[do3_dt_ozmx]
+  standard_name = ozone_tendency_due_to_ozone_mixing_ratio
+  long_name = ozone tendency due to ozone mixing ratio
+  units = kg kg-1 s-1
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[do3_dt_temp]
+  standard_name = ozone_tendency_due_to_temperature
+  long_name = ozone tendency due to temperature
+  units = kg kg-1 s-1
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[do3_dt_ohoz]
+  standard_name = ozone_tendency_due_to_overhead_ozone_column
+  long_name = ozone tendency due to overhead ozone column
+  units = kg kg-1 s-1
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  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
\ No newline at end of file
diff --git a/physics/ozphys_2015.F90 b/physics/ozphys_2015.F90
index 110ba02e2..9898c71e4 100644
--- a/physics/ozphys_2015.F90
+++ b/physics/ozphys_2015.F90
@@ -63,42 +63,35 @@ end subroutine ozphys_2015_init
 !! \htmlinclude ozphys_2015_run.html
 !!
   subroutine ozphys_2015_run (oz_phys, im, levs, ko3, dt, oz, tin, po3, prsl, oz_data,      &
-       pl_coeff, delp, ldiag3d, dtend, dtidx, ntoz, index_of_process_prod_loss,             &
-       index_of_process_ozmix, index_of_process_temp, index_of_process_overhead_ozone,      &
-       con_g, errmsg, errflg)
+       pl_coeff, delp, con_1ovg, do3_dt_prd, do3_dt_ozmx, do3_dt_temp, do3_dt_ohoz, errmsg, errflg)
 
     ! Inputs
     logical, intent(in) :: &
-         oz_phys,                      & !
-         ldiag3d                         ! Flag to output GFS diagnostic tendencies
+         oz_phys        ! Flag for ozone_physics_2015 scheme.
     real(kind_phys),intent(in) :: &
-         con_g                           ! Physical constant: Gravitational acceleration (ms-2)
+         con_1ovg       ! Physical constant: One divided by gravitational acceleration (m-1 s2)
     integer, intent(in) :: &
-         im,                           & ! Horizontal dimension
-         levs,                         & ! Number of vertical layers
-         ko3,                          & ! Number of vertical layers in ozone forcing data
-         pl_coeff,                     & ! Number of coefficients in ozone forcing data
-         ntoz,                         & ! Index for ozone mixing ratio
-         index_of_process_prod_loss,   & ! Index for process in diagnostic tendency output
-         index_of_process_ozmix,       & ! Index for process in diagnostic tendency output
-         index_of_process_temp,        & ! Index for process in diagnostic tendency output
-         index_of_process_overhead_ozone ! Index for process in diagnostic tendency output
-    integer, intent(in), dimension(:,:) :: &
-         dtidx                           ! Bookkeeping indices for GFS diagnostic tendencies
+         im,          & ! Horizontal dimension
+         levs,        & ! Number of vertical layers
+         ko3,         & ! Number of vertical layers in ozone forcing data
+         pl_coeff       ! Number of coefficients in ozone forcing data
     real(kind_phys), intent(in) :: &
-         dt                              ! Physics timestep (seconds)
+         dt             ! Physics timestep (seconds)
     real(kind_phys), intent(in), dimension(:) :: &
-         po3                             ! Natural log of ozone forcing data pressure levels
+         po3            ! Natural log of ozone forcing data pressure levels
     real(kind_phys), intent(in), dimension(:,:) :: &
-         prsl,                         & ! Air-pressure (Pa)
-         tin,                          & ! Temperature of new-state (K)
-         delp                            ! Difference between mid-layer pressures (Pa)
+         prsl,        & ! Air-pressure (Pa)
+         tin,         & ! Temperature of new-state (K)
+         delp           ! Difference between mid-layer pressures (Pa)
     real(kind_phys), intent(in), dimension(:,:,:) :: &
-         oz_data                          ! Ozone forcing data
+         oz_data        ! Ozone forcing data
 
-    ! In/Outs
-    real(kind=kind_phys), intent(inout), dimension(:,:,:) :: &
-         dtend                           ! Diagnostic tendencies for state variables
+    ! Outputs (optional)
+    real(kind=kind_phys), intent(inout), dimension(:,:), pointer, optional :: &
+         do3_dt_prd,  & ! Physics tendency: production and loss effect
+         do3_dt_ozmx, & ! Physics tendency: ozone mixing ratio effect
+         do3_dt_temp, & ! Physics tendency: temperature effect
+         do3_dt_ohoz    ! Physics tendency: overhead ozone effect
 
     ! Outputs
     real(kind=kind_phys), intent(inout), dimension(:,:) :: &
@@ -110,9 +103,7 @@ subroutine ozphys_2015_run (oz_phys, im, levs, ko3, dt, oz, tin, po3, prsl, oz_d
 
     ! Locals
     integer :: k, kmax, kmin, l, i, j
-    integer, dimension(4) :: idtend
     logical, dimension(im) :: flg
-    real :: gravi
     real(kind_phys) :: pmax, pmin, tem, temp
     real(kind_phys), dimension(im) :: wk1, wk2, wk3, ozib
     real(kind_phys), dimension(im,pl_coeff) :: prod
@@ -130,19 +121,8 @@ subroutine ozphys_2015_run (oz_phys, im, levs, ko3, dt, oz, tin, po3, prsl, oz_d
        return
     endif
 
-    ! Are UFS diagnostic tendencies requested? If so, set up bookeeping indices...
-    if(ldiag3d) then
-       idtend(1) = dtidx(100+ntoz,index_of_process_prod_loss)          ! was ozp1
-       idtend(2) = dtidx(100+ntoz,index_of_process_ozmix)              ! was ozp2
-       idtend(3) = dtidx(100+ntoz,index_of_process_temp)               ! was ozp3
-       idtend(4) = dtidx(100+ntoz,index_of_process_overhead_ozone)     ! was ozp4
-    else
-       idtend=0
-    endif
-
     ! Temporaries
     ozi = oz
-    gravi=1.0/con_g
 
     colo3(:,levs+1) = 0.0
     coloz(:,levs+1) = 0.0
@@ -194,8 +174,8 @@ subroutine ozphys_2015_run (oz_phys, im, levs, ko3, dt, oz, tin, po3, prsl, oz_d
           enddo
        enddo
        do i=1,im
-          colo3(i,l) = colo3(i,l+1) + ozi(i,l)  * delp(i,l)*gravi
-          coloz(i,l) = coloz(i,l+1) + prod(i,6) * delp(i,l)*gravi
+          colo3(i,l) = colo3(i,l+1) + ozi(i,l)  * delp(i,l)*con_1ovg
+          coloz(i,l) = coloz(i,l+1) + prod(i,6) * delp(i,l)*con_1ovg
           prod(i,2)  = min(prod(i,2), 0.0)
        enddo
        do i=1,im
@@ -204,18 +184,12 @@ subroutine ozphys_2015_run (oz_phys, im, levs, ko3, dt, oz, tin, po3, prsl, oz_d
                                                        + prod(i,4) * (colo3(i,l)-coloz(i,l))
           oz(i,l) = (ozib(i)  + tem*dt) / (1.0 - prod(i,2)*dt)
        enddo
-       if(idtend(1)>=1) then
-          dtend(:,l,idtend(1)) = dtend(:,l,idtend(1)) + (prod(:,1)-prod(:,2)*prod(:,6))*dt
-       endif
-       if(idtend(2)>=1) then
-          dtend(:,l,idtend(2)) = dtend(:,l,idtend(2)) + (oz(:,l) - ozib(:))
-       endif
-       if(idtend(3)>=1) then
-          dtend(:,l,idtend(3)) = dtend(:,l,idtend(3)) + prod(:,3)*(tin(:,l)-prod(:,5))*dt
-       endif
-       if(idtend(4)>=1) then
-          dtend(:,l,idtend(4)) = dtend(:,l,idtend(4)) + prod(:,4) * (colo3(:,l)-coloz(:,l))*dt
-       endif
+
+       ! Diagnostics (optional)
+       if (associated(do3_dt_prd))  do3_dt_prd(:,l)  = (prod(:,1)-prod(:,2)*prod(:,6))*dt
+       if (associated(do3_dt_ozmx)) do3_dt_ozmx(:,l) = (oz(:,l) - ozib(:))
+       if (associated(do3_dt_temp)) do3_dt_temp(:,l) = prod(:,3)*(tin(:,l)-prod(:,5))*dt
+       if (associated(do3_dt_ohoz)) do3_dt_ohoz(:,l) = prod(:,4) * (colo3(:,l)-coloz(:,l))*dt
     enddo
 
     return
diff --git a/physics/ozphys_2015.meta b/physics/ozphys_2015.meta
index 4b19f2c04..1d8fba74e 100644
--- a/physics/ozphys_2015.meta
+++ b/physics/ozphys_2015.meta
@@ -125,71 +125,46 @@
   type = real
   kind = kind_phys
   intent = in
-[ldiag3d]
-  standard_name = flag_for_diagnostics_3D
-  long_name = flag for calculating 3-D diagnostic fields
-  units = flag
+[con_1ovg]
+  standard_name = one_divided_by_the_gravitational_acceleration
+  long_name = inverse of gravitational acceleration
+  units = s2 m-1
   dimensions = ()
-  type = logical
+  type = real
+  kind = kind_phys
   intent = in
-[dtend]
-  standard_name = cumulative_change_of_state_variables
-  long_name = diagnostic tendencies for state variables
-  units = mixed
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension,cumulative_change_of_state_variables_outer_index_max)
+[do3_dt_prd]
+  standard_name = ozone_tendency_due_to_production_and_loss_rate
+  long_name = ozone tendency due to production and loss rate
+  units = kg kg-1 s-1
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
   type = real
   kind = kind_phys
   intent = inout
-[dtidx]
-  standard_name = cumulative_change_of_state_variables_outer_index
-  long_name = index of state-variable and process in last dimension of diagnostic tendencies array AKA cumulative_change_index
-  units = index
-  dimensions = (number_of_tracers_plus_one_hundred,number_of_cumulative_change_processes)
-  type = integer
-  intent = in
-[ntoz]
-  standard_name = index_of_ozone_mixing_ratio_in_tracer_concentration_array
-  long_name = tracer index for ozone mixing ratio
-  units = index
-  dimensions = ()
-  type = integer
-  intent = in
-[index_of_process_prod_loss]
-  standard_name = index_of_production_and_loss_process_in_cumulative_change_index
-  long_name = index of production and loss effect in photochemistry process in second dimension of array cumulative change index
-  units = index
-  dimensions = ()
-  type = integer
-  intent = in
-[index_of_process_ozmix]
-  standard_name = index_of_ozone_mixing_ratio_process_in_cumulative_change_index
-  long_name = index of ozone mixing ratio effect in photochemistry process in second dimension of array cumulative change index
-  units = index
-  dimensions = ()
-  type = integer
-  intent = in
-[index_of_process_temp]
-  standard_name = index_of_temperature_process_in_cumulative_change_index
-  long_name = index of temperature effect in photochemistry process in second dimension of array cumulative change index
-  units = index
-  dimensions = ()
-  type = integer
-  intent = in
-[index_of_process_overhead_ozone]
-  standard_name = index_of_overhead_process_in_cumulative_change_index
-  long_name = index of overhead ozone effect in photochemistry process in second dimension of array cumulative change index
-  units = index
-  dimensions = ()
-  type = integer
-  intent = in
-[con_g]
-  standard_name = gravitational_acceleration
-  long_name = gravitational acceleration
-  units = m s-2
-  dimensions = ()
+[do3_dt_ozmx]
+  standard_name = ozone_tendency_due_to_ozone_mixing_ratio
+  long_name = ozone tendency due to ozone mixing ratio
+  units = kg kg-1 s-1
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
   type = real
   kind = kind_phys
-  intent = in
+  intent = inout
+[do3_dt_temp]
+  standard_name = ozone_tendency_due_to_temperature
+  long_name = ozone tendency due to temperature
+  units = kg kg-1 s-1
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = inout
+[do3_dt_ohoz]
+  standard_name = ozone_tendency_due_to_overhead_ozone_column
+  long_name = ozone tendency due to overhead ozone column
+  units = kg kg-1 s-1
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = inout
 [errmsg]
   standard_name = ccpp_error_message
   long_name = error message for error handling in CCPP
diff --git a/physics/ozphys_time_vary.F90 b/physics/ozphys_time_vary.F90
index a0a778c36..ddac1dcd4 100644
--- a/physics/ozphys_time_vary.F90
+++ b/physics/ozphys_time_vary.F90
@@ -16,8 +16,8 @@ module ozphys_time_vary
 !! \htmlinclude ozphys_time_vary_init.html
 !!
 ! ###########################################################################################
-  subroutine ozphys_time_vary_init(nPts, latsozp, oz_lat, dlat, jindx1, jindx2,    &
-       ddy, errmsg, errflg)
+  subroutine ozphys_time_vary_init(nPts, latsozp, oz_lat, dlat, jindx1, jindx2, ddy,        &
+       errmsg, errflg)
     ! Inputs
     integer, intent(in) :: &
          nPts,      & ! Horizontal dimension
diff --git a/physics/physcons.F90 b/physics/physcons.F90
index e7ec8fb77..19a03ef20 100644
--- a/physics/physcons.F90
+++ b/physics/physcons.F90
@@ -97,6 +97,7 @@ module physcons
   real(kind=kind_phys),parameter:: con_dldt   =con_cvap-con_cliq
   real(kind=kind_phys),parameter:: con_xpona  =-con_dldt/con_rv
   real(kind=kind_phys),parameter:: con_xponb  =-con_dldt/con_rv+con_hvap/(con_rv*con_ttp)
+  real(kind=kind_phys),parameter:: con_1ovg   = 1._kind_phys/con_g
 
 !> \name Other Physics/Chemistry constants (source: 2002 CODATA)
   real(kind=kind_phys),parameter:: con_c      =2.99792458e+8_kind_phys             !< speed of light (\f$m/s\f$)

From 816f607d78a4e89e79f405865f7dfceee3b225fd Mon Sep 17 00:00:00 2001
From: "Michael Kavulich, Jr" <kavulich@ucar.edu>
Date: Mon, 14 Aug 2023 11:01:43 -0600
Subject: [PATCH 069/115] More fixes from Weiwei

---
 physics/docs/pdftxt/CLM_LAKE.txt             |  2 +-
 physics/docs/pdftxt/CU_GF_deep.txt           |  2 +-
 physics/docs/pdftxt/SRW_all_schemes_list.txt |  2 +-
 physics/docs/pdftxt/SRW_mainpage.txt         | 13 ++++++-------
 physics/docs/pdftxt/THOMPSON.txt             |  4 ++--
 5 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/physics/docs/pdftxt/CLM_LAKE.txt b/physics/docs/pdftxt/CLM_LAKE.txt
index f80e55b25..498797511 100644
--- a/physics/docs/pdftxt/CLM_LAKE.txt
+++ b/physics/docs/pdftxt/CLM_LAKE.txt
@@ -22,7 +22,7 @@ in the lake.
 Testing of the CLM lake model within RAP/HRRR applications showed computational efficiency of the model with no change of even
 0.1% in run time. The lake/snow variables have to be continuously transfered within the CLM lake model from one forecast to another,
 constrained by the atmospheric data assimilation. The lake-cycling initialization in RAP/HRRR has been effective overall, owing to 
-accurate houly estimates of near-surface temperature, moisture and winds, and shortwave and longwave estimates provided to the 1-d CLM
+accurate hourly estimates of near-surface temperature, moisture and winds, and shortwave and longwave estimates provided to the 1-d CLM
 lake model every time step (Benjamin et al. (2022) \cite gmd-15-6659-2022). Cycling techniques showed improvements over initializing
 lake temperatures from the SST analysis, which is problematic for small water bodies. The improvements are particularly eminent during transition 
 periods between cold and warm seasons, and in the regions with anomalous weather conditions. The CLM lake model has the potential 
diff --git a/physics/docs/pdftxt/CU_GF_deep.txt b/physics/docs/pdftxt/CU_GF_deep.txt
index 412dab5f0..ca06666e5 100644
--- a/physics/docs/pdftxt/CU_GF_deep.txt
+++ b/physics/docs/pdftxt/CU_GF_deep.txt
@@ -9,7 +9,7 @@ Further developments by Grell and \f$D\acute{e}v\acute{e}nyi\f$ (2002) \cite Gre
 stochastics through allowing parameter perturbations.
 The GF scheme includes mixed phase physics impact, momentum transport, a diurnal cycle closure (Bechtold et al. (2014) \cite bechtold_et_al_2014 ), and a trimodal spectral size to simulate the interaction and transition from shallow, congestus and deep convection regimes.
 The vertical mass flux distribution of shallow, congestus and deep convection regimes is characterized by Probability Density Functions (PDFs). The three PDFs are meant to represent the average statistical mass flux characteristic of deep, congestus, and shallow (respectively) plumes in the grid area. Each PDF therefore represents a spectrum of plumes within the grid box. Forcing is different for each characteristic type. Entrainment and detrainment are derived from the PDFs. 
-The GF scheme takes into account aerosol dependence (considered experimental and not supported in this release), which is implemented through rain generation (following Berry (1968) \cite berry_1968 and evaporation formulations depending on the cloud concentration nuclei at cloud base (Jiang et al. (2010) \cite Jiang_2010, and Lee and Feingold (2010) \cite lee_and_feingold_2010). Wet scavenging is considered to add a memory impact. GF is able to transport tracers. Recently, GPU capabilities and cap suppressing (\p do_cap_suppress) based on radar data assimilation have been added, and they are used only for the RAP suite.
+The GF scheme takes into account aerosol dependence (considered experimental and not supported in this release), which is implemented through rain generation (following Berry (1968) \cite berry_1968 and evaporation formulations depending on the cloud concentration nuclei at cloud base (Jiang et al. (2010) \cite Jiang_2010), and Lee and Feingold (2010) \cite lee_and_feingold_2010). Wet scavenging is considered to add a memory impact. GF is able to transport tracers. Recently, GPU capabilities and cap suppressing (\p do_cap_suppress) based on radar data assimilation have been added, and they are used only for the RAP suite.
 
 The impacts of GF scheme in operational RAP/HRRR include: (a)uses mass-flux schemes, which are more physically realistic than (sounding) adjustment schemes;
 (b)takes parameterization uncertainty into account by allowing parameters from multiple convective schemes which can be perturbed 
diff --git a/physics/docs/pdftxt/SRW_all_schemes_list.txt b/physics/docs/pdftxt/SRW_all_schemes_list.txt
index 16a1727e6..d9ef65315 100644
--- a/physics/docs/pdftxt/SRW_all_schemes_list.txt
+++ b/physics/docs/pdftxt/SRW_all_schemes_list.txt
@@ -68,7 +68,7 @@ to the parameterization.
 - If the in-core saturation adjustment is used (\p do_sat_adj=.true.), it is invoked at shorter timesteps along with the dynamical solver.
 
 
-The UFS Short Range Weather Application (SRW App) v3.0.0 supports four physicsphysics suites.
+The UFS Short Range Weather Application (SRW App) v3.0.0 supports four physics suites.
 
 Table 1.  Physics suites and primary schemes supported in SRW v3.0.0  
 \tableofcontents
diff --git a/physics/docs/pdftxt/SRW_mainpage.txt b/physics/docs/pdftxt/SRW_mainpage.txt
index 5e854034c..1f756c3ff 100644
--- a/physics/docs/pdftxt/SRW_mainpage.txt
+++ b/physics/docs/pdftxt/SRW_mainpage.txt
@@ -12,13 +12,12 @@ supports suites:
 - \ref WoFS_v0_page
 - \ref rap_suite_page
 
-\attention Here all supported suites are a recent snapshot of 
-<a href="https://github.com/ufs-community/ccpp-physics"> 
-the UFS fork for CCPP </a>. In this regard, GFS_v16 Suite is 
-not the same code as in the operational GFS v16. First of all, the operational GFS_v16 does not use CCPP at all. 
-Secondly, most of physics schemes hosted in CCPP repository have marched ahead since GFS was updated to version 16.0 on 22 March 2021. 
-This implication should be also applied to all other suites: as such, RAP/HRRR suites in this release are 
+\attention <b>Important note:</b><br>All supported suites are a recent snapshot of <a href="https://github.com/ufs-community/ccpp-physics"> 
+the UFS fork for CCPP </a>. In this regard, they may differ substantially from the suites used in operational models. For example, the GFS_v16 Suite is 
+not the same code as in the operational GFS v16. While the suite is nominally the same, using the same schemes as the operational version, most
+of the individual physics schemes hosted in the CCPP repository have changed, including new development and bug fixes compared to the versions included
+in GFS version 16.0, which was released on 22 March 2021. 
+This implication should be also applied to all other suites: RAP/HRRR suites in this release do not correspond directly to the
 the evolving version of the RAP/HRRR physics in operations. 
 
-
 */
diff --git a/physics/docs/pdftxt/THOMPSON.txt b/physics/docs/pdftxt/THOMPSON.txt
index 4ad481887..914a95922 100644
--- a/physics/docs/pdftxt/THOMPSON.txt
+++ b/physics/docs/pdftxt/THOMPSON.txt
@@ -89,8 +89,8 @@ Two namelist variables control the usage of the semi-Lagrangian sedimentation, \
 the upper level and reduce the OLR bias.
 
 - For the non-aerosol option of the scheme, the cloud number concentration is divided into two parts (over land and others). The number 
-concentration over the ocean is reduced to a smaller numer (50/L) from its default (100/L). The purpose is to reduce the bias in surface
-downward shortwave radiative flux off the coastal regional including the Southeast Pacific. 
+concentration over the ocean is reduced to a smaller number (50/L) from its default (100/L). The purpose is to reduce the bias in surface
+downward shortwave radiative flux off the coastal region including the Southeast Pacific. 
 
 \section intra_thompson Intraphysics Communication
 - \ref arg_table_mp_thompson_run

From 9c342a5f5841656629d85589fec5507657a561f7 Mon Sep 17 00:00:00 2001
From: "Timothy S. Sliwinski" <Timothy.S.Sliwinski@noaa.gov>
Date: Tue, 15 Aug 2023 00:23:30 +0000
Subject: [PATCH 070/115] Adding OpenACC statements to accelerate MYNN surface
 scheme performance through GPU offloading

Overview:
---------
With very minimal changes to the original code of the scheme, the MYNN surface scheme has been enhanced with OpenACC statements which introduce the capability for offloading computational execution to OpenACC-supported accelerator devices (e.g. Nvidia GPUs). Since the scheme operates by looping multiple times over independent vertical columns, the overall computational strategy maps well to GPU hardware where multiple iterations of each loop can be run in parallel with SIMD methods. Data movement has been optimized to ensure data transfers from host memory to device memory are limited as data movement is a significant source of latency when performing offloading to accelerator devices. Performance increases on a GPU ranged from a 3.3x slowdown to a 41.9x speedup versus CPU execution (See the Performance section for more information).

MYNN Scheme Code Changes:
-------------------------
A few minor code changes were unavoidable due to certain limitations on what OpenACC is able to execute on the accelerator within kernel and parallel blocks. A complete list of these changes is below:

1. Adding preprocessor directives to disable multiple standard output statements, including those used for debug output. The challenges of these are different depending on the view from the host or accelerator. When run in parallel on the accelerator, these statements are not guaranteed to be presented to the user in-order. Also, in limited cases, these statements would have to output variables that were not transferred to the GPU because they were not necessary for computation, introducing additional transfer overhead to ensure they were present only for these output statements. Further, with hundreds of threads executing at once, the output could be quite large and unwieldy. That said, some of these statements could have been run on the host to alleviate the problems introduced by parallelization on the device. However, this would have necessitated device-to-host transfers of variables to ensure values being output were correct while introducing additional transfer overhead costs to performance. Disabling these for accelerators only seemed the best course of action. These are disabled based on the presence of the __OPENACC compile time variable to ensure these are only disabled when the code is compiled for accelerator usage and does not affect CPU execution.

2. Changing the CCPP errmsg variable declaration on line 349 of module_sf_mynn.F90 to be a fixed 200 length character array. Since this variable is set at times in the middle of accelerator kernel regions, it must be present on the accelerator. However, when defined with "len=*", it is an assumed-size array, which OpenACC does not support on the accelerator. Rather than disable this variable completely, changing it to a fixed length allows it to be transferred to/from the accelerator and used. This change is enforced by preprocessor directives based on the presence of the __OPENACC compile time variable and ensures this change only occurs when the code is compiled for accelerator usage, therefore it does not affect CPU execution.

3. Adding preprocessor directives to "move" return statement on line 1399 of module_sf_mynn.F90 out of the main i-loop and instead execute it at line 2006 if errflg is set to 1. This change is necessary as OpenACC accelerator code cannot execute branching such as this, so this conditional return statement can only be executed by the host. This change is enforced by preprocessor directives based on the presence of the __OPENACC compile time variable and ensures this change only occurs when the code is compiled for accelerator usage, therefore it does not affect CPU execution.

4. Commenting out the zLhux local variable in the zolri function over lines 3671 to 3724. The zLhux variable appears to have been used only to capture values of zolri over multiple iterations, but is never used or passed along after this collection is completed. Since this array would be an assumed-size array based on the value of nmax at runtime, it would have been unsupported by OpenACC. But, since it is unused, the choice was made to simply comment out the variable and all lines related to it, allow the remaining code of the function to executed on the accelerator.

Performance:
------------
Performance testing was performed on a single Nvidia P100 GPU versus a single 10-core Haswell CPU on Hera. Since the MYNN Surface scheme is a serial code, parallelization on the 10-core Haswell was performed using simple data partitioning across the 10 cores using OpenMP threads such that each thread received a near equal amount of data. When data movement was fully optimized for the accelerator -- meaning all CCPP Physics input variables were pre-loaded on the GPU as they would be when the CCPP infrastructure fully supports accelerator offloading -- GPU performance speedups range between 11.8X and 41.8X over the 10-core Haswell when the number of vertical columns (i) was varied between 150k and 750k, respectively.

                 Performance Timings (optimized data movement)

 Columns (i) \  Compute  |      CPU      |     GPU    |    GPU  Speedup   |
---------------------------------------------------------------------------
         150,000         |    263 ms     |    22 ms   |       11.9x       |
---------------------------------------------------------------------------
         450,000         |    766 ms     |    28 ms   |       27.0x       |
---------------------------------------------------------------------------
         750,000         |   1314 ms     |    31 ms   |       41.9x       |
---------------------------------------------------------------------------

However, standalone performance -- meaning all CCPP Physics input variables were initially loaded onto the GPU only after being declared in the MYNN subroutine calls -- was slightly less performant than the 10-core Haswell due to the additional overhead incurred by the data transfers. In this case, the decreasing performance lag for the GPU behind the CPU as the number of columns increases is due to the GPU performing better with more data (i.e. higher computational throughput) than the CPU despite more data needing to be transferred to the device.

                 Performance Timings (standalone)

 Columns (i) \  Compute  |      CPU      |       GPU      |    GPU  Speedup   |
-------------------------------------------------------------------------------
         150,000         |    263 ms     |      862 ms    |       -3.3x       |
-------------------------------------------------------------------------------
         450,000         |    766 ms     |     1767 ms    |       -2.3x       |
-------------------------------------------------------------------------------
         750,000         |   1314 ms     |     2776 ms    |       -2.1x       |
-------------------------------------------------------------------------------

With these results, it is clear that this scheme will perform at its best on accelerators once the CCPP infrastructure also supports OpenACC.

Contact Information:
--------------------
This enhancement was performed by Timothy Sliwinski at NOAA GSL. Questions regarding these changes should be directed to timothy.s.sliwinski@noaa.gov
---
 physics/module_sf_mynn.F90  | 331 ++++++++++++++++++++++++++++++++++--
 physics/mynnsfc_wrapper.F90 |  31 ++++
 2 files changed, 351 insertions(+), 11 deletions(-)

diff --git a/physics/module_sf_mynn.F90 b/physics/module_sf_mynn.F90
index c60247cf6..399b1ee83 100644
--- a/physics/module_sf_mynn.F90
+++ b/physics/module_sf_mynn.F90
@@ -106,6 +106,7 @@ MODULE module_sf_mynn
 
   REAL(kind_phys), DIMENSION(0:1000 ),SAVE :: psim_stab,psim_unstab, &
                                      psih_stab,psih_unstab
+!$acc declare create(psim_stab, psim_unstab, psih_stab, psih_unstab)
 
 CONTAINS
 
@@ -344,7 +345,12 @@ SUBROUTINE SFCLAY_mynn(                           &
      &                     qsfc_wat,  qsfc_lnd,  qsfc_ice
 
 ! CCPP error handling
+#ifndef _OPENACC
       character(len=*), intent(inout) :: errmsg
+#else
+!Necessary since OpenACC does not support assumed-size arrays
+      character(len=200), intent(inout) :: errmsg
+#endif
       integer,          intent(inout) :: errflg
 
 !ADDITIONAL OUTPUT
@@ -371,6 +377,20 @@ SUBROUTINE SFCLAY_mynn(                           &
       errflg = 0
       errmsg = ''
 
+!$acc enter data copyin( dz8w,U3D,V3D,QV3D,QC3D,P3D,T3D,       &
+!$acc                       pattern_spp_sfc, errmsg)
+
+!$acc enter data copyin( UST_WAT(:), UST_LND(:),  UST_ICE(:),     &
+!$acc                    MOL(:),     QFLX(:),     HFLX(:),        &
+!$acc                    QSFC(:),    QSFC_WAT(:), QSFC_LND(:),    &
+!$acc                    QSFC_ICE(:))
+
+!$acc enter data create( dz8w1d(:),  dz2w1d(:),   U1D(:),         &
+!$acc                    V1D(:),     U1D2(:),     V1D2(:),        &
+!$acc                    QV1D(:),    QC1D(:),     P1D(:),         &
+!$acc                    T1D(:),     rstoch1D(:), qstar(:))
+
+
       IF (debug_code >= 1) THEN
         write(*,*)"======= printing of constants:"
         write(*,*)"cp=",    cp," g=",     grav
@@ -382,6 +402,10 @@ SUBROUTINE SFCLAY_mynn(                           &
       itf=ite !MIN0(ite,ide-1)
       ktf=kte !MIN0(kte,kde-1)
 
+!$acc parallel loop present(dz8w,U3D,V3D,QV3D,QC3D,P3D,T3D,       &
+!$acc                       pattern_spp_sfc,dz8w1d,dz2w1d,U1D,    &
+!$acc                       V1D,U1D2,V1D2,QV1D,QC1D,P1D,T1D,      &
+!$acc                       rstoch1D,qstar)
       DO i=its,ite
          dz8w1d(I) = dz8w(i,kts)
          dz2w1d(I) = dz8w(i,kts+1)
@@ -403,6 +427,9 @@ SUBROUTINE SFCLAY_mynn(                           &
       ENDDO
 
       IF (itimestep==1 .AND. iter==1) THEN
+!$acc parallel loop present(U1D,V1D,UST_WAT,UST_LND,UST_ICE,MOL,  &
+!$acc                       QFLX,HFLX,QV3D,QSFC,QSFC_WAT,         &
+!$acc                       QSFC_LND,QSFC_ICE)
          DO i=its,ite
             IF (.not. flag_restart) THEN
                !Everything here is used before calculated
@@ -432,6 +459,9 @@ SUBROUTINE SFCLAY_mynn(                           &
          ENDDO
       ENDIF
 
+!$acc exit data delete( dz8w,U3D,V3D,QV3D,QC3D,P3D,T3D,         &
+!$acc                   pattern_spp_sfc, QC1D)
+
       CALL SFCLAY1D_mynn(flag_iter,                             &
            J,U1D,V1D,T1D,QV1D,P1D,dz8w1d,                       &
            U1D2,V1D2,dz2w1d,                                    &
@@ -471,6 +501,16 @@ SUBROUTINE SFCLAY_mynn(                           &
            its,ite, jts,jte, kts,kte,                           &
            errmsg, errflg                                       )
 
+!$acc exit data copyout( UST_WAT(:), UST_LND(:),  UST_ICE(:),   &
+!$acc                    MOL(:),     QFLX(:),     HFLX(:),      &
+!$acc                    QSFC(:),    QSFC_WAT(:), QSFC_LND(:),  &
+!$acc                    QSFC_ICE(:), errmsg)
+
+!$acc exit data delete( dz8w1d(:),   dz2w1d(:),   U1D(:),       &
+!$acc                   V1D(:),      U1D2(:),     V1D2(:),      &
+!$acc                   QV1D(:),     T1D(:),      P1D(:),       &
+!$acc                   rstoch1D(:), qstar(:))
+
     END SUBROUTINE SFCLAY_MYNN
 
 !-------------------------------------------------------------------
@@ -626,7 +666,12 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
 !JOE-end
 
 ! CCPP error handling
+#ifndef _OPENACC
       character(len=*), intent(inout) :: errmsg
+#else
+! Necessary since OpenACC does not support assumed-size arrays
+      character(len=200), intent(inout) :: errmsg
+#endif
       integer,          intent(inout) :: errflg
 
 !----------------------------------------------------------------
@@ -679,6 +724,58 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
       errflg = 0
       errmsg = ''
 !-------------------------------------------------------------------
+!$acc update device(psim_stab, psim_unstab, psih_stab, psih_unstab)
+
+!$acc enter data create( ZA,     ZA2,    THV1D,  TH1D,   TC1D,   TV1D,  &
+!$acc                    RHO1D,  QVSH,   PSIH2,  PSIM10, PSIH10, WSPDI, &
+!$acc                    GOVRTH, PSFC,   THCON,                         &
+!$acc                    zratio_lnd,   zratio_ice,   zratio_wat,        &
+!$acc                    TSK_lnd,      TSK_ice,      TSK_wat,           &
+!$acc                    THSK_lnd,     THSK_ice,     THSK_wat,          &
+!$acc                    THVSK_lnd,    THVSK_ice,    THVSK_wat,         &
+!$acc                    GZ1OZ0_lnd,   GZ1OZ0_ice,   GZ1OZ0_wat,        &
+!$acc                    GZ1OZt_lnd,   GZ1OZt_ice,   GZ1OZt_wat,        &
+!$acc                    GZ2OZ0_lnd,   GZ2OZ0_ice,   GZ2OZ0_wat,        &
+!$acc                    GZ2OZt_lnd,   GZ2OZt_ice,   GZ2OZt_wat,        &
+!$acc                    GZ10OZ0_lnd,  GZ10OZ0_ice,  GZ10OZ0_wat,       &
+!$acc                    GZ10OZt_lnd,  GZ10OZt_ice,  GZ10OZt_wat,       &
+!$acc                    ZNTstoch_lnd, ZNTstoch_ice, ZNTstoch_wat,      &
+!$acc                    ZT_lnd,       ZT_ice,       ZT_wat,            &
+!$acc                    ZQ_lnd,       ZQ_ice,       ZQ_wat,            &
+!$acc                    PSIQ_lnd,     PSIQ_ice,     PSIQ_wat,          &
+!$acc                    PSIQ2_lnd,    PSIQ2_ice,    PSIQ2_wat,         &
+!$acc                    QSFCMR_lnd,   QSFCMR_ice,   QSFCMR_wat )
+
+!$acc enter data copyin(flag_iter, dry, wet, icy, CPM, MAVAIL, &
+!$acc                   QFX, FLHC, FLQC, CHS, CH, CHS2, CQS2, USTM, &
+!$acc                   HFX, LH, wstar, qstar, PBLH, ZOL, MOL, RMOL, &
+!$acc                   T2, TH2, Q2, QV1D, PSFCPA, &
+!$acc                   WSPD, U10, V10, U1D, V1D, U1D2, V1D2, &
+!$acc                   T1D, P1D, rstoch1D, sigmaf, &
+!$acc                   shdmax, vegtype, z0pert, ztpert, dx, QGH, &
+!$acc                   dz2w1d, dz8w1d, &
+!$acc                   stress_wat, stress_lnd, stress_ice, &
+!$acc                   rb_wat, rb_lnd, rb_ice, &
+!$acc                   tskin_wat, tskin_lnd, tskin_ice, &
+!$acc                   tsurf_wat, tsurf_lnd, tsurf_ice, &
+!$acc                   psim, psih, &
+!$acc                   UST_wat, UST_lnd, UST_ice, &
+!$acc                   ZNT_wat, ZNT_lnd, ZNT_ice, &
+!$acc                   QSFC, QSFC_lnd, QSFC_wat, QSFC_ice, &
+!$acc                   QFLX, QFLX_lnd, QFLX_wat, QFLX_ice, &
+!$acc                   HFLX, HFLX_lnd, HFLX_wat, HFLX_ice, &
+!$acc                   PSIX_wat, PSIX_lnd, PSIX_ice, &
+!$acc                   PSIX10_wat, PSIX10_lnd, PSIX10_ice, &
+!$acc                   PSIT2_lnd, PSIT2_wat, PSIT2_ice, &
+!$acc                   PSIT_lnd, PSIT_wat, PSIT_ice, &
+!$acc                   ch_lnd, ch_wat, ch_ice, &
+!$acc                   cm_lnd, cm_wat, cm_ice, &
+!$acc                   snowh_lnd, errmsg)
+
+!$acc parallel loop present(PSFCPA, PSFC, QSFC, T1D, flag_iter,               &
+!$acc                       QSFC_wat, QSFCMR_wat, wet, TSK_wat, tskin_wat,    &
+!$acc                       QSFC_lnd, QSFCMR_lnd, dry, TSK_lnd, tskin_lnd,    &
+!$acc                       QSFC_ice, QSFCMR_ice, icy, TSK_ice, tskin_ice)
       DO I=its,ite
 
          ! PSFC ( in cmb) is used later in saturation checks
@@ -700,7 +797,9 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
                ENDIF
                QSFC_wat(I)=EP2*E1/(PSFC(I)-ep3*E1)             !specific humidity
                QSFCMR_wat(I)=EP2*E1/(PSFC(I)-E1)                !mixing ratio
+#ifndef _OPENACC
                IF(QSFC_wat(I)>1..or.QSFC_wat(I)<0.) print *,' QSFC_wat(I)',itimestep,i,QSFC_wat(I),TSK_wat(i)
+#endif
             ENDIF
             IF (dry(i)) THEN
               TSK_lnd(I) = tskin_lnd(i)
@@ -720,7 +819,9 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
                  QSFC_lnd(I)=0.5*(QSFC_lnd(I) + QSFC(I))
                  QSFCMR_lnd(I)=QSFC_lnd(I)/(1.-QSFC_lnd(I))       !mixing ratio
               endif ! lsm
+#ifndef _OPENACC
               IF(QSFC_lnd(I)>1..or.QSFC_lnd(I)<0.) print *,' QSFC_lnd(I)',itimestep,i,QSFC_lnd(I),Tskin_lnd(i),tsurf_lnd(i),qsfc(i)
+#endif
             ENDIF
             IF (icy(i)) THEN
               TSK_ice(I) = tskin_ice(i)
@@ -738,7 +839,9 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
                  QSFC_ice(I)=EP2*E1/(PSFC(I)-ep3*E1)             !specific humidity
                  QSFCMR_ice(I)=EP2*E1/(PSFC(I)-E1)                !mixing ratio
               endif ! lsm
+#ifndef _OPENACC
               IF(QSFC_ice(I)>1..or.QSFC_ice(I)<0.) print *,' QSFC_ice(I)',itimestep,i,QSFC_ice(I),TSK_ice(i)
+#endif
             ENDIF
 
          ELSE
@@ -791,6 +894,7 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
        endif ! flag_iter
       ENDDO
 
+#ifndef _OPENACC
       IF (debug_code >= 1) THEN
         write(0,*)"ITIMESTEP=",ITIMESTEP," iter=",iter
         DO I=its,ite
@@ -815,7 +919,12 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
            ENDIF
         ENDDO
       ENDIF
+#endif
 
+!$acc parallel loop present(PSFC, PSFCPA, QVSH, QV1D, THCON, flag_iter,        &
+!$acc       dry, tskin_lnd, TSK_lnd, tsurf_lnd, THSK_lnd, THVSK_lnd, qsfc_lnd, &
+!$acc       icy, tskin_ice, TSK_ice, tsurf_ice, THSK_ice, THVSK_ice, qsfc_ice, &
+!$acc       wet, tskin_wat, TSK_wat, tsurf_wat, THSK_wat, THVSK_wat)
       DO I=its,ite
          ! PSFC ( in cmb) is used later in saturation checks
          PSFC(I)=PSFCPA(I)/1000.
@@ -829,8 +938,10 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
            ! CONVERT SKIN TEMPERATURES TO POTENTIAL TEMPERATURE:
            THSK_lnd(I) = TSK_lnd(I)*THCON(I)   !(K)
            THVSK_lnd(I) = THSK_lnd(I)*(1.+EP1*qsfc_lnd(I))
+#ifndef _OPENACC
            if(THVSK_lnd(I) < 170. .or. THVSK_lnd(I) > 360.) &
            print *,'THVSK_lnd(I)',itimestep,i,THVSK_lnd(I),THSK_lnd(i),tsurf_lnd(i),tskin_lnd(i),qsfc_lnd(i)
+#endif
          endif
          if(icy(i)) then
            TSK_ice(I) = tskin_ice(i)
@@ -838,8 +949,10 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
            ! CONVERT SKIN TEMPERATURES TO POTENTIAL TEMPERATURE:
            THSK_ice(I) = TSK_ice(I)*THCON(I)   !(K)
            THVSK_ice(I) = THSK_ice(I)*(1.+EP1*qsfc_ice(I))   !(K)
+#ifndef _OPENACC
            if(THVSK_ice(I) < 170. .or. THVSK_ice(I) > 360.) &
            print *,'THVSK_ice(I)',itimestep,i,THVSK_ice(I),THSK_ice(i),tsurf_ice(i),tskin_ice(i),qsfc_ice(i)
+#endif
          endif
          if(wet(i)) then
            TSK_wat(I) = tskin_wat(i)
@@ -847,24 +960,29 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
            ! CONVERT SKIN TEMPERATURES TO POTENTIAL TEMPERATURE:
            THSK_wat(I) = TSK_wat(I)*THCON(I)   !(K)
            THVSK_wat(I) = THSK_wat(I)*(1.+EP1*QVSH(I))   !(K)
+#ifndef _OPENACC
            if(THVSK_wat(I) < 170. .or. THVSK_wat(I) > 360.) &
            print *,'THVSK_wat(I)',i,THVSK_wat(I),THSK_wat(i),tsurf_wat(i),tskin_wat(i),qsfc_wat(i)
+#endif
          endif
         endif ! flag_iter
       ENDDO
 
+!$acc parallel loop present(TH1D, T1D, P1D, TC1D)
       DO I=its,ite
          ! CONVERT LOWEST LAYER TEMPERATURE TO POTENTIAL TEMPERATURE:
          TH1D(I)=T1D(I)*(100000./P1D(I))**ROVCP  !(Theta, K)
          TC1D(I)=T1D(I)-273.15                   !(T, Celsius)
       ENDDO
 
+!$acc parallel loop present(THV1D, TH1D, QVSH, TV1D, T1D)
       DO I=its,ite
          ! CONVERT TO VIRTUAL TEMPERATURE
          THV1D(I)=TH1D(I)*(1.+EP1*QVSH(I))             !(K)
          TV1D(I)=T1D(I)*(1.+EP1*QVSH(I))               !(K)
       ENDDO
 
+!$acc parallel loop present(RHO1D, P1D, TV1D, TH1D, ZA, ZA2, dz2w1d, dz8w1d, GOVRTH)
       DO I=its,ite
          RHO1D(I)=P1D(I)/(Rd*TV1D(I))     !now using value calculated in sfc driver
          ZA(I)=0.5*dz8w1d(I)              !height of first half-sigma level
@@ -873,11 +991,13 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
       ENDDO
 
       !tgs - should QFX and HFX be separate for land, ice and water?
+!$acc parallel loop present(QFX, QFLX, RHO1D, HFX, HFLX)
       DO I=its,ite
          QFX(i)=QFLX(i)*RHO1D(I)
          HFX(i)=HFLX(i)*RHO1D(I)*cp
       ENDDO
 
+#ifndef _OPENACC
       IF (debug_code ==2) THEN
         !write(*,*)"ITIMESTEP=",ITIMESTEP
         DO I=its,ite
@@ -890,7 +1010,9 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
           write(*,*)"RHO1D=", RHO1D(i)," GOVRTH=",GOVRTH(i)
         ENDDO
       ENDIF
+#endif
 
+!$acc parallel loop present(T1D,P1D,QGH,QV1D,CPM)
       DO I=its,ite
          ! QGH CHANGED TO USE LOWEST-LEVEL AIR TEMP
          ! Q2SAT = QGH IN LSM
@@ -908,6 +1030,7 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
          CPM(I)=CP*(1.+0.84*QV1D(I))
       ENDDO
 
+#ifndef _OPENACC
       IF (debug_code == 2) THEN
          write(*,*)"ITIMESTEP=",ITIMESTEP
          DO I=its,ite
@@ -925,7 +1048,13 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
             endif
          ENDDO
       ENDIF
+#endif
 
+!$acc parallel loop present(flag_iter,U1D,V1D,WSPD,wet,dry,icy,    &
+!$acc                    THV1D,THVSK_wat,THVSK_lnd,THVSK_ice,   &
+!$acc                    hfx,RHO1D,qfx,WSTAR,pblh,dx,GOVRTH,ZA, &
+!$acc                    TSK_wat,TSK_lnd,TSK_ice,               &
+!$acc                    rb_wat,rb_lnd,rb_ice)
       DO I=its,ite
         if( flag_iter(i) ) then
          ! DH* 20200401 - note. A weird bug in Intel 18 on hera prevents using the
@@ -1041,6 +1170,7 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
          WSPD(I) = MAX(WSPD_ice,WSPD_wat)
          WSPD(I) = MAX(WSPD_lnd,WSPD(I))
 
+#ifndef _OPENACC
          IF (debug_code == 2) THEN
             write(*,*)"===== After rb calc in mynn sfc layer:"
             write(*,*)"ITIMESTEP=",ITIMESTEP
@@ -1049,6 +1179,7 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
             IF (wet(i))write(*,*)"rb_wat=", rb_wat(I)," DTHVDZ=",DTHVDZ
             IF (dry(i))write(*,*)"rb_lnd=", rb_lnd(I)," DTHVDZ=",DTHVDZ
          ENDIF
+#endif
 
          ! IF PREVIOUSLY UNSTABLE, DO NOT LET INTO REGIMES 1 AND 2 (STABLE)
          !if (itimestep .GT. 1) THEN
@@ -1067,6 +1198,29 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
 !--------------------------------------------------------------------
 !--------------------------------------------------------------------
 
+!$acc parallel loop present(flag_iter, errmsg, &
+!$acc                    wet, dry, icy, &
+!$acc                    ZT_wat, ZT_lnd, ZT_ice, &
+!$acc                    ZNT_wat, ZNT_lnd, ZNT_ice, &
+!$acc                    ZNTstoch_wat, ZNTstoch_lnd, ZNTstoch_ice, &
+!$acc                    UST_wat, UST_lnd, UST_ice, &
+!$acc                    ZQ_wat, ZQ_lnd, ZQ_ice, &
+!$acc                    snowh_lnd, &
+!$acc                    THVSK_wat, THVSK_lnd, THVSK_ice, &
+!$acc                    qsfc_wat, qsfc_lnd, qsfc_ice, &
+!$acc                    GZ1OZ0_wat, GZ1OZt_wat, GZ2OZ0_wat, GZ2OZt_wat, GZ10OZ0_wat, GZ10OZt_wat, &
+!$acc                    GZ1OZ0_lnd, GZ1OZt_lnd, GZ2OZ0_lnd, GZ2OZt_lnd, GZ10OZ0_lnd, GZ10OZt_lnd, &
+!$acc                    GZ1OZ0_ice, GZ1OZt_ice, GZ2OZ0_ice, GZ2OZt_ice, GZ10OZ0_ice, GZ10OZt_ice, &
+!$acc                    zratio_wat, zratio_lnd, zratio_ice, &
+!$acc                    stress_wat, stress_lnd, stress_ice, &
+!$acc                    rb_wat, rb_lnd, rb_ice, &
+!$acc                    psim, psih, psim10, psih10, psih2, &
+!$acc                    psix_wat, psix10_wat, psit_wat, psit2_wat, psiq_wat, psiq2_wat, &
+!$acc                    psix_lnd, psix10_lnd, psit_lnd, psit2_lnd, psiq_lnd, psiq2_lnd, &
+!$acc                    psix_ice, psix10_ice, psit_ice, psit2_ice, psiq_ice, psiq2_ice, &
+!$acc                    WSPD, WSPDI, U1D, V1D, TC1D, THV1D, rstoch1D, USTM, ZA, ZOL, QVSH, &
+!$acc                    shdmax, vegtype, z0pert, ztpert, mol, rmol, qstar, sigmaf)
+
  DO I=its,ite
    if( flag_iter(i) ) then
 
@@ -1082,10 +1236,12 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
        if (sfc_z0_type >= 0) then ! Avoid calculation is using wave model
           ! CALCULATE z0 (znt)
           !--------------------------------------
+#ifndef _OPENACC
           IF (debug_code == 2) THEN
             write(*,*)"=============Input to ZNT over water:"
             write(*,*)"u*:",UST_wat(i)," wspd=",WSPD(i)," visc=",visc," za=",ZA(I)
           ENDIF
+#endif
           IF ( PRESENT(ISFTCFLX) ) THEN
              IF ( ISFTCFLX .EQ. 0 ) THEN
                 IF (COARE_OPT .EQ. 3.0) THEN
@@ -1122,10 +1278,12 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
           ZNTstoch_wat(I)  = ZNT_wat(I)
        endif
 
+#ifndef _OPENACC
        IF (debug_code > 1) THEN
           write(*,*)"==========Output ZNT over water:"
           write(*,*)"ZNT:",ZNTstoch_wat(i)
        ENDIF
+#endif
 
        !COMPUTE ROUGHNESS REYNOLDS NUMBER (restar) USING NEW ZNT
        ! AHW: Garrattt formula: Calculate roughness Reynolds number
@@ -1136,10 +1294,12 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
        !--------------------------------------
        !CALCULATE z_t and z_q
        !--------------------------------------
+#ifndef _OPENACC
        IF (debug_code > 1) THEN
           write(*,*)"=============Input to ZT over water:"
           write(*,*)"u*:",UST_wat(i)," restar=",restar," visc=",visc
        ENDIF
+#endif
 
        IF ( PRESENT(ISFTCFLX) ) THEN
           IF ( ISFTCFLX .EQ. 0 ) THEN
@@ -1183,10 +1343,12 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
                                     rstoch1D(i),spp_sfc)
           ENDIF
        ENDIF
+#ifndef _OPENACC
        IF (debug_code > 1) THEN
          write(*,*)"=============Output ZT & ZQ over water:"
          write(*,*)"ZT:",ZT_wat(i)," ZQ:",ZQ_wat(i)
        ENDIF
+#endif
 
        GZ1OZ0_wat(I)= LOG((ZA(I)+ZNTstoch_wat(I))/ZNTstoch_wat(I))
        GZ1OZt_wat(I)= LOG((ZA(I)+ZNTstoch_wat(i))/ZT_wat(i))
@@ -1232,7 +1394,10 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
                 ! or initialized to zero, but certainly not set correctly
                 errmsg = 'Logic error: qstar is not set correctly when calling Yang_2008'
                 errflg = 1
+#ifndef _OPENACC
+! Necessary since OpenACC does not support branching in parallel code
                 return
+#endif
                 CALL Yang_2008(ZNTSTOCH_lnd(i),ZT_lnd(i),ZQ_lnd(i),UST_lnd(i),MOL(I),&
                               qstar(I),restar,visc)
              ELSEIF ( IZ0TLND .EQ. 3 ) THEN
@@ -1249,6 +1414,8 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
                          UST_lnd(I),KARMAN,1.0_kind_phys,0,spp_sfc,rstoch1D(i))
           ENDIF
        ENDIF
+
+#ifndef _OPENACC
        IF (ZNTstoch_lnd(i) < 1E-8 .OR. Zt_lnd(i) < 1E-10) THEN
          write(0,*)"===(land) capture bad input in mynn sfc layer, i=:",i
          write(0,*)" ZNT=", ZNTstoch_lnd(i)," ZT=",Zt_lnd(i)
@@ -1257,7 +1424,7 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
          " ust=", ust_lnd(i)," snowh=", snowh_lnd(i),"psfcpa=",PSFCPA(i), &
          " dz=",dz8w1d(i)," qflx=",qflx_lnd(i)," hflx=",hflx_lnd(i)," hpbl=",pblh(i)
        ENDIF
-
+#endif
 
        GZ1OZ0_lnd(I)= LOG((ZA(I)+ZNTstoch_lnd(I))/ZNTstoch_lnd(I))
        GZ1OZt_lnd(I)= LOG((ZA(I)+ZNTstoch_lnd(i))/ZT_lnd(i))
@@ -1323,6 +1490,7 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
              ZOL(I)=MAX(ZOL(I),0.0_kind_phys)
              ZOL(I)=MIN(ZOL(I),20._kind_phys)
 
+#ifndef _OPENACC
              IF (debug_code >= 1) THEN
                IF (ZNTstoch_wat(i) < 1E-8 .OR. Zt_wat(i) < 1E-10) THEN
                  write(0,*)"===(wet) capture bad input in mynn sfc layer, i=:",i
@@ -1333,6 +1501,7 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
                  " dz=",dz8w1d(i)," qflx=",qflx(i)," hflx=",hflx(i)," hpbl=",pblh(i)
                ENDIF
              ENDIF
+#endif
 
              !Use Pedros iterative function to find z/L
              !zol(I)=zolri(rb_wat(I),ZA(I),ZNTstoch_wat(I),ZT_wat(I),ZOL(I),psi_opt)
@@ -1390,6 +1559,7 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
              ZOL(I)=MAX(ZOL(I),-20.0_kind_phys)
              ZOL(I)=MIN(ZOL(I),0.0_kind_phys)
 
+#ifndef _OPENACC
              IF (debug_code >= 1) THEN
                IF (ZNTstoch_wat(i) < 1E-8 .OR. Zt_wat(i) < 1E-10) THEN
                  write(0,*)"===(wet) capture bad input in mynn sfc layer, i=:",i
@@ -1400,6 +1570,7 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
                  " dz=",dz8w1d(i)," qflx=",qflx(i)," hflx=",hflx(i)," hpbl=",pblh(i)
                ENDIF
              ENDIF
+#endif
 
              !Use Pedros iterative function to find z/L
              !zol(I)=zolri(rb_wat(I),ZA(I),ZNTstoch_wat(I),ZT_wat(I),ZOL(I),psi_opt)
@@ -1460,6 +1631,7 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
              ZOL(I)=MAX(ZOL(I),0.0_kind_phys)
              ZOL(I)=MIN(ZOL(I),20._kind_phys)
 
+#ifndef _OPENACC
              IF (debug_code >= 1) THEN
                IF (ZNTstoch_lnd(i) < 1E-8 .OR. Zt_lnd(i) < 1E-10) THEN
                  write(0,*)"===(land) capture bad input in mynn sfc layer, i=:",i
@@ -1470,6 +1642,7 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
                  " dz=",dz8w1d(i)," qflx=",qflx(i)," hflx=",hflx(i)," hpbl=",pblh(i)
                ENDIF
              ENDIF
+#endif
 
              !Use Pedros iterative function to find z/L
              !zol(I)=zolri(rb_lnd(I),ZA(I),ZNTstoch_lnd(I),ZT_lnd(I),ZOL(I),psi_opt)
@@ -1526,6 +1699,7 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
              ZOL(I)=MAX(ZOL(I),-20.0_kind_phys)
              ZOL(I)=MIN(ZOL(I),0.0_kind_phys)
 
+#ifndef _OPENACC
              IF (debug_code >= 1) THEN
                IF (ZNTstoch_lnd(i) < 1E-8 .OR. Zt_lnd(i) < 1E-10) THEN
                  write(0,*)"===(land) capture bad input in mynn sfc layer, i=:",i
@@ -1536,6 +1710,7 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
                  " dz=",dz8w1d(i)," qflx=",qflx(i)," hflx=",hflx(i)," hpbl=",pblh(i)
                ENDIF
              ENDIF
+#endif
 
              !Use Pedros iterative function to find z/L
              !zol(I)=zolri(rb_lnd(I),ZA(I),ZNTstoch_lnd(I),ZT_lnd(I),ZOL(I),psi_opt)
@@ -1595,6 +1770,7 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
              ZOL(I)=MAX(ZOL(I),0.0_kind_phys)
              ZOL(I)=MIN(ZOL(I),20._kind_phys)
 
+#ifndef _OPENACC
              IF (debug_code >= 1) THEN
                IF (ZNTstoch_ice(i) < 1E-8 .OR. Zt_ice(i) < 1E-10) THEN
                  write(0,*)"===(ice) capture bad input in mynn sfc layer, i=:",i
@@ -1605,6 +1781,7 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
                  " dz=",dz8w1d(i)," qflx=",qflx(i)," hflx=",hflx(i)," hpbl=",pblh(i)
                ENDIF
              ENDIF
+#endif
 
              !Use Pedros iterative function to find z/L
              !zol(I)=zolri(rb_ice(I),ZA(I),ZNTstoch_ice(I),ZT_ice(I),ZOL(I),psi_opt)
@@ -1661,6 +1838,7 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
              ZOL(I)=MAX(ZOL(I),-20.0_kind_phys)
              ZOL(I)=MIN(ZOL(I),0.0_kind_phys)
 
+#ifndef _OPENACC
              IF (debug_code >= 1) THEN
                IF (ZNTstoch_ice(i) < 1E-8 .OR. Zt_ice(i) < 1E-10) THEN
                  write(0,*)"===(ice) capture bad input in mynn sfc layer, i=:",i
@@ -1671,6 +1849,7 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
                  " dz=",dz8w1d(i)," qflx=",qflx(i)," hflx=",hflx(i)," hpbl=",pblh(i)
                ENDIF
              ENDIF
+#endif
 
              !Use Pedros iterative function to find z/L
              !zol(I)=zolri(rb_ice(I),ZA(I),ZNTstoch_ice(I),ZT_ice(I),ZOL(I),psi_opt)
@@ -1821,6 +2000,14 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
    endif ! flag_iter
  ENDDO   ! end i-loop
 
+#ifdef _OPENACC
+ ! Necessary since OpenACC does not support branching in parallel code
+ IF (errflg == 1) THEN
+    return
+ ENDIF
+#endif
+
+#ifndef _OPENACC
  IF (debug_code == 2) THEN
     DO I=its,ite
        IF(wet(i))write(*,*)"==== AT END OF MAIN LOOP, i=",i, "(wet)"
@@ -1841,10 +2028,29 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
        write(*,*)"============================================="
     ENDDO ! end i-loop
  ENDIF
+#endif
 
    !----------------------------------------------------------
    !  COMPUTE SURFACE HEAT AND MOISTURE FLUXES
    !----------------------------------------------------------
+!$acc parallel loop present(flag_iter, dry, wet, icy, &
+!$acc                    QFX, HFX, FLHC, FLQC, LH, CHS, CH, CHS2, CQS2, &
+!$acc                    RHO1D, MAVAIL, USTM, &
+!$acc                    UST_lnd, UST_wat, UST_ice, &
+!$acc                    PSIQ_lnd, PSIT_lnd, PSIX_lnd, &
+!$acc                    PSIQ_wat, PSIT_wat, PSIX_wat, &
+!$acc                    PSIQ_ice, PSIT_ice, PSIX_ice, &
+!$acc                    PSIQ2_lnd, PSIT2_lnd, &
+!$acc                    PSIQ2_wat, PSIT2_wat, &
+!$acc                    PSIQ2_ice, PSIT2_ice, &
+!$acc                    QSFC, QSFC_lnd, QSFC_wat, QSFC_ice, &
+!$acc                    QFLX, QFLX_lnd, QFLX_wat, QFLX_ice, &
+!$acc                    HFLX, HFLX_lnd, HFLX_wat, HFLX_ice, &
+!$acc                    QSFCMR_lnd, QSFCMR_wat, QSFCMR_ice, &
+!$acc                    QV1D, WSPD, WSPDI, CPM, TH1D, &
+!$acc                    THSK_lnd, THSK_wat, THSK_ice, &
+!$acc                    ch_lnd, ch_wat, ch_ice, &
+!$acc                    cm_lnd, cm_wat, cm_ice)
  DO I=its,ite
   if( flag_iter(i) ) then
 
@@ -2008,12 +2214,14 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
 
       ENDIF
 
+#ifndef _OPENACC
       IF (debug_code > 1) THEN
          write(*,*)"QFX=",QFX(I),"FLQC=",FLQC(I)
          if(icy(i))write(*,*)"ice, MAVAIL:",MAVAIL(I)," u*=",UST_ice(I)," psiq=",PSIQ_ice(i)
          if(dry(i))write(*,*)"lnd, MAVAIL:",MAVAIL(I)," u*=",UST_lnd(I)," psiq=",PSIQ_lnd(i)
          if(wet(i))write(*,*)"ocn, MAVAIL:",MAVAIL(I)," u*=",UST_wat(I)," psiq=",PSIQ_wat(i)
       ENDIF
+#endif
 
       ! The exchange coefficient for cloud water is assumed to be the
       ! same as that for heat. CH is multiplied by WSPD.
@@ -2040,6 +2248,18 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
 ENDDO ! end i-loop
 
 IF (compute_diag) then
+   !$acc parallel loop present(flag_iter, dry, wet, icy, &
+   !$acc                    ZA, ZA2, T2, TH2, TH1D, Q2, QV1D, PSFCPA, &
+   !$acc                    THSK_lnd, THSK_wat, THSK_ice, &
+   !$acc                    QSFC_lnd, QSFC_wat, QSFC_ice, &
+   !$acc                    U10, V10, U1D, V1D, U1D2, V1D2, &
+   !$acc                    ZNTstoch_lnd, ZNTstoch_lnd, ZNTstoch_ice, &
+   !$acc                    PSIX_lnd, PSIX_wat, PSIX_ice, &
+   !$acc                    PSIX10_lnd, PSIX10_wat, PSIX10_ice, &
+   !$acc                    PSIT2_lnd, PSIT2_wat, PSIT2_ice, &
+   !$acc                    PSIT_lnd, PSIT_wat, PSIT_ice, &
+   !$acc                    PSIQ2_lnd, PSIQ2_wat, PSIQ2_ice, &
+   !$acc                    PSIQ_lnd, PSIQ_wat, PSIQ_ice)
    DO I=its,ite
      if( flag_iter(i) ) then
       !-----------------------------------------------------
@@ -2154,6 +2374,16 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
 ! DEBUG - SUSPICIOUS VALUES
 !-----------------------------------------------------
 IF ( debug_code == 2) THEN
+   !$acc parallel loop present(dry, wet, icy, CPM, MAVAIL, &
+   !$acc                    HFX, LH, wstar, RHO1D, PBLH, ZOL, ZA, MOL, &
+   !$acc                    PSIM, PSIH, WSTAR, T1D, TH1D, THV1D, QVSH, &
+   !$acc                    UST_wat, UST_lnd, UST_ice, &
+   !$acc                    THSK_wat, THSK_lnd, THSK_ice, &
+   !$acc                    THVSK_wat, THVSK_lnd, THVSK_ice, &
+   !$acc                    ZNTstoch_wat, ZNTstoch_lnd, ZNTstoch_ice, &
+   !$acc                    ZT_wat, ZT_lnd, ZT_ice, &
+   !$acc                    QSFC_wat, QSFC_lnd, QSFC_ice, &
+   !$acc                    PSIX_wat, PSIX_lnd, PSIX_ice)
    DO I=its,ite
       yesno = 0
       IF (compute_flux) THEN
@@ -2258,6 +2488,54 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
     ENDDO ! end i-loop
  ENDIF ! end debug option
 
+!$acc exit data copyout(CPM, FLHC, FLQC, CHS, CH, CHS2, CQS2,&
+!$acc                   USTM, wstar, qstar, ZOL, MOL, RMOL,  &
+!$acc                   HFX, QFX, LH, QSFC, QFLX, HFLX,      &
+!$acc                   T2, TH2, Q2, WSPD, U10, V10,         &
+!$acc                   QGH, psim, psih,                     &
+!$acc                   stress_wat, stress_lnd, stress_ice,  &
+!$acc                   rb_wat,     rb_lnd,     rb_ice,      &
+!$acc                   UST_wat,    UST_lnd,    UST_ice,     &
+!$acc                   ZNT_wat,    ZNT_lnd,    ZNT_ice,     &
+!$acc                   QSFC_lnd,   QSFC_wat,   QSFC_ice,    &
+!$acc                   QFLX_lnd,   QFLX_wat,   QFLX_ice,    &
+!$acc                   HFLX_lnd,   HFLX_wat,   HFLX_ice,    &
+!$acc                   PSIX_wat,   PSIX_lnd,   PSIX_ice,    &
+!$acc                   PSIX10_wat, PSIX10_lnd, PSIX10_ice,  &
+!$acc                   PSIT2_lnd,  PSIT2_wat,  PSIT2_ice,   &
+!$acc                   PSIT_lnd,   PSIT_wat,   PSIT_ice,    &
+!$acc                   ch_lnd,     ch_wat,     ch_ice,      &
+!$acc                   cm_lnd,     cm_wat,     cm_ice,      &
+!$acc                   errmsg)
+
+!$acc exit data delete( flag_iter, dry, wet, icy, dx,         &
+!$acc                   MAVAIL, PBLH, PSFCPA, z0pert, ztpert, &
+!$acc                   QV1D, U1D, V1D, U1D2, V1D2, T1D, P1D, &
+!$acc                   rstoch1D, sigmaf, shdmax, vegtype,    &
+!$acc                   dz2w1d, dz8w1d, snowh_lnd,            &
+!$acc                   tskin_wat, tskin_lnd, tskin_ice,      &
+!$acc                   tsurf_wat, tsurf_lnd, tsurf_ice)
+
+!$acc exit data delete(  ZA,     ZA2,    THV1D,  TH1D,   TC1D,   TV1D,  &
+!$acc                    RHO1D,  QVSH,   PSIH2,  PSIM10, PSIH10, WSPDI, &
+!$acc                    GOVRTH, PSFC,   THCON,                         &
+!$acc                    zratio_lnd,   zratio_ice,   zratio_wat,        &
+!$acc                    TSK_lnd,      TSK_ice,      TSK_wat,           &
+!$acc                    THSK_lnd,     THSK_ice,     THSK_wat,          &
+!$acc                    THVSK_lnd,    THVSK_ice,    THVSK_wat,         &
+!$acc                    GZ1OZ0_lnd,   GZ1OZ0_ice,   GZ1OZ0_wat,        &
+!$acc                    GZ1OZt_lnd,   GZ1OZt_ice,   GZ1OZt_wat,        &
+!$acc                    GZ2OZ0_lnd,   GZ2OZ0_ice,   GZ2OZ0_wat,        &
+!$acc                    GZ2OZt_lnd,   GZ2OZt_ice,   GZ2OZt_wat,        &
+!$acc                    GZ10OZ0_lnd,  GZ10OZ0_ice,  GZ10OZ0_wat,       &
+!$acc                    GZ10OZt_lnd,  GZ10OZt_ice,  GZ10OZt_wat,       &
+!$acc                    ZNTstoch_lnd, ZNTstoch_ice, ZNTstoch_wat,      &
+!$acc                    ZT_lnd,       ZT_ice,       ZT_wat,            &
+!$acc                    ZQ_lnd,       ZQ_ice,       ZQ_wat,            &
+!$acc                    PSIQ_lnd,     PSIQ_ice,     PSIQ_wat,          &
+!$acc                    PSIQ2_lnd,    PSIQ2_ice,    PSIQ2_wat,         &
+!$acc                    QSFCMR_lnd,   QSFCMR_ice,   QSFCMR_wat )
+
 END SUBROUTINE SFCLAY1D_mynn
 !-------------------------------------------------------------------
 !>\ingroup mynn_sfc
@@ -2272,6 +2550,7 @@ END SUBROUTINE SFCLAY1D_mynn
   SUBROUTINE zilitinkevich_1995(Z_0,Zt,Zq,restar,ustar,KARMAN,&
         & landsea,IZ0TLND2,spp_sfc,rstoch)
 
+       !$acc routine seq
        IMPLICIT NONE
        REAL(kind_phys), INTENT(IN)       :: Z_0,restar,ustar,KARMAN,landsea
        INTEGER,  OPTIONAL,   INTENT(IN)  :: IZ0TLND2
@@ -2341,6 +2620,7 @@ SUBROUTINE davis_etal_2008(Z_0,ustar)
     !This is an update version from Davis et al. 2008, which
     !corrects a small-bias in Z_0 (AHW real-time 2012).
 
+       !$acc routine seq
        IMPLICIT NONE
        REAL(kind_phys), INTENT(IN)  :: ustar
        REAL(kind_phys), INTENT(OUT) :: Z_0
@@ -2368,7 +2648,7 @@ END SUBROUTINE davis_etal_2008
 !>This formulation for roughness length was designed account for.
 !!wave steepness.
    SUBROUTINE Taylor_Yelland_2001(Z_0,ustar,wsp10)
-
+       !$acc routine seq
        IMPLICIT NONE
        REAL(kind_phys), INTENT(IN)  :: ustar,wsp10
        REAL(kind_phys), INTENT(OUT) :: Z_0
@@ -2396,7 +2676,7 @@ END SUBROUTINE Taylor_Yelland_2001
 !! The Charnock parameter CZC is varied from .011 to .018.
 !! between 10-m wsp = 10 and 18..
    SUBROUTINE charnock_1955(Z_0,ustar,wsp10,visc,zu)
-
+       !$acc routine seq
        IMPLICIT NONE
        REAL(kind_phys), INTENT(IN)  :: ustar, visc, wsp10, zu
        REAL(kind_phys), INTENT(OUT) :: Z_0
@@ -2421,7 +2701,7 @@ END SUBROUTINE charnock_1955
 !!The Charnock parameter CZC is varied from about .005 to .028
 !!between 10-m wind speeds of 6 and 19 m/s.
    SUBROUTINE edson_etal_2013(Z_0,ustar,wsp10,visc,zu)
-
+       !$acc routine seq
        IMPLICIT NONE
        REAL(kind_phys), INTENT(IN)  :: ustar, visc, wsp10, zu
        REAL(kind_phys), INTENT(OUT) :: Z_0
@@ -2450,7 +2730,7 @@ END SUBROUTINE edson_etal_2013
 !!data. The formula for land uses a constant ratio (Z_0/7.4) taken
 !!from Garratt (1992).
    SUBROUTINE garratt_1992(Zt,Zq,Z_0,Ren,landsea)
-
+       !$acc routine seq
        IMPLICIT NONE
        REAL(kind_phys), INTENT(IN)  :: Ren, Z_0,landsea
        REAL(kind_phys), INTENT(OUT) :: Zt,Zq
@@ -2486,7 +2766,7 @@ END SUBROUTINE garratt_1992
 !!
 !!This is for use over water only.
     SUBROUTINE fairall_etal_2003(Zt,Zq,Ren,ustar,visc,rstoch,spp_sfc)
-
+       !$acc routine seq
        IMPLICIT NONE
        REAL(kind_phys), INTENT(IN)   :: Ren,ustar,visc,rstoch
        INTEGER, INTENT(IN)           :: spp_sfc
@@ -2530,7 +2810,7 @@ END SUBROUTINE fairall_etal_2003
 !! The actual reference is unknown. This was passed along by Jim Edson (personal communication).
 !! This is for use over water only, preferably open ocean.
     SUBROUTINE fairall_etal_2014(Zt,Zq,Ren,ustar,visc,rstoch,spp_sfc)
-
+       !$acc routine seq
        IMPLICIT NONE
        REAL(kind_phys), INTENT(IN)  :: Ren,ustar,visc,rstoch
        INTEGER, INTENT(IN)          :: spp_sfc
@@ -2578,6 +2858,7 @@ END SUBROUTINE fairall_etal_2014
 !!This should only be used over land!
        SUBROUTINE Yang_2008(Z_0,Zt,Zq,ustar,tstar,qst,Ren,visc)
 
+       !$acc routine seq
        IMPLICIT NONE
        REAL(kind_phys), INTENT(IN)  :: Z_0, Ren, ustar, tstar, qst, visc
        REAL(kind_phys) ::      ht,     &! roughness height at critical Reynolds number
@@ -2613,6 +2894,7 @@ END SUBROUTINE Yang_2008
 !>\ingroup mynn_sfc
     SUBROUTINE GFS_z0_lnd(z0max,shdmax,z1,vegtype,ivegsrc,z0pert)
 
+        !$acc routine seq
         REAL(kind_phys), INTENT(OUT)  :: z0max
         REAL(kind_phys), INTENT(IN)   :: shdmax,z1,z0pert
         INTEGER, INTENT(IN)           :: vegtype,ivegsrc
@@ -2673,6 +2955,7 @@ END SUBROUTINE GFS_z0_lnd
 !>\ingroup mynn_sfc
     SUBROUTINE GFS_zt_lnd(ztmax,z0max,sigmaf,ztpert,ustar_lnd)
 
+        !$acc routine seq
         REAL(kind_phys), INTENT(OUT)  :: ztmax
         REAL(kind_phys), INTENT(IN)   :: z0max,sigmaf,ztpert,ustar_lnd
         REAL(kind_phys)               :: czilc, tem1, tem2
@@ -2701,6 +2984,7 @@ END SUBROUTINE GFS_zt_lnd
 !>\ingroup mynn_sfc
     SUBROUTINE GFS_z0_wat(z0rl_wat,ustar_wat,WSPD,z1,sfc_z0_type,redrag)
 
+        !$acc routine seq
         REAL(kind_phys), INTENT(OUT)  :: z0rl_wat
         REAL(kind_phys), INTENT(INOUT):: ustar_wat
         REAL(kind_phys), INTENT(IN)   :: wspd,z1
@@ -2753,11 +3037,16 @@ END SUBROUTINE GFS_z0_wat
 !--------------------------------------------------------------------
 !>\ingroup mynn_sfc
     SUBROUTINE GFS_zt_wat(ztmax,z0rl_wat,restar,WSPD,z1,sfc_z0_type,errmsg,errflg)
-
+        !$acc routine seq
         real(kind_phys), INTENT(OUT)  :: ztmax
         real(kind_phys), INTENT(IN)   :: wspd,z1,z0rl_wat,restar
         INTEGER, INTENT(IN)           :: sfc_z0_type
+#ifndef _OPENACC
         character(len=*), intent(out) :: errmsg
+#else
+! Necessary since OpenACC does not support assumed-size arrays
+        character(len=200), intent(out) :: errmsg
+#endif
         integer,          intent(out) :: errflg
         real(kind_phys)               :: z0,z0max,wind10m,rat,ustar_wat
         real(kind_phys), PARAMETER    :: charnock = 0.014, z0s_max=.317e-2
@@ -2798,6 +3087,7 @@ SUBROUTINE GFS_zt_wat(ztmax,z0rl_wat,restar,WSPD,z1,sfc_z0_type,errmsg,errflg)
               errflg = 1
               errmsg = 'ERROR(GFS_zt_wat): sfc_z0_type not valid.'
               return
+
             endif
 
     END SUBROUTINE GFS_zt_wat
@@ -2807,6 +3097,7 @@ END SUBROUTINE GFS_zt_wat
 !! Weiguo Wang, 2019-0425
 
       SUBROUTINE znot_m_v6(uref, znotm)
+      !$acc routine seq
       use machine , only : kind_phys
       IMPLICIT NONE
 ! Calculate areodynamical roughness over water with input 10-m wind
@@ -2856,6 +3147,7 @@ END SUBROUTINE znot_m_v6
 !!
       SUBROUTINE znot_t_v6(uref, znott)
 
+      !$acc routine seq
       IMPLICIT NONE
 !> Calculate scalar roughness over water with input 10-m wind
 !! For low-to-moderate winds, try to match the Ck-U10 relationship from COARE algorithm
@@ -2922,6 +3214,7 @@ END SUBROUTINE znot_t_v6
 !!
       SUBROUTINE znot_m_v7(uref, znotm)
 
+      !$acc routine seq
       IMPLICIT NONE
 !> Calculate areodynamical roughness over water with input 10-m wind
 !! For low-to-moderate winds, try to match the Cd-U10 relationship from COARE V3.5 (Edson et al. 2013)
@@ -2971,6 +3264,7 @@ END SUBROUTINE znot_m_v7
 !!
       SUBROUTINE znot_t_v7(uref, znott)
 
+      !$acc routine seq
       IMPLICIT NONE
 !> Calculate scalar roughness over water with input 10-m wind
 !! For low-to-moderate winds, try to match the Ck-U10 relationship from COARE algorithm
@@ -3040,6 +3334,7 @@ END SUBROUTINE znot_t_v7
 !! This should only be used over snow/ice!
     SUBROUTINE Andreas_2002(Z_0,bvisc,ustar,Zt,Zq)
 
+       !$acc routine seq
        IMPLICIT NONE
        REAL(kind_phys), INTENT(IN)  :: Z_0, bvisc, ustar
        REAL(kind_phys), INTENT(OUT) :: Zt, Zq
@@ -3313,6 +3608,7 @@ END SUBROUTINE PSI_CB2005
 !! and Holtslag (1991) for stable conditions.
     SUBROUTINE Li_etal_2010(zL, Rib, zaz0, z0zt)
 
+       !$acc routine seq
        IMPLICIT NONE
        REAL(kind_phys), INTENT(OUT)  :: zL
        REAL(kind_phys), INTENT(IN) :: Rib, zaz0, z0zt
@@ -3471,6 +3767,7 @@ REAL(kind_phys) function zolri2(zol2,ri2,za,z0,zt,psi_opt)
 
       REAL(kind_phys) function zolrib(ri,za,z0,zt,logz0,logzt,zol1,psi_opt)
 
+      !$acc routine seq
       ! This iterative algorithm to compute z/L from bulk-Ri
 
       IMPLICIT NONE
@@ -3480,7 +3777,7 @@ REAL(kind_phys) function zolrib(ri,za,z0,zt,logz0,logzt,zol1,psi_opt)
       REAL(kind_phys) :: zol20,zol3,zolt,zolold
       INTEGER :: n
       INTEGER, PARAMETER :: nmax = 20
-      REAL(kind_phys), DIMENSION(nmax):: zLhux
+      !REAL(kind_phys), DIMENSION(nmax):: zLhux
       REAL(kind_phys) :: psit2,psix2
 
       !print*,"+++++++INCOMING: z/L=",zol1," ri=",ri
@@ -3522,7 +3819,7 @@ REAL(kind_phys) function zolrib(ri,za,z0,zt,logz0,logzt,zol1,psi_opt)
         endif
         !print*,"n=",n," psit2=",psit2," psix2=",psix2
         zolrib=ri*psix2**2/psit2
-        zLhux(n)=zolrib
+        !zLhux(n)=zolrib
         n=n+1
       enddo
 
@@ -3530,7 +3827,7 @@ REAL(kind_phys) function zolrib(ri,za,z0,zt,logz0,logzt,zol1,psi_opt)
          !print*,"iter FAIL, n=",n," Ri=",ri," z/L=",zolri
          !if convergence fails, use approximate values:
          CALL Li_etal_2010(zolrib, ri, za/z0, z0/zt)
-         zLhux(n)=zolrib
+         !zLhux(n)=zolrib
          !print*,"FAILED, n=",n," Ri=",ri," z0=",z0
          !print*,"z/L=",zLhux(1:nmax)
       else
@@ -3595,6 +3892,7 @@ END SUBROUTINE psi_init
 !
 !>\ingroup mynn_sfc
    real(kind_phys) function psim_stable_full(zolf)
+        !$acc routine seq
         real(kind_phys) :: zolf
 
         !psim_stable_full=-6.1*log(zolf+(1+zolf**2.5)**(1./2.5))
@@ -3605,6 +3903,7 @@ real(kind_phys) function psim_stable_full(zolf)
 
 !>\ingroup mynn_sfc
    real(kind_phys) function psih_stable_full(zolf)
+        !$acc routine seq
         real(kind_phys) :: zolf
 
         !psih_stable_full=-5.3*log(zolf+(1+zolf**1.1)**(1./1.1))
@@ -3615,6 +3914,7 @@ real(kind_phys) function psih_stable_full(zolf)
 
 !>\ingroup mynn_sfc
    real(kind_phys) function psim_unstable_full(zolf)
+        !$acc routine seq
         real(kind_phys) :: zolf,x,ym,psimc,psimk
 
         x=(1.-16.*zolf)**.25
@@ -3633,6 +3933,7 @@ real(kind_phys) function psim_unstable_full(zolf)
 
 !>\ingroup mynn_sfc
    real(kind_phys) function psih_unstable_full(zolf)
+        !$acc routine seq
         real(kind_phys) :: zolf,y,yh,psihc,psihk
 
         y=(1.-16.*zolf)**.5
@@ -3654,6 +3955,7 @@ real(kind_phys) function psih_unstable_full(zolf)
 !>\ingroup mynn_sfc
 !!
    REAL(kind_phys) function psim_stable_full_gfs(zolf)
+        !$acc routine seq
         REAL(kind_phys) :: zolf
         REAL(kind_phys), PARAMETER :: alpha4 = 20.
         REAL(kind_phys) :: aa
@@ -3667,6 +3969,7 @@ REAL(kind_phys) function psim_stable_full_gfs(zolf)
 !>\ingroup mynn_sfc
 !!
    real(kind_phys) function psih_stable_full_gfs(zolf)
+        !$acc routine seq
         real(kind_phys) :: zolf
         real(kind_phys), PARAMETER :: alpha4 = 20.
         real(kind_phys) :: bb
@@ -3680,6 +3983,7 @@ real(kind_phys) function psih_stable_full_gfs(zolf)
 !>\ingroup mynn_sfc
 !!
    real(kind_phys) function psim_unstable_full_gfs(zolf)
+        !$acc routine seq
         real(kind_phys) :: zolf
         real(kind_phys) :: hl1,tem1
         real(kind_phys), PARAMETER :: a0=-3.975,  a1=12.32,  &
@@ -3700,6 +4004,7 @@ real(kind_phys) function psim_unstable_full_gfs(zolf)
 !>\ingroup mynn_sfc
 !!
    real(kind_phys) function psih_unstable_full_gfs(zolf)
+        !$acc routine seq
         real(kind_phys) :: zolf
         real(kind_phys) :: hl1,tem1
         real(kind_phys), PARAMETER :: a0p=-7.941, a1p=24.75, &
@@ -3720,6 +4025,7 @@ real(kind_phys) function psih_unstable_full_gfs(zolf)
 !>\ingroup mynn_sfc
 !! look-up table functions - or, if beyond -10 < z/L < 10, recalculate
    real(kind_phys) function psim_stable(zolf,psi_opt)
+        !$acc routine seq
         integer :: nzol,psi_opt
         real(kind_phys) :: rzol,zolf
 
@@ -3740,6 +4046,7 @@ real(kind_phys) function psim_stable(zolf,psi_opt)
 
 !>\ingroup mynn_sfc
    real(kind_phys) function psih_stable(zolf,psi_opt)
+        !$acc routine seq
         integer :: nzol,psi_opt
         real(kind_phys) :: rzol,zolf
 
@@ -3760,6 +4067,7 @@ real(kind_phys) function psih_stable(zolf,psi_opt)
 
 !>\ingroup mynn_sfc
    real(kind_phys) function psim_unstable(zolf,psi_opt)
+        !$acc routine seq
         integer :: nzol,psi_opt
         real(kind_phys) :: rzol,zolf
 
@@ -3780,6 +4088,7 @@ real(kind_phys) function psim_unstable(zolf,psi_opt)
 
 !>\ingroup mynn_sfc
    real(kind_phys) function psih_unstable(zolf,psi_opt)
+        !$acc routine seq
         integer :: nzol,psi_opt
         real(kind_phys) :: rzol,zolf
 
diff --git a/physics/mynnsfc_wrapper.F90 b/physics/mynnsfc_wrapper.F90
index 1a970c9f4..3c033e65e 100644
--- a/physics/mynnsfc_wrapper.F90
+++ b/physics/mynnsfc_wrapper.F90
@@ -191,6 +191,16 @@ SUBROUTINE mynnsfc_wrapper_run(            &
      &            IMS,IME,JMS,JME,KMS,KME,                  &
      &            ITS,ITE,JTS,JTE,KTS,KTE
 
+!$acc enter data create(hfx, znt, psim, psih, chs,          &
+!$acc                   mavail, xland, GZ1OZ0, cpm, qgh,    &
+!$acc                   qfx, snowh_wat)
+
+!$acc enter data create(dz, th, qv)
+
+!$acc enter data copyin(rmol, phii, t3d, exner, qvsh, slmsk, xland)
+
+!$acc enter data copyin(dry, wet, icy, znt_lnd, znt_wat, znt_ice, qsfc_lnd, qsfc_ice, qsfc_lnd_ruc, qsfc_ice_ruc)
+
       ! Initialize CCPP error handling variables
       errmsg = ''
       errflg = 0
@@ -203,6 +213,7 @@ SUBROUTINE mynnsfc_wrapper_run(            &
 !         write(0,*)"iter=",iter
 !      endif
 
+!$acc kernels
       ! prep MYNN-only variables
       dz(:,:) = 0
       th(:,:) = 0
@@ -210,6 +221,9 @@ SUBROUTINE mynnsfc_wrapper_run(            &
       hfx(:)  = 0
       qfx(:)  = 0
       rmol(:) = 0
+!$acc end kernels
+
+!$acc parallel loop collapse(2) present(dz, phii, th, t3d, exner, qv, qvsh)
       do k=1,2 !levs
         do i=1,im
            dz(i,k)=(phii(i,k+1) - phii(i,k))*g_inv
@@ -219,6 +233,7 @@ SUBROUTINE mynnsfc_wrapper_run(            &
         enddo
       enddo
 
+!$acc parallel loop present(slmsk, xland, qgh, mavail, cpm, snowh_wat)
       do i=1,im
           if (slmsk(i)==1. .or. slmsk(i)==2.)then !sea/land/ice mask (=0/1/2) in FV3
             xland(i)=1.0                          !but land/water = (1/2) in SFCLAY_mynn
@@ -235,6 +250,7 @@ SUBROUTINE mynnsfc_wrapper_run(            &
           snowh_wat(i) = 0.0
       enddo
 
+!$acc kernels
       ! cm -> m
       where (dry) znt_lnd=znt_lnd*0.01
       where (wet) znt_wat=znt_wat*0.01
@@ -245,6 +261,7 @@ SUBROUTINE mynnsfc_wrapper_run(            &
         where (dry) qsfc_lnd = qsfc_lnd_ruc/(1.+qsfc_lnd_ruc) ! spec. hum
         where (icy) qsfc_ice = qsfc_ice_ruc/(1.+qsfc_ice_ruc) ! spec. hum.
       end if
+!$acc end kernels
 
 !      if (lprnt) then
 !          write(0,*)"CALLING SFCLAY_mynn; input:"
@@ -274,6 +291,8 @@ SUBROUTINE mynnsfc_wrapper_run(            &
 !          write(0,*)"PBLH=",pblh(1)," xland=",xland(1)
 !       endif
 
+!$acc exit data delete(qsfc_lnd_ruc, qsfc_ice_ruc)
+!$acc exit data delete(phii, qvsh, slmsk)
 
         CALL SFCLAY_mynn(                                                     &
              u3d=u,v3d=v,t3d=t3d,qv3d=qv,p3d=prsl,dz8w=dz,                    &
@@ -318,6 +337,13 @@ SUBROUTINE mynnsfc_wrapper_run(            &
              errmsg=errmsg, errflg=errflg                                     )
         if (errflg/=0) return
 
+!$acc exit data delete(hfx, znt, psim, psih, chs,          &
+!$acc                   mavail, xland, GZ1OZ0, cpm, qgh,    &
+!$acc                   qfx, snowh_wat, t3d, exner)
+!$acc exit data delete(dz, th, qv)
+!$acc exit data copyout(rmol)
+!$acc exit data copyout(qsfc_lnd, qsfc_ice)
+
         !! POST MYNN SURFACE LAYER (INTERSTITIAL) WORK:
         !do i = 1, im
         !   !* Taken from sfc_nst.f
@@ -336,10 +362,15 @@ SUBROUTINE mynnsfc_wrapper_run(            &
         !   znt_ice(i)=znt_ice(i)*100.
         !enddo
 
+!$acc kernels
         ! m -> cm
         where (dry) znt_lnd=znt_lnd*100.
         where (wet) znt_wat=znt_wat*100.
         where (icy) znt_ice=znt_ice*100.
+!$acc end kernels
+
+!$acc exit data delete(dry, wet, icy)
+!$acc exit data copyout(znt_lnd, znt_wat, znt_ice)
 
 !      if (lprnt) then
 !         write(0,*)

From 62298180c7269038931db60549b4ed1a4e6a2b9e Mon Sep 17 00:00:00 2001
From: Jili Dong <Jili.Dong@noaa.gov>
Date: Mon, 21 Aug 2023 19:19:51 +0000
Subject: [PATCH 071/115] add SPP support for G-F deep convection

---
 physics/cu_gf_deep.F90         |  7 +++----
 physics/cu_gf_driver.F90       | 26 ++++++++++++++++++++------
 physics/cu_gf_driver.meta      | 15 +++++++++++++++
 physics/module_mp_thompson.F90 |  2 +-
 physics/mp_thompson.F90        |  2 +-
 physics/mp_thompson.meta       |  2 +-
 6 files changed, 41 insertions(+), 13 deletions(-)

diff --git a/physics/cu_gf_deep.F90 b/physics/cu_gf_deep.F90
index 67dd9bd3f..a4253906c 100644
--- a/physics/cu_gf_deep.F90
+++ b/physics/cu_gf_deep.F90
@@ -4707,11 +4707,10 @@ subroutine get_zu_zd_pdf_fim(kklev,p,rand_vmas,zubeg,ipr,xland,zuh2,draft,ierr,k
  if(draft == 1) then
    lev_start=min(.9,.1+csum*.013)
    kb_adj=max(kb,2)
-   tunning=max(p(kklev+1),.5*(p(kpbli)+p(kt)))
-   tunning=p(kklev)
-!   tunning=p(kklev+1) !p(kpbli+1) !p(kklev) !p(kt)+(p(kpbli)-p(kt))*lev_start
-!   tunning=.5*(p(kb_adj)+p(kt)) !p(kpbli+1) !p(kklev) !p(kt)+(p(kpbli)-p(kt))*lev_start
+! trash is the depth of the cloud
    trash=-p(kt)+p(kb_adj)
+   tunning=p(kklev)
+   if(rand_vmas.ne.0.) tunning=p(kklev-1)+.1*rand_vmas*trash
    beta_deep=1.3 +(1.-trash/1200.)
    tunning =min(0.95, (tunning-p(kb_adj))/(p(kt)-p(kb_adj))) !=.6
    tunning =max(0.02, tunning)
diff --git a/physics/cu_gf_driver.F90 b/physics/cu_gf_driver.F90
index f82569b99..5e42fb777 100644
--- a/physics/cu_gf_driver.F90
+++ b/physics/cu_gf_driver.F90
@@ -67,6 +67,7 @@ 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)
 !-------------------------------------------------------------
       implicit none
@@ -80,6 +81,10 @@ subroutine cu_gf_driver_run(ntracer,garea,im,km,dt,flag_init,flag_restart,&
       integer            :: ichoice=0    ! 0 2 5 13 8
       integer            :: ichoicem=13  ! 0 2 5 13
       integer            :: ichoice_s=3  ! 0 1 2 3
+      integer, intent(in) :: spp_cu_deep ! flag for using SPP perturbations
+      real(kind_phys), dimension(:,:), intent(in) ::        &
+     &                    spp_wts_cu_deep
+      real(kind=kind_phys) :: spp_wts_cu_deep_tmp
 
       logical, intent(in) :: do_cap_suppress
       real(kind=kind_phys), parameter :: aodc0=0.14
@@ -313,9 +318,18 @@ subroutine cu_gf_driver_run(ntracer,garea,im,km,dt,flag_init,flag_restart,&
 ! these should be coming in from outside
 !
 !    cactiv(:)      = 0
-     rand_mom(:)    = 0.
-     rand_vmas(:)   = 0.
-     rand_clos(:,:) = 0.
+     if (spp_cu_deep == 0) then
+       rand_mom(:)    = 0.
+       rand_vmas(:)   = 0.
+       rand_clos(:,:) = 0.
+     else 
+       do i=1,im
+         spp_wts_cu_deep_tmp=min(max(-1.0, spp_wts_cu_deep(i,1)),1.0)
+         rand_mom(i)    = spp_wts_cu_deep_tmp 
+         rand_vmas(i)   = spp_wts_cu_deep_tmp 
+         rand_clos(i,:) = spp_wts_cu_deep_tmp
+       end do
+     end if
 !$acc end kernels
 !
      its=1
@@ -630,7 +644,7 @@ subroutine cu_gf_driver_run(ntracer,garea,im,km,dt,flag_init,flag_restart,&
      enddo
 !$acc end kernels
      if (dx(its)<6500.) then
-       ichoice=10
+!       ichoice=10
        imid_gf=0
      endif
 !
@@ -734,7 +748,7 @@ subroutine cu_gf_driver_run(ntracer,garea,im,km,dt,flag_init,flag_restart,&
               ,rand_mom      & ! for stochastics mom, if temporal and spatial patterns exist
               ,rand_vmas     & ! for stochastics vertmass, if temporal and spatial patterns exist
               ,rand_clos     & ! for stochastics closures, if temporal and spatial patterns exist
-              ,0             & ! flag to what you want perturbed
+              ,spp_cu_deep   & ! flag to what you want perturbed
                                ! 1 = momentum transport
                                ! 2 = normalized vertical mass flux profile
                                ! 3 = closures
@@ -816,7 +830,7 @@ subroutine cu_gf_driver_run(ntracer,garea,im,km,dt,flag_init,flag_restart,&
               ,rand_mom      & ! for stochastics mom, if temporal and spatial patterns exist
               ,rand_vmas     & ! for stochastics vertmass, if temporal and spatial patterns exist
               ,rand_clos     & ! for stochastics closures, if temporal and spatial patterns exist
-              ,0             & ! flag to what you want perturbed
+              ,spp_cu_deep   & ! flag to what you want perturbed
                                ! 1 = momentum transport
                                ! 2 = normalized vertical mass flux profile
                                ! 3 = closures
diff --git a/physics/cu_gf_driver.meta b/physics/cu_gf_driver.meta
index 8b1a46e2d..08e9de201 100644
--- a/physics/cu_gf_driver.meta
+++ b/physics/cu_gf_driver.meta
@@ -597,6 +597,21 @@
   dimensions = ()
   type = integer
   intent = in
+[spp_wts_cu_deep]
+  standard_name = spp_weights_for_cu_deep_scheme
+  long_name = spp weights for cu deep scheme
+  units = 1
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[spp_cu_deep]
+  standard_name = control_for_deep_convection_spp_perturbations
+  long_name = control for deep convection spp perturbations
+  units = count
+  dimensions = ()
+  type = integer
+  intent = in
 [errmsg]
   standard_name = ccpp_error_message
   long_name = error message for error handling in CCPP
diff --git a/physics/module_mp_thompson.F90 b/physics/module_mp_thompson.F90
index 4d823d2f4..ca913c6e3 100644
--- a/physics/module_mp_thompson.F90
+++ b/physics/module_mp_thompson.F90
@@ -1046,7 +1046,7 @@ SUBROUTINE mp_gt_driver(qv, qc, qr, qi, qs, qg, ni, nr, nc,     &
       INTEGER, INTENT(IN) :: rand_perturb_on, kme_stoch, n_var_spp
       REAL, DIMENSION(:,:), INTENT(IN) :: rand_pert
       REAL, DIMENSION(:), INTENT(IN) :: spp_prt_list, spp_stddev_cutoff
-      CHARACTER(len=3), DIMENSION(:), INTENT(IN) :: spp_var_list
+      CHARACTER(len=10), DIMENSION(:), INTENT(IN) :: spp_var_list
       INTEGER, INTENT(IN):: has_reqc, has_reqi, has_reqs
 #if ( WRF_CHEM == 1 )
       REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(INOUT):: &
diff --git a/physics/mp_thompson.F90 b/physics/mp_thompson.F90
index 6a95a706c..c456e87cd 100644
--- a/physics/mp_thompson.F90
+++ b/physics/mp_thompson.F90
@@ -409,7 +409,7 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd,        &
          integer,                   intent(in) :: n_var_spp
          real(kind_phys),           intent(in) :: spp_wts_mp(:,:)
          real(kind_phys),           intent(in) :: spp_prt_list(:)
-         character(len=3),          intent(in) :: spp_var_list(:)
+         character(len=10),          intent(in) :: spp_var_list(:)
          real(kind_phys),           intent(in) :: spp_stddev_cutoff(:)
 
          logical, intent (in) :: cplchm
diff --git a/physics/mp_thompson.meta b/physics/mp_thompson.meta
index 691698281..5918e4dd9 100644
--- a/physics/mp_thompson.meta
+++ b/physics/mp_thompson.meta
@@ -725,7 +725,7 @@
   units = none
   dimensions = (number_of_perturbed_spp_schemes)
   type = character
-  kind = len=3
+  kind = len=10
   intent = in
 [cplchm]
   standard_name = flag_for_chemistry_coupling

From 96f60024a50b5c9b1701b83cd0fa3ece5c94ba21 Mon Sep 17 00:00:00 2001
From: Jili Dong <Jili.Dong@noaa.gov>
Date: Wed, 23 Aug 2023 15:36:30 +0000
Subject: [PATCH 072/115] minor change on explicitly delcaring data type

---
 physics/cu_gf_driver.F90 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/physics/cu_gf_driver.F90 b/physics/cu_gf_driver.F90
index 5e42fb777..3b700cc5a 100644
--- a/physics/cu_gf_driver.F90
+++ b/physics/cu_gf_driver.F90
@@ -324,7 +324,7 @@ subroutine cu_gf_driver_run(ntracer,garea,im,km,dt,flag_init,flag_restart,&
        rand_clos(:,:) = 0.
      else 
        do i=1,im
-         spp_wts_cu_deep_tmp=min(max(-1.0, spp_wts_cu_deep(i,1)),1.0)
+         spp_wts_cu_deep_tmp=min(max(-1.0_kind_phys, spp_wts_cu_deep(i,1)),1.0_kind_phys)
          rand_mom(i)    = spp_wts_cu_deep_tmp 
          rand_vmas(i)   = spp_wts_cu_deep_tmp 
          rand_clos(i,:) = spp_wts_cu_deep_tmp

From a03c68443ccc2d3debc0b23b23843dfd027d6d7b Mon Sep 17 00:00:00 2001
From: Ted Mansell <ted.mansell@noaa.gov>
Date: Thu, 24 Aug 2023 14:46:44 +0000
Subject: [PATCH 073/115]  Change 1D GS arrays from fixed size to allocated

---
 physics/module_mp_nssl_2mom.F90 | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/physics/module_mp_nssl_2mom.F90 b/physics/module_mp_nssl_2mom.F90
index cac1218a9..20239833a 100644
--- a/physics/module_mp_nssl_2mom.F90
+++ b/physics/module_mp_nssl_2mom.F90
@@ -2326,7 +2326,7 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
      real, dimension(its:ite, 1, na) :: xfall
      real, dimension(kts:kte, nproc) :: thproclocal
      integer, parameter :: nor = 0, ng = 0
-     integer :: nx,ny,nz
+     integer :: nx,ny,nz,ngs
      integer ix,jy,kz,i,j,k,il,n
      integer :: infdo
      real :: ssival, ssifac, t8s, t9s, qvapor
@@ -2915,6 +2915,9 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
        
 !      ENDIF ! .false.
  
+
+      ngs = 128
+
       IF ( isedonly /= 1 ) THEN
    ! call nssl_2mom_gs: main gather-scatter routine to calculate microphysics
 
@@ -2939,7 +2942,7 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
      &   timevtcalc,axtra2d, makediag        &
      &   ,has_wetscav, rainprod2d, evapprod2d  &
      & ,errmsg,errflg &
-     &   ,elec2,its,ids,ide,jds,jde          &
+     &   ,elec2,its,ids,ide,jds,jde,ngs      &
      & )
 
 
@@ -2964,7 +2967,7 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
      &  ,an,dn1,t77 & 
      &  ,pn,wn & 
      &  ,axtra2d, makediag  &
-     &  ,ssat,t00,t77,flag_qndrop)
+     &  ,ssat,t00,t77,flag_qndrop,ngs)
 
 ! recalculate dn1 after temperature changes 
       DO kz = kts,kte
@@ -8999,7 +9002,7 @@ SUBROUTINE NUCOND    &
      &  ,an,dn,p2 & 
      &  ,pn,w & 
      &  ,axtra,io_flag &
-     &  ,ssfilt,t00,t77,flag_qndrop  &
+     &  ,ssfilt,t00,t77,flag_qndrop,ngs  &
      & )
 
 
@@ -9064,7 +9067,7 @@ SUBROUTINE NUCOND    &
       real, parameter :: cwmas20 = 1000.*0.523599*(2.*20.e-6)**3 ! mass of 20-micron radius droplet, for sat. adj.
       integer nxmpb,nzmpb,nxz
       integer mgs,ngs,numgs,inumgs
-      parameter (ngs=500)
+!      parameter (ngs=1 )
       integer ngscnt,igs(ngs),kgs(ngs)
       integer kgsp(ngs),kgsm(ngs)
       integer nsvcnt
@@ -9095,7 +9098,7 @@ SUBROUTINE NUCOND    &
       integer ifilt   ! =1 to filter ssat, =0 to set ssfilt=ssat
       parameter ( ifilt = 0 ) 
       real temp1,temp2 ! ,ssold
-      real :: ssmax(ngs) = 0.0       ! maximum SS experienced by a parcel
+      real :: ssmax(ngs)       ! maximum SS experienced by a parcel
       real ssmx
       real dnnet,dqnet
 !      real cnu,rnu,snu,cinu
@@ -11598,7 +11601,7 @@ subroutine nssl_2mom_gs   &
      & ,timevtcalc,axtra,io_flag  &
      & , has_wetscav,rainprod2d, evapprod2d &
      & ,errmsg,errflg &
-     & ,elec,its,ids,ide,jds,jde &
+     & ,elec,its,ids,ide,jds,jde,ngs &
      & )
 
 
@@ -11830,7 +11833,7 @@ subroutine nssl_2mom_gs   &
 !
       integer nxmpb,nzmpb,nxz
       integer jgs,mgs,ngs,numgs
-      parameter (ngs=500) !500)
+!      parameter (ngs=1 ) !500)
       integer, parameter :: ngsz = 500
       integer ntt
       parameter (ntt=300)

From 95e9ff2268ad03f3004da886634812c5f7bdf32c Mon Sep 17 00:00:00 2001
From: "Timothy S. Sliwinski" <Timothy.S.Sliwinski@noaa.gov>
Date: Thu, 24 Aug 2023 16:10:55 +0000
Subject: [PATCH 074/115] Reworking how errmsg is treated in device code to
 remove some preprocessor variable substitutions through the use of new local
 variables.

The changes in this commit affect 3 main areas of module_sf_mynn.F90:
1.) Subroutine SFCLAY_mynn
2.) Subroutine SFCLAY1D_mynn
3.) Subroutine GFS_zt_wat
Each of these areas are described in more detail below.

1.) SFCLAY_mynn

In the SFCLAY_mynn subroutine, it was possible to remove all #ifdef
substitutions of errmsg(len=*) for errmsg(len=200) because errmsg is not used in
any code regions of this subroutine that may be run on an accelerator device.
Since this is the case, errmsg(len=*) is perfectly acceptable, and can be left
alone. The OpenACC data statements within the subroutine were also updated to
remove references to errmsg as well since, again, it was not necessary to have
errmsg on the device for this subroutine.

2.) SFCLAY1D_mynn

- Creation of device_errmsg and device_errflg and proper syncing with errmsg
  and errflg

In the SFCLAY1D_mynn subroutine, it was also possible to remove all #ifdef
substitutions by instead creating a new local variable called device_errmsg
that is a copy of errmsg but with a fixed size of 512 such that it is acceptable
for use on the device. This is necessary because at certain points in the
subroutine, loops that are good to be offloaded to the device set errmsg under
certain conditions. Since these areas cannot be isolated from the parent loop
without a major rework of the loop, we must preserve a way for errmsg to be set
on the device. Since device_errmsg is a fixed size, we can do that. However,
this complicates the code a bit for error handling purposes as we now have
errmsg and device_errmsg which must be synced properly to ensure error messages
are returned to CCPP as expected. Therefore, we must keep track of when
device_errmsg is set so we can know to sync device_errmsg with errmsg. This is
done by making a new local variable called device_errflg to be device_errmsg's
complement on the device as errflg is errmsg's complement on the host. When
device_errflg is set to a nonzero integer, we then know that device_errmsg must
be synced with errmsg. This is simple to do at the end of the subroutine after
the device_errmsg on the device is copyout-ed by OpenACC, and a new IF-block
has been added for this general case.

- Special case of mid-loop return (line 1417), and the creation of
  device_special_errflg and device_special_errmsg

However, there is a special case we must handle a bit differently. In the
mid-loop return statement near line 1417, we also must perform this sync to
ensure the proper errmsg is returned in the event this return is needed.
Therefore, a similar IF-block has been created within the corresponding #ifdef
near line 2027 to ensure errmsg has the proper value before the subroutine
returns. However, since this block is in the middle of the entire code and
only executed on the host, we must first perform an OpenACC sync operation
to make sure the device_errmsg and the device_errflg on the host matches the
device_errmsg and device_errflg on the host, otherwise the incorrect values
could lead to the return statement not executing as expected.

This special case seems simple, but an extra trap lay exposed. If
device_errmsg and device_errflg is set on the device at any point now before
this IF-block, then the return statement we moved out of the loop will now
be executed for *ANY* error message, whether that was the intended course or
not. Therefore, we need to ensure this special case is only triggered for
this specific case. Unfortunately, there appears no other way than to create
two additional variables (device_special_errmsg and device_special_errflg)
to isolate this case from all other error cases. With these installed in
place of just device_errmsg and device_errflg, this special return case is
now properly handled.

- Complete Ifdef/Ifndef removal not possible

Overall, due to the nature of this special case, we have no choice but to
leave the #ifdef and #ifndef preprocessor statements in place as they are
the only things capable of moving this return statement out of the loop
without additional invasive changes to how the code operates.

3.) GFS_zt_wat

In the GFS_zt_wat subroutine, since this subroutine is called on the
device from within the main I-loop of SFCLAY1D_mynn, we have no choice but
to change all errmsg and errflg usage to device_errmsg or device_errflg,
otherwise this subroutine and the entire parent loop could not be run on
the device. Therefore, all errmsg and errflg lines have been commented out
and new, comparable lines using device_errmsg and device_errflg added in
their place. Additionally, the subroutine call variable list was updated.
---
 physics/module_sf_mynn.F90 | 99 ++++++++++++++++++++++++++------------
 1 file changed, 67 insertions(+), 32 deletions(-)

diff --git a/physics/module_sf_mynn.F90 b/physics/module_sf_mynn.F90
index 399b1ee83..dd181c99c 100644
--- a/physics/module_sf_mynn.F90
+++ b/physics/module_sf_mynn.F90
@@ -345,12 +345,7 @@ SUBROUTINE SFCLAY_mynn(                           &
      &                     qsfc_wat,  qsfc_lnd,  qsfc_ice
 
 ! CCPP error handling
-#ifndef _OPENACC
       character(len=*), intent(inout) :: errmsg
-#else
-!Necessary since OpenACC does not support assumed-size arrays
-      character(len=200), intent(inout) :: errmsg
-#endif
       integer,          intent(inout) :: errflg
 
 !ADDITIONAL OUTPUT
@@ -378,7 +373,7 @@ SUBROUTINE SFCLAY_mynn(                           &
       errmsg = ''
 
 !$acc enter data copyin( dz8w,U3D,V3D,QV3D,QC3D,P3D,T3D,       &
-!$acc                       pattern_spp_sfc, errmsg)
+!$acc                       pattern_spp_sfc)
 
 !$acc enter data copyin( UST_WAT(:), UST_LND(:),  UST_ICE(:),     &
 !$acc                    MOL(:),     QFLX(:),     HFLX(:),        &
@@ -504,7 +499,7 @@ SUBROUTINE SFCLAY_mynn(                           &
 !$acc exit data copyout( UST_WAT(:), UST_LND(:),  UST_ICE(:),   &
 !$acc                    MOL(:),     QFLX(:),     HFLX(:),      &
 !$acc                    QSFC(:),    QSFC_WAT(:), QSFC_LND(:),  &
-!$acc                    QSFC_ICE(:), errmsg)
+!$acc                    QSFC_ICE(:))
 
 !$acc exit data delete( dz8w1d(:),   dz2w1d(:),   U1D(:),       &
 !$acc                   V1D(:),      U1D2(:),     V1D2(:),      &
@@ -666,14 +661,25 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
 !JOE-end
 
 ! CCPP error handling
-#ifndef _OPENACC
       character(len=*), intent(inout) :: errmsg
-#else
-! Necessary since OpenACC does not support assumed-size arrays
-      character(len=200), intent(inout) :: errmsg
-#endif
       integer,          intent(inout) :: errflg
 
+! Local fixed-size errmsg character array for error messages on accelerator
+! devices distinct from the host (e.g. GPUs). Necessary since OpenACC does
+! not support assumed-size (len=*) arrays like errmsg. Additional
+! device_errflg integer to denote when device_errmsg needs to be synced
+! with errmsg.
+      character(len=512) :: device_errmsg
+      integer            :: device_errflg
+
+! Special versions of the fixed-size errmsg character array for error messages
+! on the device and it's errflag counterpart. These are necessary to ensure
+! the return statements at lines 1417 and 2030 are executed only for this
+! special case, and not any and all error messages set on the device.
+      character(len=512) :: device_special_errmsg
+      integer            :: device_special_errflg
+
+
 !----------------------------------------------------------------
 ! LOCAL VARS
 !----------------------------------------------------------------
@@ -723,6 +729,10 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
       ! Initialize error-handling
       errflg = 0
       errmsg = ''
+      device_errflg = errflg
+      device_errmsg = errmsg
+      device_special_errflg = errflg
+      device_special_errmsg = errmsg
 !-------------------------------------------------------------------
 !$acc update device(psim_stab, psim_unstab, psih_stab, psih_unstab)
 
@@ -770,7 +780,9 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
 !$acc                   PSIT_lnd, PSIT_wat, PSIT_ice, &
 !$acc                   ch_lnd, ch_wat, ch_ice, &
 !$acc                   cm_lnd, cm_wat, cm_ice, &
-!$acc                   snowh_lnd, errmsg)
+!$acc                   snowh_lnd, &
+!$acc                   device_errmsg, device_errflg, &
+!$acc                   device_special_errmsg, device_special_errflg)
 
 !$acc parallel loop present(PSFCPA, PSFC, QSFC, T1D, flag_iter,               &
 !$acc                       QSFC_wat, QSFCMR_wat, wet, TSK_wat, tskin_wat,    &
@@ -1198,7 +1210,9 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
 !--------------------------------------------------------------------
 !--------------------------------------------------------------------
 
-!$acc parallel loop present(flag_iter, errmsg, &
+!$acc parallel loop present(flag_iter, &
+!$acc                    device_errmsg, device_errflg, &
+!$acc                    device_special_errmsg, device_special_errflg, &
 !$acc                    wet, dry, icy, &
 !$acc                    ZT_wat, ZT_lnd, ZT_ice, &
 !$acc                    ZNT_wat, ZNT_lnd, ZNT_ice, &
@@ -1330,7 +1344,7 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
              ENDIF
           ELSEIF ( ISFTCFLX .EQ. 4 ) THEN
              !GFS zt formulation
-             CALL GFS_zt_wat(ZT_wat(i),ZNTstoch_wat(i),restar,WSPD(i),ZA(i),sfc_z0_type,errmsg,errflg)
+             CALL GFS_zt_wat(ZT_wat(i),ZNTstoch_wat(i),restar,WSPD(i),ZA(i),sfc_z0_type,device_errmsg,device_errflg)
              ZQ_wat(i)=ZT_wat(i)
           ENDIF
        ELSE
@@ -1392,10 +1406,14 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
              ELSEIF ( IZ0TLND .EQ. 2 ) THEN
                 ! DH note - at this point, qstar is either not initialized
                 ! or initialized to zero, but certainly not set correctly
-                errmsg = 'Logic error: qstar is not set correctly when calling Yang_2008'
-                errflg = 1
+                device_special_errmsg = 'Logic error: qstar is not set correctly when calling Yang_2008'
+                device_special_errflg = 1
 #ifndef _OPENACC
 ! Necessary since OpenACC does not support branching in parallel code
+! Must sync errmsg and errflg with device_errmsg and device_errflg, respectively
+! so that proper error message and error flag codes are returned.
+                errmsg = device_special_errmsg
+                errflg = device_special_errflg
                 return
 #endif
                 CALL Yang_2008(ZNTSTOCH_lnd(i),ZT_lnd(i),ZQ_lnd(i),UST_lnd(i),MOL(I),&
@@ -2001,8 +2019,14 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
  ENDDO   ! end i-loop
 
 #ifdef _OPENACC
- ! Necessary since OpenACC does not support branching in parallel code
- IF (errflg == 1) THEN
+! Necessary since OpenACC does not support branching in parallel code.
+! Must sync host errflg, errmsg to determine if return must be triggered
+! and correct error message and error flag code returned.
+! This code is being executed on the HOST side only, pulling data from DEVICE.
+!$acc exit data copyout(device_special_errflg, device_special_errmsg)
+ IF (device_special_errflg /= 0) THEN
+    errflg = device_special_errflg
+    errmsg = device_special_errmsg
     return
  ENDIF
 #endif
@@ -2506,7 +2530,13 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
 !$acc                   PSIT_lnd,   PSIT_wat,   PSIT_ice,    &
 !$acc                   ch_lnd,     ch_wat,     ch_ice,      &
 !$acc                   cm_lnd,     cm_wat,     cm_ice,      &
-!$acc                   errmsg)
+!$acc                   device_errmsg, device_errflg)
+
+! Final sync of device and host error flags and messages
+IF (device_errflg /= 0) THEN
+    errflg = device_errflg
+    errmsg = device_errmsg
+ENDIF
 
 !$acc exit data delete( flag_iter, dry, wet, icy, dx,         &
 !$acc                   MAVAIL, PBLH, PSFCPA, z0pert, ztpert, &
@@ -3036,24 +3066,27 @@ SUBROUTINE GFS_z0_wat(z0rl_wat,ustar_wat,WSPD,z1,sfc_z0_type,redrag)
     END SUBROUTINE GFS_z0_wat
 !--------------------------------------------------------------------
 !>\ingroup mynn_sfc
-    SUBROUTINE GFS_zt_wat(ztmax,z0rl_wat,restar,WSPD,z1,sfc_z0_type,errmsg,errflg)
+    SUBROUTINE GFS_zt_wat(ztmax,z0rl_wat,restar,WSPD,z1,sfc_z0_type,device_errmsg,device_errflg)
         !$acc routine seq
         real(kind_phys), INTENT(OUT)  :: ztmax
         real(kind_phys), INTENT(IN)   :: wspd,z1,z0rl_wat,restar
         INTEGER, INTENT(IN)           :: sfc_z0_type
-#ifndef _OPENACC
-        character(len=*), intent(out) :: errmsg
-#else
-! Necessary since OpenACC does not support assumed-size arrays
-        character(len=200), intent(out) :: errmsg
-#endif
-        integer,          intent(out) :: errflg
+
+! Using device_errmsg and device_errflg rather than the CCPP errmsg and errflg
+! so that this subroutine can be run on an accelerator device with OpenACC.
+!        character(len=*), intent(out) :: errmsg
+!        integer,          intent(out) :: errflg
+        character(len=512), intent(out) :: device_errmsg
+        integer,            intent(out) :: device_errflg
+
         real(kind_phys)               :: z0,z0max,wind10m,rat,ustar_wat
         real(kind_phys), PARAMETER    :: charnock = 0.014, z0s_max=.317e-2
 
         ! Initialize error-handling
-        errflg = 0
-        errmsg = ''
+!        errflg = 0
+!        errmsg = ''
+        device_errflg = 0
+        device_errmsg = ''
 
 !            z0           = 0.01 * z0rl_wat
 !Already converted to meters in the wrapper
@@ -3084,8 +3117,10 @@ SUBROUTINE GFS_zt_wat(ztmax,z0rl_wat,restar,WSPD,z1,sfc_z0_type,errmsg,errflg)
               call znot_t_v7(wind10m, ztmax)   ! 10-m wind,m/s, ztmax(m)
             else if (sfc_z0_type > 0) then
               write(0,*)'no option for sfc_z0_type=',sfc_z0_type
-              errflg = 1
-              errmsg = 'ERROR(GFS_zt_wat): sfc_z0_type not valid.'
+!              errflg = 1
+!              errmsg = 'ERROR(GFS_zt_wat): sfc_z0_type not valid.'
+              device_errflg = 1
+              device_errmsg = 'ERROR(GFS_zt_wat): sfc_z0_type not valid.'
               return
 
             endif

From 36a313e91bd7089a3069a72d1326d200e4bbcde0 Mon Sep 17 00:00:00 2001
From: "Timothy S. Sliwinski" <Timothy.S.Sliwinski@noaa.gov>
Date: Mon, 28 Aug 2023 21:11:38 +0000
Subject: [PATCH 075/115] Removing preprocessor directives to re-enable print
 statements on GPU for debug and other conditions.

Original problem:
-----------------

Following feedback that debug information was still desirable for OpenACC device-
executed code where possible, this change removes all preprocessor directives which
were guarding against the compilation of statements which wrote to standard output.
These directives were originally used because debug statements and other standard
output had the potential to greatly reduce performance because of the need to copy over
certain variables from the host to the device just for debug output purposes. Additionally,
when statements were located within parallel-execution regions, the output was not
guaranteed to be presented in any specific order and the additional IF-branches in the
code also would have reduced performance as branching is not efficient when on SIMD
architectures.

Resolutions:
------------

However, with a bit of extra work, a few of these issues are alleviated to allow output to
work again as requested. First, on the data optimization side of the problem, the impact
of pulling in variables just for debugging was minimized by ensuring the data was pulled
in and resident on the GPU for the entire subroutine execution. While this increases the
memory footprint on the device which may have very limited memory, it reduces the data
transfer related performance hit. Next, in the cases where debug output was not within
parallel regions but still needing to be executed on the GPU to show the proper values
at that state of the overall program execution, OpenACC serial regions were used.
These allow the data to not have to be transferred off the GPU mid-execution of the
program just to be shown as debug output and also partially solve the problem of
out-of-order output. Since debug regions are guarded by IF blocks, these serial regions
do not significantly impact performance when debug output is turned off (debug_code=0).
However, slowdown is significant for any other debug-levels which should be acceptable
for debugging situations.

Performance Changes:
--------------------

Overall, these changes accomplish the goal of re-enabling debugging output, but not
completely without a cost. Overall runtime was slightly impacted on the GPU when tested
with 150k and 750k vertical columns (the value of ite used in the i-loops) and debugging
turned off (debug_code=0). For 150k columns, the GPU decreased in speed from the
original baseline of 22ms to 30ms. For 750k columns, the GPU decreased in speed from
the original baseline of 31ms to 70ms. The impact is greater for the larger number of
columns due to the impact of the number of times the mid-loop IF branches are
evaluated on the GPU. While these are slight declines in performance, these are still
significant speedups over the CPU-only tests (8.7x and 18.7x speedups for 150k and
750k, respectively).

Compilation Time Changes:
-------------------------

One additional noted observation regarding performance is compilation time. When all
debug output is disabled (debug_code=0), compilation time is approximately 90 seconds
with the additional serial blocks, IF-branches, and so forth as each of these require more
work from the OpenACC compiler to generate code for the GPU. This problem is
compounded when the debug_code option is increase to either 1 (some debug output)
or 2 (full debug output). At a value of 1, compilation time jumps up to approximately
12.5 minutes on the Hera GPU nodes. At a value of 2, compilation time increases further
to approximately 18.5 minutes on the same GPU nodes. The explanation for this is the
need for the OpenACC compiler to enable greater amounts of serial and branching code
that (again) are less optimal on the GPU and so the compiler must do more work to try
to optimize them as best it can.
---
 physics/module_sf_mynn.F90 | 112 ++++++++++++++++---------------------
 1 file changed, 49 insertions(+), 63 deletions(-)

diff --git a/physics/module_sf_mynn.F90 b/physics/module_sf_mynn.F90
index dd181c99c..eecc5493c 100644
--- a/physics/module_sf_mynn.F90
+++ b/physics/module_sf_mynn.F90
@@ -780,11 +780,11 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
 !$acc                   PSIT_lnd, PSIT_wat, PSIT_ice, &
 !$acc                   ch_lnd, ch_wat, ch_ice, &
 !$acc                   cm_lnd, cm_wat, cm_ice, &
-!$acc                   snowh_lnd, &
+!$acc                   snowh_lnd, snowh_wat, snowh_ice, &
 !$acc                   device_errmsg, device_errflg, &
 !$acc                   device_special_errmsg, device_special_errflg)
 
-!$acc parallel loop present(PSFCPA, PSFC, QSFC, T1D, flag_iter,               &
+!$acc parallel loop present(PSFCPA, PSFC, QSFC, T1D, flag_iter, tsurf_lnd,    &
 !$acc                       QSFC_wat, QSFCMR_wat, wet, TSK_wat, tskin_wat,    &
 !$acc                       QSFC_lnd, QSFCMR_lnd, dry, TSK_lnd, tskin_lnd,    &
 !$acc                       QSFC_ice, QSFCMR_ice, icy, TSK_ice, tskin_ice)
@@ -809,9 +809,7 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
                ENDIF
                QSFC_wat(I)=EP2*E1/(PSFC(I)-ep3*E1)             !specific humidity
                QSFCMR_wat(I)=EP2*E1/(PSFC(I)-E1)                !mixing ratio
-#ifndef _OPENACC
                IF(QSFC_wat(I)>1..or.QSFC_wat(I)<0.) print *,' QSFC_wat(I)',itimestep,i,QSFC_wat(I),TSK_wat(i)
-#endif
             ENDIF
             IF (dry(i)) THEN
               TSK_lnd(I) = tskin_lnd(i)
@@ -831,9 +829,7 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
                  QSFC_lnd(I)=0.5*(QSFC_lnd(I) + QSFC(I))
                  QSFCMR_lnd(I)=QSFC_lnd(I)/(1.-QSFC_lnd(I))       !mixing ratio
               endif ! lsm
-#ifndef _OPENACC
               IF(QSFC_lnd(I)>1..or.QSFC_lnd(I)<0.) print *,' QSFC_lnd(I)',itimestep,i,QSFC_lnd(I),Tskin_lnd(i),tsurf_lnd(i),qsfc(i)
-#endif
             ENDIF
             IF (icy(i)) THEN
               TSK_ice(I) = tskin_ice(i)
@@ -851,9 +847,7 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
                  QSFC_ice(I)=EP2*E1/(PSFC(I)-ep3*E1)             !specific humidity
                  QSFCMR_ice(I)=EP2*E1/(PSFC(I)-E1)                !mixing ratio
               endif ! lsm
-#ifndef _OPENACC
               IF(QSFC_ice(I)>1..or.QSFC_ice(I)<0.) print *,' QSFC_ice(I)',itimestep,i,QSFC_ice(I),TSK_ice(i)
-#endif
             ENDIF
 
          ELSE
@@ -906,7 +900,10 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
        endif ! flag_iter
       ENDDO
 
-#ifndef _OPENACC
+!$acc serial present(pblh, PSFCPA, dz8w1d, qflx, hflx,                       &
+!$acc      dry, tskin_lnd, tsurf_lnd, qsfc_lnd, znt_lnd, ust_lnd, snowh_lnd, &
+!$acc      icy, tskin_ice, tsurf_ice, qsfc_ice, znt_ice, ust_ice, snowh_ice, &
+!$acc      wet, tskin_wat, tsurf_wat, qsfc_wat, znt_wat, ust_wat, snowh_wat)
       IF (debug_code >= 1) THEN
         write(0,*)"ITIMESTEP=",ITIMESTEP," iter=",iter
         DO I=its,ite
@@ -931,12 +928,12 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
            ENDIF
         ENDDO
       ENDIF
-#endif
+!$acc end serial
 
 !$acc parallel loop present(PSFC, PSFCPA, QVSH, QV1D, THCON, flag_iter,        &
 !$acc       dry, tskin_lnd, TSK_lnd, tsurf_lnd, THSK_lnd, THVSK_lnd, qsfc_lnd, &
 !$acc       icy, tskin_ice, TSK_ice, tsurf_ice, THSK_ice, THVSK_ice, qsfc_ice, &
-!$acc       wet, tskin_wat, TSK_wat, tsurf_wat, THSK_wat, THVSK_wat)
+!$acc       wet, tskin_wat, TSK_wat, tsurf_wat, THSK_wat, THVSK_wat, qsfc_wat)
       DO I=its,ite
          ! PSFC ( in cmb) is used later in saturation checks
          PSFC(I)=PSFCPA(I)/1000.
@@ -950,10 +947,8 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
            ! CONVERT SKIN TEMPERATURES TO POTENTIAL TEMPERATURE:
            THSK_lnd(I) = TSK_lnd(I)*THCON(I)   !(K)
            THVSK_lnd(I) = THSK_lnd(I)*(1.+EP1*qsfc_lnd(I))
-#ifndef _OPENACC
            if(THVSK_lnd(I) < 170. .or. THVSK_lnd(I) > 360.) &
            print *,'THVSK_lnd(I)',itimestep,i,THVSK_lnd(I),THSK_lnd(i),tsurf_lnd(i),tskin_lnd(i),qsfc_lnd(i)
-#endif
          endif
          if(icy(i)) then
            TSK_ice(I) = tskin_ice(i)
@@ -961,10 +956,8 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
            ! CONVERT SKIN TEMPERATURES TO POTENTIAL TEMPERATURE:
            THSK_ice(I) = TSK_ice(I)*THCON(I)   !(K)
            THVSK_ice(I) = THSK_ice(I)*(1.+EP1*qsfc_ice(I))   !(K)
-#ifndef _OPENACC
            if(THVSK_ice(I) < 170. .or. THVSK_ice(I) > 360.) &
            print *,'THVSK_ice(I)',itimestep,i,THVSK_ice(I),THSK_ice(i),tsurf_ice(i),tskin_ice(i),qsfc_ice(i)
-#endif
          endif
          if(wet(i)) then
            TSK_wat(I) = tskin_wat(i)
@@ -972,10 +965,8 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
            ! CONVERT SKIN TEMPERATURES TO POTENTIAL TEMPERATURE:
            THSK_wat(I) = TSK_wat(I)*THCON(I)   !(K)
            THVSK_wat(I) = THSK_wat(I)*(1.+EP1*QVSH(I))   !(K)
-#ifndef _OPENACC
            if(THVSK_wat(I) < 170. .or. THVSK_wat(I) > 360.) &
            print *,'THVSK_wat(I)',i,THVSK_wat(I),THSK_wat(i),tsurf_wat(i),tskin_wat(i),qsfc_wat(i)
-#endif
          endif
         endif ! flag_iter
       ENDDO
@@ -1009,7 +1000,10 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
          HFX(i)=HFLX(i)*RHO1D(I)*cp
       ENDDO
 
-#ifndef _OPENACC
+!$acc serial present(THV1D, TV1D, RHO1D, GOVRTH, &
+!$acc                dry, tsk_lnd, thvsk_lnd,    &
+!$acc                icy, tsk_ice, thvsk_ice,    &
+!$acc                wet, tsk_wat, thvsk_wat)
       IF (debug_code ==2) THEN
         !write(*,*)"ITIMESTEP=",ITIMESTEP
         DO I=its,ite
@@ -1022,7 +1016,7 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
           write(*,*)"RHO1D=", RHO1D(i)," GOVRTH=",GOVRTH(i)
         ENDDO
       ENDIF
-#endif
+!$acc end serial
 
 !$acc parallel loop present(T1D,P1D,QGH,QV1D,CPM)
       DO I=its,ite
@@ -1042,7 +1036,10 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
          CPM(I)=CP*(1.+0.84*QV1D(I))
       ENDDO
 
-#ifndef _OPENACC
+!$acc serial present(QGH,                       &
+!$acc                wet, QSFC_wat, QSFCMR_wat, &
+!$acc                dry, QSFC_lnd, QSFCMR_lnd, &
+!$acc                icy, QSFC_ice, QSFCMR_ice)
       IF (debug_code == 2) THEN
          write(*,*)"ITIMESTEP=",ITIMESTEP
          DO I=its,ite
@@ -1060,7 +1057,7 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
             endif
          ENDDO
       ENDIF
-#endif
+!$acc end serial
 
 !$acc parallel loop present(flag_iter,U1D,V1D,WSPD,wet,dry,icy,    &
 !$acc                    THV1D,THVSK_wat,THVSK_lnd,THVSK_ice,   &
@@ -1182,7 +1179,6 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
          WSPD(I) = MAX(WSPD_ice,WSPD_wat)
          WSPD(I) = MAX(WSPD_lnd,WSPD(I))
 
-#ifndef _OPENACC
          IF (debug_code == 2) THEN
             write(*,*)"===== After rb calc in mynn sfc layer:"
             write(*,*)"ITIMESTEP=",ITIMESTEP
@@ -1191,7 +1187,6 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
             IF (wet(i))write(*,*)"rb_wat=", rb_wat(I)," DTHVDZ=",DTHVDZ
             IF (dry(i))write(*,*)"rb_lnd=", rb_lnd(I)," DTHVDZ=",DTHVDZ
          ENDIF
-#endif
 
          ! IF PREVIOUSLY UNSTABLE, DO NOT LET INTO REGIMES 1 AND 2 (STABLE)
          !if (itimestep .GT. 1) THEN
@@ -1210,7 +1205,7 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
 !--------------------------------------------------------------------
 !--------------------------------------------------------------------
 
-!$acc parallel loop present(flag_iter, &
+!$acc parallel loop present(flag_iter, PSFCPA, dz8w1d, pblh, &
 !$acc                    device_errmsg, device_errflg, &
 !$acc                    device_special_errmsg, device_special_errflg, &
 !$acc                    wet, dry, icy, &
@@ -1219,8 +1214,10 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
 !$acc                    ZNTstoch_wat, ZNTstoch_lnd, ZNTstoch_ice, &
 !$acc                    UST_wat, UST_lnd, UST_ice, &
 !$acc                    ZQ_wat, ZQ_lnd, ZQ_ice, &
-!$acc                    snowh_lnd, &
+!$acc                    snowh_wat, snowh_lnd, snowh_ice, &
 !$acc                    THVSK_wat, THVSK_lnd, THVSK_ice, &
+!$acc                    tskin_wat, tskin_lnd, tskin_ice, &
+!$acc                    tsurf_wat, tsurf_lnd, tsurf_ice, &
 !$acc                    qsfc_wat, qsfc_lnd, qsfc_ice, &
 !$acc                    GZ1OZ0_wat, GZ1OZt_wat, GZ2OZ0_wat, GZ2OZt_wat, GZ10OZ0_wat, GZ10OZt_wat, &
 !$acc                    GZ1OZ0_lnd, GZ1OZt_lnd, GZ2OZ0_lnd, GZ2OZt_lnd, GZ10OZ0_lnd, GZ10OZt_lnd, &
@@ -1228,12 +1225,14 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
 !$acc                    zratio_wat, zratio_lnd, zratio_ice, &
 !$acc                    stress_wat, stress_lnd, stress_ice, &
 !$acc                    rb_wat, rb_lnd, rb_ice, &
+!$acc                    qflx, qflx_lnd, &
+!$acc                    hflx, hflx_lnd, &
 !$acc                    psim, psih, psim10, psih10, psih2, &
 !$acc                    psix_wat, psix10_wat, psit_wat, psit2_wat, psiq_wat, psiq2_wat, &
 !$acc                    psix_lnd, psix10_lnd, psit_lnd, psit2_lnd, psiq_lnd, psiq2_lnd, &
 !$acc                    psix_ice, psix10_ice, psit_ice, psit2_ice, psiq_ice, psiq2_ice, &
 !$acc                    WSPD, WSPDI, U1D, V1D, TC1D, THV1D, rstoch1D, USTM, ZA, ZOL, QVSH, &
-!$acc                    shdmax, vegtype, z0pert, ztpert, mol, rmol, qstar, sigmaf)
+!$acc                    shdmax, vegtype, z0pert, ztpert, mol, rmol, wstar, qstar, sigmaf)
 
  DO I=its,ite
    if( flag_iter(i) ) then
@@ -1250,12 +1249,12 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
        if (sfc_z0_type >= 0) then ! Avoid calculation is using wave model
           ! CALCULATE z0 (znt)
           !--------------------------------------
-#ifndef _OPENACC
+
           IF (debug_code == 2) THEN
             write(*,*)"=============Input to ZNT over water:"
             write(*,*)"u*:",UST_wat(i)," wspd=",WSPD(i)," visc=",visc," za=",ZA(I)
           ENDIF
-#endif
+
           IF ( PRESENT(ISFTCFLX) ) THEN
              IF ( ISFTCFLX .EQ. 0 ) THEN
                 IF (COARE_OPT .EQ. 3.0) THEN
@@ -1292,12 +1291,10 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
           ZNTstoch_wat(I)  = ZNT_wat(I)
        endif
 
-#ifndef _OPENACC
        IF (debug_code > 1) THEN
           write(*,*)"==========Output ZNT over water:"
           write(*,*)"ZNT:",ZNTstoch_wat(i)
        ENDIF
-#endif
 
        !COMPUTE ROUGHNESS REYNOLDS NUMBER (restar) USING NEW ZNT
        ! AHW: Garrattt formula: Calculate roughness Reynolds number
@@ -1308,12 +1305,10 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
        !--------------------------------------
        !CALCULATE z_t and z_q
        !--------------------------------------
-#ifndef _OPENACC
        IF (debug_code > 1) THEN
           write(*,*)"=============Input to ZT over water:"
           write(*,*)"u*:",UST_wat(i)," restar=",restar," visc=",visc
        ENDIF
-#endif
 
        IF ( PRESENT(ISFTCFLX) ) THEN
           IF ( ISFTCFLX .EQ. 0 ) THEN
@@ -1357,12 +1352,11 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
                                     rstoch1D(i),spp_sfc)
           ENDIF
        ENDIF
-#ifndef _OPENACC
+
        IF (debug_code > 1) THEN
          write(*,*)"=============Output ZT & ZQ over water:"
          write(*,*)"ZT:",ZT_wat(i)," ZQ:",ZQ_wat(i)
        ENDIF
-#endif
 
        GZ1OZ0_wat(I)= LOG((ZA(I)+ZNTstoch_wat(I))/ZNTstoch_wat(I))
        GZ1OZt_wat(I)= LOG((ZA(I)+ZNTstoch_wat(i))/ZT_wat(i))
@@ -1433,7 +1427,6 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
           ENDIF
        ENDIF
 
-#ifndef _OPENACC
        IF (ZNTstoch_lnd(i) < 1E-8 .OR. Zt_lnd(i) < 1E-10) THEN
          write(0,*)"===(land) capture bad input in mynn sfc layer, i=:",i
          write(0,*)" ZNT=", ZNTstoch_lnd(i)," ZT=",Zt_lnd(i)
@@ -1442,7 +1435,6 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
          " ust=", ust_lnd(i)," snowh=", snowh_lnd(i),"psfcpa=",PSFCPA(i), &
          " dz=",dz8w1d(i)," qflx=",qflx_lnd(i)," hflx=",hflx_lnd(i)," hpbl=",pblh(i)
        ENDIF
-#endif
 
        GZ1OZ0_lnd(I)= LOG((ZA(I)+ZNTstoch_lnd(I))/ZNTstoch_lnd(I))
        GZ1OZt_lnd(I)= LOG((ZA(I)+ZNTstoch_lnd(i))/ZT_lnd(i))
@@ -1508,7 +1500,6 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
              ZOL(I)=MAX(ZOL(I),0.0_kind_phys)
              ZOL(I)=MIN(ZOL(I),20._kind_phys)
 
-#ifndef _OPENACC
              IF (debug_code >= 1) THEN
                IF (ZNTstoch_wat(i) < 1E-8 .OR. Zt_wat(i) < 1E-10) THEN
                  write(0,*)"===(wet) capture bad input in mynn sfc layer, i=:",i
@@ -1519,7 +1510,6 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
                  " dz=",dz8w1d(i)," qflx=",qflx(i)," hflx=",hflx(i)," hpbl=",pblh(i)
                ENDIF
              ENDIF
-#endif
 
              !Use Pedros iterative function to find z/L
              !zol(I)=zolri(rb_wat(I),ZA(I),ZNTstoch_wat(I),ZT_wat(I),ZOL(I),psi_opt)
@@ -1577,7 +1567,6 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
              ZOL(I)=MAX(ZOL(I),-20.0_kind_phys)
              ZOL(I)=MIN(ZOL(I),0.0_kind_phys)
 
-#ifndef _OPENACC
              IF (debug_code >= 1) THEN
                IF (ZNTstoch_wat(i) < 1E-8 .OR. Zt_wat(i) < 1E-10) THEN
                  write(0,*)"===(wet) capture bad input in mynn sfc layer, i=:",i
@@ -1588,7 +1577,6 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
                  " dz=",dz8w1d(i)," qflx=",qflx(i)," hflx=",hflx(i)," hpbl=",pblh(i)
                ENDIF
              ENDIF
-#endif
 
              !Use Pedros iterative function to find z/L
              !zol(I)=zolri(rb_wat(I),ZA(I),ZNTstoch_wat(I),ZT_wat(I),ZOL(I),psi_opt)
@@ -1649,7 +1637,6 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
              ZOL(I)=MAX(ZOL(I),0.0_kind_phys)
              ZOL(I)=MIN(ZOL(I),20._kind_phys)
 
-#ifndef _OPENACC
              IF (debug_code >= 1) THEN
                IF (ZNTstoch_lnd(i) < 1E-8 .OR. Zt_lnd(i) < 1E-10) THEN
                  write(0,*)"===(land) capture bad input in mynn sfc layer, i=:",i
@@ -1660,7 +1647,6 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
                  " dz=",dz8w1d(i)," qflx=",qflx(i)," hflx=",hflx(i)," hpbl=",pblh(i)
                ENDIF
              ENDIF
-#endif
 
              !Use Pedros iterative function to find z/L
              !zol(I)=zolri(rb_lnd(I),ZA(I),ZNTstoch_lnd(I),ZT_lnd(I),ZOL(I),psi_opt)
@@ -1717,7 +1703,6 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
              ZOL(I)=MAX(ZOL(I),-20.0_kind_phys)
              ZOL(I)=MIN(ZOL(I),0.0_kind_phys)
 
-#ifndef _OPENACC
              IF (debug_code >= 1) THEN
                IF (ZNTstoch_lnd(i) < 1E-8 .OR. Zt_lnd(i) < 1E-10) THEN
                  write(0,*)"===(land) capture bad input in mynn sfc layer, i=:",i
@@ -1728,7 +1713,6 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
                  " dz=",dz8w1d(i)," qflx=",qflx(i)," hflx=",hflx(i)," hpbl=",pblh(i)
                ENDIF
              ENDIF
-#endif
 
              !Use Pedros iterative function to find z/L
              !zol(I)=zolri(rb_lnd(I),ZA(I),ZNTstoch_lnd(I),ZT_lnd(I),ZOL(I),psi_opt)
@@ -1788,7 +1772,6 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
              ZOL(I)=MAX(ZOL(I),0.0_kind_phys)
              ZOL(I)=MIN(ZOL(I),20._kind_phys)
 
-#ifndef _OPENACC
              IF (debug_code >= 1) THEN
                IF (ZNTstoch_ice(i) < 1E-8 .OR. Zt_ice(i) < 1E-10) THEN
                  write(0,*)"===(ice) capture bad input in mynn sfc layer, i=:",i
@@ -1799,7 +1782,6 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
                  " dz=",dz8w1d(i)," qflx=",qflx(i)," hflx=",hflx(i)," hpbl=",pblh(i)
                ENDIF
              ENDIF
-#endif
 
              !Use Pedros iterative function to find z/L
              !zol(I)=zolri(rb_ice(I),ZA(I),ZNTstoch_ice(I),ZT_ice(I),ZOL(I),psi_opt)
@@ -1856,7 +1838,6 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
              ZOL(I)=MAX(ZOL(I),-20.0_kind_phys)
              ZOL(I)=MIN(ZOL(I),0.0_kind_phys)
 
-#ifndef _OPENACC
              IF (debug_code >= 1) THEN
                IF (ZNTstoch_ice(i) < 1E-8 .OR. Zt_ice(i) < 1E-10) THEN
                  write(0,*)"===(ice) capture bad input in mynn sfc layer, i=:",i
@@ -1867,7 +1848,6 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
                  " dz=",dz8w1d(i)," qflx=",qflx(i)," hflx=",hflx(i)," hpbl=",pblh(i)
                ENDIF
              ENDIF
-#endif
 
              !Use Pedros iterative function to find z/L
              !zol(I)=zolri(rb_ice(I),ZA(I),ZNTstoch_ice(I),ZT_ice(I),ZOL(I),psi_opt)
@@ -2031,7 +2011,13 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
  ENDIF
 #endif
 
-#ifndef _OPENACC
+!$acc serial present(wet, dry, icy,                  &
+!$acc        PSIM, PSIH, CPM, RHO1D, ZOL, wspd, MOL, &
+!$acc        wstar, qstar, THV1D, HFX, MAVAIL, QVSH, &
+!$acc         THVSK_wat,    THVSK_lnd,    THVSK_ice, &
+!$acc           UST_wat,      UST_lnd,      UST_ice, &
+!$acc      ZNTstoch_wat, ZNTstoch_lnd, ZNTstoch_ice, &
+!$acc            zt_wat,       zt_lnd,       zt_ice)
  IF (debug_code == 2) THEN
     DO I=its,ite
        IF(wet(i))write(*,*)"==== AT END OF MAIN LOOP, i=",i, "(wet)"
@@ -2052,7 +2038,7 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
        write(*,*)"============================================="
     ENDDO ! end i-loop
  ENDIF
-#endif
+!$acc end serial
 
    !----------------------------------------------------------
    !  COMPUTE SURFACE HEAT AND MOISTURE FLUXES
@@ -2238,14 +2224,12 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
 
       ENDIF
 
-#ifndef _OPENACC
       IF (debug_code > 1) THEN
          write(*,*)"QFX=",QFX(I),"FLQC=",FLQC(I)
          if(icy(i))write(*,*)"ice, MAVAIL:",MAVAIL(I)," u*=",UST_ice(I)," psiq=",PSIQ_ice(i)
          if(dry(i))write(*,*)"lnd, MAVAIL:",MAVAIL(I)," u*=",UST_lnd(I)," psiq=",PSIQ_lnd(i)
          if(wet(i))write(*,*)"ocn, MAVAIL:",MAVAIL(I)," u*=",UST_wat(I)," psiq=",PSIQ_wat(i)
       ENDIF
-#endif
 
       ! The exchange coefficient for cloud water is assumed to be the
       ! same as that for heat. CH is multiplied by WSPD.
@@ -2397,17 +2381,17 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
 !-----------------------------------------------------
 ! DEBUG - SUSPICIOUS VALUES
 !-----------------------------------------------------
+!$acc serial present(dry, wet, icy, CPM, MAVAIL, &
+!$acc       HFX, LH, wstar, RHO1D, PBLH, ZOL, ZA, MOL, &
+!$acc       PSIM, PSIH, WSTAR, T1D, TH1D, THV1D, QVSH, &
+!$acc       UST_wat, UST_lnd, UST_ice, &
+!$acc       THSK_wat, THSK_lnd, THSK_ice, &
+!$acc       THVSK_wat, THVSK_lnd, THVSK_ice, &
+!$acc       ZNTstoch_wat, ZNTstoch_lnd, ZNTstoch_ice, &
+!$acc       ZT_wat, ZT_lnd, ZT_ice, &
+!$acc       QSFC_wat, QSFC_lnd, QSFC_ice, &
+!$acc       PSIX_wat, PSIX_lnd, PSIX_ice)
 IF ( debug_code == 2) THEN
-   !$acc parallel loop present(dry, wet, icy, CPM, MAVAIL, &
-   !$acc                    HFX, LH, wstar, RHO1D, PBLH, ZOL, ZA, MOL, &
-   !$acc                    PSIM, PSIH, WSTAR, T1D, TH1D, THV1D, QVSH, &
-   !$acc                    UST_wat, UST_lnd, UST_ice, &
-   !$acc                    THSK_wat, THSK_lnd, THSK_ice, &
-   !$acc                    THVSK_wat, THVSK_lnd, THVSK_ice, &
-   !$acc                    ZNTstoch_wat, ZNTstoch_lnd, ZNTstoch_ice, &
-   !$acc                    ZT_wat, ZT_lnd, ZT_ice, &
-   !$acc                    QSFC_wat, QSFC_lnd, QSFC_ice, &
-   !$acc                    PSIX_wat, PSIX_lnd, PSIX_ice)
    DO I=its,ite
       yesno = 0
       IF (compute_flux) THEN
@@ -2511,6 +2495,7 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
       ENDIF
     ENDDO ! end i-loop
  ENDIF ! end debug option
+!$acc end serial
 
 !$acc exit data copyout(CPM, FLHC, FLQC, CHS, CH, CHS2, CQS2,&
 !$acc                   USTM, wstar, qstar, ZOL, MOL, RMOL,  &
@@ -2542,7 +2527,8 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter,                            &
 !$acc                   MAVAIL, PBLH, PSFCPA, z0pert, ztpert, &
 !$acc                   QV1D, U1D, V1D, U1D2, V1D2, T1D, P1D, &
 !$acc                   rstoch1D, sigmaf, shdmax, vegtype,    &
-!$acc                   dz2w1d, dz8w1d, snowh_lnd,            &
+!$acc                   dz2w1d, dz8w1d,                       &
+!$acc                   snowh_wat, snowh_lnd, snowh_ice,      &
 !$acc                   tskin_wat, tskin_lnd, tskin_ice,      &
 !$acc                   tsurf_wat, tsurf_lnd, tsurf_ice)
 

From 315d3cc74f5d5edad379f9968c361f5f3c513725 Mon Sep 17 00:00:00 2001
From: Samuel Trahan <Samuel.Trahan@noaa.gov>
Date: Wed, 6 Sep 2023 00:17:12 -0600
Subject: [PATCH 076/115] stop FV3_HRRR_c3 from crashing with gnu debug

---
 physics/cu_c3_deep.F90 | 298 ++++++++++++++++++++---------------------
 physics/cu_c3_sh.F90   |  22 +--
 2 files changed, 160 insertions(+), 160 deletions(-)

diff --git a/physics/cu_c3_deep.F90 b/physics/cu_c3_deep.F90
index c3a4b2c4e..7927f1cfb 100644
--- a/physics/cu_c3_deep.F90
+++ b/physics/cu_c3_deep.F90
@@ -159,12 +159,12 @@ subroutine cu_c3_deep_run(        &
         nranflag,itf,ktf,its,ite, kts,kte,ipr,imid
      integer, intent (in   )              ::                &
         ichoice
-     real(kind=kind_phys),  dimension (its:ite,4)                 &
+     real(kind=kind_phys),  dimension (its:,:)                 &
         ,intent (in  )                   ::  rand_clos
-     real(kind=kind_phys),  dimension (its:ite)                   &
+     real(kind=kind_phys),  dimension (its:)                   &
         ,intent (in  )                   ::  rand_mom,rand_vmas
 !$acc declare copyin(rand_clos,rand_mom,rand_vmas)
-     real(kind=kind_phys), intent(in), dimension (its:ite) :: ca_deep(:)
+     real(kind=kind_phys), intent(in), dimension (its:) :: ca_deep(:)
      integer, intent(in) :: do_capsuppress
      real(kind=kind_phys), intent(in), dimension(:) :: cap_suppress_j
 !$acc declare create(cap_suppress_j)
@@ -177,28 +177,28 @@ subroutine cu_c3_deep_run(        &
   ! outq   = output q tendency (per s)
   ! outqc  = output qc tendency (per s)
   ! pre    = output precip
-     real(kind=kind_phys),    dimension (its:ite,kts:kte)                              &
+     real(kind=kind_phys),    dimension (its:,kts:)                              &
         ,intent (inout  )                   ::                         &
         cnvwt,outu,outv,outt,outq,outqc,cupclw
-     real(kind=kind_phys),    dimension (its:ite)                                      &
+     real(kind=kind_phys),    dimension (its:)                                      &
         ,intent (out    )                   ::                         &
         frh_out,rainevap
-     real(kind=kind_phys),    dimension (its:ite,kts:kte)                              &
+     real(kind=kind_phys),    dimension (its:,kts:)                              &
         ,intent (in  )                      ::                         &
         tmf, qmicro, sigmain, forceqv_spechum
-     real(kind=kind_phys),    dimension (its:ite)                                      &
+     real(kind=kind_phys),    dimension (its:)                                      &
         ,intent (inout  )                   ::                         &
         pre,xmb_out
 !$acc declare copy(cnvwt,outu,outv,outt,outq,outqc,cupclw,frh_out,pre,xmb_out)
-     real(kind=kind_phys),    dimension (its:ite)                                      &
+     real(kind=kind_phys),    dimension (its:)                                      &
         ,intent (in  )                   ::                            &
         hfx,qfx,xmbm_in,xmbs_in
 !$acc declare copyin(hfx,qfx,xmbm_in,xmbs_in)
-     integer,    dimension (its:ite)                                   &
+     integer,    dimension (its:)                                   &
         ,intent (inout  )                ::                            &
         kbcon,ktop
 !$acc declare copy(kbcon,ktop)
-     integer,    dimension (its:ite)                                   &
+     integer,    dimension (its:)                                   &
         ,intent (in  )                   ::                            &
         kpbl,tropics
 !$acc declare copyin(kpbl,tropics)
@@ -207,26 +207,26 @@ subroutine cu_c3_deep_run(        &
   ! omega (omeg), windspeed (us,vs), and a flag (ierr) to turn off
   ! convection for this call only and at that particular gridpoint
   !
-     real(kind=kind_phys),    dimension (its:ite,kts:kte)                              &
+     real(kind=kind_phys),    dimension (its:,kts:)                              &
         ,intent (in   )                   ::                           &
         dhdt,rho,t,po,us,vs,tn,delp
 !$acc declare copyin(dhdt,rho,t,po,us,vs,tn)
-     real(kind=kind_phys),    dimension (its:ite,kts:kte)                              &
+     real(kind=kind_phys),    dimension (its:,kts:)                              &
         ,intent (inout   )                ::                           &
         omeg
 !$acc declare copy(omeg)
-     real(kind=kind_phys),    dimension (its:ite,kts:kte)                              &
+     real(kind=kind_phys),    dimension (its:,kts:)                              &
         ,intent (inout)                   ::                           &
          q,qo,zuo,zdo,zdm
 !$acc declare sigmaout                                                                                                                                                      
-     real(kind=kind_phys),    dimension (its:ite,kts:kte)                              &
+     real(kind=kind_phys),    dimension (its:,kts:)                              &
         ,intent (out)                     ::                           &
          sigmaout
-     real(kind=kind_phys), dimension (its:ite)                                         &
+     real(kind=kind_phys), dimension (its:)                                         &
         ,intent (in   )                   ::                           &
         dx,z1,psur,xland
 !$acc declare copyin(dx,z1,psur,xland)
-     real(kind=kind_phys), dimension (its:ite)                                         &
+     real(kind=kind_phys), dimension (its:)                                         &
         ,intent (inout   )                ::                           &
         mconv,ccn
 !$acc declare copy(mconv,ccn)
@@ -372,8 +372,8 @@ subroutine cu_c3_deep_run(        &
 !$acc       kzdown,kdet,k22,jmin,kstabi,kstabm,k22x,xland1,              &
 !$acc       ktopdby,kbconx,ierr2,ierr3,kbmax)
 
-     integer,  dimension (its:ite), intent(inout) :: ierr
-     integer,  dimension (its:ite), intent(in) :: csum
+     integer,  dimension (its:), intent(inout) :: ierr
+     integer,  dimension (its:), intent(in) :: csum
      logical, intent(in) :: do_ca, progsigma
      logical, intent(in) :: flag_init, flag_restart
 !$acc declare copy(ierr) copyin(csum)
@@ -421,7 +421,7 @@ subroutine cu_c3_deep_run(        &
 !$acc                tn_bl, qo_bl, qeso_bl, heo_bl, heso_bl,            &
 !$acc                qeso_cup_bl,qo_cup_bl, heo_cup_bl,heso_cup_bl,     &
 !$acc                gammao_cup_bl,tn_cup_bl,hco_bl,dbyo_bl,xf_dicycle)
-     real(kind=kind_phys), intent(inout), dimension(its:ite,10) :: forcing
+     real(kind=kind_phys), intent(inout), dimension(its:,:) :: forcing
 !$acc declare copy(forcing)
      integer :: turn,pmin_lev(its:ite),start_level(its:ite),ktopkeep(its:ite)
      real(kind=kind_phys),    dimension (its:ite,kts:kte) :: dtempdz
@@ -2418,16 +2418,16 @@ subroutine rain_evap_below_cloudbase(itf,ktf, its,ite, kts,kte,ierr,    &
 
 
    integer                           ,intent(in)    :: itf,ktf, its,ite, kts,kte
-   integer, dimension(its:ite)       ,intent(in)    :: ierr,kbcon
-   real(kind=kind_phys), dimension(its:ite)        ,intent(in)    ::psur,xland,pwavo,edto,pwevo,xmb
-   real(kind=kind_phys), dimension(its:ite,kts:kte),intent(in)    :: po_cup,qo_cup,qes_cup
-   real(kind=kind_phys), dimension(its:ite)        ,intent(inout) :: pre
-   real(kind=kind_phys), dimension(its:ite,kts:kte),intent(inout) :: outt,outq  !,outbuoy
+   integer, dimension(its:)       ,intent(in)    :: ierr,kbcon
+   real(kind=kind_phys), dimension(its:)        ,intent(in)    ::psur,xland,pwavo,edto,pwevo,xmb
+   real(kind=kind_phys), dimension(its:,kts:),intent(in)    :: po_cup,qo_cup,qes_cup
+   real(kind=kind_phys), dimension(its:)        ,intent(inout) :: pre
+   real(kind=kind_phys), dimension(its:,kts:),intent(inout) :: outt,outq  !,outbuoy
 !$acc declare copyin(ierr,kbcon,psur,xland,pwavo,edto,pwevo,xmb,po_cup,qo_cup,qes_cup)
 !$acc declare copy(pre,outt,outq)
 
-  !real,    dimension(its:ite)        ,intent(out)      :: tot_evap_bcb
-  !real,    dimension(its:ite,kts:kte),intent(out) :: evap_bcb,net_prec_bcb
+  !real,    dimension(its:)        ,intent(out)      :: tot_evap_bcb
+  !real,    dimension(its:,kts:),intent(out) :: evap_bcb,net_prec_bcb
 
   !-- locals
    integer :: i,k
@@ -2511,30 +2511,30 @@ subroutine cup_dd_edt(ierr,us,vs,z,ktop,kbcon,edt,p,pwav,            &
   !
   ! ierr error value, maybe modified in this routine
   !
-     real(kind=kind_phys),    dimension (its:ite,kts:kte)                    &
+     real(kind=kind_phys),    dimension (its:,kts:)                    &
         ,intent (in   )                   ::                 &
         rho,us,vs,z,p,pw
-     real(kind=kind_phys),    dimension (its:ite,1)                          &
+     real(kind=kind_phys),    dimension (its:,: )                          &
         ,intent (out  )                   ::                 &
         edtc
-     real(kind=kind_phys),    dimension (its:ite)                            &
+     real(kind=kind_phys),    dimension (its:)                            &
         ,intent (out )                    ::                 &
         pefc
-     real(kind=kind_phys),    dimension (its:ite)                            &
+     real(kind=kind_phys),    dimension (its:)                            &
         ,intent (out  )                   ::                 &
         edt
-     real(kind=kind_phys),    dimension (its:ite)                            &
+     real(kind=kind_phys),    dimension (its:)                            &
         ,intent (in   )                   ::                 &
         pwav,pwev,psum2,psumh,edtmax,edtmin
-     integer, dimension (its:ite)                            &
+     integer, dimension (its:)                            &
         ,intent (in   )                   ::                 &
         ktop,kbcon,xland1
      real(kind=kind_phys),    intent (in  ) ::               &                 !HCB
         ccnclean
-     real(kind=kind_phys),    dimension (its:ite)            &
+     real(kind=kind_phys),    dimension (its:)            &
         ,intent (inout )                   ::                &
         ccn
-     integer, dimension (its:ite)                            &
+     integer, dimension (its:)                            &
         ,intent (inout)                   ::                 &
         ierr
 !$acc declare copyin(rho,us,vs,z,p,pw,pwav,pwev,psum2,psumh,edtmax,edtmin,ktop,kbcon)
@@ -2671,7 +2671,7 @@ subroutine cup_dd_moisture(ierrc,zd,hcd,hes_cup,qcd,qes_cup,  &
   ! pwev = total normalized integrated evaoprate (i2)
   ! entr= entrainment rate 
   !
-     real(kind=kind_phys),    dimension (its:ite,kts:kte)               &
+     real(kind=kind_phys),    dimension (its:,kts:)               &
         ,intent (in   )                   ::            &
         zd,hes_cup,hcd,qes_cup,q_cup,z_cup,             &
         dd_massentr,dd_massdetr,gamma_cup,q,he,p_cup
@@ -2679,18 +2679,18 @@ subroutine cup_dd_moisture(ierrc,zd,hcd,hes_cup,qcd,qes_cup,  &
      integer                                            &
         ,intent (in   )                   ::            &
         iloop
-     integer, dimension (its:ite)                       &
+     integer, dimension (its:)                       &
         ,intent (in   )                   ::            &
         jmin
 !$acc declare copyin(jmin)
-     integer, dimension (its:ite)                       &
+     integer, dimension (its:)                       &
         ,intent (inout)                   ::            &
         ierr
 !$acc declare copy(ierr)
-     real(kind=kind_phys),    dimension (its:ite,kts:kte)&
+     real(kind=kind_phys),    dimension (its:,kts:)&
         ,intent (out  )                   ::            &
         qcd,qrcd,pwd
-     real(kind=kind_phys),    dimension (its:ite)&
+     real(kind=kind_phys),    dimension (its:)&
         ,intent (out  )                   ::            &
         pwev,bu
 !$acc declare copyout(qcd,qrcd,pwd,pwev,bu)
@@ -2812,23 +2812,23 @@ subroutine cup_env(z,qes,he,hes,t,q,p,z1,                &
         its,ite, kts,kte
   !
   !
-     real(kind=kind_phys),    dimension (its:ite,kts:kte)                &
+     real(kind=kind_phys),    dimension (its:,kts:)                &
         ,intent (in   )                   ::             &
         p,t,q
 !$acc declare copyin(p,t,q)
-     real(kind=kind_phys),    dimension (its:ite,kts:kte)                &
+     real(kind=kind_phys),    dimension (its:,kts:)                &
         ,intent (out  )                   ::             &
         hes,qes
 !$acc declare copyout(hes,qes)
-     real(kind=kind_phys),    dimension (its:ite,kts:kte)                &
+     real(kind=kind_phys),    dimension (its:,kts:)                &
         ,intent (inout)                   ::             &
         he,z
 !$acc declare copy(he,z)
-     real(kind=kind_phys),    dimension (its:ite)                        &
+     real(kind=kind_phys),    dimension (its:)                        &
         ,intent (in   )                   ::             &
         psur,z1
 !$acc declare copyin(psur,z1)
-     integer, dimension (its:ite)                        &
+     integer, dimension (its:)                        &
         ,intent (inout)                   ::             &
         ierr
 !$acc declare copy(ierr)
@@ -2966,19 +2966,19 @@ subroutine cup_env_clev(t,qes,q,he,hes,z,p,qes_cup,q_cup,        &
         itf,ktf,                                                    &
         its,ite, kts,kte
   !
-     real(kind=kind_phys),    dimension (its:ite,kts:kte)                        &
+     real(kind=kind_phys),    dimension (its:,kts:)                        &
         ,intent (in   )                   ::                     &
         qes,q,he,hes,z,p,t
 !$acc declare copyin(qes,q,he,hes,z,p,t)
-     real(kind=kind_phys),    dimension (its:ite,kts:kte)                        &
+     real(kind=kind_phys),    dimension (its:,kts:)                        &
         ,intent (out  )                   ::                     &
         qes_cup,q_cup,he_cup,hes_cup,z_cup,p_cup,gamma_cup,t_cup
 !$acc declare copyout(qes_cup,q_cup,he_cup,hes_cup,z_cup,p_cup,gamma_cup,t_cup)
-     real(kind=kind_phys),    dimension (its:ite)                                &
+     real(kind=kind_phys),    dimension (its:)                                &
         ,intent (in   )                   ::                     &
         psur,z1
 !$acc declare copyin(psur,z1)
-     integer, dimension (its:ite)                                &
+     integer, dimension (its:)                                &
         ,intent (inout)                   ::                     &
         ierr
 !$acc declare copy(ierr)
@@ -3077,33 +3077,33 @@ subroutine cup_forcing_ens_3d(closure_n,xland,aa0,aa1,xaa0,mbdt,dtime,ierr,ierr2
   ! k22         = updraft originating level
   ! ichoice       = flag if only want one closure (usually set to zero!)
   !
-     real(kind=kind_phys),    dimension (its:ite,1:maxens3)                            &
+     real(kind=kind_phys),    dimension (its:,1:)                            &
         ,intent (inout)                   ::                           &
         pr_ens
-     real(kind=kind_phys),    dimension (its:ite,1:maxens3)                            &
+     real(kind=kind_phys),    dimension (its:,1:)                            &
         ,intent (inout  )                 ::                           &
         xf_ens
 !$acc declare copy(pr_ens,xf_ens)
-     real(kind=kind_phys),    dimension (its:ite,kts:kte)                              &
+     real(kind=kind_phys),    dimension (its:,kts:)                              &
         ,intent (in   )                   ::                           &
         zd,zu,p_cup,zdm
-     real(kind=kind_phys),    dimension (its:ite,kts:kte)                              &
+     real(kind=kind_phys),    dimension (its:,kts:)                              &
         ,intent (in   )                   ::                           &
         omeg
-     real(kind=kind_phys),    dimension (its:ite,1)                                    &
+     real(kind=kind_phys),    dimension (its:,:)                                    &
         ,intent (in   )                   ::                           &
         xaa0
-     real(kind=kind_phys),    dimension (its:ite,4)                                    &
+     real(kind=kind_phys),    dimension (its:,:)                                    &
         ,intent (in   )                   ::                           &
        rand_clos 
-     real(kind=kind_phys),    dimension (its:ite)                                      &
+     real(kind=kind_phys),    dimension (its:)                                      &
         ,intent (in   )                   ::                           &
         aa1,edt,edtm,omegac,sigmab
-     real(kind=kind_phys),    dimension (its:ite)                                      &
+     real(kind=kind_phys),    dimension (its:)                                      &
         ,intent (in   )                   ::                           &
         mconv,axx
 !$acc declare copyin(zd,zu,p_cup,zdm,omeg,xaa0,rand_clos,aa1,edt,edtm,mconv,axx)
-     real(kind=kind_phys),    dimension (its:ite)                                      &
+     real(kind=kind_phys),    dimension (its:)                                      &
         ,intent (inout)                   ::                           &
         aa0,closure_n
 !$acc declare copy(aa0,closure_n)
@@ -3113,13 +3113,13 @@ subroutine cup_forcing_ens_3d(closure_n,xland,aa0,aa1,xaa0,mbdt,dtime,ierr,ierr2
      real(kind=kind_phys)                                                              &
         ,intent (in   )                   ::                           &
         dtime
-     integer, dimension (its:ite)                                      &
+     integer, dimension (its:)                                      &
         ,intent (inout   )                ::                           &
         k22,kbcon,ktop
-     integer, dimension (its:ite)                                      &
+     integer, dimension (its:)                                      &
         ,intent (in      )                ::                           &
         xland
-     integer, dimension (its:ite)                                      &
+     integer, dimension (its:)                                      &
         ,intent (inout)                   ::                           &
         ierr,ierr2,ierr3
 !$acc declare copy(k22,kbcon,ktop,ierr,ierr2,ierr3) copyin(xland)
@@ -3129,10 +3129,10 @@ subroutine cup_forcing_ens_3d(closure_n,xland,aa0,aa1,xaa0,mbdt,dtime,ierr,ierr2
       integer, intent(in)  :: dicycle
       logical, intent (in) :: progsigma
 
-      real(kind=kind_phys),    intent(in)   , dimension (its:ite) :: aa1_bl,tau_ecmwf
-      real(kind=kind_phys),    intent(inout), dimension (its:ite) :: xf_dicycle
-      real(kind=kind_phys),    intent(out),   dimension (its:ite) :: xf_progsigma
-      real(kind=kind_phys),    intent(inout), dimension (its:ite,10) :: forcing
+      real(kind=kind_phys),    intent(in)   , dimension (its:) :: aa1_bl,tau_ecmwf
+      real(kind=kind_phys),    intent(inout), dimension (its:) :: xf_dicycle
+      real(kind=kind_phys),    intent(out),   dimension (its:) :: xf_progsigma
+      real(kind=kind_phys),    intent(inout), dimension (its:,:) :: forcing
 !$acc declare copyin(aa1_bl,tau_ecmwf) copy(xf_dicycle,forcing)
       !- local var
       real(kind=kind_phys)  :: xff_dicycle
@@ -3487,31 +3487,31 @@ subroutine cup_kbcon(ierrc,cap_inc,iloop_in,k22,kbcon,he_cup,hes_cup, &
   ! 
   ! ierr error value, maybe modified in this routine
   !
-     real(kind=kind_phys),    dimension (its:ite,kts:kte)                              &
+     real(kind=kind_phys),    dimension (its:,kts:)                              &
         ,intent (in   )                   ::                           &
         he_cup,hes_cup,p_cup
 !$acc declare copyin(he_cup,hes_cup,p_cup)
-     real(kind=kind_phys),    dimension (its:ite)                                      &
+     real(kind=kind_phys),    dimension (its:)                                      &
         ,intent (in   )                   ::                           &
         entr_rate,ztexec,zqexec,cap_inc,cap_max
 !$acc declare copyin(entr_rate,ztexec,zqexec,cap_inc,cap_max)
-     real(kind=kind_phys),    dimension (its:ite)                                      &
+     real(kind=kind_phys),    dimension (its:)                                      &
         ,intent (inout   )                   ::                        &
         hkb !,cap_max
 !$acc declare copy(hkb)
-     integer, dimension (its:ite)                                      &
+     integer, dimension (its:)                                      &
         ,intent (in   )                   ::                           &
         kbmax
 !$acc declare copyin(kbmax)
-     integer, dimension (its:ite)                                      &
+     integer, dimension (its:)                                      &
         ,intent (inout)                   ::                           &
         kbcon,k22,ierr
 !$acc declare copy(kbcon,k22,ierr)
      integer                                                           &
         ,intent (in   )                   ::                           &
         iloop_in
-     character*50 :: ierrc(its:ite)
-     real(kind=kind_phys), dimension (its:ite,kts:kte),intent (in) :: z_cup,heo
+     character*50 :: ierrc(its:)
+     real(kind=kind_phys), dimension (its:,kts:),intent (in) :: z_cup,heo
 !$acc declare copyin(z_cup,heo)
      integer, dimension (its:ite)      ::     iloop,start_level
 !$acc declare create(iloop,start_level)
@@ -3645,18 +3645,18 @@ subroutine cup_maximi(array,ks,ke,maxx,ierr,              &
   ! x output array with return values
   ! kt output array of levels
   ! ks,kend  check-range
-     real(kind=kind_phys),    dimension (its:ite,kts:kte)                              &
+     real(kind=kind_phys),    dimension (its:,kts:)                              &
         ,intent (in   )                   ::                           &
          array
 !$acc declare copyin(array)
-     integer, dimension (its:ite)                                      &
+     integer, dimension (its:)                                      &
         ,intent (in   )                   ::                           &
          ierr,ke
 !$acc declare copyin(ierr,ke)
      integer                                                           &
         ,intent (in   )                   ::                           &
          ks
-     integer, dimension (its:ite)                                      &
+     integer, dimension (its:)                                      &
         ,intent (out  )                   ::                           &
          maxx
 !$acc declare copyout(maxx)
@@ -3708,15 +3708,15 @@ subroutine cup_minimi(array,ks,kend,kt,ierr,              &
   ! x output array with return values
   ! kt output array of levels
   ! ks,kend  check-range
-     real(kind=kind_phys),    dimension (its:ite,kts:kte)                    &
+     real(kind=kind_phys),    dimension (its:,kts:)                    &
         ,intent (in   )                   ::                 &
          array
 !$acc declare copyin(array)
-     integer, dimension (its:ite)                            &
+     integer, dimension (its:)                            &
         ,intent (in   )                   ::                 &
          ierr,ks,kend
 !$acc declare copyin(ierr,ks,kend)
-     integer, dimension (its:ite)                            &
+     integer, dimension (its:)                            &
         ,intent (out  )                   ::                 &
          kt
 !$acc declare copyout(kt)
@@ -3771,10 +3771,10 @@ subroutine cup_up_aa0(aa0,z,zu,dby,gamma_cup,t_cup,       &
   ! z = heights of model levels 
   ! ierr error value, maybe modified in this routine
   !
-     real(kind=kind_phys),    dimension (its:ite,kts:kte)                     &
+     real(kind=kind_phys),    dimension (its:,kts:)                     &
         ,intent (in   )                   ::                  &
         z,zu,gamma_cup,t_cup,dby
-     integer, dimension (its:ite)                             &
+     integer, dimension (its:)                             &
         ,intent (in   )                   ::                  &
         kbcon,ktop
 !$acc declare copyin(z,zu,gamma_cup,t_cup,dby,kbcon,ktop)
@@ -3783,11 +3783,11 @@ subroutine cup_up_aa0(aa0,z,zu,dby,gamma_cup,t_cup,       &
 !
 
 
-     integer, dimension (its:ite)                             &
+     integer, dimension (its:)                             &
         ,intent (inout)                   ::                  &
         ierr
 !$acc declare copy(ierr)
-     real(kind=kind_phys),    dimension (its:ite)                             &
+     real(kind=kind_phys),    dimension (its:)                             &
         ,intent (out  )                   ::                  &
         aa0
 !$acc declare copyout(aa0)
@@ -3830,15 +3830,15 @@ subroutine neg_check(name,j,dt,q,outq,outt,outu,outv,                      &
                         outqc,pret,its,ite,kts,kte,itf,ktf,ktop)
 
    integer,      intent(in   ) ::            j,its,ite,kts,kte,itf,ktf
-   integer, dimension (its:ite  ),   intent(in   ) ::  ktop
+   integer, dimension (its:  ),   intent(in   ) ::  ktop
 
-     real(kind=kind_phys), dimension (its:ite,kts:kte  )                    ,                 &
+     real(kind=kind_phys), dimension (its:,kts:  )                    ,                 &
       intent(inout   ) ::                                                     &
        outq,outt,outqc,outu,outv
-     real(kind=kind_phys), dimension (its:ite,kts:kte  )                    ,                 &
+     real(kind=kind_phys), dimension (its:,kts:  )                    ,                 &
       intent(inout   ) ::                                                     &
        q
-     real(kind=kind_phys), dimension (its:ite  )                            ,                 &
+     real(kind=kind_phys), dimension (its:  )                            ,                 &
       intent(inout   ) ::                                                     &
        pret
 !$acc declare copy(outq,outt,outqc,outu,outv,q,pret)
@@ -3979,38 +3979,38 @@ subroutine cup_output_ens_3d(xff_mid,xf_ens,ierr,dellat,dellaq,dellaqc,  &
   ! pw = pw -epsilon*pd (ensemble dependent)
   ! ierr error value, maybe modified in this routine
   !
-     real(kind=kind_phys),    dimension (its:ite,1:maxens3)                            &
+     real(kind=kind_phys),    dimension (its:,:)                            &
         ,intent (inout)                   ::                           &
        xf_ens,pr_ens
-     real(kind=kind_phys),    dimension (its:ite,kts:kte)                              &
+     real(kind=kind_phys),    dimension (its:,kts:)                              &
         ,intent (inout  )                 ::                           &
         outtem,outq,outqc
-     real(kind=kind_phys),    dimension (its:ite,kts:kte)                              &
+     real(kind=kind_phys),    dimension (its:,kts:)                              &
         ,intent (in  )                    ::                           &
         zu,pwd,p_cup
-     real(kind=kind_phys),   dimension (its:ite)                                       &
+     real(kind=kind_phys),   dimension (its:)                                       &
          ,intent (in  )                   ::                           &
         sig,xmbm_in,xmbs_in,edt,sigmab,dx
-     real(kind=kind_phys),   dimension (its:ite,2)                                     &
+     real(kind=kind_phys),   dimension (its:,:)                                     &
          ,intent (in  )                   ::                           &
         xff_mid
-     real(kind=kind_phys),    dimension (its:ite)                                      &
+     real(kind=kind_phys),    dimension (its:)                                      &
         ,intent (inout  )                 ::                           &
         pre,xmb
-     real(kind=kind_phys),    dimension (its:ite)                                      &
+     real(kind=kind_phys),    dimension (its:)                                      &
         ,intent (inout  )                 ::                           &
         closure_n
-     real(kind=kind_phys),    dimension (its:ite,kts:kte,1)                            &
+     real(kind=kind_phys),    dimension (its:,kts:,:)                            &
         ,intent (in   )                   ::                           &
        dellat,dellaqc,dellaq,pw
-     integer, dimension (its:ite)                                      &
+     integer, dimension (its:)                                      &
         ,intent (in   )                   ::                           &
         ktop,xland1
-     integer, dimension (its:ite)                                      &
+     integer, dimension (its:)                                      &
         ,intent (inout)                   ::                           &
         ierr,ierr2,ierr3
      integer, intent(in) :: dicycle
-     real(kind=kind_phys),    intent(in), dimension (its:ite) :: xf_dicycle, xf_progsigma
+     real(kind=kind_phys),    intent(in), dimension (its:) :: xf_dicycle, xf_progsigma
 !$acc declare copyin(zu,pwd,p_cup,sig,xmbm_in,xmbs_in,edt,xff_mid,dellat,dellaqc,dellaq,pw,ktop,xland1,xf_dicycle)
 !$acc declare copy(xf_ens,pr_ens,outtem,outq,outqc,pre,xmb,closure_n,ierr,ierr2,ierr3)
 !
@@ -4248,15 +4248,15 @@ subroutine cup_up_moisture(name,ierr,z_cup,qc,qrc,pw,pwav,     &
   ! zu = normalized updraft mass flux
   ! gamma_cup = gamma on model cloud levels
   !
-     real(kind=kind_phys),    dimension (its:ite,kts:kte)                         &
+     real(kind=kind_phys),    dimension (its:,kts:)                         &
         ,intent (in   )                   ::                      &
         p_cup,rho,q,zu,gamma_cup,qe_cup,                          &
         up_massentr,up_massdetr,dby,qes_cup,z_cup
-     real(kind=kind_phys),    dimension (its:ite)                                 &
+     real(kind=kind_phys),    dimension (its:)                                 &
         ,intent (in   )                   ::                      &
         zqexec,c0
   ! entr= entrainment rate 
-     integer, dimension (its:ite)                                 &
+     integer, dimension (its:)                                 &
         ,intent (in   )                   ::                      &
         kbcon,ktop,k22,xland1
 !$acc declare copyin(p_cup,rho,q,zu,gamma_cup,qe_cup,up_massentr,up_massdetr,dby,qes_cup,z_cup,zqexec,c0,kbcon,ktop,k22,xland1)
@@ -4268,7 +4268,7 @@ subroutine cup_up_moisture(name,ierr,z_cup,qc,qrc,pw,pwav,     &
 
    ! ierr error value, maybe modified in this routine
 
-     integer, dimension (its:ite)                                  &
+     integer, dimension (its:)                                  &
         ,intent (inout)                   ::                       &
         ierr
 !$acc declare copy(ierr)
@@ -4281,11 +4281,11 @@ subroutine cup_up_moisture(name,ierr,z_cup,qc,qrc,pw,pwav,     &
    ! pwav = totan normalized integrated condensate (i1)
    ! c0 = conversion rate (cloud to rain)
 
-     real(kind=kind_phys),    dimension (its:ite,kts:kte)                          &
+     real(kind=kind_phys),    dimension (its:,kts:)                          &
         ,intent (out  )                   ::                       &
         qc,qrc,pw,clw_all
 !$acc declare copy(qc,qrc,pw,clw_all)
-     real(kind=kind_phys),    dimension (its:ite,kts:kte)                          &
+     real(kind=kind_phys),    dimension (its:,kts:)                          &
         ,intent (inout)                   ::                       &
         c1d
 !$acc declare copy(c1d)
@@ -4295,11 +4295,11 @@ subroutine cup_up_moisture(name,ierr,z_cup,qc,qrc,pw,pwav,     &
      real(kind=kind_phys),    dimension (its:ite)         ::                       &
         pwavh
 !$acc declare create(pwavh)
-     real(kind=kind_phys),    dimension (its:ite)                                  &
+     real(kind=kind_phys),    dimension (its:)                                  &
         ,intent (out  )                   ::                       &
         pwav,psum,psumh
 !$acc declare copyout(pwav,psum,psumh)
-     real(kind=kind_phys),    dimension (its:ite)                                  &
+     real(kind=kind_phys),    dimension (its:)                                  &
         ,intent (in  )                    ::                       &
         ccn
 !$acc declare copyin(ccn)
@@ -4329,7 +4329,7 @@ subroutine cup_up_moisture(name,ierr,z_cup,qc,qrc,pw,pwav,     &
         is_deep = (name == 'deep')
 
 !$acc kernels
-        prop_b(kts:kte)=0
+        prop_b(kts:)=0
 !$acc end kernels
         iall=0
         clwdet=0.1 !0.02
@@ -4646,11 +4646,11 @@ subroutine rates_up_pdf(rand_vmas,ipr,name,ktop,ierr,p_cup,entr_rate_2d,hkbo,heo
      implicit none
      character *(*), intent (in)       :: name
      integer, intent(in) :: ipr,its,ite,itf,kts,kte,ktf
-     real(kind=kind_phys), dimension (its:ite,kts:kte),intent (inout) :: entr_rate_2d,zuo
-     real(kind=kind_phys), dimension (its:ite,kts:kte),intent (in) ::p_cup, heo,heso_cup,z_cup
-     real(kind=kind_phys), dimension (its:ite),intent (in) :: hkbo,rand_vmas
-     integer, dimension (its:ite),intent (in) :: kstabi,k22,kpbl,csum,xland,pmin_lev
-     integer, dimension (its:ite),intent (inout) :: kbcon,ierr,ktop,ktopdby
+     real(kind=kind_phys), dimension (its:,kts:),intent (inout) :: entr_rate_2d,zuo
+     real(kind=kind_phys), dimension (its:,kts:),intent (in) ::p_cup, heo,heso_cup,z_cup
+     real(kind=kind_phys), dimension (its:),intent (in) :: hkbo,rand_vmas
+     integer, dimension (its:),intent (in) :: kstabi,k22,kpbl,csum,xland,pmin_lev
+     integer, dimension (its:),intent (inout) :: kbcon,ierr,ktop,ktopdby
 !$acc declare copy(entr_rate_2d,zuo,kbcon,ierr,ktop,ktopdby) &
 !$acc         copyin(p_cup, heo,heso_cup,z_cup,hkbo,rand_vmas,kstabi,k22,kpbl,csum,xland,pmin_lev)
 
@@ -4737,7 +4737,7 @@ subroutine rates_up_pdf(rand_vmas,ipr,name,ktop,ierr,p_cup,entr_rate_2d,hkbo,heo
               ktop(i)= 0
         else
            call get_zu_zd_pdf_fim(kklev,p_cup(i,:),rand_vmas(i),zubeg,ipr,xland(i),zuh2,1,ierr(i),k22(i), &
-            kfinalzu+1,zuo(i,kts:kte),kts,kte,ktf,beta_u,kbcon(i),csum(i),pmin_lev(i))
+            kfinalzu+1,zuo(i,kts:),kts,kte,ktf,beta_u,kbcon(i),csum(i),pmin_lev(i))
         endif
       endif ! end deep
       if ( is_mid ) then
@@ -4748,7 +4748,7 @@ subroutine rates_up_pdf(rand_vmas,ipr,name,ktop,ierr,p_cup,entr_rate_2d,hkbo,heo
            kfinalzu=ktop(i)
            ktopdby(i)=ktop(i)+1
           call get_zu_zd_pdf_fim(kklev,p_cup(i,:),rand_vmas(i),zubeg,ipr,xland(i),zuh2,3, &
-            ierr(i),k22(i),ktopdby(i)+1,zuo(i,kts:kte),kts,kte,ktf,beta_u,kbcon(i),csum(i),pmin_lev(i))
+            ierr(i),k22(i),ktopdby(i)+1,zuo(i,kts:),kts,kte,ktf,beta_u,kbcon(i),csum(i),pmin_lev(i))
        endif
       endif ! mid
       if ( is_shallow ) then
@@ -4759,7 +4759,7 @@ subroutine rates_up_pdf(rand_vmas,ipr,name,ktop,ierr,p_cup,entr_rate_2d,hkbo,heo
            kfinalzu=ktop(i)
            ktopdby(i)=ktop(i)+1
            call get_zu_zd_pdf_fim(kbcon(i),p_cup(i,:),rand_vmas(i),zubeg,ipr,xland(i),zuh2,2,ierr(i),k22(i), &
-             ktopdby(i)+1,zuo(i,kts:kte),kts,kte,ktf,beta_u,kbcon(i),csum(i),pmin_lev(i))
+             ktopdby(i)+1,zuo(i,kts:),kts,kte,ktf,beta_u,kbcon(i),csum(i),pmin_lev(i))
 
          endif
          endif ! shal
@@ -4782,8 +4782,8 @@ subroutine get_zu_zd_pdf_fim(kklev,p,rand_vmas,zubeg,ipr,xland,zuh2,draft,ierr,k
  real(kind=kind_phys), parameter :: beta_dd=4.0,g_beta_dd=6.
  integer, intent(in) ::ipr,xland,kb,kklev,kt,kts,kte,ktf,kpbli,csum,pmin_lev
  real(kind=kind_phys), intent(in) ::max_mass,zubeg
- real(kind=kind_phys), intent(inout) :: zu(kts:kte)
- real(kind=kind_phys), intent(in) :: p(kts:kte)
+ real(kind=kind_phys), intent(inout) :: zu(kts:)
+ real(kind=kind_phys), intent(in) :: p(kts:)
  real(kind=kind_phys)  :: trash,beta_deep,zuh(kts:kte),zuh2(1:40)
  integer, intent(inout) :: ierr
  integer, intent(in) ::draft
@@ -5057,20 +5057,20 @@ subroutine cup_up_aa1bl(aa0,t,tn,q,qo,dtime,  &
   ! z = heights of model levels 
   ! ierr error value, maybe modified in this routine
   !
-     real(kind=kind_phys),    dimension (its:ite,kts:kte)                              &
+     real(kind=kind_phys),    dimension (its:,kts:)                              &
         ,intent (in   )                   ::                           &
         z_cup,zu,gamma_cup,t_cup,dby,t,tn,q,qo
-     integer, dimension (its:ite)                                      &
+     integer, dimension (its:)                                      &
         ,intent (in   )                   ::                           &
         kbcon,ktop
      real(kind=kind_phys), intent(in) :: dtime
 !
 ! input and output
 !
-     integer, dimension (its:ite)                                      &
+     integer, dimension (its:)                                      &
         ,intent (inout)                   ::                           &
         ierr
-     real(kind=kind_phys),    dimension (its:ite)                                      &
+     real(kind=kind_phys),    dimension (its:)                                      &
         ,intent (out  )                   ::                           &
         aa0
 !
@@ -5107,14 +5107,14 @@ subroutine get_inversion_layers(ierr,p_cup,t_cup,z_cup,qo_cup,qeso_cup,k_inv_lay
                                     
         implicit none
         integer                      ,intent (in ) :: itf,ktf,its,ite,kts,kte
-        integer, dimension (its:ite) ,intent (in ) :: ierr,kstart,kend
+        integer, dimension (its:) ,intent (in ) :: ierr,kstart,kend
 !$acc declare copyin(ierr,kstart,kend)
         integer, dimension (its:ite) :: kend_p3
 !$acc declare create(kend_p3)
                     
-        real(kind=kind_phys),    dimension (its:ite,kts:kte), intent (in ) :: p_cup,t_cup,z_cup,qo_cup,qeso_cup                            
-        real(kind=kind_phys),    dimension (its:ite,kts:kte), intent (out) :: dtempdz                    
-        integer, dimension (its:ite,kts:kte), intent (out) :: k_inv_layers
+        real(kind=kind_phys),    dimension (its:,kts:), intent (in ) :: p_cup,t_cup,z_cup,qo_cup,qeso_cup                            
+        real(kind=kind_phys),    dimension (its:,kts:), intent (out) :: dtempdz                    
+        integer, dimension (its:,kts:), intent (out) :: k_inv_layers
 !$acc declare copyin(p_cup,t_cup,z_cup,qo_cup,qeso_cup)
 !$acc declare copyout(dtempdz,k_inv_layers)
         !-local vars
@@ -5308,15 +5308,15 @@ subroutine get_lateral_massflux(itf,ktf, its,ite, kts,kte
      implicit none
      integer, intent (in) :: draft
      integer, intent(in):: itf,ktf, its,ite, kts,kte
-     integer, intent(in)   , dimension(its:ite)         :: ierr,ktop,kbcon,k22
+     integer, intent(in)   , dimension(its:)         :: ierr,ktop,kbcon,k22
 !$acc declare copyin(ierr,ktop,kbcon,k22)
-    !real(kind=kind_phys),    intent(in),  optional , dimension(its:ite):: lambau
-     real(kind=kind_phys),    intent(inout),  optional , dimension(its:ite):: lambau
-     real(kind=kind_phys),    intent(in)   , dimension(its:ite,kts:kte) :: zo_cup,zuo
-     real(kind=kind_phys),    intent(inout), dimension(its:ite,kts:kte) :: cd,entr_rate_2d   
-     real(kind=kind_phys),    intent(  out), dimension(its:ite,kts:kte) :: up_massentro, up_massdetro  &
+    !real(kind=kind_phys),    intent(in),  optional , dimension(its:):: lambau
+     real(kind=kind_phys),    intent(inout),  optional , dimension(its:):: lambau
+     real(kind=kind_phys),    intent(in)   , dimension(its:,kts:) :: zo_cup,zuo
+     real(kind=kind_phys),    intent(inout), dimension(its:,kts:) :: cd,entr_rate_2d   
+     real(kind=kind_phys),    intent(  out), dimension(its:,kts:) :: up_massentro, up_massdetro  &
                                                           ,up_massentr,  up_massdetr
-     real(kind=kind_phys),    intent(  out), dimension(its:ite,kts:kte),  optional ::                  &
+     real(kind=kind_phys),    intent(  out), dimension(its:,kts:),  optional ::                  &
                                                           up_massentru,up_massdetru
 !$acc declare copy(lambau,cd,entr_rate_2d) copyin(zo_cup,zuo) copyout(up_massentro, up_massdetro,up_massentr,  up_massdetr)
 !$acc declare copyout(up_massentro, up_massdetro,up_massentr,  up_massdetr, up_massentru,up_massdetru)
@@ -5437,10 +5437,10 @@ subroutine get_partition_liq_ice(ierr,tn,po_cup, p_liq_ice,melting_layer
      implicit none
      character *(*), intent (in)                          :: cumulus
      integer  ,intent (in   )	                          :: itf,ktf, its,ite, kts,kte
-     real(kind=kind_phys),     intent (in   ), dimension(its:ite,kts:kte) :: tn,po_cup
-     real(kind=kind_phys),     intent (inout), dimension(its:ite,kts:kte) :: p_liq_ice,melting_layer
+     real(kind=kind_phys),     intent (in   ), dimension(its:,kts:) :: tn,po_cup
+     real(kind=kind_phys),     intent (inout), dimension(its:,kts:) :: p_liq_ice,melting_layer
 !$acc declare copyin(tn,po_cup) copy(p_liq_ice,melting_layer)
-     integer  , intent (in  ), dimension(its:ite) :: ierr
+     integer  , intent (in  ), dimension(its:) :: ierr
 !$acc declare copyin(ierr)
      integer :: i,k
      real(kind=kind_phys)    :: dp     
@@ -5539,11 +5539,11 @@ subroutine get_melting_profile(ierr,tn_cup,po_cup, p_liq_ice,melting_layer,qrco
      implicit none
      character *(*), intent (in)                          :: cumulus
      integer  ,intent (in   )                                  :: itf,ktf, its,ite, kts,kte
-     integer  ,intent (in   ), dimension(its:ite)         :: ierr
-     real(kind=kind_phys)     ,intent (in   ), dimension(its:ite)         :: edto
-     real(kind=kind_phys)     ,intent (in   ), dimension(its:ite,kts:kte) :: tn_cup,po_cup,qrco,pwo &
+     integer  ,intent (in   ), dimension(its:)         :: ierr
+     real(kind=kind_phys)     ,intent (in   ), dimension(its:)         :: edto
+     real(kind=kind_phys)     ,intent (in   ), dimension(its:,kts:) :: tn_cup,po_cup,qrco,pwo &
                                                             ,pwdo,p_liq_ice,melting_layer
-     real(kind=kind_phys)     ,intent (inout), dimension(its:ite,kts:kte) :: melting
+     real(kind=kind_phys)     ,intent (inout), dimension(its:,kts:) :: melting
 !$acc declare copyin(ierr,edto,tn_cup,po_cup,qrco,pwo,pwdo,p_liq_ice,melting_layer,melting)
      integer :: i,k
      real(kind=kind_phys)    :: dp     
@@ -5615,13 +5615,13 @@ subroutine get_cloud_top(name,ktop,ierr,p_cup,entr_rate_2d,hkbo,heo,heso_cup,z_c
                          kstabi,k22,kbcon,its,ite,itf,kts,kte,ktf,zuo,kpbl,klcl,hcot)
      implicit none
      integer, intent(in) :: its,ite,itf,kts,kte,ktf
-     real(kind=kind_phys), dimension (its:ite,kts:kte),intent (inout) :: entr_rate_2d,zuo
-     real(kind=kind_phys), dimension (its:ite,kts:kte),intent (in) ::p_cup, heo,heso_cup,z_cup
-     real(kind=kind_phys), dimension (its:ite),intent (in) :: hkbo
-     integer, dimension (its:ite),intent (in) :: kstabi,k22,kbcon,kpbl,klcl
-     integer, dimension (its:ite),intent (inout) :: ierr,ktop
+     real(kind=kind_phys), dimension (its:,kts:),intent (inout) :: entr_rate_2d,zuo
+     real(kind=kind_phys), dimension (its:,kts:),intent (in) ::p_cup, heo,heso_cup,z_cup
+     real(kind=kind_phys), dimension (its:),intent (in) :: hkbo
+     integer, dimension (its:),intent (in) :: kstabi,k22,kbcon,kpbl,klcl
+     integer, dimension (its:),intent (inout) :: ierr,ktop
 !$acc declare copy(entr_rate_2d,zuo,ierr,ktop) copyin(p_cup, heo,heso_cup,z_cup,hkbo,kstabi,k22,kbcon,kpbl,klcl)
-     real(kind=kind_phys), dimension (its:ite,kts:kte) :: hcot
+     real(kind=kind_phys), dimension (its:,kts:) :: hcot
 !$acc declare create(hcot)
      character *(*), intent (in) ::    name
      real(kind=kind_phys) :: dz,dh, dbythresh
@@ -5644,7 +5644,7 @@ subroutine get_cloud_top(name,ktop,ierr,p_cup,entr_rate_2d,hkbo,heo,heso_cup,z_c
        kfinalzu=ktf-2
        ktop(i)=kfinalzu
        if(ierr(i).eq.0)then
-       dby (kts:kte)=0.0
+       dby (kts:)=0.0
 
        start_level(i)=kbcon(i)
        !-- hcot below kbcon
@@ -5704,16 +5704,16 @@ subroutine calculate_updraft_velocity(its,itf,ktf,ite,kts,kte,ierr,progsigma,
     implicit none
     logical, intent(in) :: progsigma
     integer, intent(in) :: itf,its,ktf,ite,kts,kte
-    integer, dimension (its:ite), intent(inout) :: ierr
-    real(kind=kind_phys), dimension (its:ite,kts:kte),intent (in) :: zo,entr_rate_2d,   &
+    integer, dimension (its:), intent(inout) :: ierr
+    real(kind=kind_phys), dimension (its:,kts:),intent (in) :: zo,entr_rate_2d,   &
          cd,po,qeso,to,qo,dbyo,clw_all,qlk,delp,zu
-    integer, dimension (its:ite),intent(in) :: k22,kbcon,ktcon
+    integer, dimension (its:),intent(in) :: k22,kbcon,ktcon
     real(kind=kind_phys), dimension (its:ite) :: sumx
     real(kind=kind_phys) ,intent (in) :: fv,rd,el2orc 
     real(kind=kind_phys), dimension (its:ite,kts:kte) :: drag, buo, zi, del
-    real(kind=kind_phys), dimension (its:ite,kts:kte),intent (out) :: wu2,omega_u,      &
+    real(kind=kind_phys), dimension (its:,kts:),intent (out) :: wu2,omega_u,      &
          zeta,zdqca
-    real(kind=kind_phys), dimension (its:ite),intent(out) :: wc,omegac
+    real(kind=kind_phys), dimension (its:),intent(out) :: wc,omegac
     real(kind=kind_phys) :: rho,bb1,bb2,dz,dp,ptem,tem1,ptem1,tem,rfact,gamma,val
     integer :: i,k    
 
diff --git a/physics/cu_c3_sh.F90 b/physics/cu_c3_sh.F90
index 0ea0f28ae..2568a26e6 100644
--- a/physics/cu_c3_sh.F90
+++ b/physics/cu_c3_sh.F90
@@ -95,23 +95,23 @@ subroutine cu_c3_sh_run (                                            &
   ! outq   = output q tendency (per s)
   ! outqc  = output qc tendency (per s)
   ! pre    = output precip
-     real(kind=kind_phys),    dimension (its:ite,kts:kte)                              &
+     real(kind=kind_phys),    dimension (its:,kts:)                              &
         ,intent (inout  )                 ::                           &
         cnvwt,outt,outq,outqc,cupclw,zuo,outu,outv
 !$acc declare copy(cnvwt,outt,outq,outqc,cupclw,zuo,outu,outv)
-     real(kind=kind_phys),    dimension (its:ite,kts:kte)                              &
+     real(kind=kind_phys),    dimension (its:,kts:)                              &
         ,intent (in  )                      ::                         &
         tmf, qmicro, sigmain, forceqv_spechum
-     real(kind=kind_phys),    dimension (its:ite)                                      &
+     real(kind=kind_phys),    dimension (its:)                                      &
         ,intent (out  )                   ::                           &
         xmb_out
-     integer,    dimension (its:ite)                                   &
+     integer,    dimension (its:)                                   &
         ,intent (inout  )                 ::                           &
         ierr
-     integer,    dimension (its:ite)                                   &
+     integer,    dimension (its:)                                   &
         ,intent (out  )                   ::                           &
         kbcon,ktop,k22
-     integer,    dimension (its:ite)                                   &
+     integer,    dimension (its:)                                   &
         ,intent (in  )                    ::                           &
         kpbl,tropics
 !$acc declare copyout(xmb_out,kbcon,ktop,k22) copyin(kpbl,tropics) copy(ierr)
@@ -119,13 +119,13 @@ subroutine cu_c3_sh_run (                                            &
   ! basic environmental input includes a flag (ierr) to turn off
   ! convection for this call only and at that particular gridpoint
   !
-     real(kind=kind_phys),    dimension (its:ite,kts:kte)                              &
+     real(kind=kind_phys),    dimension (its:,kts:)                              &
         ,intent (in   )                   ::                           &
         t,po,tn,dhdt,rho,us,vs,delp
-     real(kind=kind_phys),    dimension (its:ite,kts:kte)                              &
+     real(kind=kind_phys),    dimension (its:,kts:)                              &
         ,intent (inout)                   ::                           &
          q,qo
-     real(kind=kind_phys), dimension (its:ite)                                         &
+     real(kind=kind_phys), dimension (its:)                                         &
         ,intent (in   )                   ::                           &
         xland,z1,psur,hfx,qfx,dx
        
@@ -133,7 +133,7 @@ subroutine cu_c3_sh_run (                                            &
         ,intent (in   )                   ::                           &
         dtime,tcrit,fv,r_d
 !$acc declare sigmaout                                                                                                                                                                                                                      
-     real(kind=kind_phys),    dimension (its:ite,kts:kte)                              &
+     real(kind=kind_phys),    dimension (its:,kts:)                              &
         ,intent (out)                     ::                           &
         sigmaout
 
@@ -245,7 +245,7 @@ subroutine cu_c3_sh_run (                                            &
       real(kind=kind_phys) buo_flux,pgeoh,dp,entup,detup,totmas
 
      real(kind=kind_phys) xff_shal(3),blqe,xkshal
-     character*50 :: ierrc(its:ite)
+     character*50 :: ierrc(its:)
      real(kind=kind_phys),    dimension (its:ite,kts:kte) ::                           &
        up_massentr,up_massdetr,up_massentro,up_massdetro,up_massentru,up_massdetru
 !$acc declare create(up_massentr,up_massdetr,up_massentro,up_massdetro,up_massentru,up_massdetru)

From 26ca9f9c3d08aa5ddc5cb414c1a0377d1fb5fae2 Mon Sep 17 00:00:00 2001
From: dustinswales <dswales@ucar.edu>
Date: Wed, 6 Sep 2023 10:57:28 -0600
Subject: [PATCH 077/115] Renamed file

---
 ...s_diagnostics.F90 => GFS_physics_post.F90} | 30 +++++++++----------
 ...diagnostics.meta => GFS_physics_post.meta} |  6 ++--
 physics/ozphys_2015.F90                       |  1 +
 3 files changed, 19 insertions(+), 18 deletions(-)
 rename physics/{GFS_physics_diagnostics.F90 => GFS_physics_post.F90} (81%)
 rename physics/{GFS_physics_diagnostics.meta => GFS_physics_post.meta} (97%)

diff --git a/physics/GFS_physics_diagnostics.F90 b/physics/GFS_physics_post.F90
similarity index 81%
rename from physics/GFS_physics_diagnostics.F90
rename to physics/GFS_physics_post.F90
index 0c6197bc2..d034c1999 100644
--- a/physics/GFS_physics_diagnostics.F90
+++ b/physics/GFS_physics_post.F90
@@ -1,20 +1,20 @@
 ! ###########################################################################################
-!> \file GFS_physics_diagnostics.F90
+!> \file GFS_physics_post.F90
 !!
 ! ###########################################################################################
-module GFS_physics_diagnostics
+module GFS_physics_post
   use machine, only : kind_phys, kind_dbl_prec, kind_sngl_prec
   implicit none
-  public GFS_physics_diagnostics_init, GFS_physics_diagnostics_run
+  public GFS_physics_post_init, GFS_physics_post_run
 contains
 
 ! ########################################################################################### 
-! SUBROUTINE GFS_physics_diagnostics_init
+! SUBROUTINE GFS_physics_post_init
 ! ###########################################################################################
-!! \section arg_table_GFS_physics_diagnostics_init Argument Table
-!! \htmlinclude GFS_physics_diagnostics_init.html
+!! \section arg_table_GFS_physics_post_init Argument Table
+!! \htmlinclude GFS_physics_post_init.html
 !!
-  subroutine GFS_physics_diagnostics_init(errmsg, errflg)
+  subroutine GFS_physics_post_init(errmsg, errflg)
 
     ! Outputs
     character(len=*), intent(out) :: &
@@ -22,15 +22,15 @@ subroutine GFS_physics_diagnostics_init(errmsg, errflg)
     integer, intent(out) :: &
          errflg         ! CCPP error flag
 
-  end subroutine GFS_physics_diagnostics_init
+  end subroutine GFS_physics_post_init
 
 ! ###########################################################################################
-! SUBROUTINE GFS_physics_diagnostics_run
+! SUBROUTINE GFS_physics_post_run
 ! ###########################################################################################
-!! \section arg_table_GFS_physics_diagnostics_run Argument Table
-!! \htmlinclude GFS_physics_diagnostics_run.html
+!! \section arg_table_GFS_physics_post_run Argument Table
+!! \htmlinclude GFS_physics_post_run.html
 !!
-  subroutine GFS_physics_diagnostics_run(nCol, nLev, ntoz, dtidx, ip_prod_loss, ip_ozmix,   &
+  subroutine GFS_physics_post_run(nCol, nLev, ntoz, dtidx, ip_prod_loss, ip_ozmix,   &
        ip_temp, ip_overhead_ozone, do3_dt_prd, do3_dt_ozmx, do3_dt_temp, do3_dt_ohoz, dtend,&
        errmsg, errflg)
     ! Inputs
@@ -69,7 +69,7 @@ subroutine GFS_physics_diagnostics_run(nCol, nLev, ntoz, dtidx, ip_prod_loss, ip
 
     ! #######################################################################################
     !
-    ! Ozone physics diagnostics
+    ! Ozone physics diagnostic
     !
     ! #######################################################################################
     idtend = dtidx(100+ntoz,ip_prod_loss)
@@ -92,6 +92,6 @@ subroutine GFS_physics_diagnostics_run(nCol, nLev, ntoz, dtidx, ip_prod_loss, ip
        dtend(:,:,idtend) = dtend(:,:,idtend) + do3_dt_ohoz
     endif
 
-  end subroutine GFS_physics_diagnostics_run
+  end subroutine GFS_physics_post_run
 
-end module GFS_physics_diagnostics
+end module GFS_physics_post
diff --git a/physics/GFS_physics_diagnostics.meta b/physics/GFS_physics_post.meta
similarity index 97%
rename from physics/GFS_physics_diagnostics.meta
rename to physics/GFS_physics_post.meta
index b6036b0c9..8b5120b9e 100644
--- a/physics/GFS_physics_diagnostics.meta
+++ b/physics/GFS_physics_post.meta
@@ -1,11 +1,11 @@
 [ccpp-table-properties]
-  name = GFS_physics_diagnostics
+  name = GFS_physics_post
   type = scheme
   dependencies = machine.F
 
 ########################################################################
 [ccpp-arg-table]
-  name = GFS_physics_diagnostics_init
+  name = GFS_physics_post_init
   type = scheme
 [errmsg]
   standard_name = ccpp_error_message
@@ -25,7 +25,7 @@
 
 ########################################################################
 [ccpp-arg-table]
-  name = GFS_physics_diagnostics_run
+  name = GFS_physics_post_run
   type = scheme
 [nCol]
   standard_name = horizontal_loop_extent
diff --git a/physics/ozphys_2015.F90 b/physics/ozphys_2015.F90
index 9898c71e4..47386bd6e 100644
--- a/physics/ozphys_2015.F90
+++ b/physics/ozphys_2015.F90
@@ -17,6 +17,7 @@ module ozphys_2015
 !! \c ozprdlos_2015_new_sbuvO3_tclm15_nuchem.f77) provided by Naval
 !! Research Laboratory through CHEM2D chemistry model
 !! (McCormack et al. (2006) \cite mccormack_et_al_2006).
+!! (https://doi.org/10.5194/acp-6-4943-2006)
 !!
 !> \section genal_ozphys_2015 GFS ozphys_2015_run General Algorithm
 !> -  This code assumes that both prsl and po3 are from bottom to top

From c0ec619536bd29740627cb2dc1da106b61dd435c Mon Sep 17 00:00:00 2001
From: Michael Toy <michael.toy@noaa.gov>
Date: Tue, 19 Sep 2023 02:36:14 +0000
Subject: [PATCH 078/115] Added tendency limiter for mesosphere and horizontal
 wave number filter for orographic gravity wave drag in UGWP -- Issue #95

---
 physics/drag_suite.F90 | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/physics/drag_suite.F90 b/physics/drag_suite.F90
index 22f122e71..ff68f4216 100644
--- a/physics/drag_suite.F90
+++ b/physics/drag_suite.F90
@@ -460,6 +460,8 @@ subroutine drag_suite_run(                                           &
    real(kind=kind_phys), parameter       ::  ce      = 0.8
    real(kind=kind_phys), parameter       ::  cg      = 0.5
    real(kind=kind_phys), parameter       ::  sgmalolev  = 0.5  ! max sigma lvl for dtfac
+   real(kind=kind_phys), parameter       ::  plolevmeso = 70.0 ! pres lvl for mesosphere OGWD reduction (Pa)
+   real(kind=kind_phys), parameter       ::  facmeso    = 0.5  ! fractional velocity reduction for OGWD
    integer,parameter    ::  kpblmin = 2
 
 !
@@ -472,7 +474,7 @@ subroutine drag_suite_run(                                           &
                             rcsks,wdir,ti,rdz,tem2,dw2,shr2,      &
                             bvf2,rdelks,wtkbj,tem,gfobnv,hd,fro,  &
                             rim,temc,tem1,efact,temv,dtaux,dtauy, &
-                            dtauxb,dtauyb,eng0,eng1
+                            dtauxb,dtauyb,eng0,eng1,ksmax,dtfac_meso
 !
    logical              ::  ldrag(im),icrilv(im),                 &
                             flag(im),kloop1(im)
@@ -887,6 +889,14 @@ subroutine drag_suite_run(                                           &
          ldrag(i) = ldrag(i) .or. bnv2(i,1).le.0.0
          ldrag(i) = ldrag(i) .or. ulow(i).eq.1.0
          ldrag(i) = ldrag(i) .or. var_stoch(i) .le. 0.0
+!  Check if mesoscale gravity waves will propagate vertically or be evanescent
+!  and not impart a drag force -- consider the maximum sub-grid horizontal
+!  topographic wavelength to be one-half the horizontal grid spacing -- calculate
+!  ksmax accordingly
+         ksmax = 4.0*pi/dx(i)   ! based on wavelength = 0.5*dx(i)
+         if ( bnv2(i,1).gt.0.0 ) then
+            ldrag(i) = ldrag(i) .or. sqrt(bnv2(i,1))*rulow(i).lt.ksmax
+         endif
 !
 !  set all ri low level values to the low level value
 !
@@ -1106,7 +1116,19 @@ subroutine drag_suite_run(                                           &
          enddo
 !
          do k = kts,km
-            taud_ms(i,k)  = taud_ms(i,k)*dtfac(i)* ls_taper(i) *(1.-rstoch(i))
+
+            ! Check if well into mesosphere -- if so, perform similar reduction of
+            ! velocity tendency due to mesoscale GWD to prevent sudden reversal of
+            ! wind direction (similar to above)
+            dtfac_meso = 1.0
+            if (prsl(i,k).le.plolevmeso) then
+               if (taud_ms(i,k).ne.0.)                                  &
+                  dtfac_meso = min(dtfac_meso,facmeso*abs(velco(i,k)    &
+                     /(deltim*rcs*taud_ms(i,k))))
+            end if
+
+            taud_ms(i,k)  = taud_ms(i,k)*dtfac(i)*dtfac_meso*           &
+                               ls_taper(i) *(1.-rstoch(i))
             taud_bl(i,k)  = taud_bl(i,k)*dtfac(i)* ls_taper(i) *(1.-rstoch(i))
 
             dtaux  = taud_ms(i,k) * xn(i)

From ab84c01a110bbf13490fcf3243effe06cb26608d Mon Sep 17 00:00:00 2001
From: "Haiqin.Li" <Haiqin.Li@noaa.gov>
Date: Wed, 20 Sep 2023 01:29:56 +0000
Subject: [PATCH 079/115] "GF radar reflectivity, dust bug fix, and C3 updates"

---
 physics/GFS_rrtmg_pre.F90                  |  2 +-
 physics/cu_c3_deep.F90                     | 16 +++--
 physics/cu_c3_driver.F90                   |  4 +-
 physics/cu_c3_sh.F90                       | 10 ++--
 physics/cu_gf_driver_post.F90              | 11 ++--
 physics/smoke_dust/dust_data_mod.F90       | 32 ++++------
 physics/smoke_dust/dust_fengsha_mod.F90    | 70 +++++++++++++++++-----
 physics/smoke_dust/rrfs_smoke_wrapper.F90  | 22 ++++---
 physics/smoke_dust/rrfs_smoke_wrapper.meta | 36 +++++++++--
 9 files changed, 138 insertions(+), 65 deletions(-)

diff --git a/physics/GFS_rrtmg_pre.F90 b/physics/GFS_rrtmg_pre.F90
index 4f4de181a..fff4ae0b9 100644
--- a/physics/GFS_rrtmg_pre.F90
+++ b/physics/GFS_rrtmg_pre.F90
@@ -976,7 +976,7 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp, lextop,&
      &       imp_physics_mg, iovr, iovr_rand, iovr_maxrand, iovr_max,   &
      &       iovr_dcorr, iovr_exp, iovr_exprand, idcor, idcor_con,      &
      &       idcor_hogan, idcor_oreopoulos, lcrick, lcnorm,             &
-     &       imfdeepcnv, imfdeepcnv_gf, imfdeepcnv_gf, do_mynnedmf,     &
+     &       imfdeepcnv, imfdeepcnv_gf, imfdeepcnv_c3, do_mynnedmf,     &
      &       lgfdlmprad,                                                &
      &       uni_cld, lmfshal, lmfdeep2, cldcov, clouds1,               &
      &       effrl, effri, effrr, effrs, effr_in,                       &
diff --git a/physics/cu_c3_deep.F90 b/physics/cu_c3_deep.F90
index c3a4b2c4e..d1b490c77 100644
--- a/physics/cu_c3_deep.F90
+++ b/physics/cu_c3_deep.F90
@@ -2078,9 +2078,9 @@ subroutine cu_c3_deep_run(        &
 
 !> - Call rain_evap_below_cloudbase() to calculate evaporation below cloud base
 
-      call rain_evap_below_cloudbase(itf,ktf,its,ite,                    &
-           kts,kte,ierr,kbcon,xmb,psur,xland,qo_cup,                     &
-           po_cup,qes_cup,pwavo,edto,pwevo,pre,outt,outq)      !,outbuoy)
+!      call rain_evap_below_cloudbase(itf,ktf,its,ite,                    &
+!           kts,kte,ierr,kbcon,xmb,psur,xland,qo_cup,                     &
+!           po_cup,qes_cup,pwavo,edto,pwevo,pre,outt,outq)      !,outbuoy)
 
       k=1
 !$acc kernels
@@ -2137,7 +2137,7 @@ subroutine cu_c3_deep_run(        &
          do k = ktop(i), 1, -1
               rain =  pwo(i,k) + edto(i) * pwdo(i,k)
               rn(i) = rn(i) + rain * xmb(i) * .001 * dtime
-            !if(po(i,k).gt.400.)then
+              if(k.gt.jmin(i))then
               if(flg(i))then
               q1=qo(i,k)+(outq(i,k))*dtime
               t1=tn(i,k)+(outt(i,k))*dtime
@@ -2162,7 +2162,7 @@ subroutine cu_c3_deep_run(        &
                 pre(i)=max(pre(i),0.)
                 delqev(i) = delqev(i) + .001*dp*qevap(i)/g
               endif
-            !endif ! 400mb
+            endif 
           endif
         enddo
 !       pre(i)=1000.*rn(i)/dtime
@@ -4429,7 +4429,7 @@ subroutine cup_up_moisture(name,ierr,z_cup,qc,qrc,pw,pwav,     &
 !
 !now do the rest
 !
-            kklev(i)=maxloc(zu(i,:),1)
+            kklev(i)=maxloc(zu(i,2:ktop(i)),1)
 !$acc loop seq
             do k=kbcon(i)+1,ktop(i)
                if(t(i,k) > 273.16) then
@@ -4489,6 +4489,10 @@ subroutine cup_up_moisture(name,ierr,z_cup,qc,qrc,pw,pwav,     &
                endif
                if(k.gt.kbcon(i)+1)c1d(i,k)=clwdet*up_massdetr(i,k-1)
                if(k.gt.kbcon(i)+1)c1d_b(i,k)=clwdet*up_massdetr(i,k-1)
+               !if(is_deep.and.k.gt.kklev(i))then
+                c1d(i,k)=0.005
+                c1d_b(i,k)=0.005
+               !endif
 
                if(autoconv.eq.2) then
 ! 
diff --git a/physics/cu_c3_driver.F90 b/physics/cu_c3_driver.F90
index fd4d37b0b..270e01989 100644
--- a/physics/cu_c3_driver.F90
+++ b/physics/cu_c3_driver.F90
@@ -340,8 +340,8 @@ subroutine cu_c3_driver_run(ntracer,garea,im,km,dt,flag_init,flag_restart,&
 !
 !> - Set tuning constants for radiation coupling
 !
-     tun_rad_shall(:)=.01
-     tun_rad_mid(:)=.3 !.02
+     tun_rad_shall(:)=.012
+     tun_rad_mid(:)=.15 !.02
      tun_rad_deep(:)=.3 !.065
      edt(:)=0.
      edtm(:)=0.
diff --git a/physics/cu_c3_sh.F90 b/physics/cu_c3_sh.F90
index 0ea0f28ae..d2b9a71b2 100644
--- a/physics/cu_c3_sh.F90
+++ b/physics/cu_c3_sh.F90
@@ -6,12 +6,12 @@ module cu_c3_sh
     use progsigma, only : progsigma_calc
 
     !real(kind=kind_phys), parameter:: c1_shal=0.0015! .0005
-    real(kind=kind_phys), parameter:: c1_shal=0. !0.005! .0005
     real(kind=kind_phys), parameter:: g  =9.81
     real(kind=kind_phys), parameter:: cp =1004.
     real(kind=kind_phys), parameter:: xlv=2.5e6
     real(kind=kind_phys), parameter:: r_v=461.
-    real(kind=kind_phys), parameter:: c0_shal=.001
+    real(kind=kind_phys)  :: c0_shal=.004
+    real(kind=kind_phys)  :: c1_shal=0. !0.005! .0005
     real(kind=kind_phys), parameter:: fluxtune=1.5
 
 contains
@@ -274,6 +274,8 @@ subroutine cu_c3_sh_run (                                            &
         ktopx(i)=0
         if(xland(i).gt.1.5 .or. xland(i).lt.0.5)then
             xland1(i)=0
+            c0_shal=.001
+            c1_shal=.001
 !            ierr(i)=100
         endif
         pre(i)=0.
@@ -669,11 +671,11 @@ subroutine cu_c3_sh_run (                                            &
           if(qco(i,k)>=trash ) then 
               dz=z_cup(i,k)-z_cup(i,k-1)
               ! cloud liquid water
-              c1d(i,k)=.02*up_massdetr(i,k-1)
+              c1d(i,k)=c1_shal! 0. !.02*up_massdetr(i,k-1)
               qrco(i,k)= (qco(i,k)-trash)/(1.+(c0_shal+c1d(i,k))*dz)
               if(qrco(i,k).lt.0.)then  ! hli new test 02/12/19
                  qrco(i,k)=0.
-                 c1d(i,k)=0.
+                 !c1d(i,k)=0.
               endif
               pwo(i,k)=c0_shal*dz*qrco(i,k)*zuo(i,k)
               clw_all(i,k)=qco(i,k)-trash !LB total cloud before rain and detrain
diff --git a/physics/cu_gf_driver_post.F90 b/physics/cu_gf_driver_post.F90
index 56da0feba..8c5896164 100644
--- a/physics/cu_gf_driver_post.F90
+++ b/physics/cu_gf_driver_post.F90
@@ -66,20 +66,21 @@ subroutine cu_gf_driver_post_run (im, km, t, q, prevst, prevsq, cactiv, cactiv_m
           conv_act_m(i)=0.0
         endif
         ! reflectivity parameterization for parameterized convection (reference:Unipost MDLFLD.f)
-        if(sqrt(garea(i)).lt.6500.)then
+        !if(sqrt(garea(i)).lt.6500.)then
         ze      = 0.0
         ze_conv = 0.0
         dbz_sum = 0.0
-        cuprate = raincv(i) * 3600.0 / dt          ! cu precip rate (mm/h)
-        ze_conv = 300.0 * cuprate**1.4
-        if (maxupmf(i).gt.0.05) then
+        cuprate = max(0.1,1.e3*raincv(i) * 3600.0 / dt)          ! cu precip rate (mm/h)
+        if(cuprate .lt. 0.05) cuprate=0.
+        ze_conv = 300.0 * cuprate**1.5
+        if (maxupmf(i).gt.0.1 .and. cuprate.gt.0.) then
          do k = 1, km
           ze = 10._kind_phys ** (0.1 * refl_10cm(i,k))
           dbz_sum = max(dbzmin, 10.0 * log10(ze + ze_conv))
           refl_10cm(i,k) = dbz_sum
          enddo
         endif
-        endif
+        !endif
       enddo
 !$acc end kernels
 
diff --git a/physics/smoke_dust/dust_data_mod.F90 b/physics/smoke_dust/dust_data_mod.F90
index a710701f1..eb809378d 100755
--- a/physics/smoke_dust/dust_data_mod.F90
+++ b/physics/smoke_dust/dust_data_mod.F90
@@ -44,24 +44,10 @@ module dust_data_mod
   ! Never used:
   ! real(kind_phys), parameter :: fengsha_alpha = 0.3
   ! real(kind_phys), parameter :: fengsha_gamma = 1.3
+
   ! -- FENGSHA threshold velocities based on Dale A. Gillette's data
   integer, parameter :: fengsha_maxstypes = 13
-!  real(kind_phys), dimension(fengsha_maxstypes) :: dust_uthres = &
-!    (/ 0.065,   & ! Sand            - 1
-!       0.20,    & ! Loamy Sand      - 2
-!       0.52,    & ! Sandy Loam      - 3
-!       0.50,    & ! Silt Loam       - 4
-!       0.50,    & ! Silt            - 5
-!       0.60,    & ! Loam            - 6
-!       0.73,    & ! Sandy Clay Loam - 7
-!       0.73,    & ! Silty Clay Loam - 8
-!       0.80,    & ! Clay Loam       - 9
-!       0.95,    & ! Sandy Clay      - 10
-!       0.95,    & ! Silty Clay      - 11
-!       1.00,    & ! Clay            - 12
-!       9.999 /)   ! Other           - 13
-!  dust_uthres = 0.065, 0.18, 0.27, 0.30, 0.35, 0.38, 0.35, 0.41, 0.41,
-!                0.45,0.50,0.45,9999.0
+
   real(kind_phys), dimension(fengsha_maxstypes), parameter :: dust_uthres = &
     (/ 0.065,   & ! Sand            - 1
        0.18,    & ! Loamy Sand      - 2
@@ -76,12 +62,16 @@ module dust_data_mod
        0.50,    & ! Silty Clay      - 11
        0.45,    & ! Clay            - 12
        9999.0 /)   ! Other           - 13
-  ! -- FENGSHA uses precalculated drag partition from ASCAT. See: Prigent et al. (2012,2015)
-  integer, parameter :: dust_calcdrag = 1
 
-  real(kind_phys) :: dust_alpha = 2.2
+  ! -- FENGSHA uses precalculated drag partition
+  integer, parameter :: dust_calcdrag = 1
+  ! -- FENGSHA dust moisture parameterization 1:fecan  -  2:shao 
+  integer :: dust_moist_opt = 1
+  
+  real(kind_phys) :: dust_alpha = 1.0
   real(kind_phys) :: dust_gamma = 1.0
-
+  real(kind_phys) :: dust_moist_correction = 1.0
+  real(kind_phys) :: dust_drylimit_factor = 1.0
 
   ! -- sea salt parameters
   integer,            dimension(nsalt), parameter :: spoint    = (/ 1, 2, 2, 2, 2, 2, 3, 3, 3 /)  ! 1 Clay, 2 Silt, 3 Sand
@@ -93,7 +83,7 @@ module dust_data_mod
     (/      1.,     0.2,     0.2,     0.2,     0.2,     0.2,   0.333,   0.333,   0.333 /)
 
 
-  ! -- soil vagatation parameters
+  ! -- soil vegatation parameters
   integer, parameter :: max_soiltyp = 30
   real(kind_phys), dimension(max_soiltyp), parameter :: &
     maxsmc = (/ 0.421, 0.464, 0.468, 0.434, 0.406, 0.465, &
diff --git a/physics/smoke_dust/dust_fengsha_mod.F90 b/physics/smoke_dust/dust_fengsha_mod.F90
index 54a64239d..1e24c8947 100755
--- a/physics/smoke_dust/dust_fengsha_mod.F90
+++ b/physics/smoke_dust/dust_fengsha_mod.F90
@@ -61,6 +61,8 @@ subroutine gocart_dust_fengsha_driver(dt,              &
     REAL(kind_phys), INTENT(IN) :: dt ! time step
     REAL(kind_phys), INTENT(IN) :: g  ! gravity (m/s**2)
 
+
+
     ! Local variables
     integer :: nmx,i,j,k,imx,jmx,lmx
     integer :: ilwi
@@ -75,6 +77,7 @@ subroutine gocart_dust_fengsha_driver(dt,              &
     real(kind_phys), DIMENSION (num_emis_dust) :: distribution
     real(kind_phys), dimension (3) :: massfrac
     real(kind_phys) :: erodtot
+    real(kind_phys) :: moist_volumetric
 
     ! conversion values
     conver=1.e-9
@@ -174,10 +177,13 @@ subroutine gocart_dust_fengsha_driver(dt,              &
                 endif
              endif
 
+             ! soil moisture correction factor 
+             moist_volumetric = dust_moist_correction * smois(i,2,j) 
+
              ! Call dust emission routine.
              
              call source_dust(imx,jmx, lmx, nmx, dt, tc, ustar, massfrac, & 
-                  erodtot, dxy, smois(i,1,j), airden, airmas, bems, g, dust_alpha, dust_gamma, &
+                  erodtot, dxy, moist_volumetric, airden, airmas, bems, g, dust_alpha, dust_gamma, &
                   R, uthr(i,j))
 
              ! convert back to concentration
@@ -457,10 +463,16 @@ subroutine DustEmissionFENGSHA(slc, clay, sand, silt,  &
 
    !  Now compute size-dependent total emission flux
    !  ----------------------------------------------
-   ! Fecan moisture correction
-   ! -------------------------
-   h = moistureCorrectionFecan(slc, sand, clay, rhop)
-   
+
+   if (dust_moist_opt .eq. 1) then
+
+      ! Fecan moisture correction
+      ! -------------------------
+      h = moistureCorrectionFecan(slc, sand, clay)
+   else
+      ! shao soil moisture correction 
+      h = moistureCorrectionShao(slc)
+   end if
    ! Adjust threshold
    ! ----------------
    u_thresh = uthrs * h
@@ -478,7 +490,7 @@ subroutine DustEmissionFENGSHA(slc, clay, sand, silt,  &
 
  end subroutine DustEmissionFENGSHA
 !-----------------------------------------------------------------
-  real function soilMoistureConvertVol2Grav(vsoil, sandfrac, rhop)
+  real function soilMoistureConvertVol2Grav(vsoil, sandfrac)
 
 ! !USES:
     implicit NONE
@@ -486,7 +498,6 @@ real function soilMoistureConvertVol2Grav(vsoil, sandfrac, rhop)
 ! !INPUT PARAMETERS:
     REAL(kind_phys), intent(in) :: vsoil       ! volumetric soil moisture fraction [1]
     REAL(kind_phys), intent(in) :: sandfrac    ! fractional sand content [1]
-    REAL(kind_phys), intent(in) :: rhop        ! dry dust density [kg m-3]
 
 ! !DESCRIPTION: Convert soil moisture fraction from volumetric to gravimetric.
 !
@@ -500,20 +511,21 @@ real function soilMoistureConvertVol2Grav(vsoil, sandfrac, rhop)
 
 !  !CONSTANTS:
     REAL(kind_phys), parameter :: rhow = 1000.    ! density of water [kg m-3]
-
+    REAL(kind_phys), parameter :: rhop = 1700.    ! density of dry soil 
 !EOP
 !-------------------------------------------------------------------------
 !  Begin...
 
 !  Saturated volumetric water content (sand-dependent) ! [m3 m-3]
-    vsat = 0.489 - 0.00126 * ( 100. * sandfrac )
+    vsat = 0.489 - 0.126 * sandfrac 
+    
 
 !  Gravimetric soil content
-    soilMoistureConvertVol2Grav = vsoil * rhow / (rhop * (1. - vsat))
+    soilMoistureConvertVol2Grav = 100.0 * (vsoil * rhow / rhop / ( 1. - vsat))
 
   end function soilMoistureConvertVol2Grav
 !----------------------------------------------------------------
-  real function moistureCorrectionFecan(slc, sand, clay, rhop)
+  real function moistureCorrectionFecan(slc, sand, clay)
 
 ! !USES:
     implicit NONE
@@ -522,7 +534,6 @@ real function moistureCorrectionFecan(slc, sand, clay, rhop)
     REAL(kind_phys), intent(in) :: slc     ! liquid water content of top soil layer, volumetric fraction [1]
     REAL(kind_phys), intent(in) :: sand    ! fractional sand content [1]
     REAL(kind_phys), intent(in) :: clay    ! fractional clay content [1]
-    REAL(kind_phys), intent(in) :: rhop    ! dry dust density [kg m-3]
 
 ! !DESCRIPTION: Compute correction factor to account for Fecal soil moisture
 !
@@ -540,15 +551,46 @@ real function moistureCorrectionFecan(slc, sand, clay, rhop)
 !  Begin...
 
 !  Convert soil moisture from volumetric to gravimetric
-    grvsoilm = soilMoistureConvertVol2Grav(slc, sand, 2650.)
+    grvsoilm = soilMoistureConvertVol2Grav(slc, sand)
 
 !  Compute fecan dry limit
-    drylimit = clay * (14.0 * clay + 17.0)
+    drylimit = dust_drylimit_factor * clay * (14.0 * clay + 17.0)
 
 !  Compute soil moisture correction
     moistureCorrectionFecan = sqrt(1.0 + 1.21 * max(0., grvsoilm - drylimit)**0.68)
 
   end function moistureCorrectionFecan
+!----------------------------------------------------------------
+  real function moistureCorrectionShao(slc)
+
+! !USES:
+    implicit NONE
+
+! !INPUT PARAMETERS:
+    REAL(kind_phys), intent(in) :: slc     ! liquid water content of top soil layer, volumetric fraction [1]
+
+! !DESCRIPTION: Compute correction factor to account for Fecal soil moisture
+!
+! !REVISION HISTORY:
+!
+!  02Apr2020, B.Baker/NOAA    - Original implementation
+!  01Apr2020, R.Montuoro/NOAA - Adapted for GOCART process library
+
+!  !Local Variables
+    real :: grvsoilm
+    real :: drylimit
+
+!EOP
+!---------------------------------------------------------------
+!  Begin...
+
+    if (slc < 0.03) then
+       moistureCorrectionShao = exp(22.7 * slc) 
+    else
+       moistureCorrectionShao = exp(95.3 * slc - 2.029)
+    end if
+
+  end function moistureCorrectionShao
 !---------------------------------------------------------------
   real function DustFluxV2HRatioMB95(clay, kvhmax)
 
diff --git a/physics/smoke_dust/rrfs_smoke_wrapper.F90 b/physics/smoke_dust/rrfs_smoke_wrapper.F90
index 1f9ef6340..7b69fc9e3 100755
--- a/physics/smoke_dust/rrfs_smoke_wrapper.F90
+++ b/physics/smoke_dust/rrfs_smoke_wrapper.F90
@@ -12,7 +12,8 @@ module rrfs_smoke_wrapper
                                      num_moist, num_chem, num_emis_seas, num_emis_dust, &
                                      DUST_OPT_FENGSHA, p_qv, p_atm_shum, p_atm_cldq,    &
                                      p_smoke, p_dust_1, p_coarse_pm, epsilc
-   use dust_data_mod,         only : dust_alpha, dust_gamma
+   use dust_data_mod,         only : dust_alpha, dust_gamma, dust_moist_opt, &
+                                     dust_moist_correction, dust_drylimit_factor
    use plume_data_mod,        only : p_frp_std, p_frp_hr, num_frp_plume
    use seas_mod,              only : gocart_seasalt_driver
    use dust_fengsha_mod,      only : gocart_dust_fengsha_driver
@@ -49,6 +50,7 @@ subroutine rrfs_smoke_wrapper_run(im, kte, kme, ktau, dt, garea, land, jdate,
                    ebb_smoke_hr, frp_hr, frp_std_hr,                                       &
                    coef_bb, ebu_smoke,fhist, min_fplume, max_fplume, hwp, wetness,         &
                    smoke_ext, dust_ext, ndvel, ddvel_inout,rrfs_sd,                        &
+                   dust_moist_opt_in, dust_moist_correction_in, dust_drylimit_factor_in,   & 
                    dust_alpha_in, dust_gamma_in, fire_in,                                  &
                    seas_opt_in, dust_opt_in, drydep_opt_in, coarsepm_settling_in,          &
                    do_plumerise_in, plumerisefire_frq_in, addsmoke_flag_in,                &
@@ -91,12 +93,15 @@ subroutine rrfs_smoke_wrapper_run(im, kte, kme, ktau, dt, garea, land, jdate,
     real(kind_phys), dimension(:,:), intent(out) :: smoke_ext, dust_ext
     real(kind_phys), dimension(:,:), intent(inout) :: nwfa, nifa
     real(kind_phys), dimension(:,:), intent(inout) :: ddvel_inout
-    real (kind=kind_phys), dimension(:), intent(in) :: wetness
-    integer, intent(in   ) :: imp_physics, imp_physics_thompson
-    real (kind=kind_phys), intent(in) :: dust_alpha_in, dust_gamma_in, wetdep_ls_alpha_in
-    integer,        intent(in) :: seas_opt_in, dust_opt_in, drydep_opt_in,        &
-                                  coarsepm_settling_in, plumerisefire_frq_in,     &
-                                  addsmoke_flag_in, wetdep_ls_opt_in
+    real(kind_phys), dimension(:), intent(in) :: wetness
+    real(kind_phys), intent(in) :: dust_alpha_in, dust_gamma_in, wetdep_ls_alpha_in
+    real(kind_phys), intent(in) :: dust_moist_correction_in
+    real(kind_phys), intent(in) :: dust_drylimit_factor_in
+    integer, intent(in) :: dust_moist_opt_in
+    integer, intent(in) :: imp_physics, imp_physics_thompson
+    integer, intent(in) :: seas_opt_in, dust_opt_in, drydep_opt_in,        &
+                           coarsepm_settling_in, plumerisefire_frq_in,     &
+                           addsmoke_flag_in, wetdep_ls_opt_in
     logical, intent(in   ) :: do_plumerise_in, rrfs_sd
     character(len=*), intent(out) :: errmsg
     integer,          intent(out) :: errflg
@@ -314,6 +319,9 @@ subroutine rrfs_smoke_wrapper_run(im, kte, kme, ktau, dt, garea, land, jdate,
        ! Set at compile time in dust_data_mod:
        dust_alpha = dust_alpha_in
        dust_gamma = dust_gamma_in
+       dust_moist_opt = dust_moist_opt_in
+       dust_moist_correction = dust_moist_correction_in
+       dust_drylimit_factor = dust_drylimit_factor_in
        call gocart_dust_fengsha_driver(dt,chem,rho_phy,smois,p8w,ssm,   &
             isltyp,vegfrac,snowh,xland,dxy,g,emis_dust,ust,znt,         &
             clayf,sandf,rdrag,uthr,                                     &
diff --git a/physics/smoke_dust/rrfs_smoke_wrapper.meta b/physics/smoke_dust/rrfs_smoke_wrapper.meta
index bf2fddd60..a0a641246 100755
--- a/physics/smoke_dust/rrfs_smoke_wrapper.meta
+++ b/physics/smoke_dust/rrfs_smoke_wrapper.meta
@@ -210,17 +210,17 @@
   kind = kind_phys
   intent = in
 [nsoil]
-  standard_name = vertical_dimension_of_soil
-  long_name = soil vertical layer dimension
+  standard_name = vertical_dimension_of_soil_internal_to_land_surface_scheme
+  long_name = number of soil layers internal to land surface model
   units = count
   dimensions = ()
   type = integer
   intent = in
 [smc]
-  standard_name = volume_fraction_of_condensed_water_in_soil
-  long_name = volumetric fraction of soil moisture
+  standard_name = volume_fraction_of_soil_moisture_for_land_surface_model
+  long_name = volumetric fraction of soil moisture for lsm
   units = frac
-  dimensions = (horizontal_loop_extent,vertical_dimension_of_soil)
+  dimensions = (horizontal_dimension,vertical_dimension_of_soil_internal_to_land_surface_scheme)
   type = real
   kind = kind_phys
   intent = inout
@@ -612,6 +612,32 @@
   dimensions = ()
   type = logical
   intent = in
+[dust_moist_opt_in]
+  standard_name = control_for_dust_soil_moisture_option
+  long_name = smoke dust moisture parameterization 1 - fecan 2 - shao
+  units = index
+  dimensions = ()
+  type = integer
+  active = (do_smoke_coupling)
+  intent = in
+[dust_moist_correction_in]
+  standard_name = dust_moist_correction_fengsha_dust_scheme
+  long_name = moisture correction term for fengsha dust emission
+  units = none
+  dimensions = ()
+  type = real
+  kind = kind_phys
+  active = (do_smoke_coupling)
+  intent = in
+[dust_drylimit_factor_in]
+  standard_name = dust_drylimit_factor_fengsha_dust_scheme
+  long_name = moisture correction term for drylimit in fengsha dust emission
+  units = none
+  dimensions = ()
+  type = real
+  kind = kind_phys
+  active = (do_smoke_coupling)
+  intent = in
 [dust_alpha_in]
   standard_name = alpha_fengsha_dust_scheme
   long_name = alpha paramter for fengsha dust scheme

From 5612a96edecac3fe931cdc3a8754dfd6e1532df0 Mon Sep 17 00:00:00 2001
From: "samuel.trahan" <Samuel.Trahan@noaa.gov>
Date: Thu, 21 Sep 2023 20:53:34 +0000
Subject: [PATCH 080/115] Fix race condition in GFS_phys_time_vary.fv3.F90
 error detection

---
 physics/GFS_phys_time_vary.fv3.F90 | 67 +++++++++++++++++++++++-------
 physics/noahmp_tables.f90          | 18 ++++----
 2 files changed, 60 insertions(+), 25 deletions(-)

diff --git a/physics/GFS_phys_time_vary.fv3.F90 b/physics/GFS_phys_time_vary.fv3.F90
index a10c10d1b..04348f6dc 100644
--- a/physics/GFS_phys_time_vary.fv3.F90
+++ b/physics/GFS_phys_time_vary.fv3.F90
@@ -61,6 +61,22 @@ module GFS_phys_time_vary
 
       contains
 
+      subroutine copy_error(myerrmsg, myerrflg, errmsg, errflg)
+        implicit none
+        character(*), intent(in) :: myerrmsg
+        integer, intent(in) :: myerrflg
+        character(*), intent(out) :: errmsg
+        integer, intent(inout) :: errflg
+        if(myerrflg == 0) return
+        if(errflg /= 0) return
+        !$OMP CRITICAL
+        if(errflg == 0) then
+          errmsg = myerrmsg
+          errflg = myerrflg
+        endif
+        !$OMP END CRITICAL
+      end subroutine copy_error
+
 !> \section arg_table_GFS_phys_time_vary_init Argument Table
 !! \htmlinclude GFS_phys_time_vary_init.html
 !!
@@ -192,6 +208,9 @@ subroutine GFS_phys_time_vary_init (
          real(kind=kind_phys), dimension(:), allocatable :: dzsno
          real(kind=kind_phys), dimension(:), allocatable :: dzsnso
 
+         integer :: myerrflg
+         character(255) :: myerrmsg
+
          ! Initialize CCPP error handling variables
          errmsg = ''
          errflg = 0
@@ -215,7 +234,7 @@ subroutine GFS_phys_time_vary_init (
 !$OMP          shared (do_ugwp_v1,jindx1_tau,jindx2_tau,ddy_j1tau,ddy_j2tau)        &
 !$OMP          shared (isot,ivegsrc,nlunit,sncovr,sncovr_ice,lsm,lsm_ruc)           &
 !$OMP          shared (min_seaice,fice,landfrac,vtype,weasd,snupx,salp_data)        &
-!$OMP          private (ix,i,j,rsnow,vegtyp)
+!$OMP          private (ix,i,j,rsnow,vegtyp,myerrmsg,myerrflg)
 
 !$OMP sections
 
@@ -227,16 +246,18 @@ subroutine GFS_phys_time_vary_init (
          ! oz_coeff in GFS_typedefs.F90 match what is set by read_o3data
          ! in GFS_typedefs.F90: allocate (Tbd%ozpl (IM,levozp,oz_coeff))
          if (size(ozpl, dim=2).ne.levozp) then
-            write(errmsg,'(2a,i0,a,i0)') "Value error in GFS_phys_time_vary_init: ",    &
+            myerrflg = 1
+            write(myerrmsg,'(2a,i0,a,i0)') "Value error in GFS_phys_time_vary_init: ",    &
                   "levozp from read_o3data does not match value in GFS_typedefs.F90: ", &
                   levozp, " /= ", size(ozpl, dim=2)
-            errflg = 1
+            call copy_error(myerrmsg, myerrflg, errmsg, errflg)
          end if
          if (size(ozpl, dim=3).ne.oz_coeff) then
-            write(errmsg,'(2a,i0,a,i0)') "Value error in GFS_phys_time_vary_init: ",      &
+            myerrflg = 1
+            write(myerrmsg,'(2a,i0,a,i0)') "Value error in GFS_phys_time_vary_init: ",      &
                   "oz_coeff from read_o3data does not match value in GFS_typedefs.F90: ", &
                   oz_coeff, " /= ", size(ozpl, dim=3)
-            errflg = 1
+            call copy_error(myerrmsg, myerrflg, errmsg, errflg)
          end if
 
 !$OMP section
@@ -247,16 +268,18 @@ subroutine GFS_phys_time_vary_init (
          ! h2o_coeff in GFS_typedefs.F90 match what is set by read_o3data
          ! in GFS_typedefs.F90: allocate (Tbd%h2opl (IM,levh2o,h2o_coeff))
          if (size(h2opl, dim=2).ne.levh2o) then
-            write(errmsg,'(2a,i0,a,i0)') "Value error in GFS_phys_time_vary_init: ",     &
+            write(myerrmsg,'(2a,i0,a,i0)') "Value error in GFS_phys_time_vary_init: ",     &
                   "levh2o from read_h2odata does not match value in GFS_typedefs.F90: ", &
                   levh2o, " /= ", size(h2opl, dim=2)
-            errflg = 1
+            myerrflg = 1
+            call copy_error(myerrmsg, myerrflg, errmsg, errflg)
          end if
          if (size(h2opl, dim=3).ne.h2o_coeff) then
-            write(errmsg,'(2a,i0,a,i0)') "Value error in GFS_phys_time_vary_init: ",       &
+            write(myerrmsg,'(2a,i0,a,i0)') "Value error in GFS_phys_time_vary_init: ",       &
                   "h2o_coeff from read_h2odata does not match value in GFS_typedefs.F90: ", &
                   h2o_coeff, " /= ", size(h2opl, dim=3)
-            errflg = 1
+            myerrflg = 1
+            call copy_error(myerrmsg, myerrflg, errmsg, errflg)
          end if
 
 !$OMP section
@@ -264,7 +287,9 @@ subroutine GFS_phys_time_vary_init (
 !>  added coupled gocart and radiation option to initializing aer_nm
          if (iaerclm) then
            ntrcaer = ntrcaerm
-           call read_aerdata (me,master,iflip,idate,errmsg,errflg)
+           myerrflg = 0
+           call read_aerdata (me,master,iflip,idate,myerrmsg,myerrflg)
+           call copy_error(myerrmsg, myerrflg, errmsg, errflg)
          else if(iaermdl ==2 ) then
            do ix=1,ntrcaerm
              do j=1,levs
@@ -289,16 +314,22 @@ subroutine GFS_phys_time_vary_init (
 !$OMP section
 !> - Call tau_amf dats for  ugwp_v1
          if (do_ugwp_v1) then
-            call read_tau_amf(me, master, errmsg, errflg)
+            myerrflg = 0
+            call read_tau_amf(me, master, myerrmsg, myerrflg)
+            call copy_error(myerrmsg, myerrflg, errmsg, errflg)
          endif
 
 !$OMP section
 !> - Initialize soil vegetation (needed for sncovr calculation further down)
-         call set_soilveg(me, isot, ivegsrc, nlunit, errmsg, errflg)
+         myerrflg = 0
+         call set_soilveg(me, isot, ivegsrc, nlunit, myerrmsg, myerrflg)
+         call copy_error(myerrmsg, myerrflg, errmsg, errflg)
 
 !$OMP section
 !> - read in NoahMP table (needed for NoahMP init)
-         call read_mp_table_parameters(errmsg, errflg)
+         myerrflg = 0
+         call read_mp_table_parameters(myerrmsg, myerrflg)
+         call copy_error(myerrmsg, myerrflg, errmsg, errflg)
 
 !$OMP end sections
 
@@ -393,7 +424,9 @@ subroutine GFS_phys_time_vary_init (
          if (errflg/=0) return
 
          if (iaerclm) then
+           ! This call is outside the OpenMP section, so it should access errmsg & errflg directly.
            call read_aerdataf (me, master, iflip, idate, fhour, errmsg, errflg)
+           ! If it is moved to an OpenMP section, it must use myerrmsg, myerrflg, and copy_error.
            if (errflg/=0) return
          end if
 
@@ -479,7 +512,8 @@ subroutine GFS_phys_time_vary_init (
 !$omp          shared(dwsat_table,dksat_table,psisat_table,smoiseq)     &
 !$OMP          shared(smcwtdxy,deeprechxy,rechxy,errmsg,errflg)         &
 !$OMP          private(vegtyp,masslai,masssai,snd,dzsno,dzsnso,isnow)   &
-!$OMP          private(soiltyp,bexp,smcmax,smcwlt,dwsat,dksat,psisat,ddz)
+!$OMP          private(soiltyp,bexp,smcmax,smcwlt,dwsat,dksat,psisat)   &
+!$OMP          private(myerrmsg,myerrflg,ddz)
              do ix=1,im
                if (landfrac(ix) >= drythresh) then
                  tvxy(ix)     = tsfcl(ix)
@@ -594,8 +628,9 @@ subroutine GFS_phys_time_vary_init (
                    dzsno(-1)    = 0.20_kind_phys
                    dzsno(0)     = snd - 0.05_kind_phys - 0.20_kind_phys
                  else
-                   errmsg = 'Error in GFS_phys_time_vary.fv3.F90: Problem with the logic assigning snow layers in Noah MP initialization'
-                   errflg = 1
+                   myerrmsg = 'Error in GFS_phys_time_vary.fv3.F90: Problem with the logic assigning snow layers in Noah MP initialization'
+                   myerrflg = 1
+                   call copy_error(myerrmsg, myerrflg, errmsg, errflg)
                  endif
 
 ! Now we have the snowxy field
diff --git a/physics/noahmp_tables.f90 b/physics/noahmp_tables.f90
index 3b06d7f53..7b536a1d7 100644
--- a/physics/noahmp_tables.f90
+++ b/physics/noahmp_tables.f90
@@ -783,7 +783,7 @@ subroutine read_mp_table_parameters(errmsg, errflg)
        open(15, status='old', form='formatted', action='read', iostat=ierr)
     end if
     if ( ierr /= 0 ) then
-       errmsg = 'warning: cannot find file noahmptable.tb'
+       errmsg = 'warning: cannot find file noahmptable.tbl'
        errflg = 1
        return
 !      write(*,'("warning: cannot find file noahmptable.tbl")')
@@ -914,7 +914,7 @@ subroutine read_mp_table_parameters(errmsg, errflg)
        open(15, status='old', form='formatted', action='read', iostat=ierr)
     end if
     if ( ierr /= 0 ) then
-       errmsg = 'warning: cannot find file noahmptable.tb'
+       errmsg = 'warning: cannot find file noahmptable.tbl'
        errflg = 1
        return
 !      write(*,'("warning: cannot find file noahmptable.tbl")')
@@ -957,7 +957,7 @@ subroutine read_mp_table_parameters(errmsg, errflg)
        open(15, status='old', form='formatted', action='read', iostat=ierr)
     end if
     if ( ierr /= 0 ) then
-       errmsg = 'warning: cannot find file noahmptable.tb'
+       errmsg = 'warning: cannot find file noahmptable.tbl'
        errflg = 1
        return
 !      write(*,'("warning: cannot find file noahmptable.tbl")')
@@ -982,7 +982,7 @@ subroutine read_mp_table_parameters(errmsg, errflg)
       open(15, status='old', form='formatted', action='read', iostat=ierr)
     end if
     if (ierr /= 0) then
-       errmsg = 'warning: cannot find file noahmptable.tb'
+       errmsg = 'warning: cannot find file noahmptable.tbl'
        errflg = 1
        return
 !      write(*,'("warning: cannot find file noahmptable.tbl")')
@@ -1011,7 +1011,7 @@ subroutine read_mp_table_parameters(errmsg, errflg)
       open(15, status='old', form='formatted', action='read', iostat=ierr)
     end if
     if (ierr /= 0) then
-       errmsg = 'warning: cannot find file noahmptable.tb'
+       errmsg = 'warning: cannot find file noahmptable.tbl'
        errflg = 1
        return
 !      write(*,'("warning: cannot find file noahmptable.tbl")')
@@ -1069,7 +1069,7 @@ subroutine read_mp_table_parameters(errmsg, errflg)
       open(15, status='old', form='formatted', action='read', iostat=ierr)
     end if
     if (ierr /= 0) then
-       errmsg = 'warning: cannot find file noahmptable.tb'
+       errmsg = 'warning: cannot find file noahmptable.tbl'
        errflg = 1
        return
 !      write(*,'("warning: cannot find file noahmptable.tbl")')
@@ -1096,7 +1096,7 @@ subroutine read_mp_table_parameters(errmsg, errflg)
       open(15, status='old', form='formatted', action='read', iostat=ierr)
     end if
     if (ierr /= 0) then
-       errmsg = 'warning: cannot find file noahmptable.tb'
+       errmsg = 'warning: cannot find file noahmptable.tbl'
        errflg = 1
        return
 !      write(*,'("warning: cannot find file noahmptable.tbl")')
@@ -1249,7 +1249,7 @@ subroutine read_mp_table_parameters(errmsg, errflg)
       open(15, status='old', form='formatted', action='read', iostat=ierr)
     end if
     if (ierr /= 0) then
-       errmsg = 'warning: cannot find file noahmptable.tb'
+       errmsg = 'warning: cannot find file noahmptable.tbl'
        errflg = 1
        return
 !      write(*,'("warning: cannot find file noahmptable.tbl")')
@@ -1278,7 +1278,7 @@ subroutine read_mp_table_parameters(errmsg, errflg)
       open(15, status='old', form='formatted', action='read', iostat=ierr)
     end if
     if (ierr /= 0) then
-       errmsg = 'warning: cannot find file noahmptable.tb'
+       errmsg = 'warning: cannot find file noahmptable.tbl'
        errflg = 1
        return
 !      write(*,'("warning: cannot find file noahmptable.tbl")')

From 3ec61d39e75bf9f83a1e232e762909964a687767 Mon Sep 17 00:00:00 2001
From: "samuel.trahan" <Samuel.Trahan@noaa.gov>
Date: Thu, 21 Sep 2023 22:23:47 +0000
Subject: [PATCH 081/115] detect empty errmsg in GFS_phys_time_vary.fv3.F90

---
 physics/GFS_phys_time_vary.fv3.F90 | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/physics/GFS_phys_time_vary.fv3.F90 b/physics/GFS_phys_time_vary.fv3.F90
index 04348f6dc..e6bf24186 100644
--- a/physics/GFS_phys_time_vary.fv3.F90
+++ b/physics/GFS_phys_time_vary.fv3.F90
@@ -67,14 +67,14 @@ subroutine copy_error(myerrmsg, myerrflg, errmsg, errflg)
         integer, intent(in) :: myerrflg
         character(*), intent(out) :: errmsg
         integer, intent(inout) :: errflg
-        if(myerrflg == 0) return
-        if(errflg /= 0) return
-        !$OMP CRITICAL
-        if(errflg == 0) then
-          errmsg = myerrmsg
-          errflg = myerrflg
+        if(myerrflg /= 0 .and. errflg == 0) then
+          !$OMP CRITICAL
+          if(errflg == 0) then
+            errmsg = myerrmsg
+            errflg = myerrflg
+          endif
+          !$OMP END CRITICAL
         endif
-        !$OMP END CRITICAL
       end subroutine copy_error
 
 !> \section arg_table_GFS_phys_time_vary_init Argument Table
@@ -209,7 +209,7 @@ subroutine GFS_phys_time_vary_init (
          real(kind=kind_phys), dimension(:), allocatable :: dzsnso
 
          integer :: myerrflg
-         character(255) :: myerrmsg
+         character(len=255) :: myerrmsg
 
          ! Initialize CCPP error handling variables
          errmsg = ''
@@ -288,6 +288,7 @@ subroutine GFS_phys_time_vary_init (
          if (iaerclm) then
            ntrcaer = ntrcaerm
            myerrflg = 0
+           myerrmsg = 'read_aerdata failed without a message'
            call read_aerdata (me,master,iflip,idate,myerrmsg,myerrflg)
            call copy_error(myerrmsg, myerrflg, errmsg, errflg)
          else if(iaermdl ==2 ) then
@@ -315,6 +316,7 @@ subroutine GFS_phys_time_vary_init (
 !> - Call tau_amf dats for  ugwp_v1
          if (do_ugwp_v1) then
             myerrflg = 0
+            myerrmsg = 'read_tau_amf failed without a message'
             call read_tau_amf(me, master, myerrmsg, myerrflg)
             call copy_error(myerrmsg, myerrflg, errmsg, errflg)
          endif
@@ -322,12 +324,14 @@ subroutine GFS_phys_time_vary_init (
 !$OMP section
 !> - Initialize soil vegetation (needed for sncovr calculation further down)
          myerrflg = 0
+         myerrmsg = 'set_soilveg failed without a message'
          call set_soilveg(me, isot, ivegsrc, nlunit, myerrmsg, myerrflg)
          call copy_error(myerrmsg, myerrflg, errmsg, errflg)
 
 !$OMP section
 !> - read in NoahMP table (needed for NoahMP init)
          myerrflg = 0
+         myerrmsg = 'read_mp_table_parameters failed without a message'
          call read_mp_table_parameters(myerrmsg, myerrflg)
          call copy_error(myerrmsg, myerrflg, errmsg, errflg)
 

From 7912a1954983010f1f2ee5ce552139b8dda0b669 Mon Sep 17 00:00:00 2001
From: "samuel.trahan" <Samuel.Trahan@noaa.gov>
Date: Thu, 21 Sep 2023 22:24:02 +0000
Subject: [PATCH 082/115] Initialize err variables in set_soilveg.f

---
 physics/set_soilveg.f | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/physics/set_soilveg.f b/physics/set_soilveg.f
index 37f2c2a73..35f4ace37 100644
--- a/physics/set_soilveg.f
+++ b/physics/set_soilveg.f
@@ -44,6 +44,9 @@ subroutine set_soilveg(me,isot,ivet,nlunit,errmsg,errflg)
      &  DEFINED_SLOPE, FXEXP_DATA, NROOT_DATA, REFKDT_DATA, Z0_DATA,
      &  CZIL_DATA, LAI_DATA, CSOIL_DATA
 
+      errmsg = ''
+      errflg = 0
+
 cmy end locals
       if(ivet.eq.2) then
 

From 7332c8e7ac3d5eec9d48947ec9c1bbd035d9dfeb Mon Sep 17 00:00:00 2001
From: "samuel.trahan" <Samuel.Trahan@noaa.gov>
Date: Thu, 21 Sep 2023 23:32:27 +0000
Subject: [PATCH 083/115] initialize errmsg & errflg in noahmp_tables.f90

---
 physics/noahmp_tables.f90 | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/physics/noahmp_tables.f90 b/physics/noahmp_tables.f90
index 7b536a1d7..753c8ff24 100644
--- a/physics/noahmp_tables.f90
+++ b/physics/noahmp_tables.f90
@@ -484,6 +484,9 @@ subroutine read_mp_table_parameters(errmsg, errflg)
                                                       sr2006_psi_e_a, sr2006_psi_e_b, sr2006_psi_e_c, sr2006_smcmax_a,       &
                                                       sr2006_smcmax_b
 
+    errmsg = ''
+    errflg = 0
+
     ! initialize our variables to bad values, so that if the namelist read fails, we come to a screeching halt as soon as we try to use anything.
     ! vegetation parameters
     isurban_table      = -99999

From 374996ecc45f138ff48ed1812fee3dc59837c556 Mon Sep 17 00:00:00 2001
From: "samuel.trahan" <Samuel.Trahan@noaa.gov>
Date: Fri, 22 Sep 2023 13:42:46 +0000
Subject: [PATCH 084/115] only read h2odata, ozdata and noahmp table when they
 are needed

---
 physics/GFS_phys_time_vary.fv3.F90 | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/physics/GFS_phys_time_vary.fv3.F90 b/physics/GFS_phys_time_vary.fv3.F90
index e6bf24186..4100bdf6e 100644
--- a/physics/GFS_phys_time_vary.fv3.F90
+++ b/physics/GFS_phys_time_vary.fv3.F90
@@ -226,7 +226,7 @@ subroutine GFS_phys_time_vary_init (
 !$OMP          shared (xlat_d,xlon_d,imap,jmap,errmsg,errflg)                       &
 !$OMP          shared (levozp,oz_coeff,oz_pres,ozpl)                                &
 !$OMP          shared (levh2o,h2o_coeff,h2o_pres,h2opl)                             &
-!$OMP          shared (iamin, iamax, jamin, jamax)                                  &
+!$OMP          shared (iamin, iamax, jamin, jamax, lsm_noahmp)                      &
 !$OMP          shared (iaerclm,iaermdl,ntrcaer,aer_nm,iflip,iccn)                   &
 !$OMP          shared (jindx1_o3,jindx2_o3,ddy_o3,jindx1_h,jindx2_h,ddy_h)          &
 !$OMP          shared (jindx1_aer,jindx2_aer,ddy_aer,iindx1_aer,iindx2_aer,ddx_aer) &
@@ -240,6 +240,7 @@ subroutine GFS_phys_time_vary_init (
 
 !$OMP section
 !> - Call read_o3data() to read ozone data
+       need_o3data: if(ntoz > 0) then
          call read_o3data (ntoz, me, master)
 
          ! Consistency check that the hardcoded values for levozp and
@@ -259,9 +260,11 @@ subroutine GFS_phys_time_vary_init (
                   oz_coeff, " /= ", size(ozpl, dim=3)
             call copy_error(myerrmsg, myerrflg, errmsg, errflg)
          end if
+       endif need_o3data
 
 !$OMP section
 !> - Call read_h2odata() to read stratospheric water vapor data
+       need_h2odata: if(h2o_phys) then
          call read_h2odata (h2o_phys, me, master)
 
          ! Consistency check that the hardcoded values for levh2o and
@@ -281,6 +284,7 @@ subroutine GFS_phys_time_vary_init (
             myerrflg = 1
             call copy_error(myerrmsg, myerrflg, errmsg, errflg)
          end if
+       endif need_h2odata
 
 !$OMP section
 !> - Call read_aerdata() to read aerosol climatology, Anning added coupled
@@ -330,10 +334,12 @@ subroutine GFS_phys_time_vary_init (
 
 !$OMP section
 !> - read in NoahMP table (needed for NoahMP init)
-         myerrflg = 0
-         myerrmsg = 'read_mp_table_parameters failed without a message'
-         call read_mp_table_parameters(myerrmsg, myerrflg)
-         call copy_error(myerrmsg, myerrflg, errmsg, errflg)
+         if(lsm == lsm_noahmp) then
+           myerrflg = 0
+           myerrmsg = 'read_mp_table_parameters failed without a message'
+           call read_mp_table_parameters(myerrmsg, myerrflg)
+           call copy_error(myerrmsg, myerrflg, errmsg, errflg)
+         endif
 
 !$OMP end sections
 

From 5377c7c0ab39f275804749a50f31f0e03f7abab4 Mon Sep 17 00:00:00 2001
From: "anning.cheng" <anning.cheng@noaa.gov>
Date: Fri, 22 Sep 2023 10:08:02 -0400
Subject: [PATCH 085/115] passing nc back from microphysics

---
 physics/module_mp_thompson.F90 | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/physics/module_mp_thompson.F90 b/physics/module_mp_thompson.F90
index ca913c6e3..271db11d0 100644
--- a/physics/module_mp_thompson.F90
+++ b/physics/module_mp_thompson.F90
@@ -1509,6 +1509,14 @@ SUBROUTINE mp_gt_driver(qv, qc, qr, qi, qs, qg, ni, nr, nc,     &
             enddo
          endif
 
+         if (merra2_aerosol_aware) then
+            do k = kts, kte
+               nc(i,k,j) = nc1d(k)
+               nwfa(i,k,j) = nwfa1d(k)
+               nifa(i,k,j) = nifa1d(k)
+            enddo
+         endif
+
          do k = kts, kte
             qv(i,k,j) = qv1d(k)
             qc(i,k,j) = qc1d(k)

From f324aa52e64b325965b1552916c733946610ddd2 Mon Sep 17 00:00:00 2001
From: Ted Mansell <ted.mansell@noaa.gov>
Date: Fri, 22 Sep 2023 20:21:45 -0500
Subject: [PATCH 086/115]  Update variable name in mp_nssl.F90

---
 physics/mp_nssl.F90 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/physics/mp_nssl.F90 b/physics/mp_nssl.F90
index b81afaafb..aacf4c3dd 100644
--- a/physics/mp_nssl.F90
+++ b/physics/mp_nssl.F90
@@ -134,7 +134,7 @@ subroutine mp_nssl_init(ncol, nlev, errflg, errmsg, threads, restart, &
 
 !           write(0,*) 'call nssl_2mom_init'
          CALL nssl_2mom_init(ims,ime, jms,jme, kms,kme,nssl_params,ipctmp=ipc,mixphase=0,   &
-                ihvol=ihailv,nssl_ehw0=nssl_ehw0_in,nssl_ehlw0=nssl_ehlw0_in,errmsg=errmsg, &
+                ihvol=ihailv,nssl_ehw0=nssl_ehw0,nssl_ehlw0=nssl_ehlw0,errmsg=errmsg, &
                 nssl_alphar=nssl_alphar,                                                    &
                 nssl_alphah=nssl_alphah,                                                    &
                 nssl_alphahl=nssl_alphahl,                                                  &

From cfd848540b64a55d5b2cc625683ca511889cfd6e Mon Sep 17 00:00:00 2001
From: "Haiqin.Li" <Haiqin.Li@noaa.gov>
Date: Sat, 23 Sep 2023 02:49:23 +0000
Subject: [PATCH 087/115] "to address the reviewer's comments"

---
 physics/cu_c3_deep.F90        | 2 --
 physics/cu_c3_driver.F90      | 9 ++-------
 physics/cu_c3_driver_post.F90 | 9 ++++-----
 physics/cu_gf_driver.F90      | 5 ++---
 physics/cu_gf_driver_post.F90 | 2 --
 5 files changed, 8 insertions(+), 19 deletions(-)

diff --git a/physics/cu_c3_deep.F90 b/physics/cu_c3_deep.F90
index d1b490c77..b8a1dd838 100644
--- a/physics/cu_c3_deep.F90
+++ b/physics/cu_c3_deep.F90
@@ -4489,10 +4489,8 @@ subroutine cup_up_moisture(name,ierr,z_cup,qc,qrc,pw,pwav,     &
                endif
                if(k.gt.kbcon(i)+1)c1d(i,k)=clwdet*up_massdetr(i,k-1)
                if(k.gt.kbcon(i)+1)c1d_b(i,k)=clwdet*up_massdetr(i,k-1)
-               !if(is_deep.and.k.gt.kklev(i))then
                 c1d(i,k)=0.005
                 c1d_b(i,k)=0.005
-               !endif
 
                if(autoconv.eq.2) then
 ! 
diff --git a/physics/cu_c3_driver.F90 b/physics/cu_c3_driver.F90
index 270e01989..cc2906ad5 100644
--- a/physics/cu_c3_driver.F90
+++ b/physics/cu_c3_driver.F90
@@ -644,7 +644,6 @@ subroutine cu_c3_driver_run(ntracer,garea,im,km,dt,flag_init,flag_restart,&
      enddo
 !$acc end kernels
      if (dx(its)<6500.) then
-       ichoice=10
        imid_gf=0
      endif
 !
@@ -680,10 +679,6 @@ subroutine cu_c3_driver_run(ntracer,garea,im,km,dt,flag_init,flag_restart,&
           do i=its,itf
            if(xmbs(i).gt.0.)then
             cutens(i)=1.
-            if (dx(i)<6500.) then
-             ierrm(i)=555
-             ierr (i)=555
-            endif
            endif
           enddo
 !$acc end kernels
@@ -1041,8 +1036,8 @@ subroutine cu_c3_driver_run(ntracer,garea,im,km,dt,flag_init,flag_restart,&
             gdc(i,16,10)=pret(i)*3600.
 
             maxupmf(i)=0.
-            if(forcing(i,6).gt.0.)then
-              maxupmf(i)=maxval(xmb(i)*zu(i,kts:ktf)/forcing(i,6))
+            if(forcing2(i,6).gt.0.)then
+              maxupmf(i)=maxval(xmb(i)*zu(i,kts:ktf)/forcing2(i,6))
             endif
 
             if(ktop(i).gt.2 .and.pret(i).gt.0.)dt_mf(i,ktop(i)-1)=ud_mf(i,ktop(i))
diff --git a/physics/cu_c3_driver_post.F90 b/physics/cu_c3_driver_post.F90
index 74957a6b2..528f3d466 100644
--- a/physics/cu_c3_driver_post.F90
+++ b/physics/cu_c3_driver_post.F90
@@ -66,20 +66,19 @@ subroutine cu_c3_driver_post_run (im, km, t, q, prevst, prevsq, cactiv, cactiv_m
           conv_act_m(i)=0.0
         endif
         ! reflectivity parameterization for parameterized convection (reference:Unipost MDLFLD.f)
-        if(sqrt(garea(i)).lt.6500.)then
         ze      = 0.0
         ze_conv = 0.0
         dbz_sum = 0.0
-        cuprate = raincv(i) * 3600.0 / dt          ! cu precip rate (mm/h)
-        ze_conv = 300.0 * cuprate**1.4
-        if (maxupmf(i).gt.0.05) then
+        cuprate = max(0.1,1.e3*raincv(i) * 3600.0 / dt)          ! cu precip rate (mm/h)
+        if(cuprate .lt. 0.05) cuprate=0.
+        ze_conv = 300.0 * cuprate**1.5
+        if (maxupmf(i).gt.0.1 .and. cuprate.gt.0.) then
          do k = 1, km
           ze = 10._kind_phys ** (0.1 * refl_10cm(i,k))
           dbz_sum = max(dbzmin, 10.0 * log10(ze + ze_conv))
           refl_10cm(i,k) = dbz_sum
          enddo
         endif
-        endif
       enddo
 !$acc end kernels
 
diff --git a/physics/cu_gf_driver.F90 b/physics/cu_gf_driver.F90
index 3b700cc5a..f3f5042fc 100644
--- a/physics/cu_gf_driver.F90
+++ b/physics/cu_gf_driver.F90
@@ -644,7 +644,6 @@ subroutine cu_gf_driver_run(ntracer,garea,im,km,dt,flag_init,flag_restart,&
      enddo
 !$acc end kernels
      if (dx(its)<6500.) then
-!       ichoice=10
        imid_gf=0
      endif
 !
@@ -1015,8 +1014,8 @@ subroutine cu_gf_driver_run(ntracer,garea,im,km,dt,flag_init,flag_restart,&
             gdc(i,16,10)=pret(i)*3600.
 
             maxupmf(i)=0.
-            if(forcing(i,6).gt.0.)then
-              maxupmf(i)=maxval(xmb(i)*zu(i,kts:ktf)/forcing(i,6))
+            if(forcing2(i,6).gt.0.)then
+              maxupmf(i)=maxval(xmb(i)*zu(i,kts:ktf)/forcing2(i,6))
             endif
 
             if(ktop(i).gt.2 .and.pret(i).gt.0.)dt_mf(i,ktop(i)-1)=ud_mf(i,ktop(i))
diff --git a/physics/cu_gf_driver_post.F90 b/physics/cu_gf_driver_post.F90
index 8c5896164..59f43618c 100644
--- a/physics/cu_gf_driver_post.F90
+++ b/physics/cu_gf_driver_post.F90
@@ -66,7 +66,6 @@ subroutine cu_gf_driver_post_run (im, km, t, q, prevst, prevsq, cactiv, cactiv_m
           conv_act_m(i)=0.0
         endif
         ! reflectivity parameterization for parameterized convection (reference:Unipost MDLFLD.f)
-        !if(sqrt(garea(i)).lt.6500.)then
         ze      = 0.0
         ze_conv = 0.0
         dbz_sum = 0.0
@@ -80,7 +79,6 @@ subroutine cu_gf_driver_post_run (im, km, t, q, prevst, prevsq, cactiv, cactiv_m
           refl_10cm(i,k) = dbz_sum
          enddo
         endif
-        !endif
       enddo
 !$acc end kernels
 

From fda90e0d45e13458d89425ec9bb4d1ef454e1fa8 Mon Sep 17 00:00:00 2001
From: Ted Mansell <ted.mansell@noaa.gov>
Date: Sat, 23 Sep 2023 16:19:01 -0500
Subject: [PATCH 088/115]  Update for NSSL 2/3-moment cloud physics

---
 physics/module_mp_nssl_2mom.F90 | 1157 +++++++++++++++++++++----------
 1 file changed, 795 insertions(+), 362 deletions(-)

diff --git a/physics/module_mp_nssl_2mom.F90 b/physics/module_mp_nssl_2mom.F90
index 6439d81d3..72ff9b1b1 100644
--- a/physics/module_mp_nssl_2mom.F90
+++ b/physics/module_mp_nssl_2mom.F90
@@ -8,7 +8,7 @@
 
 
 !---------------------------------------------------------------------
-! code snapshot: "Apr 10 2023" at "13:17:29"
+! code snapshot: "Sep 22 2023" at "22:01:53"
 !---------------------------------------------------------------------
 !---------------------------------------------------------------------
 ! IMPORTANT: Best results are attained using the 5th-order WENO (Weighted Essentially Non-Oscillatory) advection option (4) for scalars:
@@ -33,9 +33,7 @@
 !!
 !! Added info on graupel density and soaking is in Mansell and Ziegler (2013, JAS)
 !!
-!! Average graupel particle density is predicted, which affects fall speed as well.
-!! Hail density prediction is by default disabled in this version, but may be enabled
-!! at some point if there is interest.
+!! Average graupel and hail particle densities are predicted, which affects fall speed as well.
 !!
 !! Maintainer: Ted Mansell, National Severe Storms Laboratory <ted.mansell@noaa.gov>
 !!
@@ -76,6 +74,13 @@
 !
 !
 !---------------------------------------------------------------------
+! Apr. 2023
+!  - Update to 3-moment for rain, graupel, and hail
+!  - Change default graupel/hail fall speeds to icdx/icdxhl=6 (Milbrandt & Morrison 2013)
+!     and also set default ehw0=0.9 and ehlw0=0.9 to compensate for lower fall speeds.
+!  - Change default hail conversion to ihlcnh=-1, and then =1 for 2-mom or =3 for 3-mom,
+!     using wet growth diameter to convert large graupel
+!---------------------------------------------------------------------
 ! Sept. 2021:
 ! Fixes:
 !   Restored previous formulation of snow reflectivity, as it was realized that the last change incorrectly assumed a fixed
@@ -225,7 +230,7 @@ MODULE module_mp_nssl_2mom
   real, private :: rho_qr = 1000., cnor = 8.0e5  ! cnor is set in namelist!!  rain params
   real, private :: rho_qs =  100., cnos = 3.0e6  ! set in namelist!!  snow params
   real, private :: rho_qh =  500., cnoh = 4.0e5  ! set in namelist!!  graupel params
-  real, private :: rho_qhl=  900., cnohl = 4.0e4 ! set in namelist!!  hail params
+  real, private :: rho_qhl=  800., cnohl = 4.0e4 ! set in namelist!!  hail params
 
   real, private :: hdnmn  = 170.0  ! minimum graupel density (for variable density graupel)
   real, private :: hldnmn = 500.0  ! minimum hail density (for variable density hail)
@@ -287,8 +292,10 @@ MODULE module_mp_nssl_2mom
   real, private    :: graupelfallfac = 1.0 ! factor to adjust graupel fall speed
   real, private    :: hailfallfac = 1.0 ! factor to adjust hail fall speed
   integer, private :: icefallopt = 3 ! 1= default, 2 = Ferrier ice fall speed; 3 = adjusted Ferrier (slightly high Vt)
-  integer, private :: icdx = 3 ! (graupel) 0=Ferrier; 1=leave drag coef. cd fixed; 2=vary by density, 4=set by user with cdxmin,cdxmax,etc.
-  integer, private :: icdxhl = 3 ! (hail) 0=Ferrier; 1=leave drag coef. cd fixed; 2=vary by density, 4=set by user with cdxmin,cdxmax,etc.
+  integer, private :: icdx = 6 ! (graupel) 0=Ferrier; 1=leave drag coef. cd fixed; 2=vary by density, 4=set by user with cdxmin,cdxmax,etc.
+                               ! 6= Milbrandt and Morrison (2013) density-based fall speed
+  integer, private :: icdxhl = 6 ! (hail) 0=Ferrier; 1=leave drag coef. cd fixed; 2=vary by density, 4=set by user with cdxmin,cdxmax,etc.
+                               ! 6= Milbrandt and Morrison (2013) density-based fall speed
   real    :: axh = 75.7149, bxh = 0.5
   real    :: axf = 75.7149, bxf = 0.5
   real    :: axhl = 206.984, bxhl = 0.6384
@@ -340,7 +347,7 @@ MODULE module_mp_nssl_2mom
                              ! (first nucleation is done with a KW sat. adj. step)
   integer, private :: issfilt = 0     ! flag to turn on filtering of supersaturation field
   integer, private :: icnuclimit = 0  ! limit droplet nucleation based on Konwar et al. (2012) and Chandrakar et al. (2016)
-  integer, private :: irenuc = 2      ! =1 to always allow renucleation of droplets within the cloud
+  integer, private :: irenuc = 2      ! =1 to always allow renucleation of droplets within the cloud (do no use, obsolete)
                                       ! =2 renucleation following Twomey/Cohard&Pinty
                                       ! =7 New renucleation that requires prediction of the number of activated nuclei
                              ! i.e., not only at cloud base
@@ -439,6 +446,7 @@ MODULE module_mp_nssl_2mom
   real   , private :: ehs0 = 0.1, ehs1 = 0.1  ! graupel-snow coll. eff. parameters: ehs0*exp(ehs1*min(temcg(mgs),0.0))
                                      ! set ehs1 = 0 to get a constant value of ehs0
   integer :: iessopt = 1  ! 1 = Original (no factor); 2 = factor based on wvel; 3 = factor based on SSI
+                          ! 4 = as 3 but sets min factor of 0.1 and goes to full value at 0.5% SSI
   real   , private :: ess0 = 0.5, ess1 = 0.05 ! snow aggregation coefficients: ess0*exp(ess1*min(temcg(mgs),0.0))
                                      ! set ess1 = 0 to get a constant value of ess0
   real   , private :: esstem1 = -15.  ! lower temperature where snow aggregation turns on
@@ -535,17 +543,18 @@ MODULE module_mp_nssl_2mom
 
   real, parameter :: alpharmax = 8. ! limited for rwvent calculation
   
-  integer, private ::  ihlcnh = 1  ! which graupel -> hail conversion to use
+  integer, private ::  ihlcnh = -1  ! which graupel -> hail conversion to use
                           ! 1 = Milbrandt and Yau (2005) using Ziegler 1985 wet growth diameter
                           ! 2 = Straka and Mansell (2005) conversion using size threshold
                           ! 3 = Conversion using wet growth diameter
   real, private :: hlcnhdia = 1.e-3 ! threshold diameter for graupel -> hail conversion for ihlcnh = 1 option.
   real, private :: hlcnhqmin = 0.1e-3 ! minimum graupel mass content for graupel -> hail conversion (ihlcnh = 1)
-  real   , private :: hldia1 = 20.0e-3  ! threshold diameter for graupel -> hail conversion for ihlcnh = 2 option.
-  integer :: incwet = 0    ! flag to do wet growth only on D > D_wet
+  real   , private :: hldia1 = 10.0e-3  ! threshold diameter for graupel -> hail conversion for ihlcnh = 2 option.
+  integer, private  :: incwet = 0    ! flag to do wet growth only on D > D_wet
   integer, private  :: iusedw = 0    ! flag to use experimental wet growth ice diameter for gr -> hl conversion (=1 turns on)
   real   , private  :: dwmin   = 5.0e-3  ! Minimum diameter with iusedw (can stay at 0 or be set to something larger)
   real   , private  :: dwetmin = 5.0e-3  ! Minimum diameter with iusedw (can stay at 0 or be set to something larger)
+  real   , private  :: dwmax  = 15.e-3 ! for ihlcnh, always convert this size and larger whether or not there is wet growth
   real   , private  :: dwtempmin = 242. ! lowest temperature to allow wet growth conversion to hail
   real   , private  :: dwehwmin = 0.   ! Minimum ehw to use to find wet growth diameter (if > ehw0, then wet growth diam becomes smaller)
   real   , private  :: dg0thresh = 0.15 ! graupel wet growth diameter above which we say do not bother
@@ -576,7 +585,7 @@ MODULE module_mp_nssl_2mom
                               ! =  2 DTD mass-weighted version based on MY code
                               ! =  3 Milbrandt version (from Cohard and Pinty code
   integer :: dmropt = 0 ! extra option for crcnw
-  integer :: dmhlopt = 1 ! options for graupel -> conversion
+  integer :: dmhlopt = 0 ! options for graupel -> hail conversion
   integer :: irescalerainopt = 3 ! 0 = default option
                                  ! 1 = qx(mgs,lc) > qxmin(lc) 
                                  ! 2 = qx(mgs,lc) > qxmin(lc) .and. wvel(mgs) < 3.0
@@ -593,7 +602,7 @@ MODULE module_mp_nssl_2mom
 
   integer :: ivhmltsoak = 1   ! 0=off, 1=on : flag to simulate soaking (graupel/hail) during melting 
                          ! when liquid fraction is not predicted
-  logical :: iwetsoak = .true. ! soak and freeze during wet growth or not
+  logical, private :: iwetsoak = .true. ! soak and freeze during wet growth or not
   integer, private :: ioldlimiter = 0 ! test switch for new(=0) or old(=1) size limiter at the end of GS for 3-moment categories
   integer, private :: isnowfall = 2   ! Option for choosing between snow fall speed parameters
                          ! 1 = original Zrnic et al. (Mansell et al. 2010)
@@ -800,7 +809,7 @@ MODULE module_mp_nssl_2mom
       double precision gmoi(0:ngm0) ! ,gmod(0:ngm1,0:ngm2),gmdi(0:ngm1,0:ngm2)
 
       integer, parameter :: nqiacralpha =  300 !480 ! 240 ! 120 ! 15
-      integer, parameter :: nqiacrratio =  100 ! 500 !50  ! 25
+      integer, parameter :: nqiacrratio =  400 ! 500 !50  ! 25
 !      real,    parameter :: maxratiolu = 25.
       real,    parameter :: maxratiolu = 100. ! 25.
       real,    parameter :: maxalphalu = 15.
@@ -899,7 +908,7 @@ MODULE module_mp_nssl_2mom
 
 !      parameter( xvcmn=4.188e-18 )   ! mks  min volume = 3 micron radius
       real, parameter :: xvcmn=0.523599*(2.*cwradn)**3    ! mks  min volume = 2.5 micron radius
-      real, parameter :: xvcmx=0.523599*(2.*xcradmx)**3    ! mks  min volume = 2.5 micron radius
+      real, parameter :: xvcmx=0.523599*(2.*xcradmx)**3    ! mks  max volume = 60 micron radius
       real, parameter :: cwmasn = 1000.*xvcmn   ! minimum mass, defined by radius of 5.0e-6
       real, parameter :: cwmasx = 1000.*xvcmx   ! maximum mass, defined by radius of 50.0e-6
       real, parameter :: cwmasn5 = 1000.*0.523599*(2.*5.0e-6)**3 !  5.23e-13
@@ -947,7 +956,7 @@ MODULE module_mp_nssl_2mom
       real :: cp = 1004.0, rd = 287.04
       real :: rw = 461.5              ! gas const. for water vapor
       REAL, PRIVATE ::      cpl = 4190.0
-     REAL, PRIVATE ::      cpigb = 2106.0
+      REAL, PRIVATE ::      cpigb = 2106.0
       real :: cpi 
       real :: cap 
       real :: tfrcbw
@@ -962,8 +971,8 @@ MODULE module_mp_nssl_2mom
 
      ! GHB: Needed for eqtset=2 in cm1
 !     REAL, PRIVATE ::      cv = cp - rd
-     real, private, parameter ::      cv = 717.0             ! specific heat at constant volume - air
-     REAL, PRIVATE, parameter ::      cvv = 1408.5
+      real, private, parameter ::      cv = 717.0             ! specific heat at constant volume - air
+      REAL, PRIVATE, parameter ::      cvv = 1408.5
      ! GHB
 
       real, parameter ::  bfnu0 = (rnu + 2.0)/(rnu + 1.0) 
@@ -992,6 +1001,8 @@ MODULE module_mp_nssl_2mom
 
       logical, parameter :: do_satadj_for_wrfchem = .true.
 
+      integer, parameter :: ac_opt = 0 ! option flag for alternate aerosol (for NUWRF only)
+      logical, private :: nuaccoinp = .false.
 
 ! Note to users: Many of these options are for development and not guaranteed to perform well.
 ! Some may not be functional depending on the version of the code.
@@ -1101,7 +1112,7 @@ MODULE module_mp_nssl_2mom
                         rescale_low_alphah, &
                         rescale_low_alphahl, &
                         rescale_high_alpha, &
-                        ihlcnh, hldia1,iusedw, dwehwmin, dwmin, dwtempmin, &
+                        ihlcnh, hldia1,iusedw, dwehwmin, dwmin, dwmax, dwtempmin, dg0thresh, &
                         icvhl2h, hldnmn,hdnmn,    &
                         hlcnhdia, hlcnhqmin, &
                         isedonly,           &
@@ -1194,13 +1205,14 @@ SUBROUTINE nssl_2mom_init_const(  &
 
         RETURN
        END SUBROUTINE nssl_2mom_init_const
+
+
 ! #####################################################################
 ! #####################################################################
 !>\ingroup mod_nsslmp
 !! NSSL MP setup routine (sets local options and array indices)
        SUBROUTINE nssl_2mom_init(  &
      & ims,ime, jms,jme, kms,kme, nssl_params, ipctmp, mixphase,ihvol,idoniconlytmp, &
-     & igvol, &
      & nssl_graupelfallfac, &
      & nssl_hailfallfac, &
      & nssl_ehw0, &
@@ -1214,6 +1226,7 @@ SUBROUTINE nssl_2mom_init(  &
      & nssl_alphah, &
      & nssl_alphahl, &
      & nssl_alphar, &
+     & nssl_density_on, nssl_hail_on, nssl_ccn_on, nssl_icecrystals_on, ccn_is_ccna, &
      & errmsg, errflg, &
      & infileunit, &
      & myrank, mpiroot &
@@ -1233,9 +1246,11 @@ SUBROUTINE nssl_2mom_init(  &
      & nssl_alphahl, &
      & nssl_alphar
    integer, intent(in), optional ::  &
-     & nssl_icdx, igvol, &
+     & nssl_icdx, &
      & nssl_icdxhl, myrank, mpiroot, &
      & nssl_ufccn
+   logical, intent(in), optional :: nssl_density_on, nssl_hail_on, nssl_ccn_on, nssl_icecrystals_on
+   integer, intent(inout), optional :: ccn_is_ccna
 
   integer, intent(in),optional      :: infileunit
 
@@ -1243,16 +1258,20 @@ SUBROUTINE nssl_2mom_init(  &
    character(len=*), intent(  out) :: errmsg
    integer,          intent(  out) :: errflg
    integer, intent(in), optional :: ims,ime, jms,jme, kms,kme
+
    real,  intent(in), dimension(20), optional :: nssl_params
 
 
 
-   integer, intent(in) :: ipctmp,mixphase,ihvol
+   integer, intent(in) :: ipctmp,mixphase
+   integer, optional, intent(in) :: ihvol
    logical, optional, intent(in) :: idoniconlytmp
 
     integer :: igvol_local = 1
     logical :: wrote_namelist = .false.
     logical :: wrf_dm_on_monitor
+    integer :: hail_on = -1, density_on = -1, icecrystals_on = 1
+    integer :: ccn_on = -1
 
      double precision :: arg
      real    :: temq
@@ -1277,9 +1296,37 @@ SUBROUTINE nssl_2mom_init(  &
      turn_on_ccna = .false.
      turn_on_cina = .false.
 
-      IF ( present( igvol ) ) THEN
-        igvol_local = igvol
+!      IF ( present( igvol ) ) THEN
+!        igvol_local = igvol
+!      ENDIF
+      
+      IF ( present( nssl_hail_on ) ) THEN
+        IF ( nssl_hail_on ) THEN
+          hail_on = 1
+        ELSE
+          hail_on = 0
+        ENDIF
+      ENDIF
+
+      IF ( present( nssl_density_on ) ) THEN
+        IF ( nssl_density_on ) THEN
+          density_on = 1
+        ELSE
+          density_on = 0
+        ENDIF
       ENDIF
+      
+      IF ( present( nssl_icecrystals_on ) ) THEN
+        IF ( nssl_icecrystals_on ) THEN
+          icecrystals_on = 1
+        ELSE
+          icecrystals_on = 0
+          ! renucfrac = 1.0 ! why was this set to 1?
+          ffrzs = 1.0
+        ENDIF
+      ENDIF
+
+
 !
 ! set some global values from namelist input
 !
@@ -1295,7 +1342,6 @@ SUBROUTINE nssl_2mom_init(  &
       rho_qh   = nssl_params(8)
       rho_qhl  = nssl_params(9)
       rho_qs   = nssl_params(10)
-
       IF ( Nint(nssl_params(13)) == 1 ) THEN
       ! hack to switch CCN field to CCNA (activated ccn)
 !       invertccn = .true.
@@ -1306,29 +1352,56 @@ SUBROUTINE nssl_2mom_init(  &
       IF ( present(nssl_ufccn) ) iufccn = nssl_ufccn
 
       ENDIF
-
+       alphar   = nssl_params(15)
 !      ipelec   = Nint(nssl_params(11))
 !      isaund   = Nint(nssl_params(12))
+
+
       IF ( present(nssl_graupelfallfac) ) graupelfallfac = nssl_graupelfallfac
       IF ( present(nssl_hailfallfac) ) hailfallfac = nssl_hailfallfac
-      IF ( present(nssl_ehw0) ) ehw0 = nssl_ehw0
-      IF ( present(nssl_ehlw0) ) ehlw0 = nssl_ehlw0
+      IF ( present(nssl_ehw0) ) THEN
+        IF ( nssl_ehw0 > 0.0 ) ehw0 = nssl_ehw0
+      ENDIF
+      IF ( present(nssl_ehlw0) ) THEN
+        IF ( nssl_ehlw0 > 0.0 ) ehlw0 = nssl_ehlw0
+      ENDIF
       IF ( present(nssl_icdx) ) icdx = nssl_icdx
       IF ( present(nssl_icdxhl) ) icdxhl = nssl_icdxhl
       IF ( present(nssl_icefallfac) ) icefallfac = nssl_icefallfac
       IF ( present(nssl_snowfallfac) ) snowfallfac = nssl_snowfallfac
-      IF ( present(nssl_cccn) )    ccn = nssl_cccn
-      IF ( present(nssl_alphah) )  alphah = nssl_alphah
-      IF ( present(nssl_alphahl) ) alphahl = nssl_alphahl
-      IF ( present(nssl_alphar) )  alphar = nssl_alphar
+      IF ( present(nssl_cccn) ) THEN
+        IF (nssl_cccn > 1 ) ccn = nssl_cccn
+      ENDIF
+      IF ( present(nssl_alphah) ) THEN
+        IF ( nssl_alphah > -1. ) alphah = nssl_alphah
+      ENDIF
+      IF ( present(nssl_alphahl) ) THEN
+        IF ( nssl_alphahl > -1. ) alphahl = nssl_alphahl
+      ENDIF
+      IF ( present(nssl_alphar) ) THEN
+        IF ( nssl_alphar > -1.0 ) alphar = nssl_alphar
+      ENDIF
+
 
+    ipconc = ipctmp
+    
+    IF ( ipconc < 5 ) THEN
+       ihlcnh = 0
+    ENDIF
 
+    IF ( ihlcnh <= 0 ) THEN
+      IF ( ipconc == 5 ) THEN
+       ihlcnh = 3
+      ELSEIF ( ipconc >= 6 ) THEN
+       ihlcnh = 3
+      ENDIF
+    ENDIF
 
       
 
 
 
-      IF ( .true. ) THEN ! set to true to enable internal namelist read
+      IF ( .false. ) THEN ! set to true to enable internal namelist read
       open(15,file='input.nml',status='old',form='formatted',action='read')
       rewind(15)
       read(15,NML=nssl_mp_params,iostat=istat)
@@ -1359,8 +1432,34 @@ SUBROUTINE nssl_2mom_init(  &
         ENDIF
       ENDIF
 
+        IF ( present( nssl_ccn_on ) ) THEN
+          IF ( nssl_ccn_on ) THEN
+            ccn_on = 1
+          ELSE
+            ccn_on = 0
+            irenuc = 2
+          ENDIF
+        ENDIF
+
       IF ( irenuc >= 5 ) THEN
         turn_on_ccna = .true.
+        IF ( present( nssl_ccn_on ) ) THEN
+          IF ( .not. nssl_ccn_on ) THEN
+      errmsg = 'NSSL_MP Error: Must have nssl_ccn_on=1 for irenuc >= 5!'
+      errflg = 1
+      return
+          ENDIF
+        ENDIF
+      ENDIF
+
+      IF ( present( ccn_is_ccna ) .and. ccn_on == 1 ) THEN
+        IF ( ccn_is_ccna > 0 ) THEN
+          turn_on_ccna = .true.
+        ELSE
+          IF ( irenuc >= 5 ) THEN
+            ccn_is_ccna = 1
+          ENDIF
+        ENDIF
       ENDIF
 
       cwccn = ccn
@@ -1374,25 +1473,42 @@ SUBROUTINE nssl_2mom_init(  &
         lh = lh + 1
         lhl = lhl + 1
       ENDIF
-      IF ( ihvol <= -1 .or. ihvol == 2 ) THEN
-        IF ( ihvol == -1 .or. ihvol == -2 ) THEN
-        lhab = lhab - 1  ! turns off hail 
-        lhl = 0
-        ! past me thought it would be a good idea to change graupel factors when hail is off....
-        ! ehw0 = 0.75
-        ! iehw = 2
-        ! dfrz = Max( dfrz, 0.5e-3 )
-        ENDIF
-        IF ( ihvol == -2 .or. ihvol == 2 ) THEN ! ice crystals are turned off
-         ! a value of 2? means to turn off ice crystals but turn on hail
-          renucfrac = 1.0
-          ffrzs = 1.0
-          ! idoci = 0 ! try this later
+      IF ( hail_on == -1 ) THEN ! hail_on is not set
+        hail_on = 1
+        IF ( ihvol <= -1 .or. ihvol == 2 ) THEN
+          IF ( ihvol == -1 .or. ihvol == -2 ) THEN
+          lhab = lhab - 1  ! turns off hail 
+          lhl = 0
+          hail_on = 0
+          ! past me thought it would be a good idea to change graupel factors when hail is off....
+          ! ehw0 = 0.75
+          ! iehw = 2
+          ! dfrz = Max( dfrz, 0.5e-3 )
+          ENDIF
+          IF ( ihvol == -2 .or. ihvol == 2 .or. icecrystals_on == 0 ) THEN ! ice crystals are turned off
+           ! a value of 2? means to turn off ice crystals but turn on hail
+           ! renucfrac = 1.0 ! why?
+            ffrzs = 1.0
+           ! idoci = 0 ! try this later
+          ENDIF
+        ENDIF
+      
+      ELSE ! hail_on is set
+        IF ( hail_on == 0 ) THEN
+          lhab = lhab - 1  ! turns off hail 
+          lhl = 0
+        ELSE
+          ! assume default that hail is on
         ENDIF
       ENDIF
+      
+      IF ( density_on == -1 ) THEN ! density flag not set, so default is to predict it
+        density_on = 1
+      ENDIF
+
 
       IF ( iresetmoments == 0 ) iresetmoments = 1 ! lhl
-!      write(0,*) 'wrf_init: lhab,lhl = ',lhab,lhl
+!      write(0,*) 'wrf_init: lhab,lhl,hail_on,density_on = ',lhab,lhl,hail_on,density_on
 
 !      IF ( ipelec > 0 ) idonic = .true.
 
@@ -1551,8 +1667,6 @@ SUBROUTINE nssl_2mom_init(  &
       qiacrratio(0,:) = 1.0
 
 
-      isub = Min( 0, Max(-1,ihvol) ) ! is -1 or 0
-
       lccn = 0
       lccnuf = 0
       lccna = 0
@@ -1576,14 +1690,13 @@ SUBROUTINE nssl_2mom_init(  &
       
 !      lccn = 9
 
-    ipconc = ipctmp
 
     IF ( ipconc == 0 ) THEN
-       IF ( ihvol >= 0 ) THEN
+       IF ( hail_on == 1 ) THEN ! turn on graupel density for 1-moment scheme
        lvh = 9
        ltmp = 9
        denscale(lvh) = 1
-       ELSE ! no hail
+       ELSE ! no hail, 'LFO' scheme
        ltmp = lhab
        lhl = 0
        ENDIF
@@ -1601,17 +1714,17 @@ SUBROUTINE nssl_2mom_init(  &
       lns = ltmp+5 !13
       lnh = ltmp+6 !14
       ltmp = lnh
-      IF ( ihvol >= 0 ) THEN
+      IF ( hail_on == 1 ) THEN
       ltmp = ltmp + 1
       lnhl = ltmp ! lhab+7 ! 15
       ENDIF
-      IF ( igvol_local >= 1 ) THEN
+      IF ( density_on >= 1 ) THEN
       ltmp = ltmp + 1
       lvh = ltmp ! lhab+8 + isub ! 16 + isub ! isub adjusts to 15 if hail is off
 !      ltmp = lvh
       ENDIF
       denscale(lccn:ltmp) = 1
-      IF ( ihvol >= 1 ) THEN
+      IF ( density_on == 1 .and. hail_on == 1 ) THEN
        ltmp = ltmp + 1
        lvhl = ltmp
 !       ltmp = lvhl
@@ -1647,13 +1760,13 @@ SUBROUTINE nssl_2mom_init(  &
       ltmp = ltmp + 1
       lnhl = ltmp ! lhab+7 ! 15
       ENDIF
-      IF ( igvol_local >= 1 ) THEN
+      IF ( density_on == 1 ) THEN
       ltmp = ltmp + 1
       lvh = ltmp ! lhab+8 + isub ! 16 + isub ! isub adjusts to 15 if hail is off
       ENDIF
 !      ltmp = lvh
       denscale(lccn:ltmp) = 1
-      IF ( ihvol >= 1 ) THEN
+      IF ( density_on == 1 .and. hail_on == 1 ) THEN
        ltmp = ltmp + 1
        lvhl = ltmp
 !       ltmp = lvhl
@@ -1673,19 +1786,14 @@ SUBROUTINE nssl_2mom_init(  &
        lzh = ltmp
        ltmp = ltmp + 1
        lzr = ltmp
-       ltmp = ltmp + 1
        IF ( lhl > 1 ) THEN
          ltmp = ltmp + 1
          lzhl = ltmp
        ENDIF
+      ! write(0,*) 'ipcon,lzr = ',ipconc,lzr,lzh,lzhl
       ENDIF
 !      ltmp = lvh
  !     denscale(lccn:lvh) = 1
-      IF ( ihvol >= 1 ) THEN
-       lvhl = ltmp+1
-       ltmp = lvhl
-       denscale(lvhl) = 1
-      ENDIF
       IF ( mixedphase ) THEN
       ltmp = ltmp + 1
       lsw  = ltmp
@@ -1705,7 +1813,8 @@ SUBROUTINE nssl_2mom_init(  &
 
 
 
-    
+      ! write(0,*) 'wrf_init: lh,lhl,lzh,lzhl = ',lh,lhl,lzh,lzhl 
+      ! write(0,*) 'wrf_init: ipconc = ',ipconc
       ! write(0,*) 'wrf_init: irenuc, turn_on_ccna = ',irenuc, turn_on_ccna 
       IF ( turn_on_ccna ) THEN
         ltmp = ltmp + 1
@@ -2171,19 +2280,24 @@ END SUBROUTINE nssl_2mom_init
 !! Driver subroutine that copies state data to local 2D arrays for microphysics calls
 SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw, chl,  &
                               cn, vhw, vhl, cna, cni, f_cn, f_cna, f_cina,              &
+                              f_qc, f_qr, f_qi, f_qs, f_qh, f_qhl,                      &
                               cnuf, f_cnuf,                                             &
                               zrw, zhw, zhl, f_zrw, f_zhw, f_zhl, f_vhw, f_vhl,         &
                               qsw, qhw, qhlw,                                           &
                               tt, th, pii, p, w, dn, dz, dtp, itimestep,                &
+                              is_theta_or_temp,                                         &
                               ntmul, ntcnt, lastloop,                                   &
                               RAINNC,RAINNCV,                                           &
                               dx, dy,                                                   &
                               axtra,                                                    &
                               SNOWNC, SNOWNCV, GRPLNC, GRPLNCV,                         &
                               SR,HAILNC, HAILNCV,                                       &
+                              hail_maxk1, hail_max2d, nwp_diagnostics,                  &
                               tkediss,                                                  &
                               re_cloud, re_ice, re_snow, re_rain,                       &
+                              re_graup, re_hail,                                        &
                               has_reqc, has_reqi, has_reqs, has_reqr,                   &
+                              has_reqg, has_reqh,                                       &
                               rainncw2, rainnci2,                                       &
                               dbz, vzf,compdbz,                                         &
                               rscghis_2d,rscghis_2dp,rscghis_2dn,                       &
@@ -2217,6 +2331,8 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
 
 
 
+
+
       implicit none
 
 
@@ -2234,6 +2350,7 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
                               zrw, zhw, zhl,                                            &
                               qsw, qhw, qhlw,                                           &
                             qi,qhl,ccw,crw,cci,csw,chw,chl,vhw,vhl
+      integer, optional, intent(in) :: is_theta_or_temp
       logical, optional, intent(in) ::  f_zrw, f_zhw, f_zhl, f_vhw, f_vhl ! not used yet
       real, dimension(ims:ime, kms:kme, jms:jme), optional, intent(inout):: dbz, vzf, cn, cna, cni, cnuf
       real, dimension(ims:ime, jms:jme), optional, intent(inout):: compdbz
@@ -2268,16 +2385,21 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
        real, dimension(ims:ime, kms:kme, jms:jme), optional, intent(inout) :: axtra
 
 ! WRF variables
-      real, dimension(ims:ime, jms:jme), intent(inout)::                                 &
+      real, dimension(ims:ime, jms:jme) ::                                 &
                             RAINNC,RAINNCV    ! accumulated precip (NC) and rate (NCV)
       real, dimension(ims:ime, jms:jme), optional, intent(inout)::                                 &
                             SNOWNC,SNOWNCV,GRPLNC,GRPLNCV,SR        ! accumulated precip (NC) and rate (NCV)
       real, dimension(ims:ime, jms:jme), optional, intent(inout)::                                 &
                             HAILNC,HAILNCV ! accumulated precip (NC) and rate (NCV)
+      real, dimension(ims:ime, jms:jme), optional, intent(inout) :: hail_maxk1, hail_max2d
+      integer, optional, intent(in) :: nwp_diagnostics
+!     for cm1, set nproctot=44 (or as needed) to get domain total rates
       integer, parameter :: nproc = 1
-      REAL, DIMENSION(ims:ime, kms:kme, jms:jme), optional, INTENT(INOUT)::  re_cloud, re_ice, re_snow, re_rain
+      double precision :: proctot(nproc),proctotmpi(nproc)
+      REAL, DIMENSION(ims:ime, kms:kme, jms:jme), optional, INTENT(INOUT)::  re_cloud, re_ice, re_snow, &
+                                                                   re_rain, re_graup, re_hail
       REAL, DIMENSION(ims:ime, kms:kme, jms:jme), optional, INTENT(IN):: tkediss
-      INTEGER, INTENT(IN), optional :: has_reqc, has_reqi, has_reqs, has_reqr
+      INTEGER, INTENT(IN), optional :: has_reqc, has_reqi, has_reqs, has_reqr, has_reqg, has_reqh
       real, dimension(ims:ime, jms:jme), intent(out), optional ::                                 &
                             rainncw2, rainnci2       ! liquid rain, ice, accumulation rates
       real, optional, intent(in) :: dx,dy
@@ -2286,6 +2408,7 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
       integer, intent(in), optional :: ntmul, ntcnt
       logical, optional, intent(in) :: lastloop
       logical, optional, intent(in) :: diagflag, f_cna, f_cn, f_cina, f_cnuf
+      logical, optional, intent(in) :: f_qc, f_qr, f_qi, f_qs, f_qh, f_qhl
       integer, optional, intent(in) :: ipelectmp, ke_diag
 
    ! CCPP error handling
@@ -2298,7 +2421,11 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
   LOGICAL :: flag_qndrop  ! wrf-chem
   LOGICAL :: flag_qnifa , flag_qnwfa
   logical :: flag_cnuf = .false.
+  logical :: flag_ccn = .false.
+  logical :: flag_qi  = .true.
+  logical :: has_reqg_local = .false., has_reqh_local = .false.
   logical :: flag
+  logical :: nwp_diagflag = .false.
   real :: cinchange, t7max,testmax,wmax
 
 ! 20130903 acd_ck_washout start
@@ -2323,9 +2450,11 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
      real, dimension(its:ite, kts:kte) :: rainprod2d, evapprod2d,tke2d
      real, dimension(its:ite, 1, kts:kte, na) :: an, ancuten
      real, dimension(its:ite, 1, kts:kte, nxtra) :: axtra2d
+     real, dimension(its:ite, 1, kts:kte, 3) :: alpha2d
      real, dimension(its:ite, 1, kts:kte) :: t0,t1,t2,t3,t4,t5,t6,t7,t8,t9
      real, dimension(its:ite, 1, kts:kte) :: dn1,t00,t77,ssat,pn,wn,dz2d,dz2dinv,dbz2d,vzf2d
      real, dimension(its:ite, 1, na) :: xfall
+     real, dimension(its:ite, 1) :: hailmax1d,hailmaxk1
      real, dimension(kts:kte, nproc) :: thproclocal
      integer, parameter :: nor = 0, ng = 0
      integer :: nx,ny,nz,ngs
@@ -2374,15 +2503,6 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
       integer :: loopcnt, loopmax, outerloopcnt
       logical :: lastlooptmp
 
-#ifdef MPI
-
-#if defined(MPI) 
-      integer, parameter :: ntot = 50
-      double precision  mpitotindp(ntot), mpitotoutdp(ntot)
-      INTEGER :: mpi_error_code = 1
-#endif
-#endif
-
 
 ! -------------------------------------------------------------------
 
@@ -2397,11 +2517,35 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
      flag_qnifa = .false.
      flag_qnwfa = .false.
      flag_cnuf = .false.
+     flag_ccn = .false.
+     nwp_diagflag = .false.
      
      IF ( PRESENT ( nssl_progn ) ) flag_qndrop = nssl_progn
      IF ( present ( f_cnuf ) ) flag_cnuf = f_cnuf
+     IF ( present ( nwp_diagnostics ) ) nwp_diagflag = ( nwp_diagnostics > 0 )
+
+     IF ( present ( f_cn ) .and. present( cn ) ) THEN 
+       flag_ccn = f_cn
+     ELSEIF ( present( cn ) ) THEN
+       flag_ccn = .true.
+     ENDIF
+     
+     IF ( present( f_qi ) ) THEN
+       flag_qi = f_qi
+     ELSE
+       IF ( ffrzs < 1.0 ) THEN
+         flag_qi = .true.
+       ELSE
+         flag_qi = .false.
+       ENDIF
+     ENDIF
+     
+     IF ( .not. flag_qi .and. ffrzs < 1.0 ) ffrzs = 1.0
 
      
+     IF ( PRESENT ( has_reqg ) ) has_reqg_local = has_reqg > 0
+     IF ( PRESENT ( has_reqh ) ) has_reqh_local = has_reqh > 0
+     
      loopmax = 1
      outerloopcnt = 1
      lastlooptmp = .true.
@@ -2411,7 +2555,13 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
        lastlooptmp = lastloop
      ENDIF
           
-     ! ---
+
+         has_wetscav = .false.
+         IF ( wrfchem_flag > 0 ) THEN
+           IF ( PRESENT( wetscav_on ) ) THEN
+             has_wetscav = wetscav_on
+           ENDIF
+         ENDIF
 
      IF ( present( f_cna ) ) THEN
        f_cnatmp = f_cna
@@ -2462,8 +2612,9 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
      nx = ite-its+1
      ny = 1         ! set up as 2D slabs
      nz = kte-kts+1
+     ngs = Max(nz,64)
      
-     IF ( .not. present( cn ) ) THEN
+     IF ( .not. flag_ccn ) THEN
        renucfrac = 1.0
      ENDIF
 
@@ -2527,30 +2678,32 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
 
      DO jy = jts,jye
      
-     xfall(:,:,:) = 0.0
-
 !     write(0,*) 'N2M: load an, jy,lccn = ',jy,lccn,qccn
 
      IF ( present( pcc2 ) .and. makediag ) THEN
          axtra2d(its:ite,1,kts:kte,:) = 0.0
      ENDIF
 
+     IF ( nwp_diagflag ) THEN
+        alpha2d(its:ite,1,kts:kte,1) = alphar
+        alpha2d(its:ite,1,kts:kte,2) = alphah
+        alpha2d(its:ite,1,kts:kte,3) = alphahl
+     ENDIF
+
+
    ! copy from 3D array to 2D slab
    
        DO kz = kts,kte
         DO ix = its,ite
-
           IF ( present( tt ) ) THEN
             an(ix,1,kz,lt) = tt(ix,kz,jy)/pii(ix,kz,jy)
           ELSE
             an(ix,1,kz,lt) = th(ix,kz,jy)
           ENDIF
-
-        
           an(ix,1,kz,lv)   = qv(ix,kz,jy)
           an(ix,1,kz,lc)   = qc(ix,kz,jy)
           an(ix,1,kz,lr)   = qr(ix,kz,jy)
-          IF ( present( qi ) ) THEN
+          IF ( flag_qi ) THEN
             an(ix,1,kz,li)   = qi(ix,kz,jy)
           ELSE
             an(ix,1,kz,li) = 0.0
@@ -2561,7 +2714,7 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
           IF ( lccn > 1 ) THEN
            IF ( is_aerosol_aware .and. flag_qnwfa ) THEN
             ! 
-           ELSEIF ( present( cn ) ) THEN
+           ELSEIF ( flag_ccn ) THEN
              IF ( lccna > 1 .and. .not. ( present( cna ) .and. f_cnatmp ) ) THEN
                an(ix,1,kz,lccna) = cn(ix,kz,jy)
                an(ix,1,kz,lccn) = qccn ! cn(ix,kz,jy)
@@ -2690,6 +2843,7 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
 !
       ssival = Min(t8s,max(an(ix,1,kz,lv),0.0))/t9s  ! qv/qvi
 
+
       if ( ssival .gt. 1.0 ) then
 !
       IF ( icenucopt == 1 ) THEN
@@ -2750,7 +2904,8 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
         ! naer needs units of cm**-3, so mult by 1.e-6
         
         !  dp1 = 1.e3*0.0000594*(273.16 - t0(ix,1,kz))**3.33 * (1.e-6*cin*dn(ix,1,kz))**(0.0264*(273.16 - t0(ix,1,kz)) + 0.0033)
-          dp1 = 1.e3*dn1(ix,1,kz)/rho00*0.0000594*(273.16 - t0(ix,1,kz))**3.33 * (1.e-6*naer)**(0.0264*(273.16 - t0(ix,1,kz)) + 0.0033)
+            tmp = 1.e-6*naer
+          dp1 = 1.e3*dn1(ix,1,kz)/rho00*0.0000594*(273.16 - t0(ix,1,kz))**3.33 * tmp**(0.0264*(273.16 - t0(ix,1,kz)) + 0.0033)
           t7(ix,1,kz) = Min(dp1, 1.0d30)
       
         ELSE
@@ -2767,16 +2922,12 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
         ENDDO ! ix
        ENDDO ! kz
 
-         has_wetscav = .false.
-         IF ( wrfchem_flag > 0 ) THEN
-           IF ( PRESENT( wetscav_on ) ) THEN
-             has_wetscav = wetscav_on
-             IF ( has_wetscav ) THEN
-               IF ( PRESENT( rainprod ) ) rainprod2d(its:ite,kts:kte) = 0
-               IF ( PRESENT( evapprod ) ) evapprod2d(its:ite,kts:kte) = 0
-             ENDIF
-           ENDIF
-         ENDIF
+      IF ( wrfchem_flag > 0 ) THEN
+          IF ( has_wetscav ) THEN
+            IF ( PRESENT( rainprod ) ) rainprod2d(its:ite,kts:kte) = 0
+            IF ( PRESENT( evapprod ) ) evapprod2d(its:ite,kts:kte) = 0
+          ENDIF
+      ENDIF
          
 
    ! transform from number mixing ratios to number conc.
@@ -2917,9 +3068,6 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
        
 !      ENDIF ! .false.
  
-
-      ngs = 128
-
       IF ( isedonly /= 1 ) THEN
    ! call nssl_2mom_gs: main gather-scatter routine to calculate microphysics
 
@@ -2940,11 +3088,11 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
 !     &   ln,ipc,lvol,lz,lliq,              &
      &   cdx,                              &
      &   xdn0,dbz2d,tke2d,                 &
-     &   thproclocal,nproc,dx1,dy1,    &
+     &   thproclocal,nproc,dx1,dy1,ngs,    &
      &   timevtcalc,axtra2d, makediag        &
-     &   ,has_wetscav, rainprod2d, evapprod2d  &
+     &   ,has_wetscav, rainprod2d, evapprod2d, alpha2d  &
      & ,errmsg,errflg &
-     &   ,elec2,its,ids,ide,jds,jde,ngs      &
+     &   ,elec2,its,ids,ide,jds,jde          &
      & )
 
 
@@ -2967,9 +3115,10 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
      &  ,dz2d & 
      &  ,t0,t9 & 
      &  ,an,dn1,t77 & 
-     &  ,pn,wn & 
+     &  ,pn,wn &
+     &  ,ngs   &
      &  ,axtra2d, makediag  &
-     &  ,ssat,t00,t77,flag_qndrop,ngs)
+     &  ,ssat,t00,t77,flag_qndrop)
 
 ! recalculate dn1 after temperature changes 
       DO kz = kts,kte
@@ -2985,14 +3134,12 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
 
 
      ENDDO ! loopcnt=1,loopmax
-
      IF ( present( pcc2 ) .and. makediag ) THEN
          DO kz = kts,kte
           DO ix = its,ite
 ! example of using the 'axtra2d' array to get rates out of the microphysics routine for output.
 ! Search for 'axtra' to find example code below
 !            pcc2(ix,kz,jy)    = axtra2d(ix,1,kz,1)
-
           ENDDO
          ENDDO
      ENDIF
@@ -3056,7 +3203,7 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
           call calc_eff_radius   &
      &         (nx,ny,nz,na,jy & 
      &          ,nor,nor & 
-     &          ,t1=t1,t2=t2,t3=t3,t4=t4  & 
+     &          ,t1=t1,t2=t2,t3=t3,t4=t4,t5=t5,t6=t6,f_t5=has_reqg_local, f_t6=has_reqh_local  & 
      &          ,an=an,dn=dn1 )
 
         DO kz = kts,kte
@@ -3078,12 +3225,46 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
          ENDDO
          ENDIF
        ENDIF
+
+       IF ( present(has_reqg) .and. present( re_graup ) ) THEN
+         IF ( has_reqg /= 0 ) THEN
+         DO kz = kts,kte
+           DO ix = its,ite
+            re_graup(ix,kz,jy)  = MAX(50.E-6, MIN(t5(ix,1,kz), 10.E-3))
+           ENDDO
+         ENDDO
+         ENDIF
+       ENDIF
+
+       IF ( present(has_reqh) .and. present( re_hail ) ) THEN
+         IF ( has_reqh /= 0 ) THEN
+         DO kz = kts,kte
+           DO ix = its,ite
+            re_hail(ix,kz,jy)  = MAX(50.E-6, MIN(t5(ix,1,kz), 40.E-3))
+           ENDDO
+         ENDDO
+         ENDIF
+       ENDIF
        
          ENDIF
         ENDIF
 
 
+     IF ( present( hail_maxk1 ) .and. present( hail_max2d ) .and. nwp_diagflag ) THEN
+         DO ix = its,ite
+            hailmax1d(ix,1) = hail_max2d(ix,jy)
+            hailmaxk1(ix,1) = hail_maxk1(ix,jy)
+         ENDDO
 
+         call hailmaxd(dtp,nx,ny,nz,an,na,nor,nor,alpha2d,dn1,   &
+                          hailmax1d,hailmaxk1,1 )
+
+         DO ix = its,ite
+           hail_max2d(ix,jy) = hailmax1d(ix,1)
+           hail_maxk1(ix,jy) = hailmaxk1(ix,1)
+         ENDDO
+!       ENDIF
+     ENDIF
    
 ! transform concentrations back to mixing ratios
      DO il = lnb,na
@@ -3111,14 +3292,14 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
          qv(ix,kz,jy)  = an(ix,1,kz,lv)
          qc(ix,kz,jy)  = an(ix,1,kz,lc)
          qr(ix,kz,jy)  = an(ix,1,kz,lr)
-         IF ( present(qi) ) qi(ix,kz,jy)  = an(ix,1,kz,li)
+         IF ( flag_qi ) qi(ix,kz,jy)  = an(ix,1,kz,li)
          qs(ix,kz,jy)  = an(ix,1,kz,ls)
          qh(ix,kz,jy)  = an(ix,1,kz,lh)
          IF ( lhl > 1 ) qhl(ix,kz,jy) = an(ix,1,kz,lhl)
          
          IF ( lccn > 1 .and. is_aerosol_aware .and. flag_qnwfa ) THEN
            ! not used here
-         ELSEIF ( present( cn ) .and. lccn > 1 .and. .not. flag_qndrop) THEN
+         ELSEIF ( flag_ccn .and. lccn > 1 .and. .not. flag_qndrop) THEN
             IF ( lccna > 1 .and. .not. ( present( cna ) .and. f_cnatmp ) ) THEN
               cn(ix,kz,jy) = Max(0.0, an(ix,1,kz,lccna) )
             ELSE
@@ -3185,7 +3366,8 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
 
         ENDDO
        ENDDO
-  
+
+
      ENDDO ! jy
      
      
@@ -3824,8 +4006,242 @@ Function delabk(ba,bb,nua,nub,mua,mub,k)
       
       RETURN
       END Function delabk
+
+
+
+! #######################################################################
+!  HAILMAXD - calculated maximum expected hail size
+! #######################################################################
+!>\ingroup mod_nsslmp
+!! Hail max size subroutine. 
+     subroutine hailmaxd(dtp,nx,ny,nz,an,na,nor,norz,alpha2d,dn,  &
+     &                    hailmax1d,hailmaxk1,jslab ) 
+!
+! Calculate maximum hail size from the tail of of the distribution. The value
+! of thresh_conc sets the minimum concentration in the integral over (Dmax, Inf).
+! This uses the lookup tables for incomplete gamma functions and simply search for
+! the expected value (and linearly interpolate) on D.
+!
+!  Written by ERM 7/2023
+!
+!
+!
+      implicit none
+
+      integer nx,ny,nz,nor,norz,ngt,jgs,na,ia
+      integer id ! =1 use density, =0 no density
+!      integer :: its,ite ! x-range to calculate
       
+      integer ng1
+      parameter(ng1 = 1)
+
+      real an(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz,na)
+      real dn(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz)
+
+!      real gz(-nor+ng1:nz+nor),z1d(-nor+ng1:nz+nor,4)
+      real dtp
+      real alpha2d(-nor+1:nx+nor,1,-norz+1:nz+norz,3)  ! array for PSD shape parameters
+      real  :: hailmax1d(nx,ny),hailmaxk1(nx,ny)
+      integer infdo
+      integer jslab ! which line of xfall to use
+            
+      integer ix,jy,kz,ndfall,n,k,il,in
+      double precision :: tmp, ratio, del, g1palp
+      real, parameter :: dz = 200.
+
+      real :: db1(nx,nz+1),dtz1(nz+1,nx,0:1),dz2dinv(nz+1,nx),db1inv(nx,nz+1)
+      
+      real :: rhovtzx(nz,nx)
+
+      real :: alp, diam, diam1, hwdn
+      
+!      real, parameter :: cmin = 0.001 ! threshold number per m^3 for maximum diamter (threshold from diag_nwp)
+      DOUBLE PRECISION, PARAMETER:: thresh_conc = 0.0005d0                 ! number conc. of graupel/hail per cubic meter
+      real :: cwchtmp,cwchltmp, maxdia
+
+!-----------------------------------------------------------------------------
+
+      integer :: ixb, jyb, kzb
+      integer :: ixe, jye, kze
+      integer :: plo, phi
+      integer :: ialp, i, j
+
+      logical :: debug_mpi = .TRUE.
+
+! ###################################################################
+
+
+      IF ( lh > 1 ) THEN
+        cwchtmp  = ((3. + dnu(lh))*(2. + dnu(lh))*(1.0 + dnu(lh)))**(-1./3.)
+      ENDIF
+      IF ( lhl > 1 ) THEN
+        cwchltmp = ((3. + dnu(lhl))*(2. + dnu(lhl))*(1.0 + dnu(lhl)))**(-1./3.)
+      ENDIF
+
+
+      kzb = 1
+      kze = nz
+
+      ixb = 1  ! aliased its
+      ixe = nx ! aliased ite
+
+
+      jy = jslab
+      jgs = jy
+
+
+!      hailmax1d(:,jy) = 0.0
+!      hailmaxk1(:,jy) = 0.0
+
+      if ( ndebug .gt. 0 ) write(0,*) 'dbg = 3a'
+
+
+! first graupel, even if hail is also predicted, since graupel can sometime be large on its own
+      IF ( lh > 1 .and. lnh > 1 ) THEN
+      DO kz = kzb,kze
+      DO ix = ixb,ixe
+        IF ( an(ix,jy,kz,lh) .gt. qxmin(lh) .and. an(ix,jy,kz,lnh) .gt. thresh_conc ) THEN
+          IF ( lvh .gt. 1 ) THEN
+            hwdn = dn(ix,jy,kz)*an(ix,jy,kz,lh)/an(ix,jy,kz,lvh)
+          ELSE
+            hwdn = rho_qh
+          ENDIF
 
+          tmp = 1. + alpha2d(ix,1,kz,2)
+          i = Int(dgami*(tmp))
+          del = tmp - dgam*i
+          g1palp = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
+
+          tmp = dn(ix,jy,kz)*an(ix,jy,kz,lh)/(hwdn*an(ix,jy,kz,lnh))
+          diam = (6.0*tmp/(3.14159))**(1./3.)
+          IF ( lzh > 1 ) THEN ! 3moment
+            cwchtmp = ((3. + alpha2d(ix,1,kz,2))*(2. + alpha2d(ix,1,kz,2))*(1.0 + alpha2d(ix,1,kz,2)))**(-1./3.)
+          ENDIF
+          diam1 = diam*cwchtmp ! characteristic diameter, i.e., 1/lambda
+         ! want cxd1 = thresh_conc
+         !  tmp = gaminterp(ratio,alpha(mgs,lh),1,1)
+         ! cxd1 = cx(mgs,lh)*(tmp)/g1palp
+         ! tmp = thresh_conc*g1palp/cx
+         ! 
+         tmp = thresh_conc*g1palp/an(ix,jy,kz,lnh)
+         alp = alpha2d(ix,1,kz,2)
+         ! gamxinflu(i,j,luindex,ilh)
+           j = Int(Max(0.0,Min(maxalphalu,alp))*dqiacralphainv)
+           ratio = 0.0
+           maxdia = 0.0
+           ! eventually could replace with bisection search, but final value of i is usually small
+           ! compared to nqiacrratio
+           DO i = 0,nqiacrratio-1
+              IF ( gamxinflu(i,j,1,1) >= tmp .and. tmp >= gamxinflu(i+1,j,1,1) ) THEN
+               !  interpolate here for FWIW
+                ratio = i*dqiacrratio
+                del = tmp - gamxinflu(i,j,1,1)
+                ratio = (float(i) + del/(gamxinflu(i+1,j,1,1) - gamxinflu(i,j,1,1)))*dqiacrratio
+                exit
+              ENDIF
+           ENDDO
+           
+           IF ( ratio > 0.0 ) THEN
+              maxdia = ratio*diam1 ! units of m
+           ENDIF
+
+           IF ( kz == kzb ) THEN
+             hailmaxk1(ix,jy) = Max( maxdia, hailmaxk1(ix,jy) )
+!             IF ( maxdia > 0.1 ) THEN
+!            IF ( an(ix,jy,kz,lh) > 1.e-4 ) THEN
+!              write(0,*) 'maxdia,tmp,alp,ratio,diam,diam1= ',maxdia,tmp,alp,ratio,diam*100.,diam1*100.
+!              write(0,*) 'hwdn, cxhl, qx, g1palp = ',hwdn, an(ix,jy,kz,lnhl), an(ix,jy,kz,lhl), g1palp
+!              write(0,*) 'j,gamxinflu(0,2,4) = ',j,gamxinflu(0,j,1,1),gamxinflu(2,j,1,1), &
+!                gamxinflu(4,j,1,1)
+!            ENDIF
+           ENDIF
+           
+           hailmax1d(ix,jy) = Max(maxdia, hailmax1d(ix,jy) )
+
+        ! 
+
+        ENDIF
+
+      ENDDO
+      ENDDO
+
+      ENDIF ! lh
+
+! And diam for hail if present
+      IF ( lhl > 1 .and. lnhl > 1 ) THEN
+      DO kz = kzb,kze
+      DO ix = ixb,ixe
+        IF ( an(ix,jy,kz,lhl) .gt. qxmin(lhl) .and. an(ix,jy,kz,lnhl) .gt. thresh_conc ) THEN
+          IF ( lvhl .gt. 1 ) THEN
+            hwdn = dn(ix,jy,kz)*an(ix,jy,kz,lhl)/an(ix,jy,kz,lvhl)
+          ELSE
+            hwdn = rho_qhl
+          ENDIF
+
+          tmp = 1. + alpha2d(ix,1,kz,3)
+          i = Int(dgami*(tmp))
+          del = tmp - dgam*i
+          g1palp = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
+
+          tmp = dn(ix,jy,kz)*an(ix,jy,kz,lhl)/(hwdn*an(ix,jy,kz,lnhl))
+          diam = (6.0*tmp/(3.14159))**(1./3.)
+          IF ( lzhl > 1 ) THEN ! 3moment
+            cwchltmp = ((3. + alpha2d(ix,1,kz,3))*(2. + alpha2d(ix,1,kz,3))*(1.0 + alpha2d(ix,1,kz,3)))**(-1./3.)
+          ENDIF
+          diam1 = diam*cwchltmp ! characteristic diameter, i.e., 1/lambda
+         ! want cxd1 = thresh_conc
+         !  tmp = gaminterp(ratio,alpha(mgs,lh),1,1)
+         ! cxd1 = cx(mgs,lh)*(tmp)/g1palp
+         ! tmp = thresh_conc*g1palp/cx
+         ! 
+         tmp = thresh_conc*g1palp/an(ix,jy,kz,lnhl)
+         alp = alpha2d(ix,1,kz,3)
+         ! gamxinflu(i,j,luindex,ilh)
+           j = Int(Max(0.0,Min(maxalphalu,alp))*dqiacralphainv)
+           ratio = 0.0
+           maxdia = 0.0
+           ! eventually could replace with bisection search, but final value of i is usually small
+           ! compared to nqiacrratio
+           DO i = 0,nqiacrratio-1
+              IF ( gamxinflu(i,j,1,1) >= tmp .and. tmp >= gamxinflu(i+1,j,1,1) ) THEN
+               !  interpolate here for FWIW
+                ratio = i*dqiacrratio
+                del = tmp - gamxinflu(i,j,1,1)
+                ratio = (float(i) + del/(gamxinflu(i+1,j,1,1) - gamxinflu(i,j,1,1)))*dqiacrratio
+                exit
+              ENDIF
+           ENDDO
+           
+           IF ( ratio > 0.0 ) THEN
+              maxdia = ratio*diam1 ! units of m
+           ENDIF
+
+           IF ( kz == kzb ) THEN
+             hailmaxk1(ix,jy) = Max( maxdia, hailmaxk1(ix,jy) )
+!             IF ( maxdia > 0.1 ) THEN
+!            IF ( an(ix,jy,kz,lhl) > 1.e-4 ) THEN
+!              write(0,*) 'maxdia,tmp,alp,ratio,diam,diam1= ',maxdia,tmp,alp,ratio,diam*100.,diam1*100.
+!              write(0,*) 'hwdn, cxhl, qx, g1palp = ',hwdn, an(ix,jy,kz,lnhl), an(ix,jy,kz,lhl), g1palp
+!              write(0,*) 'j,gamxinflu(0,2,4) = ',j,gamxinflu(0,j,1,1),gamxinflu(2,j,1,1), &
+!                gamxinflu(4,j,1,1)
+!            ENDIF
+           ENDIF
+           
+           hailmax1d(ix,jy) = Max(maxdia, hailmax1d(ix,jy) )
+
+        ! 
+
+        ENDIF
+
+      ENDDO
+      ENDDO
+
+      ENDIF
+
+
+     END SUBROUTINE HAILMAXD
+! #######################################################################
+! #######################################################################
 !>\ingroup mod_nsslmp
 !! Sedimentation driver subroutine. Calls fallout column by column
      subroutine sediment1d(dtp,nx,ny,nz,an,na,nor,norz,xfall,dn,dz3d,dz3dinv, &
@@ -4872,9 +5288,6 @@ subroutine calcnfromq(nx,ny,nz,an,na,nor,norz,dn, &
 
              an(ix,jy,kz,lnr) = nrx ! *dninv ! convert to number mixing ratio
              
-             IF ( lzr > 1 ) THEN ! set reflectivity moment
-               an(ix,jy,kz,lzr) = 36.*g1r*dn(ix,kz)**2*q**2/(pi**2*xdnr**2*nrx) ! *dninv
-             ENDIF
            ELSEIF ( an(ix,jy,kz,lr) <= qxmin(lr) .or. &
                     ( an(ix,jy,kz,lnr) <= cxmin .and. an(ix,jy,kz,lr) <= qxmin_init(lr)) ) THEN
              an(ix,jy,kz,lv) = an(ix,jy,kz,lv) + an(ix,jy,kz,lr)
@@ -4883,6 +5296,15 @@ subroutine calcnfromq(nx,ny,nz,an,na,nor,norz,dn, &
            ENDIF
          ENDIF
 
+             IF ( lzr > 1 ) THEN ! set reflectivity moment
+               IF ( an(ix,jy,kz,lr) > qxmin_init(lr) .and. an(ix,jy,kz,lzr) < zxmin .and. &
+                    an(ix,jy,kz,lnr) > cxmin ) THEN
+                  q = an(ix,jy,kz,lr)
+                  nrx = an(ix,jy,kz,lnr)
+                  an(ix,jy,kz,lzr) = 36.*g1r*dn(ix,kz)**2*q**2/(pi**2*xdnr**2*nrx) ! *dninv
+               ENDIF
+             ENDIF
+
   ! snow
          IF ( lns > 1 ) THEN
            IF ( an(ix,jy,kz,lns) <= 0.1*cxmin .and. an(ix,jy,kz,ls) > qxmin_init(ls) ) THEN
@@ -4936,9 +5358,6 @@ subroutine calcnfromq(nx,ny,nz,an,na,nor,norz,dn, &
                an(ix,jy,kz,lvh) = 0.0
              ENDIF
 
-             IF ( lzh > 1 ) THEN ! set reflectivity moment
-               an(ix,jy,kz,lzh) = 36.*g1h*dn(ix,kz)**2*q**2/(pi**2*xdnh**2*nrx) ! *dninv
-             ENDIF
            ELSEIF ( an(ix,jy,kz,lh) <= qxmin(lh) .or. &
                     ( an(ix,jy,kz,lnh) <= cxmin .and. an(ix,jy,kz,lh) <= qxmin_init(lh)) ) THEN
            
@@ -4948,6 +5367,15 @@ subroutine calcnfromq(nx,ny,nz,an,na,nor,norz,dn, &
            ENDIF
          ENDIF
 
+             IF ( lzh > 1 ) THEN ! set reflectivity moment
+               IF ( an(ix,jy,kz,lh) > qxmin_init(lh) .and. an(ix,jy,kz,lzh) < zxmin .and. &
+                    an(ix,jy,kz,lnh) > cxmin ) THEN
+                  q = an(ix,jy,kz,lh)
+                  nrx = an(ix,jy,kz,lnh)
+                  an(ix,jy,kz,lzh) = 36.*g1h*dn(ix,kz)**2*q**2/(pi**2*xdnh**2*nrx) ! *dninv
+               ENDIF
+             ENDIF
+
     ! hail
 
          IF ( lnhl > 1 .and. lhl > 1 ) THEN
@@ -4968,10 +5396,6 @@ subroutine calcnfromq(nx,ny,nz,an,na,nor,norz,dn, &
 
              an(ix,jy,kz,lnhl) = nrx ! *dninv ! convert to number mixing ratio
 
-             IF ( lzhl > 1 ) THEN ! set reflectivity moment
-               an(ix,jy,kz,lzhl) = 36.*g1hl*dn(ix,kz)**2*q**2/(pi**2*xdnhl**2*nrx) ! *dninv
-             ENDIF
-
            ELSEIF ( an(ix,jy,kz,lhl) <= qxmin(lhl) .or.  &
                    ( an(ix,jy,kz,lnhl) <= cxmin .and. an(ix,jy,kz,lhl) <= qxmin_init(lhl)) ) THEN
            
@@ -4980,6 +5404,15 @@ subroutine calcnfromq(nx,ny,nz,an,na,nor,norz,dn, &
            
            ENDIF
          ENDIF
+
+             IF ( lzhl > 1 ) THEN ! set reflectivity moment
+               IF ( an(ix,jy,kz,lhl) > qxmin_init(lhl) .and. an(ix,jy,kz,lzhl) < zxmin .and. &
+                    an(ix,jy,kz,lnhl) > cxmin ) THEN
+                  q = an(ix,jy,kz,lhl)
+                  nrx = an(ix,jy,kz,lnhl)
+                  an(ix,jy,kz,lzhl) = 36.*g1hl*dn(ix,kz)**2*q**2/(pi**2*xdnhl**2*nrx) ! *dninv
+               ENDIF
+             ENDIF
          
          
 !         ENDIF
@@ -5250,7 +5683,7 @@ END subroutine calcnfromcuten
    SUBROUTINE calc_eff_radius    &
      &  (nx,ny,nz,na,jyslab & 
      &  ,nor,norz & 
-     &  ,t1,t2,t3,t4  & 
+     &  ,t1,t2,t3,t4,t5,t6, f_t5,f_t6  & 
      &  ,qcw,qci,qsw,qrw &
      &  ,ccw,cci,csw,crw &
      &  ,an,dn )
@@ -5272,6 +5705,9 @@ SUBROUTINE calc_eff_radius    &
       real,optional :: t2(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz)
       real,optional :: t3(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz)
       real,optional :: t4(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz)
+      real,optional :: t5(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz)
+      real,optional :: t6(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz)
+      logical, optional :: f_t5, f_t6 ! flags to fill t5/t6 for graupel/hail
 
       real, optional :: an(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz,na)
       real dn(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz)
@@ -7495,7 +7931,7 @@ subroutine ziegfall1d(nx,ny,nz,nor,norz,na,dtp,jgs,ixcol, &
             cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/(z*1000.*1000)
             an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
 
-           ELSEIF ( zx(mgs,il) <= 0.0 .and. cx(mgs,il) > 0.0 ) THEN
+           ELSEIF ( zx(mgs,il) <= zxmin .and. cx(mgs,il) > cxmin ) THEN
 !  have mass and concentration but no reflectivity, so set reflectivity, using default alpha
             g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
             chw = cx(mgs,il)
@@ -7511,7 +7947,7 @@ subroutine ziegfall1d(nx,ny,nz,nor,norz,na,dtp,jgs,ixcol, &
             zx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/(xdn(mgs,lr)**2*chw)
             an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
 
-           ELSEIF ( zx(mgs,il) <= 0.0 .and. cx(mgs,il) <= 0.0 ) THEN
+           ELSEIF ( zx(mgs,il) <= zxmin .and. cx(mgs,il) <= 0.0 ) THEN
 !   How did this happen?
          ! set values according to dBZ of -10, or Z = 0.1
 !              write(91,*) 'alpha = ',alpha(mgs,il)
@@ -7710,7 +8146,7 @@ subroutine ziegfall1d(nx,ny,nz,nor,norz,na,dtp,jgs,ixcol, &
 !            zx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/chw
             zx(mgs,il) = Min(zxmin*1.1, g1*dn(igs(mgs),jy,kgs(mgs))**2*(6*qr)**2/(chw*(pi*xdn(mgs,il))**2) )
             an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
-           ELSEIF ( zx(mgs,il) <= 0.0 .and. cx(mgs,il) <= 0.0 ) THEN
+           ELSEIF ( zx(mgs,il) <= zxmin .and. cx(mgs,il) <= 0.0 ) THEN
 !   How did this happen?
 !              write(91,*) 'ziegfall: something screwy with moments: il = ',il
 !              write(91,*) 'q,n,z = ', 1.e3*qx(mgs,il),cx(mgs,il),zx(mgs,il)
@@ -7737,7 +8173,7 @@ subroutine ziegfall1d(nx,ny,nz,nor,norz,na,dtp,jgs,ixcol, &
           ENDIF
          ENDIF
 
-        IF ( qx(mgs,il) .gt. qxmin(il) .and. cx(mgs,il) .gt. 0.0 ) THEN
+        IF ( qx(mgs,il) .gt. qxmin(il) .and. cx(mgs,il) .gt. cxmin ) THEN
           chw = cx(mgs,il)
           qr  = qx(mgs,il)
           z   = zx(mgs,il)
@@ -9003,8 +9439,9 @@ SUBROUTINE NUCOND    &
      &  ,t0,t9 & 
      &  ,an,dn,p2 & 
      &  ,pn,w & 
+     &  ,ngs   &
      &  ,axtra,io_flag &
-     &  ,ssfilt,t00,t77,flag_qndrop,ngs  &
+     &  ,ssfilt,t00,t77,flag_qndrop  &
      & )
 
 
@@ -9061,6 +9498,7 @@ SUBROUTINE NUCOND    &
       logical :: io_flag
       
       real :: dv
+      real :: ccnefactwo, sstmp, cn1, cnuctmp
 
 ! 
 !  declarations microphysics and for gather/scatter
@@ -9069,7 +9507,6 @@ SUBROUTINE NUCOND    &
       real, parameter :: cwmas20 = 1000.*0.523599*(2.*20.e-6)**3 ! mass of 20-micron radius droplet, for sat. adj.
       integer nxmpb,nzmpb,nxz
       integer mgs,ngs,numgs,inumgs
-!      parameter (ngs=1 )
       integer ngscnt,igs(ngs),kgs(ngs)
       integer kgsp(ngs),kgsm(ngs)
       integer nsvcnt
@@ -9088,6 +9525,7 @@ SUBROUTINE NUCOND    &
 
 
       real ccnc(ngs), ccna(ngs), cnuc(ngs), cwnccn(ngs)
+      real :: ccnc_nu(ngs), ccnc_ac(ngs), ccnc_co(ngs)
       real ccncuf(ngs)
       real sscb  ! 'cloud base' SS threshold
       parameter ( sscb = 2.0 )
@@ -9100,7 +9538,7 @@ SUBROUTINE NUCOND    &
       integer ifilt   ! =1 to filter ssat, =0 to set ssfilt=ssat
       parameter ( ifilt = 0 ) 
       real temp1,temp2 ! ,ssold
-      real :: ssmax(ngs)       ! maximum SS experienced by a parcel
+      real :: ssmax(ngs)      ! maximum SS experienced by a parcel
       real ssmx
       real dnnet,dqnet
 !      real cnu,rnu,snu,cinu
@@ -9224,7 +9662,6 @@ SUBROUTINE NUCOND    &
       
       integer :: count
       
-
 ! -------------------------------------------------------------------------------
       itile = nxi
       jtile = ny
@@ -9238,6 +9675,7 @@ SUBROUTINE NUCOND    &
       kzbeg = 1
       nzbeg = 1
 
+      IF ( ac_opt > 0 )  ccnefactwo =  (1.63e-3/(cck * beta(3./2., cck/2.)))**(1.0/(cck + 2.0))
       f5 = 237.3 * 17.27 * 2.5e6 / cp ! combined constants for rain condensation (Soong and Ogura 73)
 
        jy = 1
@@ -9463,12 +9901,16 @@ SUBROUTINE NUCOND    &
         ELSE
           ssmax(mgs) = 0.0
         ENDIF
-        IF ( lccn .gt. 1 ) THEN
-          ccnc(mgs) = an(igs(mgs),jy,kgs(mgs),lccn)
+        IF ( lccn .gt. 1 .and. ac_opt == 0 ) THEN
+          IF ( lccnuf .gt. 1 .and. i_uf_or_ccn > 0 ) THEN
+             ccnc(mgs) = an(igs(mgs),jy,kgs(mgs),lccn) + an(igs(mgs),jy,kgs(mgs),lccnuf)
+          ELSE
+             ccnc(mgs) = an(igs(mgs),jy,kgs(mgs),lccn)
+          ENDIF
         ELSE
           ccnc(mgs) = cwnccn(mgs)
         ENDIF
-        IF ( lccnuf .gt. 1 ) THEN
+        IF ( lccnuf .gt. 1 .and. i_uf_or_ccn == 0 ) THEN
           ccncuf(mgs) = an(igs(mgs),jy,kgs(mgs),lccnuf)
         ELSE
           ccncuf(mgs) = 0.0
@@ -9534,7 +9976,7 @@ SUBROUTINE NUCOND    &
           il = lr
           DO mgs = 1,ngscnt
 
-         IF ( zx(mgs,il) <= 0.0 ) THEN
+         IF ( zx(mgs,il) <= zxmin ) THEN
            qx(mgs,lv) = qx(mgs,lv) + qx(mgs,il)
            qx(mgs,il) = 0.0
            cx(mgs,il) = 0.0
@@ -9577,7 +10019,7 @@ SUBROUTINE NUCOND    &
             
             ENDIF
 !            an(igs(mgs),jgs,kgs(mgs),ln(il)) = zx(mgs,il)
-           ELSEIF ( zx(mgs,il) <= 0.0 .and. cx(mgs,il) > 0.0 ) THEN
+           ELSEIF ( zx(mgs,il) <= zxmin .and. cx(mgs,il) > 0.0 ) THEN
 !  have mass and concentration but no reflectivity, so set reflectivity, using default alpha
             IF ( imurain == 3 ) THEN
             g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
@@ -9593,7 +10035,7 @@ SUBROUTINE NUCOND    &
             
             ENDIF
 
-           ELSEIF ( zx(mgs,il) <= 0.0 .and. cx(mgs,il) <= 0.0 ) THEN
+           ELSEIF ( zx(mgs,il) <= zxmin .and. cx(mgs,il) <= 0.0 ) THEN
 !   How did this happen?
          ! set values according to dBZ of -10, or Z = 0.1
 !              0.1 = 1.e18*0.224*an(ix,jy,kz,lzh)*(hwdn/rwdn)**2
@@ -9773,6 +10215,8 @@ SUBROUTINE NUCOND    &
       ssfkp1(mgs) = ssfilt(igs(mgs),jgs,Min(nz-1,kgs(mgs)+1))
       ssfkm1(mgs) = ssfilt(igs(mgs),jgs,Max(1,kgs(mgs)-1))
 
+!        IF ( wvel(mgs) /= 0.0 ) write(0,*) 'mgs,wvel1,ssf = ',mgs,wvel(mgs),ssf(mgs)
+
 
       ENDDO
 
@@ -9782,7 +10226,7 @@ SUBROUTINE NUCOND    &
 !  cloud water variables
 !
 
-      if ( ndebug .gt. 0 )write(0,*) 'ICEZVD_DR: Set cloud water variables'
+      if ( ndebug .gt. 0 ) write(0,*) 'ICEZVD_DR: Set cloud water variables'
 
       do mgs = 1,ngscnt
       xv(mgs,lc) = 0.0
@@ -9914,15 +10358,14 @@ SUBROUTINE NUCOND    &
         ENDIF
         qx(mgs,lc) = 0.
         IF ( restoreccn ) THEN
-          IF ( irenuc <= 2 ) THEN
-             IF ( .not. invertccn ) THEN
-              ccnc(mgs) = Max( ccnc(mgs), Min( qccn*rho0(mgs), ccnc(mgs) + restoreccnfrac*cx(mgs,lc) ) )
-             ELSE
-              ccnc(mgs) = ccnc(mgs) + restoreccnfrac*cx(mgs,lc)
-             ENDIF
-          ENDIF
-          IF ( lccna > 1 ) THEN
-            ccna(mgs) = ccna(mgs) - restoreccnfrac*cx(mgs,lc)
+           IF ( lccna > 1 ) THEN
+              ccna(mgs) = ccna(mgs) - restoreccnfrac*cx(mgs,lc)
+           ELSEIF ( irenuc <= 2 ) THEN
+              IF ( .not. invertccn ) THEN
+               ccnc(mgs) = Max( ccnc(mgs), Min( qccn*rho0(mgs), ccnc(mgs) + restoreccnfrac*cx(mgs,lc) ) )
+              ELSE
+               ccnc(mgs) = ccnc(mgs) + restoreccnfrac*cx(mgs,lc)
+              ENDIF
           ENDIF
         ENDIF
         cx(mgs,lc) = 0.
@@ -9932,7 +10375,9 @@ SUBROUTINE NUCOND    &
         qx(mgs,lc) = qx(mgs,lc) - QEVAP
         IF ( qx(mgs,lc) .le. 0. ) THEN
           IF ( restoreccn ) THEN
-            IF ( irenuc <= 2 ) THEN
+            IF ( lccna > 1 ) THEN
+              ccna(mgs) = ccna(mgs) - restoreccnfrac*cx(mgs,lc)
+            ELSEIF ( irenuc <= 2 ) THEN
 !              ccnc(mgs) = Max( ccnc(mgs), Min( qccn*rho0(mgs), ccnc(mgs) + cx(mgs,lc) ) )
 !              ccnc(mgs) = ccnc(mgs) + cx(mgs,lc)
               IF ( .not. invertccn ) THEN
@@ -9941,15 +10386,14 @@ SUBROUTINE NUCOND    &
                ccnc(mgs) = ccnc(mgs) + restoreccnfrac*cx(mgs,lc)
               ENDIF
             ENDIF
-            IF ( lccna > 1 ) THEN
-              ccna(mgs) = ccna(mgs) - restoreccnfrac*cx(mgs,lc)
-            ENDIF
           ENDIF
           cx(mgs,lc) = 0.
         ELSE
           tmp = 0.9*QEVAP*cx(mgs,lc)/qctmp ! let droplets get smaller but also remove some. A factor of 1.0 would maintain same size
           IF ( restoreccn ) THEN
-            IF ( irenuc <= 2 ) THEN
+            IF ( lccna > 1 ) THEN
+              ccna(mgs) = ccna(mgs) - restoreccnfrac*tmp
+            ELSEIF ( irenuc <= 2 ) THEN
  !             ccnc(mgs) = Max( ccnc(mgs), Min( qccn*rho0(mgs), ccnc(mgs) + tmp ) )
 !              ccnc(mgs) = ccnc(mgs) + tmp
               IF ( .not. invertccn ) THEN
@@ -9958,9 +10402,6 @@ SUBROUTINE NUCOND    &
                ccnc(mgs) = ccnc(mgs) + restoreccnfrac*tmp
               ENDIF
             ENDIF
-            IF ( lccna > 1 ) THEN
-              ccna(mgs) = ccna(mgs) - restoreccnfrac*tmp
-            ENDIF
           ENDIF
           cx(mgs,lc) = cx(mgs,lc) - tmp
         ENDIF
@@ -10300,7 +10741,8 @@ SUBROUTINE NUCOND    &
 !          IF ( ssf(mgs) > ssmx  .and. ssf(mgs) < 5.0 .and. ccnc(mgs) > 0.1*cwnccn(mgs) ) THEN ! this one works
 !          IF ( ssf(mgs) > ssmx  .and. ssf(mgs) < 20.0 ) THEN ! test -- fails
 !          IF ( ssf(mgs) > ssmx  .and. ssf(mgs) < 20.0 .and. ccnc(mgs) > 0.1*cwnccn(mgs)) THEN ! test -- is OK
-          IF ( ssf(mgs) > ssmx  .and. ssf(mgs) < 20.0 .and. ccnc(mgs) > 0.05*cwnccn(mgs)) THEN ! test
+          IF ( ssf(mgs) > ssmx  .and. ssf(mgs) < 20.0 .and.  &
+             ( ccnc(mgs) > 0.05*cwnccn(mgs) .or. ( ac_opt > 0 .and. ccnc_ac(mgs) - cx(mgs,lc) > 0.0 ) ) ) THEN ! test
 !          IF ( ssf(mgs) > ssmx ) THEN ! original condition
            CALL QVEXCESS(ngs,mgs,qwvp,qv0,qx(1,lc),pres,thetap,theta0,dcloud, & 
      &      pi0,tabqvs,nqsat,fqsat,cbw,fcqv1,felvcp,ssmx,pk,ngscnt)
@@ -10311,7 +10753,7 @@ SUBROUTINE NUCOND    &
         ELSE
             dcloud = 0.0
         ENDIF
-
+        
         thetap(mgs) = thetap(mgs) + felvcp(mgs)*DCLOUD/(pi0(mgs))
         qwvp(mgs) = qwvp(mgs) - DCLOUD
         qx(mgs,lc) = qx(mgs,lc) + DCLOUD
@@ -10336,11 +10778,16 @@ SUBROUTINE NUCOND    &
       
       IF (  .not. flag_qndrop ) THEN ! { do not calculate number of droplets if using wrf-chem
 
+      IF ( ac_opt == 0 ) THEN
+        cnuctmp = cnuc(mgs)
+      ELSE
+        cnuctmp = ccnc_ac(mgs)
+      ENDIF
       
 !      IF ( ssmax(mgs) .lt. sscb .and. qx(mgs,lc) .gt. qxmin(lc)) THEN
       IF ( dcloud .gt. qxmin(lc) .and. wvel(mgs) > 0.0) THEN
 !       CN(mgs) =   CCNE*wvel(mgs)**cnexp ! *Min(1.0,1./dtp) ! 0.3465
-       CN(mgs) =   CCNE0*cnuc(mgs)**(2./(2.+cck))*wvel(mgs)**cnexp ! *Min(1.0,1./dtp) ! 0.3465
+       CN(mgs) =   CCNE0*cnuctmp**(2./(2.+cck))*wvel(mgs)**cnexp ! *Min(1.0,1./dtp) ! 0.3465
         IF ( ny .le. 2 .and. cn(mgs) .gt. 0.0    &
      &                    .and. ncdebug .ge. 1 ) THEN 
           write(iunit,*) 'CN: ',cn(mgs)*1.e-6, cx(mgs,lc)*1.e-6, qx(mgs,lc)*1.e3,   &
@@ -10362,12 +10809,16 @@ SUBROUTINE NUCOND    &
       ENDIF
 
       IF ( cn(mgs) .gt. 0.0 ) THEN
-       IF ( cn(mgs) .gt. ccnc(mgs) ) THEN
-         cn(mgs) = ccnc(mgs)
-!         ccnc(mgs) = 0.0
+       IF ( ac_opt == 0 ) THEN
+         IF ( cn(mgs) .gt. ccnc(mgs) ) THEN
+           cn(mgs) = ccnc(mgs)
+!          ccnc(mgs) = 0.0
+         ENDIF
+       ELSE 
+         cn(mgs) = Min( cn(mgs), ccnc_ac(mgs) )
        ENDIF
 !      cx(mgs,lc) = cx(mgs,lc) + cn(mgs)
-      IF ( irenuc <= 2 ) ccnc(mgs) = Max(0.0, ccnc(mgs) - cn(mgs))
+      IF ( irenuc <= 2 .and. lccna < 1  ) ccnc(mgs) = Max(0.0, ccnc(mgs) - cn(mgs))
       ccna(mgs) = ccna(mgs) + cn(mgs)
       ENDIF
 
@@ -10413,7 +10864,8 @@ SUBROUTINE NUCOND    &
 
       DSSDZ=0.
       r2dzm=0.50/dz3d(igs(mgs),jy,kgs(mgs))
-      IF ( irenuc >= 0 .and. .not. flag_qndrop) THEN ! turn off nucleation when flag_qndrop (using WRF-CHEM for activation)
+
+      IF ( irenuc >= 0 .and. ac_opt == 0 .and. .not. flag_qndrop ) THEN ! turn off nucleation when flag_qndrop (using WRF-CHEM for activation)
 
       IF ( irenuc < 2 ) THEN !{
 
@@ -10490,6 +10942,7 @@ SUBROUTINE NUCOND    &
                ! nucleation
        CN(mgs) = Min(cn(mgs), ccnc(mgs))
        cn(mgs) = Min(cn(mgs), 0.5*dqc/cwmasn) ! limit the nucleation mass to half of the condensation mass
+       CN(mgs) = Min( CN(mgs), Max(0.0, (cnuc(mgs) - ccna(mgs) )) )
        
         IF ( .false. .and. ny <= 2 ) THEN
           write(0,*) 'i,k, cwmasn = ',igs(mgs),kgs(mgs),cwmasn
@@ -10517,7 +10970,7 @@ SUBROUTINE NUCOND    &
        
        cx(mgs,lc) = cx(mgs,lc) + cn(mgs)
        
-       ccnc(mgs) = Max(0.0, ccnc(mgs) - cn(mgs))
+       IF ( lccna < 1 ) ccnc(mgs) = Max(0.0, ccnc(mgs) - cn(mgs))
 
       ELSEIF ( irenuc == 3 ) THEN !} { 
       ! Phillips Donner Garner 2007
@@ -10704,17 +11157,22 @@ SUBROUTINE NUCOND    &
        ! 6/13/2016: Phillips et al. appears not to decrement CCN, but only increments CCNa.
        ! This would allow an initially non-homogeneous (vertically, e.g.) initial value of CCN/rho_air
        ! ccnc(mgs) = Max(0.0, ccnc(mgs) - cn(mgs))
-      ELSEIF ( irenuc == 7 ) THEN !} { 
+      ELSEIF ( irenuc == 7 .or. irenuc == 17 ) THEN !} { 
 
       ! simple Twomey scheme but limit activation to try to do most activation near cloud base, but keep some CCN available for renuclation
 !      if (ndebug .gt. 0) write(0,*) 'ICEZVD_DR:  Cloud reNucleation, wvel = ',wvel(mgs)
        cn(mgs) = 0.0
+       IF ( irenuc == 7 ) THEN
+         frac = 0.9
+       ELSE
+         frac = 0.98
+       ENDIF
 !       IF ( ccna(mgs) < 0.7*cnuc(mgs) .and. ccnc(mgs) > 0.69*cnuc(mgs) - ccna(mgs)) THEN ! here, assume we are near cloud base and use Twomey formulation
-       IF ( ccna(mgs) < 0.9*cnuc(mgs) ) THEN ! { here, assume we are near cloud base and use Twomey formulation
-         CN(mgs) =  Min( 0.91*cnuc(mgs), CCNE0*cnuc(mgs)**(2./(2.+cck))*Max(0.0,wvel(mgs))**cnexp )! *Min(1.0,1./dtp) ! 0.3465
+       IF ( ccna(mgs) < frac*cnuc(mgs) ) THEN ! { here, assume we are near cloud base and use Twomey formulation
+         CN(mgs) =  Min( (frac+0.01)*cnuc(mgs), CCNE0*cnuc(mgs)**(2./(2.+cck))*Max(0.0,wvel(mgs))**cnexp )! *Min(1.0,1./dtp) ! 0.3465
 !         IF ( cn(mgs) + ccna(mgs) > 0.71*cnuc ) THEN
          ! prevent this branch from activating more than 70% of CCN
-           CN(mgs) = Min( CN(mgs), Max(0.0, (0.9*cnuc(mgs) - ccna(mgs) )) )
+           CN(mgs) = Min( CN(mgs), Max(0.0, (frac*cnuc(mgs) - ccna(mgs) )) )
 !           CN(mgs) = Min( CN(mgs), Max(0.0, 0.71*ccnc(mgs) - ccna(mgs) ) )
          !  write(0,*) '1: k,cn = ',kgs(mgs),cn(mgs),ssf(mgs)
 !!           IF ( ccncuf(mgs) > 0.0 .and. cn(mgs) < 1.e-3 .and. ssmax(mgs) > 1.0 ) THEN
@@ -10854,7 +11312,7 @@ SUBROUTINE NUCOND    &
        IF ( cn(mgs) > 0.0 ) THEN
        cx(mgs,lc) = cx(mgs,lc) + cn(mgs)
        
-       ccnc(mgs) = Max(0.0, ccnc(mgs) - cn(mgs))
+       ! ccnc(mgs) = Max(0.0, ccnc(mgs) - cn(mgs))
        
        ! create some small droplets at minimum size (CP 2000), although it adds very little liquid
        
@@ -10873,8 +11331,6 @@ SUBROUTINE NUCOND    &
 
       ccna(mgs) = ccna(mgs) + cn(mgs)
 
-
-
       ENDIF ! irenuc >= 0 .and. .not. flag_qndrop
 
       IF( cx(mgs,lc) .GT. 0. .AND. qx(mgs,lc) .LE. qxmin(lc)) cx(mgs,lc)=0.
@@ -10927,7 +11383,11 @@ SUBROUTINE NUCOND    &
           ELSEIF ( imaxsupopt == 4 ) THEN
             cn(mgs) = Min( Max(ccnc(mgs),cwnccn(mgs)), rho0(mgs)*qvex/Max( cwmasn5, Max(cwmas20,xmas(mgs,lc)) )  )
           ENDIF
-        ccnc(mgs) = Max( 0.0, ccnc(mgs) - cn(mgs) )
+        IF ( lccna > 1 ) THEN
+          ccna(mgs) = ccna(mgs) + cn(mgs)
+        ELSE
+          ccnc(mgs) = Max( 0.0, ccnc(mgs) - cn(mgs) )
+        ENDIF
         cx(mgs,lc) = cx(mgs,lc) + cn(mgs)
         ENDIF
         
@@ -11041,10 +11501,12 @@ SUBROUTINE NUCOND    &
        IF (  ipconc .ge. 2 ) THEN
         an(igs(mgs),jy,kgs(mgs),lnc) = Max(cx(mgs,lc) , 0.0)
         IF ( lss > 1 ) an(igs(mgs),jy,kgs(mgs),lss) = Max( 0.0, ssmax(mgs) )
-        IF ( lccn .gt. 1 ) THEN
-          an(igs(mgs),jy,kgs(mgs),lccn) = Max(0.0,  ccnc(mgs) )
+        IF ( ac_opt == 0 ) THEN
+          IF ( lccn .gt. 1 .and. lccna .lt. 1  ) THEN
+            an(igs(mgs),jy,kgs(mgs),lccn) = Max(0.0,  ccnc(mgs) )
+          ENDIF
         ENDIF
-        IF ( lccnuf .gt. 1 ) THEN
+        IF ( lccnuf .gt. 1 .and. .not. ( lccna .gt. 1 .and. i_uf_or_ccn > 0 ) ) THEN
           an(igs(mgs),jy,kgs(mgs),lccnuf) = Max(0.0,  ccncuf(mgs) )
         ENDIF
         IF ( lccna .gt. 1 ) THEN
@@ -11522,20 +11984,25 @@ SUBROUTINE NUCOND    &
       an(ix,jy,kz,lv) = an(ix,jy,kz,lv) + an(ix,jy,kz,lc)
       an(ix,jy,kz,lc)= 0.0
        IF ( ipconc .ge. 2 ) THEN
-        IF ( lccn .gt. 1 ) THEN
-         an(ix,jy,kz,lccn) =     &
-     &       an(ix,jy,kz,lccn) + Max(0.0,an(ix,jy,kz,lnc))
+        IF ( lccn .gt. 1 .or. ac_opt == 1 ) THEN
+          IF ( irenuc < 5 .and. lccna <= 1 ) THEN
+            IF ( ac_opt == 0 ) THEN
+               an(ix,jy,kz,lccn) = an(ix,jy,kz,lccn) + Max(0.0,an(ix,jy,kz,lnc))
+            ENDIF
+          ELSEIF ( lccna > 1 ) THEN
+            an(ix,jy,kz,lccna) = Max( 0.0, an(ix,jy,kz,lccna) - Max(0.0,an(ix,jy,kz,lnc)) )
+          ENDIF
         ENDIF
          an(ix,jy,kz,lnc) = 0.0
          IF ( lccn > 1 ) an(ix,jy,kz,lccn) = Max( 0.0, an(ix,jy,kz,lccn) )
          
-         IF ( lccna > 0  ) THEN ! apply exponential decay to activated CCN to restore to environmental value
+         IF ( lccna > 0 .and. ac_opt == 0  ) THEN ! apply exponential decay to activated CCN to restore to environmental value
            IF ( restoreccn ) THEN
            tmp = an(ix,jy,kz,li) + an(ix,jy,kz,ls)  
            
            IF ( an(ix,jy,kz,lccna) > 1. .and. tmp < qxmin(li) ) an(ix,jy,kz,lccna) = an(ix,jy,kz,lccna)*Exp(-dtp/ccntimeconst)
            ENDIF
-         ELSEIF ( lccn > 1 .and. restoreccn ) THEN
+         ELSEIF ( lccn > 1 .and. restoreccn .and. ac_opt == 0  ) THEN
            ! in this case, we are treating the ccn field as ccna
            tmp = an(ix,jy,kz,li) + an(ix,jy,kz,ls)  
 !           IF ( ny == 2 .and. ix == nx/2 ) THEN
@@ -11599,11 +12066,11 @@ subroutine nssl_2mom_gs   &
 !     &   ln,ipc,lvol,lz,lliq,   &
      &   cdx,                              &
      &   xdn0,tmp3d,tkediss  &
-     &  ,thproc,numproc,dx1,dy1     &
+     &  ,thproc,numproc,dx1,dy1,ngs     &
      & ,timevtcalc,axtra,io_flag  &
-     & , has_wetscav,rainprod2d, evapprod2d &
+     & , has_wetscav,rainprod2d, evapprod2d, alpha2d &
      & ,errmsg,errflg &
-     & ,elec,its,ids,ide,jds,jde,ngs &
+     & ,elec,its,ids,ide,jds,jde &
      & )
 
 
@@ -11689,6 +12156,11 @@ subroutine nssl_2mom_gs   &
       real rainprod2d(-nor+1:nx+nor,-norz+ng1:nz+norz)
       real evapprod2d(-nor+1:nx+nor,-norz+ng1:nz+norz)
 
+      
+      real :: alpha2d(-nor+1:nx+nor,-norz+ng1:nz+norz,3)
+
+      real, parameter :: tfrdry = 243.15
+
       logical lrescalelow(lc:lhab)
       real tkediss(-nor+1:nx+nor,-norz+ng1:nz+norz)
       real axtra(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-norz+ng1:nz+norz,nxtra)
@@ -11835,7 +12307,6 @@ subroutine nssl_2mom_gs   &
 !
       integer nxmpb,nzmpb,nxz
       integer jgs,mgs,ngs,numgs
-!      parameter (ngs=1 ) !500)
       integer, parameter :: ngsz = 500
       integer ntt
       parameter (ntt=300)
@@ -12215,13 +12686,12 @@ subroutine nssl_2mom_gs   &
       real qrcnw(ngs), qwcnr(ngs)
       real zrcnw(ngs),zracr(ngs),zracw(ngs),zrcev(ngs)
 
-
       real qracw(ngs) ! qwacr(ngs),
       real qiacw(ngs) !, qwaci(ngs)
 
       real qsacw(ngs) ! ,qwacs(ngs),
       real qhacw(ngs) ! qwach(ngs),
-      real :: qhlacw(ngs), qxacwtmp, qxacrtmp ! 
+      real :: qhlacw(ngs), qxacwtmp, qxacrtmp, qxacitmp, qxacstmp !
       real vhacw(ngs), vsacw(ngs), vhlacw(ngs), vhlacr(ngs)
 
       real qfcev(ngs)
@@ -12287,7 +12757,8 @@ subroutine nssl_2mom_gs   &
       real zfmlr(ngs), zfdsv(ngs), zfsbv(ngs), zhlcnf(ngs), zfshr(ngs), zfshrr(ngs)
       real zhmlrtmp,zhmlr0inf,zhlmlr0inf
       real zhmlrr(ngs),zhlmlrr(ngs),zhshrr(ngs),zhlshrr(ngs),zfmlrr(ngs)
-      real zsmlr(ngs), zsmlrr(ngs), zsshr(ngs), zsshrr(ngs)
+!      real zsmlr(ngs)
+      real zsmlrr(ngs), zsshr(ngs), zsshrr(ngs)
       real zhcns(ngs), zhcni(ngs)
       real zhwdn(ngs), zfwdn(ngs) ! change in Z due to density changes
       real zhldn(ngs) ! change in Z due to density changes
@@ -12664,6 +13135,7 @@ subroutine nssl_2mom_gs   &
 
       real :: term1,term2,term3,term4
       real :: qaacw ! combined qsacw-qhacw for WSM6 variation
+      real :: cwchtmp
 
       real, parameter ::  c1r=19.0, c2r=0.6, c3r=1.8, c4r=17.0   ! rain
       real, parameter ::  c1h=5.5, c2h=0.7, c3h=4.5, c4h=8.5   ! Graupel
@@ -12993,7 +13465,6 @@ subroutine nssl_2mom_gs   &
       do ix = nxmpb,itile
 
       pqs(1) = t00(ix,jy,kz)
-!      pqs(kz) = t00(ix,jy,kz)
 
       theta(1) = an(ix,jy,kz,lt)
       temg(1) = t0(ix,jy,kz)
@@ -13011,22 +13482,8 @@ subroutine nssl_2mom_gs   &
 
       qss(1) = qvs(1)
 
-!      IF ( jy .eq. 1 .and. ix .eq. 24 ) THEN
-!       write(91,*) 'kz,qv,th: ',kz,an(ix,jy,kz,lv),an(ix,jy,kz,lt),pqs(kz),tabqvs(ltemq),qvs(kz)
-!      ENDIF
-
       if ( temg(1) .lt. tfr ) then
-!      if( qcw(kz) .le. qxmin(lc) .and. qci(kz) .gt. qxmin(li))
-!     >  qss(kz) = qis(kz)
-!      if( qcw(kz) .gt. qxmin(lc) .and. qci(kz) .gt. qxmin(li))
-!     >   qss(kz) = (qcw(kz)*qvs(kz) + qci(kz)*qis(kz)) /
-!     >   (qcw(kz) + qci(kz))
-      qss(1) = qis(1)
-      else
-!       IF ( an(ix,jy,kz,lv)  .gt. qss(kz) ) THEN
-!       write(iunit,*) 'qss exceeded at ',ix,jy,kz,qss(kz),an(ix,jy,kz,lv),temg(kz)
-!       write(iunit,*) 'other temg = ',theta(kz)*(pinit(kz)+p2(ix,jy,kz))
-!       ENDIF
+        qss(1) = qis(1)
       end if
 !
       ishail = .false.
@@ -13316,7 +13773,6 @@ subroutine nssl_2mom_gs   &
 
 
 
-
 !
 !  6th moments
 !
@@ -13622,20 +14078,54 @@ subroutine nssl_2mom_gs   &
 
       end do
 
-      IF ( ipconc == 5 .and. imydiagalpha > 1 ) THEN
+      IF ( ipconc == 5 .and. imydiagalpha == 2 ) THEN
 
+        cwchtmp = ((3. + dnu(lh))*(2. + dnu(lh))*(1.0 + dnu(lh)))**(-1./3.)
+        
         DO mgs = 1,ngscnt
           !IF ( igs(mgs) == 19 ) write(0,*) 'k,qr,qh,cr,ch = ',kgs(mgs),qx(mgs,lr),cx(mgs,lr),qx(mgs,lh),cx(mgs,lh)
           IF ( qx(mgs,lr) .gt. qxmin(lr) .and. cx(mgs,lr) > cxmin ) THEN
              xv(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(xdn(mgs,lr)*cx(mgs,lr))            ! 
              xdia(mgs,lr,3) = (xv(mgs,lr)*6.0*cwc1)**(1./3.) 
-             alpha(mgs,lr) = Min(alphamax, c1r*tanh(c2r*(xdia(mgs,lr,3)*1000. - c3r)) + c4r)
+           !  alpha(mgs,lr) = Min(alphamax, c1r*tanh(c2r*(xdia(mgs,lr,3)*1000. - c3r)) + c4r)
            ! IF ( igs(mgs) == 19 ) write(0,*) 'imy: i,k,alpr,xdia = ',igs(mgs),kgs(mgs),alpha(mgs,lr),xdia(mgs,lr,3)*1000.
+
+            ! M&M-C 2010:
+             tmp = 4. + alphar
+             i = Int(dgami*(tmp))
+             del = tmp - dgam*i
+             x = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
+
+             tmp = 1. + alphar
+             i = Int(dgami*(tmp))
+             del = tmp - dgam*i
+             y = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
+
+             tmp = (x/y)**(1./3.)*xdia(mgs,lr,3)*cwchtmp
+
+             alpha(mgs,lr) = Min(15., 11.8*(1000.*tmp - 0.7)**2 + 2.)
           ENDIF
           IF ( qx(mgs,lh) .gt. qxmin(lh) .and. cx(mgs,lh) > cxmin ) THEN
+!      MY 2005:
              xv(mgs,lh) = rho0(mgs)*qx(mgs,lh)/(xdn(mgs,lh)*cx(mgs,lh))            ! 
              xdia(mgs,lh,3) = (xv(mgs,lh)*6.*piinv)**(1./3.) ! mwfac*xdia(mgs,lh,1) ! (xv(mgs,lh)*cwc0*6.0)**(1./3.)
-             alpha(mgs,lh) = Min(alphamax, c1h*tanh(c2h*(xdia(mgs,lh,3)*1000. - c3h)) + c4h)
+!             alpha(mgs,lh) = Min(alphamax, c1h*tanh(c2h*(xdia(mgs,lh,3)*1000. - c3h)) + c4h)
+
+            ! M&M-C 2010:
+             tmp = 4. + dnu(lh)
+             i = Int(dgami*(tmp))
+             del = tmp - dgam*i
+             x = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
+
+             tmp = 1. + dnu(lh)
+             i = Int(dgami*(tmp))
+             del = tmp - dgam*i
+             y = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
+
+             tmp = (x/y)**(1./3.)*xdia(mgs,lh,3)*cwchtmp
+
+             alpha(mgs,lh) = Min(15., 11.8*(1000.*tmp - 0.7)**2 + 2.)
+            ! alphan(mgs,lh) = alpha(mgs,lh)
             
            ! IF ( igs(mgs) == 19 ) write(0,*) 'imy: i,k,alph,xdia = ',igs(mgs),kgs(mgs),alpha(mgs,lh),xdia(mgs,lh,3)*1000.
             il = lh
@@ -13731,6 +14221,8 @@ subroutine nssl_2mom_gs   &
  
 !      CALL cld_cpu('Z-MOMENT-1')  
       
+      IF ( ipconc >= 6 ) THEN
+      
       ! set base g1x in case rain is not 3-moment
        IF ( ipconc >= 6 .and. imurain == 3 ) THEN
          il = lr
@@ -13825,7 +14317,7 @@ subroutine nssl_2mom_gs   &
             qr  = qx(mgs,il)
             cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/(z*xdn(mgs,lr)**2)
 !            an(igs(mgs),jgs,kgs(mgs),ln(il)) = zx(mgs,il)
-           ELSEIF ( zx(mgs,il) <= 0.0 .and. cx(mgs,il) > 0.0 ) THEN
+           ELSEIF ( zx(mgs,il) <= zxmin .and. cx(mgs,il) > 0.0 ) THEN
 !  have mass and concentration but no reflectivity, so set reflectivity, using default alpha
             g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
             chw = cx(mgs,il)
@@ -13833,7 +14325,7 @@ subroutine nssl_2mom_gs   &
             zx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/(xdn(mgs,lr)**2*chw)
             an(igs(mgs),jgs,kgs(mgs),lz(lr)) = zx(mgs,lr)
 
-           ELSEIF ( zx(mgs,il) <= 0.0 .and. cx(mgs,il) <= 0.0 ) THEN
+           ELSEIF ( zx(mgs,il) <= zxmin .and. cx(mgs,il) <= 0.0 ) THEN
 !   How did this happen?
          ! set values according to dBZ of -10, or Z = 0.1
 !              0.1 = 1.e18*0.224*an(ix,jy,kz,lzh)*(hwdn/rwdn)**2
@@ -13850,7 +14342,6 @@ subroutine nssl_2mom_gs   &
           IF ( zx(mgs,lr) > 0.0 ) THEN
             xv(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(1000.*cx(mgs,lr))
             vr = xv(mgs,lr)
-!            z = 36.*(alpha(kz)+2.0)*a(ix,jy,kz,lnr)*vr**2/((alpha(kz)+1.0)*pi**2)
            qr = qx(mgs,lr)
            nrx = cx(mgs,lr)
            z = zx(mgs,lr)
@@ -13862,7 +14353,6 @@ subroutine nssl_2mom_gs   &
            IF ( z .gt. 0.0 ) THEN
 !           alpha(mgs,lr) = 3.
            alp = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/(z*pi**2) - 1.
-!           print*,'kz, alp, alpha(kz) = ',kz,alp,alpha(kz),rd,z,xv
            DO i = 1,20
             IF ( Abs(alp - alpha(mgs,lr)) .lt. 0.01 ) EXIT
              alpha(mgs,lr) = Max( rnumin, Min( rnumax, alp ) )
@@ -13991,6 +14481,7 @@ subroutine nssl_2mom_gs   &
 !        CALL cld_cpu('Z-MOMENT-1r')  
         ENDIF ! }
         
+      ENDIF ! ipconc >= 6
 
 !  Find shape parameters for graupel and hail
       IF ( ipconc .ge. 6 ) THEN
@@ -14073,7 +14564,7 @@ subroutine nssl_2mom_gs   &
 !            cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/z
             cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(6.*qr)**2/(z*(pi*xdn(mgs,il))**2)
 
-           ELSEIF ( zx(mgs,il) <= 0.0 .and. cx(mgs,il) > cxmin ) THEN
+           ELSEIF ( zx(mgs,il) <= zxmin .and. cx(mgs,il) > cxmin ) THEN
 !  have mass and concentration but no reflectivity, so set reflectivity, using default alpha
 !            g1 = (6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
 !     &            ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il)))
@@ -14086,7 +14577,7 @@ subroutine nssl_2mom_gs   &
             zx(mgs,il) = Max(zxmin*1.1, g1*dn(igs(mgs),jy,kgs(mgs))**2*(6*qr)**2/(chw*(pi*xdn(mgs,il))**2) )
             an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
 
-           ELSEIF ( zx(mgs,il) <= 0.0 .and. cx(mgs,il) <= 0.0 ) THEN
+           ELSEIF ( zx(mgs,il) <= zxmin .and. cx(mgs,il) <= 0.0 ) THEN
 !   How did this happen?
          ! set values according to dBZ of -10, or Z = 0.1
 !              0.1 = 1.e18*0.224*an(ix,jy,kz,lzh)*(hwdn/rwdn)**2
@@ -14740,7 +15231,6 @@ subroutine nssl_2mom_gs   &
 !
       eiw(mgs) = 0.0
       eii(mgs) = 0.0
-
       ehsclsn(mgs) = 0.0
       ehiclsn(mgs) = 0.0
       ehlsclsn(mgs) = 0.0
@@ -14975,7 +15465,7 @@ subroutine nssl_2mom_gs   &
              fac = fac*(ssi(mgs) - 1.0)/0.02
              ehsfac(mgs) = (ssi(mgs) - 1.0)/0.02
            ENDIF
-        ELSEIF ( iessopt == 4 ) THEN ! factor based on ice supersat
+        ELSEIF ( iessopt == 4 ) THEN ! factor based on ice supersat; very roughly based on Hosler et al. 1957 (J. Met.)
            IF ( ssi(mgs) <= 1.0 ) THEN
              fac = 0.1
              ehsfac(mgs) = 0.1
@@ -15339,6 +15829,7 @@ subroutine nssl_2mom_gs   &
       do mgs = 1,ngscnt
       qraci(mgs) = 0.0
       craci(mgs) = 0.0
+      qracs(mgs) = 0.0
       IF ( eri(mgs) .gt. 0.0 .and. iacr .ge. 1 .and. xdia(mgs,lr,3) .gt. 2.*rwradmn ) THEN
         IF ( ipconc .ge. 3 ) THEN
 
@@ -15386,7 +15877,7 @@ subroutine nssl_2mom_gs   &
 !
       IF ( ipconc < 3 ) THEN
       do mgs = 1,ngscnt
-      qracs(mgs) =  0.0
+      qracs(mgs) = 0.0
       IF ( ers(mgs) .gt. 0.0 .and. ipconc < 3 ) THEN
        IF ( lwsm6 .and. ipconc == 0 ) THEN
          vt = vt2ave(mgs)
@@ -16666,7 +17157,7 @@ subroutine nssl_2mom_gs   &
 ! Ziegler (1985) autoconversion
 !
 !
-      IF ( ipconc .ge. 2 .and. ircnw /= -1) THEN ! DTD: added flag for autoconversion.  If -1, turns off autoconversion
+      IF ( ipconc .ge. 2 ) THEN
       if (ndebug .gt. 0 ) write(0,*) 'conc 26a'
       
       DO mgs = 1,ngscnt
@@ -16749,6 +17240,7 @@ subroutine nssl_2mom_gs   &
            
            IF ( crcnw(mgs) < 1.e-30 ) qrcnw(mgs) = 0.0
 
+           IF ( ipconc >= 6 ) THEN
            IF ( lzr > 1 .and. qrcnw(mgs) > 0.0 ) THEN
 !            vr = rho0(mgs)*qrcnw(mgs)/(1000.*crcnw(mgs))
 !            zrcnw(mgs) = 36.*(xnu(lr)+2.0)*crcnw(mgs)*vr**2/((xnu(lr)+1.0)*pi**2)
@@ -16788,6 +17280,7 @@ subroutine nssl_2mom_gs   &
              endif
 !             z  = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/((alpha(mgs,lr)+1.0)*pi**2)
            ENDIF 
+           ENDIF ! ipconc >= 6
 !           IF (  crcnw(mgs) .gt. cautn(mgs) .and. crcnw(mgs) .gt. 1.0 )
 !     :          THEN
 !             write(0,*)  'crcnw,cautn ',crcnw(mgs)/cautn(mgs),
@@ -16998,7 +17491,7 @@ subroutine nssl_2mom_gs   &
            ELSE !{
 
             
-           IF ( lzr > 1 ) THEN
+           IF ( ipconc >= 6 .and. lzr > 1 ) THEN
            ! interpolate along x, i.e., ratio; 
             tmp1 = ziacrratio(i,j) + delx*dqiacrratioinv*(ziacrratio(ip1,j) - ziacrratio(i,j))
             tmp2 = ziacrratio(i,jp1) + delx*dqiacrratioinv*(ziacrratio(ip1,jp1) - ziacrratio(i,jp1))
@@ -17016,7 +17509,7 @@ subroutine nssl_2mom_gs   &
               crfrzs(mgs) = crfrz(mgs)
               qrfrzs(mgs) = qrfrz(mgs)
 
-              IF ( lzr > 1 ) THEN
+              IF ( ipconc >= 6 .and. lzr > 1 ) THEN
                 zrfrzs(mgs) = zrfrz(mgs)
                 zrfrzf(mgs) = 0.
               ENDIF
@@ -17031,7 +17524,7 @@ subroutine nssl_2mom_gs   &
             crfrzf(mgs) = 0.0
             qrfrzf(mgs) = 0.0
 
-             IF ( lzr > 1 ) THEN
+             IF (ipconc >= 6 .and. lzr > 1 ) THEN
                zrfrzs(mgs) = zrfrz(mgs)
                zrfrzf(mgs) = 0.
              ENDIF
@@ -17074,7 +17567,7 @@ subroutine nssl_2mom_gs   &
             crfrzs(mgs) = crfrzs(mgs) - crfrzf(mgs)
             qrfrzs(mgs) = qrfrzs(mgs) - qrfrzf(mgs)
 
-           IF ( lzr > 1 ) THEN
+           IF ( ipconc >= 6 .and. lzr > 1 ) THEN
             zrfrzs(mgs) = zrfrz(mgs)
            ! interpolate along x, i.e., ratio; 
             tmp1 = ziacrratio(i,j) + delx*dqiacrratioinv*(ziacrratio(ip1,j) - ziacrratio(i,j))
@@ -17103,7 +17596,7 @@ subroutine nssl_2mom_gs   &
              crfrz(mgs) = fac*crfrz(mgs)
              crfrzs(mgs) = fac*crfrzs(mgs)
              crfrzf(mgs) = fac*crfrzf(mgs)
-             IF ( lzr > 1 ) THEN
+             IF ( ipconc >= 6 .and. lzr > 1 ) THEN
                zrfrz(mgs) = fac*zrfrz(mgs)
                zrfrzf(mgs) = fac*zrfrzf(mgs)
              ENDIF
@@ -17651,7 +18144,7 @@ subroutine nssl_2mom_gs   &
 
         x =  1. + alpha(mgs,lr)
 
-        IF ( lzr > 1 ) THEN ! 3 moment
+        IF ( ipconc >= 6 .and. lzr > 1 ) THEN ! 3 moment
         tmp = 1. + alpr ! alpha(mgs,lr)
         i = Int(dgami*(tmp))
         del = tmp - dgam*i
@@ -17676,6 +18169,7 @@ subroutine nssl_2mom_gs   &
      &    0.308*fvent(mgs)*y*   &
      &            Sqrt(ax(lr)*rhovt(mgs))*(vent1/vent2)
        
+        rwventz(mgs) = 0.0
 
 !        rwventz(mgs) =    &
 !     &    0.78*x +    &
@@ -17694,6 +18188,7 @@ subroutine nssl_2mom_gs   &
      &    *(xdia(mgs,lr,1)**((1.0+br)/2.0)) )
 
 
+        IF ( ipconc >= 7 ) THEN
         alpr = Min(alpharmax,alpha(mgs,lr) )
 
            tmp = alpr + 5.5 + br/2.
@@ -17708,7 +18203,7 @@ subroutine nssl_2mom_gs   &
      &    0.308*fvent(mgs)*   &
      &            Sqrt(ax(lr)*rhovt(mgs))*(y/gf1palp(mgs))*(xdia(mgs,lr,1)**((1.0+br)/2.0))
 
-
+        ENDIF
 
           
           ENDIF ! iferwisventr
@@ -17752,6 +18247,9 @@ subroutine nssl_2mom_gs   &
       hwventa = (0.78)*gmoi(igmhwa)
       hwventb = (0.308)*gmoi(igmhwb)
 !      hwventc = (4.0*gr/(3.0*cdx(lh)))**(0.25)
+      hwvent(:) = 0.0
+      hwventy(:) = 0.0
+
       do mgs = 1,ngscnt
       IF ( qx(mgs,lh) .gt. qxmin(lh) ) THEN
        hwventc = (4.0*gr/(3.0*cdxgs(mgs,lh)))**(0.25)
@@ -17909,7 +18407,7 @@ subroutine nssl_2mom_gs   &
       vffzf(:) = 0.0
       vhlfzhl(:) = 0.0
       qsfzs(:) = 0.0
-      zsmlr(:) = 0.0
+!      zsmlr(:) = 0.0
       zhmlr(:) = 0.0
       zhmlrr(:) = 0.0
       zsmlrr(:) = 0.0
@@ -18110,20 +18608,8 @@ subroutine nssl_2mom_gs   &
 !        ENDIF
 
 
-
-        IF ( lzr .gt. 1 .and. qx(mgs,ls) > qxmin(ls) ) THEN
-            tmp = qx(mgs,ls)/cx(mgs,ls)
-!            alp = Max( -0.8, alpha(mgs,lh) )
-            alp = xnu(ls)
-            g1 = 36.*(alp+2.0)/((alp+1.0)*pi**2)
-
-          zsmlr(mgs) =  g1*(rho0(mgs)/(xdn(mgs,ls)))**2*( tmp * qsmlr(mgs) )
-!          zhmlr(mgs) =  (xdn0(lr)/(xdn(mgs,lh)))**2*( zx(mgs,lh) * qhmlr(mgs) )
-
-        ENDIF
-
      IF ( chmlr(mgs) < 0.0 .and. (ibinhmlr < 1 .or. lzh < 1) ) THEN ! { already done if ibinhmlr > 0
-      IF ( lzr .gt. 1 .and. lzh < 1  .and. qx(mgs,lh) > qxmin(lh) ) THEN ! Only compute if rain is 3-moment but graupel is not, otherwise is computed later
+      IF (  ipconc >= 6 .and. lzr .gt. 1 .and. lzh < 1  .and. qx(mgs,lh) > qxmin(lh) ) THEN ! Only compute if rain is 3-moment but graupel is not, otherwise is computed later
           tmp = qx(mgs,lh)/cx(mgs,lh)
           alp = alpha(mgs,lh)
           g1 = g1x(mgs,lh) ! (6.0 + alp)*(5.0 + alp)*(4.0 + alp)/((3.0 + alp)*(2.0 + alp)*(1.0 + alp))
@@ -18236,7 +18722,7 @@ subroutine nssl_2mom_gs   &
       ENDIF !}
       
         
-       IF ( lzhl .gt. 1 .and. ibinhlmlr <= 0 ) THEN
+       IF ( ipconc >= 8 .and. lzhl .gt. 1 .and. ibinhlmlr <= 0 ) THEN
         IF ( cx(mgs,lhl) > 0.0 ) THEN
 
           tmp = qx(mgs,lhl)/cx(mgs,lhl)
@@ -18575,6 +19061,9 @@ subroutine nssl_2mom_gs   &
         qsdpv(mgs) = 0.0
       ENDIF
 
+      qhsbv(mgs) = 0.0
+      qhdpv(mgs) = 0.0
+      IF ( qx(mgs,lh) > qxmin(lh) ) THEN
       IF ( temg(mgs) < tfr .or. .not. qhmlr(mgs) < 0.0 ) THEN
       ! no liquid from melting, so evaporation is greater. Thus can calculate sublimation rate
       qhsbv(mgs) = max( min(qhdsv(mgs), 0.0), -qhmxd(mgs) )
@@ -18587,12 +19076,14 @@ subroutine nssl_2mom_gs   &
 !     &   evapfac*min(   &
 !     &  fmlt1e(mgs)*cx(mgs,lh)*hwvent(mgs)*xdia(mgs,lh,1), 0.0 )
         
-      qhcev(mgs) =  evapfac*  &
-     &  2.0*pi*(qx(mgs,lv)-qss0(mgs))*cx(mgs,lh)*xdia(mgs,lh,1)*hwvent(mgs)/(qss0(mgs)*(fav(mgs)+fbv(mgs)))
+        qhcev(mgs) =  evapfac*2.0*pi*(qx(mgs,lv)-qss0(mgs))*  &
+     &   cx(mgs,lh)*xdia(mgs,lh,1)*hwvent(mgs)/(qss0(mgs)*(fav(mgs)+fbv(mgs)))
 
-      qhcev(mgs)  = max(qhcev(mgs), -qhmxd(mgs))
+        qhcev(mgs)  = max(qhcev(mgs), -qhmxd(mgs))
+        IF ( temg(mgs) > tfr ) qhcev(mgs) = Min(0.0, qhcev(mgs) )
         
       ENDIF
+      ENDIF
 
 
       qhlsbv(mgs) = 0.0
@@ -18605,10 +19096,11 @@ subroutine nssl_2mom_gs   &
         ENDIF
         IF ( qhlmlr(mgs) < 0.0 .and. .not. mixedphase ) THEN
         ! Liquid is forming, so find the evaporation that was subtracted from melting (if it is not condensing)
-         qhlcev(mgs) =  evapfac*  &
-     &      2.0*pi*(qx(mgs,lv)-qss0(mgs))*cx(mgs,lhl)*xdia(mgs,lhl,1)*hlvent(mgs)/(qss0(mgs)*(fav(mgs)+fbv(mgs)))
+         qhlcev(mgs) =  evapfac*2.0*pi*(qx(mgs,lv)-qss0(mgs))*  &
+     &      cx(mgs,lhl)*xdia(mgs,lhl,1)*hlvent(mgs)/(qss0(mgs)*(fav(mgs)+fbv(mgs)))
 
          qhlcev(mgs)  = max(qhlcev(mgs), -qhlmxd(mgs))
+         IF ( temg(mgs) > tfr ) qhlcev(mgs) = Min(0.0, qhlcev(mgs) )
         
       ENDIF
       ENDIF
@@ -18777,7 +19269,7 @@ subroutine nssl_2mom_gs   &
 !
       do mgs = 1,ngscnt
       
-      IF ( temg(mgs) < tfr ) THEN
+      IF ( tfrdry < temg(mgs) .and. temg(mgs) < tfr ) THEN
 !
 !      qswet(mgs) =
 !     >  ( xdia(mgs,ls,1)*swvent(mgs)*cx(mgs,ls)*fwet1(mgs)
@@ -18815,7 +19307,6 @@ subroutine nssl_2mom_gs   &
        
         qhwet(mgs) = qhdry(mgs)
         qhlwet(mgs) = qhldry(mgs)
-        
        ENDIF
 !
 !      qhlwet(mgs) = qhldry(mgs)
@@ -19222,14 +19713,22 @@ subroutine nssl_2mom_gs   &
          ELSE
          IF (((qhacw(mgs) + qhacr(mgs))*dtp > qxmin(lh) .and. qx(mgs,lh) > hlcnhqmin .and. temg(mgs) .le. tfr-2.0  &
                .and.  temg(mgs) .gt. dwtempmin ) .or. ( wetgrowth(mgs) .and. qx(mgs,lh) > hlcnhqmin ) ) THEN
-         dw = 0.01*( Exp( -temcg(mgs)/( 1.1e4 * rho0(mgs)*ehw(mgs)*qx(mgs,lc) - 1.3e3*rho0(mgs)*qx(mgs,li) + 1.0 ) ) - 1.0 )
-         dwr = 0.01*( Exp( -temcg(mgs)/( 1.1e4 * rho0(mgs)*(ehw(mgs)*qx(mgs,lc)+ehr(mgs)*qx(mgs,lr)) - &
-                1.3e3*rho0(mgs)*qx(mgs,li) + 1.0 ) ) - 1.0 )
+!         dw = 0.01*( Exp( -temcg(mgs)/( 1.1e4 * rho0(mgs)*ehw(mgs)*qx(mgs,lc) - 1.3e3*rho0(mgs)*qx(mgs,li) + 1.0 ) ) - 1.0 )
+!         dwr = 0.01*( Exp( -temcg(mgs)/( 1.1e4 * rho0(mgs)*(ehw(mgs)*qx(mgs,lc)+ehr(mgs)*qx(mgs,lr)) - &
+!                1.3e3*rho0(mgs)*qx(mgs,li) + 1.0 ) ) - 1.0 )
+            x =   1.1e4 * rho0(mgs)*(ehw(mgs)*qx(mgs,lc)+ehr(mgs)*qx(mgs,lr)) - &
+                1.3e3*rho0(mgs)*qx(mgs,li) + 1.0 
+            IF ( x > 1.e-20 ) THEN
+              arg = Min(70.0, (-temcg(mgs)/x )) ! prevent overflow of the exp function in 32 bit
+              dwr = 0.01*(exp(arg) - 1.0)
+            ELSE
+              dwr = 1.e30
+            ENDIF
           d = dwr
-           IF ( dwr < 0.2 .and. dwr > 0.0 ) THEN
+           IF ( dwr < 0.2 .and. dwr > 0.0 .and. rho0(mgs)*(qx(mgs,lc)+qx(mgs,lr)) > 1.e-4 ) THEN
+                      sqrtrhovt = Sqrt( rhovt(mgs) )
                       fventh = sqrtrhovt*(fpndl(mgs)**(1./3.)) * (fakvisc(mgs))**(-0.5) 
                       fventm = sqrtrhovt*(fschm(mgs)**(1./3.)) * (fakvisc(mgs))**(-0.5)
-                      sqrtrhovt = Sqrt( rhovt(mgs) )
                       ltemq = (tfr-163.15)/fqsat+1.5
                       qvs0 = pqs(mgs)*tabqvs(ltemq)
                       denomdp = felf(mgs) + fcw(mgs)*temcg(mgs)
@@ -19242,6 +19741,7 @@ subroutine nssl_2mom_gs   &
                       h4 = ehr(mgs)* qx(mgs,lr)
                       ! iterate to find minimum diameter for wet growth. Start with value of dwr
                       DO n = 1,10
+                        d = Max(d, 1.e-4)
                         dold = d
                         vth = axx(mgs,lh)*d**bxx(mgs,lh) 
                         x2 = fventh*sqrtrhovt*Sqrt(d*vth)
@@ -19266,32 +19766,26 @@ subroutine nssl_2mom_gs   &
                        
                         ELSE
 
-                        d = 8.*ah*h1*dtpinv/ &
+                        ! Based on Farley and Orville (1986), eq. 5-9 but neglecting the Ci*(T0-Ts) term in (8) since we want Ts=T0
+                        ! Simplified mass rates as dm_w/dt = pi/4*d**2*(Vh - Vc)*rhoair*qc*ehw, etc.
+                        d = 8.*ah*h1/ &
                             ( ( Max(0.001,vth - vtxbar(mgs,lc,1))*h3 +                              &
                             Max(0.001,vth - vtxbar(mgs,lr,1))*h4) *rho0(mgs)*denomdp +               &
                             Max(0.001,vth - vtxbar(mgs,li,1))*h2)
+                            
                         ENDIF
-!                        write(0,*) 'iter,d,dwr = ',n,d,dwr
-!                        write(91,*) 'parts = ',( -ah*ftka*temcg - ah*felv*fwvdf*dn(i,j,k)*(qvamb - qvs0) ),( Max(0.001,vth - 0.01*vwmw)*ehw* qcmks*dn(i,j,k)/denominv + Max(0.001,vth - 0.01*vimw)*ehi*qimks*dn(i,j,k)*fci*temcg)
-!!                        write(91,*) 'partsr = ',( -ah*ftka*temcg - ah*felv*fwvdf*dn(i,j,k)*(qvamb - qvs0) ),( ( Max(0.001,vth - 0.01*vwmw)*ehw* qcmks + Max(0.001,vth - 0.01*vrmw)*ehr* qrmks) *dn(i,j,k)/denominv + &
-!!                            Max(0.001,vth - 0.01*vimw)*ehi*qimks*dn(i,j,k)*fci*temcg)
-!                        write(91,*) 'parts2 = ',vth
-                        
                         IF ( Abs(dold - d)/dold < 0.05 .or. ( n > 3 .and. d > dg0thresh ) ) EXIT
                         
                       ENDDO
               ENDIF
               
-              dg0(mgs) = Max( d, dwmin )
-!             IF ( .false. .and. ny == 2 .and. dwr < 0.5 .and. dwr > 0. ) THEN
-!             write(0,*) 'i,k,dg0 = ',igs(mgs), kgs(mgs), dg0(mgs)
-!             write(0,*) 'h1,h2,h3,h4 = ',h1,h2,h3,h4
-!             write(0,*) 'dw,dwr = ',dw,dwr
-!             write(0,*) 'wetgrowth = ',wetgrowth(mgs)
-!             write(0,*) 'temc,Dh, Dhl = ',temcg(mgs),xdia(mgs,lh,3),xdia(mgs,lhl,3)
-!             ENDIF
+              dg0(mgs) = Min( dwmax, Max( d, dwmin ) )
           ELSE
-            dg0(mgs) = dg0thresh + 0.0001
+            IF ( qx(mgs,lh) > qxmin(lh) .and. qx(mgs,lh) > hlcnhqmin .and. temg(mgs) .le. tfr-2.0  ) THEN
+              dg0(mgs) = dwmax
+            ELSE
+              dg0(mgs) = dg0thresh + 0.0001
+            ENDIF
           ENDIF
           
             IF ( ihlcnh == 3 .and. (qhacw(mgs) + qhacr(mgs))*dtp > qxmin(lh) .and. qx(mgs,lh) > hlcnhqmin &
@@ -19301,10 +19795,6 @@ subroutine nssl_2mom_gs   &
             ENDIF
             
           ENDIF
-!       write(0,*) 'notwet growth graupel,hail,Dw,Dwr = ',wetgrowth(mgs) , wetgrowthhl(mgs), dh0 ,tmp,tmp1
-!       write(0,*) 'temc,Dh, Dhl = ',temcg(mgs),xdia(mgs,lh,3),xdia(mgs,lhl,3)
-!       write(0,*) 'qc,qi = ', qx(mgs,lc) , qx(mgs,li) 
-
 
         wtest = (dg0(mgs) > 0.0 .and. dg0(mgs) < dg0thresh )
         
@@ -19339,18 +19829,6 @@ subroutine nssl_2mom_gs   &
            tmp = qhacw(mgs) + qhacr(mgs) + qhaci(mgs) + qhacs(mgs)
 !           qtmp = Min( 1.0, xdia(mgs,lh,3)/(2.0*dh0) )*(tmp)
            qtmp = Min( 100.0, xdia(mgs,lh,3)/(2.0*dh0) )*(tmp)
-!           IF ( .false. .and. qx(mgs,lhl) + qtmp*dtp .lt. 0.5e-3 ) THEN
-!             hdia1 = Max(dh0, xdia(mgs,lh,3) )
-!            qtmp = qtmp + Min(qxmxd(mgs,lh), Max( 0.0,   &
-!     &      ((pi*xdn(mgs,lh)*cx(mgs,lh)) / (6.0*rho0(mgs)*dtp))   &
-!     &      *exp(-hdia1/xdia(mgs,lh,1))   &
-!     &      *( (hdia1**3) + 3.0*(hdia1**2)*xdia(mgs,lh,1)   &
-!     &      + 6.0*(hdia1)*(xdia(mgs,lh,1)**2) + 6.0*(xdia(mgs,lh,1)**3) ) ) )
-
-!           ENDIF
-
-!           qhlcnh(mgs) = Min( 0.5*(qx(mgs,lh))+tmp, xdia(mgs,lh,3)/(2.0*dh0)*(tmp) )
-!           qhlcnh(mgs) = Min(  qxmxd(mgs,lh), xdia(mgs,lh,3)/(2.0*dh0)*(tmp) )
            qhlcnh(mgs) = Min(  qxmxd(mgs,lh), qtmp )
            
            IF ( ipconc .ge. 5 ) THEN !{
@@ -19360,8 +19838,6 @@ subroutine nssl_2mom_gs   &
            chlcnhhl(mgs) = Min( cxmxd(mgs,lh), rho0(mgs)*qhlcnh(mgs)/(pi*xdn(mgs,lh)*dh0**3/6.0) )
 
            r = rho0(mgs)*qhlcnh(mgs)/(xdn(mgs,lh)*xv(mgs,lh))  ! number of graupel particles at mean volume diameter
-!           chlcnh(mgs) = Min( Max( 1./8.*r , chlcnh(mgs)), r )
-!           chlcnh(mgs) = Min( chlcnh(mgs), r )
            chlcnh(mgs) = Max( chlcnhhl(mgs), r )
            ENDIF !}
            
@@ -19395,11 +19871,10 @@ subroutine nssl_2mom_gs   &
             qxd1 = qx(mgs,lh)*(tmp2)
             qhlcnh(mgs) = dtpinv*qxd1
             flim = 1.0
-!            tmp3 = Min( dtp*(qfacw(mgs) + qfacr(mgs) ), qxmxd(mgs,lf) )
             tmp3 = qxmxd(mgs,lh)
             IF (qxd1 > tmp3 ) THEN
-              flim = tmp3/(qxd1)
-              qhlcnh(mgs) = flim*qhlcnh(mgs)
+!              flim = tmp3/(qxd1)
+!              qhlcnh(mgs) = flim*qhlcnh(mgs)
             ENDIF
 
             
@@ -19416,10 +19891,10 @@ subroutine nssl_2mom_gs   &
             chlcnhhl(mgs) = chlcnh(mgs)
 
            IF ( qx(mgs,lhl) > qxmin(lhl) .and. dmhlopt > 0 ) THEN
-             dh0 = rho0(mgs)*qhlcnh(mgs)/chlcnhhl(mgs)
-             IF ( dh0 < xmas(mgs,lhl) ) THEN
+             tmp = rho0(mgs)*qhlcnh(mgs)/chlcnhhl(mgs)
+             IF ( tmp < xmas(mgs,lhl) ) THEN
                ! dh0 = ( qxd1*dh0 + qx(mgs,lhl)*xmas(mgs,lhl))/( qxd1 + qx(mgs,lhl))  ! weighted average
-               dh0 = (( qxd1*dh0**(1./3.) + qx(mgs,lhl)*xmas(mgs,lhl)**(1./3.))/( qxd1 + qx(mgs,lhl)))**3  ! weighted average
+               dh0 = (( qxd1*tmp**(1./3.) + qx(mgs,lhl)*xmas(mgs,lhl)**(1./3.))/( qxd1 + qx(mgs,lhl)))**3  ! weighted average
                chlcnhhl(mgs) = Min( chlcnhhl(mgs), rho0(mgs)*qhlcnh(mgs)/dh0 )
              ELSE
 !               dh0 = Max( dh0, xmas(mgs,lhl) ) ! when enough hail is established, do not dilute the size
@@ -19428,7 +19903,7 @@ subroutine nssl_2mom_gs   &
 
 
            ! reflectivity
-           IF ( lzh > 1 .and. lzhl > 1 ) THEN
+           IF ( ipconc >= 6 .and. lzh > 1 .and. lzhl > 1 ) THEN
             tmp3 = gaminterp(ratio,alpha(mgs,lh),11,1)
             zxd1 = flim*zx(mgs,lh)*(tmp3)
             zhlcnh(mgs) = dtpinv*zxd1
@@ -19440,17 +19915,6 @@ subroutine nssl_2mom_gs   &
                qhlcnh(mgs) = 0.0
             ENDIF
 
-!           IF ( cxd1 < 0.0 .or. qxd1 < 0.0 ) THEN
-!             write(0,*) 'cxd1,qxd1 = ',cxd1,qxd1
-!             write(0,*) 'dw,temcg = ',dw,temcg(mgs),ratio 
-!           ENDIF
-           
-!           write(0,*) 'dw,temcg = ',dw,temcg(mgs),ratio
-!           write(0,*) 'qhlcnh,qh = ',qhlcnh(mgs),qx(mgs,lh),qxd1
-!           write(0,*) 'chlcnh,ch = ',chlcnh(mgs),cx(mgs,lh),cxd1
-!           write(0,*) 'zhlcnh,zh = ',zhlcnh(mgs),zx(mgs,lh),zxd1
-!           write(0,*) 'tmp1,2,3 = ',tmp,tmp2,tmp3
-
            vhlcnh(mgs) = rho0(mgs)*qhlcnh(mgs)/xdn(mgs,lh)
            vhlcnhl(mgs) = rho0(mgs)*qhlcnh(mgs)/Max(xdnmn(lhl), xdn(mgs,lh))
            
@@ -19494,17 +19958,6 @@ subroutine nssl_2mom_gs   &
            ELSE
             zxd1 = 0
            ENDIF
-!           IF ( cxd1 < 0.0 .or. qxd1 < 0.0 ) THEN
-!             write(0,*) 'cxd1,qxd1 = ',cxd1,qxd1
-!             write(0,*) 'dw,temcg = ',dw,temcg(mgs),ratio 
-!           ENDIF
-           
-!           write(0,*) 'dw,temcg = ',dw,temcg(mgs),ratio
-!           write(0,*) 'qhlcnh,qh = ',qhlcnh(mgs),qx(mgs,lh),qxd1
-!           write(0,*) 'chlcnh,ch = ',chlcnh(mgs),cx(mgs,lh),cxd1
-!           write(0,*) 'zhlcnh,zh = ',zhlcnh(mgs),zx(mgs,lh),zxd1
-!           write(0,*) 'tmp1,2,3 = ',tmp,tmp2,tmp3
-
            vhlcnh(mgs) = rho0(mgs)*qhlcnh(mgs)/xdn(mgs,lh)
            vhlcnhl(mgs) = rho0(mgs)*qhlcnh(mgs)/Max(xdnmn(lhl), xdn(mgs,lh))
            
@@ -20765,6 +21218,14 @@ subroutine nssl_2mom_gs   &
        pqlwlghld(:) = 0.0
        pqlwhli(:) = 0.0
        pqlwhld(:) = 0.0
+       IF ( ipconc > 5 ) THEN
+       pzhwi(:) = 0.0
+       pzhwd(:) = 0.0
+       pzrwi(:) = 0.0
+       pzrwd(:) = 0.0
+       pzhli(:) = 0.0
+       pzhld(:) = 0.0
+       ENDIF
 
 
 !
@@ -21337,8 +21798,8 @@ subroutine nssl_2mom_gs   &
 
 !        zhshr(mgs) =  (xdn0(lr)/(xdn(mgs,lh)))**2*( zx(mgs,lh) * qhshr(mgs) )
         
-        qtmp = qhdpv(mgs) + qhcev(mgs)
-        ctmp = chdpv(mgs) + chcev(mgs)
+        qtmp = qhdpv(mgs) + qhcev(mgs) + qhsbv(mgs)
+        ctmp = chdpv(mgs) + chcev(mgs) + chsbv(mgs)
 
         zhdsv(mgs) = g1*(6.*rho0(mgs)/(pi*xdn(mgs,lh)))**2*( 2.*( tmp ) * qtmp - tmp**2 * ctmp )
 
@@ -21484,7 +21945,6 @@ subroutine nssl_2mom_gs   &
       pzhwd(mgs) = 0.0   &
      & + (1-il5(mgs))*zhmlr(mgs)   &
      & + zhshr(mgs)   &
-!     >  + il5(mgs)*chsbv(mgs)   &
      &  + Min( 0.0, zhdsv(mgs) )   &
      &  - il5(mgs)*zhlcnh(mgs)
 
@@ -21674,7 +22134,7 @@ subroutine nssl_2mom_gs   &
         zrachl(mgs) = 0.0
         zsshr(mgs) = 0.0
         zsshrr(mgs) = 0.0
-        zsmlr(mgs) = 0.0
+!        zsmlr(mgs) = 0.0
         zsmlrr(mgs) = 0.0
 
         IF ( qx(mgs,ls) .gt. qxmin(ls) .and. ( csmlr(mgs) /= 0.0 .or. csshr(mgs) /= 0.0 .or. &
@@ -21682,8 +22142,8 @@ subroutine nssl_2mom_gs   &
          tmp = qx(mgs,ls)/cx(mgs,ls)
          g1 = 36.*(xnu(ls)+2.0)/((xnu(ls)+1.0)*pi**2)
         IF ( .not. mixedphase ) THEN
-          zsmlr(mgs) =  (xdn(mgs,ls)/xdn(mgs,lr))**2*g1*(rho0(mgs)/(xdn(mgs,ls)))**2* &
-     &                 ( 2.*tmp * qsmlr(mgs) - tmp**2 * csmlr(mgs)  )
+!          zsmlr(mgs) =  (xdn(mgs,ls)/xdn(mgs,lr))**2*g1*(rho0(mgs)/(xdn(mgs,ls)))**2* &
+!     &                 ( 2.*tmp * qsmlr(mgs) - tmp**2 * csmlr(mgs)  )
 
           IF ( csmlrr(mgs) /= 0.0 ) THEN
             z1 = g1smlr*(6.*rho0(mgs)/(pi*xdn(mgs,lr)))**2*( qsmlr(mgs)**2/ csmlrr(mgs)  )
@@ -22534,7 +22994,6 @@ subroutine nssl_2mom_gs   &
       end do
       end if
 
-
       IF ( has_wetscav ) THEN
         DO mgs = 1,ngscnt
          evapprod2d(igs(mgs),kgs(mgs)) = -(qrcev(mgs) + qssbv(mgs)  + qhsbv(mgs) + qhlsbv(mgs)) 
@@ -22776,41 +23235,9 @@ subroutine nssl_2mom_gs   &
       tqvcon = temg(mgs)-cbw
       ltemq = (temg(mgs)-163.15)/fqsat+1.5
       ltemq = Min( nqsat, Max(1,ltemq) )
-!      IF ( ltemq .lt. 1 .or. ltemq .gt. nqsat ) THEN
-! C$PAR CRITICAL SECTION
-!        write(iunit,*) 'out of range ltemq!',temgtmp,temg(mgs),
-!     :      thetap(mgs),theta0(mgs),pres(mgs),theta(mgs),
-!     :      ltemq,igs(mgs),jy,kgs(mgs)
-!        write(iunit,*) an(igs(mgs),jy,kgs(mgs),lt),
-!     :   ab(igs(mgs),jy,kgs(mgs),lt),
-!     :   t0(igs(mgs),jy,kgs(mgs))
-!        write(iunit,*) fcc3(mgs),qx(mgs,lc),qitmp(mgs),dtp,ptem(mgs)
-!        STOP
-! C$PAR END CRITICAL SECTION
-!      END IF
+
       qvs(mgs) = pqs(mgs)*tabqvs(ltemq)
       qis(mgs) = pqs(mgs)*tabqis(ltemq)
-!      qss(kz) = qvs(kz)
-!      if ( temg(kz) .lt. tfr ) then
-!      if( qcw(kz) .le. qxmin(lc) .and. qci(kz) .gt. qxmin(li))
-!     >  qss(kz) = qis(kz)
-!      if( qcw(kz) .gt. qxmin(lc) .and. qci(kz) .gt. qxmin(li))
-!     >   qss(kz) = (qcw(kz)*qvs(kz) + qci(kz)*qis(kz)) /
-!     >   (qcw(kz) + qci(kz))
-!      qss(kz) = qis(kz)
-!      end if
-! dont get enough condensation with qcw .le./.gt. qxmin(lc)
-!      if ( temg(mgs) .lt. tfr ) then
-!      if( qx(mgs,lc) .ge. 0.0 .and. qitmp(mgs) .le. qxmin(li) )
-!     >  qss(mgs) = qvs(mgs)
-!      if( qx(mgs,lc) .eq. 0.0 .and. qitmp(mgs) .gt. qxmin(li))
-!     >  qss(mgs) = qis(mgs)
-!      if( qx(mgs,lc) .gt. 0.0 .and. qitmp(mgs) .gt. qxmin(li))
-!     >   qss(mgs) = (qx(mgs,lc)*qvs(mgs) + qitmp(mgs)*qis(mgs)) /
-!     >   (qx(mgs,lc) + qitmp(mgs))
-!      else
-!      qss(mgs) = qvs(mgs)
-!      end if
       qss(mgs) = qvs(mgs)
       if ( temg(mgs) .lt. tfr ) then
       if( qx(mgs,lc) .ge. 0.0 .and. qitmp(mgs) .le. qxmin(li) )   &
@@ -23049,7 +23476,6 @@ subroutine nssl_2mom_gs   &
 
 
 
-
       if (ndebug .gt. 0 ) write(0,*) 'gs 11'
 
       do mgs = 1,ngscnt
@@ -23212,7 +23638,7 @@ subroutine nssl_2mom_gs   &
             qr  = qx(mgs,il)
             cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/(z*xdn(mgs,lr)**2)
 !            an(igs(mgs),jgs,kgs(mgs),ln(il)) = zx(mgs,il)
-           ELSEIF ( zx(mgs,il) <= 0.0 .and. cx(mgs,il) > 0.0 ) THEN
+           ELSEIF ( zx(mgs,il) <= zxmin .and. cx(mgs,il) > 0.0 ) THEN
 !  have mass and concentration but no reflectivity, so set reflectivity, using default alpha
             g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
             chw = cx(mgs,il)
@@ -23220,7 +23646,7 @@ subroutine nssl_2mom_gs   &
             zx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/(xdn(mgs,lr)**2*chw)
             an(igs(mgs),jgs,kgs(mgs),lz(lr)) = zx(mgs,lr)
 
-           ELSEIF ( zx(mgs,il) <= 0.0 .and. cx(mgs,il) <= 0.0 ) THEN
+           ELSEIF ( zx(mgs,il) <= zxmin .and. cx(mgs,il) <= 0.0 ) THEN
 !   How did this happen?
          ! set values according to dBZ of -10, or Z = 0.1
 !              0.1 = 1.e18*0.224*an(ix,jy,kz,lzh)*(hwdn/rwdn)**2
@@ -23237,7 +23663,6 @@ subroutine nssl_2mom_gs   &
           IF ( zx(mgs,lr) > 0.0 ) THEN
             xv(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(1000.*cx(mgs,lr))
             vr = xv(mgs,lr)
-!            z = 36.*(alpha(kz)+2.0)*a(ix,jy,kz,lnr)*vr**2/((alpha(kz)+1.0)*pi**2)
            qr = qx(mgs,lr)
            nrx = cx(mgs,lr)
            z = zx(mgs,lr)
@@ -23247,9 +23672,7 @@ subroutine nssl_2mom_gs   &
 
 ! determine shape parameter alpha by iteration
            IF ( z .gt. 0.0 ) THEN
-!           alpha(mgs,lr) = 3.
            alp = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/(z*pi**2) - 1.
-!           write(0,*) 'kz, alp, alpha(kz) = ',kz,alp,alpha(kz),rd,z,xv
            DO i = 1,20
             IF ( Abs(alp - alpha(mgs,lr)) .lt. 0.01 ) EXIT
              alpha(mgs,lr) = Max( rnumin, Min( rnumax, alp ) )
@@ -23425,7 +23848,7 @@ subroutine nssl_2mom_gs   &
             cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(6.*qr)**2/(z*(pi*xdn(mgs,il))**2)
 
 
-           ELSEIF ( zx(mgs,il) <= 0.0 .and. cx(mgs,il) > 0.0 ) THEN
+           ELSEIF ( zx(mgs,il) <= zxmin .and. cx(mgs,il) > 0.0 ) THEN
 !  have mass and concentration but no reflectivity, so set reflectivity, using default alpha
 !            g1 = (6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
 !     &            ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il)))
@@ -23438,7 +23861,7 @@ subroutine nssl_2mom_gs   &
             zx(mgs,il) = Max(zxmin*1.1, g1*dn(igs(mgs),jy,kgs(mgs))**2*(6*qr)**2/(chw*(pi*xdn(mgs,il))**2) )
             an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
 
-           ELSEIF ( zx(mgs,il) <= 0.0 .and. cx(mgs,il) <= 0.0 ) THEN
+           ELSEIF ( zx(mgs,il) <= zxmin .and. cx(mgs,il) <= 0.0 ) THEN
 !   How did this happen?
          ! set values according to dBZ of -10, or Z = 0.1
 !              0.1 = 1.e18*0.224*an(ix,jy,kz,lzh)*(hwdn/rwdn)**2
@@ -23580,6 +24003,16 @@ subroutine nssl_2mom_gs   &
           
           ENDIF !}
 
+        IF ( lzr > 1 ) THEN
+          alpha2d(igs(mgs),kgs(mgs),1) = Max(alphamin, Min(alphamax, alpha(mgs,lr) ))
+        ENDIF
+        IF ( lzh > 1 ) THEN
+          alpha2d(igs(mgs),kgs(mgs),2) = Max(alphamin, Min(alphamax, alpha(mgs,lh) ))
+        ENDIF
+        IF ( lzhl > 1 ) THEN
+          alpha2d(igs(mgs),kgs(mgs),3) = Max(alphamin, Min(alphamax, alpha(mgs,lhl) ))
+        ENDIF
+
         IF ( il == lhl .and. lnhlf > 1 ) THEN
         ! update chxf in case cx has changed
           chxf(mgs,lhl) = frac*cx(mgs,lhl)
@@ -23608,7 +24041,7 @@ subroutine nssl_2mom_gs   &
  
            
            ENDIF ! } }
-          
+
           ENDIF ! }}
           ENDIF ! }
 

From 0cb137e1822f076e98a468edc8a386fc280c225a Mon Sep 17 00:00:00 2001
From: Ted Mansell <ted.mansell@noaa.gov>
Date: Sun, 24 Sep 2023 15:49:28 -0500
Subject: [PATCH 089/115] Update NSSL documentation and references for 3-moment
 option

---
 physics/docs/library.bib                | 17 +++++++++++------
 physics/docs/pdftxt/NSSLMICRO.txt       |  4 ++--
 physics/docs/pdftxt/suite_input.nml.txt |  3 ++-
 3 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/physics/docs/library.bib b/physics/docs/library.bib
index 34bb54e8f..4260fc3c2 100644
--- a/physics/docs/library.bib
+++ b/physics/docs/library.bib
@@ -3760,8 +3760,6 @@ @inproceedings{yudin_et_al_2019
 
 @article{mansell_2013,
 	author = {Edward R. Mansell and Conrad L. Ziegler},
-	date-added = {2015-02-26 22:32:59 +0000},
-	date-modified = {2020-02-10 23:06:41 +0000},
 	doi = {10.1175/JAS-D-12-0264.1},
 	journal = {Journal of the Atmospheric Sciences},
 	keywords = {storm electrification, microphysics 2-moment},
@@ -3774,8 +3772,6 @@ @article{mansell_2013
 
 @article{mansell_2010,
 	author = {Edward R. Mansell},
-	date-added = {2011-02-22 10:34:11 -0600},
-	date-modified = {2011-02-22 10:35:34 -0600},
 	doi = {10.1175/2010JAS3341.1},
 	journal = {Journal of the Atmospheric Sciences},
 	keywords = {advection, microphysics 2-moment},
@@ -3787,8 +3783,6 @@ @article{mansell_2010
 
 @article{mansell_etal_2010,
 	author = {E. R. Mansell and C. L. Ziegler and E. C. Bruning},
-	date-added = {2007-08-20 15:44:13 -0500},
-	date-modified = {2010-04-13 16:55:16 -0500},
 	doi = {10.1175/2009JAS2965.1},
 	journal = {Journal of the Atmospheric Sciences},
 	keywords = {storm electrification, microphysics 2-moment},
@@ -3798,6 +3792,17 @@ @article{mansell_etal_2010
 	year = {2010},
 	bdsk-url-1 = {https://doi.org/10.1175/2009JAS2965.1}}
 
+@article{mansell:2020,
+	Author = {Edward R. Mansell and Dawson, II, Daniel T. and Jerry M. Straka},
+	Doi = {10.1175/JAS-D-19-0268.1},
+	Journal = jas,
+	Keywords = {microphysics 3-moment},
+	Pages = {3361-3385},
+	Title = {Bin-emulating Hail Melting in 3-moment bulk microphysics},
+	Volume = {77},
+	Year = {2020},
+	Bdsk-Url-1 = {https://dx.doi.org/10.1175/JAS-D-12-0264.1},
+
 @inproceedings{yudin_et_al_2020,
 	author = {Yudin, V. A. and Yang, F. and Karol, S. I. and Fuller-Rowell T. J. and Kubaryk, A. and Juang, H. and Kar, S. and Alpert, J. C. and Li, Z.},
 	booktitle = {1st UFS Users' Workshop},
diff --git a/physics/docs/pdftxt/NSSLMICRO.txt b/physics/docs/pdftxt/NSSLMICRO.txt
index 3d35c9fd2..44d1f069b 100644
--- a/physics/docs/pdftxt/NSSLMICRO.txt
+++ b/physics/docs/pdftxt/NSSLMICRO.txt
@@ -2,7 +2,7 @@
 \page NSSLMICRO_page NSSL 2-moment Cloud Microphysics Scheme
 \section nssl2m_descrp Description
 
-The NSSL two-moment bulk microphysical parameterization scheme that describes form and phase changes among a range of liquid and ice hydrometeors, as described in Mansell et al. (2010) \cite Mansell_etal_2010 and Mansell and Ziegler (2013) \cite Mansell_2013. The microphysical parameterization predicts the mass mixing ratio and number concentration of cloud droplets, raindrops, cloud ice crystals (columns), snow particles (including large crystals and aggregates), graupel, and (optionally) hail.  
+The NSSL 2/3-moment bulk microphysical parameterization scheme that describes form and phase changes among a range of liquid and ice hydrometeors, as described in Mansell et al. (2010) \cite Mansell_etal_2010, Mansell and Ziegler (2013) \cite Mansell_2013, and Mansell et al. (2020) \cite Mansell_etal_2020. The microphysical parameterization predicts the mass mixing ratio and number concentration of cloud droplets, raindrops, cloud ice crystals (columns), snow particles (including large crystals and aggregates), graupel, and (optionally) hail. Optionally, a third moment (reflectivity or 6th moment) of rain, graupel, and hail can be activated.
 
 The graupel and hail particle densities are also calculated by predicting the total particle volume. The graupel category therefore emulates a range of characteristics from high-density frozen drops (includes small hail) to low-density graupel (from rimed ice crystals/snow) in its size and density spectrum. The hail category is designed to simulate larger hail sizes. Hail is only produced from higher-density large graupel.
 
@@ -10,7 +10,7 @@ Hydrometeor size distributions are assumed to follow a gamma functional form. Mi
 
 Cloud concentration nuclei (CCN) concentration is predicted as in Mansell et al. (2010) \cite Mansell_etal_2010 with a bulk activation spectrum approximating small aerosols. The model tracks the number of unactivated CCN, and the local CCN concentration is depleted as droplets are activated, either at cloud base or in cloud. The CCN are subjected to advection and subgrid turbulent mixing but have no other interactions with hydrometeors; for example, scavenging by raindrops is omitted. CCN are restored by droplet evaporation and by a gradual regeneration when no hydrometeors are present. Aerosol sensitivity is enhanced by explicitly treating droplet condensation instead of using a saturation adjustment. Supersaturation (within reason) is allowed to persist in updraft with low droplet concentration.
 
-Excessive size sorting (common in 2-moment schemes) is effectively controlled by an adaptive breakup method that prevents reflectivity growth by sedimentation (Mansell 2010 \cite Mansell_2010). 
+Excessive size sorting (common in 2-moment schemes) is effectively controlled by an adaptive breakup method that prevents reflectivity growth by sedimentation (Mansell 2010 \cite Mansell_2010). Activating the 3-moment scheme provides a natural sedimentation feedback that narrows the size spectrum as size-sorting procedes without the the artificial breakup induced by the 2-moment scheme.
 
 The NSSL scheme is designed with deep (severe) convection in mind at grid spacings of up to 4 km, but can also be run at larger grid spacing as needed for nesting etc. It is also able to capture non-severe and winter weather.
 
diff --git a/physics/docs/pdftxt/suite_input.nml.txt b/physics/docs/pdftxt/suite_input.nml.txt
index e986fc322..c4bb5003b 100644
--- a/physics/docs/pdftxt/suite_input.nml.txt
+++ b/physics/docs/pdftxt/suite_input.nml.txt
@@ -54,7 +54,7 @@ show some variables in the namelist that must match the SDF.
                                                       <li> 10: Morrison-Gettelman microphysics scheme
                                                       <li> 11: GFDL microphysics scheme
                                                       <li> 17: NSSL microphysics scheme with background CCN
-                                                      <li> 18: NSSL microphysics scheme with predicted CCN (compatibility)
+                                                      <li> 18: NSSL microphysics scheme with predicted CCN (compatibility: 18 = 17 + nssl_ccn_on=.true.)
                                                       </ul>
                                                       <td>99
 <tr><td colspan="4" align= center>\b Parameters \b related \b to \b radiation \b scheme \b options
@@ -406,6 +406,7 @@ show some variables in the namelist that must match the SDF.
 <tr><td>nssl_ehw0_in    <td>mp_nssl          <td>constant or max assumed graupel-droplet collection efficiency          <td>0.9
 <tr><td>nssl_ehlw0_in   <td>mp_nssl          <td>constant or max assumed hail-droplet collection efficiency          <td>0.9
 <tr><td>nssl_hail_on    <td>mp_nssl          <td>NSSL flag to activate the hail category         <td>.false.
+<tr><td>nssl_3moment    <td>mp_nssl          <td>NSSL flag to activate 3-moment for rain/graupel (and hail if activated)<td>.false.
 <tr><td>nssl_ccn_on     <td>mp_nssl          <td>NSSL flag to activate the CCN category          <td>.true.
 <tr><td>nssl_invertccn  <td>mp_nssl          <td>NSSL flag to treat CCN as activated or unactivated      <td>.true.
 <tr><td>nssl_ehw0       <td>mp_nssl          <td>NSSL graupel-droplet collection efficiency      <td>0.9

From 9b9f55320455a3bca522f1c059b2919922bee2c4 Mon Sep 17 00:00:00 2001
From: Ted Mansell <ted.mansell@noaa.gov>
Date: Sun, 24 Sep 2023 16:33:05 -0500
Subject: [PATCH 090/115]  module_mp_nssl_2mom.F90 : set ngs with constant

---
 physics/module_mp_nssl_2mom.F90 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/physics/module_mp_nssl_2mom.F90 b/physics/module_mp_nssl_2mom.F90
index 72ff9b1b1..a373ddaf9 100644
--- a/physics/module_mp_nssl_2mom.F90
+++ b/physics/module_mp_nssl_2mom.F90
@@ -2612,7 +2612,7 @@ SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw
      nx = ite-its+1
      ny = 1         ! set up as 2D slabs
      nz = kte-kts+1
-     ngs = Max(nz,64)
+     ngs = 64
      
      IF ( .not. flag_ccn ) THEN
        renucfrac = 1.0

From 6ee6df60ca69743bab195fc4b04a891e91bdaeaf Mon Sep 17 00:00:00 2001
From: Ted Mansell <ted.mansell@noaa.gov>
Date: Mon, 25 Sep 2023 12:33:46 -0500
Subject: [PATCH 091/115]  module_mp_nssl_2mom.F90: removed unneeded lines

---
 physics/module_mp_nssl_2mom.F90 | 2 --
 1 file changed, 2 deletions(-)

diff --git a/physics/module_mp_nssl_2mom.F90 b/physics/module_mp_nssl_2mom.F90
index a373ddaf9..a40a62f02 100644
--- a/physics/module_mp_nssl_2mom.F90
+++ b/physics/module_mp_nssl_2mom.F90
@@ -21238,7 +21238,6 @@ subroutine nssl_2mom_gs   &
       pqwvi(mgs) =    &
      &  -Min(0.0, qrcev(mgs))   &
      &  -Min(0.0, qhcev(mgs))   &
-     &  -Min(0.0, qfcev(mgs))   &
      &  -Min(0.0, qhlcev(mgs))   &
      &  -Min(0.0, qscev(mgs))   &
 !     >  +il5(mgs)*(-qhsbv(mgs) - qhlsbv(mgs) )   &
@@ -21249,7 +21248,6 @@ subroutine nssl_2mom_gs   &
       pqwvd(mgs) =     &
      &  -Max(0.0, qrcev(mgs))   &
      &  -Max(0.0, qhcev(mgs))   &
-     &  -Max(0.0, qfcev(mgs))   &
      &  -Max(0.0, qhlcev(mgs))   &
      &  -Max(0.0, qscev(mgs))   &
      &  +il5(mgs)*(-qiint(mgs)   &

From dbd5f58b1f04f8d31a445ca477a1cc1169707303 Mon Sep 17 00:00:00 2001
From: "samuel.trahan" <Samuel.Trahan@noaa.gov>
Date: Wed, 27 Sep 2023 01:19:48 +0000
Subject: [PATCH 092/115] remove all constant 3D variables from clm lake

---
 physics/clm_lake.f90  | 202 ++++++++++++++++--------------------------
 physics/clm_lake.meta |  78 ++--------------
 2 files changed, 86 insertions(+), 194 deletions(-)

diff --git a/physics/clm_lake.f90 b/physics/clm_lake.f90
index 4fa6dacb6..c6fa56320 100644
--- a/physics/clm_lake.f90
+++ b/physics/clm_lake.f90
@@ -229,6 +229,31 @@ end subroutine is_salty
  
     !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
+    subroutine calculate_z_dz_lake(i,input_lakedepth,clm_lakedepth,z_lake,dz_lake)
+      implicit none
+      integer, intent(in) :: i
+      real(kind_phys), intent(inout) :: clm_lakedepth(:) ! lake depth used by clm
+      real(kind_phys), intent(in) :: input_lakedepth(:) ! lake depth before correction (m)
+      real(kind_lake) :: z_lake(nlevlake)  ! layer depth for lake (m)
+      real(kind_lake) :: dz_lake(nlevlake) ! layer thickness for lake (m)
+      real(kind_lake) :: depthratio
+
+      if (input_lakedepth(i) == spval) then
+        clm_lakedepth(i) = zlak(nlevlake) + 0.5_kind_lake*dzlak(nlevlake)
+        z_lake(1:nlevlake) = zlak(1:nlevlake)
+        dz_lake(1:nlevlake) = dzlak(1:nlevlake)
+      else
+        depthratio = input_lakedepth(i) / (zlak(nlevlake) + 0.5_kind_lake*dzlak(nlevlake)) 
+        z_lake(1) = zlak(1)
+        dz_lake(1) = dzlak(1)
+        dz_lake(2:nlevlake) = dzlak(2:nlevlake)*depthratio
+        z_lake(2:nlevlake) = zlak(2:nlevlake)*depthratio + dz_lake(1)*(1._kind_lake - depthratio)
+      end if
+
+    end subroutine calculate_z_dz_lake
+
+    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
     !> \section arg_table_clm_lake_run Argument Table
     !! \htmlinclude clm_lake_run.html
     !!
@@ -258,8 +283,8 @@ SUBROUTINE clm_lake_run( &
 
          salty, savedtke12d, snowdp2d, h2osno2d, snl2d, t_grnd2d, t_lake3d,       &
          lake_icefrac3d, t_soisno3d, h2osoi_ice3d, h2osoi_liq3d, h2osoi_vol3d,    &
-         z3d, dz3d, zi3d, z_lake3d, dz_lake3d, watsat3d, csol3d, sand3d, clay3d,  &
-         tkmg3d, tkdry3d, tksatu3d, clm_lakedepth, cannot_freeze,                 &
+         z3d, dz3d, zi3d,                                                         &
+                   input_lakedepth, clm_lakedepth, cannot_freeze,                 &
 
          ! Error reporting:
          errflg, errmsg)
@@ -336,14 +361,8 @@ SUBROUTINE clm_lake_run( &
                                                                                   dz3d 
     real(kind_phys),    dimension( :,-nlevsnow+0: )  ,INTENT(inout)  :: zi3d    
 
-    REAL(KIND_PHYS),           DIMENSION( :,: ),INTENT(INOUT)  :: z_lake3d
-    REAL(KIND_PHYS),           DIMENSION( :,: ),INTENT(INOUT)  :: dz_lake3d
-    REAL(KIND_PHYS),           DIMENSION( :,: ),INTENT(INOUT)  :: watsat3d
-    REAL(KIND_PHYS),           DIMENSION( :,: ),INTENT(INOUT)  :: csol3d, sand3d, clay3d
-    REAL(KIND_PHYS),           DIMENSION( :,: ),INTENT(INOUT)  :: tkmg3d
-    REAL(KIND_PHYS),           DIMENSION( :,: ),INTENT(INOUT)  :: tkdry3d
-    REAL(KIND_PHYS),           DIMENSION( :,: ),INTENT(INOUT)  :: tksatu3d
     REAL(KIND_PHYS),           DIMENSION( : )  ,INTENT(INOUT)  :: clm_lakedepth
+    REAL(KIND_PHYS),           DIMENSION( : )  ,INTENT(INOUT)  :: input_lakedepth
 
     !
     ! Error reporting:
@@ -430,10 +449,10 @@ SUBROUTINE clm_lake_run( &
       character*255 :: message
       logical, parameter :: feedback_to_atmosphere = .true. ! FIXME: REMOVE
 
-      real(kind_lake) :: to_radians, lat_d, lon_d, qss
+      real(kind_lake) :: to_radians, lat_d, lon_d, qss, tkm, bd
 
-      integer :: month,num1,num2,day_of_month
-      real(kind_lake) :: wght1,wght2,Tclim
+      integer :: month,num1,num2,day_of_month,isl
+      real(kind_lake) :: wght1,wght2,Tclim,depthratio
 
       logical salty_flag, cannot_freeze_flag
 
@@ -451,31 +470,19 @@ SUBROUTINE clm_lake_run( &
                               lakedepth_default=lakedepth_default, fhour=fhour,           &
              oro_lakedepth=oro_lakedepth, savedtke12d=savedtke12d, snowdp2d=snowdp2d,     &
              h2osno2d=h2osno2d, snl2d=snl2d, t_grnd2d=t_grnd2d, t_lake3d=t_lake3d,        &
-             lake_icefrac3d=lake_icefrac3d, z_lake3d=z_lake3d, dz_lake3d=dz_lake3d,       &
+             lake_icefrac3d=lake_icefrac3d,                                               &
              t_soisno3d=t_soisno3d, h2osoi_ice3d=h2osoi_ice3d, h2osoi_liq3d=h2osoi_liq3d, &
-             h2osoi_vol3d=h2osoi_vol3d, z3d=z3d, dz3d=dz3d, zi3d=zi3d, watsat3d=watsat3d, &
-             csol3d=csol3d, tkmg3d=tkmg3d, fice=fice, hice=hice, min_lakeice=min_lakeice, &
+             h2osoi_vol3d=h2osoi_vol3d, z3d=z3d, dz3d=dz3d, zi3d=zi3d,                    &
+                                           fice=fice, hice=hice, min_lakeice=min_lakeice, &
              tsfc=tsfc,                                                                   &
-             use_lake_model=use_lake_model, use_lakedepth=use_lakedepth, tkdry3d=tkdry3d, &
-             tksatu3d=tksatu3d, im=im, prsi=prsi, xlat_d=xlat_d, xlon_d=xlon_d,           &
-             clm_lake_initialized=clm_lake_initialized, sand3d=sand3d, clay3d=clay3d,     &
+             use_lake_model=use_lake_model, use_lakedepth=use_lakedepth,                  &
+                                im=im, prsi=prsi, xlat_d=xlat_d, xlon_d=xlon_d,           &
+             clm_lake_initialized=clm_lake_initialized, input_lakedepth=input_lakedepth,  &
              tg3=tg3, clm_lakedepth=clm_lakedepth, km=km, me=me, master=master,           &
              errmsg=errmsg, errflg=errflg)
         if(errflg/=0) then
           return
         endif
-        if(any(clay3d>0 .and. clay3d<1)) then
-          write(message,*) 'Invalid clay3d. Abort.'
-          errmsg=trim(message)
-          errflg=1
-          return
-        endif
-        if(any(dz_lake3d>0 .and. dz_lake3d<.1)) then
-          write(message,*) 'Invalid dz_lake3d. Abort.'
-          errmsg=trim(message)
-          errflg=1
-          return
-        endif
 
       lake_points=0
       snow_points=0
@@ -540,6 +547,13 @@ SUBROUTINE clm_lake_run( &
 
            lake_points = lake_points+1
 
+           call calculate_z_dz_lake(i,input_lakedepth,clm_lakedepth,z_lake(1,:),dz_lake(1,:))
+
+           do c = 2,column
+             z_lake(c,:) = z_lake(1,:)
+             dz_lake(c,:) = z_lake(1,:)
+           enddo
+
            do c = 1,column
      
             forc_t(c)          = SFCTMP           ! [K]
@@ -567,8 +581,6 @@ SUBROUTINE clm_lake_run( &
             do k = 1,nlevlake
                t_lake(c,k)        = t_lake3d(i,k)
                lake_icefrac(c,k)  = lake_icefrac3d(i,k)
-               z_lake(c,k)        = z_lake3d(i,k)
-               dz_lake(c,k)       = dz_lake3d(i,k)
             enddo
             do k = -nlevsnow+1,nlevsoil
                t_soisno(c,k)      = t_soisno3d(i,k)
@@ -582,11 +594,18 @@ SUBROUTINE clm_lake_run( &
                zi(c,k)            = zi3d(i,k)
             enddo
             do k = 1,nlevsoil
-               watsat(c,k)        = watsat3d(i,k)
-               csol(c,k)          = csol3d(i,k)
-               tkmg(c,k)          = tkmg3d(i,k)
-               tkdry(c,k)         = tkdry3d(i,k)
-               tksatu(c,k)        = tksatu3d(i,k)
+               ! Soil hydraulic and thermal properties
+               isl = ISLTYP(i)   
+               if (isl == 0  ) isl = 14
+               if (isl == 14 ) isl = isl + 1 
+
+               watsat(c,k) = 0.489_kind_lake - 0.00126_kind_lake*sand(isl)
+               csol(c,k) = (2.128_kind_lake*sand(isl)+2.385_kind_lake*clay(isl)) / (sand(isl)+clay(isl))*1.e6_kind_lake  ! J/(m3 K)
+               tkm                = (8.80_kind_lake*sand(isl)+2.92_kind_lake*clay(isl))/(sand(isl)+clay(isl))          ! W/(m K)
+               bd                 = (1._kind_lake-watsat(c,k))*2.7e3_kind_lake
+               tkmg(c,k)          = tkm ** (1._kind_lake- watsat(c,k))
+               tkdry(c,k)         = (0.135_kind_lake*bd + 64.7_kind_lake) / (2.7e3_kind_lake - 0.947_kind_lake*bd)
+               tksatu(c,k)        = tkmg(c,k)*0.57_kind_lake**watsat(c,k)
             enddo
             
           enddo
@@ -747,7 +766,7 @@ SUBROUTINE clm_lake_run( &
                   hice(I) = 0                               ! sea_ice_thickness
                   do k=1,nlevlake
                     if(lake_icefrac3d(i,k)>0) then
-                      hice(i) = hice(i) + dz_lake3d(i,k)
+                      hice(i) = hice(i) + dz_lake(c,k)
                     endif
                   end do
                 else ! Not an ice point
@@ -5315,14 +5334,14 @@ SUBROUTINE lakeini(kdt,            ISLTYP,          gt0,             snowd,
                     weasd,                           lakedepth_default,  fhour,       &
                     oro_lakedepth,  savedtke12d,     snowdp2d,        h2osno2d,       & !o
                     snl2d,          t_grnd2d,        t_lake3d,        lake_icefrac3d, &
-                    z_lake3d,       dz_lake3d,       t_soisno3d,      h2osoi_ice3d,   &
+                                                     t_soisno3d,      h2osoi_ice3d,   &
                     h2osoi_liq3d,   h2osoi_vol3d,    z3d,             dz3d,           &
-                    zi3d,           watsat3d,        csol3d,          tkmg3d,         &
+                    zi3d,                                                             &
                     fice,           hice,            min_lakeice,     tsfc,           &
                     use_lake_model, use_lakedepth,                                    &
-                    tkdry3d,        tksatu3d,        im,              prsi,           &
+                                                     im,              prsi,           &
                     xlat_d,         xlon_d,          clm_lake_initialized,            &
-                    sand3d,         clay3d,          tg3,             clm_lakedepth,  &
+                    input_lakedepth,                 tg3,             clm_lakedepth,  &
                     km,   me,       master,          errmsg,          errflg)
 
    !> Some fields in lakeini are not available during initialization,
@@ -5360,6 +5379,7 @@ SUBROUTINE lakeini(kdt,            ISLTYP,          gt0,             snowd,
   real(kind_phys),    intent(in)                                      :: lakedepth_default
 
   real(kind_phys),    dimension(IM),intent(inout)                      :: clm_lakedepth
+  real(kind_phys),    dimension(IM),intent(inout)                      :: input_lakedepth
   real(kind_phys),    dimension(IM),intent(in)                         :: oro_lakedepth
   real(kind_phys),    dimension(IM),intent(out)                        :: savedtke12d
   real(kind_phys),    dimension(IM),intent(out)                        :: snowdp2d,       &
@@ -5368,43 +5388,24 @@ SUBROUTINE lakeini(kdt,            ISLTYP,          gt0,             snowd,
                                                                              t_grnd2d
                                                                               
   real(kind_phys),    dimension(IM,nlevlake),INTENT(out)                  :: t_lake3d,       &
-                                                                             lake_icefrac3d, &
-                                                                             z_lake3d,       &
-                                                                             dz_lake3d
+                                                                             lake_icefrac3d
   real(kind_phys),    dimension(IM,-nlevsnow+1:nlevsoil ),INTENT(out)     :: t_soisno3d,     &
                                                                              h2osoi_ice3d,   &
                                                                              h2osoi_liq3d,   &
                                                                              h2osoi_vol3d,   &
                                                                              z3d,            &
                                                                              dz3d
-  real(kind_phys),    dimension(IM,nlevsoil),INTENT(out)                  :: watsat3d,       &
-                                                                             csol3d,         &
-                                                                             tkmg3d,         &
-                                                                             tkdry3d,        &
-                                                                             tksatu3d
-  real(kind_phys),    dimension(IM,nlevsoil),INTENT(inout)                :: clay3d,   &
-                                                                             sand3d   
 
   real(kind_phys),    dimension( IM,-nlevsnow+0:nlevsoil ),INTENT(out)   :: zi3d            
 
   !LOGICAL, DIMENSION( : ),intent(out)                      :: lake
   !REAL(KIND_PHYS), OPTIONAL,    DIMENSION( : ), INTENT(IN)    ::  lake_depth ! no separate variable for this in CCPP
 
-  real(kind_lake),   dimension( 1:im,1:nlevsoil )     :: bsw3d,    &
-                                                        bsw23d,   &
-                                                        psisat3d, &
-                                                        vwcsat3d, &
-                                                        watdry3d, &
-                                                        watopt3d, &
-                                                        hksat3d,  &
-                                                        sucsat3d
   integer  :: n,i,j,k,ib,lev,bottom      ! indices
   real(kind_lake),dimension(1:im )    :: bd2d               ! bulk density of dry soil material [kg/m^3]
   real(kind_lake),dimension(1:im )    :: tkm2d              ! mineral conductivity
   real(kind_lake),dimension(1:im )    :: xksat2d            ! maximum hydraulic conductivity of soil [mm/s]
   real(kind_lake),dimension(1:im )    :: depthratio2d       ! ratio of lake depth to standard deep lake depth 
-  real(kind_lake),dimension(1:im )    :: clay2d             ! temporary
-  real(kind_lake),dimension(1:im )    :: sand2d             ! temporary
 
   logical,parameter        :: arbinit = .false.
   real(kind_lake),parameter           :: defval  = -999.0
@@ -5413,16 +5414,19 @@ SUBROUTINE lakeini(kdt,            ISLTYP,          gt0,             snowd,
   character*256 :: message
   real(kind_lake) :: ht
   real(kind_lake) :: rhosn
-  real(kind_lake) :: depth
+  real(kind_lake) :: depth, lakedepth
 
   logical :: climatology_limits
 
+  real(kind_lake)  :: z_lake(nlevlake)  ! layer depth for lake (m)
+  real(kind_lake)  :: dz_lake(nlevlake)                  ! layer thickness for lake (m)
+
   integer, parameter :: xcheck=38
   integer, parameter :: ycheck=92
 
   integer :: used_lakedepth_default, init_points, month, julday
   integer :: mon, iday, num2, num1, juld, day2, day1, wght1, wght2
-  real(kind_lake) :: Tclim
+  real(kind_lake) :: Tclim, watsat
 
   used_lakedepth_default=0
 
@@ -5456,6 +5460,8 @@ SUBROUTINE lakeini(kdt,            ISLTYP,          gt0,             snowd,
       cycle
     endif
 
+    input_lakedepth=clm_lakedepth
+
     snl2d(i)                   = defval
     do k = -nlevsnow+1,nlevsoil
         h2osoi_liq3d(i,k)      = defval
@@ -5468,8 +5474,6 @@ SUBROUTINE lakeini(kdt,            ISLTYP,          gt0,             snowd,
     do k = 1,nlevlake 
         t_lake3d(i,k)          = defval
         lake_icefrac3d(i,k)    = defval
-        z_lake3d(i,k)          = defval
-        dz_lake3d(i,k)         = defval
     enddo
     
     if (use_lake_model(i) == 1) then
@@ -5499,60 +5503,9 @@ SUBROUTINE lakeini(kdt,            ISLTYP,          gt0,             snowd,
     isl = ISLTYP(i)   
     if (isl == 0  ) isl = 14
     if (isl == 14 ) isl = isl + 1 
-    do k = 1,nlevsoil
-      sand3d(i,k)  = sand(isl)
-      clay3d(i,k)  = clay(isl)
-
-      ! Cannot continue if either of these checks fail.
-      if(clay3d(i,k)>0 .and. clay3d(i,k)<1) then
-        write(message,*) 'bad clay3d ',clay3d(i,k)
-        write(0,'(A)') trim(message)
-        errmsg = trim(message)
-        errflg = 1
-        return
-      endif
-      if(sand3d(i,k)>0 .and. sand3d(i,k)<1) then
-        write(message,*) 'bad sand3d ',sand3d(i,k)
-        write(0,'(A)') trim(message)
-        errmsg = trim(message)
-        errflg = 1
-        return
-      endif
-    enddo
 
-    do k = 1,nlevsoil
-      clay2d(i) = clay3d(i,k)
-      sand2d(i) = sand3d(i,k)
-      watsat3d(i,k) = 0.489_kind_lake - 0.00126_kind_lake*sand2d(i)
-      bd2d(i)    = (1._kind_lake-watsat3d(i,k))*2.7e3_kind_lake
-      xksat2d(i) = 0.0070556_kind_lake *( 10._kind_lake**(-0.884_kind_lake+0.0153_kind_lake*sand2d(i)) ) ! mm/s
-      tkm2d(i) = (8.80_kind_lake*sand2d(i)+2.92_kind_lake*clay2d(i))/(sand2d(i)+clay2d(i))          ! W/(m K)
-
-      bsw3d(i,k) = 2.91_kind_lake + 0.159_kind_lake*clay2d(i)
-      bsw23d(i,k) = -(3.10_kind_lake + 0.157_kind_lake*clay2d(i) - 0.003_kind_lake*sand2d(i))
-      psisat3d(i,k) = -(exp((1.54_kind_lake - 0.0095_kind_lake*sand2d(i) + 0.0063_kind_lake*(100.0_kind_lake-sand2d(i)  &
-           -clay2d(i)))*log(10.0_kind_lake))*9.8e-5_kind_lake)
-      vwcsat3d(i,k) = (50.5_kind_lake - 0.142_kind_lake*sand2d(i) - 0.037_kind_lake*clay2d(i))/100.0_kind_lake
-      hksat3d(i,k) = xksat2d(i)
-      sucsat3d(i,k) = 10._kind_lake * ( 10._kind_lake**(1.88_kind_lake-0.0131_kind_lake*sand2d(i)) )
-      tkmg3d(i,k) = tkm2d(i) ** (1._kind_lake- watsat3d(i,k))
-      tksatu3d(i,k) = tkmg3d(i,k)*0.57_kind_lake**watsat3d(i,k)
-      tkdry3d(i,k) = (0.135_kind_lake*bd2d(i) + 64.7_kind_lake) / (2.7e3_kind_lake - 0.947_kind_lake*bd2d(i))
-      csol3d(i,k) = (2.128_kind_lake*sand2d(i)+2.385_kind_lake*clay2d(i)) / (sand2d(i)+clay2d(i))*1.e6_kind_lake  ! J/(m3 K)
-      watdry3d(i,k) = watsat3d(i,k) * (316230._kind_lake/sucsat3d(i,k)) ** (-1._kind_lake/bsw3d(i,k))
-      watopt3d(i,k) = watsat3d(i,k) * (158490._kind_lake/sucsat3d(i,k)) ** (-1._kind_lake/bsw3d(i,k))
-    end do
-    if (clm_lakedepth(i) == spval) then
-      clm_lakedepth(i) = zlak(nlevlake) + 0.5_kind_lake*dzlak(nlevlake)
-      z_lake3d(i,1:nlevlake) = zlak(1:nlevlake)
-      dz_lake3d(i,1:nlevlake) = dzlak(1:nlevlake)
-    else
-      depthratio2d(i) = clm_lakedepth(i) / (zlak(nlevlake) + 0.5_kind_lake*dzlak(nlevlake)) 
-      z_lake3d(i,1) = zlak(1)
-      dz_lake3d(i,1) = dzlak(1)
-      dz_lake3d(i,2:nlevlake) = dzlak(2:nlevlake)*depthratio2d(i)
-      z_lake3d(i,2:nlevlake) = zlak(2:nlevlake)*depthratio2d(i) + dz_lake3d(i,1)*(1._kind_lake - depthratio2d(i))
-    end if
+    call calculate_z_dz_lake(i,input_lakedepth,clm_lakedepth,z_lake,dz_lake)
+
     z3d(i,1:nlevsoil) = zsoi(1:nlevsoil)
     zi3d(i,0:nlevsoil) = zisoi(0:nlevsoil)
     dz3d(i,1:nlevsoil) = dzsoi(1:nlevsoil)
@@ -5633,9 +5586,9 @@ SUBROUTINE lakeini(kdt,            ISLTYP,          gt0,             snowd,
      if(lake_icefrac3d(i,1) > 0.) then
        depth = 0.
        do k=2,nlevlake
-         depth = depth + dz_lake3d(i,k)
+         depth = depth + dz_lake(k)
          if(hice(i) >= depth) then
-           lake_icefrac3d(i,k) = max(0.,lake_icefrac3d(i,1)+(0.-lake_icefrac3d(i,1))/z_lake3d(i,nlevlake)*depth)
+           lake_icefrac3d(i,k) = max(0.,lake_icefrac3d(i,1)+(0.-lake_icefrac3d(i,1))/z_lake(nlevlake)*depth)
          else
            lake_icefrac3d(i,k) = 0.
          endif
@@ -5649,8 +5602,8 @@ SUBROUTINE lakeini(kdt,            ISLTYP,          gt0,             snowd,
        t_grnd2d(i)          = max(tfrz,tsfc(i))
      endif
      do k = 2, nlevlake
-       if(z_lake3d(i,k).le.depth_c) then
-         t_lake3d(i,k) = tsfc(i)+(277.2_kind_lake-tsfc(i))/depth_c*z_lake3d(i,k)
+       if(z_lake(k).le.depth_c) then
+         t_lake3d(i,k) = tsfc(i)+(277.2_kind_lake-tsfc(i))/depth_c*z_lake(k)
        else
          t_lake3d(i,k) = 277.2_kind_lake
        end if
@@ -5684,7 +5637,8 @@ SUBROUTINE lakeini(kdt,            ISLTYP,          gt0,             snowd,
 
     do k = 1,nlevsoil
        h2osoi_vol3d(i,k) = 1.0_kind_lake
-       h2osoi_vol3d(i,k) = min(h2osoi_vol3d(i,k),watsat3d(i,k))
+       watsat = 0.489_kind_lake - 0.00126_kind_lake*sand(isl)
+       h2osoi_vol3d(i,k) = min(h2osoi_vol3d(i,k),watsat)
 
       ! soil layers
       if (t_soisno3d(i,k) <= tfrz) then
diff --git a/physics/clm_lake.meta b/physics/clm_lake.meta
index 3de543078..11a44286a 100644
--- a/physics/clm_lake.meta
+++ b/physics/clm_lake.meta
@@ -289,6 +289,14 @@
   type = real
   kind = kind_phys
   intent = in
+[input_lakedepth]
+  standard_name = lake_depth_before_correction
+  long_name = lake depth_before_correction
+  units = m
+  dimensions = (horizontal_loop_extent)
+  type = real
+  kind = kind_phys
+  intent = inout
 [wind]
   standard_name = wind_speed_at_lowest_model_layer
   long_name = wind speed at lowest model level
@@ -716,76 +724,6 @@
   type = real
   kind = kind_phys
   intent = inout
-[z_lake3d]
-  standard_name = depth_of_lake_interface_layers
-  long_name = depth of lake interface layers
-  units = fraction
-  dimensions = (horizontal_loop_extent, lake_vertical_dimension_for_clm_lake_model)
-  type = real
-  kind = kind_phys
-  intent = inout
-[dz_lake3d]
-  standard_name = thickness_of_lake_layers
-  long_name = thickness of lake layers
-  units = fraction
-  dimensions = (horizontal_loop_extent, lake_vertical_dimension_for_clm_lake_model)
-  type = real
-  kind = kind_phys
-  intent = inout
-[watsat3d]
-  standard_name = saturated_volumetric_soil_water_in_lake_model
-  long_name = saturated volumetric soil water in lake model
-  units = m
-  dimensions = (horizontal_loop_extent, lake_vertical_dimension_for_clm_lake_model)
-  type = real
-  kind = kind_phys
-  intent = inout
-[csol3d]
-  standard_name = soil_heat_capacity_in_lake_model
-  long_name = soil heat capacity in lake model
-  units = m
-  dimensions = (horizontal_loop_extent, lake_vertical_dimension_for_clm_lake_model)
-  type = real
-  kind = kind_phys
-  intent = inout
-[sand3d]
-  standard_name = clm_lake_percent_sand
-  long_name = percent sand in clm lake model
-  units = percent
-  dimensions = (horizontal_loop_extent,soil_vertical_dimension_for_clm_lake_model)
-  type = integer
-  intent = inout
-[clay3d]
-  standard_name = clm_lake_percent_clay
-  long_name = percent clay in clm lake model
-  units = percent
-  dimensions = (horizontal_loop_extent,soil_vertical_dimension_for_clm_lake_model)
-  type = integer
-  intent = inout
-[tkmg3d]
-  standard_name = soil_mineral_thermal_conductivity_in_lake_model
-  long_name = soil mineral thermal conductivity in lake model
-  units = m
-  dimensions = (horizontal_loop_extent, lake_vertical_dimension_for_clm_lake_model)
-  type = real
-  kind = kind_phys
-  intent = inout
-[tkdry3d]
-  standard_name = dry_soil_thermal_conductivity_in_lake_model
-  long_name = dry soil thermal conductivity in lake model
-  units = m
-  dimensions = (horizontal_loop_extent, lake_vertical_dimension_for_clm_lake_model)
-  type = real
-  kind = kind_phys
-  intent = inout
-[tksatu3d]
-  standard_name = saturated_soil_thermal_conductivity_in_lake_model
-  long_name = saturated soil thermal conductivity in lake model
-  units = m
-  dimensions = (horizontal_loop_extent, lake_vertical_dimension_for_clm_lake_model)
-  type = real
-  kind = kind_phys
-  intent = inout
 [clm_lakedepth]
   standard_name = clm_lake_depth
   long_name = clm internal copy of lake depth with 10.0 replaced by default lake depth

From 75ec62308ae51ea48b03ecd438b8a1eb71c8b929 Mon Sep 17 00:00:00 2001
From: "samuel.trahan" <Samuel.Trahan@noaa.gov>
Date: Wed, 27 Sep 2023 14:40:02 +0000
Subject: [PATCH 093/115] calculate constants only once per i

---
 physics/clm_lake.f90 | 28 +++++++++++++---------------
 1 file changed, 13 insertions(+), 15 deletions(-)

diff --git a/physics/clm_lake.f90 b/physics/clm_lake.f90
index c6fa56320..da4712810 100644
--- a/physics/clm_lake.f90
+++ b/physics/clm_lake.f90
@@ -554,6 +554,19 @@ SUBROUTINE clm_lake_run( &
              dz_lake(c,:) = z_lake(1,:)
            enddo
 
+           ! Soil hydraulic and thermal properties
+           isl = ISLTYP(i)   
+           if (isl == 0  ) isl = 14
+           if (isl == 14 ) isl = isl + 1 
+
+           watsat = 0.489_kind_lake - 0.00126_kind_lake*sand(isl)
+           csol   = (2.128_kind_lake*sand(isl)+2.385_kind_lake*clay(isl)) / (sand(isl)+clay(isl))*1.e6_kind_lake  ! J/(m3 K)
+           tkm    = (8.80_kind_lake*sand(isl)+2.92_kind_lake*clay(isl))/(sand(isl)+clay(isl))          ! W/(m K)
+           bd     = (1._kind_lake-watsat(1,1))*2.7e3_kind_lake
+           tkmg   = tkm ** (1._kind_lake- watsat(1,1))
+           tkdry  = (0.135_kind_lake*bd + 64.7_kind_lake) / (2.7e3_kind_lake - 0.947_kind_lake*bd)
+           tksatu = tkmg(1,1)*0.57_kind_lake**watsat(1,1)
+
            do c = 1,column
      
             forc_t(c)          = SFCTMP           ! [K]
@@ -593,21 +606,6 @@ SUBROUTINE clm_lake_run( &
             do k = -nlevsnow+0,nlevsoil
                zi(c,k)            = zi3d(i,k)
             enddo
-            do k = 1,nlevsoil
-               ! Soil hydraulic and thermal properties
-               isl = ISLTYP(i)   
-               if (isl == 0  ) isl = 14
-               if (isl == 14 ) isl = isl + 1 
-
-               watsat(c,k) = 0.489_kind_lake - 0.00126_kind_lake*sand(isl)
-               csol(c,k) = (2.128_kind_lake*sand(isl)+2.385_kind_lake*clay(isl)) / (sand(isl)+clay(isl))*1.e6_kind_lake  ! J/(m3 K)
-               tkm                = (8.80_kind_lake*sand(isl)+2.92_kind_lake*clay(isl))/(sand(isl)+clay(isl))          ! W/(m K)
-               bd                 = (1._kind_lake-watsat(c,k))*2.7e3_kind_lake
-               tkmg(c,k)          = tkm ** (1._kind_lake- watsat(c,k))
-               tkdry(c,k)         = (0.135_kind_lake*bd + 64.7_kind_lake) / (2.7e3_kind_lake - 0.947_kind_lake*bd)
-               tksatu(c,k)        = tkmg(c,k)*0.57_kind_lake**watsat(c,k)
-            enddo
-            
           enddo
 
           eflx_lwrad_net = -9999

From 7a8f6934f40390de915f4d8828d2119da9f99956 Mon Sep 17 00:00:00 2001
From: "Haiqin.Li" <Haiqin.Li@noaa.gov>
Date: Wed, 27 Sep 2023 18:56:22 +0000
Subject: [PATCH 094/115] "to address the reviewers' comments"

---
 physics/cu_c3_deep.F90        |  4 ----
 physics/cu_c3_driver.F90      | 32 --------------------------------
 physics/cu_c3_driver_post.F90 |  2 +-
 physics/cu_gf_driver.F90      | 32 --------------------------------
 physics/cu_gf_driver_post.F90 |  2 +-
 5 files changed, 2 insertions(+), 70 deletions(-)

diff --git a/physics/cu_c3_deep.F90 b/physics/cu_c3_deep.F90
index b8a1dd838..e6d238b69 100644
--- a/physics/cu_c3_deep.F90
+++ b/physics/cu_c3_deep.F90
@@ -2078,10 +2078,6 @@ subroutine cu_c3_deep_run(        &
 
 !> - Call rain_evap_below_cloudbase() to calculate evaporation below cloud base
 
-!      call rain_evap_below_cloudbase(itf,ktf,its,ite,                    &
-!           kts,kte,ierr,kbcon,xmb,psur,xland,qo_cup,                     &
-!           po_cup,qes_cup,pwavo,edto,pwevo,pre,outt,outq)      !,outbuoy)
-
       k=1
 !$acc kernels
       do i=its,itf
diff --git a/physics/cu_c3_driver.F90 b/physics/cu_c3_driver.F90
index cc2906ad5..8592e08f9 100644
--- a/physics/cu_c3_driver.F90
+++ b/physics/cu_c3_driver.F90
@@ -949,38 +949,6 @@ subroutine cu_c3_driver_run(ntracer,garea,im,km,dt,flag_init,flag_restart,&
               !gdc(i,k,8)=(outq(i,k))*86400.*xlv/cp
                gdc(i,k,8)=(outqm(i,k)+outqs(i,k)+outq(i,k))*86400.*xlv/cp
                gdc(i,k,9)=gdc(i,k,2)+gdc(i,k,3)+gdc(i,k,4)
-!
-!> - Calculate subsidence effect on clw
-!
-!              dsubclw=0.
-!              dsubclwm=0.
-!              dsubclws=0.
-!              dp=100.*(p2d(i,k)-p2d(i,k+1))
-!              if (clcw(i,k) .gt. -999.0 .and. clcw(i,k+1) .gt. -999.0 )then
-!                 clwtot = cliw(i,k) + clcw(i,k)
-!                 clwtot1= cliw(i,k+1) + clcw(i,k+1)
-!                 dsubclw=((-edt(i)*zd(i,k+1)+zu(i,k+1))*clwtot1   &
-!                      -(-edt(i)*zd(i,k)  +zu(i,k))  *clwtot  )*g/dp
-!                 dsubclwm=((-edtm(i)*zdm(i,k+1)+zum(i,k+1))*clwtot1   &
-!                      -(-edtm(i)*zdm(i,k)  +zum(i,k))  *clwtot  )*g/dp
-!                 dsubclws=(zus(i,k+1)*clwtot1-zus(i,k)*clwtot)*g/dp
-!                 dsubclw=dsubclw+(zu(i,k+1)*clwtot1-zu(i,k)*clwtot)*g/dp
-!                 dsubclwm=dsubclwm+(zum(i,k+1)*clwtot1-zum(i,k)*clwtot)*g/dp
-!                 dsubclws=dsubclws+(zus(i,k+1)*clwtot1-zus(i,k)*clwtot)*g/dp
-!              endif
-!              tem  = dt*(outqcs(i,k)*cutens(i)+outqc(i,k)*cuten(i)       &
-!                    +outqcm(i,k)*cutenm(i)                           &
-!                     +dsubclw*xmb(i)+dsubclws*xmbs(i)+dsubclwm*xmbm(i) &
-!                    )
-!              tem1 = max(0.0, min(1.0, (tcr-t(i,k))*tcrf))
-!              if (clcw(i,k) .gt. -999.0) then
-!               cliw(i,k) = max(0.,cliw(i,k) + tem * tem1)            ! ice
-!               clcw(i,k) = max(0.,clcw(i,k) + tem *(1.0-tem1))       ! water
-!              else
-!                cliw(i,k) = max(0.,cliw(i,k) + tem)
-!              endif
-!
-!            enddo
 
 !> - FCT treats subsidence effect to cloud ice/water (begin)
                dp=100.*(p2d(i,k)-p2d(i,k+1))
diff --git a/physics/cu_c3_driver_post.F90 b/physics/cu_c3_driver_post.F90
index 528f3d466..d5d2dee3b 100644
--- a/physics/cu_c3_driver_post.F90
+++ b/physics/cu_c3_driver_post.F90
@@ -69,7 +69,7 @@ subroutine cu_c3_driver_post_run (im, km, t, q, prevst, prevsq, cactiv, cactiv_m
         ze      = 0.0
         ze_conv = 0.0
         dbz_sum = 0.0
-        cuprate = max(0.1,1.e3*raincv(i) * 3600.0 / dt)          ! cu precip rate (mm/h)
+        cuprate = 1.e3*raincv(i) * 3600.0 / dt          ! cu precip rate (mm/h)
         if(cuprate .lt. 0.05) cuprate=0.
         ze_conv = 300.0 * cuprate**1.5
         if (maxupmf(i).gt.0.1 .and. cuprate.gt.0.) then
diff --git a/physics/cu_gf_driver.F90 b/physics/cu_gf_driver.F90
index f3f5042fc..d85b7ac52 100644
--- a/physics/cu_gf_driver.F90
+++ b/physics/cu_gf_driver.F90
@@ -927,38 +927,6 @@ subroutine cu_gf_driver_run(ntracer,garea,im,km,dt,flag_init,flag_restart,&
               !gdc(i,k,8)=(outq(i,k))*86400.*xlv/cp
                gdc(i,k,8)=(outqm(i,k)+outqs(i,k)+outq(i,k))*86400.*xlv/cp
                gdc(i,k,9)=gdc(i,k,2)+gdc(i,k,3)+gdc(i,k,4)
-!
-!> - Calculate subsidence effect on clw
-!
-!              dsubclw=0.
-!              dsubclwm=0.
-!              dsubclws=0.
-!              dp=100.*(p2d(i,k)-p2d(i,k+1))
-!              if (clcw(i,k) .gt. -999.0 .and. clcw(i,k+1) .gt. -999.0 )then
-!                 clwtot = cliw(i,k) + clcw(i,k)
-!                 clwtot1= cliw(i,k+1) + clcw(i,k+1)
-!                 dsubclw=((-edt(i)*zd(i,k+1)+zu(i,k+1))*clwtot1   &
-!                      -(-edt(i)*zd(i,k)  +zu(i,k))  *clwtot  )*g/dp
-!                 dsubclwm=((-edtm(i)*zdm(i,k+1)+zum(i,k+1))*clwtot1   &
-!                      -(-edtm(i)*zdm(i,k)  +zum(i,k))  *clwtot  )*g/dp
-!                 dsubclws=(zus(i,k+1)*clwtot1-zus(i,k)*clwtot)*g/dp
-!                 dsubclw=dsubclw+(zu(i,k+1)*clwtot1-zu(i,k)*clwtot)*g/dp
-!                 dsubclwm=dsubclwm+(zum(i,k+1)*clwtot1-zum(i,k)*clwtot)*g/dp
-!                 dsubclws=dsubclws+(zus(i,k+1)*clwtot1-zus(i,k)*clwtot)*g/dp
-!              endif
-!              tem  = dt*(outqcs(i,k)*cutens(i)+outqc(i,k)*cuten(i)       &
-!                    +outqcm(i,k)*cutenm(i)                           &
-!                     +dsubclw*xmb(i)+dsubclws*xmbs(i)+dsubclwm*xmbm(i) &
-!                    )
-!              tem1 = max(0.0, min(1.0, (tcr-t(i,k))*tcrf))
-!              if (clcw(i,k) .gt. -999.0) then
-!               cliw(i,k) = max(0.,cliw(i,k) + tem * tem1)            ! ice
-!               clcw(i,k) = max(0.,clcw(i,k) + tem *(1.0-tem1))       ! water
-!              else
-!                cliw(i,k) = max(0.,cliw(i,k) + tem)
-!              endif
-!
-!            enddo
 
 !> - FCT treats subsidence effect to cloud ice/water (begin)
                dp=100.*(p2d(i,k)-p2d(i,k+1))
diff --git a/physics/cu_gf_driver_post.F90 b/physics/cu_gf_driver_post.F90
index 59f43618c..5adf3ac42 100644
--- a/physics/cu_gf_driver_post.F90
+++ b/physics/cu_gf_driver_post.F90
@@ -69,7 +69,7 @@ subroutine cu_gf_driver_post_run (im, km, t, q, prevst, prevsq, cactiv, cactiv_m
         ze      = 0.0
         ze_conv = 0.0
         dbz_sum = 0.0
-        cuprate = max(0.1,1.e3*raincv(i) * 3600.0 / dt)          ! cu precip rate (mm/h)
+        cuprate = 1.e3*raincv(i) * 3600.0 / dt          ! cu precip rate (mm/h)
         if(cuprate .lt. 0.05) cuprate=0.
         ze_conv = 300.0 * cuprate**1.5
         if (maxupmf(i).gt.0.1 .and. cuprate.gt.0.) then

From a110a5b93bce92bab083fdaa07bd21ba5cae8720 Mon Sep 17 00:00:00 2001
From: dustinswales <dswales@ucar.edu>
Date: Wed, 27 Sep 2023 14:04:50 -0600
Subject: [PATCH 095/115] Getting real close...

---
 physics/GFS_phys_time_vary.fv3.F90  | 105 ++++--
 physics/GFS_phys_time_vary.fv3.meta |  83 ++++-
 physics/GFS_rrtmg_pre.F90           |  19 +-
 physics/GFS_rrtmg_pre.meta          |  39 +--
 physics/GFS_rrtmg_setup.F90         |  26 +-
 physics/GFS_rrtmg_setup.meta        |  30 +-
 physics/GFS_rrtmgp_pre.F90          |  22 +-
 physics/GFS_rrtmgp_pre.meta         |  35 +-
 physics/GFS_rrtmgp_setup.F90        |  20 +-
 physics/GFS_rrtmgp_setup.meta       |  30 +-
 physics/module_ozphys.F90           | 476 ++++++++++++++++++++++++++++
 physics/module_ozphys.meta          |  24 ++
 physics/ozphys_2015.F90             | 126 +++-----
 physics/ozphys_2015.meta            |  62 +---
 physics/ozphys_time_vary.F90        | 165 ----------
 physics/ozphys_time_vary.meta       | 200 ------------
 physics/radiation_gases.f           | 313 ++----------------
 physics/rrtmgp_lw_main.F90          |   1 -
 18 files changed, 815 insertions(+), 961 deletions(-)
 create mode 100644 physics/module_ozphys.F90
 create mode 100644 physics/module_ozphys.meta
 delete mode 100644 physics/ozphys_time_vary.F90
 delete mode 100644 physics/ozphys_time_vary.meta

diff --git a/physics/GFS_phys_time_vary.fv3.F90 b/physics/GFS_phys_time_vary.fv3.F90
index d82f22399..af2dd9b00 100644
--- a/physics/GFS_phys_time_vary.fv3.F90
+++ b/physics/GFS_phys_time_vary.fv3.F90
@@ -10,10 +10,12 @@ module GFS_phys_time_vary
       use omp_lib
 #endif
 
-      use machine, only : kind_phys
+      use machine, only : kind_phys, kind_dbl_prec, kind_sngl_prec
 
       use mersenne_twister, only: random_setseed, random_number
 
+      use module_ozphys, only: ty_ozphys
+
       use h2o_def,   only : levh2o, h2o_coeff, h2o_lat, h2o_pres, h2o_time, h2oplin
       use h2ointerp, only : read_h2odata, setindxh2o, h2ointerpol
 
@@ -64,9 +66,9 @@ module GFS_phys_time_vary
 !>\section gen_GFS_phys_time_vary_init GFS_phys_time_vary_init General Algorithm
 !> @{
       subroutine GFS_phys_time_vary_init (                                                         &
-              me, master, h2o_phys, iaerclm, iccn, iaermdl, iflip, im, levs,                 &
+              me, master, ntoz, h2o_phys, iaerclm, iccn, iaermdl, iflip, im, levs,                 &
               nx, ny, idate, xlat_d, xlon_d,                                                       &
-              jindx1_h, jindx2_h, ddy_h, h2opl,fhour,          &
+              jindx1_o3, jindx2_o3, ddy_o3, jindx1_h, jindx2_h, ddy_h, h2opl,fhour,                &
               jindx1_aer, jindx2_aer, ddy_aer, iindx1_aer, iindx2_aer, ddx_aer, aer_nm,            &
               jindx1_ci, jindx2_ci, ddy_ci, iindx1_ci, iindx2_ci, ddx_ci, imap, jmap,              &
               do_ugwp_v1, jindx1_tau, jindx2_tau, ddy_j1tau, ddy_j2tau,                            &
@@ -79,12 +81,12 @@ subroutine GFS_phys_time_vary_init (
               smcwtdxy, deeprechxy, rechxy, snowxy, snicexy, snliqxy, tsnoxy , smoiseq, zsnsoxy,   &
               slc, smc, stc, tsfcl, snowd, canopy, tg3, stype, con_t0c, lsm_cold_start, nthrds,    &
               lkm, use_lake_model, lakefrac, lakedepth, iopt_lake, iopt_lake_clm, iopt_lake_flake, &
-              lakefrac_threshold, lakedepth_threshold, errmsg, errflg)
+              lakefrac_threshold, lakedepth_threshold, ozphys, errmsg, errflg)
 
          implicit none
 
          ! Interface variables
-         integer,              intent(in)    :: me, master, iccn, iflip, im, nx, ny, levs, iaermdl
+         integer,              intent(in)    :: me, master, ntoz, iccn, iflip, im, nx, ny, levs, iaermdl
          logical,              intent(in)    :: h2o_phys, iaerclm, lsm_cold_start
          integer,              intent(in)    :: idate(:), iopt_lake, iopt_lake_clm, iopt_lake_flake
          real(kind_phys),      intent(in)    :: fhour, lakefrac_threshold, lakedepth_threshold
@@ -93,8 +95,8 @@ subroutine GFS_phys_time_vary_init (
          integer,              intent(in) :: lkm
          integer,              intent(inout)  :: use_lake_model(:)
          real(kind=kind_phys), intent(in   )  :: lakefrac(:), lakedepth(:)
-         integer,              intent(inout) :: jindx1_h(:), jindx2_h(:)
-         real(kind_phys),      intent(inout) :: ddy_h(:)
+         integer,              intent(inout) :: jindx1_o3(:), jindx2_o3(:), jindx1_h(:), jindx2_h(:)
+         real(kind_phys),      intent(inout) :: ddy_o3(:),  ddy_h(:)
          real(kind_phys),      intent(in)    :: h2opl(:,:,:)
 
          integer,              intent(inout) :: jindx1_aer(:), jindx2_aer(:), iindx1_aer(:), iindx2_aer(:)
@@ -113,6 +115,7 @@ subroutine GFS_phys_time_vary_init (
          real(kind_phys),      intent(in)    :: min_seaice, fice(:)
          real(kind_phys),      intent(in)    :: landfrac(:)
          real(kind_phys),      intent(inout) :: weasd(:)
+         type(ty_ozphys),      intent(in)    :: ozphys
 
          ! NoahMP - only allocated when NoahMP is used
          integer, intent(in) :: lsoil, lsnow_lsm_lbound, lsnow_lsm_ubound
@@ -200,21 +203,30 @@ subroutine GFS_phys_time_vary_init (
          jamax=-999
 
 !$OMP parallel num_threads(nthrds) default(none)                                    &
-!$OMP          shared (me,master,h2o_phys,im,nx,ny,levs,idate)                      &
+!$OMP          shared (me,master,ntoz,h2o_phys,im,nx,ny,levs,idate)                 &
 !$OMP          shared (xlat_d,xlon_d,imap,jmap,errmsg,errflg)                       &
 !$OMP          shared (levh2o,h2o_coeff,h2o_pres,h2opl)                             &
 !$OMP          shared (iamin, iamax, jamin, jamax)                                  &
 !$OMP          shared (iaerclm,iaermdl,ntrcaer,aer_nm,iflip,iccn)                   &
-!$OMP          shared (jindx1_h,jindx2_h,ddy_h)                                     &
+!$OMP          shared (jindx1_o3,jindx2_o3,ddy_o3,jindx1_h,jindx2_h,ddy_h)          &
 !$OMP          shared (jindx1_aer,jindx2_aer,ddy_aer,iindx1_aer,iindx2_aer,ddx_aer) &
 !$OMP          shared (jindx1_ci,jindx2_ci,ddy_ci,iindx1_ci,iindx2_ci,ddx_ci)       &
 !$OMP          shared (do_ugwp_v1,jindx1_tau,jindx2_tau,ddy_j1tau,ddy_j2tau)        &
 !$OMP          shared (isot,ivegsrc,nlunit,sncovr,sncovr_ice,lsm,lsm_ruc)           &
 !$OMP          shared (min_seaice,fice,landfrac,vtype,weasd,snupx,salp_data)        &
+!$OMP          shared (ozphys)                                                      &
 !$OMP          private (ix,i,j,rsnow,vegtyp)
 
 !$OMP sections
 
+!$OMP section
+!> - Setup spatial interpolation indices for ozone physics.
+         if (ntoz > 0) then
+            !$OMP CRITICAL
+            call ozphys%setup_forcing(xlat_d, jindx1_o3, jindx2_o3, ddy_o3)
+            !$OMP END CRITICAL
+         endif
+
 !$OMP section
 !> - Call read_h2odata() to read stratospheric water vapor data
          call read_h2odata (h2o_phys, me, master)
@@ -710,8 +722,8 @@ end subroutine GFS_phys_time_vary_init
 !> @{
       subroutine GFS_phys_time_vary_timestep_init (                                                 &
             me, master, cnx, cny, isc, jsc, nrcm, im, levs, kdt, idate, nsswr, fhswr, lsswr, fhour, &
-            imfdeepcnv, cal_pre, random_clds, nscyc, h2o_phys, iaerclm, iccn, clstp,          &
-            jindx1_h, jindx2_h, ddy_h, h2opl, iflip,            &
+            imfdeepcnv, cal_pre, random_clds, nscyc, ntoz, h2o_phys, iaerclm, iccn, clstp,          &
+            jindx1_o3, jindx2_o3, ddy_o3, ozpl, jindx1_h, jindx2_h, ddy_h, h2opl, iflip,            &
             jindx1_aer, jindx2_aer, ddy_aer, iindx1_aer, iindx2_aer, ddx_aer, aer_nm,               &
             jindx1_ci, jindx2_ci, ddy_ci, iindx1_ci, iindx2_ci, ddx_ci, in_nm, ccn_nm, fn_nml,      &
             imap, jmap, prsl, seed0, rann, nthrds, nx, ny, nsst, tile_num, nlunit, lsoil, lsoil_lsm,&
@@ -719,21 +731,21 @@ subroutine GFS_phys_time_vary_timestep_init (
             lakefrac, min_seaice, min_lakeice, smc, slc, stc, smois, sh2o, tslb, tiice, tg3, tref,  &
             tsfc, tsfco, tisfc, hice, fice, facsf, facwf, alvsf, alvwf, alnsf, alnwf, zorli, zorll, &
             zorlo, weasd, slope, snoalb, canopy, vfrac, vtype, stype,scolor, shdmin, shdmax, snowd, &
-            cv, cvb, cvt, oro, oro_uf, xlat_d, xlon_d, slmsk, landfrac,                             &
+            cv, cvb, cvt, oro, oro_uf, xlat_d, xlon_d, slmsk, landfrac, ozphys,               &
             do_ugwp_v1, jindx1_tau, jindx2_tau, ddy_j1tau, ddy_j2tau, tau_amf, errmsg, errflg)
 
          implicit none
 
          ! Interface variables
          integer,              intent(in)    :: me, master, cnx, cny, isc, jsc, nrcm, im, levs, kdt, &
-                                                nsswr, imfdeepcnv, iccn, nscyc, iflip
+                                                nsswr, imfdeepcnv, iccn, nscyc, ntoz, iflip
          integer,              intent(in)    :: idate(:)
          real(kind_phys),      intent(in)    :: fhswr, fhour
          logical,              intent(in)    :: lsswr, cal_pre, random_clds, h2o_phys, iaerclm
          real(kind_phys),      intent(out)   :: clstp
-         integer,              intent(in)    :: jindx1_h(:), jindx2_h(:)
-         real(kind_phys),      intent(in)    :: ddy_h(:)
-         real(kind_phys),      intent(inout) :: h2opl(:,:,:)
+         integer,              intent(in)    :: jindx1_o3(:), jindx2_o3(:), jindx1_h(:), jindx2_h(:)
+         real(kind_phys),      intent(in)    :: ddy_o3(:),  ddy_h(:)
+         real(kind_phys),      intent(inout) :: ozpl(:,:,:), h2opl(:,:,:)
          integer,              intent(in)    :: jindx1_aer(:), jindx2_aer(:), iindx1_aer(:), iindx2_aer(:)
          real(kind_phys),      intent(in)    :: ddy_aer(:), ddx_aer(:)
          real(kind_phys),      intent(inout) :: aer_nm(:,:,:)
@@ -749,6 +761,7 @@ subroutine GFS_phys_time_vary_timestep_init (
          integer,              intent(in)    :: jindx1_tau(:), jindx2_tau(:)
          real(kind_phys),      intent(in)    :: ddy_j1tau(:), ddy_j2tau(:)
          real(kind_phys),      intent(inout) :: tau_amf(:)
+         type(ty_ozphys),      intent(in)    :: ozphys
 
          ! For gcycle only
          integer,              intent(in)    :: nthrds, nx, ny, nsst, tile_num, nlunit, lsoil
@@ -771,10 +784,13 @@ subroutine GFS_phys_time_vary_timestep_init (
          integer,              intent(out)   :: errflg
 
          ! Local variables
-         integer :: i, j, k, iseed, iskip, ix
-         real(kind=kind_phys) :: wrk(1)
-         real(kind=kind_phys) :: rannie(cny)
-         real(kind=kind_phys) :: rndval(cnx*cny*nrcm)
+         integer :: i, j, k, iseed, iskip, ix, idat(8), jdat(8), iday, j1, j2, nc, n1, n2, jdow,     &
+              jdoy, jday, w3kindreal, w3kindint
+         real(kind_phys) :: wrk(1), tem, tx1, tx2, rjday
+         real(kind_phys) :: rannie(cny)
+         real(kind_phys) :: rndval(cnx*cny*nrcm)
+         real(kind_dbl_prec)  :: rinc(5)
+         real(kind_sngl_prec) :: rinc4(5)
 
          ! Initialize CCPP error handling variables
          errmsg = ''
@@ -790,15 +806,56 @@ subroutine GFS_phys_time_vary_timestep_init (
 !$OMP parallel num_threads(nthrds) default(none)                                         &
 !$OMP          shared(kdt,nsswr,lsswr,clstp,imfdeepcnv,cal_pre,random_clds)              &
 !$OMP          shared(fhswr,fhour,seed0,cnx,cny,nrcm,wrk,rannie,rndval)                  &
-!$OMP          shared(rann,im,isc,jsc,imap,jmap,me,idate)       &
-!$OMP          shared(h2o_phys,jindx1_h,jindx2_h,h2opl,ddy_h,iaerclm,master) &
+!$OMP          shared(rann,im,isc,jsc,imap,jmap,ntoz,me,idate,jindx1_o3,jindx2_o3)       &
+!$OMP          shared(ozpl,ddy_o3,h2o_phys,jindx1_h,jindx2_h,h2opl,ddy_h,iaerclm,master) &
 !$OMP          shared(levs,prsl,iccn,jindx1_ci,jindx2_ci,ddy_ci,iindx1_ci,iindx2_ci)     &
 !$OMP          shared(ddx_ci,in_nm,ccn_nm,do_ugwp_v1,jindx1_tau,jindx2_tau,ddy_j1tau)    &
-!$OMP          shared(ddy_j2tau,tau_amf,iflip)                                           &
-!$OMP          private(iseed,iskip,i,j,k)
+!$OMP          shared(ddy_j2tau,tau_amf,iflip,ozphys)                              &
+!$OMP          private(iseed,iskip,i,j,rjday,idat,rinc,w3kindreal,w3kindint,jdat)&
+!$OMP          private(jdow,jdoy,jday,rinc4,n1,n2)
 
 !$OMP sections
 
+!$OMP section
+!> - Compute temporal interpolation indices for updating gas concentrations.
+         idat=0
+         idat(1)=idate(4)
+         idat(2)=idate(2)
+         idat(3)=idate(3)
+         idat(5)=idate(1)
+         rinc=0.
+         rinc(2)=fhour
+         call w3kind(w3kindreal,w3kindint)
+         if(w3kindreal==4) then
+            rinc4=rinc
+            CALL w3movdat(rinc4,idat,jdat)
+         else
+            CALL w3movdat(rinc,idat,jdat)
+         endif
+         jdow = 0
+         jdoy = 0
+         jday = 0
+         call w3doxdat(jdat,jdow,jdoy,jday)
+         rjday = jdoy + jdat(5) / 24.
+         if (rjday < ozphys%time(1)) rjday = rjday + 365.
+
+         n2 = ozphys%ntime + 1
+         do j=2,ozphys%ntime
+            if (rjday < ozphys%time(j)) then
+               n2 = j
+               exit
+            endif
+         enddo
+         n1 = n2 - 1
+         if (n2 > ozphys%ntime) n2 = n2 - ozphys%ntime
+
+         !> - Update ozone concentration.
+         if (ntoz > 0) then
+            !$OMP CRITICAL
+            call ozphys%update_forcing(jindx1_o3, jindx2_o3, ddy_o3, rjday, n1, n2, ozpl)
+            !$OMP END CRITICAL
+         endif
+
 !$OMP section
 
          !--- switch for saving convective clouds - cnvc90.f
diff --git a/physics/GFS_phys_time_vary.fv3.meta b/physics/GFS_phys_time_vary.fv3.meta
index 6ef6e226c..bf5a3fa04 100644
--- a/physics/GFS_phys_time_vary.fv3.meta
+++ b/physics/GFS_phys_time_vary.fv3.meta
@@ -2,7 +2,7 @@
   name = GFS_phys_time_vary
   type = scheme
   dependencies = aerclm_def.F,aerinterp.F90,gcycle.F90,h2o_def.f,h2ointerp.f90,iccn_def.F,iccninterp.F90,machine.F,mersenne_twister.f
-  dependencies = namelist_soilveg.f,set_soilveg.f,sfcsub.F,cires_tauamf_data.F90,noahmp_tables.f90
+  dependencies = namelist_soilveg.f,set_soilveg.f,sfcsub.F,cires_tauamf_data.F90,noahmp_tables.f90,module_ozphys.F90
 
 ########################################################################
 [ccpp-arg-table]
@@ -72,6 +72,36 @@
   dimensions = ()
   type = integer
   intent = in
+  intent = in
+[ntoz]
+  standard_name = index_of_ozone_mixing_ratio_in_tracer_concentration_array
+  long_name = tracer index for ozone mixing ratio
+  units = index
+  dimensions = ()
+  type = integer
+  intent = in
+[jindx1_o3]
+  standard_name = lower_latitude_index_of_ozone_forcing_for_interpolation
+  long_name = interpolation low index for ozone
+  units = index
+  dimensions = (horizontal_dimension)
+  type = integer
+  intent = in
+[jindx2_o3]
+  standard_name = upper_latitude_index_of_ozone_forcing_for_interpolation
+  long_name = interpolation high index for ozone
+  units = index
+  dimensions = (horizontal_dimension)
+  type = integer
+  intent = in
+[ddy_o3]
+  standard_name = latitude_interpolation_weight_for_ozone_forcing
+  long_name = interpolation high index for ozone
+  units = none
+  dimensions = (horizontal_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
 [nx]
   standard_name = number_of_points_in_x_direction_for_this_MPI_rank
   long_name = number of points in x direction for this MPI rank
@@ -932,6 +962,13 @@
   type = real
   kind = kind_phys
   intent = in
+[ozphys]
+  standard_name = dataset_for_ozone_physics
+  long_name = dataset for NRL ozone physics
+  units = mixed
+  dimensions = ()
+  type = ty_ozphys
+  intent = in
 [errmsg]
   standard_name = ccpp_error_message
   long_name = error message for error handling in CCPP
@@ -1107,6 +1144,13 @@
   dimensions = ()
   type = integer
   intent = in
+[ntoz]
+  standard_name = index_of_ozone_mixing_ratio_in_tracer_concentration_array
+  long_name = tracer index for ozone mixing ratio
+  units = index
+  dimensions = ()
+  type = integer
+  intent = in
 [h2o_phys]
   standard_name = flag_for_stratospheric_water_vapor_physics
   long_name = flag for stratospheric water vapor physics
@@ -1136,6 +1180,36 @@
   type = real
   kind = kind_phys
   intent = out
+[jindx1_o3]
+  standard_name = lower_latitude_index_of_ozone_forcing_for_interpolation
+  long_name = interpolation low index for ozone
+  units = index
+  dimensions = (horizontal_dimension)
+  type = integer
+  intent = in
+[jindx2_o3]
+  standard_name = upper_latitude_index_of_ozone_forcing_for_interpolation
+  long_name = interpolation high index for ozone
+  units = index
+  dimensions = (horizontal_dimension)
+  type = integer
+  intent = in
+[ddy_o3]
+  standard_name = latitude_interpolation_weight_for_ozone_forcing
+  long_name = interpolation high index for ozone
+  units = none
+  dimensions = (horizontal_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[ozpl]
+  standard_name = ozone_forcing
+  long_name = ozone forcing data
+  units = mixed
+  dimensions = (horizontal_dimension,number_of_levels_in_ozone_data,number_of_coefficients_in_ozone_data)
+  type = real
+  kind = kind_phys
+  intent = inout
 [jindx1_h]
   standard_name = lower_latitude_index_of_stratospheric_water_vapor_forcing_for_interpolation
   long_name = interpolation low index for stratospheric water vapor
@@ -1868,6 +1942,13 @@
   type = real
   kind = kind_phys
   intent = inout
+[ozphys]
+  standard_name = dataset_for_ozone_physics
+  long_name = dataset for NRL ozone physics
+  units = mixed
+  dimensions = ()
+  type = ty_ozphys
+  intent = in
 [errmsg]
   standard_name = ccpp_error_message
   long_name = error message for error handling in CCPP
diff --git a/physics/GFS_rrtmg_pre.F90 b/physics/GFS_rrtmg_pre.F90
index f2183919f..69be4f8d0 100644
--- a/physics/GFS_rrtmg_pre.F90
+++ b/physics/GFS_rrtmg_pre.F90
@@ -45,8 +45,8 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp, lextop,&
         gasvmr_ccl4,  gasvmr_cfc113, aerodp,ext550, clouds6, clouds7, clouds8, &
         clouds9, cldsa, cldfra, cldfra2d, lwp_ex,iwp_ex, lwp_fc,iwp_fc,        &
         faersw1, faersw2, faersw3, faerlw1, faerlw2, faerlw3, alpha, rrfs_sd,  &
-        aero_dir_fdb, fdb_coef, spp_wts_rad, spp_rad, ico2, latsozc, levozc,   &
-        blatc, dphiozc, errmsg, errflg)
+        aero_dir_fdb, fdb_coef, spp_wts_rad, spp_rad, ico2, ozphys,      &
+        errmsg, errflg)
 
       use machine,                   only: kind_phys
 
@@ -54,7 +54,7 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp, lextop,&
       use funcphys,                  only: fpvs
 
       use module_radiation_astronomy,only: coszmn                      ! sol_init, sol_update
-      use module_radiation_gases,    only: NF_VGAS, getgases, getozn   ! gas_init, gas_update,
+      use module_radiation_gases,    only: NF_VGAS, getgases           ! gas_init, gas_update,
       use module_radiation_aerosols, only: NF_AESW, NF_AELW, setaer, & ! aer_init, aer_update,
      &                                     NSPC1
       use module_radiation_clouds,   only: NF_CLDS,                  & ! cld_init
@@ -81,6 +81,8 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp, lextop,&
                                            make_IceNumber,           &
                                            make_DropletNumber,       &
                                            make_RainNumber
+      ! For NRL Ozone
+      use module_ozphys, only: ty_ozphys
       implicit none
 
       integer,              intent(in)  :: im, levs, lm, lmk, lmp, ltp,        &
@@ -102,8 +104,7 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp, lextop,&
                                            imp_physics_mg, imp_physics_wsm6,   &
                                            imp_physics_nssl,                   &
                                            imp_physics_fer_hires,              &
-                                           yearlen, icloud, iaermdl, iaerflg,  &
-                                           latsozc, levozc
+                                           yearlen, icloud, iaermdl, iaerflg
 
       integer,              intent(in)  ::                                     &
          iovr,                             & ! choice of cloud-overlap method
@@ -134,7 +135,7 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp, lextop,&
       integer,              intent(in) :: spp_rad
       real(kind_phys),      intent(in) :: spp_wts_rad(:,:)
 
-      real(kind=kind_phys), intent(in) :: fhswr, fhlwr, solhr, sup, julian, sppt_amp, dcorr_con, blatc, dphiozc
+      real(kind=kind_phys), intent(in) :: fhswr, fhlwr, solhr, sup, julian, sppt_amp, dcorr_con
       real(kind=kind_phys), intent(in) :: con_eps, epsm1, fvirt, rog, rocp, con_rd, con_pi, con_g, con_ttp, con_thgni
 
       real(kind=kind_phys), dimension(:), intent(in) :: xlat_d, xlat, xlon,    &
@@ -252,6 +253,9 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp, lextop,&
       integer  :: iflag
       integer  :: islmsk
 
+      ! For NRL Ozone
+      type(ty_ozphys),intent(in) :: ozphys
+
       integer :: ids, ide, jds, jde, kds, kde, &
                  ims, ime, jms, jme, kms, kme, &
                  its, ite, jts, jte, kts, kte
@@ -422,7 +426,6 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp, lextop,&
 
 
 !> - Get layer ozone mass mixing ratio (if use ozone climatology data,
-!!    call getozn()).
 
       if (ntoz > 0) then            ! interactive ozone generation
         do k=1,lmk
@@ -431,7 +434,7 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp, lextop,&
           enddo
         enddo
       else                                ! climatological ozone
-        call getozn (prslk1, xlat, im, lmk, top_at_1, latsozc, levozc, blatc, dphiozc, olyr)
+         call ozphys%oz_clim(xlat, prslk1, con_pi, olyr)
       endif                               ! end_if_ntoz
 
 !> - Call coszmn(), to compute cosine of zenith angle (only when SW is called)
diff --git a/physics/GFS_rrtmg_pre.meta b/physics/GFS_rrtmg_pre.meta
index 038f59c27..a29b0ac3c 100644
--- a/physics/GFS_rrtmg_pre.meta
+++ b/physics/GFS_rrtmg_pre.meta
@@ -2,7 +2,7 @@
   name = GFS_rrtmg_pre
   type = scheme
   dependencies = funcphys.f90,iounitdef.f,machine.F,module_bfmicrophysics.f,module_mp_radar.F90,module_mp_thompson.F90
-  dependencies = module_mp_thompson_make_number_concentrations.F90,radcons.f90,radiation_aerosols.f
+  dependencies = module_mp_thompson_make_number_concentrations.F90,radcons.f90,radiation_aerosols.f,module_ozphys.F90
   dependencies = radiation_astronomy.f,radiation_clouds.f,radiation_gases.f,radlw_param.f,radsw_param.f,surface_perturbation.F90,radiation_cloud_overlap.F90
 
 ########################################################################
@@ -247,6 +247,13 @@
   dimensions = ()
   type = integer
   intent = in
+[ozphys]
+  standard_name = dataset_for_ozone_physics
+  long_name = dataset for NRL ozone physics
+  units = mixed
+  dimensions = ()
+  type = ty_ozphys
+  intent = in
 [iaermdl]
   standard_name = control_for_aerosol_radiation_scheme
   long_name = control of aerosol scheme in radiation
@@ -1503,36 +1510,6 @@
   dimensions = ()
   type = integer
   intent = in
-[latsozc]
-  standard_name = number_of_latitudes_in_ozone_climotology_data
-  long_name = number of latitude in ozone climotology data
-  units = count
-  dimensions = ()
-  type = integer
-  intent = in
-[levozc]
-  standard_name = number_of_levels_in_ozone_climotology_data
-  long_name = number of levels in ozone climotology data
-  units = count
-  dimensions = ()
-  type = integer
-  intent = in
-[dphiozc]
-  standard_name = ozone_data_parameter_1
-  long_name = ozone data parameter 1
-  units = none
-  dimensions = ()
-  type = real
-  kind = kind_phys
-  intent = in
-[blatc]
-  standard_name = ozone_data_parameter_2
-  long_name = ozone data parameter 2
-  units = none
-  dimensions = ()
-  type = real
-  kind = kind_phys
-  intent = in
 [errmsg]
   standard_name = ccpp_error_message
   long_name = error message for error handling in CCPP
diff --git a/physics/GFS_rrtmg_setup.F90 b/physics/GFS_rrtmg_setup.F90
index 30917b961..908a364dc 100644
--- a/physics/GFS_rrtmg_setup.F90
+++ b/physics/GFS_rrtmg_setup.F90
@@ -7,7 +7,7 @@
 module GFS_rrtmg_setup
 
    use machine, only:  kind_phys
-
+   use module_ozphys, only: ty_ozphys
    implicit none
 
    public GFS_rrtmg_setup_init, GFS_rrtmg_setup_timestep_init, GFS_rrtmg_setup_finalize
@@ -44,7 +44,7 @@ subroutine GFS_rrtmg_setup_init ( si, levr, ictm, isol, solar_file, ico2, &
         iaermdl, iaerflg, aeros_file, con_pi, con_t0c, con_c, con_boltz,     &
         con_plnk, con_solr_2008, con_solr_2002, con_g, con_rd, co2usr_file,  &
         co2cyc_file, rad_hr_units, inc_minor_gas, icliq_lw, isubcsw, isubclw,&
-        iswmode, latsozp, levozp, timeozp, ipsd0, ltp, lextop, errmsg, errflg)
+        iswmode, ipsd0, ltp, lextop, errmsg, errflg)
 ! =================   subprogram documentation block   ================ !
 !                                                                       !
 ! subprogram:   GFS_rrtmg_setup_init - a subprogram to initialize radiation !
@@ -155,8 +155,7 @@ subroutine GFS_rrtmg_setup_init ( si, levr, ictm, isol, solar_file, ico2, &
       integer, intent(in) :: levr, ictm, isol, ico2, iaer, ntcw, num_p3d, &
            ltp, npdf3d, ntoz, iovr, iovr_rand, iovr_maxrand, iovr_max,    &
            iovr_dcorr, iovr_exp, iovr_exprand, icliq_sw, imp_physics,     &
-           iflip, me, rad_hr_units, icliq_lw, isubcsw, isubclw, iswmode,  &
-           latsozp, levozp, timeozp
+           iflip, me, rad_hr_units, icliq_lw, isubcsw, isubclw, iswmode
       integer, intent(in) :: idate(:)
       logical, intent(in) :: lcrick, lcnorm, lnoprec, do_RRTMGP, lalw1bd, &
            inc_minor_gas, lextop
@@ -219,8 +218,7 @@ subroutine GFS_rrtmg_setup_init ( si, levr, ictm, isol, solar_file, ico2, &
            con_pi )
       call aer_init ( levr, me, iaermdl, iaerflg, lalw1bd, aeros_file,  &
            con_pi, con_t0c, con_c, con_boltz, con_plnk, errflg, errmsg)
-      call gas_init ( me, co2usr_file, co2cyc_file, ico2, ictm, ntoz,   &
-           con_pi, latsozp, levozp, timeozp, errflg, errmsg)
+      call gas_init ( me, co2usr_file, co2cyc_file, ico2, ictm, con_pi, errflg, errmsg )
       call cld_init ( si, levr, imp_physics, me, con_g, con_rd, errflg, errmsg)
       call rlwinit ( me, rad_hr_units, inc_minor_gas, icliq_lw, isubcsw, &
            iovr, iovr_rand, iovr_maxrand, iovr_max, iovr_dcorr,         &
@@ -246,7 +244,8 @@ end subroutine GFS_rrtmg_setup_init
 !!
    subroutine GFS_rrtmg_setup_timestep_init (idate, jdate, deltsw, deltim, &
         lsswr, me, iaermdl, iaerflg, isol, aeros_file, slag, sdec, cdec,   &
-        solcon, con_pi, co2dat_file, co2gbl_file, ictm, ico2, ntoz, errmsg, errflg)
+        solcon, con_pi, co2dat_file, co2gbl_file, ictm, ico2, ntoz, ozphys,&
+        errmsg, errflg)
 
       implicit none
 
@@ -259,6 +258,7 @@ subroutine GFS_rrtmg_setup_timestep_init (idate, jdate, deltsw, deltim, &
       logical,              intent(in)  :: lsswr
       integer,              intent(in)  :: me
       integer,              intent(in)  :: iaermdl, iaerflg, isol, ictm, ico2, ntoz
+      type(ty_ozphys),      intent(inout) :: ozphys
       character(len=26),    intent(in)  :: aeros_file, co2dat_file, co2gbl_file
       real(kind=kind_phys), intent(out) :: slag
       real(kind=kind_phys), intent(out) :: sdec
@@ -279,7 +279,7 @@ subroutine GFS_rrtmg_setup_timestep_init (idate, jdate, deltsw, deltim, &
       errflg = 0
 
       call radupdate(idate,jdate,deltsw,deltim,lsswr,me,iaermdl, iaerflg,isol,aeros_file,&
-           slag,sdec,cdec,solcon,con_pi,co2dat_file,co2gbl_file,ictm,ico2,ntoz,errflg,errmsg)
+           slag,sdec,cdec,solcon,con_pi,co2dat_file,co2gbl_file,ictm,ico2,ntoz,ozphys,errflg,errmsg)
 
    end subroutine GFS_rrtmg_setup_timestep_init
 
@@ -327,7 +327,7 @@ end subroutine GFS_rrtmg_setup_finalize
 !-----------------------------------
       subroutine radupdate( idate,jdate,deltsw,deltim,lsswr,me, iaermdl,&
            iaerflg, isol, aeros_file, slag,sdec,cdec,solcon, con_pi,    &
-           co2dat_file,co2gbl_file, ictm, ico2, ntoz, errflg, errmsg)
+           co2dat_file,co2gbl_file, ictm, ico2, ntoz, ozphys, errflg, errmsg)
 !...................................
 
 ! =================   subprogram documentation block   ================ !
@@ -371,6 +371,7 @@ subroutine radupdate( idate,jdate,deltsw,deltim,lsswr,me, iaermdl,&
 
 !  ---  inputs:
       integer, intent(in) :: idate(:), jdate(:), me, iaermdl, iaerflg, isol, ictm, ntoz, ico2
+      type(ty_ozphys),intent(inout) :: ozphys
       logical, intent(in) :: lsswr
       character(len=26),intent(in) :: aeros_file,co2dat_file,co2gbl_file
 
@@ -463,8 +464,11 @@ subroutine radupdate( idate,jdate,deltsw,deltim,lsswr,me, iaermdl,&
         lco2_chg = .false.
       endif
 
-      call gas_update ( kyear,kmon,kday,khour,loz1st,lco2_chg, me, co2dat_file, &
-           co2gbl_file, ictm, ico2, ntoz, errflg, errmsg )
+      call gas_update ( kyear,kmon,kday,khour,lco2_chg, me, co2dat_file, &
+           co2gbl_file, ictm, ico2, errflg, errmsg )
+      if (ntoz == 0) then
+         call ozphys%update_clim(kmon, kday, khour, loz1st)
+      endif
 
       if ( loz1st ) loz1st = .false.
 
diff --git a/physics/GFS_rrtmg_setup.meta b/physics/GFS_rrtmg_setup.meta
index f92d6f8db..35713757b 100644
--- a/physics/GFS_rrtmg_setup.meta
+++ b/physics/GFS_rrtmg_setup.meta
@@ -2,7 +2,7 @@
   name = GFS_rrtmg_setup
   type = scheme
   dependencies = iounitdef.f,module_bfmicrophysics.f,radcons.f90,radiation_aerosols.f,radiation_astronomy.f,radiation_clouds.f
-  dependencies = module_mp_thompson.F90,radiation_gases.f,radlw_main.F90,radlw_param.f,radsw_main.F90,radsw_param.f,machine.F
+  dependencies = module_mp_thompson.F90,radiation_gases.f,radlw_main.F90,radlw_param.f,radsw_main.F90,radsw_param.f,machine.F,module_ozphys.F90
 
 ########################################################################
 [ccpp-arg-table]
@@ -173,27 +173,6 @@
   dimensions = ()
   type = integer
   intent = in
-[levozp]
-  standard_name = number_of_levels_in_ozone_climotology_data
-  long_name = number of levels in ozone climotology data
-  units = count
-  dimensions = ()
-  type = integer
-  intent = in
-[timeozp]
-  standard_name = number_of_times_in_ozone_climotology_data
-  long_name = number of times in ozone climotology data
-  units = count
-  dimensions = ()
-  type = integer
-  intent = in
-[latsozp]
-  standard_name = number_of_latitudes_in_ozone_climotology_data
-  long_name = number of latitude in ozone climotology data
-  units = count
-  dimensions = ()
-  type = integer
-  intent = in
 [icliq_sw]
   standard_name = control_for_shortwave_radiation_liquid_clouds
   long_name = sw optical property for liquid clouds
@@ -530,6 +509,13 @@
   dimensions = ()
   type = integer
   intent = in
+[ozphys]
+  standard_name = dataset_for_ozone_physics
+  long_name = dataset for NRL ozone physics
+  units = mixed
+  dimensions = ()
+  type = ty_ozphys
+  intent = inout
 [con_pi]
   standard_name = pi
   long_name = ratio of a circle's circumference to its diameter
diff --git a/physics/GFS_rrtmgp_pre.F90 b/physics/GFS_rrtmgp_pre.F90
index dd72a6a1c..9dcc002a0 100644
--- a/physics/GFS_rrtmgp_pre.F90
+++ b/physics/GFS_rrtmgp_pre.F90
@@ -8,7 +8,8 @@ module GFS_rrtmgp_pre
   use machine,                    only: kind_phys
   use funcphys,                   only: fpvs
   use module_radiation_astronomy, only: coszmn 
-  use module_radiation_gases,     only: NF_VGAS, getgases, getozn
+  use module_radiation_gases,     only: NF_VGAS, getgases
+  use module_ozphys,              only: ty_ozphys
   use mo_gas_concentrations,      only: ty_gas_concs
   use radiation_tools,            only: check_error_msg,cmp_tlev
   use rrtmgp_lw_gas_optics,       only: lw_gas_props
@@ -117,25 +118,23 @@ subroutine GFS_rrtmgp_pre_run(me, nCol, nLev, i_o3, doSWrad, doLWrad, fhswr, fhl
        vmr_n2o, vmr_co2, tsfg, tsfa, qs_lay, q_lay, tv_lay,                                 &
        relhum, deltaZ, deltaZc, deltaP, active_gases_array,                                 &
        tsfc_radtime, coszen, coszdg, top_at_1, iSFC, iTOA, nDay, idxday, semis,             &
-       sfc_emiss_byband, ico2, latsozc, levozc, blatc, dphiozc, con_pi, errmsg, errflg)
+       sfc_emiss_byband, ico2, ozphys, con_pi, errmsg, errflg)
     
-    ! Inputs   
+    ! Inputs
     integer, intent(in)    :: &
          me,                & ! MPI rank
          nCol,              & ! Number of horizontal grid points
          nLev,              & ! Number of vertical layers
          ico2,              & ! Flag for co2 radiation scheme 
-         i_o3,              & ! Index into tracer array for ozone
-         latsozc,           & !
-         levozc
+         i_o3                 ! Index into tracer array for ozone
+    type(ty_ozphys),intent(in) :: &
+         ozphys
     logical, intent(in) :: &
     	 doSWrad,           & ! Call SW radiation?
     	 doLWrad              ! Call LW radiation
     real(kind_phys), intent(in) :: &
          fhswr,             & ! Frequency of SW radiation call.
-         fhlwr,             & ! Frequency of LW radiation call.
-         blatc,             & !
-         dphiozc
+         fhlwr                ! Frequency of LW radiation call.
     real(kind_phys), intent(in) :: &
          con_g,             & ! Physical constant: gravitational constant
          con_rd,            & ! Physical constant: gas-constant for dry air
@@ -353,9 +352,8 @@ subroutine GFS_rrtmgp_pre_run(me, nCol, nLev, i_o3, doSWrad, doLWrad, fhswr, fhl
           enddo
        enddo
     ! OR Use climatological ozone data
-    else                               
-       call getozn (prslk(1:NCOL,:), xlat, nCol, nLev, top_at_1, latsozc, levozc, blatc,    &
-            dphiozc, o3_lay)
+    else
+       call ozphys%oz_clim(xlat, prslk, con_pi, o3_lay)
     endif
 
     ! #######################################################################################
diff --git a/physics/GFS_rrtmgp_pre.meta b/physics/GFS_rrtmgp_pre.meta
index 1a96eee1b..4e2aa3a56 100644
--- a/physics/GFS_rrtmgp_pre.meta
+++ b/physics/GFS_rrtmgp_pre.meta
@@ -2,7 +2,7 @@
   name = GFS_rrtmgp_pre
   type = scheme
   dependencies = funcphys.f90,iounitdef.f,machine.F,module_bfmicrophysics.f,physcons.F90,radcons.f90,radiation_aerosols.f
-  dependencies = radiation_astronomy.f,radiation_gases.f,radiation_tools.F90,rrtmg_lw_cloud_optics.F90
+  dependencies = radiation_astronomy.f,radiation_gases.f,radiation_tools.F90,rrtmg_lw_cloud_optics.F90,module_ozphys.F90
 
 ########################################################################
 [ccpp-arg-table]
@@ -503,35 +503,12 @@
   dimensions = (horizontal_loop_extent)
   type = integer
   intent = inout
-[latsozc]
-  standard_name = number_of_latitudes_in_ozone_climotology_data
-  long_name = number of latitude in ozone climotology data
-  units = count
-  dimensions = ()
-  type = integer
-  intent = in
-[levozc]
-  standard_name = number_of_levels_in_ozone_climotology_data
-  long_name = number of levels in ozone climotology data
-  units = count
-  dimensions = ()
-  type = integer
-  intent = in
-[dphiozc]
-  standard_name = ozone_data_parameter_1
-  long_name = ozone data parameter 1
-  units = none
-  dimensions = ()
-  type = real
-  kind = kind_phys
-  intent = in
-[blatc]
-  standard_name = ozone_data_parameter_2
-  long_name = ozone data parameter 2
-  units = none
+[ozphys]
+  standard_name = dataset_for_ozone_physics
+  long_name = dataset for NRL ozone physics
+  units = mixed
   dimensions = ()
-  type = real
-  kind = kind_phys
+  type = ty_ozphys
   intent = in
 [errmsg]
   standard_name = ccpp_error_message
diff --git a/physics/GFS_rrtmgp_setup.F90 b/physics/GFS_rrtmgp_setup.F90
index 7b5479e60..3e4f57d13 100644
--- a/physics/GFS_rrtmgp_setup.F90
+++ b/physics/GFS_rrtmgp_setup.F90
@@ -6,6 +6,7 @@ module GFS_rrtmgp_setup
   use module_radiation_astronomy, only : sol_init, sol_update
   use module_radiation_aerosols,  only : aer_init, aer_update
   use module_radiation_gases,     only : gas_init, gas_update
+  use module_ozphys,              only : ty_ozphys
   implicit none
   
   public GFS_rrtmgp_setup_init, GFS_rrtmgp_setup_timestep_init, GFS_rrtmgp_setup_finalize
@@ -37,7 +38,7 @@ module GFS_rrtmgp_setup
   subroutine GFS_rrtmgp_setup_init(do_RRTMGP, imp_physics, imp_physics_fer_hires,        &
        imp_physics_gfdl, imp_physics_thompson, imp_physics_wsm6, imp_physics_zhao_carr,  &
        imp_physics_zhao_carr_pdf, imp_physics_mg,  si, levr, ictm, isol, ico2, iaer,     &
-       ntcw, ntoz, iovr, latsozp, levozp, timeozp, isubc_sw, isubc_lw, lalw1bd, idate,   &
+       ntcw, ntoz, iovr, isubc_sw, isubc_lw, lalw1bd, idate,               &
        me, aeros_file, iaermdl, iaerflg, con_pi, con_t0c, con_c, con_boltz, con_plnk,    &
        solar_file, con_solr_2008, con_solr_2002, co2usr_file, co2cyc_file, ipsd0,        &
        errmsg, errflg)
@@ -57,8 +58,7 @@ subroutine GFS_rrtmgp_setup_init(do_RRTMGP, imp_physics, imp_physics_fer_hires,
          con_pi, con_t0c, con_c, con_boltz, con_plnk, con_solr_2008, con_solr_2002
     real(kind_phys), dimension(:), intent(in) :: &
          si
-    integer, intent(in) :: levr, ictm, isol, ico2, iaer, & 
-         ntcw, ntoz, iovr, isubc_sw, isubc_lw, latsozp, levozp, timeozp, me
+    integer, intent(in) :: levr, ictm, isol, ico2, iaer, ntcw, ntoz, iovr, isubc_sw, isubc_lw, me
     logical, intent(in) :: &
          lalw1bd
     integer, intent(in), dimension(:) :: &
@@ -129,8 +129,7 @@ subroutine GFS_rrtmgp_setup_init(do_RRTMGP, imp_physics, imp_physics_fer_hires,
     call sol_init ( me, isol, solar_file, con_solr_2008, con_solr_2002, con_pi )
     call aer_init ( levr, me, iaermdl, iaerflg, lalw1bd, aeros_file, con_pi, con_t0c,    &
          con_c, con_boltz, con_plnk, errflg, errmsg)
-    call gas_init ( me, co2usr_file, co2cyc_file, ico2, ictm, ntoz, con_pi, latsozp,     &
-         levozp, timeozp, errflg, errmsg )
+    call gas_init ( me, co2usr_file, co2cyc_file, ico2, ictm, con_pi, errflg, errmsg )
 
     if ( me == 0 ) then
        print *,' return from rad_initialize (GFS_rrtmgp_setup_init) - after calling radinit'
@@ -149,7 +148,7 @@ end subroutine GFS_rrtmgp_setup_init
 !!
   subroutine GFS_rrtmgp_setup_timestep_init (idate, jdate, deltsw, deltim, doSWrad, me,     &
        iaermdl, aeros_file, isol, slag, sdec, cdec, solcon, con_pi, co2dat_file,            &
-       co2gbl_file, ictm, ico2, ntoz, errmsg, errflg)
+       co2gbl_file, ictm, ico2, ntoz, ozphys, errmsg, errflg)
      
     ! Inputs
     integer,         intent(in)  :: idate(:)
@@ -161,7 +160,7 @@ subroutine GFS_rrtmgp_setup_timestep_init (idate, jdate, deltsw, deltim, doSWrad
     integer,         intent(in)  :: me
     integer,         intent(in)  :: iaermdl,isol,ictm,ico2,ntoz
     character(len=26), intent(in) :: aeros_file,co2dat_file,co2gbl_file
-
+    type(ty_ozphys),intent(inout) :: ozphys
     ! Outputs
     real(kind_phys), intent(out) :: slag
     real(kind_phys), intent(out) :: sdec
@@ -241,8 +240,11 @@ subroutine GFS_rrtmgp_setup_timestep_init (idate, jdate, deltsw, deltim, doSWrad
     else
        lco2_chg = .false.
     endif
-    call gas_update (kyear, kmon, kday, khour, loz1st, lco2_chg, me, co2dat_file,           &
-         co2gbl_file, ictm, ico2, ntoz, errflg, errmsg )
+    call gas_update (kyear, kmon, kday, khour, lco2_chg, me, co2dat_file, co2gbl_file, ictm,&
+         ico2, errflg, errmsg )
+    if (ntoz == 0) then
+       call ozphys%update_clim(kmon, kday, khour, loz1st)
+    endif
     
     if ( loz1st ) loz1st = .false.
 
diff --git a/physics/GFS_rrtmgp_setup.meta b/physics/GFS_rrtmgp_setup.meta
index c8ed60650..96f7e24e7 100644
--- a/physics/GFS_rrtmgp_setup.meta
+++ b/physics/GFS_rrtmgp_setup.meta
@@ -2,7 +2,7 @@
   name = GFS_rrtmgp_setup
   type = scheme
   dependencies = iounitdef.f,machine.F,module_bfmicrophysics.f,radiation_aerosols.f,radiation_astronomy.f
-  dependencies = module_mp_thompson.F90,radiation_gases.f
+  dependencies = module_mp_thompson.F90,radiation_gases.f,module_ozphys.F90
 
 ########################################################################
 [ccpp-arg-table]
@@ -266,27 +266,6 @@
   dimensions =  ()
   type = integer
   intent = inout
-[levozp]
-  standard_name = number_of_levels_in_ozone_climotology_data
-  long_name = number of levels in ozone climotology data
-  units = count
-  dimensions = ()
-  type = integer
-  intent = in
-[timeozp]
-  standard_name = number_of_times_in_ozone_climotology_data
-  long_name = number of times in ozone climotology data
-  units = count
-  dimensions = ()
-  type = integer
-  intent = in
-[latsozp]
-  standard_name = number_of_latitudes_in_ozone_climotology_data
-  long_name = number of latitude in ozone climotology data
-  units = count
-  dimensions = ()
-  type = integer
-  intent = in
 [iaermdl]
   standard_name = control_for_aerosol_radiation_scheme
   long_name = control of aerosol scheme in radiation
@@ -410,6 +389,13 @@
   dimensions = ()
   type = integer
   intent = in
+[ozphys]
+  standard_name = dataset_for_ozone_physics
+  long_name = dataset for NRL ozone physics
+  units = mixed
+  dimensions = ()
+  type = ty_ozphys
+  intent = inout
 [iaermdl]
   standard_name = control_for_aerosol_radiation_scheme
   long_name = control of aerosol scheme in radiation
diff --git a/physics/module_ozphys.F90 b/physics/module_ozphys.F90
new file mode 100644
index 000000000..966d27113
--- /dev/null
+++ b/physics/module_ozphys.F90
@@ -0,0 +1,476 @@
+! #########################################################################################
+!> \section arg_table_module_ozphys Argument table                               
+!! \htmlinclude module_ozphys.html                                               
+!!
+! #########################################################################################
+module module_ozphys
+  use machine,  only : kind_phys
+  use funcphys, only : fpkapx
+  implicit none
+
+  public ty_ozphys
+
+! ######################################################################################### 
+!> \section arg_table_ty_ozphys Argument Table 
+!! \htmlinclude ty_ozphys.html
+!!
+!! All data field are ordered from surface-to-toa (j=1=isfc)
+!!
+! #########################################################################################
+  type ty_ozphys
+     ! Prognostic ozone.
+     integer                      :: nlat          !< Number of latitudes.
+     integer                      :: nlev          !< Number of vertical layers.
+     integer                      :: ntime         !< Number of times.
+     integer                      :: ncf           !< Number of coefficients.
+     real(kind_phys), allocatable :: lat(:)        !< Latitude.
+     real(kind_phys), allocatable :: pres(:)       !< Pressure levels.
+     real(kind_phys), allocatable :: po3(:)        !< Natural log pressure of levels.
+     real(kind_phys), allocatable :: time(:)       !< Time.
+     real(kind_phys), allocatable :: data(:,:,:,:) !< Ozone forcing data (raw)
+     ! Climotological ozone.
+     integer                      :: nlatc         !< Number of latitudes.
+     integer                      :: nlevc         !< Number of vertical layers.
+     integer                      :: ntimec        !< Number of times.
+     real(kind_phys)              :: blatc         !< Parameter for ozone climotology
+     real(kind_phys)              :: dphiozc       !< Parameter for ozone climotology
+     real(kind_phys), allocatable :: pkstr(:)      !<
+     real(kind_phys), allocatable :: pstr(:)       !<
+     real(kind_phys), allocatable :: datac(:,:,:)  !< Ozone climotological data
+     integer                      :: k1oz          !< Lower interpolation index in datac(dim=3), time dim
+     integer                      :: k2oz          !< Upper interpolation index in datac(dim=3), time dim 
+     real(kind_phys)              :: facoz         !< Parameter for ozone climotology
+     contains
+       procedure, public :: load_forcing
+       procedure, public :: load_clim
+       procedure, public :: setup_forcing
+       procedure, public :: update_forcing
+       procedure, public :: update_clim
+       procedure, public :: oz_prog_2015
+       procedure, public :: oz_prog_2006
+       procedure, public :: oz_clim
+  end type ty_ozphys
+  
+contains
+  ! #########################################################################################
+  ! Procedure (type-bound) for loading ozone forcing data.
+  ! #########################################################################################
+  function load_forcing(this, file, fileID) result (err_message)
+    class(ty_ozphys), intent(inout) :: this
+    integer,          intent(in)    :: fileID
+    character(len=*), intent(in)    :: file
+    character(len=128)              :: err_message
+    integer :: i1, i2, i3
+    real(kind=4), dimension(:), allocatable :: lat4, pres4, time4, tempin
+    real(kind=4) :: blatc4
+
+    ! Get dimensions from data file
+    open(unit=fileID,file=trim(file), form='unformatted', convert='big_endian')
+    read (fileID) this%ncf, this%nlat, this%nlev, this%ntime
+    rewind(fileID)
+    
+    allocate (this%lat(this%nlat))
+    allocate (this%pres(this%nlev))
+    allocate (this%po3(this%nlev))
+    allocate (this%time(this%ntime+1))
+    allocate (this%data(this%nlat,this%nlev,this%ncf,this%ntime))
+    
+    allocate(lat4(this%nlat), pres4(this%nlev), time4(this%ntime+1))
+    read (fileID) this%ncf, this%nlat, this%nlev, this%ntime, lat4, pres4, time4
+    
+    ! Store 
+    this%pres(:) = pres4(:)
+    this%po3(:)  = log(100.0*this%pres(:)) ! from mb to ln(Pa)
+    this%lat(:)  = lat4(:)
+    this%time(:) = time4(:)
+    deallocate(lat4, pres4, time4)
+    
+    allocate(tempin(this%nlat))
+    do i1=1,this%ntime
+       do i2=1,this%ncf
+          do i3=1,this%nlev
+             read(fileID) tempin
+             this%data(:,i3,i2,i1) = tempin(:)
+          enddo
+       enddo
+    enddo
+    deallocate(tempin)
+    close(fileID)
+
+  end function load_forcing
+
+  ! #########################################################################################
+  ! Procedure for setting up interpolation indices between data and model grid.
+  ! #########################################################################################
+  subroutine setup_forcing(this, lat, idx1, idx2, idxh)
+    class(ty_ozphys), intent(in)  :: this
+    real(kind_phys),  intent(in)  :: lat(:)
+    integer,          intent(out) :: idx1(:), idx2(:)
+    real(kind_phys),  intent(out) :: idxh(:)
+    integer :: i,j
+
+    do j=1,size(lat)
+       idx2(j) = this%nlat + 1
+       do i=1,this%nlat
+          if (lat(j) < this%lat(i)) then
+             idx2(j) = i
+             exit
+          endif
+       enddo
+       idx1(j) = max(idx2(j)-1,1)
+       idx2(j) = min(idx2(j),this%nlat)
+       if (idx2(j) .ne. idx1(j)) then
+          idxh(j) = (lat(j) - this%lat(idx1(j))) / (this%lat(idx2(j)) - this%lat(idx1(j)))
+       else
+          idxh(j) = 1.0
+       endif
+    enddo
+
+  end subroutine setup_forcing
+
+  ! #########################################################################################
+  ! Procedure (type-bound) for updating ozone data.
+  ! #########################################################################################
+  subroutine update_forcing(this, idx1, idx2, idxh, rjday, idxt1, idxt2, ozpl)
+    class(ty_ozphys), intent(in)  :: this
+    integer,          intent(in)  :: idx1(:), idx2(:)
+    real(kind_phys),  intent(in)  :: idxh(:)
+    real(kind_phys),  intent(in)  :: rjday
+    integer,          intent(in)  :: idxt1, idxt2
+    real(kind_phys),  intent(out) :: ozpl(:,:,:)
+    integer :: nc, l, j, j1, j2
+    real(kind_phys) :: tem, tx1, tx2
+
+    tx1 = (this%time(idxt2) - rjday) / (this%time(idxt2) - this%time(idxt1))
+    tx2 = 1.0 - tx1
+ 
+    do nc=1,this%ncf
+       do l=1,this%nlev
+          do j=1,size(ozpl(:,1,1))
+             j1  = idx1(j)
+             j2  = idx2(j)
+             tem = 1.0 - idxh(j)
+             ozpl(j,l,nc) = tx1*(tem*this%data(j1,l,nc,idxt1)+idxh(j)*this%data(j2,l,nc,idxt1)) &
+                  + tx2*(tem*this%data(j1,l,nc,idxt2)+idxh(j)*this%data(j2,l,nc,idxt2))
+          enddo
+       enddo
+    enddo
+
+  end subroutine update_forcing
+
+  ! #########################################################################################
+  ! Procedure (type-bound) for NRL prognostic ozone (2015).
+  ! #########################################################################################
+  subroutine oz_prog_2015(this, con_1ovg, dt, p, t, dp, ozpl, oz, do3_dt_prd, do3_dt_ozmx,  &
+       do3_dt_temp, do3_dt_ohoz)
+    class(ty_ozphys), intent(in) :: this
+    real(kind_phys),intent(in) :: &
+         con_1ovg       ! Physical constant: One divided by gravitational acceleration (m-1 s2)
+    real(kind_phys), intent(in) :: &
+         dt             ! Model timestep (sec)
+    real(kind_phys),  intent(in), dimension(:,:) :: &
+         p,           & ! Model Pressure (Pa)
+         t,           & ! Model temperature (K)
+         dp             ! Model layer thickness (Pa)
+    real(kind_phys), intent(in), dimension(:,:,:) :: &
+         ozpl           ! Ozone forcing data
+    real(kind_phys), intent(inout), dimension(:,:) :: &
+         oz             ! Ozone concentration updated by physics
+    real(kind_phys), intent(inout), dimension(:,:), pointer, optional :: &
+         do3_dt_prd,  & ! Physics tendency: production and loss effect
+         do3_dt_ozmx, & ! Physics tendency: ozone mixing ratio effect
+         do3_dt_temp, & ! Physics tendency: temperature effect
+         do3_dt_ohoz    ! Physics tendency: overhead ozone effect
+
+    integer :: k, kmax, kmin, iLev, iCol, nCol, nLev, iCf
+    logical, dimension(size(p,1)) :: flg
+    real(kind_phys) :: pmax, pmin, tem, temp
+    real(kind_phys), dimension(size(p,1)) :: wk1, wk2, wk3, ozib
+    real(kind_phys), dimension(size(p,1),this%ncf) :: prod
+    real(kind_phys), dimension(size(p,1),size(p,2)) :: ozi
+    real(kind_phys), dimension(size(p,1),size(p,2)+1) :: colo3, coloz
+
+    ! Dimensions
+    nCol = size(p,1)
+    nLev = size(p,2)
+
+    ! Temporaries
+    ozi = oz
+
+    colo3(:,nLev+1) = 0.0
+    coloz(:,nLev+1) = 0.0
+
+    do iLev=nLev,1,-1
+       pmin =  1.0e10
+       pmax = -1.0e10
+
+       do iCol=1,nCol
+          wk1(iCol)    = log(p(iCol,iLev))
+          pmin         = min(wk1(iCol), pmin)
+          pmax         = max(wk1(iCol), pmax)
+          prod(iCol,:) = 0._kind_phys
+       enddo
+       kmax = 1
+       kmin = 1
+       do k=1,this%nlev-1
+          if (pmin < this%po3(k)) kmax = k
+          if (pmax < this%po3(k)) kmin = k
+       enddo
+       !
+       do k=kmin,kmax
+          temp = 1.0 / (this%po3(k) - this%po3(k+1))
+          do iCol=1,nCol
+             flg(iCol) = .false.
+             if (wk1(iCol) < this%po3(k) .and. wk1(iCol) >= this%po3(k+1)) then
+                flg(iCol) = .true.
+                wk2(iCol) = (wk1(iCol) - this%po3(k+1)) * temp
+                wk3(iCol) = 1.0 - wk2(iCol)
+             endif
+          enddo
+          do iCf=1,this%ncf
+             do iCol=1,nCol
+                if (flg(iCol)) then
+                   prod(iCol,iCf)  = wk2(iCol) * ozpl(iCol,k,iCf) + wk3(iCol) * ozpl(iCol,k+1,iCf)
+                endif
+             enddo
+          enddo
+       enddo
+
+       do iCf=1,this%ncf
+          do iCol=1,nCol
+             if (wk1(iCol) < this%po3(this%nlev)) then
+                prod(iCol,iCf) = ozpl(iCol,this%nlev,iCf)
+             endif
+             if (wk1(iCol) >= this%po3(1)) then
+                prod(iCol,iCf) = ozpl(iCol,1,iCf)
+             endif
+          enddo
+       enddo
+       do iCol=1,nCol
+          colo3(iCol,iLev) = colo3(iCol,iLev+1) + ozi(iCol,iLev)  * dp(iCol,iLev)*con_1ovg
+          coloz(iCol,iLev) = coloz(iCol,iLev+1) + prod(iCol,6) * dp(iCol,iLev)*con_1ovg
+          prod(iCol,2)     = min(prod(iCol,2), 0.0)
+       enddo
+       do iCol=1,nCol
+          ozib(iCol) = ozi(iCol,iLev) ! no filling
+          tem        = prod(iCol,1) - prod(iCol,2) * prod(iCol,6) &
+                                    + prod(iCol,3) * (t(iCol,iLev) - prod(iCol,5)) &
+                                    + prod(iCol,4) * (colo3(iCol,iLev)-coloz(iCol,iLev))
+          oz(iCol,iLev) = (ozib(iCol)  + tem*dt) / (1.0 - prod(iCol,2)*dt)
+       enddo
+
+       ! Diagnostics (optional)
+       if (associated(do3_dt_prd))  do3_dt_prd(:,iLev)  = (prod(:,1)-prod(:,2)*prod(:,6))*dt
+       if (associated(do3_dt_ozmx)) do3_dt_ozmx(:,iLev) = (oz(:,iLev) - ozib(:))
+       if (associated(do3_dt_temp)) do3_dt_temp(:,iLev) = prod(:,3)*(t(:,iLev)-prod(:,5))*dt
+       if (associated(do3_dt_ohoz)) do3_dt_ohoz(:,iLev) = prod(:,4) * (colo3(:,iLev)-coloz(:,iLev))*dt
+    enddo
+
+    return
+  end subroutine oz_prog_2015
+
+  ! #########################################################################################
+  ! Procedure (type-bound) for NRL prognostic ozone (2006).
+  ! #########################################################################################
+  subroutine oz_prog_2006(this)
+    class(ty_ozphys), intent(in) :: this
+    return
+  end subroutine oz_prog_2006
+
+  ! #########################################################################################
+  ! Procedure (type-bound) for NRL updating climotological ozone.
+  ! Build this up from getozn.
+  ! #########################################################################################
+  subroutine oz_clim(this, lat, prslk, con_pi, oz)
+    class(ty_ozphys), intent(in) :: this
+    real(kind_phys),  intent(in) :: &
+         con_pi  ! Physics constant: Pi
+    real(kind_phys),  intent(in), dimension(:)   :: &
+         lat     ! Grid latitude
+    real(kind_phys),  intent(in), dimension(:,:) :: &
+         prslk   ! Exner function
+    real(kind_phys),  intent(out), dimension(:,:) :: &
+         oz      ! Ozone concentration updated by climotology
+
+    integer :: nCol, iCol, nLev, iLev, j, j1, j2, l, ll
+    real(kind_phys) :: elte, deglat, tem, tem1, tem2, tem3, tem4, temp
+    real(kind_phys), allocatable :: o3i(:,:),wk1(:)
+    logical :: top_at_1
+
+    nCol = size(prslk(:,1))
+    nLev = size(prslk(1,:))
+    allocate(o3i(nCol, this%nlevc),wk1(nCol))
+
+    ! What is vertical ordering?
+    top_at_1 = (prslk(1,1) .lt.  prslk(1, nLev))
+
+    elte = this%blatc + (this%nlatc-1)*this%dphiozc
+
+    do iCol = 1, nCol
+       deglat = lat(iCol) * 180.0 / con_pi
+       if (deglat > this%blatc .and. deglat < elte) then
+          tem1 = (deglat - this%blatc) / this%dphiozc + 1
+          j1   = tem1
+          j2   = j1 + 1
+          tem1 = tem1 - j1
+       elseif (deglat <= this%blatc) then
+          j1   = 1
+          j2   = 1
+          tem1 = 1.0
+       elseif (deglat >= elte) then
+          j1   = this%nlatc
+          j2   = this%nlatc
+          tem1 = 1.0
+       endif
+       
+       tem2 = 1.0 - tem1
+       do j = 1, this%nlevc
+          tem3        = tem2*this%datac(j1,j,this%k1oz) + tem1*this%datac(j2,j,this%k1oz)
+          tem4        = tem2*this%datac(j1,j,this%k2oz) + tem1*this%datac(j2,j,this%k2oz)
+          o3i(iCol,j) = tem4*this%facoz               + tem3*(1.0 - this%facoz)
+       enddo
+    enddo
+
+    do iLev = 1, nLev
+       ll = iLev
+       if (.not. top_at_1) ll = nLev - iLev + 1
+
+       do iCol = 1, nCol
+          wk1(iCol) = prslk(iCol,ll)
+       enddo
+
+       do j = 1, this%nlevc-1
+          temp = 1.0 / (this%pkstr(j+1) - this%pkstr(j))
+          do iCol = 1, nCol
+             if (wk1(iCol) > this%pkstr(j) .and. wk1(iCol) <= this%pkstr(j+1)) then
+                tem       = (this%pkstr(j+1) - wk1(iCol)) * temp
+                oz(iCol,ll) = tem * o3i(iCol,j) + (1.0 - tem) * o3i(iCol,j+1)
+             endif
+          enddo
+       enddo
+       
+       do iCol = 1, nCol
+          if (wk1(iCol) > this%pkstr(this%nlevc)) oz(iCol,ll) = o3i(iCol,this%nlevc)
+          if (wk1(iCol) < this%pkstr(1))          oz(iCol,ll) = o3i(iCol,1)
+       enddo
+    enddo
+
+    return
+  end subroutine oz_clim
+
+  ! #########################################################################################
+  ! Procedure (type-bound) for loading ozone climo data.
+  ! #########################################################################################
+  function load_clim(this, file, fileID) result (err_message)
+    class(ty_ozphys), intent(inout) :: this
+    integer,          intent(in)    :: fileID
+    character(len=*), intent(in)    :: file
+    character(len=128)              :: err_message
+
+    ! Locals
+    real(kind=4) :: blatc4
+    integer :: iLev, iLat, imo
+    real(kind=4), allocatable :: o3clim4(:,:,:), pstr4(:)
+    integer, allocatable      :: imond(:), ilatt(:,:)
+
+    open(unit=fileID,file=trim(file), form='unformatted', convert='big_endian')
+    read (fileID,end=101) this%nlatc, this%nlevc, this%ntimec, blatc4
+101 if (this%nlevc  < 10 .or. this%nlevc > 100) then
+       rewind (fileID)
+       this%nlevc = 17
+       this%nlatc = 18
+       this%blatc = -85.0
+    else
+       this%blatc = blatc4
+    endif
+    this%nlat    = 2
+    this%nlev    = 1
+    this%ntimec  = 1
+    this%ncf     = 0
+    this%dphiozc = -(this%blatc+this%blatc)/(this%nlatc-1)
+
+    allocate (o3clim4(this%nlatc,this%nlevc,12), pstr4(this%nlevc), imond(12), ilatt(this%nlatc,12) )
+
+    allocate (this%pkstr(this%nlevc), this%pstr(this%nlevc), this%datac(this%nlatc,this%nlevc,12))
+    if ( this%nlevc == 17 ) then ! For the operational ozone climatology
+       do iLev = 1, this%nlevc
+          read (fileID,15) pstr4(iLev)
+15        format(f10.3)
+       enddo
+
+       do imo = 1, 12
+          do iLat = 1, this%nlatc
+             read (fileID,16) imond(imo), ilatt(iLat,imo), (o3clim4(iLat,iLev,imo),iLev=1,10)
+16           format(i2,i4,10f6.2)
+             read (fileID,20) (o3clim4(iLat,iLev,imo),iLev=11,this%nlevc)
+20           format(6x,10f6.2)
+          enddo
+       enddo
+    else ! For newer ozone climatology
+       read (fileID)
+       do iLev = 1, this%nlevc
+          read (fileID) pstr4(iLev)
+       enddo
+       
+       do imo = 1, 12
+          do iLev = 1, this%nlevc
+              read (fileID) (o3clim4(iLat,iLev,imo),iLat=1,this%nlatc)
+           enddo
+        enddo
+     endif   ! end if_this%nlevc_block
+
+     do imo = 1, 12
+        do iLev = 1, this%nlevc
+           do iLat = 1, this%nlatc
+              this%datac(iLat,iLev,imo) = o3clim4(iLat,iLev,imo) * 1.655e-6
+           enddo
+        enddo
+     enddo
+     
+     do iLev = 1, this%nlevc
+        this%pstr(iLev)  = pstr4(iLev)
+        this%pkstr(iLev) = fpkapx(this%pstr(iLev)*100.0)
+     enddo
+
+  end function load_clim
+
+  ! #########################################################################################
+  ! Procedure (type-bound) for updating ozone climotological data.
+  ! #########################################################################################
+  subroutine update_clim(this, imon, iday, ihour, loz1st)
+    class(ty_ozphys), intent(inout) :: this
+    integer, intent(in) :: imon, iday, ihour
+    logical, intent(in) :: loz1st
+
+    integer ::  midmon=15, midm=15, midp=45, id
+    integer, parameter, dimension(13) :: mdays = (/31,28,31,30,31,30,31,31,30,31,30,31,30/)
+    logical :: change
+
+    midmon = mdays(imon)/2 + 1
+    change = loz1st .or. ( (iday==midmon) .and. (ihour==0) )
+    
+    if ( change ) then
+       if ( iday < midmon ) then
+          this%k1oz = mod(imon+10, 12) + 1
+          midm = mdays(this%k1oz)/2 + 1
+          this%k2oz = imon
+          midp = mdays(this%k1oz) + midmon
+       else
+          this%k1oz = imon
+          midm = midmon
+          this%k2oz = mod(imon, 12) + 1
+          midp = mdays(this%k2oz)/2 + 1 + mdays(this%k1oz)
+       endif
+    endif
+    
+    if (iday < midmon) then
+       id = iday + mdays(this%k1oz)
+    else
+       id = iday
+    endif
+    
+    this%facoz = float(id - midm) / float(midp - midm)
+
+  end subroutine update_clim
+
+end module module_ozphys
diff --git a/physics/module_ozphys.meta b/physics/module_ozphys.meta
new file mode 100644
index 000000000..2922d16d7
--- /dev/null
+++ b/physics/module_ozphys.meta
@@ -0,0 +1,24 @@
+[ccpp-table-properties]
+  name = ty_ozphys
+  type = ddt
+  dependencies =
+
+[ccpp-arg-table]
+  name = ty_ozphys
+  type = ddt
+
+########################################################################
+[ccpp-table-properties]
+  name = module_ozphys
+  type = module
+  dependencies = machine.F,funcphys.f90
+
+[ccpp-arg-table]
+  name = module_ozphys
+  type = module
+[ty_ozphys]
+  standard_name = ty_ozphys
+  long_name = definition of type ty_ozphys
+  units = DDT
+  dimensions = ()
+  type = ty_ozphys
\ No newline at end of file
diff --git a/physics/ozphys_2015.F90 b/physics/ozphys_2015.F90
index 47386bd6e..1478d0d6e 100644
--- a/physics/ozphys_2015.F90
+++ b/physics/ozphys_2015.F90
@@ -3,89 +3,57 @@
 !!
 ! ###########################################################################################
 module ozphys_2015
-  use machine, only : kind_phys, kind_dbl_prec, kind_sngl_prec
+  use machine,       only: kind_phys, kind_dbl_prec, kind_sngl_prec
+  use module_ozphys, only: ty_ozphys
   implicit none
-  public ozphys_2015_init, ozphys_2015_run
+  public ozphys_2015_run
 contains
 
 ! ###########################################################################################
 !>\defgroup GFS_ozphys_2015 GFS Ozone Photochemistry (2015) Module
 !! This module contains the CCPP-compliant Ozone 2015 photochemistry scheme.
 !> @{
-!> The operational GFS currently parameterizes ozone production and
-!! destruction based on monthly mean coefficients (
-!! \c ozprdlos_2015_new_sbuvO3_tclm15_nuchem.f77) provided by Naval
-!! Research Laboratory through CHEM2D chemistry model
+!> The operational GFS currently parameterizes ozone production and destruction based on 
+!! monthly mean coefficients ( \c ozprdlos_2015_new_sbuvO3_tclm15_nuchem.f77) provided by 
+!! Naval Research Laboratory through CHEM2D chemistry model
 !! (McCormack et al. (2006) \cite mccormack_et_al_2006).
 !! (https://doi.org/10.5194/acp-6-4943-2006)
 !!
 !> \section genal_ozphys_2015 GFS ozphys_2015_run General Algorithm
-!> -  This code assumes that both prsl and po3 are from bottom to top
-!!     as are all other variables.
-!> -  This code is specifically for NRL parameterization and
-!!     climatological T and O3 are in location 5 and 6 of oz_data array
+!> -  This code assumes that both 2D fields are ordered from bottom to top.
+!> -  This code is specifically for NRL parameterization and climatological T and O3 are in 
+!     location 5 and 6 of ozpl array
 !!\author   June 2015 - Shrinivas Moorthi
 !!\modified May  2023 - Dustin Swales
 ! ###########################################################################################
 
-! ###########################################################################################
-! SUBROUTINE ozphys_2015_init
-! ###########################################################################################
-!! \section arg_table_ozphys_2015_init Argument Table
-!! \htmlinclude ozphys_2015_init.html
-!!
-  subroutine ozphys_2015_init(oz_phys, errmsg, errflg)
-    ! Inputs
-    logical, intent(in) :: &
-         oz_phys
-    ! Outputs
-    character(len=*), intent(out) :: &
-         errmsg
-    integer, intent(out) :: &
-         errflg
-
-    ! Initialize CCPP error handling variables
-    errmsg = ''
-    errflg = 0
-
-    ! Sanity check
-    if (.not.oz_phys) then
-       write (errmsg,'(*(a))') 'Logic error: oz_phys_2015 == .false.'
-       errflg = 1
-       return
-    endif
-
-  end subroutine ozphys_2015_init
-
 ! ###########################################################################################
 ! SUBROUTINE ozphys_2015_run
 ! ###########################################################################################
 !! \section arg_table_ozphys_2015_run Argument Table
 !! \htmlinclude ozphys_2015_run.html
 !!
-  subroutine ozphys_2015_run (oz_phys, im, levs, ko3, dt, oz, tin, po3, prsl, oz_data,      &
-       pl_coeff, delp, con_1ovg, do3_dt_prd, do3_dt_ozmx, do3_dt_temp, do3_dt_ohoz, errmsg, errflg)
+  subroutine ozphys_2015_run (oz_phys, ozphys, nCol, nLev, dt, oz, tin, prsl, ozpl,     &
+       delp, con_1ovg, do3_dt_prd, do3_dt_ozmx, do3_dt_temp, do3_dt_ohoz, errmsg, errflg)
 
     ! Inputs
     logical, intent(in) :: &
          oz_phys        ! Flag for ozone_physics_2015 scheme.
+    type(ty_ozphys),intent(in) :: &
+         ozphys
     real(kind_phys),intent(in) :: &
          con_1ovg       ! Physical constant: One divided by gravitational acceleration (m-1 s2)
     integer, intent(in) :: &
-         im,          & ! Horizontal dimension
-         levs,        & ! Number of vertical layers
-         ko3,         & ! Number of vertical layers in ozone forcing data
-         pl_coeff       ! Number of coefficients in ozone forcing data
+         nCol,        & ! Horizontal dimension
+         nLev           ! Number of vertical layers
     real(kind_phys), intent(in) :: &
          dt             ! Physics timestep (seconds)
-    real(kind_phys), intent(in), dimension(:) :: &
-         po3            ! Natural log of ozone forcing data pressure levels
     real(kind_phys), intent(in), dimension(:,:) :: &
          prsl,        & ! Air-pressure (Pa)
          tin,         & ! Temperature of new-state (K)
          delp           ! Difference between mid-layer pressures (Pa)
     real(kind_phys), intent(in), dimension(:,:,:) :: &
-         oz_data        ! Ozone forcing data
+         ozpl           ! Ozone forcing data
 
     ! Outputs (optional)
     real(kind=kind_phys), intent(inout), dimension(:,:), pointer, optional :: &
@@ -96,26 +64,26 @@ subroutine ozphys_2015_run (oz_phys, im, levs, ko3, dt, oz, tin, po3, prsl, oz_d
 
     ! Outputs
     real(kind=kind_phys), intent(inout), dimension(:,:) :: &
-         oz                              ! Ozone concentration updated by physics
+         oz             ! Ozone concentration updated by physics
     character(len=*), intent(out) :: &
-         errmsg                          ! CCPP error message
+         errmsg         ! CCPP error message
     integer, intent(out) :: &
-         errflg                          ! CCPP error flag
+         errflg         ! CCPP error flag
 
     ! Locals
     integer :: k, kmax, kmin, l, i, j
-    logical, dimension(im) :: flg
+    logical, dimension(nCol) :: flg
     real(kind_phys) :: pmax, pmin, tem, temp
-    real(kind_phys), dimension(im) :: wk1, wk2, wk3, ozib
-    real(kind_phys), dimension(im,pl_coeff) :: prod
-    real(kind_phys), dimension(im,levs) :: ozi
-    real(kind_phys), dimension(im,levs+1) :: colo3, coloz
+    real(kind_phys), dimension(nCol) :: wk1, wk2, wk3, ozib
+    real(kind_phys), dimension(nCol,ozphys%ncf) :: prod
+    real(kind_phys), dimension(nCol,nLev) :: ozi
+    real(kind_phys), dimension(nCol,nLev+1) :: colo3, coloz
 
     ! Initialize CCPP error handling variables
     errmsg = ''
     errflg = 0
 
-    ! Sanity checkt
+    ! Sanity checks
     if (.not.oz_phys) then
        write (errmsg,'(*(a))') 'Logic error: oz_phys_2015 == .false.'
        errflg = 1
@@ -125,14 +93,14 @@ subroutine ozphys_2015_run (oz_phys, im, levs, ko3, dt, oz, tin, po3, prsl, oz_d
     ! Temporaries
     ozi = oz
 
-    colo3(:,levs+1) = 0.0
-    coloz(:,levs+1) = 0.0
+    colo3(:,nLev+1) = 0.0
+    coloz(:,nLev+1) = 0.0
 
-    do l=levs,1,-1
+    do l=nLev,1,-1
        pmin =  1.0e10
        pmax = -1.0e10
 
-       do i=1,im
+       do i=1,nCol
           wk1(i) = log(prsl(i,l))
           pmin   = min(wk1(i), pmin)
           pmax   = max(wk1(i), pmax)
@@ -140,46 +108,46 @@ subroutine ozphys_2015_run (oz_phys, im, levs, ko3, dt, oz, tin, po3, prsl, oz_d
        enddo
        kmax = 1
        kmin = 1
-       do k=1,ko3-1
-          if (pmin < po3(k)) kmax = k
-          if (pmax < po3(k)) kmin = k
+       do k=1,ozphys%nlev-1
+          if (pmin < ozphys%po3(k)) kmax = k
+          if (pmax < ozphys%po3(k)) kmin = k
        enddo
        !
        do k=kmin,kmax
-          temp = 1.0 / (po3(k) - po3(k+1))
-          do i=1,im
+          temp = 1.0 / (ozphys%po3(k) - ozphys%po3(k+1))
+          do i=1,nCol
              flg(i) = .false.
-             if (wk1(i) < po3(k) .and. wk1(i) >= po3(k+1)) then
+             if (wk1(i) < ozphys%po3(k) .and. wk1(i) >= ozphys%po3(k+1)) then
                 flg(i) = .true.
-                wk2(i) = (wk1(i) - po3(k+1)) * temp
+                wk2(i) = (wk1(i) - ozphys%po3(k+1)) * temp
                 wk3(i) = 1.0 - wk2(i)
              endif
           enddo
-          do j=1,pl_coeff
-             do i=1,im
+          do j=1,ozphys%ncf
+             do i=1,nCol
                 if (flg(i)) then
-                   prod(i,j)  = wk2(i) * oz_data(i,k,j) + wk3(i) * oz_data(i,k+1,j)
+                   prod(i,j)  = wk2(i) * ozpl(i,k,j) + wk3(i) * ozpl(i,k+1,j)
                 endif
              enddo
           enddo
        enddo
 
-       do j=1,pl_coeff
-          do i=1,im
-             if (wk1(i) < po3(ko3)) then
-                prod(i,j) = oz_data(i,ko3,j)
+       do j=1,ozphys%ncf
+          do i=1,nCol
+             if (wk1(i) < ozphys%po3(ozphys%nlev)) then
+                prod(i,j) = ozpl(i,ozphys%nlev,j)
              endif
-             if (wk1(i) >= po3(1)) then
-                prod(i,j) = oz_data(i,1,j)
+             if (wk1(i) >= ozphys%po3(1)) then
+                prod(i,j) = ozpl(i,1,j)
              endif
           enddo
        enddo
-       do i=1,im
+       do i=1,nCol
           colo3(i,l) = colo3(i,l+1) + ozi(i,l)  * delp(i,l)*con_1ovg
           coloz(i,l) = coloz(i,l+1) + prod(i,6) * delp(i,l)*con_1ovg
           prod(i,2)  = min(prod(i,2), 0.0)
        enddo
-       do i=1,im
+       do i=1,nCol
           ozib(i)  = ozi(i,l)            ! no filling
           tem      = prod(i,1) - prod(i,2) * prod(i,6) + prod(i,3) * (tin(i,l) - prod(i,5)) &
                                                        + prod(i,4) * (colo3(i,l)-coloz(i,l))
diff --git a/physics/ozphys_2015.meta b/physics/ozphys_2015.meta
index 1d8fba74e..ca2d56e4e 100644
--- a/physics/ozphys_2015.meta
+++ b/physics/ozphys_2015.meta
@@ -1,11 +1,11 @@
 [ccpp-table-properties]
   name = ozphys_2015
   type = scheme
-  dependencies = machine.F
+  dependencies = machine.F,module_ozphys.F90
 
 ########################################################################
 [ccpp-arg-table]
-  name = ozphys_2015_init
+  name = ozphys_2015_run
   type = scheme
 [oz_phys]
   standard_name = flag_for_nrl_2015_ozone_scheme
@@ -14,54 +14,27 @@
   dimensions = ()
   type = logical
   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
-
-########################################################################
-[ccpp-arg-table]
-  name = ozphys_2015_run
-  type = scheme
-[oz_phys]
-  standard_name = flag_for_nrl_2015_ozone_scheme
-  long_name = flag for new (2015) ozone physics
-  units = flag
+[ozphys]
+  standard_name = dataset_for_ozone_physics
+  long_name = dataset for NRL ozone physics
+  units = mixed
   dimensions = ()
-  type = logical
+  type = ty_ozphys
   intent = in
-[im]
+[nCol]
   standard_name = horizontal_loop_extent
   long_name = horizontal loop extent
   units = count
   dimensions = ()
   type = integer
   intent = in
-[levs]
+[nLev]
   standard_name = vertical_layer_dimension
   long_name = number of vertical layers
   units = count
   dimensions = ()
   type = integer
   intent = in
-[ko3]
-  standard_name = number_of_levels_in_ozone_data
-  long_name = number of vertical layers in ozone forcing data
-  units = count
-  dimensions = ()
-  type = integer
-  intent = in
 [dt]
   standard_name = timestep_for_physics
   long_name = physics time step
@@ -86,14 +59,6 @@
   type = real
   kind = kind_phys
   intent = in
-[po3]
-  standard_name = natural_log_of_ozone_data_pressure_levels
-  long_name = natural log of ozone forcing data pressure levels
-  units = 1
-  dimensions = (number_of_levels_in_ozone_data)
-  type = real
-  kind = kind_phys
-  intent = in
 [prsl]
   standard_name = air_pressure
   long_name = mid-layer pressure
@@ -102,7 +67,7 @@
   type = real
   kind = kind_phys
   intent = in
-[oz_data]
+[ozpl]
   standard_name = ozone_forcing
   long_name = ozone forcing data
   units = mixed
@@ -110,13 +75,6 @@
   type = real
   kind = kind_phys
   intent = in
-[pl_coeff]
-  standard_name = number_of_coefficients_in_ozone_data
-  long_name = number of coefficients in ozone forcing data
-  units = count
-  dimensions = ()
-  type = integer
-  intent = in
 [delp]
   standard_name = air_pressure_difference_between_midlayers
   long_name = difference between mid-layer pressures
diff --git a/physics/ozphys_time_vary.F90 b/physics/ozphys_time_vary.F90
deleted file mode 100644
index ddac1dcd4..000000000
--- a/physics/ozphys_time_vary.F90
+++ /dev/null
@@ -1,165 +0,0 @@
-! ###########################################################################################
-!> \file ozphys_time_vary.F90
-!!
-! ###########################################################################################
-module ozphys_time_vary
-  use machine, only : kind_phys, kind_dbl_prec, kind_sngl_prec
-  implicit none
-  public ozphys_time_vary_init, ozphys_time_vary_timestep_init
-contains
-
-! ###########################################################################################
-!>\defgroup GFS Ozone Data Module
-!! This module updates the ozone data used by physics.
-!> @{
-!> \section arg_table_ozphys_time_vary_init Argument Table
-!! \htmlinclude ozphys_time_vary_init.html
-!!
-! ###########################################################################################
-  subroutine ozphys_time_vary_init(nPts, latsozp, oz_lat, dlat, jindx1, jindx2, ddy,        &
-       errmsg, errflg)
-    ! Inputs
-    integer, intent(in) :: &
-         nPts,      & ! Horizontal dimension
-         latsozp      ! Number of latitudes in ozone data
-    real(kind_phys),  intent(in), dimension(:) :: &
-         oz_lat,    & ! Latitudes of ozone data
-         dlat         ! Latitudes of grid
-    ! Outputs
-    integer, intent(inout), dimension(:) :: &
-         jindx1,    & ! Interpolation index (low) for ozone data
-         jindx2       ! Interpolation index (high) for ozone data
-    real(kind_phys), intent(inout), dimension(:) :: &
-         ddy          ! Interpolation high index for ozone data
-    character(len=*), intent(out) :: &
-         errmsg       ! CCPP error message
-    integer, intent(out) :: &
-         errflg       ! CCPP error flag
-
-    ! Local
-    integer i,j
-
-    ! Initialize CCPP error handling variables
-    errmsg = ''
-    errflg = 0
-
-    ! Set indices
-    do j=1,nPts
-       jindx2(j) = latsozp + 1
-       do i=1,latsozp
-          if (dlat(j) < oz_lat(i)) then
-             jindx2(j) = i
-             exit
-          endif
-       enddo
-       jindx1(j) = max(jindx2(j)-1,1)
-       jindx2(j) = min(jindx2(j),latsozp)
-       if (jindx2(j) .ne. jindx1(j)) then
-          ddy(j) = (dlat(j) - oz_lat(jindx1(j))) / (oz_lat(jindx2(j)) - oz_lat(jindx1(j)))
-       else
-          ddy(j) = 1.0
-       endif
-    enddo
-    
-  end subroutine ozphys_time_vary_init
-
-! ###########################################################################################
-!> \section arg_table_ozphys_time_vary_timestep_init Argument Table
-!! \htmlinclude ozphys_time_vary_timestep_init.html
-!!
-! ###########################################################################################
-  subroutine ozphys_time_vary_timestep_init(nPts, idate, fhour, jindx1, jindx2, latsozp,    &
-       levozp, oz_coeff, timeoz, ozplin, oz_time, oz_lat, ddy, oz_data, errmsg, errflg)
-    ! Inputs
-    integer, intent(in) :: &
-         nPts,     & ! Horizontal dimension
-         latsozp,  & ! Number of latitudes in ozone data
-         levozp,   & ! Number of vertical layers in ozone data
-         oz_coeff, & ! Number of coefficients in ozone data
-         timeoz      ! Number of times in ozone data
-    integer, intent(in),dimension(:) :: &
-         idate,    & ! Initial date with different size and ordering
-         jindx1,   & ! Interpolation index (low) for ozone
-         jindx2      ! Interpolation index (high) for ozone
-    real(kind_phys), intent(in) :: &
-         fhour       ! Forecast hour
-    real(kind_phys), intent(in), dimension(:) :: &
-         ddy,      & ! Interpolation high index for ozone data
-         oz_lat,   & ! Latitudes for ozone data
-         oz_time     ! Time for ozone data
-    real(kind_phys), intent(in), dimension(:,:,:,:) :: &
-         ozplin      ! Ozone data
-
-    ! Outputs
-    real(kind_phys), intent(inout), dimension(:,:,:) :: &
-         oz_data     ! Ozone forcing data
-    character(len=*), intent(out) :: &
-         errmsg      ! CCPP error message
-    integer,          intent(out) :: &
-         errflg      ! CCPP error flag
-
-    ! Local
-    integer :: idat(8),jdat(8),iday,j,j1,j2,l,nc,n1,n2,jdow,jdoy,&
-         jday,w3kindreal,w3kindint
-    real(kind_phys) :: tem, tx1, tx2, rjday
-    real(kind_dbl_prec) :: rinc(5)
-    real(kind_sngl_prec) :: rinc4(5)
-
-    ! Initialize CCPP error handling variables
-    errmsg = ''
-    errflg = 0
-
-    !
-    idat=0
-    idat(1)=idate(4)
-    idat(2)=idate(2)
-    idat(3)=idate(3)
-    idat(5)=idate(1)
-    rinc=0.
-    rinc(2)=fhour
-    call w3kind(w3kindreal,w3kindint)
-    if(w3kindreal==4) then
-       rinc4=rinc
-       CALL w3movdat(rinc4,idat,jdat)
-    else
-       CALL w3movdat(rinc,idat,jdat)
-    endif
-    !
-    jdow = 0
-    jdoy = 0
-    jday = 0
-    call w3doxdat(jdat,jdow,jdoy,jday)
-    rjday = jdoy + jdat(5) / 24.
-    IF (RJDAY < oz_time(1)) RJDAY = RJDAY + 365.
-    !
-    n2 = timeoz + 1
-    do j=2,timeoz
-       if (rjday < oz_time(j)) then
-          n2 = j
-          exit
-       endif
-    enddo
-    n1 = n2 - 1
-    
-    tx1 = (oz_time(n2) - rjday) / (oz_time(n2) - oz_time(n1))
-    tx2 = 1.0 - tx1
-    
-    if (n2 > timeoz) n2 = n2 - timeoz
-    !
-    do nc=1,oz_coeff
-       do L=1,levozp
-          do J=1,npts
-             J1  = jindx1(J)
-             J2  = jindx2(J)
-             TEM = 1.0 - ddy(J)
-             oz_data(j,L,nc) = tx1*(TEM*ozplin(J1,L,nc,n1)+ddy(J)*ozplin(J2,L,nc,n1)) & 
-                  + tx2*(TEM*ozplin(J1,L,nc,n2)+ddy(J)*ozplin(J2,L,nc,n2))
-          enddo
-       enddo
-    enddo
-
-    return
-
-  end subroutine ozphys_time_vary_timestep_init
-!> @}
-end module ozphys_time_vary
diff --git a/physics/ozphys_time_vary.meta b/physics/ozphys_time_vary.meta
deleted file mode 100644
index 75b8b8e4f..000000000
--- a/physics/ozphys_time_vary.meta
+++ /dev/null
@@ -1,200 +0,0 @@
-[ccpp-table-properties]
-  name = ozphys_time_vary
-  type = scheme
-  dependencies = machine.F
-
-########################################################################
-[ccpp-arg-table]
-  name = ozphys_time_vary_init
-  type = scheme
-[nPts]
-  standard_name = horizontal_dimension
-  long_name = horizontal dimension
-  units = count
-  dimensions = ()
-  type = integer
-  intent = in
-[latsozp]
-  standard_name = number_of_latitudes_in_ozone_data
-  long_name = number of latitude in ozone data
-  units = count
-  dimensions = ()
-  type = integer
-  intent = in
-[oz_lat]
-  standard_name = ozone_data_latitude
-  long_name = ozone data latitude
-  units = deg
-  dimensions = (number_of_latitudes_in_ozone_data)
-  type = real
-  kind = kind_phys
-  intent = in
-[dlat]
-  standard_name = latitude_in_degree
-  long_name = latitude in degree north
-  units = degree_north
-  dimensions = (horizontal_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[jindx1]
-  standard_name = lower_latitude_index_of_ozone_forcing_for_interpolation
-  long_name = interpolation low index for ozone
-  units = index
-  dimensions = (horizontal_dimension)
-  type = integer
-  intent = inout
-[jindx2]
-  standard_name = upper_latitude_index_of_ozone_forcing_for_interpolation
-  long_name = interpolation high index for ozone
-  units = index
-  dimensions = (horizontal_dimension)
-  type = integer
-  intent = inout
-[ddy]
-  standard_name = latitude_interpolation_weight_for_ozone_forcing
-  long_name = interpolation high index for ozone
-  units = none
-  dimensions = (horizontal_dimension)
-  type = real
-  kind = kind_phys
-  intent = inout
-[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
-
-########################################################################
-[ccpp-arg-table]
-  name = ozphys_time_vary_timestep_init
-  type = scheme
-[nPts]
-  standard_name = horizontal_dimension
-  long_name = horizontal dimension
-  units = count
-  dimensions = ()
-  type = integer
-  intent = in
-[idate]
-  standard_name = date_and_time_at_model_initialization_in_united_states_order
-  long_name = initial date with different size and ordering
-  units = none
-  dimensions = (4)
-  type = integer
-  intent = in
-[fhour]
-  standard_name = forecast_time
-  long_name = current forecast time
-  units = h
-  dimensions = ()
-  type = real
-  kind = kind_phys
-  intent = in
-[jindx1]
-  standard_name = lower_latitude_index_of_ozone_forcing_for_interpolation
-  long_name = interpolation low index for ozone
-  units = index
-  dimensions = (horizontal_dimension)
-  type = integer
-  intent = in
-[jindx2]
-  standard_name = upper_latitude_index_of_ozone_forcing_for_interpolation
-  long_name = interpolation high index for ozone
-  units = index
-  dimensions = (horizontal_dimension)
-  type = integer
-  intent = in
-[latsozp]
-  standard_name = number_of_latitudes_in_ozone_data
-  long_name = number of latitude in ozone data
-  units = count
-  dimensions = ()
-  type = integer
-  intent = in
-[levozp]
-  standard_name = number_of_levels_in_ozone_data
-  long_name = number of levels in ozone data
-  units = count
-  dimensions = ()
-  type = integer
-  intent = in
-[oz_coeff]
-  standard_name = number_of_coefficients_in_ozone_data
-  long_name = number of coefficients in ozone data
-  units = count
-  dimensions = ()
-  type = integer
-  intent = in
-[timeoz]
-  standard_name = number_of_times_in_ozone_data
-  long_name = number of times in ozone data
-  units = count
-  dimensions = ()
-  type = integer
-  intent = in
-[ozplin]
-  standard_name = ozone_data
-  long_name = ozone data
-  units = 1
-  dimensions = (number_of_latitudes_in_ozone_data,number_of_levels_in_ozone_data,number_of_coefficients_in_ozone_data,number_of_times_in_ozone_data)
-  type = real
-  kind = kind_phys
-  intent = in
-[oz_time]
-  standard_name = ozone_data_time
-  long_name = ozone data time
-  units = none
-  dimensions = (13)
-  type = real
-  kind = kind_phys
-  intent = in
-[oz_lat]
-  standard_name = ozone_data_latitude
-  long_name = ozone data latitude
-  units = deg
-  dimensions = (number_of_latitudes_in_ozone_data)
-  type = real
-  kind = kind_phys
-  intent = in
-[ddy]
-  standard_name = latitude_interpolation_weight_for_ozone_forcing
-  long_name = interpolation high index for ozone
-  units = none
-  dimensions = (horizontal_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[oz_data]
-  standard_name = ozone_forcing
-  long_name = ozone forcing data
-  units = mixed
-  dimensions = (horizontal_dimension,number_of_levels_in_ozone_data,number_of_coefficients_in_ozone_data)
-  type = real
-  kind = kind_phys
-  intent = inout
-[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
diff --git a/physics/radiation_gases.f b/physics/radiation_gases.f
index 5f017598f..4c626b348 100644
--- a/physics/radiation_gases.f
+++ b/physics/radiation_gases.f
@@ -1,17 +1,14 @@
 !>  \file radiation_gases.f
-!!  This file contains routines that set up ozone climatological
-!!  profiles and other constant gas profiles, such as co2, ch4, n2o,
-!!  o2, and those of cfc gases.  All data are entered as mixing ratio
-!!  by volume, except ozone which is mass mixing ratio (g/g).
+!!  This file contains routines that set up gas profiles, such as co2, 
+!!  ch4, n2o, o2, and those of cfc gases.  All data are entered as mixing
+!!  ratio by volume
 
 !  ==========================================================  !!!!!
 !              'module_radiation_gases'  description           !!!!!
 !  ==========================================================  !!!!!
 !                                                                      !
-!   set up ozone climatological profiles and other constant gas        !
-!   profiles, such as co2, ch4, n2o, o2, and those of cfc gases.  All  !
-!   data are entered as mixing ratio by volume, except ozone which is  !
-!   mass mixing ratio (g/g).                                           !
+!   set up constant gas profiles, such as co2, ch4, n2o, o2, and those !
+!   of cfc gases. All data are entered as mixing ratio by volume       !
 !                                                                      !
 !   in the module, the externally callabe subroutines are :            !
 !                                                                      !
@@ -23,16 +20,10 @@
 !                                                                      !
 !      'gas_update' -- read in data and update with time               !
 !         input:                                                       !
-!           ( iyear, imon, iday, ihour, loz1st, ldoco2, me )           !
+!           ( iyear, imon, iday, ihour, ldoco2, me )                   !
 !         output:                                                      !
 !           ( errflg, errmsg )                                         !
 !                                                                      !
-!      'getozn'     -- setup climatological ozone profile              !
-!         input:                                                       !
-!           ( prslk,xlat,                                              !
-!             IMAX, LM )                                               !
-!         output:                                                      !
-!           ( o3mmr )                                                  !
 !                                                                      !
 !      'getgases'   -- setup constant gas profiles for LW and SW       !
 !         input:                                                       !
@@ -47,7 +38,6 @@
 !       'module module_iounitdef'           in 'iounitdef.f'           !
 !                                                                      !
 !   unit used for radiative active gases:                              !
-!      ozone : mass mixing ratio                     (g/g)             !
 !      co2   : volume mixing ratio                   (p/p)             !
 !      n2o   : volume mixing ratio                   (p/p)             !
 !      ch4   : volume mixing ratio                   (p/p)             !
@@ -81,15 +71,6 @@
 !                  seasonal cycle calculations                         !
 !     aug 2011 - y-t hou     fix a bug in subr getgases doing vertical !
 !                  co2 mapping. (for top_at_1 case, not affact opr).   !
-!     aug 2012 - y-t hou     modified subr getozn.  moved the if-first !
-!                  block to subr gas_init to ensure threading safe in  !
-!                  climatology ozone applications. (not affect gfs)    !
-!                  also changed the initialization subr into two parts:!
-!                  'gas_init' is called at the start of run to set up  !
-!                  module parameters; and 'gas_update' is called within!
-!                  the time loop to check and update data sets. defined!
-!                  the climatology ozone parameters k1oz,k2oz,facoz as !
-!                  module variables and are set in subr 'gas_update'   !
 !     nov 2012 - y-t hou     modified control parameters thru module   !
 !                  'physparam'.                                        !
 !     jan 2013 - z. janjic/y. hou   modified ilon (longitude index)    !
@@ -105,10 +86,8 @@
 
 !> \defgroup module_radiation_gases_mod Radiation Gases Module
 !> @{
-!> This module sets up ozone climatological profiles and other constant
-!! gas profiles, such as co2, ch4, n2o, o2, and those of cfc gases. All
-!! data are entered as mixing ratio by volume, except ozone which is
-!! mass mixing ratio (g/g).
+!> This module sets up constant gas profiles, such as co2, ch4, n2o, o2,
+!! and those of cfc gases. All data are entered as mixing ratio by volume.
 !!\image html rad_gas_AGGI.png "Figure 1: Atmospheric radiative forcing, relative to 1750, by long-lived greenhouse gases and the 2016 update of the NOAA Annual Greenhouse Gas Index (AGGI)"
 !! NOAA Annual Greenhouse Gas Index (AGGI) shows that from 1990 to 2016, 
 !! radiative forcing by long-lived greenhouse gases (LLGHGs) increased by
@@ -121,10 +100,6 @@
 !!\n ICO2=1: use observed global annual mean value
 !!\n ICO2=2: use observed monthly 2-d data table in \f$15^o\f$ horizontal resolution
 !!
-!! O3 Distribution (namelist control parameter -\b NTOZ):
-!!\n NTOZ=0: use seasonal and zonal averaged climatological ozone
-!!\n NTOZ>0: use 3-D prognostic ozone
-!!
 !! Trace Gases (currently using the global mean climatology in unit of ppmv):
 !! \f$CH_4-1.50\times10^{-6}\f$;
 !! \f$N_2O-0.31\times10^{-6}\f$;
@@ -137,8 +112,8 @@
 !!
 !!\version NCEP-Radiation_gases     v5.1  Nov 2012
 
-!> This module sets up ozone climatological profiles and other constant gas
-!! profiles, such as co2, ch4, n2o, o2, and those of cfc gases.
+!> This module sets up constant gas rofiles, such as co2, ch4, n2o, o2, and those 
+!! of cfc gases.
       module module_radiation_gases      
       use machine,           only : kind_phys, kind_io4
       use funcphys,          only : fpkapx
@@ -179,22 +154,8 @@ module module_radiation_gases
 ! gfdl 1999 value
       real (kind=kind_phys), parameter :: f113vmr_def= 8.2000e-11
 
-!  ---  ozone seasonal climatology parameters defined in module ozne_def
-!   - 4x5 ozone data parameter
-!     integer, parameter :: JMR=45, LOZ=17
-!     real (kind=kind_phys), parameter :: blte=-86.0, dlte=4.0
-!   - geos ozone data
-!     integer, parameter :: JMR=18, LOZ=17
-!     real (kind=kind_phys), parameter :: blte=-85.0, dlte=10.0
-
 !  ---  module variables to be set in subroutin gas_init and/or gas_update
 
-! variables for climatology ozone (ioznflg = 0)
-
-      real (kind=kind_phys), allocatable :: pkstr(:), o3r(:,:,:)
-      integer :: k1oz = 0,  k2oz = 0
-      real (kind=kind_phys) :: facoz = 0.0
-
 !  arrays for co2 2-d monthly data and global mean values from observed data
 
       real (kind=kind_phys), allocatable :: co2vmr_sav(:,:,:)
@@ -209,33 +170,30 @@ module module_radiation_gases
 
 !  ---  public interfaces
 
-      public  gas_init, gas_update, getgases, getozn
+      public  gas_init, gas_update, getgases
 
 
 ! =================
       contains
 ! =================
 
-!> This subroutine sets up ozone, co2, etc. parameters. If climatology
-!! ozone then read in monthly ozone data.
+!> This subroutine sets up co2, etc. parameters.
 !!\param me           print message control flag
 !!\param co2usr_file  co2 user defined data table
 !!\param co2cyc_file  co2 climotology monthly cycle data table
 !!\param ictmflg      data ic time/date control flag
 !!\param ico2flg      co2 data source control flag
-!!\param ioznflg      ozone data control flag
 !!\param con_pi       physical constant Pi
 !!\param errflg       error flag
 !!\param errmsg       error message
 !>\section gas_init_gen gas_init General Algorithm
 !-----------------------------------
       subroutine gas_init( me, co2usr_file, co2cyc_file, ico2flg,       &
-     &     ictmflg, ioznflg, con_pi, JMR, LOZ, timeozc, errflg, errmsg)
+     &     ictmflg, con_pi, errflg, errmsg)
 
 !  ===================================================================  !
 !                                                                       !
-!  gas_init sets up ozone, co2, etc. parameters.  if climatology ozone  !
-!  then read in monthly ozone data.                                     !
+!  gas_init sets up co2, etc. parameters.                               !
 !                                                                       !
 !  inputs:                                                              !
 !     me          - print message control flag                          !
@@ -256,9 +214,6 @@ subroutine gas_init( me, co2usr_file, co2cyc_file, ico2flg,       &
 !                           further data extrapolation.                 !
 !                   =yyyy1: use yyyy data for the fcst. if needed, do   !
 !                           extrapolation to match the fcst time.       !
-!     ioznflg     - ozone data control flag                             !
-!                   =0: use climatological ozone profile                !
-!                   >0: use interactive ozone profile                   ! 
 !     co2usr_file - external co2 user defined data table                !
 !     co2cyc_file - external co2 climotology monthly cycle data table   ! 
 !     con_pi      - physical constant Pi                                !
@@ -267,9 +222,6 @@ subroutine gas_init( me, co2usr_file, co2cyc_file, ico2flg,       &
 !     errflg      - error flag                                          !
 !     errmsg      - error message                                       !
 !                                                                       !
-!  internal module variables:                                           !
-!     pkstr, o3r - arrays for climatology ozone data                    !
-!                                                                       !
 !  usage:    call gas_init                                              !
 !                                                                       !
 !  subprograms called:  none                                            !
@@ -279,8 +231,7 @@ subroutine gas_init( me, co2usr_file, co2cyc_file, ico2flg,       &
       implicit none
 
 !  ---  inputs:
-      integer, intent(in) :: me, ictmflg, ioznflg, ico2flg
-      integer, intent(in) :: JMR, LOZ, timeozc
+      integer, intent(in) :: me, ictmflg, ico2flg
       character(len=26),intent(in) :: co2usr_file,co2cyc_file
       real(kind=kind_phys), intent(in) :: con_pi
 
@@ -291,10 +242,7 @@ subroutine gas_init( me, co2usr_file, co2cyc_file, ico2flg,       &
 !  ---  locals:
       real (kind=kind_phys), dimension(IMXCO2,JMXCO2) :: co2dat
       real (kind=kind_phys) :: co2g1, co2g2
-      real (kind=kind_phys) :: pstr(LOZ)
-      real (kind=kind_io4)  :: o3clim4(JMR,LOZ,12), pstr4(LOZ)
 
-      integer    :: imond(12), ilat(JMR,12)
       integer    :: i, j, k, iyr, imo
       logical    :: file_exist, lextpl
       character  :: cline*100, cform*8
@@ -316,78 +264,6 @@ subroutine gas_init( me, co2usr_file, co2cyc_file, ico2flg,       &
       kyrsav  = 0
       kmonsav = 1
 
-!  --- ...  climatology ozone data section
-
-      if ( ioznflg > 0 ) then
-        if ( me == 0 ) then
-          print *,' - Using interactive ozone distribution'
-        endif
-      else
-        if ( timeozc /= 12 ) then
-          print *,' - Using climatology ozone distribution'
-          print *,' timeozc=',timeozc, ' is not monthly mean',          &
-     &            ' - job aborting in subroutin gas_init!!!'
-          errflg = 1
-          errmsg = 'ERROR(gas_init): Climatological o3 distribution '// &
-     &         'is not monthly mean'
-          return
-        endif
-
-        allocate (pkstr(LOZ), o3r(JMR,LOZ,12))
-        rewind NIO3CLM
-
-        if ( LOZ == 17 ) then       ! For the operational ozone climatology
-          do k = 1, LOZ
-            read (NIO3CLM,15) pstr4(k)
-   15       format(f10.3)
-          enddo
-
-          do imo = 1, 12
-            do j = 1, JMR
-              read (NIO3CLM,16) imond(imo), ilat(j,imo),                &
-     &                          (o3clim4(j,k,imo),k=1,10)
-   16         format(i2,i4,10f6.2)
-              read (NIO3CLM,20) (o3clim4(j,k,imo),k=11,LOZ)
-   20         format(6x,10f6.2)
-            enddo
-          enddo
-        else                      ! For newer ozone climatology
-          read (NIO3CLM)
-          do k = 1, LOZ
-            read (NIO3CLM) pstr4(k)
-          enddo
-
-          do imo = 1, 12
-            do k = 1, LOZ
-              read (NIO3CLM) (o3clim4(j,k,imo),j=1,JMR)
-            enddo
-          enddo
-        endif   ! end if_LOZ_block
-!
-        do imo = 1, 12
-          do k = 1, LOZ
-            do j = 1, JMR
-              o3r(j,k,imo) = o3clim4(j,k,imo) * 1.655e-6
-            enddo
-          enddo
-        enddo
-
-        do k = 1, LOZ
-          pstr(k) = pstr4(k)
-        enddo
-
-        if ( me == 0 ) then
-          print *,' - Using climatology ozone distribution'
-          print *,'   Found ozone data for levels pstr=',               &
-     &            (pstr(k),k=1,LOZ)
-!         print *,' O3=',(o3r(15,k,1),k=1,LOZ)
-        endif
-
-        do k = 1, LOZ
-          pkstr(k) = fpkapx(pstr(k)*100.0)
-        enddo
-      endif   ! end if_ioznflg_block
-
 !  --- ...  co2 data section
 
       co2_glb = co2vmr_def
@@ -541,20 +417,18 @@ end subroutine gas_init
 !!\param imon        month of the year
 !!\param iday        day of the month
 !!\param ihour       hour of the day
-!!\param loz1st      clim ozone 1st time update control flag
 !!\param ldoco2      co2 update control flag
 !!\param me          print message control flag
 !!\param co2dat_file co2 2d monthly obsv data table
 !!\param co2gbl_file co2 global annual mean data table 
 !!\param ictmflg     data ic time/date control flag
 !!\param ico2flg     co2 data source control flag
-!!\param ioznflg     ozone data control flag
 !!\param errflg      error flag
 !!\param errmsg      error message
 !>\section gen_gas_update gas_update General Algorithm
 !-----------------------------------
-      subroutine gas_update(iyear, imon, iday, ihour, loz1st, ldoco2,   &
-     &     me, co2dat_file, co2gbl_file, ictmflg, ico2flg, ioznflg,     &
+      subroutine gas_update(iyear, imon, iday, ihour, ldoco2,           &
+     &     me, co2dat_file, co2gbl_file, ictmflg, ico2flg,              &
      &     errflg, errmsg )
 
 !  ===================================================================  !
@@ -567,7 +441,6 @@ subroutine gas_update(iyear, imon, iday, ihour, loz1st, ldoco2,   &
 !     imon        - month of the year                       1           !
 !     iday        - day of the month                        1           !
 !     ihour       - hour of the day                         1           !
-!     loz1st      - clim ozone 1st time update control flag 1           !
 !     ldoco2      - co2 update control flag                 1           !
 !     me          - print message control flag              1           !
 !     ico2flg     - co2 data source control flag                        !
@@ -587,9 +460,6 @@ subroutine gas_update(iyear, imon, iday, ihour, loz1st, ldoco2,   &
 !                           further data extrapolation.                 !
 !                   =yyyy1: use yyyy data for the fcst. if needed, do   !
 !                           extrapolation to match the fcst time.       !
-!     ioznflg     - ozone data control flag                             !
-!                   =0: use climatological ozone profile                !
-!                   >0: use interactive ozone profile                   !
 !     ivflip      - vertical profile indexing flag                      !
 !     co2dat_file - external co2 2d monthly obsv data table             !
 !     co2gbl_file - external co2 global annual mean data table          !
@@ -603,8 +473,6 @@ subroutine gas_update(iyear, imon, iday, ihour, loz1st, ldoco2,   &
 !     co2cyc_sav - monthly cycle co2 vol mixing ratio  IMXCO2*JMXCO2*12 !
 !     co2_glb    - global annual mean co2 mixing ratio                  !
 !     gco2cyc    - global monthly mean co2 variation       12           !
-!     k1oz,k2oz,facoz                                                   !
-!                - climatology ozone parameters             1           !
 !                                                                       !
 !  usage:    call gas_update                                            !
 !                                                                       !
@@ -616,9 +484,8 @@ subroutine gas_update(iyear, imon, iday, ihour, loz1st, ldoco2,   &
 
 !  ---  inputs:
       integer, intent(in) :: iyear,imon,iday,ihour,me,ictmflg,ico2flg
-      integer, intent(in) :: ioznflg
       character(len=26),intent(in) :: co2dat_file, co2gbl_file
-      logical, intent(in) :: loz1st, ldoco2
+      logical, intent(in) :: ldoco2
 
 !  ---  output:
       character(len=*), intent(out) :: errmsg
@@ -643,35 +510,6 @@ subroutine gas_update(iyear, imon, iday, ihour, loz1st, ldoco2,   &
       errmsg = ''
       errflg = 0
 
-!> - Ozone data section
-
-      if ( ioznflg == 0 ) then
-        midmon = mdays(imon)/2 + 1
-        change = loz1st .or. ( (iday==midmon) .and. (ihour==0) )
-!
-        if ( change ) then
-          if ( iday < midmon ) then
-            k1oz = mod(imon+10, 12) + 1
-            midm = mdays(k1oz)/2 + 1
-            k2oz = imon
-            midp = mdays(k1oz) + midmon
-          else
-            k1oz = imon
-            midm = midmon
-            k2oz = mod(imon, 12) + 1
-            midp = mdays(k2oz)/2 + 1 + mdays(k1oz)
-          endif
-        endif
-!
-        if (iday < midmon) then
-         id = iday + mdays(k1oz)
-        else
-         id = iday
-        endif
-
-        facoz = float(id - midm) / float(midp - midm)
-      endif
-
 !> - co2 data section
 
       if ( ico2flg == 0 ) return    ! use prescribed global mean co2 data
@@ -1103,121 +941,6 @@ subroutine getgases( plvl, xlon, xlat, IMAX, LMAX, ico2flg,       &
       end subroutine getgases
 !-----------------------------------
 
-!> This subroutine sets up climatological ozone profile for radiation
-!! calculation. This code is originally written by Shrinivas Moorthi.
-!!\param prslk       (IMAX,LM), exner function = \f$(p/p0)^{rocp}\f$
-!!\param xlat        (IMAX), latitude in radians, default to pi/2 ->
-!!                    -pi/2 range, otherwise see in-line comment
-!!\param IMAX, LM    (1), horizontal and vertical dimensions
-!!\param top_at_1    (1), vertical profile indexing flag
-!!\param o3mmr       (IMAX,LM), output ozone profile in mass mixing
-!!                   ratio (g/g)
-!>\section getozn_gen getozn General Algorithm
-!-----------------------------------
-      subroutine getozn( prslk,xlat, IMAX, LM, top_at_1, JMR, LOZ, blte,&
-     &     dlte, o3mmr)
-
-!  ===================================================================  !
-!                                                                       !
-!  getozn sets up climatological ozone profile for radiation calculation!
-!                                                                       !
-!  this code is originally written By Shrinivas Moorthi                 !
-!                                                                       !
-!  inputs:                                                              !
-!     prslk (IMAX,LM)  - exner function = (p/p0)**rocp                  !
-!     xlat  (IMAX)     - latitude in radians, default to pi/2 -> -pi/2  !
-!                        range, otherwise see in-line comment           !
-!     IMAX, LM         - horizontal and vertical dimensions             !
-!     top_at_1         - vertical profile indexing flag                 !
-!                                                                       !
-!  outputs:                                                             !
-!     o3mmr (IMAX,LM)  - output ozone profile in mass mixing ratio (g/g)!
-!                                                                       !
-!  module variables:                                                    !
-!     k1oz, k2oz       - ozone data interpolation indices               !
-!     facoz            - ozone data interpolation factor                !
-!                                                                       !
-!  usage:    call getozn                                                !
-!                                                                       !
-!  ===================================================================  !
-!
-      implicit none
-
-!  ---  inputs:
-      integer,  intent(in) :: IMAX, LM, JMR, LOZ
-      real(kind=kind_phys), intent(in) :: blte, dlte
-      logical,  intent(in) :: top_at_1
-      real (kind=kind_phys), intent(in) :: prslk(:,:), xlat(:)
-
-!  ---  outputs:
-      real (kind=kind_phys), intent(out) :: o3mmr(:,:)
-
-!  ---  locals:
-      real (kind=kind_phys) :: o3i(IMAX,LOZ), wk1(IMAX), deglat, elte,  &
-     &                         tem, tem1, tem2, tem3, tem4, temp
-      integer :: i, j, k, l, j1, j2, ll
-!
-!===> ...  begin here
-!
-      elte = blte + (JMR-1)*dlte
-
-      do i = 1, IMAX
-        deglat = xlat(i) * raddeg        ! if xlat in pi/2 -> -pi/2 range
-!       deglat = 90.0 - xlat(i)*raddeg   ! if xlat in 0 -> pi range
-
-        if (deglat > blte .and. deglat < elte) then
-          tem1 = (deglat - blte) / dlte + 1
-          j1   = tem1
-          j2   = j1 + 1
-          tem1 = tem1 - j1
-        elseif (deglat <= blte) then
-          j1   = 1
-          j2   = 1
-          tem1 = 1.0
-        elseif (deglat >= elte) then
-          j1   = JMR
-          j2   = JMR
-          tem1 = 1.0
-        endif
-
-        tem2 = 1.0 - tem1
-        do j = 1, LOZ
-          tem3     = tem2*o3r(j1,j,k1oz) + tem1*o3r(j2,j,k1oz)
-          tem4     = tem2*o3r(j1,j,k2oz) + tem1*o3r(j2,j,k2oz)
-          o3i(i,j) = tem4*facoz          + tem3*(1.0 - facoz)
-        enddo
-      enddo
-
-      do l = 1, LM
-        ll = l
-        if (.not. top_at_1) ll = LM -l + 1
-
-        do i = 1, IMAX
-          wk1(i) = prslk(i,ll)
-        enddo
-
-        do k = 1, LOZ-1
-          temp = 1.0 / (pkstr(k+1) - pkstr(k))
-
-          do i = 1, IMAX
-            if (wk1(i) > pkstr(k) .and. wk1(i) <= pkstr(k+1)) then
-              tem       = (pkstr(k+1) - wk1(i)) * temp
-              o3mmr(I,ll) = tem * o3i(i,k) + (1.0 - tem) * o3i(i,k+1)
-            endif
-          enddo
-        enddo
-
-        do i = 1, IMAX
-          if (wk1(i) > pkstr(LOZ)) o3mmr(i,ll) = o3i(i,LOZ)
-          if (wk1(i) < pkstr(1))   o3mmr(i,ll) = o3i(i,1)
-        enddo
-      enddo
-!
-      return
-!...................................
-      end subroutine getozn
-!-----------------------------------
-
 !
 !........................................!
       end module module_radiation_gases  !
diff --git a/physics/rrtmgp_lw_main.F90 b/physics/rrtmgp_lw_main.F90
index 67f7f749a..01b25c925 100644
--- a/physics/rrtmgp_lw_main.F90
+++ b/physics/rrtmgp_lw_main.F90
@@ -19,7 +19,6 @@ module rrtmgp_lw_main
   use rrtmgp_lw_gas_optics,   only: lw_gas_props,rrtmgp_lw_gas_optics_init
   use rrtmgp_lw_cloud_optics, only: lw_cloud_props, rrtmgp_lw_cloud_optics_init, abssnow0,   &
                                     abssnow1, absrain
-  use module_radiation_gases, only: NF_VGAS, getgases, getozn
   use GFS_rrtmgp_pre,         only: iStr_h2o, iStr_co2, iStr_o3, iStr_n2o, iStr_ch4,         &
                                     iStr_o2, iStr_ccl4, iStr_cfc11, iStr_cfc12, iStr_cfc22,  &
                                     eps, oneminus, ftiny

From 2886df96f645f9366d7d0496ac654fc178264e7d Mon Sep 17 00:00:00 2001
From: dustinswales <dswales@ucar.edu>
Date: Wed, 27 Sep 2023 14:23:36 -0600
Subject: [PATCH 096/115] Small cosmetic changes

---
 physics/GFS_phys_time_vary.fv3.F90 | 53 ++++++++++++++----------------
 1 file changed, 24 insertions(+), 29 deletions(-)

diff --git a/physics/GFS_phys_time_vary.fv3.F90 b/physics/GFS_phys_time_vary.fv3.F90
index af2dd9b00..f72763c3a 100644
--- a/physics/GFS_phys_time_vary.fv3.F90
+++ b/physics/GFS_phys_time_vary.fv3.F90
@@ -219,14 +219,6 @@ subroutine GFS_phys_time_vary_init (
 
 !$OMP sections
 
-!$OMP section
-!> - Setup spatial interpolation indices for ozone physics.
-         if (ntoz > 0) then
-            !$OMP CRITICAL
-            call ozphys%setup_forcing(xlat_d, jindx1_o3, jindx2_o3, ddy_o3)
-            !$OMP END CRITICAL
-         endif
-
 !$OMP section
 !> - Call read_h2odata() to read stratospheric water vapor data
          call read_h2odata (h2o_phys, me, master)
@@ -294,6 +286,12 @@ subroutine GFS_phys_time_vary_init (
 
 !$OMP sections
 
+!$OMP section
+!> - Setup spatial interpolation indices for ozone physics.
+         if (ntoz > 0) then
+            call ozphys%setup_forcing(xlat_d, jindx1_o3, jindx2_o3, ddy_o3)
+         endif
+
 !$OMP section
 !> - Call setindxh2o() to initialize stratospheric water vapor data
          if (h2o_phys) then
@@ -803,21 +801,7 @@ subroutine GFS_phys_time_vary_timestep_init (
             return
          end if
 
-!$OMP parallel num_threads(nthrds) default(none)                                         &
-!$OMP          shared(kdt,nsswr,lsswr,clstp,imfdeepcnv,cal_pre,random_clds)              &
-!$OMP          shared(fhswr,fhour,seed0,cnx,cny,nrcm,wrk,rannie,rndval)                  &
-!$OMP          shared(rann,im,isc,jsc,imap,jmap,ntoz,me,idate,jindx1_o3,jindx2_o3)       &
-!$OMP          shared(ozpl,ddy_o3,h2o_phys,jindx1_h,jindx2_h,h2opl,ddy_h,iaerclm,master) &
-!$OMP          shared(levs,prsl,iccn,jindx1_ci,jindx2_ci,ddy_ci,iindx1_ci,iindx2_ci)     &
-!$OMP          shared(ddx_ci,in_nm,ccn_nm,do_ugwp_v1,jindx1_tau,jindx2_tau,ddy_j1tau)    &
-!$OMP          shared(ddy_j2tau,tau_amf,iflip,ozphys)                              &
-!$OMP          private(iseed,iskip,i,j,rjday,idat,rinc,w3kindreal,w3kindint,jdat)&
-!$OMP          private(jdow,jdoy,jday,rinc4,n1,n2)
-
-!$OMP sections
-
-!$OMP section
-!> - Compute temporal interpolation indices for updating gas concentrations.
+         !> - Compute temporal interpolation indices for updating gas concentrations.
          idat=0
          idat(1)=idate(4)
          idat(2)=idate(2)
@@ -849,12 +833,17 @@ subroutine GFS_phys_time_vary_timestep_init (
          n1 = n2 - 1
          if (n2 > ozphys%ntime) n2 = n2 - ozphys%ntime
 
-         !> - Update ozone concentration.
-         if (ntoz > 0) then
-            !$OMP CRITICAL
-            call ozphys%update_forcing(jindx1_o3, jindx2_o3, ddy_o3, rjday, n1, n2, ozpl)
-            !$OMP END CRITICAL
-         endif
+!$OMP parallel num_threads(nthrds) default(none)                                         &
+!$OMP          shared(kdt,nsswr,lsswr,clstp,imfdeepcnv,cal_pre,random_clds)              &
+!$OMP          shared(fhswr,fhour,seed0,cnx,cny,nrcm,wrk,rannie,rndval)                  &
+!$OMP          shared(rann,im,isc,jsc,imap,jmap,ntoz,me,idate,jindx1_o3,jindx2_o3)       &
+!$OMP          shared(ozpl,ddy_o3,h2o_phys,jindx1_h,jindx2_h,h2opl,ddy_h,iaerclm,master) &
+!$OMP          shared(levs,prsl,iccn,jindx1_ci,jindx2_ci,ddy_ci,iindx1_ci,iindx2_ci)     &
+!$OMP          shared(ddx_ci,in_nm,ccn_nm,do_ugwp_v1,jindx1_tau,jindx2_tau,ddy_j1tau)    &
+!$OMP          shared(ddy_j2tau,tau_amf,iflip,ozphys)                                    &
+!$OMP          private(iseed,iskip,i,j)
+
+!$OMP sections
 
 !$OMP section
 
@@ -901,6 +890,12 @@ subroutine GFS_phys_time_vary_timestep_init (
 
          endif  ! imfdeepcnv, cal_re, random_clds
 
+!$OMP section
+!> - Update ozone concentration.
+         if (ntoz > 0) then
+            call ozphys%update_forcing(jindx1_o3, jindx2_o3, ddy_o3, rjday, n1, n2, ozpl)
+         endif
+
 !$OMP section
 !> - Call h2ointerpol() to make stratospheric water vapor data interpolation
          if (h2o_phys) then

From 17b057ce219479a3e46e9c8d7825736a0935083c Mon Sep 17 00:00:00 2001
From: dustinswales <dswales@ucar.edu>
Date: Wed, 27 Sep 2023 14:28:52 -0600
Subject: [PATCH 097/115] Housekeeping

---
 physics/GFS_phys_time_vary.fv3.F90  |  2 +-
 physics/GFS_phys_time_vary.fv3.meta | 59 ++++++++++++++---------------
 2 files changed, 30 insertions(+), 31 deletions(-)

diff --git a/physics/GFS_phys_time_vary.fv3.F90 b/physics/GFS_phys_time_vary.fv3.F90
index f72763c3a..6fa188471 100644
--- a/physics/GFS_phys_time_vary.fv3.F90
+++ b/physics/GFS_phys_time_vary.fv3.F90
@@ -841,7 +841,7 @@ subroutine GFS_phys_time_vary_timestep_init (
 !$OMP          shared(levs,prsl,iccn,jindx1_ci,jindx2_ci,ddy_ci,iindx1_ci,iindx2_ci)     &
 !$OMP          shared(ddx_ci,in_nm,ccn_nm,do_ugwp_v1,jindx1_tau,jindx2_tau,ddy_j1tau)    &
 !$OMP          shared(ddy_j2tau,tau_amf,iflip,ozphys)                                    &
-!$OMP          private(iseed,iskip,i,j)
+!$OMP          private(iseed,iskip,i,j,k)
 
 !$OMP sections
 
diff --git a/physics/GFS_phys_time_vary.fv3.meta b/physics/GFS_phys_time_vary.fv3.meta
index bf5a3fa04..639e2db6a 100644
--- a/physics/GFS_phys_time_vary.fv3.meta
+++ b/physics/GFS_phys_time_vary.fv3.meta
@@ -30,6 +30,13 @@
   dimensions = ()
   type = logical
   intent = in
+[ntoz]
+  standard_name = index_of_ozone_mixing_ratio_in_tracer_concentration_array
+  long_name = tracer index for ozone mixing ratio
+  units = index
+  dimensions = ()
+  type = integer
+  intent = in
 [iaerclm]
   standard_name = flag_for_aerosol_input_MG_radiation
   long_name = flag for using aerosols in Morrison-Gettelman MP_radiation
@@ -72,36 +79,6 @@
   dimensions = ()
   type = integer
   intent = in
-  intent = in
-[ntoz]
-  standard_name = index_of_ozone_mixing_ratio_in_tracer_concentration_array
-  long_name = tracer index for ozone mixing ratio
-  units = index
-  dimensions = ()
-  type = integer
-  intent = in
-[jindx1_o3]
-  standard_name = lower_latitude_index_of_ozone_forcing_for_interpolation
-  long_name = interpolation low index for ozone
-  units = index
-  dimensions = (horizontal_dimension)
-  type = integer
-  intent = in
-[jindx2_o3]
-  standard_name = upper_latitude_index_of_ozone_forcing_for_interpolation
-  long_name = interpolation high index for ozone
-  units = index
-  dimensions = (horizontal_dimension)
-  type = integer
-  intent = in
-[ddy_o3]
-  standard_name = latitude_interpolation_weight_for_ozone_forcing
-  long_name = interpolation high index for ozone
-  units = none
-  dimensions = (horizontal_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
 [nx]
   standard_name = number_of_points_in_x_direction_for_this_MPI_rank
   long_name = number of points in x direction for this MPI rank
@@ -139,6 +116,28 @@
   type = real
   kind = kind_phys
   intent = in
+[jindx1_o3]
+  standard_name = lower_latitude_index_of_ozone_forcing_for_interpolation
+  long_name = interpolation low index for ozone
+  units = index
+  dimensions = (horizontal_dimension)
+  type = integer
+  intent = inout
+[jindx2_o3]
+  standard_name = upper_latitude_index_of_ozone_forcing_for_interpolation
+  long_name = interpolation high index for ozone
+  units = index
+  dimensions = (horizontal_dimension)
+  type = integer
+  intent = inout
+[ddy_o3]
+  standard_name = latitude_interpolation_weight_for_ozone_forcing
+  long_name = interpolation high index for ozone
+  units = none
+  dimensions = (horizontal_dimension)
+  type = real
+  kind = kind_phys
+  intent = inout
 [jindx1_h]
   standard_name = lower_latitude_index_of_stratospheric_water_vapor_forcing_for_interpolation
   long_name = interpolation low index for stratospheric water vapor

From 17203fe06a90612ad09a357e8084510c4a277d58 Mon Sep 17 00:00:00 2001
From: dustinswales <dswales@ucar.edu>
Date: Wed, 27 Sep 2023 14:32:20 -0600
Subject: [PATCH 098/115] Housekeeping

---
 physics/GFS_phys_time_vary.fv3.meta | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/physics/GFS_phys_time_vary.fv3.meta b/physics/GFS_phys_time_vary.fv3.meta
index 639e2db6a..ad543e146 100644
--- a/physics/GFS_phys_time_vary.fv3.meta
+++ b/physics/GFS_phys_time_vary.fv3.meta
@@ -23,13 +23,6 @@
   dimensions = ()
   type = integer
   intent = in
-[h2o_phys]
-  standard_name = flag_for_stratospheric_water_vapor_physics
-  long_name = flag for stratospheric water vapor physics
-  units = flag
-  dimensions = ()
-  type = logical
-  intent = in
 [ntoz]
   standard_name = index_of_ozone_mixing_ratio_in_tracer_concentration_array
   long_name = tracer index for ozone mixing ratio
@@ -37,6 +30,13 @@
   dimensions = ()
   type = integer
   intent = in
+[h2o_phys]
+  standard_name = flag_for_stratospheric_water_vapor_physics
+  long_name = flag for stratospheric water vapor physics
+  units = flag
+  dimensions = ()
+  type = logical
+  intent = in
 [iaerclm]
   standard_name = flag_for_aerosol_input_MG_radiation
   long_name = flag for using aerosols in Morrison-Gettelman MP_radiation

From 3f6168b12443a79adf7abcdf326bcfa6813c8d84 Mon Sep 17 00:00:00 2001
From: dustinswales <dswales@ucar.edu>
Date: Wed, 27 Sep 2023 15:49:35 -0600
Subject: [PATCH 099/115] More reorg.

---
 physics/GFS_phys_time_vary.fv3.F90     |   9 +-
 physics/GFS_rrtmg_pre.F90              |   2 +-
 physics/GFS_rrtmg_setup.F90            |   2 +-
 physics/GFS_rrtmgp_pre.F90             |   2 +-
 physics/GFS_rrtmgp_setup.F90           |   2 +-
 physics/GFS_suite_stateout_update.F90  | 135 +++++++++++++++----------
 physics/GFS_suite_stateout_update.meta |  95 ++++++++++++++++-
 physics/module_ozphys.F90              |  50 ++++-----
 8 files changed, 209 insertions(+), 88 deletions(-)

diff --git a/physics/GFS_phys_time_vary.fv3.F90 b/physics/GFS_phys_time_vary.fv3.F90
index 6fa188471..70eeb81e1 100644
--- a/physics/GFS_phys_time_vary.fv3.F90
+++ b/physics/GFS_phys_time_vary.fv3.F90
@@ -95,6 +95,7 @@ subroutine GFS_phys_time_vary_init (
          integer,              intent(in) :: lkm
          integer,              intent(inout)  :: use_lake_model(:)
          real(kind=kind_phys), intent(in   )  :: lakefrac(:), lakedepth(:)
+
          integer,              intent(inout) :: jindx1_o3(:), jindx2_o3(:), jindx1_h(:), jindx2_h(:)
          real(kind_phys),      intent(inout) :: ddy_o3(:),  ddy_h(:)
          real(kind_phys),      intent(in)    :: h2opl(:,:,:)
@@ -289,7 +290,7 @@ subroutine GFS_phys_time_vary_init (
 !$OMP section
 !> - Setup spatial interpolation indices for ozone physics.
          if (ntoz > 0) then
-            call ozphys%setup_forcing(xlat_d, jindx1_o3, jindx2_o3, ddy_o3)
+           call ozphys%setup_o3prog(xlat_d, jindx1_o3, jindx2_o3, ddy_o3)
          endif
 
 !$OMP section
@@ -729,7 +730,7 @@ subroutine GFS_phys_time_vary_timestep_init (
             lakefrac, min_seaice, min_lakeice, smc, slc, stc, smois, sh2o, tslb, tiice, tg3, tref,  &
             tsfc, tsfco, tisfc, hice, fice, facsf, facwf, alvsf, alvwf, alnsf, alnwf, zorli, zorll, &
             zorlo, weasd, slope, snoalb, canopy, vfrac, vtype, stype,scolor, shdmin, shdmax, snowd, &
-            cv, cvb, cvt, oro, oro_uf, xlat_d, xlon_d, slmsk, landfrac, ozphys,               &
+            cv, cvb, cvt, oro, oro_uf, xlat_d, xlon_d, slmsk, landfrac, ozphys,                     &
             do_ugwp_v1, jindx1_tau, jindx2_tau, ddy_j1tau, ddy_j2tau, tau_amf, errmsg, errflg)
 
          implicit none
@@ -841,7 +842,7 @@ subroutine GFS_phys_time_vary_timestep_init (
 !$OMP          shared(levs,prsl,iccn,jindx1_ci,jindx2_ci,ddy_ci,iindx1_ci,iindx2_ci)     &
 !$OMP          shared(ddx_ci,in_nm,ccn_nm,do_ugwp_v1,jindx1_tau,jindx2_tau,ddy_j1tau)    &
 !$OMP          shared(ddy_j2tau,tau_amf,iflip,ozphys)                                    &
-!$OMP          private(iseed,iskip,i,j,k)
+!$OMP          private(iseed,iskip,i,j,k,rjday,n1,n2)
 
 !$OMP sections
 
@@ -893,7 +894,7 @@ subroutine GFS_phys_time_vary_timestep_init (
 !$OMP section
 !> - Update ozone concentration.
          if (ntoz > 0) then
-            call ozphys%update_forcing(jindx1_o3, jindx2_o3, ddy_o3, rjday, n1, n2, ozpl)
+            call ozphys%update_o3prog(jindx1_o3, jindx2_o3, ddy_o3, rjday, n1, n2, ozpl)
          endif
 
 !$OMP section
diff --git a/physics/GFS_rrtmg_pre.F90 b/physics/GFS_rrtmg_pre.F90
index 69be4f8d0..108d6f407 100644
--- a/physics/GFS_rrtmg_pre.F90
+++ b/physics/GFS_rrtmg_pre.F90
@@ -434,7 +434,7 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp, lextop,&
           enddo
         enddo
       else                                ! climatological ozone
-         call ozphys%oz_clim(xlat, prslk1, con_pi, olyr)
+         call ozphys%run_o3clim(xlat, prslk1, con_pi, olyr)
       endif                               ! end_if_ntoz
 
 !> - Call coszmn(), to compute cosine of zenith angle (only when SW is called)
diff --git a/physics/GFS_rrtmg_setup.F90 b/physics/GFS_rrtmg_setup.F90
index 908a364dc..e48a60ac8 100644
--- a/physics/GFS_rrtmg_setup.F90
+++ b/physics/GFS_rrtmg_setup.F90
@@ -467,7 +467,7 @@ subroutine radupdate( idate,jdate,deltsw,deltim,lsswr,me, iaermdl,&
       call gas_update ( kyear,kmon,kday,khour,lco2_chg, me, co2dat_file, &
            co2gbl_file, ictm, ico2, errflg, errmsg )
       if (ntoz == 0) then
-         call ozphys%update_clim(kmon, kday, khour, loz1st)
+         call ozphys%update_o3clim(kmon, kday, khour, loz1st)
       endif
 
       if ( loz1st ) loz1st = .false.
diff --git a/physics/GFS_rrtmgp_pre.F90 b/physics/GFS_rrtmgp_pre.F90
index 9dcc002a0..cbf8d161b 100644
--- a/physics/GFS_rrtmgp_pre.F90
+++ b/physics/GFS_rrtmgp_pre.F90
@@ -353,7 +353,7 @@ subroutine GFS_rrtmgp_pre_run(me, nCol, nLev, i_o3, doSWrad, doLWrad, fhswr, fhl
        enddo
     ! OR Use climatological ozone data
     else
-       call ozphys%oz_clim(xlat, prslk, con_pi, o3_lay)
+       call ozphys%run_o3clim(xlat, prslk, con_pi, o3_lay)
     endif
 
     ! #######################################################################################
diff --git a/physics/GFS_rrtmgp_setup.F90 b/physics/GFS_rrtmgp_setup.F90
index 3e4f57d13..9f2b2a9f9 100644
--- a/physics/GFS_rrtmgp_setup.F90
+++ b/physics/GFS_rrtmgp_setup.F90
@@ -243,7 +243,7 @@ subroutine GFS_rrtmgp_setup_timestep_init (idate, jdate, deltsw, deltim, doSWrad
     call gas_update (kyear, kmon, kday, khour, lco2_chg, me, co2dat_file, co2gbl_file, ictm,&
          ico2, errflg, errmsg )
     if (ntoz == 0) then
-       call ozphys%update_clim(kmon, kday, khour, loz1st)
+       call ozphys%update_o3clim(kmon, kday, khour, loz1st)
     endif
     
     if ( loz1st ) loz1st = .false.
diff --git a/physics/GFS_suite_stateout_update.F90 b/physics/GFS_suite_stateout_update.F90
index 2771c3e82..41f44e0de 100644
--- a/physics/GFS_suite_stateout_update.F90
+++ b/physics/GFS_suite_stateout_update.F90
@@ -1,63 +1,90 @@
+! #########################################################################################
 !> \file GFS_suite_stateout_update.f90
-!!  Contains code to update the state variables due to process-split physics from accumulated tendencies during that phase.
+!!  Update the state variables due to process-split physics from accumulated tendencies 
+!!  during that phase.
+!!  Update gas concentrations, if using prognostic photolysis schemes.
 !!  Also, set bounds on the mass-weighted rime factor when using Ferrier-Aligo microphysics.
-
-  module GFS_suite_stateout_update
-
-  contains
-
+! #########################################################################################
+module GFS_suite_stateout_update
+  use machine,       only: kind_phys
+  use module_ozphys, only: ty_ozphys
+  implicit none
+contains
+! #########################################################################################
 !> \section arg_table_GFS_suite_stateout_update_run Argument Table
 !! \htmlinclude GFS_suite_stateout_update_run.html
 !!
-    subroutine GFS_suite_stateout_update_run (im, levs, ntrac, dtp,  &
-                     tgrs, ugrs, vgrs, qgrs, dudt, dvdt, dtdt, dqdt, &
-                     gt0, gu0, gv0, gq0, ntiw, nqrimef, imp_physics, &
-                     imp_physics_fer_hires, epsq, errmsg, errflg)
-
-      use machine,               only: kind_phys
-
-      implicit none
-
-      ! Interface variables
-      integer,              intent(in )                   :: im
-      integer,              intent(in )                   :: levs
-      integer,              intent(in )                   :: ntrac
-      integer,              intent(in )                   :: imp_physics,imp_physics_fer_hires
-      integer,              intent(in )                   :: ntiw, nqrimef
-      real(kind=kind_phys), intent(in )                   :: dtp, epsq
-
-      real(kind=kind_phys), intent(in ), dimension(:,:)   :: tgrs, ugrs, vgrs
-      real(kind=kind_phys), intent(in ), dimension(:,:,:) :: qgrs
-      real(kind=kind_phys), intent(in ), dimension(:,:)   :: dudt, dvdt, dtdt
-      real(kind=kind_phys), intent(in ), dimension(:,:,:) :: dqdt
-      real(kind=kind_phys), intent(out), dimension(:,:)   :: gt0, gu0, gv0
-      real(kind=kind_phys), intent(out), dimension(:,:,:) :: gq0
-
-      character(len=*),     intent(out)                   :: errmsg
-      integer,              intent(out)                   :: errflg
-
-      integer                       :: i, k
-      ! Initialize CCPP error handling variables
-      errmsg = ''
-      errflg = 0
-
-      gt0(:,:)   = tgrs(:,:)   + dtdt(:,:)   * dtp
-      gu0(:,:)   = ugrs(:,:)   + dudt(:,:)   * dtp
-      gv0(:,:)   = vgrs(:,:)   + dvdt(:,:)   * dtp
-      gq0(:,:,:) = qgrs(:,:,:) + dqdt(:,:,:) * dtp
-      
-      if (imp_physics == imp_physics_fer_hires) then
+! #########################################################################################
+  subroutine GFS_suite_stateout_update_run (im, levs, ntrac, dtp, tgrs, ugrs, vgrs, qgrs, &
+       dudt, dvdt, dtdt, dqdt, gt0, gu0, gv0, gq0, oz0, ntiw, nqrimef, imp_physics,       &
+       imp_physics_fer_hires, epsq, ozphys, oz_phys_2015, oz_phys_2006, con_1ovg, prsl,   &
+       dp, ozpl, do3_dt_prd, do3_dt_ozmx, do3_dt_temp, do3_dt_ohoz, errmsg, errflg)
+
+    ! Inputs
+    integer,              intent(in )                   :: im
+    integer,              intent(in )                   :: levs
+    integer,              intent(in )                   :: ntrac
+    integer,              intent(in )                   :: imp_physics,imp_physics_fer_hires
+    integer,              intent(in )                   :: ntiw, nqrimef
+    real(kind=kind_phys), intent(in )                   :: dtp, epsq, con_1ovg
+    real(kind=kind_phys), intent(in ), dimension(:,:)   :: tgrs, ugrs, vgrs, prsl, dp
+    real(kind=kind_phys), intent(in ), dimension(:,:,:) :: qgrs, ozpl
+    real(kind=kind_phys), intent(in ), dimension(:,:)   :: dudt, dvdt, dtdt
+    real(kind=kind_phys), intent(in ), dimension(:,:,:) :: dqdt
+    logical,              intent(in)                    :: oz_phys_2015
+    logical,              intent(in)                    :: oz_phys_2006
+    type(ty_ozphys),      intent(in)                    :: ozphys
+
+    ! Outputs (optional)
+    real(kind=kind_phys), intent(inout), dimension(:,:), pointer, optional :: &
+         do3_dt_prd,  & ! Physics tendency: production and loss effect
+         do3_dt_ozmx, & ! Physics tendency: ozone mixing ratio effect
+         do3_dt_temp, & ! Physics tendency: temperature effect
+         do3_dt_ohoz    ! Physics tendency: overhead ozone effect
+
+    ! Outputs
+    real(kind=kind_phys), intent(out), dimension(:,:)   :: gt0, gu0, gv0, oz0
+    real(kind=kind_phys), intent(out), dimension(:,:,:) :: gq0
+    character(len=*),     intent(out)                   :: errmsg
+    integer,              intent(out)                   :: errflg
+
+    ! Locals
+    integer :: i, k
+    
+    ! Initialize CCPP error handling variables
+    errmsg = ''
+    errflg = 0
+
+    ! Update prognostic state varaibles using accumulated tendencies from "process-split"
+    ! section of GFS suite.
+    gt0(:,:)   = tgrs(:,:)   + dtdt(:,:)   * dtp
+    gu0(:,:)   = ugrs(:,:)   + dudt(:,:)   * dtp
+    gv0(:,:)   = vgrs(:,:)   + dvdt(:,:)   * dtp
+    gq0(:,:,:) = qgrs(:,:,:) + dqdt(:,:,:) * dtp
+
+    ! If using photolysis physics schemes, update (prognostic) gas concentrations using 
+    ! updated state.
+    if (oz_phys_2015) then
+       call ozphys%run_o3prog_2015(con_1ovg, dtp, prsl, gt0, dp, ozpl, oz0, do3_dt_prd,    &
+            do3_dt_ozmx, do3_dt_temp, do3_dt_ohoz)
+    endif
+    if (oz_phys_2006) then
+       call ozphys%run_o3prog_2006()
+    endif
+
+    ! If using Ferrier-Aligo microphysics, set bounds on the mass-weighted rime factor.
+    if (imp_physics == imp_physics_fer_hires) then
        do k=1,levs
-         do i=1,im
-           if(gq0(i,k,ntiw) > epsq) then
-             gq0(i,k,nqrimef) = max(1., gq0(i,k,nqrimef)/gq0(i,k,ntiw))
-           else
-             gq0(i,k,nqrimef) = 1.
-           end if
-         end do
+          do i=1,im
+             if(gq0(i,k,ntiw) > epsq) then
+                gq0(i,k,nqrimef) = max(1., gq0(i,k,nqrimef)/gq0(i,k,ntiw))
+             else
+                gq0(i,k,nqrimef) = 1.
+             end if
+          end do
        end do
-      end if
+    end if
 
-    end subroutine GFS_suite_stateout_update_run
+  end subroutine GFS_suite_stateout_update_run
 
-  end module GFS_suite_stateout_update
\ No newline at end of file
+end module GFS_suite_stateout_update
diff --git a/physics/GFS_suite_stateout_update.meta b/physics/GFS_suite_stateout_update.meta
index 580482b71..8cbab9139 100644
--- a/physics/GFS_suite_stateout_update.meta
+++ b/physics/GFS_suite_stateout_update.meta
@@ -2,7 +2,7 @@
 [ccpp-table-properties]
   name = GFS_suite_stateout_update
   type = scheme
-  dependencies = machine.F
+  dependencies = machine.F,module_ozphys.F90
 
 ########################################################################
 [ccpp-arg-table]
@@ -37,6 +37,27 @@
   type = real
   kind = kind_phys
   intent = in
+[ozphys]
+  standard_name = dataset_for_ozone_physics
+  long_name = dataset for NRL ozone physics
+  units = mixed
+  dimensions = ()
+  type = ty_ozphys
+  intent = in
+[oz_phys_2015]
+  standard_name = flag_for_nrl_2015_ozone_scheme
+  long_name = flag for new (2015) ozone physics
+  units = flag
+  dimensions = ()
+  type = logical
+  intent = in
+[oz_phys_2006]
+  standard_name = flag_for_nrl_2006_ozone_scheme
+  long_name = flag for new (2006) ozone physics
+  units = flag
+  dimensions = ()
+  type = logical
+  intent = in
 [tgrs]
   standard_name = air_temperature
   long_name = model layer mean temperature
@@ -133,6 +154,14 @@
   type = real
   kind = kind_phys
   intent = out
+[oz0]
+  standard_name = ozone_concentration_of_new_state
+  long_name = ozone concentration updated by physics
+  units = kg kg-1
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = inout
 [ntiw]
   standard_name = index_of_cloud_ice_mixing_ratio_in_tracer_concentration_array
   long_name = tracer index for  ice water
@@ -169,6 +198,70 @@
   type = real
   kind = kind_phys
   intent = in
+[con_1ovg]
+  standard_name = one_divided_by_the_gravitational_acceleration
+  long_name = inverse of gravitational acceleration
+  units = s2 m-1
+  dimensions = ()
+  type = real
+  kind = kind_phys
+  intent = in
+[prsl]
+  standard_name = air_pressure
+  long_name = mid-layer pressure
+  units = Pa
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[ozpl]
+  standard_name = ozone_forcing
+  long_name = ozone forcing data
+  units = mixed
+  dimensions = (horizontal_loop_extent,number_of_levels_in_ozone_data,number_of_coefficients_in_ozone_data)
+  type = real
+  kind = kind_phys
+  intent = in
+[dp]
+  standard_name = air_pressure_difference_between_midlayers
+  long_name = difference between mid-layer pressures
+  units = Pa
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[do3_dt_prd]
+  standard_name = ozone_tendency_due_to_production_and_loss_rate
+  long_name = ozone tendency due to production and loss rate
+  units = kg kg-1 s-1
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = inout
+[do3_dt_ozmx]
+  standard_name = ozone_tendency_due_to_ozone_mixing_ratio
+  long_name = ozone tendency due to ozone mixing ratio
+  units = kg kg-1 s-1
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = inout
+[do3_dt_temp]
+  standard_name = ozone_tendency_due_to_temperature
+  long_name = ozone tendency due to temperature
+  units = kg kg-1 s-1
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = inout
+[do3_dt_ohoz]
+  standard_name = ozone_tendency_due_to_overhead_ozone_column
+  long_name = ozone tendency due to overhead ozone column
+  units = kg kg-1 s-1
+  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
+  type = real
+  kind = kind_phys
+  intent = inout
 [errmsg]
   standard_name = ccpp_error_message
   long_name = error message for error handling in CCPP
diff --git a/physics/module_ozphys.F90 b/physics/module_ozphys.F90
index 966d27113..205a02b46 100644
--- a/physics/module_ozphys.F90
+++ b/physics/module_ozphys.F90
@@ -41,21 +41,22 @@ module module_ozphys
      integer                      :: k2oz          !< Upper interpolation index in datac(dim=3), time dim 
      real(kind_phys)              :: facoz         !< Parameter for ozone climotology
      contains
-       procedure, public :: load_forcing
-       procedure, public :: load_clim
-       procedure, public :: setup_forcing
-       procedure, public :: update_forcing
-       procedure, public :: update_clim
-       procedure, public :: oz_prog_2015
-       procedure, public :: oz_prog_2006
-       procedure, public :: oz_clim
+       procedure, public :: load_o3prog
+       procedure, public :: setup_o3prog
+       procedure, public :: update_o3prog
+       procedure, public :: run_o3prog_2015
+       procedure, public :: run_o3prog_2006
+       !
+       procedure, public :: load_o3clim
+       procedure, public :: update_o3clim
+       procedure, public :: run_o3clim
   end type ty_ozphys
   
 contains
   ! #########################################################################################
   ! Procedure (type-bound) for loading ozone forcing data.
   ! #########################################################################################
-  function load_forcing(this, file, fileID) result (err_message)
+  function load_o3prog(this, file, fileID) result (err_message)
     class(ty_ozphys), intent(inout) :: this
     integer,          intent(in)    :: fileID
     character(len=*), intent(in)    :: file
@@ -97,12 +98,12 @@ function load_forcing(this, file, fileID) result (err_message)
     deallocate(tempin)
     close(fileID)
 
-  end function load_forcing
+  end function load_o3prog
 
   ! #########################################################################################
   ! Procedure for setting up interpolation indices between data and model grid.
   ! #########################################################################################
-  subroutine setup_forcing(this, lat, idx1, idx2, idxh)
+  subroutine setup_o3prog(this, lat, idx1, idx2, idxh)
     class(ty_ozphys), intent(in)  :: this
     real(kind_phys),  intent(in)  :: lat(:)
     integer,          intent(out) :: idx1(:), idx2(:)
@@ -126,12 +127,12 @@ subroutine setup_forcing(this, lat, idx1, idx2, idxh)
        endif
     enddo
 
-  end subroutine setup_forcing
+  end subroutine setup_o3prog
 
   ! #########################################################################################
   ! Procedure (type-bound) for updating ozone data.
   ! #########################################################################################
-  subroutine update_forcing(this, idx1, idx2, idxh, rjday, idxt1, idxt2, ozpl)
+  subroutine update_o3prog(this, idx1, idx2, idxh, rjday, idxt1, idxt2, ozpl)
     class(ty_ozphys), intent(in)  :: this
     integer,          intent(in)  :: idx1(:), idx2(:)
     real(kind_phys),  intent(in)  :: idxh(:)
@@ -156,12 +157,12 @@ subroutine update_forcing(this, idx1, idx2, idxh, rjday, idxt1, idxt2, ozpl)
        enddo
     enddo
 
-  end subroutine update_forcing
+  end subroutine update_o3prog
 
   ! #########################################################################################
   ! Procedure (type-bound) for NRL prognostic ozone (2015).
   ! #########################################################################################
-  subroutine oz_prog_2015(this, con_1ovg, dt, p, t, dp, ozpl, oz, do3_dt_prd, do3_dt_ozmx,  &
+  subroutine run_o3prog_2015(this, con_1ovg, dt, p, t, dp, ozpl, oz, do3_dt_prd, do3_dt_ozmx,  &
        do3_dt_temp, do3_dt_ohoz)
     class(ty_ozphys), intent(in) :: this
     real(kind_phys),intent(in) :: &
@@ -267,21 +268,20 @@ subroutine oz_prog_2015(this, con_1ovg, dt, p, t, dp, ozpl, oz, do3_dt_prd, do3_
     enddo
 
     return
-  end subroutine oz_prog_2015
+  end subroutine run_o3prog_2015
 
   ! #########################################################################################
   ! Procedure (type-bound) for NRL prognostic ozone (2006).
   ! #########################################################################################
-  subroutine oz_prog_2006(this)
+  subroutine run_o3prog_2006(this)
     class(ty_ozphys), intent(in) :: this
     return
-  end subroutine oz_prog_2006
+  end subroutine run_o3prog_2006
 
   ! #########################################################################################
   ! Procedure (type-bound) for NRL updating climotological ozone.
-  ! Build this up from getozn.
   ! #########################################################################################
-  subroutine oz_clim(this, lat, prslk, con_pi, oz)
+  subroutine run_o3clim(this, lat, prslk, con_pi, oz)
     class(ty_ozphys), intent(in) :: this
     real(kind_phys),  intent(in) :: &
          con_pi  ! Physics constant: Pi
@@ -356,12 +356,12 @@ subroutine oz_clim(this, lat, prslk, con_pi, oz)
     enddo
 
     return
-  end subroutine oz_clim
+  end subroutine run_o3clim
 
   ! #########################################################################################
   ! Procedure (type-bound) for loading ozone climo data.
   ! #########################################################################################
-  function load_clim(this, file, fileID) result (err_message)
+  function load_o3clim(this, file, fileID) result (err_message)
     class(ty_ozphys), intent(inout) :: this
     integer,          intent(in)    :: fileID
     character(len=*), intent(in)    :: file
@@ -432,12 +432,12 @@ function load_clim(this, file, fileID) result (err_message)
         this%pkstr(iLev) = fpkapx(this%pstr(iLev)*100.0)
      enddo
 
-  end function load_clim
+   end function load_o3clim
 
   ! #########################################################################################
   ! Procedure (type-bound) for updating ozone climotological data.
   ! #########################################################################################
-  subroutine update_clim(this, imon, iday, ihour, loz1st)
+  subroutine update_o3clim(this, imon, iday, ihour, loz1st)
     class(ty_ozphys), intent(inout) :: this
     integer, intent(in) :: imon, iday, ihour
     logical, intent(in) :: loz1st
@@ -471,6 +471,6 @@ subroutine update_clim(this, imon, iday, ihour, loz1st)
     
     this%facoz = float(id - midm) / float(midp - midm)
 
-  end subroutine update_clim
+  end subroutine update_o3clim
 
 end module module_ozphys

From d0a4bfd63fae9f4e4a06cb5598049f1019aed945 Mon Sep 17 00:00:00 2001
From: dustinswales <dswales@ucar.edu>
Date: Wed, 27 Sep 2023 15:50:51 -0600
Subject: [PATCH 100/115] Remove ozphysics modules. Now part of ty_ozphys

---
 physics/ozphys_2015.F90  | 167 ---------------------------------------
 physics/ozphys_2015.meta | 140 --------------------------------
 2 files changed, 307 deletions(-)
 delete mode 100644 physics/ozphys_2015.F90
 delete mode 100644 physics/ozphys_2015.meta

diff --git a/physics/ozphys_2015.F90 b/physics/ozphys_2015.F90
deleted file mode 100644
index 1478d0d6e..000000000
--- a/physics/ozphys_2015.F90
+++ /dev/null
@@ -1,167 +0,0 @@
-! ###########################################################################################
-!> \file ozphys_2015.F90
-!!
-! ###########################################################################################
-module ozphys_2015
-  use machine,       only: kind_phys, kind_dbl_prec, kind_sngl_prec
-  use module_ozphys, only: ty_ozphys
-  implicit none
-  public ozphys_2015_run
-contains
-
-! ###########################################################################################
-!>\defgroup GFS_ozphys_2015 GFS Ozone Photochemistry (2015) Module
-!! This module contains the CCPP-compliant Ozone 2015 photochemistry scheme.
-!> @{
-!> The operational GFS currently parameterizes ozone production and destruction based on 
-!! monthly mean coefficients ( \c ozprdlos_2015_new_sbuvO3_tclm15_nuchem.f77) provided by 
-!! Naval Research Laboratory through CHEM2D chemistry model
-!! (McCormack et al. (2006) \cite mccormack_et_al_2006).
-!! (https://doi.org/10.5194/acp-6-4943-2006)
-!!
-!> \section genal_ozphys_2015 GFS ozphys_2015_run General Algorithm
-!> -  This code assumes that both 2D fields are ordered from bottom to top.
-!> -  This code is specifically for NRL parameterization and climatological T and O3 are in 
-!     location 5 and 6 of ozpl array
-!!\author   June 2015 - Shrinivas Moorthi
-!!\modified May  2023 - Dustin Swales
-! ###########################################################################################
-
-! ###########################################################################################
-! SUBROUTINE ozphys_2015_run
-! ###########################################################################################
-!! \section arg_table_ozphys_2015_run Argument Table
-!! \htmlinclude ozphys_2015_run.html
-!!
-  subroutine ozphys_2015_run (oz_phys, ozphys, nCol, nLev, dt, oz, tin, prsl, ozpl,     &
-       delp, con_1ovg, do3_dt_prd, do3_dt_ozmx, do3_dt_temp, do3_dt_ohoz, errmsg, errflg)
-
-    ! Inputs
-    logical, intent(in) :: &
-         oz_phys        ! Flag for ozone_physics_2015 scheme.
-    type(ty_ozphys),intent(in) :: &
-         ozphys
-    real(kind_phys),intent(in) :: &
-         con_1ovg       ! Physical constant: One divided by gravitational acceleration (m-1 s2)
-    integer, intent(in) :: &
-         nCol,        & ! Horizontal dimension
-         nLev           ! Number of vertical layers
-    real(kind_phys), intent(in) :: &
-         dt             ! Physics timestep (seconds)
-    real(kind_phys), intent(in), dimension(:,:) :: &
-         prsl,        & ! Air-pressure (Pa)
-         tin,         & ! Temperature of new-state (K)
-         delp           ! Difference between mid-layer pressures (Pa)
-    real(kind_phys), intent(in), dimension(:,:,:) :: &
-         ozpl           ! Ozone forcing data
-
-    ! Outputs (optional)
-    real(kind=kind_phys), intent(inout), dimension(:,:), pointer, optional :: &
-         do3_dt_prd,  & ! Physics tendency: production and loss effect
-         do3_dt_ozmx, & ! Physics tendency: ozone mixing ratio effect
-         do3_dt_temp, & ! Physics tendency: temperature effect
-         do3_dt_ohoz    ! Physics tendency: overhead ozone effect
-
-    ! Outputs
-    real(kind=kind_phys), intent(inout), dimension(:,:) :: &
-         oz             ! Ozone concentration updated by physics
-    character(len=*), intent(out) :: &
-         errmsg         ! CCPP error message
-    integer, intent(out) :: &
-         errflg         ! CCPP error flag
-
-    ! Locals
-    integer :: k, kmax, kmin, l, i, j
-    logical, dimension(nCol) :: flg
-    real(kind_phys) :: pmax, pmin, tem, temp
-    real(kind_phys), dimension(nCol) :: wk1, wk2, wk3, ozib
-    real(kind_phys), dimension(nCol,ozphys%ncf) :: prod
-    real(kind_phys), dimension(nCol,nLev) :: ozi
-    real(kind_phys), dimension(nCol,nLev+1) :: colo3, coloz
-
-    ! Initialize CCPP error handling variables
-    errmsg = ''
-    errflg = 0
-
-    ! Sanity checks
-    if (.not.oz_phys) then
-       write (errmsg,'(*(a))') 'Logic error: oz_phys_2015 == .false.'
-       errflg = 1
-       return
-    endif
-
-    ! Temporaries
-    ozi = oz
-
-    colo3(:,nLev+1) = 0.0
-    coloz(:,nLev+1) = 0.0
-
-    do l=nLev,1,-1
-       pmin =  1.0e10
-       pmax = -1.0e10
-
-       do i=1,nCol
-          wk1(i) = log(prsl(i,l))
-          pmin   = min(wk1(i), pmin)
-          pmax   = max(wk1(i), pmax)
-          prod(i,:) = 0.0
-       enddo
-       kmax = 1
-       kmin = 1
-       do k=1,ozphys%nlev-1
-          if (pmin < ozphys%po3(k)) kmax = k
-          if (pmax < ozphys%po3(k)) kmin = k
-       enddo
-       !
-       do k=kmin,kmax
-          temp = 1.0 / (ozphys%po3(k) - ozphys%po3(k+1))
-          do i=1,nCol
-             flg(i) = .false.
-             if (wk1(i) < ozphys%po3(k) .and. wk1(i) >= ozphys%po3(k+1)) then
-                flg(i) = .true.
-                wk2(i) = (wk1(i) - ozphys%po3(k+1)) * temp
-                wk3(i) = 1.0 - wk2(i)
-             endif
-          enddo
-          do j=1,ozphys%ncf
-             do i=1,nCol
-                if (flg(i)) then
-                   prod(i,j)  = wk2(i) * ozpl(i,k,j) + wk3(i) * ozpl(i,k+1,j)
-                endif
-             enddo
-          enddo
-       enddo
-
-       do j=1,ozphys%ncf
-          do i=1,nCol
-             if (wk1(i) < ozphys%po3(ozphys%nlev)) then
-                prod(i,j) = ozpl(i,ozphys%nlev,j)
-             endif
-             if (wk1(i) >= ozphys%po3(1)) then
-                prod(i,j) = ozpl(i,1,j)
-             endif
-          enddo
-       enddo
-       do i=1,nCol
-          colo3(i,l) = colo3(i,l+1) + ozi(i,l)  * delp(i,l)*con_1ovg
-          coloz(i,l) = coloz(i,l+1) + prod(i,6) * delp(i,l)*con_1ovg
-          prod(i,2)  = min(prod(i,2), 0.0)
-       enddo
-       do i=1,nCol
-          ozib(i)  = ozi(i,l)            ! no filling
-          tem      = prod(i,1) - prod(i,2) * prod(i,6) + prod(i,3) * (tin(i,l) - prod(i,5)) &
-                                                       + prod(i,4) * (colo3(i,l)-coloz(i,l))
-          oz(i,l) = (ozib(i)  + tem*dt) / (1.0 - prod(i,2)*dt)
-       enddo
-
-       ! Diagnostics (optional)
-       if (associated(do3_dt_prd))  do3_dt_prd(:,l)  = (prod(:,1)-prod(:,2)*prod(:,6))*dt
-       if (associated(do3_dt_ozmx)) do3_dt_ozmx(:,l) = (oz(:,l) - ozib(:))
-       if (associated(do3_dt_temp)) do3_dt_temp(:,l) = prod(:,3)*(tin(:,l)-prod(:,5))*dt
-       if (associated(do3_dt_ohoz)) do3_dt_ohoz(:,l) = prod(:,4) * (colo3(:,l)-coloz(:,l))*dt
-    enddo
-
-    return
-  end subroutine ozphys_2015_run
-!> @}
-end module ozphys_2015
diff --git a/physics/ozphys_2015.meta b/physics/ozphys_2015.meta
deleted file mode 100644
index ca2d56e4e..000000000
--- a/physics/ozphys_2015.meta
+++ /dev/null
@@ -1,140 +0,0 @@
-[ccpp-table-properties]
-  name = ozphys_2015
-  type = scheme
-  dependencies = machine.F,module_ozphys.F90
-
-########################################################################
-[ccpp-arg-table]
-  name = ozphys_2015_run
-  type = scheme
-[oz_phys]
-  standard_name = flag_for_nrl_2015_ozone_scheme
-  long_name = flag for new (2015) ozone physics
-  units = flag
-  dimensions = ()
-  type = logical
-  intent = in
-[ozphys]
-  standard_name = dataset_for_ozone_physics
-  long_name = dataset for NRL ozone physics
-  units = mixed
-  dimensions = ()
-  type = ty_ozphys
-  intent = in
-[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 layers
-  units = count
-  dimensions = ()
-  type = integer
-  intent = in
-[dt]
-  standard_name = timestep_for_physics
-  long_name = physics time step
-  units = s
-  dimensions = ()
-  type = real
-  kind = kind_phys
-  intent = in
-[oz]
-  standard_name = ozone_concentration_of_new_state
-  long_name = ozone concentration updated by physics
-  units = kg kg-1
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = inout
-[tin]
-  standard_name = air_temperature_of_new_state
-  long_name = updated air temperature
-  units = K
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[prsl]
-  standard_name = air_pressure
-  long_name = mid-layer pressure
-  units = Pa
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[ozpl]
-  standard_name = ozone_forcing
-  long_name = ozone forcing data
-  units = mixed
-  dimensions = (horizontal_loop_extent,number_of_levels_in_ozone_data,number_of_coefficients_in_ozone_data)
-  type = real
-  kind = kind_phys
-  intent = in
-[delp]
-  standard_name = air_pressure_difference_between_midlayers
-  long_name = difference between mid-layer pressures
-  units = Pa
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[con_1ovg]
-  standard_name = one_divided_by_the_gravitational_acceleration
-  long_name = inverse of gravitational acceleration
-  units = s2 m-1
-  dimensions = ()
-  type = real
-  kind = kind_phys
-  intent = in
-[do3_dt_prd]
-  standard_name = ozone_tendency_due_to_production_and_loss_rate
-  long_name = ozone tendency due to production and loss rate
-  units = kg kg-1 s-1
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = inout
-[do3_dt_ozmx]
-  standard_name = ozone_tendency_due_to_ozone_mixing_ratio
-  long_name = ozone tendency due to ozone mixing ratio
-  units = kg kg-1 s-1
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = inout
-[do3_dt_temp]
-  standard_name = ozone_tendency_due_to_temperature
-  long_name = ozone tendency due to temperature
-  units = kg kg-1 s-1
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = inout
-[do3_dt_ohoz]
-  standard_name = ozone_tendency_due_to_overhead_ozone_column
-  long_name = ozone tendency due to overhead ozone column
-  units = kg kg-1 s-1
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = inout
-[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

From 385ef4e2802a838fd3099b17ee479ebaae1a6402 Mon Sep 17 00:00:00 2001
From: dustinswales <dswales@ucar.edu>
Date: Wed, 27 Sep 2023 22:19:36 -0600
Subject: [PATCH 101/115] Some polishing. Merge 2006 ozone into module_ozphys

---
 physics/GFS_phys_time_vary.fv3.F90    |  69 ++++-----
 physics/GFS_suite_stateout_update.F90 |   3 +-
 physics/module_ozphys.F90             | 127 +++++++++++++++-
 physics/ozphys.f                      | 211 --------------------------
 physics/ozphys.meta                   | 208 -------------------------
 5 files changed, 158 insertions(+), 460 deletions(-)
 delete mode 100644 physics/ozphys.f
 delete mode 100644 physics/ozphys.meta

diff --git a/physics/GFS_phys_time_vary.fv3.F90 b/physics/GFS_phys_time_vary.fv3.F90
index 70eeb81e1..cd1f8287a 100644
--- a/physics/GFS_phys_time_vary.fv3.F90
+++ b/physics/GFS_phys_time_vary.fv3.F90
@@ -802,38 +802,6 @@ subroutine GFS_phys_time_vary_timestep_init (
             return
          end if
 
-         !> - Compute temporal interpolation indices for updating gas concentrations.
-         idat=0
-         idat(1)=idate(4)
-         idat(2)=idate(2)
-         idat(3)=idate(3)
-         idat(5)=idate(1)
-         rinc=0.
-         rinc(2)=fhour
-         call w3kind(w3kindreal,w3kindint)
-         if(w3kindreal==4) then
-            rinc4=rinc
-            CALL w3movdat(rinc4,idat,jdat)
-         else
-            CALL w3movdat(rinc,idat,jdat)
-         endif
-         jdow = 0
-         jdoy = 0
-         jday = 0
-         call w3doxdat(jdat,jdow,jdoy,jday)
-         rjday = jdoy + jdat(5) / 24.
-         if (rjday < ozphys%time(1)) rjday = rjday + 365.
-
-         n2 = ozphys%ntime + 1
-         do j=2,ozphys%ntime
-            if (rjday < ozphys%time(j)) then
-               n2 = j
-               exit
-            endif
-         enddo
-         n1 = n2 - 1
-         if (n2 > ozphys%ntime) n2 = n2 - ozphys%ntime
-
 !$OMP parallel num_threads(nthrds) default(none)                                         &
 !$OMP          shared(kdt,nsswr,lsswr,clstp,imfdeepcnv,cal_pre,random_clds)              &
 !$OMP          shared(fhswr,fhour,seed0,cnx,cny,nrcm,wrk,rannie,rndval)                  &
@@ -841,8 +809,9 @@ subroutine GFS_phys_time_vary_timestep_init (
 !$OMP          shared(ozpl,ddy_o3,h2o_phys,jindx1_h,jindx2_h,h2opl,ddy_h,iaerclm,master) &
 !$OMP          shared(levs,prsl,iccn,jindx1_ci,jindx2_ci,ddy_ci,iindx1_ci,iindx2_ci)     &
 !$OMP          shared(ddx_ci,in_nm,ccn_nm,do_ugwp_v1,jindx1_tau,jindx2_tau,ddy_j1tau)    &
-!$OMP          shared(ddy_j2tau,tau_amf,iflip,ozphys)                                    &
-!$OMP          private(iseed,iskip,i,j,k,rjday,n1,n2)
+!$OMP          shared(ddy_j2tau,tau_amf,iflip,ozphys,rjday,n1,n2,idat,jdat,rinc,rinc4)   &
+!$OMP          shared(w3kindreal,w3kindint,jdow,jdoy,jday)                               &
+!$OMP          private(iseed,iskip,i,j,k)
 
 !$OMP sections
 
@@ -892,6 +861,38 @@ subroutine GFS_phys_time_vary_timestep_init (
          endif  ! imfdeepcnv, cal_re, random_clds
 
 !$OMP section
+         !> - Compute temporal interpolation indices for updating gas concentrations.
+         idat=0
+         idat(1)=idate(4)
+         idat(2)=idate(2)
+         idat(3)=idate(3)
+         idat(5)=idate(1)
+         rinc=0.
+         rinc(2)=fhour
+         call w3kind(w3kindreal,w3kindint)
+         if(w3kindreal==4) then
+            rinc4=rinc
+            CALL w3movdat(rinc4,idat,jdat)
+         else
+            CALL w3movdat(rinc,idat,jdat)
+         endif
+         jdow = 0
+         jdoy = 0
+         jday = 0
+         call w3doxdat(jdat,jdow,jdoy,jday)
+         rjday = jdoy + jdat(5) / 24.
+         if (rjday < ozphys%time(1)) rjday = rjday + 365.
+
+         n2 = ozphys%ntime + 1
+         do j=2,ozphys%ntime
+            if (rjday < ozphys%time(j)) then
+               n2 = j
+                      exit
+            endif
+         enddo
+         n1 = n2 - 1
+         if (n2 > ozphys%ntime) n2 = n2 - ozphys%ntime
+
 !> - Update ozone concentration.
          if (ntoz > 0) then
             call ozphys%update_o3prog(jindx1_o3, jindx2_o3, ddy_o3, rjday, n1, n2, ozpl)
diff --git a/physics/GFS_suite_stateout_update.F90 b/physics/GFS_suite_stateout_update.F90
index 41f44e0de..e9e477fce 100644
--- a/physics/GFS_suite_stateout_update.F90
+++ b/physics/GFS_suite_stateout_update.F90
@@ -69,7 +69,8 @@ subroutine GFS_suite_stateout_update_run (im, levs, ntrac, dtp, tgrs, ugrs, vgrs
             do3_dt_ozmx, do3_dt_temp, do3_dt_ohoz)
     endif
     if (oz_phys_2006) then
-       call ozphys%run_o3prog_2006()
+       call ozphys%run_o3prog_2006(con_1ovg, dtp, prsl, gt0, dp, ozpl, oz0, do3_dt_prd,    &
+            do3_dt_ozmx, do3_dt_temp, do3_dt_ohoz)
     endif
 
     ! If using Ferrier-Aligo microphysics, set bounds on the mass-weighted rime factor.
diff --git a/physics/module_ozphys.F90 b/physics/module_ozphys.F90
index 205a02b46..d24585d4d 100644
--- a/physics/module_ozphys.F90
+++ b/physics/module_ozphys.F90
@@ -162,12 +162,12 @@ end subroutine update_o3prog
   ! #########################################################################################
   ! Procedure (type-bound) for NRL prognostic ozone (2015).
   ! #########################################################################################
-  subroutine run_o3prog_2015(this, con_1ovg, dt, p, t, dp, ozpl, oz, do3_dt_prd, do3_dt_ozmx,  &
-       do3_dt_temp, do3_dt_ohoz)
+  subroutine run_o3prog_2015(this, con_1ovg, dt, p, t, dp, ozpl, oz, do3_dt_prd,            &
+       do3_dt_ozmx, do3_dt_temp, do3_dt_ohoz)
     class(ty_ozphys), intent(in) :: this
-    real(kind_phys),intent(in) :: &
+    real(kind_phys),  intent(in) :: &
          con_1ovg       ! Physical constant: One divided by gravitational acceleration (m-1 s2)
-    real(kind_phys), intent(in) :: &
+    real(kind_phys),  intent(in) :: &
          dt             ! Model timestep (sec)
     real(kind_phys),  intent(in), dimension(:,:) :: &
          p,           & ! Model Pressure (Pa)
@@ -253,7 +253,7 @@ subroutine run_o3prog_2015(this, con_1ovg, dt, p, t, dp, ozpl, oz, do3_dt_prd, d
           prod(iCol,2)     = min(prod(iCol,2), 0.0)
        enddo
        do iCol=1,nCol
-          ozib(iCol) = ozi(iCol,iLev) ! no filling
+          ozib(iCol) = ozi(iCol,iLev)
           tem        = prod(iCol,1) - prod(iCol,2) * prod(iCol,6) &
                                     + prod(iCol,3) * (t(iCol,iLev) - prod(iCol,5)) &
                                     + prod(iCol,4) * (colo3(iCol,iLev)-coloz(iCol,iLev))
@@ -273,8 +273,123 @@ end subroutine run_o3prog_2015
   ! #########################################################################################
   ! Procedure (type-bound) for NRL prognostic ozone (2006).
   ! #########################################################################################
-  subroutine run_o3prog_2006(this)
+  subroutine run_o3prog_2006(this, con_1ovg, dt, p, t, dp, ozpl, oz, do3_dt_prd,            &
+       do3_dt_ozmx, do3_dt_temp, do3_dt_ohoz)
     class(ty_ozphys), intent(in) :: this
+    real(kind_phys),  intent(in) :: &
+         con_1ovg       ! Physical constant: One divided by gravitational acceleration (m-1 s2)
+    real(kind_phys),  intent(in) :: &
+         dt             ! Model timestep (sec)
+    real(kind_phys),  intent(in), dimension(:,:) :: &
+         p,           & ! Model Pressure (Pa)
+         t,           & ! Model temperature (K)
+         dp             ! Model layer thickness (Pa)
+    real(kind_phys), intent(in), dimension(:,:,:) :: &
+         ozpl           ! Ozone forcing data
+    real(kind_phys), intent(inout), dimension(:,:) :: &
+         oz             ! Ozone concentration updated by physics
+    real(kind_phys), intent(inout), dimension(:,:), pointer, optional :: &
+         do3_dt_prd,  & ! Physics tendency: production and loss effect
+         do3_dt_ozmx, & ! Physics tendency: ozone mixing ratio effect
+         do3_dt_temp, & ! Physics tendency: temperature effect
+         do3_dt_ohoz    ! Physics tendency: overhead ozone effect
+
+    ! Locals
+    integer :: k, kmax, kmin, iLev, iCol, nCol, nLev, iCf
+    logical, dimension(size(p,1)) :: flg
+    real(kind_phys) :: pmax, pmin, tem, temp
+    real(kind_phys), dimension(size(p,1)) :: wk1, wk2, wk3, ozib
+    real(kind_phys), dimension(size(p,1),this%ncf) :: prod
+    real(kind_phys), dimension(size(p,1),size(p,2)) :: ozi
+    real(kind_phys), dimension(size(p,1),size(p,2)+1) :: colo3, coloz
+
+    ! Dimensions
+    nCol = size(p,1)
+    nLev = size(p,2)
+
+    ! Temporaries
+    ozi = oz
+
+    !> - Calculate vertical integrated column ozone values.
+    if (this%ncf > 2) then
+       colo3(:,nLev+1) = 0.0
+       do iLev=nLev,1,-1
+          do iCol=1,nCol
+             colo3(iCol,iLev) = colo3(iCol,iLev+1) + ozi(iCol,iLev) * dp(iCol,iLev) * con_1ovg
+          enddo
+       enddo
+    endif
+
+    !> - Apply vertically linear interpolation to the ozone coefficients.
+    do iLev=1,nLev
+       pmin =  1.0e10
+       pmax = -1.0e10
+
+       do iCol=1,nCol
+          wk1(iCol)    = log(p(iCol,iLev))
+          pmin         = min(wk1(iCol), pmin)
+          pmax         = max(wk1(iCol), pmax)
+          prod(iCol,:) = 0._kind_phys
+       enddo
+       kmax = 1
+       kmin = 1
+       do k=1,this%nlev-1
+          if (pmin < this%po3(k)) kmax = k
+          if (pmax < this%po3(k)) kmin = k
+       enddo
+
+       do k=kmin,kmax
+          temp = 1.0 / (this%po3(k) - this%po3(k+1))
+          do iCol=1,nCol
+             flg(iCol) = .false.
+             if (wk1(iCol) < this%po3(k) .and. wk1(iCol) >= this%po3(k+1)) then
+                flg(iCol) = .true.
+                wk2(iCol) = (wk1(iCol) - this%po3(k+1)) * temp
+                wk3(iCol) = 1.0 - wk2(iCol)
+             endif
+          enddo
+          do iCf=1,this%ncf
+             do iCol=1,nCol
+                if (flg(iCol)) then
+                   prod(iCol,iCf)  = wk2(iCol) * ozpl(iCol,k,iCf) + wk3(iCol) * ozpl(iCol,k+1,iCf)
+                endif
+             enddo
+          enddo
+       enddo
+
+       do iCf=1,this%ncf
+          do iCol=1,nCol
+             if (wk1(iCol) < this%po3(this%nlev)) then
+                prod(iCol,iCf) = ozpl(iCol,this%nlev,iCf)
+             endif
+             if (wk1(iCol) >= this%po3(1)) then
+                prod(iCol,iCf) = ozpl(iCol,1,iCf)
+             endif
+          enddo
+       enddo
+
+       if (this%ncf == 2) then
+          do iCol=1,nCol
+             ozib(iCol)    = ozi(iCol,iLev)
+             oz(iCol,iLev) = (ozib(iCol) + prod(iCol,1)*dt) / (1.0 + prod(iCol,2)*dt)
+          enddo
+       endif
+
+       if (this%ncf == 4) then
+          do iCol=1,nCol
+             ozib(iCol)    = ozi(iCol,iLev)
+             tem           = prod(iCol,1) + prod(iCol,3)*t(iCol,iLev) + prod(iCol,4)*colo3(iCol,iLev+1)
+             oz(iCol,iLev) = (ozib(iCol)  + tem*dt) / (1.0 + prod(iCol,2)*dt)
+          enddo
+       endif
+       ! Diagnostics (optional)
+       if (associated(do3_dt_prd))  do3_dt_prd(:,iLev)  = prod(:,1)*dt
+       if (associated(do3_dt_ozmx)) do3_dt_ozmx(:,iLev) = (oz(:,iLev) - ozib(:))
+       if (associated(do3_dt_temp)) do3_dt_temp(:,iLev) = prod(:,3) * t(:,iLev) * dt
+       if (associated(do3_dt_ohoz)) do3_dt_ohoz(:,iLev) = prod(:,4) * colo3(:,iLev) * dt
+
+    enddo
+
     return
   end subroutine run_o3prog_2006
 
diff --git a/physics/ozphys.f b/physics/ozphys.f
deleted file mode 100644
index 18a9ae46f..000000000
--- a/physics/ozphys.f
+++ /dev/null
@@ -1,211 +0,0 @@
-!> \file ozphys.f
-!! This file is ozone sources and sinks (previous version).
-
-
-!> This module contains the CCPP-compliant Ozone photochemistry scheme.
-      module ozphys
-
-      contains
-
-! \brief Brief description of the subroutine
-!
-!> \section arg_table_ozphys_init Argument Table
-!! \htmlinclude ozphys_init.html
-!!
-      subroutine ozphys_init(oz_phys, errmsg, errflg)
-
-      implicit none
-      logical,          intent(in)  :: oz_phys
-      character(len=*), intent(out) :: errmsg
-      integer,          intent(out) :: errflg
-
-      ! Initialize CCPP error handling variables
-      errmsg = ''
-      errflg = 0
-
-      if (.not.oz_phys) then
-        write (errmsg,'(*(a))') 'Logic error: oz_phys == .false.'
-        errflg = 1
-        return
-      endif
-
-      end subroutine ozphys_init
-
-!>\defgroup GFS_ozphys GFS ozphys Main
-!! \brief The operational GFS currently parameterizes ozone production and
-!! destruction based on monthly mean coefficients (\c global_o3prdlos.f77) provided by Naval
-!! Research Laboratory through CHEM2D chemistry model
-!! (McCormack et al. (2006) \cite mccormack_et_al_2006).
-!! \section arg_table_ozphys_run Argument Table
-!! \htmlinclude ozphys_run.html
-!!
-!> \section genal_ozphys GFS ozphys_run General Algorithm
-!> @{
-      subroutine ozphys_run (                                           &
-     &  im, levs, ko3, dt, oz, tin, po3,                                &
-     &  prsl, prdout, oz_coeff, delp, ldiag3d,                          &
-     &  ntoz, dtend, dtidx, index_of_process_prod_loss,                 &
-     &  index_of_process_ozmix, index_of_process_temp,                  &
-     &  index_of_process_overhead_ozone, con_g, me, errmsg, errflg)
-!
-!     this code assumes that both prsl and po3 are from bottom to top
-!     as are all other variables
-!
-      use machine , only : kind_phys
-      implicit none
-!
-      ! Interface variables
-      integer, intent(in) :: im, levs, ko3, oz_coeff, me
-      real(kind=kind_phys), intent(inout) :: oz(:,:)
-      real(kind=kind_phys), intent(inout) :: dtend(:,:,:)
-      integer, intent(in) :: dtidx(:,:), ntoz,                          &
-     &  index_of_process_prod_loss, index_of_process_ozmix,             &
-     &  index_of_process_temp, index_of_process_overhead_ozone
-      real(kind=kind_phys), intent(in) ::                               &
-     &                     dt, po3(:), prdout(:,:,:),                   &
-     &                     prsl(:,:), tin(:,:), delp(:,:),              &
-     &                     con_g
-      real :: gravi
-      logical, intent(in) :: ldiag3d
-      
-      character(len=*), intent(out) :: errmsg
-      integer,          intent(out) :: errflg
-!
-      ! Local variables
-      integer k,kmax,kmin,l,i,j, idtend(4)
-      logical flg(im)
-      real(kind=kind_phys) pmax, pmin, tem, temp
-      real(kind=kind_phys) wk1(im), wk2(im), wk3(im), prod(im,oz_coeff),
-     &                     ozib(im),  colo3(im,levs+1), ozi(im,levs)
-!
-      ! Initialize CCPP error handling variables
-      errmsg = ''
-      errflg = 0
-!
-!     save input oz in ozi
-      ozi = oz
-      gravi=1.0/con_g
-
-
-      if(ldiag3d) then
-         idtend(1) = dtidx(100+ntoz,index_of_process_prod_loss)          ! was ozp1
-         idtend(2) = dtidx(100+ntoz,index_of_process_ozmix)              ! was ozp2
-         idtend(3) = dtidx(100+ntoz,index_of_process_temp)               ! was ozp3
-         idtend(4) = dtidx(100+ntoz,index_of_process_overhead_ozone)     ! was ozp4
-      else
-         idtend=0
-      endif
-
-!
-!> - Calculate vertical integrated column ozone values.
-      if (oz_coeff > 2) then
-        colo3(:,levs+1) = 0.0
-        do l=levs,1,-1
-          do i=1,im
-            colo3(i,l) = colo3(i,l+1) + ozi(i,l) * delp(i,l) * gravi 
-          enddo
-        enddo
-      endif
-!
-!> - Apply vertically linear interpolation to the ozone coefficients. 
-      do l=1,levs
-        pmin =  1.0e10
-        pmax = -1.0e10
-!
-        do i=1,im
-          wk1(i) = log(prsl(i,l))
-          pmin   = min(wk1(i), pmin)
-          pmax   = max(wk1(i), pmax)
-          prod(i,:) = 0.0
-        enddo
-        kmax = 1
-        kmin = 1
-        do k=1,ko3-1
-          if (pmin < po3(k)) kmax = k
-          if (pmax < po3(k)) kmin = k
-        enddo
-!
-        do k=kmin,kmax
-          temp = 1.0 / (po3(k) - po3(k+1))
-          do i=1,im
-            flg(i) = .false.
-            if (wk1(i) < po3(k) .and. wk1(i) >= po3(k+1)) then
-              flg(i) = .true.
-              wk2(i) = (wk1(i) - po3(k+1)) * temp
-              wk3(i) = 1.0 - wk2(i)
-            endif
-          enddo
-          do j=1,oz_coeff
-            do i=1,im
-              if (flg(i)) then
-                prod(i,j)  = wk2(i) * prdout(i,k,j)
-     &                     + wk3(i) * prdout(i,k+1,j)
-              endif
-            enddo
-          enddo
-        enddo
-!
-        do j=1,oz_coeff
-          do i=1,im
-            if (wk1(i) < po3(ko3)) then
-              prod(i,j) = prdout(i,ko3,j)
-            endif
-            if (wk1(i) >= po3(1)) then
-              prod(i,j) = prdout(i,1,j)
-            endif
-          enddo
-        enddo
-
-        if (oz_coeff == 2) then
-          do i=1,im
-            ozib(i)   = ozi(i,l)           ! no filling
-            oz(i,l)   = (ozib(i) + prod(i,1)*dt) / (1.0 + prod(i,2)*dt)
-          enddo
-!
-          if(idtend(1)>=1) then
-             dtend(:,l,idtend(1)) = dtend(:,l,idtend(1)) +              ! was ozp1
-     &            prod(:,1)*dt
-          endif
-          if(idtend(2)>=1) then
-             dtend(:,l,idtend(2)) = dtend(:,l,idtend(2)) +              ! was ozp2
-     &            (oz(:,l) - ozib(:))
-          endif
-        endif
-!> - Calculate the 4 terms of prognostic ozone change during time \a dt:  
-!!  - ozp1(:,:) - Ozone production from production/loss ratio 
-!!  - ozp2(:,:) - Ozone production from ozone mixing ratio 
-!!  - ozp3(:,:) - Ozone production from temperature term at model layers 
-!!  - ozp4(:,:) - Ozone production from column ozone term at model layers
-        if (oz_coeff == 4) then
-          do i=1,im
-            ozib(i)  = ozi(i,l)            ! no filling
-            tem      = prod(i,1) + prod(i,3)*tin(i,l)
-     &                           + prod(i,4)*colo3(i,l+1)
-!     if (me .eq. 0) print *,'ozphys tem=',tem,' prod=',prod(i,:)
-!    &,' ozib=',ozib(i),' l=',l,' tin=',tin(i,l),'colo3=',colo3(i,l+1)
-            oz(i,l) = (ozib(i)  + tem*dt) / (1.0 + prod(i,2)*dt)
-          enddo
-          if(idtend(1)>=1) then
-            dtend(:,l,idtend(1)) = dtend(:,l,idtend(1)) +              ! was ozp1
-     &            prod(:,1)*dt
-          endif
-          if(idtend(2)>=1) then
-            dtend(:,l,idtend(2)) = dtend(:,l,idtend(2)) +              ! was ozp2
-     &            (oz(:,l)-ozib(:))
-          endif
-          if(idtend(3)>=1) then
-            dtend(:,l,idtend(3)) = dtend(:,l,idtend(3)) +              ! was ozp3
-     &            prod(:,3)*tin(:,l)*dt
-          endif
-          if(idtend(4)>=1) then
-            dtend(:,l,idtend(4)) = dtend(:,l,idtend(4)) +              ! was ozp4
-     &            prod(:,4)*colo3(:,l+1)*dt
-          endif
-        endif
-      enddo                                ! vertical loop
-!
-      return
-      end subroutine ozphys_run
-!> @}
-
-      end module ozphys
diff --git a/physics/ozphys.meta b/physics/ozphys.meta
deleted file mode 100644
index 485e2a491..000000000
--- a/physics/ozphys.meta
+++ /dev/null
@@ -1,208 +0,0 @@
-[ccpp-table-properties]
-  name = ozphys
-  type = scheme
-  dependencies = machine.F
-
-########################################################################
-[ccpp-arg-table]
-  name = ozphys_init
-  type = scheme
-[oz_phys]
-  standard_name = flag_for_nrl_2006_ozone_scheme
-  long_name = flag for old (2006) ozone physics
-  units = flag
-  dimensions = ()
-  type = logical
-  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
-
-########################################################################
-[ccpp-arg-table]
-  name = ozphys_run
-  type = scheme
-[im]
-  standard_name = horizontal_loop_extent
-  long_name = horizontal loop extent
-  units = count
-  dimensions = ()
-  type = integer
-  intent = in
-[levs]
-  standard_name = vertical_layer_dimension
-  long_name = number of vertical layers
-  units = count
-  dimensions = ()
-  type = integer
-  intent = in
-[ko3]
-  standard_name = vertical_dimension_of_ozone_forcing_data
-  long_name = number of vertical layers in ozone forcing data
-  units = count
-  dimensions = ()
-  type = integer
-  intent = in
-[dt]
-  standard_name = timestep_for_physics
-  long_name = physics time step
-  units = s
-  dimensions = ()
-  type = real
-  kind = kind_phys
-  intent = in
-[oz]
-  standard_name = ozone_concentration_of_new_state
-  long_name = ozone concentration updated by physics
-  units = kg kg-1
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = inout
-[tin]
-  standard_name = air_temperature_of_new_state
-  long_name = updated air temperature
-  units = K
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[po3]
-  standard_name = natural_log_of_ozone_forcing_data_pressure_levels
-  long_name = natural log of ozone forcing data pressure levels
-  units = 1
-  dimensions = (vertical_dimension_of_ozone_forcing_data)
-  type = real
-  kind = kind_phys
-  intent = in
-[prsl]
-  standard_name = air_pressure
-  long_name = mid-layer pressure
-  units = Pa
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[prdout]
-  standard_name = ozone_forcing
-  long_name = ozone forcing coefficients
-  units = mixed
-  dimensions = (horizontal_loop_extent,vertical_dimension_of_ozone_forcing_data,number_of_coefficients_in_ozone_forcing_data)
-  type = real
-  kind = kind_phys
-  intent = in
-[oz_coeff]
-  standard_name = number_of_coefficients_in_ozone_forcing_data
-  long_name = number of coefficients in ozone forcing data
-  units = index
-  dimensions = ()
-  type = integer
-  intent = in
-[delp]
-  standard_name = air_pressure_difference_between_midlayers
-  long_name = difference between mid-layer pressures
-  units = Pa
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension)
-  type = real
-  kind = kind_phys
-  intent = in
-[ldiag3d]
-  standard_name = flag_for_diagnostics_3D
-  long_name = flag for calculating 3-D diagnostic fields
-  units = flag
-  dimensions = ()
-  type = logical
-  intent = in
-[dtend]
-  standard_name = cumulative_change_of_state_variables
-  long_name = diagnostic tendencies for state variables
-  units = mixed
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension,cumulative_change_of_state_variables_outer_index_max)
-  type = real
-  kind = kind_phys
-  active = (flag_for_diagnostics_3D)
-  intent = inout
-[dtidx]
-  standard_name = cumulative_change_of_state_variables_outer_index
-  long_name = index of state-variable and process in last dimension of diagnostic tendencies array AKA cumulative_change_index
-  units = index
-  dimensions = (number_of_tracers_plus_one_hundred,number_of_cumulative_change_processes)
-  type = integer
-  intent = in
-[ntoz]
-  standard_name = index_of_ozone_mixing_ratio_in_tracer_concentration_array
-  long_name = tracer index for ozone mixing ratio
-  units = index
-  dimensions = ()
-  type = integer
-  intent = in
-[index_of_process_prod_loss]
-  standard_name = index_of_production_and_loss_process_in_cumulative_change_index
-  long_name = index of production and loss effect in photochemistry process in second dimension of array cumulative change index
-  units = index
-  dimensions = ()
-  type = integer
-  intent = in
-[index_of_process_ozmix]
-  standard_name = index_of_ozone_mixing_ratio_process_in_cumulative_change_index
-  long_name = index of ozone mixing ratio effect in photochemistry process in second dimension of array cumulative change index
-  units = index
-  dimensions = ()
-  type = integer
-  intent = in
-[index_of_process_temp]
-  standard_name = index_of_temperature_process_in_cumulative_change_index
-  long_name = index of temperature effect in photochemistry process in second dimension of array cumulative change index
-  units = index
-  dimensions = ()
-  type = integer
-  intent = in
-[index_of_process_overhead_ozone]
-  standard_name = index_of_overhead_process_in_cumulative_change_index
-  long_name = index of overhead ozone effect in photochemistry process in second dimension of array cumulative change index
-  units = index
-  dimensions = ()
-  type = integer
-  intent = in
-[con_g]
-  standard_name = gravitational_acceleration
-  long_name = gravitational acceleration
-  units = m s-2
-  dimensions = ()
-  type = real
-  kind = kind_phys
-  intent = in
-[me]
-  standard_name = mpi_rank
-  long_name = rank of the current MPI task
-  units = index
-  dimensions = ()
-  type = integer
-  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

From a55ce5e69e85d93e6b28b303a92c9ad7087aad08 Mon Sep 17 00:00:00 2001
From: "Samuel Trahan (NOAA contractor)"
 <39415369+SamuelTrahanNOAA@users.noreply.github.com>
Date: Thu, 28 Sep 2023 12:09:44 -0400
Subject: [PATCH 102/115] z => dz

---
 physics/clm_lake.f90 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/physics/clm_lake.f90 b/physics/clm_lake.f90
index da4712810..620f79a96 100644
--- a/physics/clm_lake.f90
+++ b/physics/clm_lake.f90
@@ -551,7 +551,7 @@ SUBROUTINE clm_lake_run( &
 
            do c = 2,column
              z_lake(c,:) = z_lake(1,:)
-             dz_lake(c,:) = z_lake(1,:)
+             dz_lake(c,:) = dz_lake(1,:)
            enddo
 
            ! Soil hydraulic and thermal properties

From 00d90608a08f13ac367f2c002b8ae18eea4e8f6b Mon Sep 17 00:00:00 2001
From: Dustin Swales <dustin.swales@noaa.gov>
Date: Thu, 28 Sep 2023 17:19:33 +0000
Subject: [PATCH 103/115] Added documentation

---
 physics/GFS_physics_post.F90 |  12 +++-
 physics/module_ozphys.F90    | 119 +++++++++++++++++++++++------------
 2 files changed, 87 insertions(+), 44 deletions(-)

diff --git a/physics/GFS_physics_post.F90 b/physics/GFS_physics_post.F90
index d034c1999..e6a50cc3a 100644
--- a/physics/GFS_physics_post.F90
+++ b/physics/GFS_physics_post.F90
@@ -1,6 +1,11 @@
 ! ###########################################################################################
 !> \file GFS_physics_post.F90
 !!
+!! This module contains GFS specific calculations (e.g. diagnostics) and suite specific
+!! code (e.g Saving fields for subsequent physics timesteps).  For interoperability across a 
+!! wide range of hosts, CCPP compliant schemes should avoid including such calculations. This 
+!! module/scheme is intended for such "host-specific" computations.
+!!
 ! ###########################################################################################
 module GFS_physics_post
   use machine, only : kind_phys, kind_dbl_prec, kind_sngl_prec
@@ -30,9 +35,10 @@ end subroutine GFS_physics_post_init
 !! \section arg_table_GFS_physics_post_run Argument Table
 !! \htmlinclude GFS_physics_post_run.html
 !!
-  subroutine GFS_physics_post_run(nCol, nLev, ntoz, dtidx, ip_prod_loss, ip_ozmix,   &
-       ip_temp, ip_overhead_ozone, do3_dt_prd, do3_dt_ozmx, do3_dt_temp, do3_dt_ohoz, dtend,&
-       errmsg, errflg)
+  subroutine GFS_physics_post_run(nCol, nLev, ntoz, dtidx, ip_prod_loss, ip_ozmix, ip_temp, &
+       ip_overhead_ozone, do3_dt_prd, do3_dt_ozmx, do3_dt_temp, do3_dt_ohoz, dtend, errmsg, &
+       errflg)
+
     ! Inputs
     integer, intent(in) :: &
          nCol,           & ! Horizontal dimension
diff --git a/physics/module_ozphys.F90 b/physics/module_ozphys.F90
index d24585d4d..f824736b1 100644
--- a/physics/module_ozphys.F90
+++ b/physics/module_ozphys.F90
@@ -2,6 +2,39 @@
 !> \section arg_table_module_ozphys Argument table                               
 !! \htmlinclude module_ozphys.html                                               
 !!
+!
+!> The operational GFS currently parameterizes ozone production and destruction based on 
+!! monthly mean coefficients (\c global_o3prdlos.f77) provided by Naval Research Laboratory
+!! through CHEM2D chemistry model (McCormack et al. (2006) \cite mccormack_et_al_2006).
+!!
+!! There are two implementations of this parameterization within this module.
+!! run_o3prog_2006 - Relies on either two/four mean monthly coefficients. This is explained
+!!                   in (https://doi.org/10.5194/acp-6-4943-2006. See Eq.(4)).
+!! run_o3prog_2015 - Relies on six mean monthly coefficients, specifically for NRL 
+!!                   parameterization and climatological T and O3 are in location 5 and 6 of
+!!                   the coefficient array.
+!! 
+!! Both of these rely on the scheme being setup correctly by invoking the load(), setup(), 
+!! and update() procedures prior to calling the run() procedure.
+!!
+!! load_o3prog()   - Read in data and load into type ty_ozphys (called once from host)
+!! setup_o3prog()  - Create spatial interpolation indices      (called once, after model grid is known)
+!! update_o3prog() - Update ozone concentration in time        (call in physics loop, before run())
+!!                   *CAVEAT* Since the radiation is often run at a lower temporal resolution
+!!                            than the rest of the physics, update_o3prog() needs to be
+!!                            called before the radiation, which is called before the physics.
+!!                            For example, within the physics loop:
+!!                                update_o3prog() -> radiation() -> run_o3prog() -> physics....
+!!
+!! Additionally, there is the functionality to not use interactive ozone, instead reverting
+!! to ozone climatology. In this case, analagous to when using prognostic ozone, there are
+!! update() and run() procedures that need to be called before the radiation.
+!! For example, within the physics loop:
+!!     update_o3clim() -> run_o3clim() -> radiation() -> physics...
+!!
+!!\author   June 2015 - Shrinivas Moorthi
+!!\modified Sep  2023 - Dustin Swales
+!!
 ! #########################################################################################
 module module_ozphys
   use machine,  only : kind_phys
@@ -14,7 +47,8 @@ module module_ozphys
 !> \section arg_table_ty_ozphys Argument Table 
 !! \htmlinclude ty_ozphys.html
 !!
-!! All data field are ordered from surface-to-toa (j=1=isfc)
+!> Derived type containing data and procedures needed by ozone photochemistry parameterization
+!! *Note* All data field are ordered from surface-to-toa.
 !!
 ! #########################################################################################
   type ty_ozphys
@@ -54,7 +88,7 @@ module module_ozphys
   
 contains
   ! #########################################################################################
-  ! Procedure (type-bound) for loading ozone forcing data.
+  ! Procedure (type-bound) for loading data for prognostic ozone.
   ! #########################################################################################
   function load_o3prog(this, file, fileID) result (err_message)
     class(ty_ozphys), intent(inout) :: this
@@ -101,7 +135,9 @@ function load_o3prog(this, file, fileID) result (err_message)
   end function load_o3prog
 
   ! #########################################################################################
-  ! Procedure for setting up interpolation indices between data and model grid.
+  ! Procedure (type-bound) for setting up interpolation indices between data-grid and 
+  ! model-grid. 
+  ! Called once during initialization
   ! #########################################################################################
   subroutine setup_o3prog(this, lat, idx1, idx2, idxh)
     class(ty_ozphys), intent(in)  :: this
@@ -130,7 +166,7 @@ subroutine setup_o3prog(this, lat, idx1, idx2, idxh)
   end subroutine setup_o3prog
 
   ! #########################################################################################
-  ! Procedure (type-bound) for updating ozone data.
+  ! Procedure (type-bound) for updating data used in prognostic ozone scheme.
   ! #########################################################################################
   subroutine update_o3prog(this, idx1, idx2, idxh, rjday, idxt1, idxt2, ozpl)
     class(ty_ozphys), intent(in)  :: this
@@ -474,7 +510,7 @@ subroutine run_o3clim(this, lat, prslk, con_pi, oz)
   end subroutine run_o3clim
 
   ! #########################################################################################
-  ! Procedure (type-bound) for loading ozone climo data.
+  ! Procedure (type-bound) for loading data for climotological ozone.
   ! #########################################################################################
   function load_o3clim(this, file, fileID) result (err_message)
     class(ty_ozphys), intent(inout) :: this
@@ -546,46 +582,47 @@ function load_o3clim(this, file, fileID) result (err_message)
         this%pstr(iLev)  = pstr4(iLev)
         this%pkstr(iLev) = fpkapx(this%pstr(iLev)*100.0)
      enddo
-
+     
    end function load_o3clim
 
-  ! #########################################################################################
-  ! Procedure (type-bound) for updating ozone climotological data.
-  ! #########################################################################################
-  subroutine update_o3clim(this, imon, iday, ihour, loz1st)
-    class(ty_ozphys), intent(inout) :: this
-    integer, intent(in) :: imon, iday, ihour
-    logical, intent(in) :: loz1st
-
-    integer ::  midmon=15, midm=15, midp=45, id
-    integer, parameter, dimension(13) :: mdays = (/31,28,31,30,31,30,31,31,30,31,30,31,30/)
-    logical :: change
-
-    midmon = mdays(imon)/2 + 1
-    change = loz1st .or. ( (iday==midmon) .and. (ihour==0) )
+   ! #########################################################################################
+   ! Procedure (type-bound) for updating temporal interpolation index when using climotological
+   ! ozone
+   ! #########################################################################################
+   subroutine update_o3clim(this, imon, iday, ihour, loz1st)
+     class(ty_ozphys), intent(inout) :: this
+     integer, intent(in) :: imon, iday, ihour
+     logical, intent(in) :: loz1st
+
+     integer ::  midmon=15, midm=15, midp=45, id
+     integer, parameter, dimension(13) :: mdays = (/31,28,31,30,31,30,31,31,30,31,30,31,30/)
+     logical :: change
+
+     midmon = mdays(imon)/2 + 1
+     change = loz1st .or. ( (iday==midmon) .and. (ihour==0) )
     
-    if ( change ) then
-       if ( iday < midmon ) then
-          this%k1oz = mod(imon+10, 12) + 1
-          midm = mdays(this%k1oz)/2 + 1
-          this%k2oz = imon
-          midp = mdays(this%k1oz) + midmon
-       else
-          this%k1oz = imon
-          midm = midmon
-          this%k2oz = mod(imon, 12) + 1
-          midp = mdays(this%k2oz)/2 + 1 + mdays(this%k1oz)
-       endif
-    endif
+     if ( change ) then
+        if ( iday < midmon ) then
+           this%k1oz = mod(imon+10, 12) + 1
+           midm = mdays(this%k1oz)/2 + 1
+           this%k2oz = imon
+           midp = mdays(this%k1oz) + midmon
+        else
+           this%k1oz = imon
+           midm = midmon
+           this%k2oz = mod(imon, 12) + 1
+           midp = mdays(this%k2oz)/2 + 1 + mdays(this%k1oz)
+        endif
+     endif
     
-    if (iday < midmon) then
-       id = iday + mdays(this%k1oz)
-    else
-       id = iday
-    endif
+     if (iday < midmon) then
+        id = iday + mdays(this%k1oz)
+     else
+        id = iday
+     endif
     
-    this%facoz = float(id - midm) / float(midp - midm)
+     this%facoz = float(id - midm) / float(midp - midm)
 
-  end subroutine update_o3clim
+   end subroutine update_o3clim
 
-end module module_ozphys
+ end module module_ozphys

From ab4d5f1206d5bb8a7550682612a84bf77e0bdbdc Mon Sep 17 00:00:00 2001
From: "Haiqin.Li" <Haiqin.Li@noaa.gov>
Date: Fri, 29 Sep 2023 02:49:39 +0000
Subject: [PATCH 104/115] "correct the dimension of soil moisture for dust
 emission"

---
 physics/smoke_dust/rrfs_smoke_wrapper.meta | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/physics/smoke_dust/rrfs_smoke_wrapper.meta b/physics/smoke_dust/rrfs_smoke_wrapper.meta
index a0a641246..cddc20fbc 100755
--- a/physics/smoke_dust/rrfs_smoke_wrapper.meta
+++ b/physics/smoke_dust/rrfs_smoke_wrapper.meta
@@ -220,7 +220,7 @@
   standard_name = volume_fraction_of_soil_moisture_for_land_surface_model
   long_name = volumetric fraction of soil moisture for lsm
   units = frac
-  dimensions = (horizontal_dimension,vertical_dimension_of_soil_internal_to_land_surface_scheme)
+  dimensions = (horizontal_loop_extent,vertical_dimension_of_soil_internal_to_land_surface_scheme)
   type = real
   kind = kind_phys
   intent = inout

From e08ecd648a3f984a79e1dfd042f66edfbfb54d62 Mon Sep 17 00:00:00 2001
From: Helin Wei <Helin.Wei@noaa.gov>
Date: Fri, 6 Oct 2023 15:07:48 -0400
Subject: [PATCH 105/115] land surface updates for hr3

---
 physics/module_sf_noahmplsm.F90 | 15 +++++++++------
 physics/noahmpdrv.F90           |  2 +-
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/physics/module_sf_noahmplsm.F90 b/physics/module_sf_noahmplsm.F90
index 86853dabe..8ced8930f 100644
--- a/physics/module_sf_noahmplsm.F90
+++ b/physics/module_sf_noahmplsm.F90
@@ -2116,7 +2116,7 @@ subroutine energy (parameters,ice    ,vegtyp ,ist    ,nsnow  ,nsoil  , & !in
 ! thermal properties of soil, snow, lake, and frozen soil
 
   call thermoprop (parameters,nsoil   ,nsnow   ,isnow   ,ist     ,dzsnso  , & !in
-                   dt      ,snowh   ,snice   ,snliq   , & !in
+                   dt      ,snowh   ,snice   ,snliq   , shdfac, & !in
                    smc     ,sh2o    ,tg      ,stc     ,ur      , & !in
                    lat     ,z0m     ,zlvl    ,vegtyp  ,  & !in
                    df      ,hcpct   ,snicev  ,snliqv  ,epore   , & !out
@@ -2463,7 +2463,7 @@ end subroutine energy
 
 !>\ingroup NoahMP_LSM
   subroutine thermoprop (parameters,nsoil   ,nsnow   ,isnow   ,ist     ,dzsnso  , & !in
-                         dt      ,snowh   ,snice   ,snliq   , & !in
+                         dt      ,snowh   ,snice   ,snliq   , shdfac,   & !in
                          smc     ,sh2o    ,tg      ,stc     ,ur      , & !in
                          lat     ,z0m     ,zlvl    ,vegtyp  , & !in
                          df      ,hcpct   ,snicev  ,snliqv  ,epore   , & !out
@@ -2480,6 +2480,7 @@ subroutine thermoprop (parameters,nsoil   ,nsnow   ,isnow   ,ist     ,dzsnso  ,
   real (kind=kind_phys)                           , intent(in)  :: dt      !< time step [s]
   real (kind=kind_phys), dimension(-nsnow+1:    0), intent(in)  :: snice   !< snow ice mass (kg/m2)
   real (kind=kind_phys), dimension(-nsnow+1:    0), intent(in)  :: snliq   !< snow liq mass (kg/m2)
+  real (kind=kind_phys)                           , intent(in)  :: shdfac !< green vegetation fraction [0.0-1.0]
   real (kind=kind_phys), dimension(-nsnow+1:nsoil), intent(in)  :: dzsnso  !< thickness of snow/soil layers [m]
   real (kind=kind_phys), dimension(       1:nsoil), intent(in)  :: smc     !< soil moisture (ice + liq.) [m3/m3]
   real (kind=kind_phys), dimension(       1:nsoil), intent(in)  :: sh2o    !< liquid soil moisture [m3/m3]
@@ -2539,6 +2540,7 @@ subroutine thermoprop (parameters,nsoil   ,nsnow   ,isnow   ,ist     ,dzsnso  ,
 ! not in use because of the separation of the canopy layer from the ground.
 ! but this may represent the effects of leaf litter (niu comments)
 !       df1 = df1 * exp (sbeta * shdfac)
+        df(1) = df(1) * exp (sbeta * shdfac)
 
 ! compute lake thermal properties 
 ! (no consideration of turbulent mixing for this version)
@@ -4888,7 +4890,7 @@ subroutine bare_flux (parameters,nsnow   ,nsoil   ,isnow   ,dt      ,sag     , &
      end if
     endif ! 4
 
-! use sfc_diag to calculate t2mv and q2v for opt_sfc=1&3
+! use sfc_diag to calculate t2mb and q2b for opt_sfc=1&3
     if(opt_diag ==3) then
      if(opt_sfc == 1 .or. opt_sfc == 3) then
 
@@ -5823,7 +5825,8 @@ subroutine thermalz0(parameters,    fveg,          z0m, z0mg,       zlvl,
 
       elseif (opt_trs == chen09) then
 
-        z0m_out = exp(fveg * log(z0m)      + (1.0 - fveg) * log(z0mg))
+!       z0m_out = exp(fveg * log(z0m)      + (1.0 - fveg) * log(z0mg))
+!       z0m_out = fveg * z0m      + (1.0 - fveg) * z0mg
         czil    = 10.0 ** (- 0.4 * parameters%hvt)
 
         reyn = ustarx*z0m_out/viscosity                      ! Blumel99 eqn 36c
@@ -5873,7 +5876,7 @@ subroutine thermalz0(parameters,    fveg,          z0m, z0mg,       zlvl,
 
         z0h_out = z0m_out
 
-      elseif (opt_trs == tessel) then
+      elseif (opt_trs == chen09 .or. opt_trs == tessel) then
 
         if (vegtyp <= 5) then
           z0h_out = z0m_out
@@ -5881,7 +5884,7 @@ subroutine thermalz0(parameters,    fveg,          z0m, z0mg,       zlvl,
           z0h_out = z0m_out * 0.01
         endif
 
-      elseif (opt_trs == blumel99 .or. opt_trs == chen09) then
+      elseif (opt_trs == blumel99) then
 
         reyn = ustarx*z0m_out/viscosity                      ! Blumel99 eqn 36c
         if (reyn > 2.0) then
diff --git a/physics/noahmpdrv.F90 b/physics/noahmpdrv.F90
index 4500d51a8..c2c03d0de 100644
--- a/physics/noahmpdrv.F90
+++ b/physics/noahmpdrv.F90
@@ -450,7 +450,7 @@ subroutine noahmpdrv_run                                       &
   integer    :: iopt_pedo = 1 ! option for pedotransfer function
   integer    :: iopt_crop = 0 ! option for crop model
   integer    :: iopt_gla  = 2 ! option for glacier treatment
-  integer    :: iopt_z0m  = 2 ! option for z0m treatment
+  integer    :: iopt_z0m  = 1 ! option for z0m treatment
 
 !
 !  ---  local inputs to noah-mp and glacier subroutines; listed in order in noah-mp call

From 4f8004ab57b85d76884858849a5f4211f28d3084 Mon Sep 17 00:00:00 2001
From: Helin Wei <Helin.Wei@noaa.gov>
Date: Fri, 6 Oct 2023 18:05:17 -0400
Subject: [PATCH 106/115] remove one printout from sfcsub.f and uncomment z0m
 composition in module_sf_noahmplsm.F90

---
 physics/module_sf_noahmplsm.F90 | 2 +-
 physics/sfcsub.F                | 3 ---
 2 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/physics/module_sf_noahmplsm.F90 b/physics/module_sf_noahmplsm.F90
index 8ced8930f..6abd59f69 100644
--- a/physics/module_sf_noahmplsm.F90
+++ b/physics/module_sf_noahmplsm.F90
@@ -5826,7 +5826,7 @@ subroutine thermalz0(parameters,    fveg,          z0m, z0mg,       zlvl,
       elseif (opt_trs == chen09) then
 
 !       z0m_out = exp(fveg * log(z0m)      + (1.0 - fveg) * log(z0mg))
-!       z0m_out = fveg * z0m      + (1.0 - fveg) * z0mg
+        z0m_out = fveg * z0m      + (1.0 - fveg) * z0mg
         czil    = 10.0 ** (- 0.4 * parameters%hvt)
 
         reyn = ustarx*z0m_out/viscosity                      ! Blumel99 eqn 36c
diff --git a/physics/sfcsub.F b/physics/sfcsub.F
index 7be07b39c..494b8f7dc 100644
--- a/physics/sfcsub.F
+++ b/physics/sfcsub.F
@@ -7491,9 +7491,6 @@ subroutine clima(lugb,iy,im,id,ih,fh,len,lsoil,slmskl,slmskw,     &
           endif
           call abort
         endif
-!
-!  soil type
-        print *,'in FIXREAD fnsotc =',fnsotc 
 !
         if(fnsotc(1:8).ne.'        ') then
           if ( index(fnsotc, "tileX.nc") == 0) then ! grib file

From 5bd6da748d22564212a448ba0e143fb8ada23722 Mon Sep 17 00:00:00 2001
From: Ted Mansell <ted.mansell@noaa.gov>
Date: Wed, 11 Oct 2023 14:21:32 -0500
Subject: [PATCH 107/115]  Set initial values for some constants (just in case)

---
 physics/module_mp_nssl_2mom.F90 | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/physics/module_mp_nssl_2mom.F90 b/physics/module_mp_nssl_2mom.F90
index a40a62f02..a88ffe053 100644
--- a/physics/module_mp_nssl_2mom.F90
+++ b/physics/module_mp_nssl_2mom.F90
@@ -951,19 +951,20 @@ MODULE module_mp_nssl_2mom
       real, parameter :: cawbolton = 17.67
 
       real, parameter :: tfrh = 233.15
+! --------------------------
+      ! For CCPP, the following variables should be set by the host model, but initial values are set just in case
       real :: tfr = 273.15
-
       real :: cp = 1004.0, rd = 287.04
       real :: rw = 461.5              ! gas const. for water vapor
-      REAL, PRIVATE ::      cpl = 4190.0
-      REAL, PRIVATE ::      cpigb = 2106.0
-      real :: cpi 
-      real :: cap 
-      real :: tfrcbw
-      real :: tfrcbi
-      real :: rovcp
-      real, public :: rdorv = 0.622
-
+      real :: cpl = 4190.0
+      real :: cpigb = 2106.0
+      real :: cpi = 1.0/1004.0
+      real :: cap = 287.04/1004.0
+      real :: tfrcbw = 273.15 - cbw
+      real :: tfrcbi = 273.15 - cbi
+      real :: rovcp = 287.04/1004.0
+      real :: rdorv = 0.622
+! --------------------------
       real, parameter :: poo = 1.0e+05
       real, parameter :: advisc0 = 1.832e-05     ! reference dynamic viscosity (SMT; see Beard & Pruppacher 71)
       real, parameter :: advisc1 = 1.718e-05     ! dynamic viscosity constant used in thermal conductivity calc
@@ -4113,7 +4114,7 @@ subroutine hailmaxd(dtp,nx,ny,nz,an,na,nor,norz,alpha2d,dn,  &
           g1palp = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
 
           tmp = dn(ix,jy,kz)*an(ix,jy,kz,lh)/(hwdn*an(ix,jy,kz,lnh))
-          diam = (6.0*tmp/(3.14159))**(1./3.)
+          diam = (6.0*tmp/pi)**(1./3.)
           IF ( lzh > 1 ) THEN ! 3moment
             cwchtmp = ((3. + alpha2d(ix,1,kz,2))*(2. + alpha2d(ix,1,kz,2))*(1.0 + alpha2d(ix,1,kz,2)))**(-1./3.)
           ENDIF
@@ -4184,7 +4185,7 @@ subroutine hailmaxd(dtp,nx,ny,nz,an,na,nor,norz,alpha2d,dn,  &
           g1palp = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
 
           tmp = dn(ix,jy,kz)*an(ix,jy,kz,lhl)/(hwdn*an(ix,jy,kz,lnhl))
-          diam = (6.0*tmp/(3.14159))**(1./3.)
+          diam = (6.0*tmp/pi)**(1./3.)
           IF ( lzhl > 1 ) THEN ! 3moment
             cwchltmp = ((3. + alpha2d(ix,1,kz,3))*(2. + alpha2d(ix,1,kz,3))*(1.0 + alpha2d(ix,1,kz,3)))**(-1./3.)
           ENDIF

From 1b2239714a949341409261ebbfb8a0bdf6a4f5da Mon Sep 17 00:00:00 2001
From: Dustin Swales <dustin.swales@noaa.gov>
Date: Thu, 12 Oct 2023 03:40:06 +0000
Subject: [PATCH 108/115] Some more cleanup

---
 physics/GFS_physics_post.F90  | 99 ++++++++++++++++++++++++++++++-----
 physics/GFS_physics_post.meta | 49 +++++++++++++++++
 physics/phys_tend.F90         | 96 ---------------------------------
 physics/phys_tend.meta        | 95 ---------------------------------
 4 files changed, 134 insertions(+), 205 deletions(-)
 delete mode 100644 physics/phys_tend.F90
 delete mode 100644 physics/phys_tend.meta

diff --git a/physics/GFS_physics_post.F90 b/physics/GFS_physics_post.F90
index e6a50cc3a..def38cd1a 100644
--- a/physics/GFS_physics_post.F90
+++ b/physics/GFS_physics_post.F90
@@ -35,47 +35,62 @@ end subroutine GFS_physics_post_init
 !! \section arg_table_GFS_physics_post_run Argument Table
 !! \htmlinclude GFS_physics_post_run.html
 !!
-  subroutine GFS_physics_post_run(nCol, nLev, ntoz, dtidx, ip_prod_loss, ip_ozmix, ip_temp, &
-       ip_overhead_ozone, do3_dt_prd, do3_dt_ozmx, do3_dt_temp, do3_dt_ohoz, dtend, errmsg, &
-       errflg)
+  subroutine GFS_physics_post_run(nCol, nLev, ntoz, ntracp100, nprocess, nprocess_summed,   &
+       dtidx, is_photochem, ldiag3d, ip_physics, ip_photochem,         &
+       ip_prod_loss, ip_ozmix, ip_temp, ip_overhead_ozone, do3_dt_prd, do3_dt_ozmx,         &
+       do3_dt_temp, do3_dt_ohoz, dtend, errmsg, errflg)
 
     ! Inputs
     integer, intent(in) :: &
          nCol,           & ! Horizontal dimension
          nLev,           & ! Number of vertical layers
          ntoz,           & ! Index for ozone mixing ratio
+         ntracp100,      & ! Number of tracers plus 100
+         nprocess,       & ! Number of processes that cause changes in state variables 
+         nprocess_summed,& ! Number of causes in dtidx per tracer summed for total physics tendency
+         ip_physics,     & ! Index for process in diagnostic tendency output
+         ip_photochem,   & ! 
          ip_prod_loss,   & ! Index for process in diagnostic tendency output
          ip_ozmix,       & ! Index for process in diagnostic tendency output
          ip_temp,        & ! Index for process in diagnostic tendency output
          ip_overhead_ozone ! Index for process in diagnostic tendency output    
     integer, intent(in), dimension(:,:) :: &
          dtidx             ! Bookkeeping indices for GFS diagnostic tendencies
+    logical, intent(in) :: &
+         ldiag3d           ! Flag for 3d diagnostic fields
+    logical, intent(in), dimension(:) :: &
+         is_photochem      ! Flags for photochemistry processes to sum
 
     ! Inputs (optional)
     real(kind=kind_phys), intent(in), dimension(:,:), pointer, optional :: &
-         do3_dt_prd,  & ! Physics tendency: production and loss effect
-         do3_dt_ozmx, & ! Physics tendency: ozone mixing ratio effect
-         do3_dt_temp, & ! Physics tendency: temperature effect
-         do3_dt_ohoz    ! Physics tendency: overhead ozone effect
+         do3_dt_prd,     & ! Physics tendency: production and loss effect
+         do3_dt_ozmx,    & ! Physics tendency: ozone mixing ratio effect
+         do3_dt_temp,    & ! Physics tendency: temperature effect
+         do3_dt_ohoz       ! Physics tendency: overhead ozone effect
 
     ! Outputs
     real(kind=kind_phys), intent(inout), dimension(:,:,:) :: &
-         dtend          ! Diagnostic tendencies for state variables
+         dtend             ! Diagnostic tendencies for state variables
     character(len=*), intent(out) :: &
-         errmsg         ! CCPP error message
+         errmsg            ! CCPP error message
     integer, intent(out) :: &
-         errflg         ! CCPP error flag
+         errflg            ! CCPP error flag
 
     ! Locals
-    integer :: idtend
-    
+    integer :: idtend, ichem, iphys, itrac
+    logical :: all_true(nprocess)
+
     ! Initialize CCPP error handling variables
     errmsg = ''
     errflg = 0
 
+    if(.not.ldiag3d) then
+       return
+    endif
+
     ! #######################################################################################
     !
-    ! Ozone physics diagnostic
+    ! Ozone physics diagnostics
     !
     ! #######################################################################################
     idtend = dtidx(100+ntoz,ip_prod_loss)
@@ -98,6 +113,62 @@ subroutine GFS_physics_post_run(nCol, nLev, ntoz, dtidx, ip_prod_loss, ip_ozmix,
        dtend(:,:,idtend) = dtend(:,:,idtend) + do3_dt_ohoz
     endif
 
-  end subroutine GFS_physics_post_run
+    ! #######################################################################################
+    !
+    ! Total (photochemical) tendencies.
+    !
+    ! #######################################################################################
+    itrac = ntoz+100
+    ichem = dtidx(itrac, ip_photochem)
+    if(ichem >= 1) then
+       call sum_it(ichem, itrac, is_photochem)
+    endif
 
+    ! #######################################################################################
+    !
+    ! Total (physics) tendencies
+    !
+    ! #######################################################################################
+    all_true = .true.
+    do itrac = 2,ntracp100
+       iphys = dtidx(itrac,ip_physics)
+       if(iphys >= 1) then
+          call sum_it(iphys, itrac, all_true)
+       endif
+    enddo
+
+  contains
+
+    subroutine sum_it(isum,itrac,sum_me)
+      integer, intent(in) :: isum ! third index of dtend of summary process
+      integer, intent(in) :: itrac ! tracer or state variable being summed
+      logical, intent(in) :: sum_me(nprocess) ! false = skip this process
+      logical :: first
+      integer :: idtend, iprocess
+
+      first=.true.
+      do iprocess=1,nprocess
+         if(iprocess>nprocess_summed) then
+            exit ! Don't sum up the sums.
+         else if(.not.sum_me(iprocess)) then
+            cycle ! We were asked to skip this one.
+         endif
+         idtend = dtidx(itrac,iprocess)
+         if(idtend>=1) then
+            ! This tendency was calculated for this tracer, so
+            ! accumulate it into the total tendency.
+            if(first) then
+               dtend(:,:,isum) = dtend(:,:,idtend)
+               first=.false.
+            else
+               dtend(:,:,isum) = dtend(:,:,isum) + dtend(:,:,idtend)
+            endif
+         endif
+      enddo
+      if(first) then
+         ! No tendencies were calculated, so sum is 0:
+         dtend(:,:,isum) = 0
+      endif
+    end subroutine sum_it
+  end subroutine GFS_physics_post_run
 end module GFS_physics_post
diff --git a/physics/GFS_physics_post.meta b/physics/GFS_physics_post.meta
index 8b5120b9e..649ef6491 100644
--- a/physics/GFS_physics_post.meta
+++ b/physics/GFS_physics_post.meta
@@ -63,6 +63,55 @@
   dimensions = ()
   type = integer
   intent = in
+[ntracp100]
+  standard_name = number_of_tracers_plus_one_hundred
+  long_name = number of tracers plus one hundred
+  units = count
+  dimensions = ()
+  type = integer
+  intent = in
+[nprocess]
+  standard_name = number_of_cumulative_change_processes
+  long_name = number of processes that cause changes in state variables
+  units = count
+  dimensions = ()
+  type = integer
+  intent = in
+[nprocess_summed]
+  standard_name = number_of_physics_causes_of_tracer_changes
+  long_name = number of causes in dtidx per tracer summed for total physics tendency
+  units = count
+  dimensions = ()
+  type = integer
+  intent = in
+[ip_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
+  units = index
+  dimensions = ()
+  type = integer
+  intent = in
+[ip_photochem]
+  standard_name = index_of_photochemistry_process_in_cumulative_change_index
+  long_name = index of photochemistry process in second dimension of array cumulative change index
+  units = index
+  dimensions = ()
+  type = integer
+  intent = in
+[is_photochem]
+  standard_name = flags_for_photochemistry_processes_to_sum
+  long_name = flags for photochemistry processes to sum as the total photochemistry process cumulative change
+  units = flag
+  dimensions = (number_of_cumulative_change_processes)
+  type = logical
+  intent = in
+[ldiag3d]
+  standard_name = flag_for_diagnostics_3D
+  long_name = flag for 3d diagnostic fields
+  units = flag
+  dimensions = ()
+  type = logical
+  intent = in
 [ip_prod_loss]
   standard_name = index_of_production_and_loss_process_in_cumulative_change_index
   long_name = index of production and loss effect in photochemistry process in second dimension of array cumulative change index
diff --git a/physics/phys_tend.F90 b/physics/phys_tend.F90
deleted file mode 100644
index e63f44be5..000000000
--- a/physics/phys_tend.F90
+++ /dev/null
@@ -1,96 +0,0 @@
-!>\file phys_tend.F90
-!!
-module phys_tend
-
-   use machine, only: kind_phys
-
-   implicit none
-
-   private
-
-   public  phys_tend_run
-
-contains
-
-!> \section arg_table_phys_tend_run Argument Table
-!! \htmlinclude phys_tend_run.html
-!!
-   subroutine phys_tend_run(ldiag3d, dtend, dtidx, ntracp100, &
-       index_of_process_physics, index_of_process_photochem,  &
-       nprocess, nprocess_summed, is_photochem, ntoz, errmsg, errflg)
-
-       ! Interface variables
-       logical, intent(in) :: ldiag3d, is_photochem(:)
-       real(kind=kind_phys), optional, intent(inout) :: dtend(:,:,:)
-       integer, intent(in) :: dtidx(:,:), index_of_process_physics, ntoz, &
-         ntracp100, nprocess, nprocess_summed, index_of_process_photochem
-       character(len=*), intent(out) :: errmsg
-       integer, intent(out)          :: errflg
-
-       integer :: ichem, iphys, itrac
-       logical :: all_true(nprocess)
-
-       ! Initialize CCPP error handling variables
-       errmsg = ''
-       errflg = 0
-
-       if(.not.ldiag3d) then
-          return
-       endif
-
-       all_true = .true.
-
-       ! Total photochemical tendencies
-       itrac=ntoz+100
-       ichem = dtidx(itrac,index_of_process_photochem)
-       if(ichem>=1) then
-          call sum_it(ichem,itrac,is_photochem)
-       endif
-
-
-       do itrac=2,ntracp100
-          ! Total physics tendencies
-          iphys = dtidx(itrac,index_of_process_physics)
-          if(iphys>=1) then
-             call sum_it(iphys,itrac,all_true)
-          endif
-       enddo
-
-     contains
-       
-       subroutine sum_it(isum,itrac,sum_me)
-         implicit none
-         integer, intent(in) :: isum ! third index of dtend of summary process
-         integer, intent(in) :: itrac ! tracer or state variable being summed
-         logical, intent(in) :: sum_me(nprocess) ! false = skip this process
-         logical :: first
-         integer :: idtend, iprocess
-
-         first=.true.
-         do iprocess=1,nprocess
-            if(iprocess>nprocess_summed) then
-               exit ! Don't sum up the sums.
-            else if(.not.sum_me(iprocess)) then
-               cycle ! We were asked to skip this one.
-            endif
-            idtend = dtidx(itrac,iprocess)
-            if(idtend>=1) then
-               ! This tendency was calculated for this tracer, so
-               ! accumulate it into the total tendency.
-               if(first) then
-                  dtend(:,:,isum) = dtend(:,:,idtend)
-                  first=.false.
-               else
-                  dtend(:,:,isum) = dtend(:,:,isum) + dtend(:,:,idtend)
-               endif
-            endif
-         enddo
-         if(first) then
-            ! No tendencies were calculated, so sum is 0:
-            dtend(:,:,isum) = 0
-         endif
-       end subroutine sum_it
-       
-   end subroutine phys_tend_run
-
-end module phys_tend
diff --git a/physics/phys_tend.meta b/physics/phys_tend.meta
deleted file mode 100644
index 0f78af20b..000000000
--- a/physics/phys_tend.meta
+++ /dev/null
@@ -1,95 +0,0 @@
-[ccpp-table-properties]
-  name = phys_tend
-  type = scheme
-  dependencies = machine.F
-
-########################################################################
-[ccpp-arg-table]
-  name = phys_tend_run
-  type = scheme
-[ldiag3d]
-  standard_name = flag_for_diagnostics_3D
-  long_name = flag for 3d diagnostic fields
-  units = flag
-  dimensions = ()
-  type = logical
-  intent = in
-[dtend]
-  standard_name = cumulative_change_of_state_variables
-  long_name = diagnostic tendencies for state variables
-  units = mixed
-  dimensions = (horizontal_loop_extent,vertical_layer_dimension,cumulative_change_of_state_variables_outer_index_max)
-  type = real
-  kind = kind_phys
-  intent = inout
-[dtidx]
-  standard_name = cumulative_change_of_state_variables_outer_index
-  long_name = index of state-variable and process in last dimension of diagnostic tendencies array AKA cumulative_change_index
-  units = index
-  dimensions = (number_of_tracers_plus_one_hundred,number_of_cumulative_change_processes)
-  type = integer
-  intent = in
-[ntracp100]
-  standard_name = number_of_tracers_plus_one_hundred
-  long_name = number of tracers plus one hundred
-  units = count
-  dimensions = ()
-  type = integer
-  intent = in
-[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
-  units = index
-  dimensions = ()
-  type = integer
-  intent = in
-[index_of_process_photochem]
-  standard_name = index_of_photochemistry_process_in_cumulative_change_index
-  long_name = index of photochemistry process in second dimension of array cumulative change index
-  units = index
-  dimensions = ()
-  type = integer
-  intent = in
-[nprocess]
-  standard_name = number_of_cumulative_change_processes
-  long_name = number of processes that cause changes in state variables
-  units = count
-  dimensions = ()
-  type = integer
-  intent = in
-[nprocess_summed]
-  standard_name = number_of_physics_causes_of_tracer_changes
-  long_name = number of causes in dtidx per tracer summed for total physics tendency
-  units = count
-  dimensions = ()
-  type = integer
-  intent = in
-[is_photochem]
-  standard_name = flags_for_photochemistry_processes_to_sum
-  long_name = flags for photochemistry processes to sum as the total photochemistry process cumulative change
-  units = flag
-  dimensions = (number_of_cumulative_change_processes)
-  type = logical
-  intent = in
-[ntoz]
-  standard_name = index_of_ozone_mixing_ratio_in_tracer_concentration_array
-  long_name = tracer index for ozone mixing ratio
-  units = index
-  dimensions = ()
-  type = integer
-  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

From 06bb2bcc9ea2fa5dd52d8f0aa8be2f41b65ab8c0 Mon Sep 17 00:00:00 2001
From: Dustin Swales <dustin.swales@noaa.gov>
Date: Thu, 12 Oct 2023 15:17:00 +0000
Subject: [PATCH 109/115] Final cleanup

---
 physics/GFS_phys_time_vary.scm.F90  | 83 +++++++++++++++++++++++------
 physics/GFS_phys_time_vary.scm.meta | 75 +++++++++++++++++++++++++-
 physics/GFS_physics_post.F90        | 24 ++-------
 physics/GFS_physics_post.meta       | 20 -------
 4 files changed, 144 insertions(+), 58 deletions(-)

diff --git a/physics/GFS_phys_time_vary.scm.F90 b/physics/GFS_phys_time_vary.scm.F90
index 97460ac98..075bfc039 100644
--- a/physics/GFS_phys_time_vary.scm.F90
+++ b/physics/GFS_phys_time_vary.scm.F90
@@ -2,15 +2,17 @@
 !!  Contains code related to GFS physics suite setup (physics part of time_vary_step)
 
 !>\defgroup mod_GFS_phys_time_vary GFS Physics Time Update
-!! This module contains GFS physics time vary subroutines including, stratospheric water vapor,
+!! This module contains GFS physics time vary subroutines including stratospheric water vapor,
 !! aerosol, IN&CCN and surface properties updates.
 !> @{
    module GFS_phys_time_vary
 
-      use machine, only : kind_phys
+      use machine, only : kind_phys, kind_dbl_prec, kind_sngl_prec
 
       use mersenne_twister, only: random_setseed, random_number
 
+      use module_ozphys, only: ty_ozphys
+
       use h2o_def,   only : levh2o, h2o_coeff, h2o_lat, h2o_pres, h2o_time, h2oplin
       use h2ointerp, only : read_h2odata, setindxh2o, h2ointerpol
 
@@ -58,8 +60,8 @@ module GFS_phys_time_vary
 !>\section gen_GFS_phys_time_vary_init GFS_phys_time_vary_init General Algorithm
 !! @{
       subroutine GFS_phys_time_vary_init (                                                         &
-              me, master, h2o_phys, iaerclm, iccn, iflip, im, nx, ny, idate, xlat_d, xlon_d, &
-              jindx1_h, jindx2_h, ddy_h, h2opl,fhour,          &
+              me, master, ntoz, h2o_phys, iaerclm, iccn, iflip, im, nx, ny, idate, xlat_d, xlon_d, &
+              jindx1_o3, jindx2_o3, ddy_o3, ozphys, jindx1_h, jindx2_h, ddy_h, h2opl,fhour,        &
               jindx1_aer, jindx2_aer, ddy_aer, iindx1_aer, iindx2_aer, ddx_aer, aer_nm,            &
               jindx1_ci, jindx2_ci, ddy_ci, iindx1_ci, iindx2_ci, ddx_ci, imap, jmap,              &
               do_ugwp_v1, jindx1_tau, jindx2_tau, ddy_j1tau, ddy_j2tau,                            &
@@ -76,14 +78,14 @@ subroutine GFS_phys_time_vary_init (
          implicit none
 
          ! Interface variables
-         integer,              intent(in)    :: me, master, iccn, iflip, im, nx, ny
+         integer,              intent(in)    :: me, master, ntoz, iccn, iflip, im, nx, ny
          logical,              intent(in)    :: h2o_phys, iaerclm, lsm_cold_start
          integer,              intent(in)    :: idate(:)
          real(kind_phys),      intent(in)    :: fhour
          real(kind_phys),      intent(in)    :: xlat_d(:), xlon_d(:)
 
-         integer,              intent(inout) :: jindx1_h(:), jindx2_h(:)
-         real(kind_phys),      intent(inout) :: ddy_h(:)
+         integer,              intent(inout) :: jindx1_o3(:), jindx2_o3(:), jindx1_h(:), jindx2_h(:)
+         real(kind_phys),      intent(inout) :: ddy_o3(:),  ddy_h(:)
          real(kind_phys),      intent(in)    :: h2opl(:,:,:)
          integer,              intent(inout) :: jindx1_aer(:), jindx2_aer(:), iindx1_aer(:), iindx2_aer(:)
          real(kind_phys),      intent(inout) :: ddy_aer(:), ddx_aer(:)
@@ -101,6 +103,7 @@ subroutine GFS_phys_time_vary_init (
          real(kind_phys),      intent(in)    :: min_seaice, fice(:)
          real(kind_phys),      intent(in)    :: landfrac(:)
          real(kind_phys),      intent(inout) :: weasd(:)
+         type(ty_ozphys),      intent(in)    :: ozphys
 
          ! NoahMP - only allocated when NoahMP is used
          integer, intent(in) :: lsoil, lsnow_lsm_lbound, lsnow_lsm_ubound
@@ -244,6 +247,11 @@ subroutine GFS_phys_time_vary_init (
 !> - Initialize soil vegetation (needed for sncovr calculation further down)
          call set_soilveg(me, isot, ivegsrc, nlunit, errmsg, errflg)
 
+!> - Setup spatial interpolation indices for ozone physics.
+         if (ntoz > 0) then
+            call ozphys%setup_o3prog(xlat_d, jindx1_o3, jindx2_o3, ddy_o3)
+         endif
+
 !> - Call setindxh2o() to initialize stratospheric water vapor data
          if (h2o_phys) then
            call setindxh2o (im, xlat_d, jindx1_h, jindx2_h, ddy_h)
@@ -625,8 +633,8 @@ end subroutine GFS_phys_time_vary_init
 !! @{
       subroutine GFS_phys_time_vary_timestep_init (                                                 &
             me, master, cnx, cny, isc, jsc, nrcm, im, levs, kdt, idate, nsswr, fhswr, lsswr, fhour, &
-            imfdeepcnv, cal_pre, random_clds,         h2o_phys, iaerclm, iccn, clstp,          &
-            jindx1_h, jindx2_h, ddy_h, h2opl, iflip,            &
+            imfdeepcnv, cal_pre, random_clds, ozphys, ntoz, h2o_phys, iaerclm, iccn, clstp,         &
+            jindx1_o3, jindx2_o3, ddy_o3, ozpl, jindx1_h, jindx2_h, ddy_h, h2opl, iflip,            &
             jindx1_aer, jindx2_aer, ddy_aer, iindx1_aer, iindx2_aer, ddx_aer, aer_nm,               &
             jindx1_ci, jindx2_ci, ddy_ci, iindx1_ci, iindx2_ci, ddx_ci, in_nm, ccn_nm,              &
             imap, jmap, prsl, seed0, rann, do_ugwp_v1, jindx1_tau, jindx2_tau, ddy_j1tau, ddy_j2tau,&
@@ -636,14 +644,14 @@ subroutine GFS_phys_time_vary_timestep_init (
 
          ! Interface variables
          integer,              intent(in)    :: me, master, cnx, cny, isc, jsc, nrcm, im, levs, kdt, &
-                                                nsswr, imfdeepcnv, iccn, iflip
+                                                nsswr, imfdeepcnv, iccn, ntoz, iflip
          integer,              intent(in)    :: idate(:)
          real(kind_phys),      intent(in)    :: fhswr, fhour
          logical,              intent(in)    :: lsswr, cal_pre, random_clds, h2o_phys, iaerclm
          real(kind_phys),      intent(out)   :: clstp
-         integer,              intent(in)    :: jindx1_h(:), jindx2_h(:)
-         real(kind_phys),      intent(in)    :: ddy_h(:)
-         real(kind_phys),      intent(inout) :: h2opl(:,:,:)
+         integer,              intent(in)    :: jindx1_o3(:), jindx2_o3(:), jindx1_h(:), jindx2_h(:)
+         real(kind_phys),      intent(in)    :: ddy_o3(:),  ddy_h(:)
+         real(kind_phys),      intent(inout) :: ozpl(:,:,:), h2opl(:,:,:)
          integer,              intent(in)    :: jindx1_aer(:), jindx2_aer(:), iindx1_aer(:), iindx2_aer(:)
          real(kind_phys),      intent(in)    :: ddy_aer(:), ddx_aer(:)
          real(kind_phys),      intent(inout) :: aer_nm(:,:,:)
@@ -659,15 +667,19 @@ subroutine GFS_phys_time_vary_timestep_init (
          integer,              intent(in)    :: jindx1_tau(:), jindx2_tau(:)
          real(kind_phys),      intent(in)    :: ddy_j1tau(:), ddy_j2tau(:)
          real(kind_phys),      intent(inout) :: tau_amf(:)
+         type(ty_ozphys),      intent(in)    :: ozphys
          integer,              intent(in)    :: nthrds
          character(len=*),     intent(out)   :: errmsg
          integer,              intent(out)   :: errflg
 
          ! Local variables
-         integer :: i, j, k, iseed, iskip, ix
-         real(kind=kind_phys) :: wrk(1)
-         real(kind=kind_phys) :: rannie(cny)
-         real(kind=kind_phys) :: rndval(cnx*cny*nrcm)
+         integer :: i, j, k, iseed, iskip, ix, idat(8), jdat(8), iday, j1, j2, nc, n1, n2, jdow,     &
+              jdoy, jday, w3kindreal, w3kindint
+         real(kind_phys) :: wrk(1), tem, tx1, tx2, rjday
+         real(kind_phys) :: rannie(cny)
+         real(kind_phys) :: rndval(cnx*cny*nrcm)
+         real(kind_dbl_prec)  :: rinc(5)
+         real(kind_sngl_prec) :: rinc4(5)
 
          ! Initialize CCPP error handling variables
          errmsg = ''
@@ -721,6 +733,43 @@ subroutine GFS_phys_time_vary_timestep_init (
 
          endif  ! imfdeepcnv, cal_re, random_clds
 
+        !> - Compute temporal interpolation indices for updating gas concentrations.
+         idat=0
+         idat(1)=idate(4)
+         idat(2)=idate(2)
+         idat(3)=idate(3)
+         idat(5)=idate(1)
+         rinc=0.
+         rinc(2)=fhour
+         call w3kind(w3kindreal,w3kindint)
+         if(w3kindreal==4) then
+            rinc4=rinc
+            CALL w3movdat(rinc4,idat,jdat)
+         else
+            CALL w3movdat(rinc,idat,jdat)
+         endif
+         jdow = 0
+         jdoy = 0
+         jday = 0
+         call w3doxdat(jdat,jdow,jdoy,jday)
+         rjday = jdoy + jdat(5) / 24.
+         if (rjday < ozphys%time(1)) rjday = rjday + 365.
+
+         n2 = ozphys%ntime + 1
+         do j=2,ozphys%ntime
+            if (rjday < ozphys%time(j)) then
+               n2 = j
+                      exit
+            endif
+         enddo
+         n1 = n2 - 1
+         if (n2 > ozphys%ntime) n2 = n2 - ozphys%ntime
+
+!> - Update ozone concentration.
+         if (ntoz > 0) then
+            call ozphys%update_o3prog(jindx1_o3, jindx2_o3, ddy_o3, rjday, n1, n2, ozpl)
+         endif
+
 !> - Call h2ointerpol() to make stratospheric water vapor data interpolation
          if (h2o_phys) then
            call h2ointerpol (me, im, idate, fhour, &
diff --git a/physics/GFS_phys_time_vary.scm.meta b/physics/GFS_phys_time_vary.scm.meta
index 21d1f2736..cf5ad15ca 100644
--- a/physics/GFS_phys_time_vary.scm.meta
+++ b/physics/GFS_phys_time_vary.scm.meta
@@ -2,7 +2,7 @@
   name = GFS_phys_time_vary
   type = scheme
   dependencies = aerclm_def.F,aerinterp.F90,h2o_def.f,h2ointerp.f90,iccn_def.F,iccninterp.F90,machine.F,mersenne_twister.f
-  dependencies = namelist_soilveg.f,set_soilveg.f,cires_tauamf_data.F90,noahmp_tables.f90
+  dependencies = namelist_soilveg.f,set_soilveg.f,module_ozphys.F90,cires_tauamf_data.F90,noahmp_tables.f90
 
 ########################################################################
 [ccpp-arg-table]
@@ -23,6 +23,13 @@
   dimensions = ()
   type = integer
   intent = in
+[ntoz]
+  standard_name = index_of_ozone_mixing_ratio_in_tracer_concentration_array
+  long_name = tracer index for ozone mixing ratio
+  units = index
+  dimensions = ()
+  type = integer
+  intent = in
 [h2o_phys]
   standard_name = flag_for_stratospheric_water_vapor_physics
   long_name = flag for stratospheric water vapor physics
@@ -95,6 +102,28 @@
   type = real
   kind = kind_phys
   intent = in
+[jindx1_o3]
+  standard_name = lower_latitude_index_of_ozone_forcing_for_interpolation
+  long_name = interpolation low index for ozone
+  units = index
+  dimensions = (horizontal_dimension)
+  type = integer
+  intent = inout
+[jindx2_o3]
+  standard_name = upper_latitude_index_of_ozone_forcing_for_interpolation
+  long_name = interpolation high index for ozone
+  units = index
+  dimensions = (horizontal_dimension)
+  type = integer
+  intent = inout
+[ddy_o3]
+  standard_name = latitude_interpolation_weight_for_ozone_forcing
+  long_name = interpolation high index for ozone
+  units = none
+  dimensions = (horizontal_dimension)
+  type = real
+  kind = kind_phys
+  intent = inout
 [jindx1_h]
   standard_name = lower_latitude_index_of_stratospheric_water_vapor_forcing_for_interpolation
   long_name = interpolation low index for stratospheric water vapor
@@ -1019,6 +1048,13 @@
   dimensions = ()
   type = logical
   intent = in
+[ntoz]
+  standard_name = index_of_ozone_mixing_ratio_in_tracer_concentration_array
+  long_name = tracer index for ozone mixing ratio
+  units = index
+  dimensions = ()
+  type = integer
+  intent = in
 [h2o_phys]
   standard_name = flag_for_stratospheric_water_vapor_physics
   long_name = flag for stratospheric water vapor physics
@@ -1048,6 +1084,36 @@
   type = real
   kind = kind_phys
   intent = out
+[jindx1_o3]
+  standard_name = lower_latitude_index_of_ozone_forcing_for_interpolation
+  long_name = interpolation low index for ozone
+  units = index
+  dimensions = (horizontal_dimension)
+  type = integer
+  intent = in
+[jindx2_o3]
+  standard_name = upper_latitude_index_of_ozone_forcing_for_interpolation
+  long_name = interpolation high index for ozone
+  units = index
+  dimensions = (horizontal_dimension)
+  type = integer
+  intent = in
+[ddy_o3]
+  standard_name = latitude_interpolation_weight_for_ozone_forcing
+  long_name = interpolation high index for ozone
+  units = none
+  dimensions = (horizontal_dimension)
+  type = real
+  kind = kind_phys
+  intent = in
+[ozpl]
+  standard_name = ozone_forcing
+  long_name = ozone forcing data
+  units = mixed
+  dimensions = (horizontal_dimension,number_of_levels_in_ozone_data,number_of_coefficients_in_ozone_data)
+  type = real
+  kind = kind_phys
+  intent = inout
 [jindx1_h]
   standard_name = lower_latitude_index_of_stratospheric_water_vapor_forcing_for_interpolation
   long_name = interpolation low index for stratospheric water vapor
@@ -1279,6 +1345,13 @@
   type = real
   kind = kind_phys
   intent = inout
+[ozphys]
+  standard_name = dataset_for_ozone_physics
+  long_name = dataset for NRL ozone physics
+  units = mixed
+  dimensions = ()
+  type = ty_ozphys
+  intent = in
 [nthrds]
   standard_name = number_of_openmp_threads
   long_name = number of OpenMP threads available for physics schemes
diff --git a/physics/GFS_physics_post.F90 b/physics/GFS_physics_post.F90
index def38cd1a..f89b257a8 100644
--- a/physics/GFS_physics_post.F90
+++ b/physics/GFS_physics_post.F90
@@ -13,22 +13,6 @@ module GFS_physics_post
   public GFS_physics_post_init, GFS_physics_post_run
 contains
 
-! ########################################################################################### 
-! SUBROUTINE GFS_physics_post_init
-! ###########################################################################################
-!! \section arg_table_GFS_physics_post_init Argument Table
-!! \htmlinclude GFS_physics_post_init.html
-!!
-  subroutine GFS_physics_post_init(errmsg, errflg)
-
-    ! Outputs
-    character(len=*), intent(out) :: &
-         errmsg         ! CCPP error message
-    integer, intent(out) :: &
-         errflg         ! CCPP error flag
-
-  end subroutine GFS_physics_post_init
-
 ! ###########################################################################################
 ! SUBROUTINE GFS_physics_post_run
 ! ###########################################################################################
@@ -36,9 +20,9 @@ end subroutine GFS_physics_post_init
 !! \htmlinclude GFS_physics_post_run.html
 !!
   subroutine GFS_physics_post_run(nCol, nLev, ntoz, ntracp100, nprocess, nprocess_summed,   &
-       dtidx, is_photochem, ldiag3d, ip_physics, ip_photochem,         &
-       ip_prod_loss, ip_ozmix, ip_temp, ip_overhead_ozone, do3_dt_prd, do3_dt_ozmx,         &
-       do3_dt_temp, do3_dt_ohoz, dtend, errmsg, errflg)
+       dtidx, is_photochem, ldiag3d, ip_physics, ip_photochem, ip_prod_loss, ip_ozmix,      &
+       ip_temp, ip_overhead_ozone, do3_dt_prd, do3_dt_ozmx, do3_dt_temp, do3_dt_ohoz,       &
+       dtend, errmsg, errflg)
 
     ! Inputs
     integer, intent(in) :: &
@@ -49,7 +33,7 @@ subroutine GFS_physics_post_run(nCol, nLev, ntoz, ntracp100, nprocess, nprocess_
          nprocess,       & ! Number of processes that cause changes in state variables 
          nprocess_summed,& ! Number of causes in dtidx per tracer summed for total physics tendency
          ip_physics,     & ! Index for process in diagnostic tendency output
-         ip_photochem,   & ! 
+         ip_photochem,   & ! Index for process in diagnostic tendency output
          ip_prod_loss,   & ! Index for process in diagnostic tendency output
          ip_ozmix,       & ! Index for process in diagnostic tendency output
          ip_temp,        & ! Index for process in diagnostic tendency output
diff --git a/physics/GFS_physics_post.meta b/physics/GFS_physics_post.meta
index 649ef6491..5701909fd 100644
--- a/physics/GFS_physics_post.meta
+++ b/physics/GFS_physics_post.meta
@@ -3,26 +3,6 @@
   type = scheme
   dependencies = machine.F
 
-########################################################################
-[ccpp-arg-table]
-  name = GFS_physics_post_init
-  type = scheme
-[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
-
 ########################################################################
 [ccpp-arg-table]
   name = GFS_physics_post_run

From 89af3d8946ab25737628a016fe89356a261155ac Mon Sep 17 00:00:00 2001
From: Dustin Swales <dustin.swales@noaa.gov>
Date: Thu, 12 Oct 2023 15:45:58 +0000
Subject: [PATCH 110/115] Omission from previous commit

---
 physics/GFS_physics_post.F90 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/physics/GFS_physics_post.F90 b/physics/GFS_physics_post.F90
index f89b257a8..fe5409353 100644
--- a/physics/GFS_physics_post.F90
+++ b/physics/GFS_physics_post.F90
@@ -10,7 +10,7 @@
 module GFS_physics_post
   use machine, only : kind_phys, kind_dbl_prec, kind_sngl_prec
   implicit none
-  public GFS_physics_post_init, GFS_physics_post_run
+  public GFS_physics_post_run
 contains
 
 ! ###########################################################################################

From c6204e149fdbff013532cf991e9ad00b107d111b Mon Sep 17 00:00:00 2001
From: "denise.worthen" <Denise.Worthen@noaa.gov>
Date: Sun, 15 Oct 2023 08:15:23 -0400
Subject: [PATCH 111/115] add dlw,dsw inst to cpllnd block

---
 physics/GFS_surface_generic_post.F90 | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/physics/GFS_surface_generic_post.F90 b/physics/GFS_surface_generic_post.F90
index 9faebc8cf..7e8cfa753 100644
--- a/physics/GFS_surface_generic_post.F90
+++ b/physics/GFS_surface_generic_post.F90
@@ -130,6 +130,8 @@ subroutine GFS_surface_generic_post_run (im, cplflx, cplaqm, cplchm, cplwav, cpl
 
         if (cplflx .or. cpllnd) then
           do i=1,im
+            dlwsfci_cpl (i) = adjsfcdlw(i)
+            dswsfci_cpl (i) = adjsfcdsw(i)
             dlwsfc_cpl  (i) = dlwsfc_cpl(i) + adjsfcdlw(i)*dtf
             dswsfc_cpl  (i) = dswsfc_cpl(i) + adjsfcdsw(i)*dtf
             psurfi_cpl  (i) = pgr(i)
@@ -138,8 +140,6 @@ subroutine GFS_surface_generic_post_run (im, cplflx, cplaqm, cplchm, cplwav, cpl
 
         if (cplflx) then
           do i=1,im
-            dlwsfci_cpl (i) = adjsfcdlw(i)
-            dswsfci_cpl (i) = adjsfcdsw(i)
             dnirbmi_cpl (i) = adjnirbmd(i)
             dnirdfi_cpl (i) = adjnirdfd(i)
             dvisbmi_cpl (i) = adjvisbmd(i)
@@ -242,7 +242,7 @@ subroutine GFS_surface_generic_post_run (im, cplflx, cplaqm, cplchm, cplwav, cpl
             tedir(i)   = tedir(i)   + edir(i) * dtf
             if (lsm == lsm_noahmp) then
              paha(i)    = paha(i)    + pah(i)   * dtf
-             twa(i)     = waxy(i) 
+             twa(i)     = waxy(i)
             endif
           enddo
         endif
@@ -252,7 +252,7 @@ subroutine GFS_surface_generic_post_run (im, cplflx, cplaqm, cplchm, cplwav, cpl
 !    heat torage parameterization the kinematic sensible heat flux
 !    (hflx) as surface boundary forcing to the pbl scheme is
 !    reduced in a factor of hffac given as a function of surface roughness &
-!    green vegetation fraction (zvfun) 
+!    green vegetation fraction (zvfun)
 !
         do i=1,im
           hflxq(i) = hflx(i)

From 2f417bb5f8c1e814ea5f3539615395d9ed096eca Mon Sep 17 00:00:00 2001
From: Helin Wei <Helin.Wei@noaa.gov>
Date: Tue, 17 Oct 2023 12:32:30 -0400
Subject: [PATCH 112/115] refine surface 2m t/q diagnostic method

---
 physics/sfc_diag_post.F90  | 24 ++++++++++++++++++------
 physics/sfc_diag_post.meta |  7 +++++++
 2 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/physics/sfc_diag_post.F90 b/physics/sfc_diag_post.F90
index c1a43f170..6945e48e9 100644
--- a/physics/sfc_diag_post.F90
+++ b/physics/sfc_diag_post.F90
@@ -14,16 +14,17 @@ module sfc_diag_post
 !!
 #endif
       subroutine sfc_diag_post_run (im, lsm, lsm_noahmp, opt_diag, dry, lssav, dtf, con_eps, con_epsm1, pgr,&
-                 t2mmp,q2mp, t2m, q2m, u10m, v10m, tmpmin, tmpmax, spfhmin, spfhmax,                  &
+                 vegtype,t2mmp,q2mp, t2m, q2m, u10m, v10m, tmpmin, tmpmax, spfhmin, spfhmax,                  &
                          wind10mmax, u10mmax, v10mmax, dpt2m, errmsg, errflg)
 
         use machine,               only: kind_phys, kind_dbl_prec
 
         implicit none
 
-        integer,                              intent(in) :: im, lsm, lsm_noahmp,opt_diag
-        logical,                              intent(in) :: lssav
-        real(kind=kind_phys),                 intent(in) :: dtf, con_eps, con_epsm1
+        integer,                             intent(in) :: im, lsm, lsm_noahmp,opt_diag
+        integer,              dimension(:),  intent(in) :: vegtype    !  vegetation type (integer index)
+        logical,                             intent(in) :: lssav
+        real(kind=kind_phys),                intent(in) :: dtf, con_eps, con_epsm1
         logical             , dimension(:),  intent(in) :: dry
         real(kind=kind_phys), dimension(:),  intent(in) :: pgr, u10m, v10m
         real(kind=kind_phys), dimension(:),  intent(inout) :: t2m, q2m, tmpmin, tmpmax, spfhmin, spfhmax
@@ -41,12 +42,23 @@ subroutine sfc_diag_post_run (im, lsm, lsm_noahmp, opt_diag, dry, lssav, dtf, co
         errflg = 0
 
         if (lsm == lsm_noahmp) then
-         if (opt_diag == 2 .or. opt_diag == 3)then
+!     over shrublands use opt_diag=2
+          do i=1, im
+           if(dry(i)) then
+             if (vegtype(i) == 6 .or. vegtype(i) == 7  & 
+                .or. vegtype(i) == 16) then
+              t2m(i) = t2mmp(i)
+              q2m(i) = q2mp(i)
+             endif
+           endif
+          enddo
+             
+         if (opt_diag == 2 .or. opt_diag == 3) then
           do i=1,im
             if(dry(i)) then
               t2m(i) = t2mmp(i)
               q2m(i) = q2mp(i)
-            endif
+             endif
           enddo
          endif
         endif
diff --git a/physics/sfc_diag_post.meta b/physics/sfc_diag_post.meta
index c50d3c4dc..17648753a 100644
--- a/physics/sfc_diag_post.meta
+++ b/physics/sfc_diag_post.meta
@@ -81,6 +81,13 @@
   type = real
   kind = kind_phys
   intent = in
+[vegtype]
+  standard_name = vegetation_type_classification
+  long_name = vegetation type at each grid cell
+  units = index
+  dimensions = (horizontal_loop_extent)
+  type = integer
+  intent= in
 [t2mmp]
   standard_name = temperature_at_2m_from_noahmp
   long_name = 2 meter temperature from noahmp

From 32cf7ba5484db1387e33c7f9d25de87079e9014c Mon Sep 17 00:00:00 2001
From: Dustin Swales <dustin.swales@noaa.gov>
Date: Fri, 27 Oct 2023 17:01:01 +0000
Subject: [PATCH 113/115] Reverted standard_name change

---
 physics/GFS_phys_time_vary.fv3.meta    | 2 +-
 physics/GFS_phys_time_vary.scm.meta    | 2 +-
 physics/GFS_suite_stateout_update.meta | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/physics/GFS_phys_time_vary.fv3.meta b/physics/GFS_phys_time_vary.fv3.meta
index ad543e146..968f33027 100644
--- a/physics/GFS_phys_time_vary.fv3.meta
+++ b/physics/GFS_phys_time_vary.fv3.meta
@@ -1205,7 +1205,7 @@
   standard_name = ozone_forcing
   long_name = ozone forcing data
   units = mixed
-  dimensions = (horizontal_dimension,number_of_levels_in_ozone_data,number_of_coefficients_in_ozone_data)
+  dimensions = (horizontal_dimension,vertical_dimension_of_ozone_forcing_data,number_of_coefficients_in_ozone_data)
   type = real
   kind = kind_phys
   intent = inout
diff --git a/physics/GFS_phys_time_vary.scm.meta b/physics/GFS_phys_time_vary.scm.meta
index cf5ad15ca..d72e27fd5 100644
--- a/physics/GFS_phys_time_vary.scm.meta
+++ b/physics/GFS_phys_time_vary.scm.meta
@@ -1110,7 +1110,7 @@
   standard_name = ozone_forcing
   long_name = ozone forcing data
   units = mixed
-  dimensions = (horizontal_dimension,number_of_levels_in_ozone_data,number_of_coefficients_in_ozone_data)
+  dimensions = (horizontal_dimension,vertical_dimension_of_ozone_forcing_data,number_of_coefficients_in_ozone_data)
   type = real
   kind = kind_phys
   intent = inout
diff --git a/physics/GFS_suite_stateout_update.meta b/physics/GFS_suite_stateout_update.meta
index 8cbab9139..fae276d2f 100644
--- a/physics/GFS_suite_stateout_update.meta
+++ b/physics/GFS_suite_stateout_update.meta
@@ -218,7 +218,7 @@
   standard_name = ozone_forcing
   long_name = ozone forcing data
   units = mixed
-  dimensions = (horizontal_loop_extent,number_of_levels_in_ozone_data,number_of_coefficients_in_ozone_data)
+  dimensions = (horizontal_loop_extent,vertical_dimension_of_ozone_forcing_data,number_of_coefficients_in_ozone_data)
   type = real
   kind = kind_phys
   intent = in

From 1abaff07fabc582e2ddaaf4977e337c85e5e9dfa Mon Sep 17 00:00:00 2001
From: Ted Mansell <ted.mansell@noaa.gov>
Date: Sun, 29 Oct 2023 15:42:36 -0500
Subject: [PATCH 114/115]  module_mp_nssl_2mom.F90: fix bug when nz > 128 where
 sedimentation did not work for k > 128

---
 physics/module_mp_nssl_2mom.F90 | 152 ++++++++++++++++++++++++--------
 1 file changed, 115 insertions(+), 37 deletions(-)

diff --git a/physics/module_mp_nssl_2mom.F90 b/physics/module_mp_nssl_2mom.F90
index a88ffe053..ad90ec81f 100644
--- a/physics/module_mp_nssl_2mom.F90
+++ b/physics/module_mp_nssl_2mom.F90
@@ -4274,7 +4274,7 @@ subroutine sediment1d(dtp,nx,ny,nz,an,na,nor,norz,xfall,dn,dz3d,dz3dinv, &
 !      real gz(-nor+ng1:nz+nor),z1d(-nor+ng1:nz+nor,4)
       real dtp
       real xfall(nx,ny,na)  ! array for stuff landing on the ground
-      real xfall0(nx,ny)    ! dummy array
+!      real xfall0(nx,ny)    ! dummy array
       integer infdo
       integer jslab ! which line of xfall to use
             
@@ -4282,47 +4282,81 @@ subroutine sediment1d(dtp,nx,ny,nz,an,na,nor,norz,xfall,dn,dz3d,dz3dinv, &
       real tmp, vtmax, dtptmp, dtfrac
       real, parameter :: dz = 200.
 
-      real :: xvt(nz+1,nx,3,lc:lhab) ! (nx,nz,2,lc:lhab) ! 1=mass-weighted, 2=number-weighted
-      real :: tmpn(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-norz+ng1:nz+norz)
-      real :: tmpn2(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-norz+ng1:nz+norz)
-      real :: z(-nor+ng1:nx+nor,-norz+ng1:nz+norz,lr:lhab)
-      real :: db1(nx,nz+1),dtz1(nz+1,nx,0:1),dz2dinv(nz+1,nx),db1inv(nx,nz+1)
+!      real :: xvt(nz+1,nx,3,lc:lhab) ! (nx,nz,2,lc:lhab) ! 1=mass-weighted, 2=number-weighted
+!      real :: tmpn(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-norz+ng1:nz+norz)
+!      real :: tmpn2(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-norz+ng1:nz+norz)
+!      real :: z(-nor+ng1:nx+nor,-norz+ng1:nz+norz,lr:lhab)
+!      real :: db1(nx,nz+1),dtz1(nz+1,nx,0:1),dz2dinv(nz+1,nx),db1inv(nx,nz+1)
       
-      real :: rhovtzx(nz,nx)
+!      real :: rhovtzx(nz,nx)
+
+      real, allocatable :: db1(:,:), dtz1(:,:,:),dz2dinv(:,:),db1inv(:,:) ! db1(nx,nz+1),dtz1(nz+1,nx,0:1),dz2dinv(nz+1,nx),db1inv(nx,nz+1)
+      real, allocatable :: rhovtzx(:,:)
+      real, allocatable :: xfall0(:,:), xvt(:,:,:,:),tmpn(:,:,:),tmpn2(:,:,:),z(:,:,:)
       
       double precision :: timesed1,timesed2,timesed3, zmaxsed,timesetvt,dummy
       double precision :: dt1,dt2,dt3,dt4
 
-      integer,parameter :: ngs = 128 
+      integer :: ngs ! = 512
       integer :: ngscnt,mgs,ipconc0
       
-      real ::  qx(ngs,lv:lhab) 
-      real ::  qxw(ngs,ls:lhab) 
-      real ::  cx(ngs,lc:lhab) 
-      real ::  xv(ngs,lc:lhab) 
-      real ::  vtxbar(ngs,lc:lhab,3) 
-      real ::  xmas(ngs,lc:lhab) 
-      real ::  xdn(ngs,lc:lhab) 
-      real ::  xdia(ngs,lc:lhab,3) 
-      real ::  vx(ngs,li:lhab) 
-      real ::  alpha(ngs,lc:lhab) 
-      real ::  zx(ngs,lr:lhab) 
-      logical :: hasmass(nx,lc+1:lhab)
-
-      integer igs(ngs),kgs(ngs)
-      
-      real rho0(ngs),temcg(ngs)
-
-      real temg(ngs)
-      
-      real rhovt(ngs)
-      
-      real cwnc(ngs),cinc(ngs)
-      real fadvisc(ngs),cwdia(ngs),cipmas(ngs)
-      
-      real cimasn,cimasx,cnina(ngs),cimas(ngs)
-      
-      real cnostmp(ngs)
+!     real ::  qx(ngs,lv:lhab) 
+!     real ::  qxw(ngs,ls:lhab) 
+!     real ::  cx(ngs,lc:lhab) 
+!     real ::  xv(ngs,lc:lhab) 
+!     real ::  vtxbar(ngs,lc:lhab,3) 
+!     real ::  xmas(ngs,lc:lhab) 
+!     real ::  xdn(ngs,lc:lhab) 
+!     real ::  xdia(ngs,lc:lhab,3) 
+!     real ::  vx(ngs,li:lhab) 
+!     real ::  alpha(ngs,lc:lhab) 
+!     real ::  zx(ngs,lr:lhab) 
+!     logical :: hasmass(nx,lc+1:lhab)
+!
+!     integer igs(ngs),kgs(ngs)
+!     
+!     real rho0(ngs),temcg(ngs)
+!
+!     real temg(ngs)
+!     
+!     real rhovt(ngs)
+!     
+!     real cwnc(ngs),cinc(ngs)
+!     real fadvisc(ngs),cwdia(ngs),cipmas(ngs)
+!     
+!     real cimasn,cimasx,cnina(ngs),cimas(ngs)
+!     
+!     real cnostmp(ngs)
+
+      real, allocatable ::  qx(:,:)
+      real, allocatable ::  qxw(:,:)
+      real, allocatable ::  cx(:,:)
+      real, allocatable ::  xv(:,:)
+      real, allocatable ::  vtxbar(:,:,:)
+      real, allocatable ::  xmas(:,:)
+      real, allocatable ::  xdn(:,:)
+      real, allocatable ::  xdia(:,:,:)
+      real, allocatable ::  vx(:,:)
+      real, allocatable ::  alpha(:,:)
+      real, allocatable ::  zx(:,:)
+      logical, allocatable :: hasmass(:,:)
+
+      integer, allocatable :: igs(:),kgs(:)
+      
+      real, allocatable :: rho0(:),temcg(:)
+
+      real, allocatable :: temg(:)
+      
+      real, allocatable :: rhovt(:)
+      
+      real, allocatable :: cwnc(:),cinc(:)
+      real, allocatable :: fadvisc(:),cwdia(:),cipmas(:)
+      
+      real, allocatable :: cnina(:),cimas(:)
+      
+      real, allocatable :: cnostmp(:)
+      
+      real :: cimasn,cimasx
       
 
 !-----------------------------------------------------------------------------
@@ -4336,7 +4370,30 @@ subroutine sediment1d(dtp,nx,ny,nz,an,na,nor,norz,xfall,dn,dz3d,dz3dinv, &
 ! ###################################################################
 
 
-
+      allocate( db1(nx,nz+1),dtz1(nz+1,nx,0:1),dz2dinv(nz+1,nx),db1inv(nx,nz+1),rhovtzx(nz,nx) )
+      allocate( xfall0(nx,ny), xvt(nz+1,nx,3,lc:lhab), tmpn(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-norz+ng1:nz+norz) )
+      allocate( tmpn2(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-norz+ng1:nz+norz), z(-nor+ng1:nx+nor,-norz+ng1:nz+norz,lr:lhab))
+
+      ngs = nz+3
+      
+      allocate( qx(ngs,lv:lhab),  &
+                qxw(ngs,ls:lhab),  &
+                cx(ngs,lc:lhab),  &
+                xv(ngs,lc:lhab),  &
+                vtxbar(ngs,lc:lhab,3),  &
+                xmas(ngs,lc:lhab),  &
+                xdn(ngs,lc:lhab),  &
+                xdia(ngs,lc:lhab,3),  &
+                vx(ngs,li:lhab),  &
+                alpha(ngs,lc:lhab),  &
+                zx(ngs,lr:lhab),     &
+                hasmass(nx,lc+1:lhab), &
+                igs(ngs),kgs(ngs), &
+                rho0(ngs),temcg(ngs),temg(ngs), rhovt(ngs), &
+                cwnc(ngs),cinc(ngs), &
+                fadvisc(ngs),cwdia(ngs),cipmas(ngs), &
+                cnina(ngs),cimas(ngs), &
+                cnostmp(ngs) )
 
       kzb = 1
       kze = nz
@@ -4656,8 +4713,29 @@ subroutine sediment1d(dtp,nx,ny,nz,an,na,nor,norz,xfall,dn,dz3d,dz3dinv, &
       ENDDO ! ix
 
 
+      deallocate( db1,dtz1,dz2dinv,db1inv,rhovtzx )
+      deallocate( xfall0, xvt, tmpn )
+      deallocate( tmpn2, z)
+
+      deallocate( qx,  &
+                qxw,  &
+                cx,  &
+                xv,  &
+                vtxbar,  &
+                xmas,  &
+                xdn,  &
+                xdia,  &
+                vx,  &
+                alpha,  &
+                zx,     &
+                hasmass, &
+                igs,kgs, &
+                rho0,temcg,temg, rhovt, &
+                cwnc,cinc, &
+                fadvisc,cwdia,cipmas, &
+                cnina,cimas, &
+                cnostmp )
 
-      
       RETURN
       END SUBROUTINE SEDIMENT1D
 

From e10030bf5a9578046d04adef261440bf9173013f Mon Sep 17 00:00:00 2001
From: Ted Mansell <ted.mansell@noaa.gov>
Date: Thu, 2 Nov 2023 13:28:39 -0500
Subject: [PATCH 115/115]  mp_nssl.F90: space formatting

---
 physics/mp_nssl.F90 | 233 ++++++++++++++++++++++----------------------
 1 file changed, 115 insertions(+), 118 deletions(-)

diff --git a/physics/mp_nssl.F90 b/physics/mp_nssl.F90
index aacf4c3dd..e79376709 100644
--- a/physics/mp_nssl.F90
+++ b/physics/mp_nssl.F90
@@ -26,12 +26,12 @@ module mp_nssl
 !! \htmlinclude mp_nssl_init.html
 !!
     subroutine mp_nssl_init(ncol, nlev, errflg, errmsg, threads, restart, &
-                              mpirank, mpiroot,    &
-                              con_g, con_rd, con_cp, con_rv,  &
-                              con_t0c, con_cliq, con_csol, con_eps,   &
-                              imp_physics, imp_physics_nssl,  &
-                              nssl_cccn, nssl_alphah, nssl_alphahl, &
-                              nssl_alphar, nssl_ehw0, nssl_ehlw0,   &
+                              mpirank, mpiroot,                           &
+                              con_g, con_rd, con_cp, con_rv,              &
+                              con_t0c, con_cliq, con_csol, con_eps,       &
+                              imp_physics, imp_physics_nssl,              &
+                              nssl_cccn, nssl_alphah, nssl_alphahl,       &
+                              nssl_alphar, nssl_ehw0, nssl_ehlw0,         &
                               nssl_ccn_on, nssl_hail_on, nssl_invertccn, nssl_3moment ) 
                               
 
@@ -134,7 +134,7 @@ subroutine mp_nssl_init(ncol, nlev, errflg, errmsg, threads, restart, &
 
 !           write(0,*) 'call nssl_2mom_init'
          CALL nssl_2mom_init(ims,ime, jms,jme, kms,kme,nssl_params,ipctmp=ipc,mixphase=0,   &
-                ihvol=ihailv,nssl_ehw0=nssl_ehw0,nssl_ehlw0=nssl_ehlw0,errmsg=errmsg, &
+                ihvol=ihailv,nssl_ehw0=nssl_ehw0,nssl_ehlw0=nssl_ehlw0,errmsg=errmsg,       &
                 nssl_alphar=nssl_alphar,                                                    &
                 nssl_alphah=nssl_alphah,                                                    &
                 nssl_alphahl=nssl_alphahl,                                                  &
@@ -165,19 +165,18 @@ end subroutine mp_nssl_init
 !! \htmlinclude mp_nssl_run.html
 !!
     subroutine mp_nssl_run(ncol, nlev, con_g, con_rd, mpirank, &
-!                             spechum, cccn, qc, qr, qi, qs, qh, qhl,         &
-                             spechum, cccn, cccna, qc, qr, qi, qs, qh, qhl,         &
-                             ccw, crw, cci, csw, chw, chl, vh, vhl,          &
-                             zrw, zhw, zhl,                                  &
-                              tgrs, prslk, prsl, phii, omega, dtp,           &
-                              prcp, rain, graupel, ice, snow, sr,            &
+                             spechum, cccn, cccna, qc, qr, qi, qs, qh, qhl,     &
+                             ccw, crw, cci, csw, chw, chl, vh, vhl,             &
+                             zrw, zhw, zhl,                                     &
+                             tgrs, prslk, prsl, phii, omega, dtp,               &
+                             prcp, rain, graupel, ice, snow, sr,                &
                              refl_10cm, do_radar_ref, first_time_step, restart, &
-                             re_cloud, re_ice, re_snow, re_rain,             &
-                             nleffr, nieffr, nseffr, nreffr,                 &
-                             imp_physics, convert_dry_rho,                   &
-                             imp_physics_nssl, nssl_ccn_on,                  &
-                             nssl_hail_on, nssl_invertccn, nssl_3moment,     &
-                             ntccn, ntccna,    &
+                             re_cloud, re_ice, re_snow, re_rain,                &
+                             nleffr, nieffr, nseffr, nreffr,                    &
+                             imp_physics, convert_dry_rho,                      &
+                             imp_physics_nssl, nssl_ccn_on,                     &
+                             nssl_hail_on, nssl_invertccn, nssl_3moment,        &
+                             ntccn, ntccna,                                     &
                              errflg, errmsg)
 
         use module_mp_nssl_2mom, only: calcnfromq, na
@@ -602,116 +601,114 @@ subroutine mp_nssl_run(ncol, nlev, con_g, con_rd, mpirank, &
 
          IF ( nssl_ccn_on )  THEN
 
-
-         CALL nssl_2mom_driver(                          &
-                    ITIMESTEP=itimestep,                &
-                  !   TH=th,                              &
-                     tt=tgrs,                          &
-                     QV=qv_mp,                         &
-                     QC=qc_mp,                         &
-                     QR=qr_mp,                         &
-                     QI=qi_mp,                         &
-                     QS=qs_mp,                         &
-                     QH=qh_mp,                         &
-                     QHL=qhl_mp,                        &
-                     CCW=nc_mp,                    &
-                     CRW=nr_mp,                       &
-                     CCI=ni_mp,                       &
-                     CSW=ns_mp,                       &
-                     CHW=nh_mp,                       &
-                     CHL=nhl_mp,                       &
-                     VHW=vh_mp,                     &
-                     VHL=vhl_mp,                     &
-                     cn=cn_mp,                        &
-                     ZRW=zrw_mp,                     &
-                     ZHW=zhw_mp,                     &
-                     ZHL=zhl_mp,                     &
-!                     cna=cna_mp, f_cna=( ntccna > 0 ),  & ! for future use
-                      cna=cna_mp, f_cna=.false. ,           &
-                    PII=prslk,                         &
-                     P=prsl,                                &
-                     W=w,                                &
-                     DZ=dz,                              &
-                     DTP=dtptmp,                         &
-                     DN=rho,                             &
-                     rainnc=xrain_mp, rainncv=xdelta_rain_mp,                         &
-                     snownc=xsnow_mp, snowncv=xdelta_snow_mp,                         &
-!                     icenc=ice_mp, icencv=delta_ice_mp,                             &
-                     GRPLNC=xgraupel_mp, GRPLNCV=xdelta_graupel_mp, sr=sr,      &
-                     dbz      = refl_10cm,               &
-!                     nssl_progn=.false.,                       &
-                     diagflag = diagflag,                &
-                     errmsg=errmsg,errflg=errflg,        &
-                     re_cloud=re_cloud_mp,                  &
-                     re_ice=re_ice_mp,                      &
-                     re_snow=re_snow_mp,                    &
-                     re_rain=re_rain_mp,                    &
-                     has_reqc=has_reqc,                  & ! ala G. Thompson
-                     has_reqi=has_reqi,                  & ! ala G. Thompson
-                     has_reqs=has_reqs,                  & ! ala G. Thompson
-                     has_reqr=has_reqr,                  &
+         CALL nssl_2mom_driver(                               &
+                     ITIMESTEP=itimestep,                     &
+                  !   TH=th,                                  &
+                     tt=tgrs,                                 &
+                     QV=qv_mp,                                &
+                     QC=qc_mp,                                &
+                     QR=qr_mp,                                &
+                     QI=qi_mp,                                &
+                     QS=qs_mp,                                &
+                     QH=qh_mp,                                &
+                     QHL=qhl_mp,                              &
+                     CCW=nc_mp,                               &
+                     CRW=nr_mp,                               &
+                     CCI=ni_mp,                               &
+                     CSW=ns_mp,                               &
+                     CHW=nh_mp,                               &
+                     CHL=nhl_mp,                              &
+                     VHW=vh_mp,                               &
+                     VHL=vhl_mp,                              &
+                     cn=cn_mp,                                &
+                     ZRW=zrw_mp,                              &
+                     ZHW=zhw_mp,                              &
+                     ZHL=zhl_mp,                              &
+!                     cna=cna_mp, f_cna=( ntccna > 0 ),       & ! for future use
+                     cna=cna_mp, f_cna=.false. ,              &
+                     PII=prslk,                               &
+                     P=prsl,                                  &
+                     W=w,                                     &
+                     DZ=dz,                                   &
+                     DTP=dtptmp,                              &
+                     DN=rho,                                  &
+                     rainnc=xrain_mp, rainncv=xdelta_rain_mp, &
+                     snownc=xsnow_mp, snowncv=xdelta_snow_mp, &
+                     GRPLNC=xgraupel_mp,                      &
+                     GRPLNCV=xdelta_graupel_mp,               &
+                     sr=sr,                                   &
+                     dbz      = refl_10cm,                    &
+                     diagflag = diagflag,                     &
+                     errmsg=errmsg,errflg=errflg,             &
+                     re_cloud=re_cloud_mp,                    &
+                     re_ice=re_ice_mp,                        &
+                     re_snow=re_snow_mp,                      &
+                     re_rain=re_rain_mp,                      &
+                     has_reqc=has_reqc,                       &
+                     has_reqi=has_reqi,                       &
+                     has_reqs=has_reqs,                       &
+                     has_reqr=has_reqr,                       &
                   IDS=ids,IDE=ide, JDS=jds,JDE=jde, KDS=kds,KDE=kde, &
                   IMS=ims,IME=ime, JMS=jms,JME=jme, KMS=kms,KME=kme, &
                   ITS=its,ITE=ite, JTS=jts,JTE=jte, KTS=kts,KTE=kte  &
                                                                     )
 
-
            ELSE
 
-         CALL nssl_2mom_driver(                          &
-                    ITIMESTEP=itimestep,                &
-                  !   TH=th,                              &
-                     tt=tgrs,                          &
-                     QV=qv_mp,                         &
-                     QC=qc_mp,                         &
-                     QR=qr_mp,                         &
-                     QI=qi_mp,                         &
-                     QS=qs_mp,                         &
-                     QH=qh_mp,                         &
-                     QHL=qhl_mp,                        &
-!                     CCW=qnc_mp,                       &
-                     CCW=nc_mp,                    &
-                     CRW=nr_mp,                       &
-                     CCI=ni_mp,                       &
-                     CSW=ns_mp,                       &
-                     CHW=nh_mp,                       &
-                     CHL=nhl_mp,                       &
-                     VHW=vh_mp,                     &
-                     VHL=vhl_mp,                     &
-                     ZRW=zrw_mp,                     &
-                     ZHW=zhw_mp,                     &
-                     ZHL=zhl_mp,                     &
-                !     cn=cccn,                        &
-                     PII=prslk,                         &
-                     P=prsl,                                &
-                     W=w,                                &
-                     DZ=dz,                              &
-                     DTP=dtptmp,                         &
-                     DN=rho,                             &
-                     rainnc=xrain_mp, rainncv=xdelta_rain_mp,                         &
-                     snownc=xsnow_mp, snowncv=xdelta_snow_mp,                         &
-!                     icenc=ice_mp, icencv=delta_ice_mp,                             &
-                     GRPLNC=xgraupel_mp, GRPLNCV=xdelta_graupel_mp, sr=sr,      &
-                     dbz      = refl_10cm,               &
-!                     nssl_progn=.false.,                       &
-                     diagflag = diagflag,                &
-                     errmsg=errmsg,errflg=errflg,        &
-                     re_cloud=re_cloud_mp,                  &
-                     re_ice=re_ice_mp,                      &
-                     re_snow=re_snow_mp,                    &
-                     re_rain=re_rain_mp,                    &
-                     has_reqc=has_reqc,                  & ! ala G. Thompson
-                     has_reqi=has_reqi,                  & ! ala G. Thompson
-                     has_reqs=has_reqs,                  & ! ala G. Thompson
-                     has_reqr=has_reqr,                  &
+         CALL nssl_2mom_driver(                               &
+                     ITIMESTEP=itimestep,                     &
+                  !   TH=th,                                  &
+                     tt=tgrs,                                 &
+                     QV=qv_mp,                                &
+                     QC=qc_mp,                                &
+                     QR=qr_mp,                                &
+                     QI=qi_mp,                                &
+                     QS=qs_mp,                                &
+                     QH=qh_mp,                                &
+                     QHL=qhl_mp,                              &
+                     CCW=nc_mp,                               &
+                     CRW=nr_mp,                               &
+                     CCI=ni_mp,                               &
+                     CSW=ns_mp,                               &
+                     CHW=nh_mp,                               &
+                     CHL=nhl_mp,                              &
+                     VHW=vh_mp,                               &
+                     VHL=vhl_mp,                              &
+!                     cn=cn_mp,                                &
+                     ZRW=zrw_mp,                              &
+                     ZHW=zhw_mp,                              &
+                     ZHL=zhl_mp,                              &
+!                     cna=cna_mp, f_cna=( ntccna > 0 ),       & ! for future use
+!                     cna=cna_mp, f_cna=.false. ,              &
+                     PII=prslk,                               &
+                     P=prsl,                                  &
+                     W=w,                                     &
+                     DZ=dz,                                   &
+                     DTP=dtptmp,                              &
+                     DN=rho,                                  &
+                     rainnc=xrain_mp, rainncv=xdelta_rain_mp, &
+                     snownc=xsnow_mp, snowncv=xdelta_snow_mp, &
+                     GRPLNC=xgraupel_mp,                      &
+                     GRPLNCV=xdelta_graupel_mp,               &
+                     sr=sr,                                   &
+                     dbz      = refl_10cm,                    &
+                     diagflag = diagflag,                     &
+                     errmsg=errmsg,errflg=errflg,             &
+                     re_cloud=re_cloud_mp,                    &
+                     re_ice=re_ice_mp,                        &
+                     re_snow=re_snow_mp,                      &
+                     re_rain=re_rain_mp,                      &
+                     has_reqc=has_reqc,                       &
+                     has_reqi=has_reqi,                       &
+                     has_reqs=has_reqs,                       &
+                     has_reqr=has_reqr,                       &
                   IDS=ids,IDE=ide, JDS=jds,JDE=jde, KDS=kds,KDE=kde, &
                   IMS=ims,IME=ime, JMS=jms,JME=jme, KMS=kms,KME=kme, &
                   ITS=its,ITE=ite, JTS=jts,JTE=jte, KTS=kts,KTE=kte  &
                                                                     )
-           
+
            ENDIF
-           
-           
+
            DO i = 1,ncol
              delta_rain_mp(i) = delta_rain_mp(i) + xdelta_rain_mp(i) ! this is liquid equivalent of all precip
              delta_graupel_mp(i) = delta_graupel_mp(i) + xdelta_graupel_mp(i) ! this is liquid equivalent of graupel
@@ -720,7 +717,7 @@ subroutine mp_nssl_run(ncol, nlev, con_g, con_rd, mpirank, &
            ENDDO
 
           ENDDO
-          
+
           ENDIF