From 2bd4acda2aea59ad07b321159922ffa3f2e3387a Mon Sep 17 00:00:00 2001 From: "anning.cheng" Date: Mon, 23 Aug 2021 13:34:59 -0500 Subject: [PATCH 01/21] Coupling Merra2 aerosl climatology with Thompson microphysics --- physics/mp_thompson.F90 | 28 +++++++++++++++++++++- physics/mp_thompson.meta | 50 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+), 1 deletion(-) diff --git a/physics/mp_thompson.F90 b/physics/mp_thompson.F90 index c31d90b09..db6240c04 100644 --- a/physics/mp_thompson.F90 +++ b/physics/mp_thompson.F90 @@ -37,6 +37,7 @@ subroutine mp_thompson_init(ncol, nlev, con_g, con_rd, con_eps, & is_aerosol_aware, nc, nwfa2d, nifa2d, & nwfa, nifa, tgrs, prsl, phil, area, & re_cloud, re_ice, re_snow, & + iccn, iaerclm, aerfld, & mpicomm, mpirank, mpiroot, & threads, ext_diag, diag3d, & errmsg, errflg) @@ -49,6 +50,8 @@ subroutine mp_thompson_init(ncol, nlev, con_g, con_rd, con_eps, & real(kind_phys), intent(in ) :: con_g, con_rd, con_eps logical, intent(in ) :: restart integer, intent(in ) :: imp_physics + integer, intent(in ) :: iccn + logical, intent(in ) :: iaerclm integer, intent(in ) :: imp_physics_thompson ! Hydrometeors logical, intent(in ) :: convert_dry_rho @@ -72,6 +75,7 @@ subroutine mp_thompson_init(ncol, nlev, con_g, con_rd, con_eps, & real(kind_phys), intent(in ) :: prsl(:,:) real(kind_phys), intent(in ) :: phil(:,:) real(kind_phys), intent(in ) :: area(:) + real (kind=kind_phys), dimension(:,:,:),intent(in):: aerfld ! Cloud effective radii real(kind_phys), optional, intent( out) :: re_cloud(:,:) real(kind_phys), optional, intent( out) :: re_ice(:,:) @@ -104,7 +108,9 @@ subroutine mp_thompson_init(ncol, nlev, con_g, con_rd, con_eps, & errflg = 0 if (is_initialized) return - + if(iccn == 3 .and. iaerclm) then + call get_niwfa(aerfld, nifa, nwfa, ncol, nlev) + end if ! Consistency checks if (imp_physics/=imp_physics_thompson) then write(errmsg,'(*(a))') "Logic error: namelist choice of microphysics is different from Thompson MP" @@ -339,6 +345,7 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & prcp, rain, graupel, ice, snow, sr, & refl_10cm, reset_dBZ, do_radar_ref, & re_cloud, re_ice, re_snow, & + iccn, iaerclm, aerfld, & mpicomm, mpirank, mpiroot, blkno, & ext_diag, diag3d, reset_diag3d, & errmsg, errflg) @@ -350,6 +357,8 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & ! Dimensions and constants integer, intent(in ) :: ncol integer, intent(in ) :: nlev + integer, intent(in ) :: iccn + logical, intent(in ) :: iaerclm real(kind_phys), intent(in ) :: con_g real(kind_phys), intent(in ) :: con_rd real(kind_phys), intent(in ) :: con_eps @@ -376,6 +385,7 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & real(kind_phys), intent(in ) :: prsl(:,:) real(kind_phys), intent(in ) :: phii(:,:) real(kind_phys), intent(in ) :: omega(:,:) + real (kind=kind_phys), dimension(:,:,:),intent(in):: aerfld real(kind_phys), intent(in ) :: dtp logical, intent(in ) :: first_time_step integer, intent(in ) :: istep, nsteps @@ -499,6 +509,10 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & return end if + if(iccn == 3 .and. iaerclm) then + call get_niwfa(aerfld, nifa, nwfa, ncol, nlev) + end if + ! Set reduced time step if subcycling is used if (nsteps>1) then dtstep = dtp/real(nsteps, kind=kind_phys) @@ -938,5 +952,17 @@ subroutine mp_thompson_finalize(errmsg, errflg) is_initialized = .false. end subroutine mp_thompson_finalize + subroutine get_niwfa(aerfld, nifa, nwfa, ncol, nlev) + implicit none + integer, intent(in)::ncol, nlev + real (kind=kind_phys), dimension(:,:,:),intent(in):: aerfld + real (kind=kind_phys), dimension(:,:),intent(out)::nifa, nwfa + nifa=(aerfld(:,:,1)/4.0737762+aerfld(:,:,2)/30.459203+aerfld(:,:,3)/153.45048+ & + 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 + end subroutine get_niwfa + end module mp_thompson diff --git a/physics/mp_thompson.meta b/physics/mp_thompson.meta index ab00e6524..037c1b9d5 100644 --- a/physics/mp_thompson.meta +++ b/physics/mp_thompson.meta @@ -270,6 +270,31 @@ kind = kind_phys intent = out optional = T +[iccn] + standard_name = flag_for_in_ccn_forcing_for_morrison_gettelman_microphysics + long_name = flag for IN and CCN forcing for morrison gettelman microphysics + units = none + dimensions = () + type = integer + intent = in + optional = F +[iaerclm] + standard_name = flag_for_aerosol_input_MG_radiation + long_name = flag for using aerosols in Morrison-Gettelman MP_radiation + units = flag + dimensions = () + type = logical + intent = in + optional = F +[aerfld] + standard_name = aerosol_number_concentration_from_gocart_aerosol_climatology + long_name = GOCART aerosol climatology number concentration + units = kg-1 + dimensions = (horizontal_loop_extent,vertical_dimension,number_of_aerosol_tracers_MG) + type = real + kind = kind_phys + intent = in + optional = F [mpicomm] standard_name = mpi_communicator long_name = MPI communicator @@ -701,6 +726,31 @@ kind = kind_phys intent = out optional = T +[iccn] + standard_name = flag_for_in_ccn_forcing_for_morrison_gettelman_microphysics + long_name = flag for IN and CCN forcing for morrison gettelman microphysics + units = none + dimensions = () + type = integer + intent = in + optional = F +[iaerclm] + standard_name = flag_for_aerosol_input_MG_radiation + long_name = flag for using aerosols in Morrison-Gettelman MP_radiation + units = flag + dimensions = () + type = logical + intent = in + optional = F +[aerfld] + standard_name = aerosol_number_concentration_from_gocart_aerosol_climatology + long_name = GOCART aerosol climatology number concentration + units = kg-1 + dimensions = (horizontal_loop_extent,vertical_dimension,number_of_aerosol_tracers_MG) + type = real + kind = kind_phys + intent = in + optional = F [mpicomm] standard_name = mpi_communicator long_name = MPI communicator From dcfe289eb19c62833437e2e813564348ef77934c Mon Sep 17 00:00:00 2001 From: "anning.cheng" Date: Tue, 24 Aug 2021 15:49:31 -0500 Subject: [PATCH 02/21] merged the early version of merra nifa and nwfa --- physics/mp_thompson.F90 | 7 ++++--- physics/mp_thompson.meta | 12 ++++++------ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/physics/mp_thompson.F90 b/physics/mp_thompson.F90 index db6240c04..a4e274f29 100644 --- a/physics/mp_thompson.F90 +++ b/physics/mp_thompson.F90 @@ -108,9 +108,6 @@ subroutine mp_thompson_init(ncol, nlev, con_g, con_rd, con_eps, & errflg = 0 if (is_initialized) return - if(iccn == 3 .and. iaerclm) then - call get_niwfa(aerfld, nifa, nwfa, ncol, nlev) - end if ! Consistency checks if (imp_physics/=imp_physics_thompson) then write(errmsg,'(*(a))') "Logic error: namelist choice of microphysics is different from Thompson MP" @@ -125,6 +122,9 @@ subroutine mp_thompson_init(ncol, nlev, con_g, con_rd, con_eps, & return end if end if + if(iccn == 3 .and. iaerclm) then + call get_niwfa(aerfld, nifa, nwfa, ncol, nlev) + end if ! Call Thompson init call thompson_init(is_aerosol_aware_in=is_aerosol_aware, mpicomm=mpicomm, & @@ -952,6 +952,7 @@ subroutine mp_thompson_finalize(errmsg, errflg) is_initialized = .false. end subroutine mp_thompson_finalize + subroutine get_niwfa(aerfld, nifa, nwfa, ncol, nlev) implicit none integer, intent(in)::ncol, nlev diff --git a/physics/mp_thompson.meta b/physics/mp_thompson.meta index 037c1b9d5..641c54fd9 100644 --- a/physics/mp_thompson.meta +++ b/physics/mp_thompson.meta @@ -271,7 +271,7 @@ intent = out optional = T [iccn] - standard_name = flag_for_in_ccn_forcing_for_morrison_gettelman_microphysics + standard_name = control_for_ice_cloud_condensation_nuclei_forcing long_name = flag for IN and CCN forcing for morrison gettelman microphysics units = none dimensions = () @@ -287,10 +287,10 @@ intent = in optional = F [aerfld] - standard_name = aerosol_number_concentration_from_gocart_aerosol_climatology + standard_name = mass_number_concentration_of_aerosol_from_gocart_climatology long_name = GOCART aerosol climatology number concentration units = kg-1 - dimensions = (horizontal_loop_extent,vertical_dimension,number_of_aerosol_tracers_MG) + dimensions = (horizontal_dimension,vertical_layer_dimension,number_of_aerosol_tracers_MG) type = real kind = kind_phys intent = in @@ -727,7 +727,7 @@ intent = out optional = T [iccn] - standard_name = flag_for_in_ccn_forcing_for_morrison_gettelman_microphysics + standard_name = control_for_ice_cloud_condensation_nuclei_forcing long_name = flag for IN and CCN forcing for morrison gettelman microphysics units = none dimensions = () @@ -743,10 +743,10 @@ intent = in optional = F [aerfld] - standard_name = aerosol_number_concentration_from_gocart_aerosol_climatology + standard_name = mass_number_concentration_of_aerosol_from_gocart_climatology long_name = GOCART aerosol climatology number concentration units = kg-1 - dimensions = (horizontal_loop_extent,vertical_dimension,number_of_aerosol_tracers_MG) + dimensions = (horizontal_loop_extent,vertical_layer_dimension,number_of_aerosol_tracers_MG) type = real kind = kind_phys intent = in From f26d1fc7bffc50e198ba3173c5f7dbd900ff4540 Mon Sep 17 00:00:00 2001 From: "anning.cheng" Date: Thu, 26 Aug 2021 17:10:25 -0400 Subject: [PATCH 03/21] version worked for producing nifa and nwfa --- physics/GFS_rrtmgp_lw_post.meta | 2 +- physics/GFS_rrtmgp_sw_post.meta | 2 +- physics/drag_suite.meta | 3 +-- physics/radlw_param.meta | 10 ++++++++++ physics/radsw_param.f | 3 +++ physics/radsw_param.meta | 10 ++++++++++ physics/rrtmgp_lw_cloud_optics.meta | 2 +- physics/rrtmgp_sw_cloud_optics.meta | 2 +- physics/rte-rrtmgp | 2 +- 9 files changed, 29 insertions(+), 7 deletions(-) diff --git a/physics/GFS_rrtmgp_lw_post.meta b/physics/GFS_rrtmgp_lw_post.meta index 4e88ea60f..36f388a60 100644 --- a/physics/GFS_rrtmgp_lw_post.meta +++ b/physics/GFS_rrtmgp_lw_post.meta @@ -172,7 +172,7 @@ intent = in optional = F [cldtaulw] - standard_name = RRTMGP_cloud_optical_depth_layers_at_10mu_band + 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) diff --git a/physics/GFS_rrtmgp_sw_post.meta b/physics/GFS_rrtmgp_sw_post.meta index 73f25cc74..2f4bb5419 100644 --- a/physics/GFS_rrtmgp_sw_post.meta +++ b/physics/GFS_rrtmgp_sw_post.meta @@ -234,7 +234,7 @@ intent = in optional = F [cldtausw] - standard_name = RRTMGP_cloud_optical_depth_layers_at_0_55mu_band + 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) diff --git a/physics/drag_suite.meta b/physics/drag_suite.meta index 71aa3ff4d..0cdcc682f 100644 --- a/physics/drag_suite.meta +++ b/physics/drag_suite.meta @@ -5,7 +5,7 @@ ######################################################################## [ccpp-arg-table] - name = unified_ugwp_init + name = drag_suite_init type = scheme [gwd_opt] standard_name = control_for_drag_suite_gravity_wave_drag @@ -720,4 +720,3 @@ type = integer intent = out optional = F - diff --git a/physics/radlw_param.meta b/physics/radlw_param.meta index 05fe5af57..c2fc40df3 100644 --- a/physics/radlw_param.meta +++ b/physics/radlw_param.meta @@ -17,6 +17,16 @@ name = sfcflw_type type = ddt +######################################################################## +[ccpp-table-properties] + name = proflw_type + type = ddt + dependencies = + +[ccpp-arg-table] + name = proflw_type + type = ddt + ######################################################################## [ccpp-table-properties] name = module_radlw_parameters diff --git a/physics/radsw_param.f b/physics/radsw_param.f index 93608eb65..b352bc785 100644 --- a/physics/radsw_param.f +++ b/physics/radsw_param.f @@ -94,6 +94,9 @@ module module_radsw_parameters ! end type sfcfsw_type ! !> derived type for SW fluxes' column profiles (at layer interfaces) +!! \section arg_table_profsw_type +!! \htmlinclude profsw_type.html +!! type profsw_type real (kind=kind_phys) :: upfxc !< total-sky upward flux real (kind=kind_phys) :: dnfxc !< total-sky downward flux diff --git a/physics/radsw_param.meta b/physics/radsw_param.meta index 7f7da3bdd..d6b734a7a 100644 --- a/physics/radsw_param.meta +++ b/physics/radsw_param.meta @@ -27,6 +27,16 @@ name = cmpfsw_type type = ddt +######################################################################## +[ccpp-table-properties] + name = profsw_type + type = ddt + dependencies = + +[ccpp-arg-table] + name = profsw_type + type = ddt + ######################################################################## [ccpp-table-properties] name = module_radsw_parameters diff --git a/physics/rrtmgp_lw_cloud_optics.meta b/physics/rrtmgp_lw_cloud_optics.meta index 09d79a388..6b72faa41 100644 --- a/physics/rrtmgp_lw_cloud_optics.meta +++ b/physics/rrtmgp_lw_cloud_optics.meta @@ -292,7 +292,7 @@ intent = in optional = F [cldtaulw] - standard_name = RRTMGP_cloud_optical_depth_layers_at_10mu_band + 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) diff --git a/physics/rrtmgp_sw_cloud_optics.meta b/physics/rrtmgp_sw_cloud_optics.meta index 9da5093b2..3956579a4 100644 --- a/physics/rrtmgp_sw_cloud_optics.meta +++ b/physics/rrtmgp_sw_cloud_optics.meta @@ -297,7 +297,7 @@ intent = out optional = F [cldtausw] - standard_name = RRTMGP_cloud_optical_depth_layers_at_0_55mu_band + 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) diff --git a/physics/rte-rrtmgp b/physics/rte-rrtmgp index 3be5c3437..d9594c46c 160000 --- a/physics/rte-rrtmgp +++ b/physics/rte-rrtmgp @@ -1 +1 @@ -Subproject commit 3be5c3437da541575a293e74b0049721642a6975 +Subproject commit d9594c46c877a2ab8001f5cd37961efdcf08ad8e From a9754186a9ac301cf4b43289089a0f96d26a9f7d Mon Sep 17 00:00:00 2001 From: "anning.cheng" Date: Tue, 31 Aug 2021 09:59:16 -0400 Subject: [PATCH 04/21] added merra2_aerosol_aware --- physics/module_mp_thompson.F90 | 7 ++++++- physics/mp_thompson.F90 | 22 ++++++++++++++++------ 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/physics/module_mp_thompson.F90 b/physics/module_mp_thompson.F90 index f05aa8ba2..a72ce8e44 100644 --- a/physics/module_mp_thompson.F90 +++ b/physics/module_mp_thompson.F90 @@ -980,6 +980,7 @@ SUBROUTINE mp_gt_driver(qv, qc, qr, qi, qs, qg, ni, nr, nc, & refl_10cm, diagflag, do_radar_ref, & vt_dbz_wt, first_time_step, & re_cloud, re_ice, re_snow, & + iccn, iaerclm, & has_reqc, has_reqi, has_reqs, & rand_perturb_on, & kme_stoch, & @@ -1046,6 +1047,9 @@ SUBROUTINE mp_gt_driver(qv, qc, qr, qi, qs, qg, ni, nr, nc, & REAL, DIMENSION(ims:ime, kms:kme, jms:jme), OPTIONAL, INTENT(INOUT):: & vt_dbz_wt LOGICAL, INTENT(IN) :: first_time_step + integer, intent(in ) :: iccn + logical, intent(in ) :: iaerclm + REAL, INTENT(IN):: dt_in, dt_inner ! To support subcycling: current step and maximum number of steps INTEGER, INTENT (IN) :: istep, nsteps @@ -1107,6 +1111,7 @@ SUBROUTINE mp_gt_driver(qv, qc, qr, qi, qs, qg, ni, nr, nc, & LOGICAL, OPTIONAL, INTENT(IN) :: diagflag INTEGER, OPTIONAL, INTENT(IN) :: do_radar_ref logical :: melti = .false. + logical :: merra2_aerosol_aware INTEGER :: ndt, it ! CCPP error handling @@ -1151,7 +1156,7 @@ SUBROUTINE mp_gt_driver(qv, qc, qr, qi, qs, qg, ni, nr, nc, & stop end if end if - + if(iccn == 3 .and. iaerclm) merra2_aerosol_aware=.true. if (is_aerosol_aware .and. (.not.present(nc) .or. & .not.present(nwfa) .or. & .not.present(nifa) .or. & diff --git a/physics/mp_thompson.F90 b/physics/mp_thompson.F90 index a4e274f29..ac6eb35fa 100644 --- a/physics/mp_thompson.F90 +++ b/physics/mp_thompson.F90 @@ -102,6 +102,7 @@ subroutine mp_thompson_init(ncol, nlev, con_g, con_rd, con_eps, & ! real (kind=kind_phys) :: h_01, airmass, niIN3, niCCN3 integer :: i, k + logical :: merra2_aerosol_aware ! set to true by iccn and iaerclm, coupling merra2 with thompson ! Initialize the CCPP error handling variables errmsg = '' @@ -123,6 +124,7 @@ subroutine mp_thompson_init(ncol, nlev, con_g, con_rd, con_eps, & end if end if if(iccn == 3 .and. iaerclm) then + merra2_aerosol_aware=.true. call get_niwfa(aerfld, nifa, nwfa, ncol, nlev) end if @@ -164,7 +166,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) @@ -317,7 +319,7 @@ subroutine mp_thompson_init(ncol, nlev, con_g, con_rd, con_eps, & ni = ni/(1.0_kind_phys+qv) nr = nr/(1.0_kind_phys+qv) - if (is_aerosol_aware) then + if (is_aerosol_aware.or.merra2_aerosol_aware) then nc = nc/(1.0_kind_phys+qv) nwfa = nwfa/(1.0_kind_phys+qv) nifa = nifa/(1.0_kind_phys+qv) @@ -440,6 +442,7 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & real(kind_phys) :: delta_snow_mp(1:ncol) ! mm ! Radar reflectivity logical :: diagflag ! must be true if do_radar_ref is true, not used otherwise + logical :: merra2_aerosol_aware ! set to true by iccn and iaerclm, coupling merra2 with thompson integer :: do_radar_ref_mp ! integer instead of logical do_radar_ref ! Effective cloud radii logical :: do_effective_radii @@ -510,6 +513,7 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & end if if(iccn == 3 .and. iaerclm) then + merra2_aerosol_aware=.true. call get_niwfa(aerfld, nifa, nwfa, ncol, nlev) end if @@ -557,7 +561,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.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) @@ -684,7 +688,7 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & end if set_extended_diagnostic_pointers !> - Call mp_gt_driver() with or without aerosols - if (is_aerosol_aware) then + if (is_aerosol_aware.merra2_aerosol_aware) then if (do_effective_radii) then call mp_gt_driver(qv=qv, qc=qc, qr=qr, qi=qi, qs=qs, qg=qg, ni=ni, nr=nr, & nc=nc, nwfa=nwfa, nifa=nifa, nwfa2d=nwfa2d, nifa2d=nifa2d, & @@ -696,6 +700,7 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & refl_10cm=refl_10cm, & diagflag=diagflag, do_radar_ref=do_radar_ref_mp, & re_cloud=re_cloud, re_ice=re_ice, re_snow=re_snow, & + iccn=iccn, iaerclm=iaerclm, & has_reqc=has_reqc, has_reqi=has_reqi, has_reqs=has_reqs, & rand_perturb_on=rand_perturb_on, kme_stoch=kme_stoch, & ! DH* 2020-06-05 not passing this optional argument, see @@ -744,7 +749,9 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & ims=ims, ime=ime, jms=jms, jme=jme, kms=kms, kme=kme, & its=its, ite=ite, jts=jts, jte=jte, kts=kts, kte=kte, & reset_dBZ=reset_dBZ, istep=istep, nsteps=nsteps, & - first_time_step=first_time_step, errmsg=errmsg, errflg=errflg, & + first_time_step=first_time_step, & + iccn=iccn, iaerclm=iaerclm, & + errmsg=errmsg, errflg=errflg, & ! Extended diagnostics ext_diag=ext_diag, & ! vts1=vts1, txri=txri, txrc=txrc, & @@ -776,6 +783,7 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & refl_10cm=refl_10cm, & diagflag=diagflag, do_radar_ref=do_radar_ref_mp, & re_cloud=re_cloud, re_ice=re_ice, re_snow=re_snow, & + iccn=iccn, iaerclm=iaerclm, & has_reqc=has_reqc, has_reqi=has_reqi, has_reqs=has_reqs, & rand_perturb_on=rand_perturb_on, kme_stoch=kme_stoch, & ! DH* 2020-06-05 not passing this optional argument, see @@ -823,7 +831,9 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & ims=ims, ime=ime, jms=jms, jme=jme, kms=kms, kme=kme, & its=its, ite=ite, jts=jts, jte=jte, kts=kts, kte=kte, & reset_dBZ=reset_dBZ, istep=istep, nsteps=nsteps, & - first_time_step=first_time_step, errmsg=errmsg, errflg=errflg, & + first_time_step=first_time_step, & + iccn=iccn, iaerclm=iaerclm, & + errmsg=errmsg, errflg=errflg, & ! Extended diagnostics ext_diag=ext_diag, & ! vts1=vts1, txri=txri, txrc=txrc, & From ab47e49edbd4306e5c11fc6347220119b75579f9 Mon Sep 17 00:00:00 2001 From: "anning.cheng" Date: Fri, 3 Sep 2021 16:38:36 -0400 Subject: [PATCH 05/21] added mraerosol in typedef --- physics/GFS_PBL_generic.F90 | 76 ++++++++++++++++++++++++---------- physics/GFS_PBL_generic.meta | 16 +++++++ physics/GFS_rrtmg_pre.F90 | 59 ++++++++++++++++---------- physics/module_mp_thompson.F90 | 30 ++++++++------ physics/mp_thompson.F90 | 76 ++++++++++++++++------------------ physics/mp_thompson.meta | 40 ++++-------------- 6 files changed, 169 insertions(+), 128 deletions(-) diff --git a/physics/GFS_PBL_generic.F90 b/physics/GFS_PBL_generic.F90 index 63e622204..51e596ed5 100644 --- a/physics/GFS_PBL_generic.F90 +++ b/physics/GFS_PBL_generic.F90 @@ -11,10 +11,10 @@ module GFS_PBL_generic_common contains - subroutine set_aerosol_tracer_index(imp_physics, imp_physics_wsm6, & - imp_physics_thompson, ltaerosol, & - imp_physics_mg, ntgl, imp_physics_gfdl, & - imp_physics_zhao_carr, kk, & + subroutine set_aerosol_tracer_index(imp_physics, imp_physics_wsm6, & + imp_physics_thompson, ltaerosol,mraeorosol, & + imp_physics_mg, ntgl, imp_physics_gfdl, & + imp_physics_zhao_carr, kk, & errmsg, errflg) implicit none ! @@ -22,7 +22,7 @@ subroutine set_aerosol_tracer_index(imp_physics, imp_physics_wsm6, & imp_physics_thompson, & imp_physics_mg, ntgl, imp_physics_gfdl, & imp_physics_zhao_carr - logical, intent(in ) :: ltaerosol + logical, intent(in ) :: ltaerosol, mraerosol integer, intent(out) :: kk character(len=*), intent(out) :: errmsg integer, intent(out) :: errflg @@ -37,6 +37,8 @@ subroutine set_aerosol_tracer_index(imp_physics, imp_physics_wsm6, & ! Thompson if(ltaerosol) then kk = 10 + else if(mraerosol) then + kk = 8 else kk = 7 endif @@ -79,12 +81,12 @@ end subroutine GFS_PBL_generic_pre_finalize !! \section arg_table_GFS_PBL_generic_pre_run Argument Table !! \htmlinclude GFS_PBL_generic_pre_run.html !! - 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, & - imp_physics, imp_physics_gfdl, imp_physics_thompson, imp_physics_wsm6, & - imp_physics_zhao_carr, imp_physics_mg, imp_physics_fer_hires, ltaerosol, & - hybedmf, do_shoc, satmedmf, qgrs, vdftra, save_u, save_v, save_t, save_q, & + 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, & + imp_physics, imp_physics_gfdl, imp_physics_thompson, imp_physics_wsm6, & + imp_physics_zhao_carr, imp_physics_mg, imp_physics_fer_hires, ltaerosol, mraerosol, & + 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) use machine, only : kind_phys @@ -101,6 +103,7 @@ subroutine GFS_PBL_generic_pre_run (im, levs, nvdiff, ntrac, rtg_ozone_index, 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 + logical, intent(in) :: mraerosol real(kind=kind_phys), dimension(:,:,:), intent(in) :: qgrs real(kind=kind_phys), dimension(:,:), intent(in) :: ugrs, vgrs, tgrs @@ -173,6 +176,22 @@ subroutine GFS_PBL_generic_pre_run (im, levs, nvdiff, ntrac, rtg_ozone_index, enddo enddo rtg_ozone_index = 10 + elseif(ltaerosol) then + do k=1,levs + do i=1,im + vdftra(i,k,1) = qgrs(i,k,ntqv) + vdftra(i,k,2) = qgrs(i,k,ntcw) + vdftra(i,k,3) = qgrs(i,k,ntiw) + vdftra(i,k,4) = qgrs(i,k,ntrw) + vdftra(i,k,5) = qgrs(i,k,ntsw) + vdftra(i,k,6) = qgrs(i,k,ntgl) + 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,ntoz) + enddo + enddo + rtg_ozone_index = 8 else do k=1,levs do i=1,im @@ -253,10 +272,10 @@ subroutine GFS_PBL_generic_pre_run (im, levs, nvdiff, ntrac, rtg_ozone_index, endif ! if (trans_aero) then - call set_aerosol_tracer_index(imp_physics, imp_physics_wsm6, & - imp_physics_thompson, ltaerosol, & - imp_physics_mg, ntgl, imp_physics_gfdl, & - imp_physics_zhao_carr, kk, & + call set_aerosol_tracer_index(imp_physics, imp_physics_wsm6, & + imp_physics_thompson, ltaerosol,mraerosol, & + imp_physics_mg, ntgl, imp_physics_gfdl, & + imp_physics_zhao_carr, kk, & errmsg, errflg) if (errflg /= 0) return ! @@ -329,7 +348,7 @@ subroutine GFS_PBL_generic_post_run (im, levs, nvdiff, ntrac, trans_aero, ntchs, ntchm, & imp_physics, imp_physics_gfdl, imp_physics_thompson, imp_physics_wsm6, imp_physics_zhao_carr, imp_physics_mg, & imp_physics_fer_hires, & - ltaerosol, cplflx, cplchm, lssav, flag_for_pbl_generic_tend, ldiag3d, lsidea, hybedmf, do_shoc, satmedmf, & + ltaerosol, mraerosol, cplflx, 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, & index_of_process_pbl, dqsfc_cpl, dusfci_cpl, dvsfci_cpl, dtsfci_cpl, dqsfci_cpl, dusfc_diag, dvsfc_diag, dtsfc_diag, & @@ -349,7 +368,7 @@ subroutine GFS_PBL_generic_post_run (im, levs, nvdiff, ntrac, 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 - logical, intent(in) :: ltaerosol, cplflx, cplchm, lssav, ldiag3d, lsidea + logical, intent(in) :: ltaerosol, cplflx, cplchm, lssav, ldiag3d, lsidea, mraerosol logical, intent(in) :: hybedmf, do_shoc, satmedmf, shinhong, do_ysu logical, intent(in) :: flag_for_pbl_generic_tend @@ -416,10 +435,10 @@ subroutine GFS_PBL_generic_post_run (im, levs, nvdiff, ntrac, ! if (trans_aero) then ! Set kk if chemistry-aerosol tracers are diffused - call set_aerosol_tracer_index(imp_physics, imp_physics_wsm6, & - imp_physics_thompson, ltaerosol, & - imp_physics_mg, ntgl, imp_physics_gfdl, & - imp_physics_zhao_carr, kk, & + call set_aerosol_tracer_index(imp_physics, imp_physics_wsm6, & + imp_physics_thompson, ltaerosol,mraerosol, & + imp_physics_mg, ntgl, imp_physics_gfdl, & + imp_physics_zhao_carr, kk, & errmsg, errflg) if (errflg /= 0) return ! @@ -477,6 +496,21 @@ subroutine GFS_PBL_generic_post_run (im, levs, nvdiff, ntrac, dqdt(i,k,ntia) = dvdftra(i,k,12) enddo enddo + else if(mraerosol) then + do k=1,levs + do i=1,im + dqdt(i,k,ntqv) = dvdftra(i,k,1) + dqdt(i,k,ntcw) = dvdftra(i,k,2) + dqdt(i,k,ntiw) = dvdftra(i,k,3) + dqdt(i,k,ntrw) = dvdftra(i,k,4) + dqdt(i,k,ntsw) = dvdftra(i,k,5) + dqdt(i,k,ntgl) = dvdftra(i,k,6) + dqdt(i,k,ntlnc) = dvdftra(i,k,7) + dqdt(i,k,ntinc) = dvdftra(i,k,8) + dqdt(i,k,ntrnc) = dvdftra(i,k,9) + dqdt(i,k,ntoz) = dvdftra(i,k,10) + enddo + enddo else do k=1,levs do i=1,im diff --git a/physics/GFS_PBL_generic.meta b/physics/GFS_PBL_generic.meta index 074ab5b43..a3eb00cd0 100644 --- a/physics/GFS_PBL_generic.meta +++ b/physics/GFS_PBL_generic.meta @@ -271,6 +271,14 @@ type = logical intent = in optional = F +[mraerosol] + standard_name = flag_for_merra2_aerosol_aware_for_thompson + long_name = flag for merra2 aerosol-aware physics for thompson microphysics + units = flag + dimensions = () + type = logical + intent = in + optional = F [hybedmf] standard_name = flag_for_hybrid_edmf_pbl_scheme long_name = flag for hybrid edmf pbl scheme (moninedmf) @@ -692,6 +700,14 @@ type = logical intent = in optional = F +[mraerosol] + standard_name = flag_for_merra2_aerosol_aware_for_thompson + long_name = flag for merra2 aerosol-aware physics for thompson microphysics + units = flag + dimensions = () + type = logical + intent = in + optional = F [cplflx] standard_name = flag_for_surface_flux_coupling long_name = flag controlling cplflx collection (default off) diff --git a/physics/GFS_rrtmg_pre.F90 b/physics/GFS_rrtmg_pre.F90 index dbea66985..11a4a48bd 100644 --- a/physics/GFS_rrtmg_pre.F90 +++ b/physics/GFS_rrtmg_pre.F90 @@ -16,25 +16,25 @@ end subroutine GFS_rrtmg_pre_init !! ! Attention - the output arguments lm, im, lmk, lmp must not be set ! in the CCPP version - they are defined in the interstitial_create routine - 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, ntrw, ntsw, ntgl, ntwa, ntoz, & - ntclamt, nleffr, nieffr, nseffr, lndp_type, kdt, imp_physics, & - 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, 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, & - sppt_wts, sppt_amp, cnvw_in, cnvc_in, qgrs, aer_nm, dx, icloud, & !inputs from here and above - coszen, coszdg, effrl_inout, effri_inout, effrs_inout, & - clouds1, clouds2, clouds3, clouds4, clouds5, & !in/out from here and above - kd, kt, kb, mtopa, mbota, raddt, tsfg, tsfa, de_lgth, alb1d, delp, dz, & !output from here and below - plvl, plyr, tlvl, tlyr, qlyr, olyr, gasvmr_co2, gasvmr_n2o, gasvmr_ch4,& - gasvmr_o2, gasvmr_co, gasvmr_cfc11, gasvmr_cfc12, gasvmr_cfc22, & - gasvmr_ccl4, gasvmr_cfc113, aerodp, clouds6, clouds7, clouds8, & - clouds9, cldsa, cldfra, faersw1, faersw2, faersw3, faerlw1, faerlw2, & + 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, ntrw, ntsw, ntgl, ntwa, ntoz, & + ntclamt, nleffr, nieffr, nseffr, lndp_type, kdt, imp_physics, & + 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, julian, yearlen, lndp_var_list, lsswr, lslwr, & + ltaerosol, mraerosol, 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, & + sppt_wts, sppt_amp, cnvw_in, cnvc_in, qgrs, aer_nm, dx, icloud, & !inputs from here and above + coszen, coszdg, effrl_inout, effri_inout, effrs_inout, & + clouds1, clouds2, clouds3, clouds4, clouds5, & !in/out from here and above + kd, kt, kb, mtopa, mbota, raddt, tsfg, tsfa, de_lgth, alb1d, delp, dz, & !output from here and below + plvl, plyr, tlvl, tlyr, qlyr, olyr, gasvmr_co2, gasvmr_n2o, gasvmr_ch4, & + gasvmr_o2, gasvmr_co, gasvmr_cfc11, gasvmr_cfc12, gasvmr_cfc22, & + gasvmr_ccl4, gasvmr_cfc113, aerodp, clouds6, clouds7, clouds8, & + clouds9, cldsa, cldfra, faersw1, faersw2, faersw3, faerlw1, faerlw2, & faerlw3, alpha, errmsg, errflg) use machine, only: kind_phys @@ -98,9 +98,9 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp, & character(len=3), dimension(:), intent(in) :: lndp_var_list - logical, intent(in) :: lsswr, lslwr, ltaerosol, lgfdlmprad, & - uni_cld, effr_in, do_mynnedmf, & - lmfshal, lmfdeep2, pert_clds + logical, intent(in) :: lsswr, lslwr, ltaerosol, lgfdlmprad, & + uni_cld, effr_in, do_mynnedmf, & + lmfshal, lmfdeep2, pert_clds,mraerosol 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 @@ -651,6 +651,21 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp, & nwfa (i,k) = tracer1(i,k,ntwa) enddo enddo + else if (imp_physics == imp_physics_thompson .and. mraerosol) then + do k=1,LMK + do i=1,IM + qvs = qlyr(i,k) + qv_mp (i,k) = qvs/(1.-qvs) + rho (i,k) = con_eps*plyr(i,k)*100./(con_rd*tlyr(i,k)*(qv_mp(i,k)+con_eps)) + orho (i,k) = 1.0/rho(i,k) + qc_mp (i,k) = tracer1(i,k,ntcw)/(1.-qvs) + qi_mp (i,k) = tracer1(i,k,ntiw)/(1.-qvs) + qs_mp (i,k) = tracer1(i,k,ntsw)/(1.-qvs) + nc_mp (i,k) = tracer1(i,k,ntlnc)/(1.-qvs) + ni_mp (i,k) = tracer1(i,k,ntinc)/(1.-qvs) + enddo + enddo + elseif (imp_physics == imp_physics_thompson) then do k=1,LMK do i=1,IM diff --git a/physics/module_mp_thompson.F90 b/physics/module_mp_thompson.F90 index a72ce8e44..394edc495 100644 --- a/physics/module_mp_thompson.F90 +++ b/physics/module_mp_thompson.F90 @@ -71,8 +71,10 @@ MODULE module_mp_thompson LOGICAL, PARAMETER, PRIVATE:: iiwarm = .false. LOGICAL, PRIVATE:: is_aerosol_aware = .false. + LOGICAL, PRIVATE:: merra2_aerosol_aware = .false. LOGICAL, PARAMETER, PRIVATE:: dustyIce = .true. LOGICAL, PARAMETER, PRIVATE:: homogIce = .true. + LOGICAL :: merra2_aerosol_aware = .false. INTEGER, PARAMETER, PRIVATE:: IFDRY = 0 REAL, PARAMETER, PRIVATE:: T_0 = 273.15 @@ -438,12 +440,14 @@ MODULE module_mp_thompson !>\section gen_thompson_init thompson_init General Algorithm !> @{ SUBROUTINE thompson_init(is_aerosol_aware_in, & + merra2_erosol_aware_in, & mpicomm, mpirank, mpiroot, & threads, errmsg, errflg) IMPLICIT NONE LOGICAL, INTENT(IN) :: is_aerosol_aware_in + LOGICAL, INTENT(IN) :: merra2_aerosol_aware_in INTEGER, INTENT(IN) :: mpicomm, mpirank, mpiroot INTEGER, INTENT(IN) :: threads CHARACTER(len=*), INTENT(INOUT) :: errmsg @@ -456,9 +460,12 @@ SUBROUTINE thompson_init(is_aerosol_aware_in, & ! Set module variable is_aerosol_aware is_aerosol_aware = is_aerosol_aware_in + merra2_aerosol_aware = merra2_aerosol_aware_in if (mpirank==mpiroot) then if (is_aerosol_aware) then write (0,'(a)') 'Using aerosol-aware version of Thompson microphysics' + else if(merra2_aerosol_aware) then + write (0,'(a)') 'Using merra2 aerosol-aware version of Thompson microphysics' else write (0,'(a)') 'Using non-aerosol-aware version of Thompson microphysics' end if @@ -1111,7 +1118,6 @@ SUBROUTINE mp_gt_driver(qv, qc, qr, qi, qs, qg, ni, nr, nc, & LOGICAL, OPTIONAL, INTENT(IN) :: diagflag INTEGER, OPTIONAL, INTENT(IN) :: do_radar_ref logical :: melti = .false. - logical :: merra2_aerosol_aware INTEGER :: ndt, it ! CCPP error handling @@ -1156,7 +1162,6 @@ SUBROUTINE mp_gt_driver(qv, qc, qr, qi, qs, qg, ni, nr, nc, & stop end if end if - if(iccn == 3 .and. iaerclm) merra2_aerosol_aware=.true. if (is_aerosol_aware .and. (.not.present(nc) .or. & .not.present(nwfa) .or. & .not.present(nifa) .or. & @@ -1404,7 +1409,7 @@ SUBROUTINE mp_gt_driver(qv, qc, qr, qi, qs, qg, ni, nr, nc, & qcten1(k) = 0. endif initialize_extended_diagnostics enddo - if (is_aerosol_aware) then + if (is_aerosol_aware .or. merra2_aerosol_aware) then do k = kts, kte nc1d(k) = nc(i,k,j) nwfa1d(k) = nwfa(i,k,j) @@ -2169,7 +2174,7 @@ subroutine mp_thompson (qv1d, qc1d, qi1d, qr1d, qs1d, qg1d, ni1d, & endif nc(k) = MIN( DBLE(Nt_c_max), ccg(1,nu_c)*ocg2(nu_c)*rc(k) & / am_r*lamc**bm_r) - if (.NOT. is_aerosol_aware) nc(k) = Nt_c + if (.NOT. (is_aerosol_aware .or. merra2_aerosol_aware)) nc(k) = Nt_c else qc1d(k) = 0.0 nc1d(k) = 0.0 @@ -2835,7 +2840,7 @@ subroutine mp_thompson (qv1d, qc1d, qi1d, qr1d, qs1d, qg1d, ni1d, & !! Implemented by T. Eidhammer and G. Thompson 2012Dec18 !+---+-----------------------------------------------------------------+ - if (dustyIce .AND. is_aerosol_aware) then + if (dustyIce .AND. (is_aerosol_aware .or. merra2_aerosol_aware)) then xni = iceDeMott(tempc,qvs(k),qvs(k),qvsi(k),rho(k),nifa(k)) else xni = 1.0 *1000. ! Default is 1.0 per Liter @@ -2883,7 +2888,7 @@ subroutine mp_thompson (qv1d, qc1d, qi1d, qr1d, qs1d, qg1d, ni1d, & !! we may need to relax the temperature and ssati constraints. if ( (ssati(k).ge. 0.25) .or. (ssatw(k).gt. eps & .and. temp(k).lt.253.15) ) then - if (dustyIce .AND. is_aerosol_aware) then + if (dustyIce .AND. (is_aerosol_aware .or. merra2_aerosol_aware)) then xnc = iceDeMott(tempc,qv(k),qvs(k),qvsi(k),rho(k),nifa(k)) xnc = xnc*(1.0 + 50.*rand3) else @@ -2897,7 +2902,7 @@ subroutine mp_thompson (qv1d, qc1d, qi1d, qr1d, qs1d, qg1d, ni1d, & !> - Freezing of aqueous aerosols based on Koop et al (2001, Nature) xni = smo0(k)+ni(k) + (pni_rfz(k)+pni_wfz(k)+pni_inu(k))*dtsave - if (is_aerosol_aware .AND. homogIce .AND. (xni.le.999.E3) & + if ((is_aerosol_aware .or. merra2_aerosol_aware) .AND. homogIce .AND. (xni.le.999.E3) & & .AND.(temp(k).lt.238).AND.(ssati(k).ge.0.4) ) then xnc = iceKoop(temp(k),qv(k),qvs(k),nwfa(k), dtsave) pni_iha(k) = xnc*odts @@ -3351,7 +3356,7 @@ subroutine mp_thompson (qv1d, qc1d, qi1d, qr1d, qs1d, qg1d, ni1d, & if ((qc1d(k) + qcten(k)*DT) .gt. R1) then rc(k) = (qc1d(k) + qcten(k)*DT)*rho(k) nc(k) = MAX(2., MIN((nc1d(k)+ncten(k)*DT)*rho(k), Nt_c_max)) - if (.NOT. is_aerosol_aware) nc(k) = Nt_c + if (.NOT. (is_aerosol_aware .or. merra2_aerosol_aware)) nc(k) = Nt_c L_qc(k) = .true. else rc(k) = R1 @@ -3519,7 +3524,7 @@ subroutine mp_thompson (qv1d, qc1d, qi1d, qr1d, qs1d, qg1d, ni1d, & prw_vcd(k) = clap*odt !+---+-----------------------------------------------------------------+ ! DROPLET NUCLEATION if (clap .gt. eps) then - if (is_aerosol_aware) then + if (is_aerosol_aware .or. merra2_aerosol_aware) then xnc = MAX(2., activ_ncloud(temp(k), w1d(k)+rand3, nwfa(k))) else xnc = Nt_c @@ -3527,7 +3532,8 @@ subroutine mp_thompson (qv1d, qc1d, qi1d, qr1d, qs1d, qg1d, ni1d, & pnc_wcd(k) = 0.5*(xnc-nc(k) + abs(xnc-nc(k)))*odts*orho !+---+-----------------------------------------------------------------+ ! EVAPORATION - elseif (clap .lt. -eps .AND. ssatw(k).lt.-1.E-6 .AND. is_aerosol_aware) then + elseif (clap .lt. -eps .AND. ssatw(k).lt.-1.E-6 .AND. + & (is_aerosol_aware .or. merra_aerosol_aware)) then & tempc = temp(k) - 273.15 otemp = 1./temp(k) rvs = rho(k)*qvs(k) @@ -3591,7 +3597,7 @@ subroutine mp_thompson (qv1d, qc1d, qi1d, qr1d, qs1d, qg1d, ni1d, & rc(k) = MAX(R1, (qc1d(k) + DT*qcten(k))*rho(k)) if (rc(k).eq.R1) L_qc(k) = .false. nc(k) = MAX(2., MIN((nc1d(k)+ncten(k)*DT)*rho(k), Nt_c_max)) - if (.NOT. is_aerosol_aware) nc(k) = Nt_c + if (.NOT. (is_aerosol_aware .or. merra2_aerosol_aware)) nc(k) = Nt_c qv(k) = MAX(1.E-10, qv1d(k) + DT*qvten(k)) temp(k) = t1d(k) + DT*tten(k) rho(k) = 0.622*pres(k)/(R*temp(k)*(qv(k)+0.622)) @@ -5651,7 +5657,7 @@ subroutine calc_effectRad (t1d, p1d, qv1d, qc1d, nc1d, qi1d, ni1d, qs1d, & rho(k) = 0.622*p1d(k)/(R*t1d(k)*(qv1d(k)+0.622)) rc(k) = MAX(R1, qc1d(k)*rho(k)) nc(k) = MAX(2., MIN(nc1d(k)*rho(k), Nt_c_max)) - if (.NOT. is_aerosol_aware) nc(k) = Nt_c + if (.NOT. (is_aerosol_aware .or. merra2_aerosol_aware)) nc(k) = Nt_c if (rc(k).gt.R1 .and. nc(k).gt.R2) has_qc = .true. ri(k) = MAX(R1, qi1d(k)*rho(k)) ni(k) = MAX(R2, ni1d(k)*rho(k)) diff --git a/physics/mp_thompson.F90 b/physics/mp_thompson.F90 index ac6eb35fa..ca0d93619 100644 --- a/physics/mp_thompson.F90 +++ b/physics/mp_thompson.F90 @@ -10,6 +10,7 @@ module mp_thompson use module_mp_thompson, only : thompson_init, mp_gt_driver, thompson_finalize, calc_effectRad use module_mp_thompson, only : naIN0, naIN1, naCCN0, naCCN1, eps, Nt_c + use module_mp_thompson, only : merra2_aerosol_aware use module_mp_thompson, only : re_qc_min, re_qc_max, re_qi_min, re_qi_max, re_qs_min, re_qs_max use module_mp_thompson_make_number_concentrations, only: make_IceNumber, make_DropletNumber, make_RainNumber @@ -27,17 +28,17 @@ module mp_thompson contains !> This subroutine is a wrapper around the actual thompson_init(). -!! \section arg_table_mp_thompson_init Argument Table +!! \section arg_table_mp_thompson use module_mp_thompson, only : _init Argument Table !! \htmlinclude mp_thompson_init.html !! subroutine mp_thompson_init(ncol, nlev, con_g, con_rd, con_eps, & restart, imp_physics, & imp_physics_thompson, convert_dry_rho,& spechum, qc, qr, qi, qs, qg, ni, nr, & - is_aerosol_aware, nc, nwfa2d, nifa2d, & + is_aerosol_aware, merra2_aerosol_aware& + nc, nwfa2d, nifa2d, & nwfa, nifa, tgrs, prsl, phil, area, & - re_cloud, re_ice, re_snow, & - iccn, iaerclm, aerfld, & + re_cloud, re_ice, re_snow, aerfld, & mpicomm, mpirank, mpiroot, & threads, ext_diag, diag3d, & errmsg, errflg) @@ -50,8 +51,6 @@ subroutine mp_thompson_init(ncol, nlev, con_g, con_rd, con_eps, & real(kind_phys), intent(in ) :: con_g, con_rd, con_eps logical, intent(in ) :: restart integer, intent(in ) :: imp_physics - integer, intent(in ) :: iccn - logical, intent(in ) :: iaerclm integer, intent(in ) :: imp_physics_thompson ! Hydrometeors logical, intent(in ) :: convert_dry_rho @@ -65,6 +64,7 @@ subroutine mp_thompson_init(ncol, nlev, con_g, con_rd, con_eps, & real(kind_phys), intent(inout) :: nr(:,:) ! Aerosols logical, intent(in ) :: is_aerosol_aware + logical, intent(in ) :: merra2_aerosol_aware real(kind_phys), optional, intent(inout) :: nc(:,:) real(kind_phys), optional, intent(inout) :: nwfa(:,:) real(kind_phys), optional, intent(inout) :: nifa(:,:) @@ -102,7 +102,6 @@ subroutine mp_thompson_init(ncol, nlev, con_g, con_rd, con_eps, & ! real (kind=kind_phys) :: h_01, airmass, niIN3, niCCN3 integer :: i, k - logical :: merra2_aerosol_aware ! set to true by iccn and iaerclm, coupling merra2 with thompson ! Initialize the CCPP error handling variables errmsg = '' @@ -123,13 +122,10 @@ subroutine mp_thompson_init(ncol, nlev, con_g, con_rd, con_eps, & return end if end if - if(iccn == 3 .and. iaerclm) then - merra2_aerosol_aware=.true. - call get_niwfa(aerfld, nifa, nwfa, ncol, nlev) - end if ! Call Thompson init - call thompson_init(is_aerosol_aware_in=is_aerosol_aware, mpicomm=mpicomm, & + call thompson_init(is_aerosol_aware_in=is_aerosol_aware, & + merra2_aerosol_aware, mpicomm=mpicomm, & mpirank=mpirank, mpiroot=mpiroot, threads=threads, & errmsg=errmsg, errflg=errflg) if (errflg /= 0) return @@ -166,7 +162,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.or.merra2_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) @@ -273,6 +269,12 @@ subroutine mp_thompson_init(ncol, nlev, con_g, con_rd, con_eps, & ! Copy to local array for calculating cloud effective radii below nc_local = nc + else if(merra2_aerosol_aware) then + call get_niwfa(aerfld, nifa, nwfa, ncol, nlev) + ! Ensure we have 1st guess cloud droplet number where mass non-zero but no number. + where(qc .LE. 0.0) nc=0.0 + where(qc .GT. 0 .and. nc .LE. 0.0) nc = make_DropletNumber(qc*rho, nwfa*rho) * orho + where(qc .EQ. 0.0 .and. nc .GT. 0.0) nc = 0.0 else @@ -319,7 +321,7 @@ subroutine mp_thompson_init(ncol, nlev, con_g, con_rd, con_eps, & ni = ni/(1.0_kind_phys+qv) nr = nr/(1.0_kind_phys+qv) - if (is_aerosol_aware.or.merra2_aerosol_aware) then + if (is_aerosol_aware .or. merra2_aerosol_aware) then nc = nc/(1.0_kind_phys+qv) nwfa = nwfa/(1.0_kind_phys+qv) nifa = nifa/(1.0_kind_phys+qv) @@ -337,19 +339,19 @@ end subroutine mp_thompson_init !>\ingroup aathompson !>\section gen_thompson_hrrr Thompson MP General Algorithm !>@{ - subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & - con_eps, convert_dry_rho, & - spechum, qc, qr, qi, qs, qg, ni, nr, & - is_aerosol_aware, nc, nwfa, nifa, & - nwfa2d, nifa2d, & - tgrs, prsl, phii, omega, dt_inner, & - dtp, first_time_step, istep, nsteps, & - prcp, rain, graupel, ice, snow, sr, & - refl_10cm, reset_dBZ, do_radar_ref, & - re_cloud, re_ice, re_snow, & - iccn, iaerclm, aerfld, & - mpicomm, mpirank, mpiroot, blkno, & - ext_diag, diag3d, reset_diag3d, & + subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & + con_eps, convert_dry_rho, & + spechum, qc, qr, qi, qs, qg, ni, nr, & + is_aerosol_aware, merra2_aerosol_aware, & + nc, nwfa, nifa, & + nwfa2d, nifa2d, & + tgrs, prsl, phii, omega, dt_inner, & + dtp, first_time_step, istep, nsteps, & + prcp, rain, graupel, ice, snow, sr, & + refl_10cm, reset_dBZ, do_radar_ref, & + re_cloud, re_ice, re_snow, aerfld, & + mpicomm, mpirank, mpiroot, blkno, & + ext_diag, diag3d, reset_diag3d, & errmsg, errflg) implicit none @@ -359,8 +361,6 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & ! Dimensions and constants integer, intent(in ) :: ncol integer, intent(in ) :: nlev - integer, intent(in ) :: iccn - logical, intent(in ) :: iaerclm real(kind_phys), intent(in ) :: con_g real(kind_phys), intent(in ) :: con_rd real(kind_phys), intent(in ) :: con_eps @@ -376,6 +376,7 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & real(kind_phys), intent(inout) :: nr(:,:) ! Aerosols logical, intent(in) :: is_aerosol_aware, reset_dBZ + logical, intent(in) :: merra2_aerosol_aware ! The following arrays are not allocated if is_aerosol_aware is false real(kind_phys), optional, intent(inout) :: nc(:,:) real(kind_phys), optional, intent(inout) :: nwfa(:,:) @@ -442,7 +443,6 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & real(kind_phys) :: delta_snow_mp(1:ncol) ! mm ! Radar reflectivity logical :: diagflag ! must be true if do_radar_ref is true, not used otherwise - logical :: merra2_aerosol_aware ! set to true by iccn and iaerclm, coupling merra2 with thompson integer :: do_radar_ref_mp ! integer instead of logical do_radar_ref ! Effective cloud radii logical :: do_effective_radii @@ -512,10 +512,6 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & return end if - if(iccn == 3 .and. iaerclm) then - merra2_aerosol_aware=.true. - call get_niwfa(aerfld, nifa, nwfa, ncol, nlev) - end if ! Set reduced time step if subcycling is used if (nsteps>1) then @@ -561,10 +557,12 @@ 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.merra2_aerosol_aware) then + if (is_aerosol_aware) then nc = nc/(1.0_kind_phys-spechum) nwfa = nwfa/(1.0_kind_phys-spechum) nifa = nifa/(1.0_kind_phys-spechum) + else if (merra2_aerosol_aware) then + call get_niwfa(aerfld, nifa, nwfa, ncol, nlev) end if end if ! *DH @@ -688,7 +686,7 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & end if set_extended_diagnostic_pointers !> - Call mp_gt_driver() with or without aerosols - if (is_aerosol_aware.merra2_aerosol_aware) then + if (is_aerosol_aware .or. merra2_aerosol_aware) then if (do_effective_radii) then call mp_gt_driver(qv=qv, qc=qc, qr=qr, qi=qi, qs=qs, qg=qg, ni=ni, nr=nr, & nc=nc, nwfa=nwfa, nifa=nifa, nwfa2d=nwfa2d, nifa2d=nifa2d, & @@ -700,7 +698,6 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & refl_10cm=refl_10cm, & diagflag=diagflag, do_radar_ref=do_radar_ref_mp, & re_cloud=re_cloud, re_ice=re_ice, re_snow=re_snow, & - iccn=iccn, iaerclm=iaerclm, & has_reqc=has_reqc, has_reqi=has_reqi, has_reqs=has_reqs, & rand_perturb_on=rand_perturb_on, kme_stoch=kme_stoch, & ! DH* 2020-06-05 not passing this optional argument, see @@ -750,7 +747,6 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & its=its, ite=ite, jts=jts, jte=jte, kts=kts, kte=kte, & reset_dBZ=reset_dBZ, istep=istep, nsteps=nsteps, & first_time_step=first_time_step, & - iccn=iccn, iaerclm=iaerclm, & errmsg=errmsg, errflg=errflg, & ! Extended diagnostics ext_diag=ext_diag, & @@ -783,7 +779,6 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & refl_10cm=refl_10cm, & diagflag=diagflag, do_radar_ref=do_radar_ref_mp, & re_cloud=re_cloud, re_ice=re_ice, re_snow=re_snow, & - iccn=iccn, iaerclm=iaerclm, & has_reqc=has_reqc, has_reqi=has_reqi, has_reqs=has_reqs, & rand_perturb_on=rand_perturb_on, kme_stoch=kme_stoch, & ! DH* 2020-06-05 not passing this optional argument, see @@ -832,7 +827,6 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & its=its, ite=ite, jts=jts, jte=jte, kts=kts, kte=kte, & reset_dBZ=reset_dBZ, istep=istep, nsteps=nsteps, & first_time_step=first_time_step, & - iccn=iccn, iaerclm=iaerclm, & errmsg=errmsg, errflg=errflg, & ! Extended diagnostics ext_diag=ext_diag, & @@ -873,7 +867,7 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & ni = ni/(1.0_kind_phys+qv) nr = nr/(1.0_kind_phys+qv) - if (is_aerosol_aware) then + if (is_aerosol_aware .or. merra2_aerosol_aware) then nc = nc/(1.0_kind_phys+qv) nwfa = nwfa/(1.0_kind_phys+qv) nifa = nifa/(1.0_kind_phys+qv) diff --git a/physics/mp_thompson.meta b/physics/mp_thompson.meta index 641c54fd9..c939039ef 100644 --- a/physics/mp_thompson.meta +++ b/physics/mp_thompson.meta @@ -270,22 +270,6 @@ kind = kind_phys intent = out optional = T -[iccn] - standard_name = control_for_ice_cloud_condensation_nuclei_forcing - long_name = flag for IN and CCN forcing for morrison gettelman microphysics - units = none - dimensions = () - type = integer - intent = in - optional = F -[iaerclm] - standard_name = flag_for_aerosol_input_MG_radiation - long_name = flag for using aerosols in Morrison-Gettelman MP_radiation - units = flag - dimensions = () - type = logical - intent = in - optional = F [aerfld] standard_name = mass_number_concentration_of_aerosol_from_gocart_climatology long_name = GOCART aerosol climatology number concentration @@ -497,6 +481,14 @@ type = logical intent = in optional = F +[is_aerosol_aware] + standard_name = flag_for_merra2_aerosol_aware_for_thompson + long_name = flag for merra2 aerosol-aware physics + units = flag + dimensions = () + type = logical + intent = in + optional = F [nc] standard_name = mass_number_concentration_of_cloud_liquid_water_particles_in_air_of_new_state long_name = cloud droplet number concentration @@ -726,22 +718,6 @@ kind = kind_phys intent = out optional = T -[iccn] - standard_name = control_for_ice_cloud_condensation_nuclei_forcing - long_name = flag for IN and CCN forcing for morrison gettelman microphysics - units = none - dimensions = () - type = integer - intent = in - optional = F -[iaerclm] - standard_name = flag_for_aerosol_input_MG_radiation - long_name = flag for using aerosols in Morrison-Gettelman MP_radiation - units = flag - dimensions = () - type = logical - intent = in - optional = F [aerfld] standard_name = mass_number_concentration_of_aerosol_from_gocart_climatology long_name = GOCART aerosol climatology number concentration From 842799217b4c7dfff52f34a7d004359066d0831d Mon Sep 17 00:00:00 2001 From: "anning.cheng" Date: Fri, 17 Sep 2021 14:34:08 -0500 Subject: [PATCH 06/21] complete code for mraerosol --- physics/GFS_PBL_generic.F90 | 4 +-- physics/GFS_rrtmg_pre.F90 | 4 +-- physics/GFS_rrtmg_pre.meta | 8 +++++ physics/GFS_rrtmgp_thompsonmp_pre.F90 | 8 ++++- physics/GFS_rrtmgp_thompsonmp_pre.meta | 8 +++++ physics/GFS_suite_interstitial.F90 | 10 +++--- physics/GFS_suite_interstitial.meta | 16 +++++++++ physics/module_MYNNPBL_wrapper.F90 | 46 ++++++++++++++++++++++++-- physics/module_MYNNPBL_wrapper.meta | 8 +++++ physics/rte-rrtmgp | 2 +- 10 files changed, 102 insertions(+), 12 deletions(-) diff --git a/physics/GFS_PBL_generic.F90 b/physics/GFS_PBL_generic.F90 index 51e596ed5..401084479 100644 --- a/physics/GFS_PBL_generic.F90 +++ b/physics/GFS_PBL_generic.F90 @@ -12,7 +12,7 @@ module GFS_PBL_generic_common contains subroutine set_aerosol_tracer_index(imp_physics, imp_physics_wsm6, & - imp_physics_thompson, ltaerosol,mraeorosol, & + imp_physics_thompson, ltaerosol,mraerosol, & imp_physics_mg, ntgl, imp_physics_gfdl, & imp_physics_zhao_carr, kk, & errmsg, errflg) @@ -176,7 +176,7 @@ subroutine GFS_PBL_generic_pre_run (im, levs, nvdiff, ntrac, rtg_ozone_index, enddo enddo rtg_ozone_index = 10 - elseif(ltaerosol) then + elseif(mraerosol) then do k=1,levs do i=1,im vdftra(i,k,1) = qgrs(i,k,ntqv) diff --git a/physics/GFS_rrtmg_pre.F90 b/physics/GFS_rrtmg_pre.F90 index 11a4a48bd..44667174a 100644 --- a/physics/GFS_rrtmg_pre.F90 +++ b/physics/GFS_rrtmg_pre.F90 @@ -652,7 +652,7 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp, & enddo enddo else if (imp_physics == imp_physics_thompson .and. mraerosol) then - do k=1,LMK + do k=1,LMK do i=1,IM qvs = qlyr(i,k) qv_mp (i,k) = qvs/(1.-qvs) @@ -779,7 +779,7 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp, & ! Update number concentration, consistent with sub-grid clouds (GF, MYNN) or without (all others) do k=1,lm do i=1,im - if (ltaerosol .and. qc_mp(i,k)>1.e-12 .and. nc_mp(i,k)<100.) then + if ((ltaerosol .or. mraerosol) .and. qc_mp(i,k)>1.e-12 .and. nc_mp(i,k)<100.) then nc_mp(i,k) = make_DropletNumber(qc_mp(i,k)*rho(i,k), nwfa(i,k)*rho(i,k)) * orho(i,k) endif if (qi_mp(i,k)>1.e-12 .and. ni_mp(i,k)<100.) then diff --git a/physics/GFS_rrtmg_pre.meta b/physics/GFS_rrtmg_pre.meta index c7c5380cb..76bed26d3 100644 --- a/physics/GFS_rrtmg_pre.meta +++ b/physics/GFS_rrtmg_pre.meta @@ -363,6 +363,14 @@ type = logical intent = in optional = F +[mraerosol] + standard_name = flag_for_merra2_aerosol_aware_for_thompson + long_name = flag for merra2 aerosol-aware physics for thompson microphysics + units = flag + dimensions = () + type = logical + intent = in + optional = F [lgfdlmprad] standard_name = flag_for_GFDL_microphysics_radiation_interaction long_name = flag for GFDL microphysics-radiation interaction diff --git a/physics/GFS_rrtmgp_thompsonmp_pre.F90 b/physics/GFS_rrtmgp_thompsonmp_pre.F90 index 85877704f..38f7c4453 100644 --- a/physics/GFS_rrtmgp_thompsonmp_pre.F90 +++ b/physics/GFS_rrtmgp_thompsonmp_pre.F90 @@ -41,7 +41,7 @@ subroutine GFS_rrtmgp_thompsonmp_pre_run(nCol, nLev, nTracers, ncnd, doSWrad, do i_cldliq, i_cldice, i_cldrain, i_cldsnow, i_cldgrpl, i_cldtot, i_cldliq_nc, & i_cldice_nc, i_twa, effr_in, p_lev, p_lay, tv_lay, t_lay, effrin_cldliq, & effrin_cldice, effrin_cldsnow, tracer, qs_lay, q_lay, relhum, con_g, con_rd, & - con_eps, lmfshal, ltaerosol, do_mynnedmf, imfdeepcnv, imfdeepcnv_gf, & + con_eps, lmfshal, ltaerosol, mraerosol, do_mynnedmf, imfdeepcnv, imfdeepcnv_gf, & doGP_cldoptics_PADE, doGP_cldoptics_LUT, & cld_frac, cld_lwp, cld_reliq, cld_iwp, cld_reice, cld_swp, cld_resnow, cld_rwp, & cld_rerain, precip_frac, errmsg, errflg) @@ -69,6 +69,7 @@ subroutine GFS_rrtmgp_thompsonmp_pre_run(nCol, nLev, nTracers, ncnd, doSWrad, do effr_in, & ! Use cloud effective radii provided by model? lmfshal, & ! Flag for mass-flux shallow convection scheme used by Xu-Randall ltaerosol, & ! Flag for aerosol option + mraerosol, & ! Flag for merra2 aerosol option do_mynnedmf, & ! Flag to activate MYNN-EDMF doGP_cldoptics_LUT,& ! Flag to do GP cloud-optics (LUTs) doGP_cldoptics_PADE ! (PADE approximation) @@ -165,6 +166,11 @@ subroutine GFS_rrtmgp_thompsonmp_pre_run(nCol, nLev, nTracers, ncnd, doSWrad, do 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 nc_mp(iCol,iLay) = nt_c*orho endif diff --git a/physics/GFS_rrtmgp_thompsonmp_pre.meta b/physics/GFS_rrtmgp_thompsonmp_pre.meta index d2a976f47..935481057 100644 --- a/physics/GFS_rrtmgp_thompsonmp_pre.meta +++ b/physics/GFS_rrtmgp_thompsonmp_pre.meta @@ -277,6 +277,14 @@ type = logical intent = in optional = F +[mraerosol] + standard_name = flag_for_merra2_aerosol_aware_for_thompson + long_name = flag for merra2 aerosol-aware physics for thompson microphysics + units = flag + dimensions = () + type = logical + intent = in + optional = F [do_mynnedmf] standard_name = flag_for_mellor_yamada_nakanishi_niino_pbl_scheme long_name = flag to activate MYNN-EDMF diff --git a/physics/GFS_suite_interstitial.F90 b/physics/GFS_suite_interstitial.F90 index 6bc702216..c5ee64700 100644 --- a/physics/GFS_suite_interstitial.F90 +++ b/physics/GFS_suite_interstitial.F90 @@ -515,7 +515,8 @@ end subroutine GFS_suite_interstitial_3_finalize !! \htmlinclude GFS_suite_interstitial_3_run.html !! subroutine GFS_suite_interstitial_3_run (im, levs, nn, cscnv, & - satmedmf, trans_trac, do_shoc, ltaerosol, ntrac, ntcw, & + satmedmf, trans_trac, do_shoc, & + ltaerosol, mraerosol, ntrac, ntcw, & ntiw, ntclamt, ntrw, ntsw, ntrnc, ntsnc, ntgl, ntgnc, & xlon, xlat, gt0, gq0, imp_physics, imp_physics_mg, & imp_physics_zhao_carr, imp_physics_zhao_carr_pdf, & @@ -536,6 +537,7 @@ subroutine GFS_suite_interstitial_3_run (im, levs, nn, cscnv, & imp_physics_gfdl, imp_physics_thompson, imp_physics_wsm6,imp_physics_fer_hires, me, index_of_process_conv_trans integer, intent(in ), dimension(:) :: islmsk, kpbl, kinver logical, intent(in ) :: cscnv, satmedmf, trans_trac, do_shoc, ltaerosol, ras + logical, intent(in ) :: mraerosol integer, intent(in) :: ntinc, ntlnc logical, intent(in) :: ldiag3d, qdiag3d @@ -658,7 +660,7 @@ subroutine GFS_suite_interstitial_3_run (im, levs, nn, cscnv, & save_tcp(i,k) = gt0(i,k) enddo enddo - if(ltaerosol) then + if(ltaerosol .or. mraerosol) then save_qi(:,:) = clw(:,:,1) save_qc(:,:) = clw(:,:,2) else @@ -699,7 +701,7 @@ end subroutine GFS_suite_interstitial_4_finalize !> \section arg_table_GFS_suite_interstitial_4_run Argument Table !! \htmlinclude GFS_suite_interstitial_4_run.html !! - subroutine GFS_suite_interstitial_4_run (im, levs, ltaerosol, tracers_total, ntrac, ntcw, ntiw, ntclamt, & + subroutine GFS_suite_interstitial_4_run (im, levs, ltaerosol, mraerosol, tracers_total, ntrac, ntcw, ntiw, ntclamt, & ntrw, ntsw, ntrnc, ntsnc, ntgl, ntgnc, ntlnc, ntinc, nn, imp_physics, imp_physics_gfdl, imp_physics_thompson, & imp_physics_zhao_carr, imp_physics_zhao_carr_pdf, convert_dry_rho, dtf, save_qc, save_qi, con_pi, dtidx, dtend,& index_of_process_conv_trans, gq0, clw, prsl, save_tcp, con_rd, con_eps, nwfa, spechum, ldiag3d, & @@ -716,7 +718,7 @@ subroutine GFS_suite_interstitial_4_run (im, levs, ltaerosol, tracers_total, ntr ntsw, ntrnc, ntsnc, ntgl, ntgnc, ntlnc, ntinc, nn, imp_physics, imp_physics_gfdl, imp_physics_thompson, & imp_physics_zhao_carr, imp_physics_zhao_carr_pdf - logical, intent(in) :: ltaerosol, convert_dry_rho + logical, intent(in) :: ltaerosol, convert_dry_rho, mraerosol real(kind=kind_phys), intent(in ) :: con_pi, dtf real(kind=kind_phys), intent(in ), dimension(:,:) :: save_qc diff --git a/physics/GFS_suite_interstitial.meta b/physics/GFS_suite_interstitial.meta index 3dd3db7ab..2510a5344 100644 --- a/physics/GFS_suite_interstitial.meta +++ b/physics/GFS_suite_interstitial.meta @@ -1231,6 +1231,14 @@ type = logical intent = in optional = F +[mraerosol] + standard_name = flag_for_merra2_aerosol_aware_for_thompson + long_name = flag for merra2 aerosol-aware physics for thompson microphysics + units = flag + dimensions = () + type = logical + intent = in + optional = F [ntrac] standard_name = number_of_tracers long_name = number of tracers @@ -1695,6 +1703,14 @@ type = logical intent = in optional = F +[mraerosol] + standard_name = flag_for_merra2_aerosol_aware_for_thompson + long_name = flag for merra2 aerosol-aware physics for thompson microphysics + units = flag + dimensions = () + type = logical + intent = in + optional = F [tracers_total] standard_name = number_of_total_tracers long_name = total number of tracers diff --git a/physics/module_MYNNPBL_wrapper.F90 b/physics/module_MYNNPBL_wrapper.F90 index 4b034f588..ae9c03a65 100644 --- a/physics/module_MYNNPBL_wrapper.F90 +++ b/physics/module_MYNNPBL_wrapper.F90 @@ -108,7 +108,7 @@ SUBROUTINE mynnedmf_wrapper_run( & & icloud_bl, do_mynnsfclay, & & imp_physics, imp_physics_gfdl, & & imp_physics_thompson, imp_physics_wsm6, & - & ltaerosol, lprnt, errmsg, errflg ) + & ltaerosol, mraerosol, lprnt, errmsg, errflg ) ! should be moved to inside the mynn: use machine , only : kind_phys @@ -195,7 +195,8 @@ SUBROUTINE mynnedmf_wrapper_run( & ! NAMELIST OPTIONS (INPUT): LOGICAL, INTENT(IN) :: bl_mynn_tkeadvect, ltaerosol, & lprnt, do_mynnsfclay, & - flag_for_pbl_generic_tend + flag_for_pbl_generic_tend, & + mraerosol INTEGER, INTENT(IN) :: & & bl_mynn_cloudpdf, & & bl_mynn_mixlength, & @@ -426,6 +427,30 @@ SUBROUTINE mynnedmf_wrapper_run( & qnifa(i,k) = qgrs_ice_aer_num_conc(i,k) enddo enddo + else if(mraerosol) then + FLAG_QI = .true. + FLAG_QNI= .true. + FLAG_QC = .true. + FLAG_QNC= .true. + FLAG_QNWFA= .false. + FLAG_QNIFA= .false. + p_qc = 2 + p_qr = 0 + p_qi = 2 + p_qs = 0 + p_qg = 0 + p_qnc= 0 + p_qni= 0 + do k=1,levs + do i=1,im + sqv(i,k) = qgrs_water_vapor(i,k) + sqc(i,k) = qgrs_liquid_cloud(i,k) + sqi(i,k) = qgrs_ice_cloud(i,k) + qnc(i,k) = qgrs_cloud_droplet_num_conc(i,k) + qni(i,k) = qgrs_cloud_ice_num_conc(i,k) + ozone(i,k) = qgrs_ozone(i,k) + enddo + enddo else FLAG_QI = .true. FLAG_QNI= .true. @@ -816,6 +841,23 @@ SUBROUTINE mynnedmf_wrapper_run( & ! !qgrs_ice_aer_num_conc(i,k) = qgrs_ice_aer_num_conc(i,k) + RQNIFABLTEN(i,k)*delt ! enddo !enddo + else if(mraerosol) then + do k=1,levs + do i=1,im + dqdt_water_vapor(i,k) = RQVBLTEN(i,k) !/(1.0 + qv(i,k)) + dqdt_liquid_cloud(i,k) = RQCBLTEN(i,k) !/(1.0 + qv(i,k)) + dqdt_cloud_droplet_num_conc(i,k) = RQNCBLTEN(i,k) + dqdt_ice_cloud(i,k) = RQIBLTEN(i,k) !/(1.0 + qv(i,k)) + dqdt_ice_num_conc(i,k) = RQNIBLTEN(i,k) + enddo + enddo + if(ldiag3d .and. .not. flag_for_pbl_generic_tend) then + call dtend_helper(100+ntqv,RQVBLTEN) + call dtend_helper(100+ntcw,RQCBLTEN) + call dtend_helper(100+ntlnc,RQNCBLTEN) + call dtend_helper(100+ntiw,RQIBLTEN) + call dtend_helper(100+ntinc,RQNIBLTEN) + endif else !Thompson (2008) do k=1,levs diff --git a/physics/module_MYNNPBL_wrapper.meta b/physics/module_MYNNPBL_wrapper.meta index e88975aff..ec803619e 100644 --- a/physics/module_MYNNPBL_wrapper.meta +++ b/physics/module_MYNNPBL_wrapper.meta @@ -1427,6 +1427,14 @@ type = logical intent = in optional = F +[mraerosol] + standard_name = flag_for_merra2_aerosol_aware_for_thompson + long_name = flag for merra2 aerosol-aware physics for thompson microphysics + units = flag + dimensions = () + type = logical + intent = in + optional = F [lprnt] standard_name = flag_print long_name = control flag for diagnostic print out diff --git a/physics/rte-rrtmgp b/physics/rte-rrtmgp index d9594c46c..3be5c3437 160000 --- a/physics/rte-rrtmgp +++ b/physics/rte-rrtmgp @@ -1 +1 @@ -Subproject commit d9594c46c877a2ab8001f5cd37961efdcf08ad8e +Subproject commit 3be5c3437da541575a293e74b0049721642a6975 From 8a9b8d1a6a46faf94c90ddfb08abd60c5cc41216 Mon Sep 17 00:00:00 2001 From: "anning.cheng" Date: Wed, 6 Oct 2021 10:04:01 -0400 Subject: [PATCH 07/21] mraerosol branch can pass control regression tests --- physics/module_mp_thompson.F90 | 14 ++++++-------- physics/mp_thompson.F90 | 27 ++++++++++++++------------- physics/mp_thompson.meta | 10 +++++++++- physics/rte-rrtmgp | 2 +- 4 files changed, 30 insertions(+), 23 deletions(-) diff --git a/physics/module_mp_thompson.F90 b/physics/module_mp_thompson.F90 index 394edc495..c91c28dc4 100644 --- a/physics/module_mp_thompson.F90 +++ b/physics/module_mp_thompson.F90 @@ -74,7 +74,6 @@ MODULE module_mp_thompson LOGICAL, PRIVATE:: merra2_aerosol_aware = .false. LOGICAL, PARAMETER, PRIVATE:: dustyIce = .true. LOGICAL, PARAMETER, PRIVATE:: homogIce = .true. - LOGICAL :: merra2_aerosol_aware = .false. INTEGER, PARAMETER, PRIVATE:: IFDRY = 0 REAL, PARAMETER, PRIVATE:: T_0 = 273.15 @@ -440,7 +439,7 @@ MODULE module_mp_thompson !>\section gen_thompson_init thompson_init General Algorithm !> @{ SUBROUTINE thompson_init(is_aerosol_aware_in, & - merra2_erosol_aware_in, & + merra2_aerosol_aware_in, & mpicomm, mpirank, mpiroot, & threads, errmsg, errflg) @@ -987,7 +986,6 @@ SUBROUTINE mp_gt_driver(qv, qc, qr, qi, qs, qg, ni, nr, nc, & refl_10cm, diagflag, do_radar_ref, & vt_dbz_wt, first_time_step, & re_cloud, re_ice, re_snow, & - iccn, iaerclm, & has_reqc, has_reqi, has_reqs, & rand_perturb_on, & kme_stoch, & @@ -1028,7 +1026,9 @@ SUBROUTINE mp_gt_driver(qv, qc, qr, qi, qs, qg, ni, nr, nc, & REAL, DIMENSION(ims:ime, kms:kme, jms:jme), OPTIONAL, INTENT(IN):: & pii REAL, DIMENSION(ims:ime, kms:kme, jms:jme), OPTIONAL, INTENT(INOUT):: & - nc, nwfa, nifa + nc + REAL, DIMENSION(ims:ime, kms:kme, jms:jme), OPTIONAL, INTENT(INOUT):: & + nwfa, nifa REAL, DIMENSION(ims:ime, jms:jme), OPTIONAL, INTENT(IN):: nwfa2d, nifa2d REAL, DIMENSION(ims:ime, kms:kme, jms:jme), OPTIONAL, INTENT(INOUT):: & re_cloud, re_ice, re_snow @@ -1054,8 +1054,6 @@ SUBROUTINE mp_gt_driver(qv, qc, qr, qi, qs, qg, ni, nr, nc, & REAL, DIMENSION(ims:ime, kms:kme, jms:jme), OPTIONAL, INTENT(INOUT):: & vt_dbz_wt LOGICAL, INTENT(IN) :: first_time_step - integer, intent(in ) :: iccn - logical, intent(in ) :: iaerclm REAL, INTENT(IN):: dt_in, dt_inner ! To support subcycling: current step and maximum number of steps @@ -3532,8 +3530,8 @@ subroutine mp_thompson (qv1d, qc1d, qi1d, qr1d, qs1d, qg1d, ni1d, & pnc_wcd(k) = 0.5*(xnc-nc(k) + abs(xnc-nc(k)))*odts*orho !+---+-----------------------------------------------------------------+ ! EVAPORATION - elseif (clap .lt. -eps .AND. ssatw(k).lt.-1.E-6 .AND. - & (is_aerosol_aware .or. merra_aerosol_aware)) then & + elseif (clap .lt. -eps .AND. ssatw(k).lt.-1.E-6 .AND. & + (is_aerosol_aware .or. merra2_aerosol_aware)) then tempc = temp(k) - 273.15 otemp = 1./temp(k) rvs = rho(k)*qvs(k) diff --git a/physics/mp_thompson.F90 b/physics/mp_thompson.F90 index ca0d93619..cb4e21e52 100644 --- a/physics/mp_thompson.F90 +++ b/physics/mp_thompson.F90 @@ -10,7 +10,6 @@ module mp_thompson use module_mp_thompson, only : thompson_init, mp_gt_driver, thompson_finalize, calc_effectRad use module_mp_thompson, only : naIN0, naIN1, naCCN0, naCCN1, eps, Nt_c - use module_mp_thompson, only : merra2_aerosol_aware use module_mp_thompson, only : re_qc_min, re_qc_max, re_qi_min, re_qi_max, re_qs_min, re_qs_max use module_mp_thompson_make_number_concentrations, only: make_IceNumber, make_DropletNumber, make_RainNumber @@ -28,19 +27,19 @@ module mp_thompson contains !> This subroutine is a wrapper around the actual thompson_init(). -!! \section arg_table_mp_thompson use module_mp_thompson, only : _init Argument Table +!! \section arg_table_mp_thompson_init Argument Table !! \htmlinclude mp_thompson_init.html !! - subroutine mp_thompson_init(ncol, nlev, con_g, con_rd, con_eps, & - restart, imp_physics, & - imp_physics_thompson, convert_dry_rho,& - spechum, qc, qr, qi, qs, qg, ni, nr, & - is_aerosol_aware, merra2_aerosol_aware& - nc, nwfa2d, nifa2d, & - nwfa, nifa, tgrs, prsl, phil, area, & - re_cloud, re_ice, re_snow, aerfld, & - mpicomm, mpirank, mpiroot, & - threads, ext_diag, diag3d, & + subroutine mp_thompson_init(ncol, nlev, con_g, con_rd, con_eps, & + restart, imp_physics, & + imp_physics_thompson, convert_dry_rho, & + spechum, qc, qr, qi, qs, qg, ni, nr, & + is_aerosol_aware, merra2_aerosol_aware,& + nc, nwfa2d, nifa2d, & + nwfa, nifa, tgrs, prsl, phil, area, & + re_cloud, re_ice, re_snow, aerfld, & + mpicomm, mpirank, mpiroot, & + threads, ext_diag, diag3d, & errmsg, errflg) implicit none @@ -65,6 +64,7 @@ subroutine mp_thompson_init(ncol, nlev, con_g, con_rd, con_eps, & ! Aerosols logical, intent(in ) :: is_aerosol_aware logical, intent(in ) :: merra2_aerosol_aware + real(kind_phys), optional, intent(inout) :: nc(:,:) real(kind_phys), optional, intent(inout) :: nwfa(:,:) real(kind_phys), optional, intent(inout) :: nifa(:,:) @@ -125,7 +125,8 @@ subroutine mp_thompson_init(ncol, nlev, con_g, con_rd, con_eps, & ! Call Thompson init call thompson_init(is_aerosol_aware_in=is_aerosol_aware, & - merra2_aerosol_aware, mpicomm=mpicomm, & + merra2_aerosol_aware_in=merra2_aerosol_aware, & + mpicomm=mpicomm, & mpirank=mpirank, mpiroot=mpiroot, threads=threads, & errmsg=errmsg, errflg=errflg) if (errflg /= 0) return diff --git a/physics/mp_thompson.meta b/physics/mp_thompson.meta index c939039ef..8886dff1f 100644 --- a/physics/mp_thompson.meta +++ b/physics/mp_thompson.meta @@ -162,6 +162,14 @@ type = logical intent = in optional = F +[merra2_aerosol_aware] + standard_name = flag_for_merra2_aerosol_aware_for_thompson + long_name = flag for merra2 aerosol-aware physics + units = flag + dimensions = () + type = logical + intent = in + optional = F [nc] standard_name = mass_number_concentration_of_cloud_liquid_water_particles_in_air long_name = cloud droplet number concentration @@ -481,7 +489,7 @@ type = logical intent = in optional = F -[is_aerosol_aware] +[merra2_aerosol_aware] standard_name = flag_for_merra2_aerosol_aware_for_thompson long_name = flag for merra2 aerosol-aware physics units = flag diff --git a/physics/rte-rrtmgp b/physics/rte-rrtmgp index 3be5c3437..d9594c46c 160000 --- a/physics/rte-rrtmgp +++ b/physics/rte-rrtmgp @@ -1 +1 @@ -Subproject commit 3be5c3437da541575a293e74b0049721642a6975 +Subproject commit d9594c46c877a2ab8001f5cd37961efdcf08ad8e From 079eb2b472d0f3410374f9b5133a760a4d9ffc68 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Wed, 6 Oct 2021 09:01:08 -0600 Subject: [PATCH 08/21] Minor bugfix in GFS_PBL_generic.F90, formatting changes in mp_thompson.F90 --- physics/GFS_PBL_generic.F90 | 2 +- physics/module_mp_thompson.F90 | 1 + physics/mp_thompson.F90 | 11 ++++------- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/physics/GFS_PBL_generic.F90 b/physics/GFS_PBL_generic.F90 index 51e596ed5..7f7d7d4a1 100644 --- a/physics/GFS_PBL_generic.F90 +++ b/physics/GFS_PBL_generic.F90 @@ -176,7 +176,7 @@ subroutine GFS_PBL_generic_pre_run (im, levs, nvdiff, ntrac, rtg_ozone_index, enddo enddo rtg_ozone_index = 10 - elseif(ltaerosol) then + elseif(mraerosol) then do k=1,levs do i=1,im vdftra(i,k,1) = qgrs(i,k,ntqv) diff --git a/physics/module_mp_thompson.F90 b/physics/module_mp_thompson.F90 index 394edc495..e06fcefe1 100644 --- a/physics/module_mp_thompson.F90 +++ b/physics/module_mp_thompson.F90 @@ -1162,6 +1162,7 @@ SUBROUTINE mp_gt_driver(qv, qc, qr, qi, qs, qg, ni, nr, nc, & stop end if end if + if (is_aerosol_aware .and. (.not.present(nc) .or. & .not.present(nwfa) .or. & .not.present(nifa) .or. & diff --git a/physics/mp_thompson.F90 b/physics/mp_thompson.F90 index ca0d93619..68d80cf8f 100644 --- a/physics/mp_thompson.F90 +++ b/physics/mp_thompson.F90 @@ -28,7 +28,7 @@ module mp_thompson contains !> This subroutine is a wrapper around the actual thompson_init(). -!! \section arg_table_mp_thompson use module_mp_thompson, only : _init Argument Table +!! \section arg_table_mp_thompson_init Argument Table !! \htmlinclude mp_thompson_init.html !! subroutine mp_thompson_init(ncol, nlev, con_g, con_rd, con_eps, & @@ -108,6 +108,7 @@ subroutine mp_thompson_init(ncol, nlev, con_g, con_rd, con_eps, & errflg = 0 if (is_initialized) return + ! Consistency checks if (imp_physics/=imp_physics_thompson) then write(errmsg,'(*(a))') "Logic error: namelist choice of microphysics is different from Thompson MP" @@ -274,7 +275,6 @@ subroutine mp_thompson_init(ncol, nlev, con_g, con_rd, con_eps, & ! Ensure we have 1st guess cloud droplet number where mass non-zero but no number. where(qc .LE. 0.0) nc=0.0 where(qc .GT. 0 .and. nc .LE. 0.0) nc = make_DropletNumber(qc*rho, nwfa*rho) * orho - where(qc .EQ. 0.0 .and. nc .GT. 0.0) nc = 0.0 else @@ -512,7 +512,6 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & return end if - ! Set reduced time step if subcycling is used if (nsteps>1) then dtstep = dtp/real(nsteps, kind=kind_phys) @@ -746,8 +745,7 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & ims=ims, ime=ime, jms=jms, jme=jme, kms=kms, kme=kme, & its=its, ite=ite, jts=jts, jte=jte, kts=kts, kte=kte, & reset_dBZ=reset_dBZ, istep=istep, nsteps=nsteps, & - first_time_step=first_time_step, & - errmsg=errmsg, errflg=errflg, & + first_time_step=first_time_step, errmsg=errmsg, errflg=errflg, & ! Extended diagnostics ext_diag=ext_diag, & ! vts1=vts1, txri=txri, txrc=txrc, & @@ -826,8 +824,7 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & ims=ims, ime=ime, jms=jms, jme=jme, kms=kms, kme=kme, & its=its, ite=ite, jts=jts, jte=jte, kts=kts, kte=kte, & reset_dBZ=reset_dBZ, istep=istep, nsteps=nsteps, & - first_time_step=first_time_step, & - errmsg=errmsg, errflg=errflg, & + first_time_step=first_time_step, errmsg=errmsg, errflg=errflg, & ! Extended diagnostics ext_diag=ext_diag, & ! vts1=vts1, txri=txri, txrc=txrc, & From 2ade7fe95c7d12cf30ade6be68f256c979064adc Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Wed, 6 Oct 2021 10:48:15 -0600 Subject: [PATCH 09/21] Bug fixes and updates in module_mp_thompson.F90 and mp_thompson.F90 --- physics/module_mp_thompson.F90 | 30 ++++++++++++++----- physics/mp_thompson.F90 | 55 ++++++++++++++++++++++------------ 2 files changed, 58 insertions(+), 27 deletions(-) diff --git a/physics/module_mp_thompson.F90 b/physics/module_mp_thompson.F90 index e5291584b..d5f06405c 100644 --- a/physics/module_mp_thompson.F90 +++ b/physics/module_mp_thompson.F90 @@ -439,7 +439,7 @@ MODULE module_mp_thompson !>\section gen_thompson_init thompson_init General Algorithm !> @{ SUBROUTINE thompson_init(is_aerosol_aware_in, & - merra2_aerosol_aware_in, & + merra2_aerosol_aware_in, & mpicomm, mpirank, mpiroot, & threads, errmsg, errflg) @@ -457,11 +457,11 @@ SUBROUTINE thompson_init(is_aerosol_aware_in, & real :: stime, etime LOGICAL, PARAMETER :: precomputed_tables = .FALSE. -! Set module variable is_aerosol_aware +! Set module variable is_aerosol_aware/merra2_aerosol_aware is_aerosol_aware = is_aerosol_aware_in merra2_aerosol_aware = merra2_aerosol_aware_in if (mpirank==mpiroot) then - if (is_aerosol_aware) then + if (is_aerosol_aware) then write (0,'(a)') 'Using aerosol-aware version of Thompson microphysics' else if(merra2_aerosol_aware) then write (0,'(a)') 'Using merra2 aerosol-aware version of Thompson microphysics' @@ -1179,11 +1179,25 @@ SUBROUTINE mp_gt_driver(qv, qc, qr, qi, qs, qg, ni, nr, nc, & else stop end if - else if (.not.is_aerosol_aware .and. (present(nwfa) .or. & - present(nifa) .or. & - present(nwfa2d) .or. & - present(nifa2d) )) then - write(*,*) 'WARNING, nc/nwfa/nifa/nwfa2d/nifa2d present but is_aerosol_aware is FALSE' + else if (merra2_aerosol_aware .and. (.not.present(nc) .or. & + .not.present(nwfa) .or. & + .not.present(nifa) .or. )) then + if (present(errmsg)) then + write(errmsg, '(*(a))') 'Logic error in mp_gt_driver: provide nc, nwfa, and nifa', & + ' for merra2 aerosol-aware version of Thompson microphysics' + else + write(*, '(*(a))') 'Logic error in mp_gt_driver: provide nc, nwfa, and nifa', & + ' for merra2 aerosol-aware version of Thompson microphysics' + end if + if (present(errflg)) then + errflg = 1 + return + else + stop + end if + else if (.not.is_aerosol_aware .and. .not.merra2_aerosol_aware .and. & + (present(nwfa) .or. present(nifa) .or. present(nwfa2d) .or. present(nifa2d))) then + write(*,*) 'WARNING, nc/nwfa/nifa/nwfa2d/nifa2d present but is_aerosol_aware/merra2_aerosol_aware are FALSE' end if end if test_only_once diff --git a/physics/mp_thompson.F90 b/physics/mp_thompson.F90 index 51d75e0ff..784eda7a6 100644 --- a/physics/mp_thompson.F90 +++ b/physics/mp_thompson.F90 @@ -124,12 +124,17 @@ subroutine mp_thompson_init(ncol, nlev, con_g, con_rd, con_eps, & end if end if + if (is_aerosol_aware .and. merra2_aerosol_aware) then + write(errmsg,'(*(a))') "Logic error: Only one Thompson aerosol option can be true, either is_aerosol_aware or merra2_aerosol_aware)' + errflg = 1 + return + end if + ! Call Thompson init - call thompson_init(is_aerosol_aware_in=is_aerosol_aware, & - merra2_aerosol_aware_in=merra2_aerosol_aware, & - mpicomm=mpicomm, & - mpirank=mpirank, mpiroot=mpiroot, threads=threads, & - errmsg=errmsg, errflg=errflg) + call thompson_init(is_aerosol_aware_in=is_aerosol_aware, & + merra2_aerosol_aware_in=merra2_aerosol_aware, & + mpicomm=mpicomm, mpirank=mpirank, mpiroot=mpiroot, & + threads=threads, errmsg=errmsg, errflg=errflg) if (errflg /= 0) return ! For restart runs, the init is done here @@ -149,6 +154,10 @@ subroutine mp_thompson_init(ncol, nlev, con_g, con_rd, con_eps, & where(qs<0) qs = 0.0 where(qg<0) qg = 0.0 + 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 !> - either kg of species per kg of dry air, or per kg of (dry + vapor). @@ -263,7 +272,6 @@ subroutine mp_thompson_init(ncol, nlev, con_g, con_rd, con_eps, & ! Ensure we have 1st guess cloud droplet number where mass non-zero but no number. where(qc .LE. 0.0) nc=0.0 where(qc .GT. 0 .and. nc .LE. 0.0) nc = make_DropletNumber(qc*rho, nwfa*rho) * orho - where(qc .EQ. 0.0 .and. nc .GT. 0.0) nc = 0.0 ! Ensure non-negative aerosol number concentrations. where(nwfa .LE. 0.0) nwfa = 1.1E6 @@ -271,8 +279,9 @@ subroutine mp_thompson_init(ncol, nlev, con_g, con_rd, con_eps, & ! Copy to local array for calculating cloud effective radii below nc_local = nc - else if(merra2_aerosol_aware) then - call get_niwfa(aerfld, nifa, nwfa, ncol, nlev) + + else if (merra2_aerosol_aware) then + ! Ensure we have 1st guess cloud droplet number where mass non-zero but no number. where(qc .LE. 0.0) nc=0.0 where(qc .GT. 0 .and. nc .LE. 0.0) nc = make_DropletNumber(qc*rho, nwfa*rho) * orho @@ -314,11 +323,11 @@ subroutine mp_thompson_init(ncol, nlev, con_g, con_rd, con_eps, & end if if (convert_dry_rho) then - !qc = qc/(1.0_kind_phys+qv) - !qr = qr/(1.0_kind_phys+qv) - !qi = qi/(1.0_kind_phys+qv) - !qs = qs/(1.0_kind_phys+qv) - !qg = qg/(1.0_kind_phys+qv) + qc = qc/(1.0_kind_phys+qv) + qr = qr/(1.0_kind_phys+qv) + qi = qi/(1.0_kind_phys+qv) + qs = qs/(1.0_kind_phys+qv) + qg = qg/(1.0_kind_phys+qv) ni = ni/(1.0_kind_phys+qv) nr = nr/(1.0_kind_phys+qv) @@ -344,8 +353,7 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & con_eps, convert_dry_rho, & spechum, qc, qr, qi, qs, qg, ni, nr, & is_aerosol_aware, merra2_aerosol_aware, & - nc, nwfa, nifa, & - nwfa2d, nifa2d, & + nc, nwfa, nifa, nwfa2d, nifa2d, & tgrs, prsl, phii, omega, dt_inner, & dtp, first_time_step, istep, nsteps, & prcp, rain, graupel, ice, snow, sr, & @@ -530,15 +538,27 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & present(nifa) .and. & present(nwfa2d) .and. & present(nifa2d) )) then - write(errmsg,fmt='(*(a))') 'Logic error in mp_thompson_run:', & + write(errmsg,fmt='(*(a))') 'Logic error in mp_thompson_run:', & ' aerosol-aware microphysics require all of the', & ' following optional arguments:', & ' nc, nwfa, nifa, nwfa2d, nifa2d' errflg = 1 return + else if (is_aerosol_aware .and. .not. (present(nc) .and. & + present(nwfa) .and. & + present(nifa) .and. )) then + write(errmsg,fmt='(*(a))') 'Logic error in mp_thompson_run:', & + ' merra2 aerosol-aware microphysics require the', & + ' following optional arguments: nc, nwfa, nifa' + errflg = 1 + return end if 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 !> - either kg of species per kg of dry air, or per kg of (dry + vapor). @@ -561,8 +581,6 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & nc = nc/(1.0_kind_phys-spechum) nwfa = nwfa/(1.0_kind_phys-spechum) nifa = nifa/(1.0_kind_phys-spechum) - else if (merra2_aerosol_aware) then - call get_niwfa(aerfld, nifa, nwfa, ncol, nlev) end if end if ! *DH @@ -967,5 +985,4 @@ subroutine get_niwfa(aerfld, nifa, nwfa, ncol, nlev) +aerfld(:,:,15)/0.3232698*1)*1.e15 end subroutine get_niwfa - end module mp_thompson From 1aa28fb5c3ab3144b063316141009d5955f3d606 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Wed, 6 Oct 2021 13:39:51 -0600 Subject: [PATCH 10/21] Bug fixes for newly added code in module_mp_thompson.F90 and mp_thompson.F90 --- physics/module_mp_thompson.F90 | 2 +- physics/mp_thompson.F90 | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/physics/module_mp_thompson.F90 b/physics/module_mp_thompson.F90 index d5f06405c..4e376c6eb 100644 --- a/physics/module_mp_thompson.F90 +++ b/physics/module_mp_thompson.F90 @@ -1181,7 +1181,7 @@ SUBROUTINE mp_gt_driver(qv, qc, qr, qi, qs, qg, ni, nr, nc, & end if else if (merra2_aerosol_aware .and. (.not.present(nc) .or. & .not.present(nwfa) .or. & - .not.present(nifa) .or. )) then + .not.present(nifa) )) then if (present(errmsg)) then write(errmsg, '(*(a))') 'Logic error in mp_gt_driver: provide nc, nwfa, and nifa', & ' for merra2 aerosol-aware version of Thompson microphysics' diff --git a/physics/mp_thompson.F90 b/physics/mp_thompson.F90 index 784eda7a6..48e02f36a 100644 --- a/physics/mp_thompson.F90 +++ b/physics/mp_thompson.F90 @@ -125,7 +125,7 @@ subroutine mp_thompson_init(ncol, nlev, con_g, con_rd, con_eps, & end if if (is_aerosol_aware .and. merra2_aerosol_aware) then - write(errmsg,'(*(a))') "Logic error: Only one Thompson aerosol option can be true, either is_aerosol_aware or merra2_aerosol_aware)' + write(errmsg,'(*(a))') "Logic error: Only one Thompson aerosol option can be true, either is_aerosol_aware or merra2_aerosol_aware)" errflg = 1 return end if @@ -546,7 +546,7 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & return else if (is_aerosol_aware .and. .not. (present(nc) .and. & present(nwfa) .and. & - present(nifa) .and. )) then + present(nifa) )) then write(errmsg,fmt='(*(a))') 'Logic error in mp_thompson_run:', & ' merra2 aerosol-aware microphysics require the', & ' following optional arguments: nc, nwfa, nifa' @@ -981,8 +981,8 @@ subroutine get_niwfa(aerfld, nifa, nwfa, ncol, nlev) nifa=(aerfld(:,:,1)/4.0737762+aerfld(:,:,2)/30.459203+aerfld(:,:,3)/153.45048+ & 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)*1.+aerfld(:,:,11)/0.3053104*5+ & + aerfld(:,:,15)/0.3232698*1)*1.e15 end subroutine get_niwfa end module mp_thompson From 88bcfd74eeef0307c5436a30f3453eb09f1b7a92 Mon Sep 17 00:00:00 2001 From: "anning.cheng" Date: Mon, 18 Oct 2021 10:59:00 -0400 Subject: [PATCH 11/21] using field table instead of code change for mraerosol --- physics/GFS_rrtmg_pre.F90 | 20 +++----------------- physics/mp_thompson.F90 | 16 ++++++---------- physics/rte-rrtmgp | 2 +- 3 files changed, 10 insertions(+), 28 deletions(-) diff --git a/physics/GFS_rrtmg_pre.F90 b/physics/GFS_rrtmg_pre.F90 index 44667174a..bb5af6afe 100644 --- a/physics/GFS_rrtmg_pre.F90 +++ b/physics/GFS_rrtmg_pre.F90 @@ -197,7 +197,7 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp, & real(kind=kind_phys), dimension(im,lm+LTP+1) :: tem2db, hz real(kind=kind_phys), dimension(im,lm+LTP,min(4,ncnd)) :: ccnd - real(kind=kind_phys), dimension(im,lm+LTP,2:ntrac) :: tracer1 + real(kind=kind_phys), dimension(im,lm+LTP,2:ntrac+2) :: tracer1 real(kind=kind_phys), dimension(im,lm+LTP,NF_CLDS) :: clouds real(kind=kind_phys), dimension(im,lm+LTP,NF_VGAS) :: gasvmr real(kind=kind_phys), dimension(im,lm+LTP,NBDSW,NF_AESW) :: faersw @@ -305,7 +305,7 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp, & enddo !--- recast remaining all tracers (except sphum) forcing them all to be positive - do j = 2, ntrac + do j = 2, ntrac do k = 1, LM k1 = k + kd k2 = k + lsk @@ -636,7 +636,7 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp, & enddo enddo ! for Thompson MP - prepare variables for calc_effr - if_thompson: if (imp_physics == imp_physics_thompson .and. ltaerosol) then + if_thompson: if (imp_physics == imp_physics_thompson .and. (ltaerosol .or. mraerosol)) then do k=1,LMK do i=1,IM qvs = qlyr(i,k) @@ -651,20 +651,6 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp, & nwfa (i,k) = tracer1(i,k,ntwa) enddo enddo - else if (imp_physics == imp_physics_thompson .and. mraerosol) then - do k=1,LMK - do i=1,IM - qvs = qlyr(i,k) - qv_mp (i,k) = qvs/(1.-qvs) - rho (i,k) = con_eps*plyr(i,k)*100./(con_rd*tlyr(i,k)*(qv_mp(i,k)+con_eps)) - orho (i,k) = 1.0/rho(i,k) - qc_mp (i,k) = tracer1(i,k,ntcw)/(1.-qvs) - qi_mp (i,k) = tracer1(i,k,ntiw)/(1.-qvs) - qs_mp (i,k) = tracer1(i,k,ntsw)/(1.-qvs) - nc_mp (i,k) = tracer1(i,k,ntlnc)/(1.-qvs) - ni_mp (i,k) = tracer1(i,k,ntinc)/(1.-qvs) - enddo - enddo elseif (imp_physics == imp_physics_thompson) then do k=1,LMK diff --git a/physics/mp_thompson.F90 b/physics/mp_thompson.F90 index 48e02f36a..2a423fbdd 100644 --- a/physics/mp_thompson.F90 +++ b/physics/mp_thompson.F90 @@ -154,10 +154,6 @@ subroutine mp_thompson_init(ncol, nlev, con_g, con_rd, con_eps, & where(qs<0) qs = 0.0 where(qg<0) qg = 0.0 - 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 !> - either kg of species per kg of dry air, or per kg of (dry + vapor). @@ -218,6 +214,8 @@ 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 @@ -520,7 +518,6 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & errflg = 1 return end if - ! Set reduced time step if subcycling is used if (nsteps>1) then dtstep = dtp/real(nsteps, kind=kind_phys) @@ -544,7 +541,7 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & ' nc, nwfa, nifa, nwfa2d, nifa2d' errflg = 1 return - else if (is_aerosol_aware .and. .not. (present(nc) .and. & + else if (merra2_aerosol_aware .and. .not. (present(nc) .and. & present(nwfa) .and. & present(nifa) )) then write(errmsg,fmt='(*(a))') 'Logic error in mp_thompson_run:', & @@ -555,9 +552,6 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & end if 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 @@ -702,7 +696,9 @@ 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 if (is_aerosol_aware .or. merra2_aerosol_aware) then if (do_effective_radii) then diff --git a/physics/rte-rrtmgp b/physics/rte-rrtmgp index d9594c46c..9588c7bd8 160000 --- a/physics/rte-rrtmgp +++ b/physics/rte-rrtmgp @@ -1 +1 @@ -Subproject commit d9594c46c877a2ab8001f5cd37961efdcf08ad8e +Subproject commit 9588c7bd89e4f51a924f766e313bc42830fb4479 From 74a6b6f4df8a154e46b50c95ab654b77a21f0ae9 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Mon, 18 Oct 2021 14:17:16 -0600 Subject: [PATCH 12/21] Updates and bug fixes for Thompson-Merra2 --- physics/GFS_PBL_generic.F90 | 4 +- physics/GFS_rrtmg_pre.F90 | 3 +- physics/GFS_suite_interstitial.F90 | 22 +++-- physics/GFS_suite_interstitial.meta | 32 -------- physics/module_MYNNPBL_wrapper.F90 | 2 + physics/module_mp_thompson.F90 | 31 ++++---- physics/mp_thompson.F90 | 119 +++++++++++++++++++++++----- 7 files changed, 132 insertions(+), 81 deletions(-) diff --git a/physics/GFS_PBL_generic.F90 b/physics/GFS_PBL_generic.F90 index 401084479..aefcb9cf4 100644 --- a/physics/GFS_PBL_generic.F90 +++ b/physics/GFS_PBL_generic.F90 @@ -12,7 +12,7 @@ module GFS_PBL_generic_common contains subroutine set_aerosol_tracer_index(imp_physics, imp_physics_wsm6, & - imp_physics_thompson, ltaerosol,mraerosol, & + imp_physics_thompson, ltaerosol,mraerosol, & imp_physics_mg, ntgl, imp_physics_gfdl, & imp_physics_zhao_carr, kk, & errmsg, errflg) @@ -191,7 +191,7 @@ subroutine GFS_PBL_generic_pre_run (im, levs, nvdiff, ntrac, rtg_ozone_index, vdftra(i,k,10) = qgrs(i,k,ntoz) enddo enddo - rtg_ozone_index = 8 + rtg_ozone_index = 10 else do k=1,levs do i=1,im diff --git a/physics/GFS_rrtmg_pre.F90 b/physics/GFS_rrtmg_pre.F90 index bb5af6afe..516d1a300 100644 --- a/physics/GFS_rrtmg_pre.F90 +++ b/physics/GFS_rrtmg_pre.F90 @@ -197,7 +197,7 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp, & real(kind=kind_phys), dimension(im,lm+LTP+1) :: tem2db, hz real(kind=kind_phys), dimension(im,lm+LTP,min(4,ncnd)) :: ccnd - real(kind=kind_phys), dimension(im,lm+LTP,2:ntrac+2) :: tracer1 + real(kind=kind_phys), dimension(im,lm+LTP,2:ntrac) :: tracer1 real(kind=kind_phys), dimension(im,lm+LTP,NF_CLDS) :: clouds real(kind=kind_phys), dimension(im,lm+LTP,NF_VGAS) :: gasvmr real(kind=kind_phys), dimension(im,lm+LTP,NBDSW,NF_AESW) :: faersw @@ -651,7 +651,6 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp, & nwfa (i,k) = tracer1(i,k,ntwa) enddo enddo - elseif (imp_physics == imp_physics_thompson) then do k=1,LMK do i=1,IM diff --git a/physics/GFS_suite_interstitial.F90 b/physics/GFS_suite_interstitial.F90 index 7c9c33cda..0023cf686 100644 --- a/physics/GFS_suite_interstitial.F90 +++ b/physics/GFS_suite_interstitial.F90 @@ -513,8 +513,7 @@ end subroutine GFS_suite_interstitial_3_finalize !! \htmlinclude GFS_suite_interstitial_3_run.html !! subroutine GFS_suite_interstitial_3_run (im, levs, nn, cscnv, & - satmedmf, trans_trac, do_shoc, & - ltaerosol, mraerosol, ntrac, ntcw, & + satmedmf, trans_trac, do_shoc, ntrac, ntcw, & ntiw, ntclamt, ntrw, ntsw, ntrnc, ntsnc, ntgl, ntgnc, & xlon, xlat, gt0, gq0, imp_physics, imp_physics_mg, & imp_physics_zhao_carr, imp_physics_zhao_carr_pdf, & @@ -534,8 +533,7 @@ subroutine GFS_suite_interstitial_3_run (im, levs, nn, cscnv, & ntrnc, ntsnc, ntgl, ntgnc, imp_physics, imp_physics_mg, imp_physics_zhao_carr, imp_physics_zhao_carr_pdf, & imp_physics_gfdl, imp_physics_thompson, imp_physics_wsm6,imp_physics_fer_hires, me, index_of_process_conv_trans integer, intent(in ), dimension(:) :: islmsk, kpbl, kinver - logical, intent(in ) :: cscnv, satmedmf, trans_trac, do_shoc, ltaerosol, ras - logical, intent(in ) :: mraerosol + logical, intent(in ) :: cscnv, satmedmf, trans_trac, do_shoc, ras integer, intent(in) :: ntinc, ntlnc logical, intent(in) :: ldiag3d, qdiag3d @@ -658,11 +656,11 @@ subroutine GFS_suite_interstitial_3_run (im, levs, nn, cscnv, & save_tcp(i,k) = gt0(i,k) enddo enddo - if(ltaerosol .or. mraerosol) then + if (ntinc>0) then save_qi(:,:) = clw(:,:,1) + end if + if (ntlnc>0) then save_qc(:,:) = clw(:,:,2) - else - save_qi(:,:) = clw(:,:,1) endif elseif (imp_physics == imp_physics_wsm6 .or. imp_physics == imp_physics_mg .or. imp_physics == imp_physics_fer_hires) then do k=1,levs @@ -699,10 +697,10 @@ end subroutine GFS_suite_interstitial_4_finalize !> \section arg_table_GFS_suite_interstitial_4_run Argument Table !! \htmlinclude GFS_suite_interstitial_4_run.html !! - subroutine GFS_suite_interstitial_4_run (im, levs, ltaerosol, mraerosol, tracers_total, ntrac, ntcw, ntiw, ntclamt, & - ntrw, ntsw, ntrnc, ntsnc, ntgl, ntgnc, ntlnc, ntinc, nn, imp_physics, imp_physics_gfdl, imp_physics_thompson, & - imp_physics_zhao_carr, imp_physics_zhao_carr_pdf, convert_dry_rho, dtf, save_qc, save_qi, con_pi, dtidx, dtend,& - index_of_process_conv_trans, gq0, clw, prsl, save_tcp, con_rd, con_eps, nwfa, spechum, ldiag3d, & + subroutine GFS_suite_interstitial_4_run (im, levs, tracers_total, ntrac, ntcw, ntiw, ntclamt, & + ntrw, ntsw, ntrnc, ntsnc, ntgl, ntgnc, ntlnc, ntinc, nn, imp_physics, imp_physics_gfdl, imp_physics_thompson, & + imp_physics_zhao_carr, imp_physics_zhao_carr_pdf, convert_dry_rho, dtf, save_qc, save_qi, con_pi, dtidx, dtend, & + index_of_process_conv_trans, gq0, clw, prsl, save_tcp, con_rd, con_eps, nwfa, spechum, ldiag3d, & qdiag3d, save_lnc, save_inc, ntk, ntke, errmsg, errflg) use machine, only: kind_phys @@ -716,7 +714,7 @@ subroutine GFS_suite_interstitial_4_run (im, levs, ltaerosol, mraerosol, tracers ntsw, ntrnc, ntsnc, ntgl, ntgnc, ntlnc, ntinc, nn, imp_physics, imp_physics_gfdl, imp_physics_thompson, & imp_physics_zhao_carr, imp_physics_zhao_carr_pdf - logical, intent(in) :: ltaerosol, convert_dry_rho, mraerosol + logical, intent(in) :: convert_dry_rho real(kind=kind_phys), intent(in ) :: con_pi, dtf real(kind=kind_phys), intent(in ), dimension(:,:) :: save_qc diff --git a/physics/GFS_suite_interstitial.meta b/physics/GFS_suite_interstitial.meta index 3735b887c..2340c8770 100644 --- a/physics/GFS_suite_interstitial.meta +++ b/physics/GFS_suite_interstitial.meta @@ -1223,22 +1223,6 @@ type = logical intent = in optional = F -[ltaerosol] - standard_name = flag_for_aerosol_physics - long_name = flag for aerosol physics - units = flag - dimensions = () - type = logical - intent = in - optional = F -[mraerosol] - standard_name = flag_for_merra2_aerosol_aware_for_thompson - long_name = flag for merra2 aerosol-aware physics for thompson microphysics - units = flag - dimensions = () - type = logical - intent = in - optional = F [ntrac] standard_name = number_of_tracers long_name = number of tracers @@ -1695,22 +1679,6 @@ type = integer intent = in optional = F -[ltaerosol] - standard_name = flag_for_aerosol_physics - long_name = flag for aerosol physics - units = flag - dimensions = () - type = logical - intent = in - optional = F -[mraerosol] - standard_name = flag_for_merra2_aerosol_aware_for_thompson - long_name = flag for merra2 aerosol-aware physics for thompson microphysics - units = flag - dimensions = () - type = logical - intent = in - optional = F [tracers_total] standard_name = number_of_total_tracers long_name = total number of tracers diff --git a/physics/module_MYNNPBL_wrapper.F90 b/physics/module_MYNNPBL_wrapper.F90 index ae9c03a65..2ebb006bf 100644 --- a/physics/module_MYNNPBL_wrapper.F90 +++ b/physics/module_MYNNPBL_wrapper.F90 @@ -449,6 +449,8 @@ SUBROUTINE mynnedmf_wrapper_run( & qnc(i,k) = qgrs_cloud_droplet_num_conc(i,k) qni(i,k) = qgrs_cloud_ice_num_conc(i,k) ozone(i,k) = qgrs_ozone(i,k) + qnwfa(i,k) = 0. + qnifa(i,k) = 0. enddo enddo else diff --git a/physics/module_mp_thompson.F90 b/physics/module_mp_thompson.F90 index 4e376c6eb..08f11b61c 100644 --- a/physics/module_mp_thompson.F90 +++ b/physics/module_mp_thompson.F90 @@ -460,14 +460,20 @@ SUBROUTINE thompson_init(is_aerosol_aware_in, & ! Set module variable is_aerosol_aware/merra2_aerosol_aware is_aerosol_aware = is_aerosol_aware_in merra2_aerosol_aware = merra2_aerosol_aware_in + if (is_aerosol_aware .and. merra2_aerosol_aware) then + errmsg = 'Logic error in thompson_init: only one of the two options can be true, ' // & + 'not both: is_aerosol_aware or merra2_aerosol_aware' + errflg = 1 + return + end if if (mpirank==mpiroot) then - if (is_aerosol_aware) then - write (0,'(a)') 'Using aerosol-aware version of Thompson microphysics' - else if(merra2_aerosol_aware) then - write (0,'(a)') 'Using merra2 aerosol-aware version of Thompson microphysics' - else - write (0,'(a)') 'Using non-aerosol-aware version of Thompson microphysics' - end if + if (is_aerosol_aware) then + write (0,'(a)') 'Using aerosol-aware version of Thompson microphysics' + else if(merra2_aerosol_aware) then + write (0,'(a)') 'Using merra2 aerosol-aware version of Thompson microphysics' + else + write (0,'(a)') 'Using non-aerosol-aware version of Thompson microphysics' + end if end if micro_init = .FALSE. @@ -1026,9 +1032,7 @@ SUBROUTINE mp_gt_driver(qv, qc, qr, qi, qs, qg, ni, nr, nc, & REAL, DIMENSION(ims:ime, kms:kme, jms:jme), OPTIONAL, INTENT(IN):: & pii REAL, DIMENSION(ims:ime, kms:kme, jms:jme), OPTIONAL, INTENT(INOUT):: & - nc - REAL, DIMENSION(ims:ime, kms:kme, jms:jme), OPTIONAL, INTENT(INOUT):: & - nwfa, nifa + nc, nwfa, nifa REAL, DIMENSION(ims:ime, jms:jme), OPTIONAL, INTENT(IN):: nwfa2d, nifa2d REAL, DIMENSION(ims:ime, kms:kme, jms:jme), OPTIONAL, INTENT(INOUT):: & re_cloud, re_ice, re_snow @@ -1054,7 +1058,6 @@ SUBROUTINE mp_gt_driver(qv, qc, qr, qi, qs, qg, ni, nr, nc, & REAL, DIMENSION(ims:ime, kms:kme, jms:jme), OPTIONAL, INTENT(INOUT):: & vt_dbz_wt LOGICAL, INTENT(IN) :: first_time_step - REAL, INTENT(IN):: dt_in, dt_inner ! To support subcycling: current step and maximum number of steps INTEGER, INTENT (IN) :: istep, nsteps @@ -1179,9 +1182,9 @@ SUBROUTINE mp_gt_driver(qv, qc, qr, qi, qs, qg, ni, nr, nc, & else stop end if - else if (merra2_aerosol_aware .and. (.not.present(nc) .or. & - .not.present(nwfa) .or. & - .not.present(nifa) )) then + else if (merra2_aerosol_aware .and. (.not.present(nc) .or. & + .not.present(nwfa) .or. & + .not.present(nifa) )) then if (present(errmsg)) then write(errmsg, '(*(a))') 'Logic error in mp_gt_driver: provide nc, nwfa, and nifa', & ' for merra2 aerosol-aware version of Thompson microphysics' diff --git a/physics/mp_thompson.F90 b/physics/mp_thompson.F90 index 2a423fbdd..828791482 100644 --- a/physics/mp_thompson.F90 +++ b/physics/mp_thompson.F90 @@ -64,18 +64,17 @@ subroutine mp_thompson_init(ncol, nlev, con_g, con_rd, con_eps, & ! Aerosols logical, intent(in ) :: is_aerosol_aware logical, intent(in ) :: merra2_aerosol_aware - real(kind_phys), optional, intent(inout) :: nc(:,:) real(kind_phys), optional, intent(inout) :: nwfa(:,:) real(kind_phys), optional, intent(inout) :: nifa(:,:) real(kind_phys), optional, intent(inout) :: nwfa2d(:) real(kind_phys), optional, intent(inout) :: nifa2d(:) + real(kind_phys), intent(in) :: aerfld(:,:,:) ! State variables real(kind_phys), intent(in ) :: tgrs(:,:) real(kind_phys), intent(in ) :: prsl(:,:) real(kind_phys), intent(in ) :: phil(:,:) real(kind_phys), intent(in ) :: area(:) - real (kind=kind_phys), dimension(:,:,:),intent(in):: aerfld ! Cloud effective radii real(kind_phys), optional, intent( out) :: re_cloud(:,:) real(kind_phys), optional, intent( out) :: re_ice(:,:) @@ -169,7 +168,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 .or. merra2_aerosol_aware) then + if (is_aerosol_aware) then nc = nc/(1.0_kind_phys-spechum) nwfa = nwfa/(1.0_kind_phys-spechum) nifa = nifa/(1.0_kind_phys-spechum) @@ -384,18 +383,17 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & ! Aerosols logical, intent(in) :: is_aerosol_aware, reset_dBZ logical, intent(in) :: merra2_aerosol_aware - ! The following arrays are not allocated if is_aerosol_aware is false real(kind_phys), optional, intent(inout) :: nc(:,:) real(kind_phys), optional, intent(inout) :: nwfa(:,:) real(kind_phys), optional, intent(inout) :: nifa(:,:) real(kind_phys), optional, intent(in ) :: nwfa2d(:) real(kind_phys), optional, intent(in ) :: nifa2d(:) + real(kind_phys), intent(in) :: aerfld(:,:,:) ! State variables and timestep information real(kind_phys), intent(inout) :: tgrs(:,:) real(kind_phys), intent(in ) :: prsl(:,:) real(kind_phys), intent(in ) :: phii(:,:) real(kind_phys), intent(in ) :: omega(:,:) - real (kind=kind_phys), dimension(:,:,:),intent(in):: aerfld real(kind_phys), intent(in ) :: dtp logical, intent(in ) :: first_time_step integer, intent(in ) :: istep, nsteps @@ -518,6 +516,7 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & errflg = 1 return end if + ! Set reduced time step if subcycling is used if (nsteps>1) then dtstep = dtp/real(nsteps, kind=kind_phys) @@ -541,7 +540,7 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & ' nc, nwfa, nifa, nwfa2d, nifa2d' errflg = 1 return - else if (merra2_aerosol_aware .and. .not. (present(nc) .and. & + else if (merra2_aerosol_aware .and. .not. (present(nc) .and. & present(nwfa) .and. & present(nifa) )) then write(errmsg,fmt='(*(a))') 'Logic error in mp_thompson_run:', & @@ -552,7 +551,6 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & end if end if - !> - 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). @@ -699,8 +697,8 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & if (merra2_aerosol_aware) then call get_niwfa(aerfld, nifa, nwfa, ncol, nlev) end if - !> - Call mp_gt_driver() with or without aerosols - if (is_aerosol_aware .or. merra2_aerosol_aware) then + !> - Call mp_gt_driver() with or without aerosols, with or without effective radii, ... + if (is_aerosol_aware) then if (do_effective_radii) then call mp_gt_driver(qv=qv, qc=qc, qr=qr, qi=qi, qs=qs, qg=qg, ni=ni, nr=nr, & nc=nc, nwfa=nwfa, nifa=nifa, nwfa2d=nwfa2d, nifa2d=nifa2d, & @@ -781,7 +779,88 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & qiten3=qiten3, niten3=niten3, nrten3=nrten3, ncten3=ncten3, & qcten3=qcten3) end if - else + else if (merra2_aerosol_aware) then + if (do_effective_radii) then + call mp_gt_driver(qv=qv, qc=qc, qr=qr, qi=qi, qs=qs, qg=qg, ni=ni, nr=nr, & + nc=nc, nwfa=nwfa, nifa=nifa, & + tt=tgrs, p=prsl, w=w, dz=dz, dt_in=dtstep, dt_inner=dt_inner, & + rainnc=rain_mp, rainncv=delta_rain_mp, & + snownc=snow_mp, snowncv=delta_snow_mp, & + icenc=ice_mp, icencv=delta_ice_mp, & + graupelnc=graupel_mp, graupelncv=delta_graupel_mp, sr=sr, & + refl_10cm=refl_10cm, & + diagflag=diagflag, do_radar_ref=do_radar_ref_mp, & + re_cloud=re_cloud, re_ice=re_ice, re_snow=re_snow, & + has_reqc=has_reqc, has_reqi=has_reqi, has_reqs=has_reqs, & + rand_perturb_on=rand_perturb_on, kme_stoch=kme_stoch, & + ! DH* 2020-06-05 not passing this optional argument, see + ! comment in module_mp_thompson.F90 / mp_gt_driver + !rand_pert=rand_pert, & + 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, & + reset_dBZ=reset_dBZ, istep=istep, nsteps=nsteps, & + first_time_step=first_time_step, errmsg=errmsg, errflg=errflg, & + ! Extended diagnostics + ext_diag=ext_diag, & + ! vts1=vts1, txri=txri, txrc=txrc, & + prw_vcdc=prw_vcdc, & + prw_vcde=prw_vcde, tpri_inu=tpri_inu, tpri_ide_d=tpri_ide_d, & + tpri_ide_s=tpri_ide_s, tprs_ide=tprs_ide, & + tprs_sde_d=tprs_sde_d, & + tprs_sde_s=tprs_sde_s, tprg_gde_d=tprg_gde_d, & + tprg_gde_s=tprg_gde_s, tpri_iha=tpri_iha, & + tpri_wfz=tpri_wfz, tpri_rfz=tpri_rfz, tprg_rfz=tprg_rfz, & + tprs_scw=tprs_scw, tprg_scw=tprg_scw, tprg_rcs=tprg_rcs, & + tprs_rcs=tprs_rcs, & + tprr_rci=tprr_rci, tprg_rcg=tprg_rcg, tprw_vcd_c=tprw_vcd_c, & + tprw_vcd_e=tprw_vcd_e, tprr_sml=tprr_sml, tprr_gml=tprr_gml, & + tprr_rcg=tprr_rcg, tprr_rcs=tprr_rcs, & + tprv_rev=tprv_rev, tten3=tten3, & + qvten3=qvten3, qrten3=qrten3, qsten3=qsten3, qgten3=qgten3, & + qiten3=qiten3, niten3=niten3, nrten3=nrten3, ncten3=ncten3, & + qcten3=qcten3) + else + call mp_gt_driver(qv=qv, qc=qc, qr=qr, qi=qi, qs=qs, qg=qg, ni=ni, nr=nr, & + nc=nc, nwfa=nwfa, nifa=nifa, & + tt=tgrs, p=prsl, w=w, dz=dz, dt_in=dtstep, dt_inner=dt_inner, & + rainnc=rain_mp, rainncv=delta_rain_mp, & + snownc=snow_mp, snowncv=delta_snow_mp, & + icenc=ice_mp, icencv=delta_ice_mp, & + graupelnc=graupel_mp, graupelncv=delta_graupel_mp, sr=sr, & + refl_10cm=refl_10cm, & + diagflag=diagflag, do_radar_ref=do_radar_ref_mp, & + has_reqc=has_reqc, has_reqi=has_reqi, has_reqs=has_reqs, & + rand_perturb_on=rand_perturb_on, kme_stoch=kme_stoch, & + ! DH* 2020-06-05 not passing this optional argument, see + ! comment in module_mp_thompson.F90 / mp_gt_driver + !rand_pert=rand_pert, & + 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, & + reset_dBZ=reset_dBZ, istep=istep, nsteps=nsteps, & + first_time_step=first_time_step, errmsg=errmsg, errflg=errflg, & + ! Extended diagnostics + ext_diag=ext_diag, & + ! vts1=vts1, txri=txri, txrc=txrc, & + prw_vcdc=prw_vcdc, & + prw_vcde=prw_vcde, tpri_inu=tpri_inu, tpri_ide_d=tpri_ide_d, & + tpri_ide_s=tpri_ide_s, tprs_ide=tprs_ide, & + tprs_sde_d=tprs_sde_d, & + tprs_sde_s=tprs_sde_s, tprg_gde_d=tprg_gde_d, & + tprg_gde_s=tprg_gde_s, tpri_iha=tpri_iha, & + tpri_wfz=tpri_wfz, tpri_rfz=tpri_rfz, tprg_rfz=tprg_rfz, & + tprs_scw=tprs_scw, tprg_scw=tprg_scw, tprg_rcs=tprg_rcs, & + tprs_rcs=tprs_rcs, & + tprr_rci=tprr_rci, tprg_rcg=tprg_rcg, tprw_vcd_c=tprw_vcd_c, & + tprw_vcd_e=tprw_vcd_e, tprr_sml=tprr_sml, tprr_gml=tprr_gml, & + tprr_rcg=tprr_rcg, tprr_rcs=tprr_rcs, & + tprv_rev=tprv_rev, tten3=tten3, & + qvten3=qvten3, qrten3=qrten3, qsten3=qsten3, qgten3=qgten3, & + qiten3=qiten3, niten3=niten3, nrten3=nrten3, ncten3=ncten3, & + qcten3=qcten3) + end if + else ! neither is_aerosol_aware nor merra2_aerosol_aware if (do_effective_radii) then call mp_gt_driver(qv=qv, qc=qc, qr=qr, qi=qi, qs=qs, qg=qg, ni=ni, nr=nr, & tt=tgrs, p=prsl, w=w, dz=dz, dt_in=dtstep, dt_inner=dt_inner, & @@ -970,15 +1049,17 @@ subroutine mp_thompson_finalize(errmsg, errflg) end subroutine mp_thompson_finalize subroutine get_niwfa(aerfld, nifa, nwfa, ncol, nlev) - implicit none - integer, intent(in)::ncol, nlev - real (kind=kind_phys), dimension(:,:,:),intent(in):: aerfld - real (kind=kind_phys), dimension(:,:),intent(out)::nifa, nwfa - nifa=(aerfld(:,:,1)/4.0737762+aerfld(:,:,2)/30.459203+aerfld(:,:,3)/153.45048+ & - 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 + implicit none + integer, intent(in)::ncol, nlev + real (kind=kind_phys), dimension(:,:,:), intent(in) :: aerfld + real (kind=kind_phys), dimension(:,:), intent(out ):: nifa, nwfa + + nifa=(aerfld(:,:,1)/4.0737762+aerfld(:,:,2)/30.459203+aerfld(:,:,3)/153.45048+ & + 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 end subroutine get_niwfa end module mp_thompson From 02f51784ee9061f51fa94b3a230c150ba4c92ebb Mon Sep 17 00:00:00 2001 From: "anning.cheng" Date: Sun, 7 Nov 2021 19:49:43 -0500 Subject: [PATCH 13/21] decrease usage of mem 6 times less --- physics/GFS_phys_time_vary.fv3.F90 | 18 +-- physics/GFS_phys_time_vary.fv3.meta | 17 ++ physics/aerclm_def.F | 4 +- physics/aerinterp.F90 | 241 ++++++++++++++++++++++++---- physics/module_mp_thompson.F90 | 2 + 5 files changed, 245 insertions(+), 37 deletions(-) diff --git a/physics/GFS_phys_time_vary.fv3.F90 b/physics/GFS_phys_time_vary.fv3.F90 index a8ecc1a5e..d6155e6b1 100644 --- a/physics/GFS_phys_time_vary.fv3.F90 +++ b/physics/GFS_phys_time_vary.fv3.F90 @@ -21,7 +21,7 @@ module GFS_phys_time_vary use h2o_def, only : levh2o, h2o_coeff, h2o_lat, h2o_pres, h2o_time, h2oplin use h2ointerp, only : read_h2odata, setindxh2o, h2ointerpol - use aerclm_def, only : aerin, aer_pres, ntrcaer, ntrcaerm + use aerclm_def, only : aerin, aer_pres, ntrcaer, ntrcaerm, iamin, iamax, jamin, jamax use aerinterp, only : read_aerdata, setindxaer, aerinterpol, read_aerdataf use iccn_def, only : ciplin, ccnin, ci_pres @@ -68,7 +68,7 @@ module GFS_phys_time_vary !! @{ 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, & + 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, & 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, & @@ -88,6 +88,7 @@ subroutine GFS_phys_time_vary_init ( integer, intent(in) :: me, master, ntoz, iccn, iflip, im, nx, ny logical, intent(in) :: h2o_phys, iaerclm, flag_restart 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(:) @@ -173,7 +174,7 @@ subroutine GFS_phys_time_vary_init ( integer, intent(out) :: errflg ! Local variables - integer :: i, j, ix, vegtyp, iamin, iamax, jamin, jamax + integer :: i, j, ix, vegtyp real(kind_phys) :: rsnow !--- Noah MP @@ -387,8 +388,7 @@ subroutine GFS_phys_time_vary_init ( if (errflg/=0) return if (iaerclm) then - call read_aerdataf (iamin, iamax, jamin, jamax, me, master, iflip, & - idate, errmsg, errflg) + call read_aerdataf (me, master, iflip, idate, fhour, errmsg, errflg) if (errflg/=0) return end if @@ -715,7 +715,7 @@ 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, & + 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, nthrds, nx, ny, nsst, tile_num, nlunit, lsoil, lsoil_lsm,& @@ -730,7 +730,7 @@ 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 + 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 @@ -797,7 +797,7 @@ 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) & +!$OMP shared(ddy_j2tau,tau_amf,iflip) & !$OMP private(iseed,iskip,i,j,k) !$OMP sections @@ -889,7 +889,7 @@ subroutine GFS_phys_time_vary_timestep_init ( ! aerinterpol is using threading inside, don't ! move into OpenMP parallel section above call aerinterpol (me, master, nthrds, im, idate, & - fhour, jindx1_aer, jindx2_aer, & + fhour, iflip, jindx1_aer, jindx2_aer, & ddy_aer, iindx1_aer, & iindx2_aer, ddx_aer, & levs, prsl, aer_nm) diff --git a/physics/GFS_phys_time_vary.fv3.meta b/physics/GFS_phys_time_vary.fv3.meta index 979200a85..a3b82dee7 100644 --- a/physics/GFS_phys_time_vary.fv3.meta +++ b/physics/GFS_phys_time_vary.fv3.meta @@ -183,6 +183,15 @@ kind = kind_phys intent = in optional = F +[fhour] + standard_name = forecast_time + long_name = current forecast time + units = h + dimensions = () + type = real + kind = kind_phys + intent = in + optional = F [jindx1_aer] standard_name = lower_latitude_index_of_aerosol_forcing_for_interpolation long_name = interpolation low index for prescribed aerosols in the y direction @@ -1301,6 +1310,14 @@ kind = kind_phys intent = inout optional = F +[iflip] + standard_name = control_for_vertical_index_direction + long_name = iflip - is not the same as flipv + units = flag + dimensions = () + type = integer + intent = in + optional = F [jindx1_aer] standard_name = lower_latitude_index_of_aerosol_forcing_for_interpolation long_name = interpolation low index for prescribed aerosols in the y direction diff --git a/physics/aerclm_def.F b/physics/aerclm_def.F index 157c7b961..088fdac7e 100644 --- a/physics/aerclm_def.F +++ b/physics/aerclm_def.F @@ -2,8 +2,10 @@ module aerclm_def use machine , only : kind_phys implicit none - integer, parameter :: levsaer=72, ntrcaerm=15, timeaer=12 + integer, parameter :: levsaer=72, ntrcaerm=15, timeaer=2 integer :: latsaer, lonsaer, ntrcaer, levsw + integer :: n1sv, n2sv + integer :: iamin, iamax, jamin, jamax character*10 :: specname(ntrcaerm) real (kind=kind_phys):: aer_time(13) diff --git a/physics/aerinterp.F90 b/physics/aerinterp.F90 index dbcf73603..a99fae7b0 100644 --- a/physics/aerinterp.F90 +++ b/physics/aerinterp.F90 @@ -11,7 +11,7 @@ module aerinterp private - public :: read_aerdata, setindxaer, aerinterpol, read_aerdataf + public :: read_aerdata, setindxaer, aerinterpol,read_aerdataf contains @@ -45,7 +45,7 @@ SUBROUTINE read_aerdata (me, master, iflip, idate, errmsg, errflg) !! =================================================================== !! check if all necessary files exist !! =================================================================== - do imon = 1, timeaer + do imon = 1, 12 write(mn,'(i2.2)') imon fname=trim("aeroclim.m"//mn//".nc") inquire (file = fname, exist = file_exist) @@ -97,23 +97,27 @@ SUBROUTINE read_aerdata (me, master, iflip, idate, errmsg, errflg) END SUBROUTINE read_aerdata ! !********************************************************************** - SUBROUTINE read_aerdataf (iamin, iamax, jamin, jamax, & - me, master, iflip, idate, errmsg, errflg) + SUBROUTINE read_aerdataf ( me, master, iflip, idate, FHOUR, errmsg, errflg) use machine, only: kind_phys, kind_io4, kind_io8 use aerclm_def use netcdf !--- in/out integer, intent(in) :: me, master, iflip, idate(4) - integer, intent(in) :: iamin, iamax, jamin, jamax character(len=*), intent(inout) :: errmsg integer, intent(inout) :: errflg - + real(kind=kind_phys), intent(in) :: fhour !--- locals integer :: ncid, varid - integer :: i, j, k, n, ii, imon, klev + integer :: i, j, k, n, ii, imon, klev, n1, n2 character :: fname*50, mn*2, vname*10 logical :: file_exist + integer IDAT(8),JDAT(8) + real(kind=kind_phys) RINC(5), rjday + integer jdow, jdoy, jday + real(4) rinc4(5) + integer w3kindreal,w3kindint + integer, allocatable :: invardims(:) real(kind=kind_io4),allocatable,dimension(:,:,:) :: buff real(kind=kind_io4),allocatable,dimension(:,:,:,:):: buffx @@ -128,12 +132,104 @@ SUBROUTINE read_aerdataf (iamin, iamax, jamin, jamax, & allocate (buff(lonsaer, latsaer, levsw)) allocate (pres_tmp(lonsaer, levsw)) allocate (buffx(lonsaer, latsaer, levsw, 1)) - +!! found interpolation months + 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 < aer_time(1)) RJDAY = RJDAY+365. +! + n2 = 13 + do j=2, 12 + if (rjday < aer_time(j)) then + n2 = j + exit + endif + enddo + n1 = n2 - 1 + if (n2 > 12) n2 = n2 -12 + write(*,*)"AAA0",n1, n2, iamin, iamax, jamin, jamax !! =================================================================== !! loop thru m01 - m12 for aer/pres array !! =================================================================== - do imon = 1, timeaer - write(mn,'(i2.2)') imon + write(mn,'(i2.2)') n1 + fname=trim("aeroclim.m"//mn//".nc") + call nf_open(fname , nf90_NOWRITE, ncid) + +! ====> construct 3-d pressure array (Pa) + call nf_inq_varid(ncid, "DELP", varid) + call nf_get_var(ncid, varid, buff) + + do j = jamin, jamax + do i = iamin, iamax +! constract pres_tmp (top-down), note input is top-down + pres_tmp(i,1) = 0. + do k=2, levsw + pres_tmp(i,k) = pres_tmp(i,k-1)+buff(i,j,k) + enddo !k-loop + enddo !i-loop (lon) + +! extract pres_tmp to fill aer_pres (in Pa) + do k = 1, levsaer + if ( iflip == 0 ) then ! data from toa to sfc + klev = k + else ! data from sfc to top + klev = ( levsw - k ) + 1 + endif + do i = iamin, iamax + aer_pres(i,j,k,1) = 1.d0*pres_tmp(i,klev) + enddo !i-loop (lon) + enddo !k-loop (lev) + enddo !j-loop (lat) + +! ====> construct 4-d aerosol array (kg/kg) +! merra2 data is top down +! for GFS, iflip 0: toa to sfc; 1: sfc to toa + DO ii = 1, ntrcaerm + vname=trim(specname(ii)) + call nf_inq_varid(ncid, vname, varid) + write(*,*)"AAA2",vname + call nf_get_var(ncid, varid, buffx) + + do j = jamin, jamax + do k = 1, levsaer +! input is from toa to sfc + if ( iflip == 0 ) then ! data from toa to sfc + klev = k + else ! data from sfc to top + klev = ( levsw - k ) + 1 + endif + do i = iamin, iamax + aerin(i,j,k,ii,1) = 1.d0*buffx(i,j,klev,1) + if(aerin(i,j,k,ii,1) < 0 .or. aerin(i,j,k,ii,1) > 1.) then + aerin(i,j,k,ii,1) = 1.e-15 + endif + enddo !i-loop (lon) + enddo !k-loop (lev) + enddo !j-loop (lat) + + ENDDO ! ii-loop (ntracaerm) + +! close the file + call nf_close(ncid) +!! =================================================================== + write(mn,'(i2.2)') n2 fname=trim("aeroclim.m"//mn//".nc") call nf_open(fname , nf90_NOWRITE, ncid) @@ -158,7 +254,7 @@ SUBROUTINE read_aerdataf (iamin, iamax, jamin, jamax, & klev = ( levsw - k ) + 1 endif do i = iamin, iamax - aer_pres(i,j,k,imon) = 1.d0*pres_tmp(i,klev) + aer_pres(i,j,k,2) = 1.d0*pres_tmp(i,klev) enddo !i-loop (lon) enddo !k-loop (lev) enddo !j-loop (lat) @@ -180,9 +276,9 @@ SUBROUTINE read_aerdataf (iamin, iamax, jamin, jamax, & klev = ( levsw - k ) + 1 endif do i = iamin, iamax - aerin(i,j,k,ii,imon) = 1.d0*buffx(i,j,klev,1) - if(aerin(i,j,k,ii,imon) < 0 .or. aerin(i,j,k,ii,imon) > 1.) then - aerin(i,j,k,ii,imon) = 1.e-15 + aerin(i,j,k,ii,2) = 1.d0*buffx(i,j,klev,1) + if(aerin(i,j,k,ii,2) < 0 .or. aerin(i,j,k,ii,2) > 1.) then + aerin(i,j,k,ii,2) = 1.e-15 endif enddo !i-loop (lon) enddo !k-loop (lev) @@ -192,7 +288,8 @@ SUBROUTINE read_aerdataf (iamin, iamax, jamin, jamax, & ! close the file call nf_close(ncid) - enddo !imon-loop + n1sv=n1 + n2sv=n2 !--- deallocate (buff, pres_tmp) deallocate (buffx) @@ -256,15 +353,20 @@ END SUBROUTINE setindxaer !********************************************************************** !********************************************************************** ! - SUBROUTINE aerinterpol(me,master,nthrds,npts,IDATE,FHOUR,jindx1,jindx2, & + SUBROUTINE aerinterpol( me,master,nthrds,npts,IDATE,FHOUR,iflip, jindx1,jindx2, & ddy,iindx1,iindx2,ddx,lev,prsl,aerout) ! - USE MACHINE, ONLY : kind_phys + use machine, only: kind_phys, kind_io4, kind_io8 use aerclm_def + use netcdf + implicit none - integer i1,i2, iday,j,j1,j2,l,npts,nc,n1,n2,lev,k,i,ii + integer, intent(in) :: iflip + integer i1,i2, iday,j,j1,j2,l,npts,nc,n1,n2,lev,k,i,ii, klev real(kind=kind_phys) fhour,temj, tx1, tx2,temi, tem real(kind=kind_phys), dimension(npts) :: temij,temiy,temjx,ddxy + character :: fname*50, mn*2, vname*10 + ! integer JINDX1(npts), JINDX2(npts), iINDX1(npts), iINDX2(npts) @@ -279,6 +381,11 @@ SUBROUTINE aerinterpol(me,master,nthrds,npts,IDATE,FHOUR,jindx1,jindx2, & integer jdow, jdoy, jday real(4) rinc4(5) integer w3kindreal,w3kindint + integer ncid, varid + real(kind=kind_io4),allocatable,dimension(:,:,:) :: buff + real(kind=kind_io4),allocatable,dimension(:,:,:,:):: buffx + real(kind=kind_io4),allocatable,dimension(:,:) :: pres_tmp + ! IDAT = 0 IDAT(1) = IDATE(4) @@ -310,6 +417,86 @@ SUBROUTINE aerinterpol(me,master,nthrds,npts,IDATE,FHOUR,jindx1,jindx2, & endif enddo n1 = n2 - 1 +! need to read a new month + if (n1>n1sv) then + DO ii = 1, ntrcaerm + do j = jamin, jamax + do k = 1, levsaer + do i = iamin, iamax + aerin(i,j,k,ii,1) = aerin(i,j,k,ii,2) + enddo !i-loop (lon) + enddo !k-loop (lev) + enddo !j-loop (lat) + ENDDO ! ii-loop (ntracaerm) +!! =================================================================== + allocate (buff(lonsaer, latsaer, levsw)) + allocate (pres_tmp(lonsaer, levsw)) + allocate (buffx(lonsaer, latsaer, levsw, 1)) + + write(mn,'(i2.2)') n2 + fname=trim("aeroclim.m"//mn//".nc") + call nf_open(fname , nf90_NOWRITE, ncid) + +! ====> construct 3-d pressure array (Pa) + call nf_inq_varid(ncid, "DELP", varid) + call nf_get_var(ncid, varid, buff) + + do j = jamin, jamax + do i = iamin, iamax +! constract pres_tmp (top-down), note input is top-down + pres_tmp(i,1) = 0. + do k=2, levsw + pres_tmp(i,k) = pres_tmp(i,k-1)+buff(i,j,k) + enddo !k-loop + enddo !i-loop (lon) + +! extract pres_tmp to fill aer_pres (in Pa) + do k = 1, levsaer + if ( iflip == 0 ) then ! data from toa to sfc + klev = k + else ! data from sfc to top + klev = ( levsw - k ) + 1 + endif + do i = iamin, iamax + aer_pres(i,j,k,2) = 1.d0*pres_tmp(i,klev) + enddo !i-loop (lon) + enddo !k-loop (lev) + enddo !j-loop (lat) + +! ====> construct 4-d aerosol array (kg/kg) +! merra2 data is top down +! for GFS, iflip 0: toa to sfc; 1: sfc to toa + DO ii = 1, ntrcaerm + vname=trim(specname(ii)) + call nf_inq_varid(ncid, vname, varid) + call nf_get_var(ncid, varid, buffx) + + do j = jamin, jamax + do k = 1, levsaer +! input is from toa to sfc + if ( iflip == 0 ) then ! data from toa to sfc + klev = k + else ! data from sfc to top + klev = ( levsw - k ) + 1 + endif + do i = iamin, iamax + aerin(i,j,k,ii,2) = 1.d0*buffx(i,j,klev,1) + if(aerin(i,j,k,ii,2) < 0 .or. aerin(i,j,k,ii,2) > 1.) then + aerin(i,j,k,ii,2) = 1.e-15 + endif + enddo !i-loop (lon) + enddo !k-loop (lev) + enddo !j-loop (lat) + + ENDDO ! ii-loop (ntracaerm) + +! close the file + call nf_close(ncid) + deallocate (buff, pres_tmp) + deallocate (buffx) + n1sv=n1 + n2sv=n2 + end if ! tx1 = (aer_time(n2) - rjday) / (aer_time(n2) - aer_time(n1)) tx2 = 1.0 - tx1 @@ -328,7 +515,7 @@ SUBROUTINE aerinterpol(me,master,nthrds,npts,IDATE,FHOUR,jindx1,jindx2, & !$OMP parallel num_threads(nthrds) default(none) & !$OMP shared(npts,ntrcaer,aerin,aer_pres,prsl) & !$OMP shared(ddx,ddy,jindx1,jindx2,iindx1,iindx2) & -!$OMP shared(aerpm,aerpres,aerout,n1,n2,lev,nthrds) & +!$OMP shared(aerpm,aerpres,aerout,lev,nthrds) & !$OMP shared(temij,temiy,temjx,ddxy) & !$OMP private(l,j,k,ii,i1,i2,j1,j2,tem) & !$OMP copyin(tx1,tx2) firstprivate(tx1,tx2) @@ -343,17 +530,17 @@ SUBROUTINE aerinterpol(me,master,nthrds,npts,IDATE,FHOUR,jindx1,jindx2, & I2 = IINDX2(J) DO ii=1,ntrcaer aerpm(j,L,ii) = & - tx1*(TEMIJ(j)*aerin(I1,J1,L,ii,n1)+DDXY(j)*aerin(I2,J2,L,ii,n1) & - +TEMIY(j)*aerin(I1,J2,L,ii,n1)+temjx(j)*aerin(I2,J1,L,ii,n1))& - +tx2*(TEMIJ(j)*aerin(I1,J1,L,ii,n2)+DDXY(j)*aerin(I2,J2,L,ii,n2) & - +TEMIY(j)*aerin(I1,J2,L,ii,n2)+temjx(j)*aerin(I2,J1,L,ii,n2)) + tx1*(TEMIJ(j)*aerin(I1,J1,L,ii,1)+DDXY(j)*aerin(I2,J2,L,ii,1) & + +TEMIY(j)*aerin(I1,J2,L,ii,1)+temjx(j)*aerin(I2,J1,L,ii,1))& + +tx2*(TEMIJ(j)*aerin(I1,J1,L,ii,2)+DDXY(j)*aerin(I2,J2,L,ii,2) & + +TEMIY(j)*aerin(I1,J2,L,ii,2)+temjx(j)*aerin(I2,J1,L,ii,2)) ENDDO aerpres(j,L) = & - tx1*(TEMIJ(j)*aer_pres(I1,J1,L,n1)+DDXY(j)*aer_pres(I2,J2,L,n1) & - +TEMIY(j)*aer_pres(I1,J2,L,n1)+temjx(j)*aer_pres(I2,J1,L,n1))& - +tx2*(TEMIJ(j)*aer_pres(I1,J1,L,n2)+DDXY(j)*aer_pres(I2,J2,L,n2) & - +TEMIY(j)*aer_pres(I1,J2,L,n2)+temjx(j)*aer_pres(I2,J1,L,n2)) + tx1*(TEMIJ(j)*aer_pres(I1,J1,L,1)+DDXY(j)*aer_pres(I2,J2,L,1) & + +TEMIY(j)*aer_pres(I1,J2,L,1)+temjx(j)*aer_pres(I2,J1,L,1))& + +tx2*(TEMIJ(j)*aer_pres(I1,J1,L,2)+DDXY(j)*aer_pres(I2,J2,L,2) & + +TEMIY(j)*aer_pres(I1,J2,L,2)+temjx(j)*aer_pres(I2,J1,L,2)) ENDDO ENDDO #ifndef __GFORTRAN__ diff --git a/physics/module_mp_thompson.F90 b/physics/module_mp_thompson.F90 index 08f11b61c..b44f37d2c 100644 --- a/physics/module_mp_thompson.F90 +++ b/physics/module_mp_thompson.F90 @@ -1163,6 +1163,8 @@ SUBROUTINE mp_gt_driver(qv, qc, qr, qi, qs, qg, ni, nr, nc, & stop end if end if + if (is_aerosol_aware .and. merra2_aerosol_aware) then + end if if (is_aerosol_aware .and. (.not.present(nc) .or. & .not.present(nwfa) .or. & From 50faac844010a1b8923bfd12dfec5452ce553a44 Mon Sep 17 00:00:00 2001 From: "anning.cheng" Date: Thu, 17 Mar 2022 20:46:11 +0000 Subject: [PATCH 14/21] some err fixed for compilation --- physics/GFS_rrtmg_pre.meta | 1 - physics/module_MYNNPBL_wrapper.meta | 1 - 2 files changed, 2 deletions(-) diff --git a/physics/GFS_rrtmg_pre.meta b/physics/GFS_rrtmg_pre.meta index feb3d4d8f..4ad9a3751 100644 --- a/physics/GFS_rrtmg_pre.meta +++ b/physics/GFS_rrtmg_pre.meta @@ -375,7 +375,6 @@ dimensions = () type = logical intent = in - optional = F [lgfdlmprad] standard_name = flag_for_GFDL_microphysics_radiation_interaction long_name = flag for GFDL microphysics-radiation interaction diff --git a/physics/module_MYNNPBL_wrapper.meta b/physics/module_MYNNPBL_wrapper.meta index fec7fd72b..b738ebaed 100644 --- a/physics/module_MYNNPBL_wrapper.meta +++ b/physics/module_MYNNPBL_wrapper.meta @@ -1309,7 +1309,6 @@ dimensions = () type = integer intent = in ->>>>>>> upstream/main [lprnt] standard_name = flag_print long_name = control flag for diagnostic print out From 2d88c4da71a45d3454d971a9ba110c49aff43e61 Mon Sep 17 00:00:00 2001 From: "anning.cheng" Date: Mon, 21 Mar 2022 19:32:28 +0000 Subject: [PATCH 15/21] synchronize with trunk and pass compilation --- physics/GFS_PBL_generic.F90 | 4 ++-- physics/GFS_suite_interstitial.F90 | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/physics/GFS_PBL_generic.F90 b/physics/GFS_PBL_generic.F90 index e1982cc69..a9fdd4155 100644 --- a/physics/GFS_PBL_generic.F90 +++ b/physics/GFS_PBL_generic.F90 @@ -113,8 +113,8 @@ subroutine GFS_PBL_generic_pre_run (im, levs, nvdiff, ntrac, rtg_ozone_index, 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 - integer, intent(in) :: mraerosol, imp_physics_nssl + 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 real(kind=kind_phys), dimension(:,:,:), intent(in) :: qgrs diff --git a/physics/GFS_suite_interstitial.F90 b/physics/GFS_suite_interstitial.F90 index e5c03c94c..044912e07 100644 --- a/physics/GFS_suite_interstitial.F90 +++ b/physics/GFS_suite_interstitial.F90 @@ -537,7 +537,7 @@ subroutine GFS_suite_interstitial_3_run (otsptflag, & imp_physics_gfdl, imp_physics_thompson, imp_physics_wsm6,imp_physics_fer_hires, & imp_physics_nssl, me, index_of_process_conv_trans integer, intent(in ), dimension(:) :: islmsk, kpbl, kinver - logical, intent(in ) :: cscnv, satmedmf, trans_trac, do_shoc, ras + logical, intent(in ) :: cscnv, satmedmf, trans_trac, do_shoc, ltaerosol, ras integer, intent(in) :: ntinc, ntlnc logical, intent(in) :: ldiag3d, qdiag3d @@ -661,11 +661,11 @@ subroutine GFS_suite_interstitial_3_run (otsptflag, & save_tcp(i,k) = gt0(i,k) enddo enddo - if (ntinc>0) then + if(ltaerosol) then save_qi(:,:) = clw(:,:,1) - end if - if (ntlnc>0) then save_qc(:,:) = clw(:,:,2) + else + save_qi(:,:) = clw(:,:,1) endif else if (imp_physics == imp_physics_nssl ) then do k=1,levs From 7bbb6a56c9d01d83989d876858c95e09509c8cfe Mon Sep 17 00:00:00 2001 From: "anning.cheng" Date: Mon, 11 Apr 2022 03:19:11 +0000 Subject: [PATCH 16/21] mraerosl begins to run --- physics/rte-rrtmgp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/physics/rte-rrtmgp b/physics/rte-rrtmgp index 9588c7bd8..cec1e8e12 160000 --- a/physics/rte-rrtmgp +++ b/physics/rte-rrtmgp @@ -1 +1 @@ -Subproject commit 9588c7bd89e4f51a924f766e313bc42830fb4479 +Subproject commit cec1e8e12d969c3c8c76574dbe4f40b366419cc7 From 4bf72634003ef9ec8edf92d90c83d1376cbcb05c Mon Sep 17 00:00:00 2001 From: "anning.cheng" Date: Fri, 13 May 2022 14:18:55 -0500 Subject: [PATCH 17/21] merged with trunk passed compilation May 13 --- physics/GFS_PBL_generic_common.F90 | 2 +- physics/GFS_PBL_generic_post.F90 | 2 +- physics/GFS_PBL_generic_pre.F90 | 4 ++-- physics/rte-rrtmgp | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/physics/GFS_PBL_generic_common.F90 b/physics/GFS_PBL_generic_common.F90 index 7c9eb1761..bd711a2b3 100644 --- a/physics/GFS_PBL_generic_common.F90 +++ b/physics/GFS_PBL_generic_common.F90 @@ -12,7 +12,7 @@ module GFS_PBL_generic_common contains subroutine set_aerosol_tracer_index(imp_physics, imp_physics_wsm6, & - imp_physics_thompson, ltaerosol,,mraerosol, & + imp_physics_thompson, ltaerosol,mraerosol, & imp_physics_mg, ntgl, imp_physics_gfdl, & imp_physics_zhao_carr, imp_physics_nssl,& nssl_hail_on, nssl_ccn_on, kk, & diff --git a/physics/GFS_PBL_generic_post.F90 b/physics/GFS_PBL_generic_post.F90 index 2a3f05c94..22deeeb67 100644 --- a/physics/GFS_PBL_generic_post.F90 +++ b/physics/GFS_PBL_generic_post.F90 @@ -12,7 +12,7 @@ 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, & 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, & 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, & diff --git a/physics/GFS_PBL_generic_pre.F90 b/physics/GFS_PBL_generic_pre.F90 index e9386204d..b9f7bb880 100644 --- a/physics/GFS_PBL_generic_pre.F90 +++ b/physics/GFS_PBL_generic_pre.F90 @@ -108,7 +108,7 @@ subroutine GFS_PBL_generic_pre_run (im, levs, nvdiff, ntrac, rtg_ozone_index, enddo enddo rtg_ozone_index = 10 - elsif(mraerosol) then + elseif(mraerosol) then do k=1,levs do i=1,im vdftra(i,k,1) = qgrs(i,k,ntqv) @@ -258,7 +258,7 @@ subroutine GFS_PBL_generic_pre_run (im, levs, nvdiff, ntrac, rtg_ozone_index, ! if (trans_aero) then call set_aerosol_tracer_index(imp_physics, imp_physics_wsm6, & - imp_physics_thompson, ltaerosol,,mraerosol, & + imp_physics_thompson, ltaerosol,mraerosol, & imp_physics_mg, ntgl, imp_physics_gfdl, & imp_physics_zhao_carr, imp_physics_nssl,& nssl_hail_on, nssl_ccn_on, kk, & diff --git a/physics/rte-rrtmgp b/physics/rte-rrtmgp index d9594c46c..cec1e8e12 160000 --- a/physics/rte-rrtmgp +++ b/physics/rte-rrtmgp @@ -1 +1 @@ -Subproject commit d9594c46c877a2ab8001f5cd37961efdcf08ad8e +Subproject commit cec1e8e12d969c3c8c76574dbe4f40b366419cc7 From 4560e7854525c239bace55e0183c1d015d31735a Mon Sep 17 00:00:00 2001 From: "anning.cheng" Date: Thu, 25 Aug 2022 15:17:42 -0400 Subject: [PATCH 18/21] merged with trunk and pass compilation 8/25/2022 --- physics/GFS_rrtmgp_cloud_mp.F90 | 2 +- physics/mp_thompson.F90 | 1 + physics/mp_thompson.meta | 28 ++++++++++++++-------------- physics/rte-rrtmgp | 2 +- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/physics/GFS_rrtmgp_cloud_mp.F90 b/physics/GFS_rrtmgp_cloud_mp.F90 index 46f895009..2acf8b4da 100644 --- a/physics/GFS_rrtmgp_cloud_mp.F90 +++ b/physics/GFS_rrtmgp_cloud_mp.F90 @@ -254,7 +254,7 @@ subroutine GFS_rrtmgp_cloud_mp_run(nCol, nLev, nTracers, ncnd, i_cldliq, i_cldic ! Update particle size using modified mixing-ratios from Thompson. call 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,& - mrserosol, effrin_cldliq, effrin_cldice, effrin_cldsnow) + mraerosol, effrin_cldliq, effrin_cldice, effrin_cldsnow) cld_reliq = effrin_cldliq cld_reice = effrin_cldice cld_resnow = effrin_cldsnow diff --git a/physics/mp_thompson.F90 b/physics/mp_thompson.F90 index bbdfe4929..589507783 100644 --- a/physics/mp_thompson.F90 +++ b/physics/mp_thompson.F90 @@ -324,6 +324,7 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & first_time_step, istep, nsteps, & prcp, rain, graupel, ice, snow, sr, & refl_10cm, reset_dBZ, do_radar_ref, & + aerfld, & mpicomm, mpirank, mpiroot, blkno, & ext_diag, diag3d, reset_diag3d, & spp_wts_mp, spp_mp, n_var_spp, & diff --git a/physics/mp_thompson.meta b/physics/mp_thompson.meta index bc89e479c..083f58c96 100644 --- a/physics/mp_thompson.meta +++ b/physics/mp_thompson.meta @@ -224,9 +224,9 @@ kind = kind_phys intent = in [aerfld] - standard_name = mass_number_concentration_of_aerosol_from_gocart_climatology - long_name = GOCART aerosol climatology number concentration - units = kg-1 + standard_name = mass_mixing_ratio_of_aerosol_from_gocart_or_merra2 + long_name = mass mixing ratio of aerosol from gocart or merra2 + units = kg kg-1 dimensions = (horizontal_dimension,vertical_layer_dimension,number_of_aerosol_tracers_MG) type = real kind = kind_phys @@ -618,9 +618,9 @@ type = logical intent = in [aerfld] - standard_name = mass_number_concentration_of_aerosol_from_gocart_climatology - long_name = GOCART aerosol climatology number concentration - units = kg-1 + standard_name = mass_mixing_ratio_of_aerosol_from_gocart_or_merra2 + long_name = mass mixing ratio of aerosol from gocart or merra2 + units = kg kg-1 dimensions = (horizontal_loop_extent,vertical_layer_dimension,number_of_aerosol_tracers_MG) type = real kind = kind_phys @@ -704,14 +704,6 @@ type = real kind = kind_phys intent = in -[spp_stddev_cutoff] - standard_name = magnitude_of_spp_standard_deviation_cutoff - long_name = magnitude of spp standard deviation cutoff - units = 1 - dimensions = (number_of_perturbed_spp_schemes) - type = real - kind = kind_phys - intent = in [spp_var_list] standard_name = perturbed_spp_schemes long_name = perturbed spp schemes @@ -720,6 +712,14 @@ type = character kind = len=3 intent = in +[spp_stddev_cutoff] + standard_name = magnitude_of_spp_standard_deviation_cutoff + long_name = magnitude of spp standard deviation cutoff + units = 1 + dimensions = (number_of_perturbed_spp_schemes) + type = real + kind = kind_phys + intent = in [cplchm] standard_name = flag_for_chemistry_coupling long_name = flag controlling cplchm collection (default off) diff --git a/physics/rte-rrtmgp b/physics/rte-rrtmgp index cec1e8e12..7f01618c9 160000 --- a/physics/rte-rrtmgp +++ b/physics/rte-rrtmgp @@ -1 +1 @@ -Subproject commit cec1e8e12d969c3c8c76574dbe4f40b366419cc7 +Subproject commit 7f01618c92409658bddd3afa9acb004c608f6a0d From 64a3409d2da1ae1b70b7f7954f8bc98a52ec08a4 Mon Sep 17 00:00:00 2001 From: "Chunxi.Zhang-NOAA" Date: Fri, 16 Sep 2022 19:42:33 +0000 Subject: [PATCH 19/21] Updated the Thompson scheme and fixed a bug in GSS_PBL_generic_common.F90 related to merra2 --- physics/GFS_PBL_generic_common.F90 | 2 +- physics/module_mp_thompson.F90 | 4 +-- physics/mp_thompson.F90 | 57 +++++++++++------------------- physics/mp_thompson.meta | 16 ++++----- 4 files changed, 30 insertions(+), 49 deletions(-) diff --git a/physics/GFS_PBL_generic_common.F90 b/physics/GFS_PBL_generic_common.F90 index bd711a2b3..5f09f5347 100644 --- a/physics/GFS_PBL_generic_common.F90 +++ b/physics/GFS_PBL_generic_common.F90 @@ -39,7 +39,7 @@ subroutine set_aerosol_tracer_index(imp_physics, imp_physics_wsm6, & if(ltaerosol) then kk = 12 else if(mraerosol) then - kk = 8 + kk = 10 else kk = 9 endif diff --git a/physics/module_mp_thompson.F90 b/physics/module_mp_thompson.F90 index 70d4b1f61..0e3d5c375 100644 --- a/physics/module_mp_thompson.F90 +++ b/physics/module_mp_thompson.F90 @@ -1154,8 +1154,6 @@ SUBROUTINE mp_gt_driver(qv, qc, qr, qi, qs, qg, ni, nr, nc, & stop end if end if - if (is_aerosol_aware .and. merra2_aerosol_aware) then - end if if (is_aerosol_aware .and. (.not.present(nc) .or. & .not.present(nwfa) .or. & @@ -2944,7 +2942,7 @@ subroutine mp_thompson (qv1d, qc1d, qi1d, qr1d, qs1d, qg1d, ni1d, & !> - Freezing of aqueous aerosols based on Koop et al (2001, Nature) xni = smo0(k)+ni(k) + (pni_rfz(k)+pni_wfz(k)+pni_inu(k))*dtsave - if ((is_aerosol_aware .or. merra2_aerosol_aware) .AND. homogIce .AND. (xni.le.999.E3) & + if ((is_aerosol_aware .or. merra2_aerosol_aware) .AND. homogIce .AND. (xni.le.499.E3) & & .AND.(temp(k).lt.238).AND.(ssati(k).ge.0.4) ) then xnc = iceKoop(temp(k),qv(k),qvs(k),nwfa(k), dtsave) pni_iha(k) = xnc*odts diff --git a/physics/mp_thompson.F90 b/physics/mp_thompson.F90 index 589507783..14f780993 100644 --- a/physics/mp_thompson.F90 +++ b/physics/mp_thompson.F90 @@ -63,11 +63,11 @@ subroutine mp_thompson_init(ncol, nlev, con_g, con_rd, con_eps, & ! Aerosols logical, intent(in ) :: is_aerosol_aware logical, intent(in ) :: merra2_aerosol_aware - real(kind_phys), optional, intent(inout) :: nc(:,:) - real(kind_phys), optional, intent(inout) :: nwfa(:,:) - real(kind_phys), optional, intent(inout) :: nifa(:,:) - real(kind_phys), optional, intent(inout) :: nwfa2d(:) - real(kind_phys), optional, intent(inout) :: nifa2d(:) + real(kind_phys), intent(inout) :: nc(:,:) + real(kind_phys), intent(inout) :: nwfa(:,:) + real(kind_phys), intent(inout) :: nifa(:,:) + real(kind_phys), intent(inout) :: nwfa2d(:) + real(kind_phys), intent(inout) :: nifa2d(:) real(kind_phys), intent(in) :: aerfld(:,:,:) ! State variables real(kind_phys), intent(in ) :: tgrs(:,:) @@ -264,6 +264,7 @@ subroutine mp_thompson_init(ncol, nlev, con_g, con_rd, con_eps, & ! Ensure we have 1st guess cloud droplet number where mass non-zero but no number. where(qc .LE. 0.0) nc=0.0 where(qc .GT. 0 .and. nc .LE. 0.0) nc = make_DropletNumber(qc*rho, nwfa*rho) * orho + where(qc .EQ. 0.0 .and. nc .GT. 0.0) nc = 0.0 ! Ensure non-negative aerosol number concentrations. where(nwfa .LE. 0.0) nwfa = 1.1E6 @@ -277,6 +278,7 @@ subroutine mp_thompson_init(ncol, nlev, con_g, con_rd, con_eps, & ! Ensure we have 1st guess cloud droplet number where mass non-zero but no number. where(qc .LE. 0.0) nc=0.0 where(qc .GT. 0 .and. nc .LE. 0.0) nc = make_DropletNumber(qc*rho, nwfa*rho) * orho + where(qc .EQ. 0.0 .and. nc .GT. 0.0) nc = 0.0 else @@ -287,11 +289,11 @@ subroutine mp_thompson_init(ncol, nlev, con_g, con_rd, con_eps, & end if if (convert_dry_rho) then - qc = qc/(1.0_kind_phys+qv) - qr = qr/(1.0_kind_phys+qv) - qi = qi/(1.0_kind_phys+qv) - qs = qs/(1.0_kind_phys+qv) - qg = qg/(1.0_kind_phys+qv) + !qc = qc/(1.0_kind_phys+qv) + !qr = qr/(1.0_kind_phys+qv) + !qi = qi/(1.0_kind_phys+qv) + !qs = qs/(1.0_kind_phys+qv) + !qg = qg/(1.0_kind_phys+qv) ni = ni/(1.0_kind_phys+qv) nr = nr/(1.0_kind_phys+qv) @@ -514,6 +516,14 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & ' nc, nwfa, nifa, nwfa2d, nifa2d' errflg = 1 return + else if (merra2_aerosol_aware .and. .not. (present(nc) .and. & + present(nwfa) .and. & + present(nifa) )) then + write(errmsg,fmt='(*(a))') 'Logic error in mp_thompson_run:', & + ' merra2 aerosol-aware microphysics require the', & + ' following optional arguments: nc, nwfa, nifa' + errflg = 1 + return end if ! Consistency cheecks - subcycling and inner loop at the same time are not supported if (nsteps>1 .and. dt_inner < dtp) then @@ -543,33 +553,6 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & else dtstep = dtp end if - if (first_time_step .and. istep==1 .and. mpirank==mpiroot .and. blkno==1) then - write(*,'(a,i0,a,a,f6.2,a)') 'Thompson MP is using ', nsteps, ' substep(s) per time step', & - ' with an effective time step of ', dtstep, ' seconds' - end if - - if (first_time_step .and. istep==1) then - if (is_aerosol_aware .and. .not. (present(nc) .and. & - present(nwfa) .and. & - present(nifa) .and. & - present(nwfa2d) .and. & - present(nifa2d) )) then - write(errmsg,fmt='(*(a))') 'Logic error in mp_thompson_run:', & - ' aerosol-aware microphysics require all of the', & - ' following optional arguments:', & - ' nc, nwfa, nifa, nwfa2d, nifa2d' - errflg = 1 - return - else if (merra2_aerosol_aware .and. .not. (present(nc) .and. & - present(nwfa) .and. & - present(nifa) )) then - write(errmsg,fmt='(*(a))') 'Logic error in mp_thompson_run:', & - ' merra2 aerosol-aware microphysics require the', & - ' following optional arguments: nc, nwfa, nifa' - errflg = 1 - return - end if - end if !> - Convert specific humidity to water vapor mixing ratio. !> - Also, hydrometeor variables are mass or number mixing ratio diff --git a/physics/mp_thompson.meta b/physics/mp_thompson.meta index 083f58c96..59f937148 100644 --- a/physics/mp_thompson.meta +++ b/physics/mp_thompson.meta @@ -704,14 +704,6 @@ type = real kind = kind_phys intent = in -[spp_var_list] - standard_name = perturbed_spp_schemes - long_name = perturbed spp schemes - units = none - dimensions = (number_of_perturbed_spp_schemes) - type = character - kind = len=3 - intent = in [spp_stddev_cutoff] standard_name = magnitude_of_spp_standard_deviation_cutoff long_name = magnitude of spp standard deviation cutoff @@ -720,6 +712,14 @@ type = real kind = kind_phys intent = in +[spp_var_list] + standard_name = perturbed_spp_schemes + long_name = perturbed spp schemes + units = none + dimensions = (number_of_perturbed_spp_schemes) + type = character + kind = len=3 + intent = in [cplchm] standard_name = flag_for_chemistry_coupling long_name = flag controlling cplchm collection (default off) From fb66f0f7c117c53a20acdf6ed21a7f1bf229e579 Mon Sep 17 00:00:00 2001 From: "Chunxi.Zhang-NOAA" Date: Fri, 23 Sep 2022 15:49:29 +0000 Subject: [PATCH 20/21] Renamed standard name flag_for_merra2_aerosol_aware_for_thompson and deleted GFS_rrtmgp_thompsonmp_pre.F90 --- physics/GFS_PBL_generic_post.meta | 4 +- physics/GFS_PBL_generic_pre.meta | 4 +- physics/GFS_rrtmg_pre.meta | 4 +- physics/GFS_rrtmgp_cloud_mp.meta | 4 +- physics/GFS_rrtmgp_thompsonmp_pre.F90 | 297 -------------------------- physics/mp_thompson.meta | 8 +- physics/mynnedmf_wrapper.meta | 4 +- 7 files changed, 14 insertions(+), 311 deletions(-) delete mode 100644 physics/GFS_rrtmgp_thompsonmp_pre.F90 diff --git a/physics/GFS_PBL_generic_post.meta b/physics/GFS_PBL_generic_post.meta index b66b74df9..b20142991 100644 --- a/physics/GFS_PBL_generic_post.meta +++ b/physics/GFS_PBL_generic_post.meta @@ -275,8 +275,8 @@ type = logical intent = in [mraerosol] - standard_name = flag_for_merra2_aerosol_aware_for_thompson - long_name = flag for merra2 aerosol-aware physics for thompson microphysics + standard_name = do_merra2_aerosol_awareness + long_name = flag for merra2 aerosol-aware physics for example the thompson microphysics units = flag dimensions = () type = logical diff --git a/physics/GFS_PBL_generic_pre.meta b/physics/GFS_PBL_generic_pre.meta index adeb72014..a09b34b48 100644 --- a/physics/GFS_PBL_generic_pre.meta +++ b/physics/GFS_PBL_generic_pre.meta @@ -281,8 +281,8 @@ type = logical intent = in [mraerosol] - standard_name = flag_for_merra2_aerosol_aware_for_thompson - long_name = flag for merra2 aerosol-aware physics for thompson microphysics + standard_name = do_merra2_aerosol_awareness + long_name = flag for merra2 aerosol-aware physics for example the thompson microphysics units = flag dimensions = () type = logical diff --git a/physics/GFS_rrtmg_pre.meta b/physics/GFS_rrtmg_pre.meta index a69bc6096..63ab11d3e 100644 --- a/physics/GFS_rrtmg_pre.meta +++ b/physics/GFS_rrtmg_pre.meta @@ -558,8 +558,8 @@ type = logical intent = in [mraerosol] - standard_name = flag_for_merra2_aerosol_aware_for_thompson - long_name = flag for merra2 aerosol-aware physics for thompson microphysics + standard_name = do_merra2_aerosol_awareness + long_name = flag for merra2 aerosol-aware physics for example the thompson microphysics units = flag dimensions = () type = logical diff --git a/physics/GFS_rrtmgp_cloud_mp.meta b/physics/GFS_rrtmgp_cloud_mp.meta index 5fc85b2e8..4f48d53ef 100644 --- a/physics/GFS_rrtmgp_cloud_mp.meta +++ b/physics/GFS_rrtmgp_cloud_mp.meta @@ -190,8 +190,8 @@ type = logical intent = in [mraerosol] - standard_name = flag_for_merra2_aerosol_aware_for_thompson - long_name = flag for merra2 aerosol-aware physics for thompson microphysics + standard_name = do_merra2_aerosol_awareness + long_name = flag for merra2 aerosol-aware physics for example the thompson microphysics units = flag dimensions = () type = logical diff --git a/physics/GFS_rrtmgp_thompsonmp_pre.F90 b/physics/GFS_rrtmgp_thompsonmp_pre.F90 deleted file mode 100644 index 38f7c4453..000000000 --- a/physics/GFS_rrtmgp_thompsonmp_pre.F90 +++ /dev/null @@ -1,297 +0,0 @@ -! ######################################################################################## -! This module contains the interface between the THOMPSON macrophysics and the RRTMGP radiation -! schemes. Only compatable with Model%imp_physics = Model%imp_physics_thompson -! ######################################################################################## -module GFS_rrtmgp_thompsonmp_pre - use machine, only: & - kind_phys - use radiation_tools, only: & - check_error_msg - use module_mp_thompson, only: & - calc_effectRad, Nt_c, & - re_qc_min, re_qc_max, & - re_qi_min, re_qi_max, & - re_qs_min, re_qs_max - use module_mp_thompson_make_number_concentrations, only: & - make_IceNumber, & - make_DropletNumber, & - make_RainNumber - use rrtmgp_lw_cloud_optics, only: radliq_lwr => radliq_lwrLW, radliq_upr => radliq_uprLW,& - radice_lwr => radice_lwrLW, radice_upr => radice_uprLW - implicit none - - ! Parameters specific to THOMPSON MP scheme. - real(kind_phys), parameter :: & - rerain_def = 1000.0 ! Default rain radius to 1000 microns - - public GFS_rrtmgp_thompsonmp_pre_init, GFS_rrtmgp_thompsonmp_pre_run, GFS_rrtmgp_thompsonmp_pre_finalize - -contains - ! ###################################################################################### - ! ###################################################################################### - subroutine GFS_rrtmgp_thompsonmp_pre_init() - end subroutine GFS_rrtmgp_thompsonmp_pre_init - - ! ###################################################################################### - ! ###################################################################################### -!! \section arg_table_GFS_rrtmgp_thompsonmp_pre_run -!! \htmlinclude GFS_rrtmgp_thompsonmp_pre_run.html -!! - subroutine GFS_rrtmgp_thompsonmp_pre_run(nCol, nLev, nTracers, ncnd, doSWrad, doLWrad, & - i_cldliq, i_cldice, i_cldrain, i_cldsnow, i_cldgrpl, i_cldtot, i_cldliq_nc, & - i_cldice_nc, i_twa, effr_in, p_lev, p_lay, tv_lay, t_lay, effrin_cldliq, & - effrin_cldice, effrin_cldsnow, tracer, qs_lay, q_lay, relhum, con_g, con_rd, & - con_eps, lmfshal, ltaerosol, mraerosol, do_mynnedmf, imfdeepcnv, imfdeepcnv_gf, & - doGP_cldoptics_PADE, doGP_cldoptics_LUT, & - cld_frac, cld_lwp, cld_reliq, cld_iwp, cld_reice, cld_swp, cld_resnow, cld_rwp, & - cld_rerain, precip_frac, errmsg, errflg) - - ! Inputs - integer, intent(in) :: & - nCol, & ! Number of horizontal grid points - nLev, & ! Number of vertical layers - ncnd, & ! Number of cloud condensation types. - nTracers, & ! Number of tracers from model. - i_cldliq, & ! Index into tracer array for cloud liquid amount. - i_cldice, & ! cloud ice amount. - i_cldrain, & ! cloud rain amount. - i_cldsnow, & ! cloud snow amount. - i_cldgrpl, & ! cloud groupel amount. - i_cldtot, & ! cloud total amount. - i_cldliq_nc, & ! cloud liquid number concentration. - i_cldice_nc, & ! cloud ice number concentration. - i_twa, & ! water friendly aerosol. - imfdeepcnv, & ! Choice of mass-flux deep convection scheme - imfdeepcnv_gf ! Flag for Grell-Freitas deep convection scheme - logical, intent(in) :: & - doSWrad, & ! Call SW radiation? - doLWrad, & ! Call LW radiation - effr_in, & ! Use cloud effective radii provided by model? - lmfshal, & ! Flag for mass-flux shallow convection scheme used by Xu-Randall - ltaerosol, & ! Flag for aerosol option - mraerosol, & ! Flag for merra2 aerosol option - do_mynnedmf, & ! Flag to activate MYNN-EDMF - doGP_cldoptics_LUT,& ! Flag to do GP cloud-optics (LUTs) - doGP_cldoptics_PADE ! (PADE approximation) - real(kind_phys), intent(in) :: & - 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 - - real(kind_phys), dimension(:,:), intent(in) :: & - tv_lay, & ! Virtual temperature (K) - t_lay, & ! Temperature (K) - qs_lay, & ! Saturation vapor pressure (Pa) - q_lay, & ! water-vapor mixing ratio (kg/kg) - relhum, & ! Relative humidity - p_lay ! Pressure at model-layers (Pa) - real(kind_phys), dimension(:,:), intent(in) :: & - p_lev ! Pressure at model-level interfaces (Pa) - real(kind_phys), dimension(:,:,:),intent(in) :: & - tracer ! Cloud condensate amount in layer by type () - - ! In/Outs - real(kind_phys), dimension(:,:), intent(inout) :: & - cld_frac, & ! Total cloud fraction - cld_lwp, & ! Cloud liquid water path - cld_reliq, & ! Cloud liquid effective radius - cld_iwp, & ! Cloud ice water path - cld_reice, & ! Cloud ice effecive 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 - effrin_cldliq, & ! Effective radius for liquid cloud-particles (microns) - effrin_cldice, & ! Effective radius for ice cloud-particles (microns) - effrin_cldsnow ! Effective radius for snow cloud-particles (microns) - - ! Outputs - character(len=*), intent(out) :: & - errmsg ! Error message - integer, intent(out) :: & - errflg ! Error flag - - ! Local variables - real(kind_phys) :: alpha0, pfac, tem1, cld_mr - real(kind_phys), dimension(nCol, nLev, min(4,ncnd)) :: cld_condensate - integer :: iCol,iLay,l - real(kind_phys) :: rho, orho - real(kind_phys), dimension(nCol,nLev) :: deltaP, deltaZ, re_cloud, re_ice,& - re_snow, qv_mp, qc_mp, qi_mp, qs_mp, nc_mp, ni_mp, nwfa - logical :: top_at_1 - - ! Initialize CCPP error handling variables - errmsg = '' - errflg = 0 - - if (.not. (doSWrad .or. doLWrad)) return - - ! 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) - - ! Cloud water path (g/m2) - deltaP = abs(p_lev(:,2:nLev+1)-p_lev(:,1:nLev))/100. - do iLay = 1, nLev - do iCol = 1, nCol - ! Compute liquid/ice condensate path from mixing ratios (kg/kg)->(g/m2) - tem1 = (1.0e5/con_g) * deltaP(iCol,iLay) - cld_lwp(iCol,iLay) = max(0., cld_condensate(iCol,iLay,1) * tem1) - cld_iwp(iCol,iLay) = max(0., cld_condensate(iCol,iLay,2) * tem1) - cld_rwp(iCol,iLay) = max(0., cld_condensate(iCol,iLay,3) * tem1) - cld_swp(iCol,iLay) = max(0., cld_condensate(iCol,iLay,4) * tem1) - enddo - enddo - - ! Cloud particle sizes and number concentrations... - - ! Prepare cloud mixing-ratios and number concentrations for calc_effectRad, - ! and update number concentrations, consistent with sub-grid clouds - do iLay = 1, nLev - do iCol = 1, nCol - qv_mp(iCol,iLay) = q_lay(iCol,iLay)/(1.-q_lay(iCol,iLay)) - rho = con_eps*p_lay(iCol,iLay)/(con_rd*t_lay(iCol,iLay)*(qv_mp(iCol,iLay)+con_eps)) - orho = 1./rho - qc_mp(iCol,iLay) = tracer(iCol,iLay,i_cldliq) / (1.-q_lay(iCol,iLay)) - 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 - 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 - nc_mp(iCol,iLay) = nt_c*orho - endif - if (qi_mp(iCol,iLay) > 1.e-12 .and. ni_mp(iCol,iLay) < 100.) then - ni_mp(iCol,iLay) = make_IceNumber(qi_mp(iCol,iLay)*rho, t_lay(iCol,iLay)) * orho - endif - enddo - enddo - - ! Compute effective radii for liquid/ice/snow using subgrid scale clouds - ! Call Thompson's subroutine to compute effective radii - do iCol=1,nCol - call calc_effectRad (t_lay(iCol,:), p_lay(iCol,:), qv_mp(iCol,:), qc_mp(iCol,:), & - nc_mp(iCol,:), qi_mp(iCol,:), ni_mp(iCol,:), qs_mp(iCol,:), & - re_cloud(iCol,:), re_ice(iCol,:), re_snow(iCol,:), 1, nLev ) - do iLay = 1, nLev - re_cloud(iCol,iLay) = MAX(re_qc_min, MIN(re_cloud(iCol,iLay), re_qc_max)) - re_ice(iCol,iLay) = MAX(re_qi_min, MIN(re_ice(iCol,iLay), re_qi_max)) - re_snow(iCol,iLay) = MAX(re_qs_min, MIN(re_snow(iCol,iLay), re_qs_max)) - enddo - enddo - - ! Scale Thompson's effective radii from meter to micron - do iLay = 1, nLev - do iCol = 1, nCol - effrin_cldliq(iCol,iLay) = re_cloud(iCol,iLay)*1.e6 - effrin_cldice(iCol,iLay) = re_ice(iCol,iLay)*1.e6 - effrin_cldsnow(iCol,iLay) = re_snow(iCol,iLay)*1.e6 - enddo - enddo - - ! Bound effective radii for RRTMGP, LUT's for cloud-optics go from - ! 2.5 - 21.5 microns for liquid clouds, - ! 10 - 180 microns for ice-clouds - if (doGP_cldoptics_PADE .or. doGP_cldoptics_LUT) then - do iLay = 1, nLev - do iCol = 1, nCol - if (effrin_cldliq(iCol,iLay) .lt. radliq_lwr) effrin_cldliq(iCol,iLay) = radliq_lwr - if (effrin_cldliq(iCol,iLay) .gt. radliq_upr) effrin_cldliq(iCol,iLay) = radliq_upr - if (effrin_cldice(iCol,iLay) .lt. radice_lwr) effrin_cldice(iCol,iLay) = radice_lwr - if (effrin_cldice(iCol,iLay) .gt. radice_upr) effrin_cldice(iCol,iLay) = radice_upr - enddo - enddo - endif - - ! Update global effective radii arrays. - do iLay = 1, nLev - do iCol = 1, nCol - cld_reliq(iCol,iLay) = effrin_cldliq(iCol,iLay) - cld_reice(iCol,iLay) = effrin_cldice(iCol,iLay) - cld_resnow(iCol,iLay) = effrin_cldsnow(iCol,iLay) - cld_rerain(iCol,iLay) = rerain_def - enddo - enddo - ! Compute cloud-fraction. Else, use value provided - if(.not. do_mynnedmf .and. imfdeepcnv .ne. imfdeepcnv_gf ) then ! MYNN PBL or GF conv - ! Cloud-fraction - if( lmfshal) alpha0 = 100. ! Default (from GATE simulations) - if(.not. lmfshal) alpha0 = 2000. - ! Xu-Randall (1996) cloud-fraction - do iLay = 1, nLev - do iCol = 1, nCol - cld_mr = cld_condensate(iCol,iLay,1) + cld_condensate(iCol,iLay,2) + & - 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) - enddo - enddo - endif - - ! Precipitation fraction (Hack. For now use cloud-fraction) - precip_frac(1:nCol,1:nLev) = cld_frac(1:nCol,1:nLev) - - end subroutine GFS_rrtmgp_thompsonmp_pre_run - - ! ###################################################################################### - ! ###################################################################################### - subroutine GFS_rrtmgp_thompsonmp_pre_finalize() - end subroutine GFS_rrtmgp_thompsonmp_pre_finalize - - ! ###################################################################################### - ! This function computes the cloud-fraction following. - ! Xu-Randall(1996) A Semiempirical Cloudiness Parameterization for Use in Climate Models - ! https://doi.org/10.1175/1520-0469(1996)053<3084:ASCPFU>2.0.CO;2 - ! - ! cld_frac = {1-exp[-alpha*cld_mr/((1-relhum)*qs_lay)**lambda]}*relhum**P - ! - ! ###################################################################################### - function cld_frac_XuRandall(p_lay, qs_lay, relhum, cld_mr, alpha) - - ! Inputs - real(kind_phys), intent(in) :: & - p_lay, & ! Pressure (Pa) - qs_lay, & ! Saturation vapor-pressure (Pa) - relhum, & ! Relative humidity - cld_mr, & ! Total cloud mixing ratio - alpha ! Scheme parameter (default=100) - - ! Outputs - real(kind_phys) :: cld_frac_XuRandall - - ! Locals - real(kind_phys) :: clwt, clwm, onemrh, tem1, tem2, tem3 - - ! Parameters - real(kind_phys) :: & - lambda = 0.50, & ! - P = 0.25 - - clwt = 1.0e-6 * (p_lay*0.001) - if (cld_mr > clwt) then - onemrh = max(1.e-10, 1.0 - relhum) - tem1 = alpha / min(max((onemrh*qs_lay)**lambda,0.0001),1.0) - tem2 = max(min(tem1*(cld_mr - clwt), 50.0 ), 0.0 ) - tem3 = sqrt(sqrt(relhum)) ! This assumes "p" = 0.25. Identical, but cheaper than relhum**p - ! - cld_frac_XuRandall = max( tem3*(1.0-exp(-tem2)), 0.0 ) - else - cld_frac_XuRandall = 0.0 - endif - - return - end function -end module GFS_rrtmgp_thompsonmp_pre diff --git a/physics/mp_thompson.meta b/physics/mp_thompson.meta index 59f937148..93a3ae7de 100644 --- a/physics/mp_thompson.meta +++ b/physics/mp_thompson.meta @@ -145,8 +145,8 @@ type = logical intent = in [merra2_aerosol_aware] - standard_name = flag_for_merra2_aerosol_aware_for_thompson - long_name = flag for merra2 aerosol-aware physics + standard_name = do_merra2_aerosol_awareness + long_name = flag for merra2 aerosol-aware physics for example the thompson microphysics units = flag dimensions = () type = logical @@ -411,8 +411,8 @@ type = logical intent = in [merra2_aerosol_aware] - standard_name = flag_for_merra2_aerosol_aware_for_thompson - long_name = flag for merra2 aerosol-aware physics + standard_name = do_merra2_aerosol_awareness + long_name = flag for merra2 aerosol-aware physics for example the thompson microphysics units = flag dimensions = () type = logical diff --git a/physics/mynnedmf_wrapper.meta b/physics/mynnedmf_wrapper.meta index 28e41fd69..a44a13f1b 100644 --- a/physics/mynnedmf_wrapper.meta +++ b/physics/mynnedmf_wrapper.meta @@ -1402,8 +1402,8 @@ type = logical intent = in [mraerosol] - standard_name = flag_for_merra2_aerosol_aware_for_thompson - long_name = flag for merra2 aerosol-aware physics for thompson microphysics + standard_name = do_merra2_aerosol_awareness + long_name = flag for merra2 aerosol-aware physics for example the thompson microphysics units = flag dimensions = () type = logical From d49e0d644f2da5c04852d81460322219dcf2149c Mon Sep 17 00:00:00 2001 From: "Chunxi.Zhang-NOAA" Date: Wed, 28 Sep 2022 21:02:15 +0000 Subject: [PATCH 21/21] Slightly modify the Thompson scheme but it will not change the baseline --- physics/module_mp_thompson.F90 | 25 ++++++++----------------- physics/mp_thompson.F90 | 8 ++++++++ 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/physics/module_mp_thompson.F90 b/physics/module_mp_thompson.F90 index 0e3d5c375..b71c8f1f7 100644 --- a/physics/module_mp_thompson.F90 +++ b/physics/module_mp_thompson.F90 @@ -1142,15 +1142,12 @@ SUBROUTINE mp_gt_driver(qv, qc, qr, qi, qs, qg, ni, nr, nc, & if ( (present(tt) .and. (present(th) .or. present(pii))) .or. & (.not.present(tt) .and. .not.(present(th) .and. present(pii))) ) then - if (present(errmsg)) then + if (present(errmsg) .and. present(errflg)) then write(errmsg, '(a)') 'Logic error in mp_gt_driver: provide either tt or th+pii' - else - write(*,'(a)') 'Logic error in mp_gt_driver: provide either tt or th+pii' - end if - if (present(errflg)) then errflg = 1 return else + write(*,'(a)') 'Logic error in mp_gt_driver: provide either tt or th+pii' stop end if end if @@ -1160,33 +1157,27 @@ SUBROUTINE mp_gt_driver(qv, qc, qr, qi, qs, qg, ni, nr, nc, & .not.present(nifa) .or. & .not.present(nwfa2d) .or. & .not.present(nifa2d) )) then - if (present(errmsg)) then + if (present(errmsg) .and. present(errflg)) then write(errmsg, '(*(a))') 'Logic error in mp_gt_driver: provide nc, nwfa, nifa, nwfa2d', & ' and nifa2d for aerosol-aware version of Thompson microphysics' - else - write(*, '(*(a))') 'Logic error in mp_gt_driver: provide nc, nwfa, nifa, nwfa2d', & - ' and nifa2d for aerosol-aware version of Thompson microphysics' - end if - if (present(errflg)) then errflg = 1 return else + write(*, '(*(a))') 'Logic error in mp_gt_driver: provide nc, nwfa, nifa, nwfa2d', & + ' and nifa2d for aerosol-aware version of Thompson microphysics' stop end if else if (merra2_aerosol_aware .and. (.not.present(nc) .or. & .not.present(nwfa) .or. & .not.present(nifa) )) then - if (present(errmsg)) then + if (present(errmsg) .and. present(errflg)) then write(errmsg, '(*(a))') 'Logic error in mp_gt_driver: provide nc, nwfa, and nifa', & ' for merra2 aerosol-aware version of Thompson microphysics' - else - write(*, '(*(a))') 'Logic error in mp_gt_driver: provide nc, nwfa, and nifa', & - ' for merra2 aerosol-aware version of Thompson microphysics' - end if - if (present(errflg)) then errflg = 1 return else + write(*, '(*(a))') 'Logic error in mp_gt_driver: provide nc, nwfa, and nifa', & + ' for merra2 aerosol-aware version of Thompson microphysics' stop end if else if (.not.is_aerosol_aware .and. .not.merra2_aerosol_aware .and. & diff --git a/physics/mp_thompson.F90 b/physics/mp_thompson.F90 index 14f780993..80762a5f1 100644 --- a/physics/mp_thompson.F90 +++ b/physics/mp_thompson.F90 @@ -879,6 +879,14 @@ subroutine mp_thompson_finalize(errmsg, errflg) end subroutine mp_thompson_finalize subroutine get_niwfa(aerfld, nifa, nwfa, ncol, nlev) + ! To calculate nifa and nwfa from bins of aerosols. + ! In GOCART and MERRA2, aerosols are given as mixing ratio (kg/kg). To + ! convert from kg/kg to #/kg, the "unit mass" (mass of one particle) + ! within the mass bins is calculated. A lognormal size distribution + ! within aerosol bins is used to find the size based upon the median + ! mass. NIFA is mainly summarized over five dust bins and NWFA over the + ! other 10 bins. The parameters besides each bins are carefully tuned + ! for a good performance of the scheme. implicit none integer, intent(in)::ncol, nlev real (kind=kind_phys), dimension(:,:,:), intent(in) :: aerfld