From 26d338c9ce21d16db458a050800341cb499a0f2a Mon Sep 17 00:00:00 2001 From: Peter Norris Date: Tue, 27 Feb 2024 13:55:16 -0500 Subject: [PATCH 1/2] pmn: first draft of RRTMGPv1.7 adaptation --- .../RRTMGP_cmake/CMakeLists.txt | 45 +++++++++++-------- GEOSirrad_GridComp/GEOS_IrradGridComp.F90 | 4 +- GEOSsolar_GridComp/GEOS_SolarGridComp.F90 | 4 +- 3 files changed, 30 insertions(+), 23 deletions(-) diff --git a/GEOS_RadiationShared/RRTMGP_cmake/CMakeLists.txt b/GEOS_RadiationShared/RRTMGP_cmake/CMakeLists.txt index b00ace6..2bcb067 100644 --- a/GEOS_RadiationShared/RRTMGP_cmake/CMakeLists.txt +++ b/GEOS_RadiationShared/RRTMGP_cmake/CMakeLists.txt @@ -2,33 +2,34 @@ esma_set_this (OVERRIDE RRTMGP) # These are from RRTMGP set (RRTMGP_SRCS - rte/mo_rte_kind.F90 - rte/mo_rte_config.F90 - rte/mo_rte_util_array.F90 - rte/kernels/mo_rte_solver_kernels.F90 - rte/kernels/mo_optical_props_kernels.F90 - rte/kernels/mo_fluxes_broadband_kernels.F90 - rte/mo_optical_props.F90 - rte/mo_source_functions.F90 - rte/mo_fluxes.F90 - rrtmgp/mo_rrtmgp_constants.F90 - rrtmgp/mo_rrtmgp_util_string.F90 - rrtmgp/mo_gas_optics.F90 - rrtmgp/mo_gas_optics_rrtmgp.F90 - rrtmgp/mo_gas_concentrations.F90 - rrtmgp/kernels/mo_gas_optics_kernels.F90 + rte-frontend/mo_rte_kind.F90 + rte-frontend/mo_rte_config.F90 + rte-frontend/mo_rte_util_array_validation.F90 + rte-kernels/mo_rte_util_array.F90 + rte-kernels/mo_rte_solver_kernels.F90 + rte-kernels/mo_optical_props_kernels.F90 + rte-kernels/mo_fluxes_broadband_kernels.F90 + rte-frontend/mo_optical_props.F90 + rte-frontend/mo_source_functions.F90 + rte-frontend/mo_fluxes.F90 + rte-frontend/mo_rte_lw.F90 + rte-frontend/mo_rte_sw.F90 + gas-optics/mo_gas_optics_constants.F90 + gas-optics/mo_gas_optics_util_string.F90 + gas-optics/mo_gas_concentrations.F90 + gas-optics/mo_gas_optics.F90 + rrtmgp-kernels/mo_gas_optics_rrtmgp_kernels.F90 + rrtmgp-frontend/mo_gas_optics_rrtmgp.F90 + rrtmgp-frontend/mo_cloud_optics_rrtmgp.F90 extensions/mo_compute_bc.F90 extensions/mo_fluxes_byband.F90 extensions/mo_fluxes_bygpoint.F90 extensions/mo_heating_rates.F90 extensions/mo_rrtmgp_clr_all_sky.F90 - extensions/cloud_optics/mo_cloud_optics.F90 - extensions/cloud_optics/mo_cloud_sampling.F90 + extensions/mo_cloud_sampling.F90 examples/mo_simple_netcdf.F90 examples/mo_load_coefficients.F90 examples/all-sky/mo_load_cloud_coefficients.F90 - rte/mo_rte_lw.F90 - rte/mo_rte_sw.F90 ) esma_mepo_style(RRTMGP RRTMGP_rel_path REL_PATH ..) @@ -77,3 +78,9 @@ if (MKL_FOUND) endif() set_target_properties (${this} PROPERTIES Fortran_MODULE_DIRECTORY ${include_${this}}) + +# Option to enable RRTMGP single-precision +option(RRTMGP_SINGLE_PRECISION "Use single precision for RRTMGP" OFF) +if (RRTMGP_SINGLE_PRECISION) + target_compile_definitions(${this} PRIVATE RTE_USE_SP) +endif() diff --git a/GEOSirrad_GridComp/GEOS_IrradGridComp.F90 b/GEOSirrad_GridComp/GEOS_IrradGridComp.F90 index 114b160..6b80a69 100644 --- a/GEOSirrad_GridComp/GEOS_IrradGridComp.F90 +++ b/GEOSirrad_GridComp/GEOS_IrradGridComp.F90 @@ -1219,7 +1219,7 @@ subroutine LW_Driver(IM,JM,LM,LATS,LONS,RC) ! RRTMGP module uses use mo_rte_kind, only: wp use mo_gas_concentrations, only: ty_gas_concs - use mo_cloud_optics, only: ty_cloud_optics + use mo_cloud_optics_rrtmgp, only: ty_cloud_optics_rrtmgp use mo_cloud_sampling, only: draw_samples, & sampled_mask_max_ran, sampled_mask_exp_ran, & sampled_urand_gen_max_ran @@ -1403,7 +1403,7 @@ subroutine LW_Driver(IM,JM,LM,LATS,LONS,RC) ! derived types for interacting with RRTMGP type(ty_gas_optics_rrtmgp), pointer :: k_dist type(ty_gas_concs) :: gas_concs, gas_concs_block - type(ty_cloud_optics) :: cloud_optics + type(ty_cloud_optics_rrtmgp) :: cloud_optics type(ty_source_func_lw) :: sources type(ty_fluxes_broadband) :: fluxes_clrsky, fluxes_clrnoa, & fluxes_allsky, fluxes_allnoa diff --git a/GEOSsolar_GridComp/GEOS_SolarGridComp.F90 b/GEOSsolar_GridComp/GEOS_SolarGridComp.F90 index 00a0648..a486d5e 100644 --- a/GEOSsolar_GridComp/GEOS_SolarGridComp.F90 +++ b/GEOSsolar_GridComp/GEOS_SolarGridComp.F90 @@ -3288,7 +3288,7 @@ subroutine SORADCORE(IM,JM,LM,include_aerosols,CURRTIME,MaxPasses,LoadBalance,RC ! RRTMGP module uses use mo_rte_kind, only: wp use mo_gas_concentrations, only: ty_gas_concs - use mo_cloud_optics, only: ty_cloud_optics + use mo_cloud_optics_rrtmgp, only: ty_cloud_optics_rrtmgp use mo_cloud_sampling, only: draw_samples, & sampled_mask_max_ran, sampled_mask_exp_ran, & sampled_urand_gen_max_ran @@ -3478,7 +3478,7 @@ subroutine SORADCORE(IM,JM,LM,include_aerosols,CURRTIME,MaxPasses,LoadBalance,RC ! coefficients and cloud physical properties) type(ty_gas_optics_rrtmgp), pointer :: k_dist type(ty_gas_concs) :: gas_concs, gas_concs_block - type(ty_cloud_optics) :: cloud_optics + type(ty_cloud_optics_rrtmgp) :: cloud_optics type(ty_fluxes_byband) :: fluxes_clrsky, fluxes_allsky ! PMN: my earlier RRTMGP implementations used cloud_props for liq and ice combined, From 43e9961ba8f0073604f2694cdcae489ca70ce0f7 Mon Sep 17 00:00:00 2001 From: Peter Norris Date: Tue, 27 Feb 2024 16:08:53 -0500 Subject: [PATCH 2/2] pmn: minor change to RRTMGP data file specs and defaults --- GEOSirrad_GridComp/GEOS_IrradGridComp.F90 | 8 ++++---- GEOSsolar_GridComp/GEOS_SolarGridComp.F90 | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/GEOSirrad_GridComp/GEOS_IrradGridComp.F90 b/GEOSirrad_GridComp/GEOS_IrradGridComp.F90 index 6b80a69..40531b1 100644 --- a/GEOSirrad_GridComp/GEOS_IrradGridComp.F90 +++ b/GEOSirrad_GridComp/GEOS_IrradGridComp.F90 @@ -1861,8 +1861,8 @@ subroutine LW_Driver(IM,JM,LM,LATS,LONS,RC) ! initialize k-distribution if not already done call MAPL_GetResource( & - MAPL, k_dist_file, "RRTMGP_DATA_LW:", & - DEFAULT='rrtmgp-data-lw.nc',__RC__) + MAPL, k_dist_file, "RRTMGP_GAS_LW:", & + DEFAULT='rrtmgp-gas-lw-g128.nc',__RC__) if (.not. rrtmgp_state%initialized) then ! gas_concs needed only to access required gas names call MAPL_TimerOn(MAPL,"---RRTMGP_IO_GAS",__RC__) @@ -2171,8 +2171,8 @@ subroutine LW_Driver(IM,JM,LM,LATS,LONS,RC) ! gets appropriate coefficients needed to calculate ! cloud optical properties from cloud physical properties call MAPL_GetResource( & - MAPL, cloud_optics_file, "RRTMGP_CLOUD_OPTICS_COEFFS_LW:", & - DEFAULT='rrtmgp-cloud-optics-coeffs-lw.nc', __RC__) + MAPL, cloud_optics_file, "RRTMGP_CLOUD_OPTICS_LW:", & + DEFAULT='rrtmgp-clouds-lw.nc', __RC__) call MAPL_GetResource( & MAPL, cloud_optics_type, "RRTMGP_CLOUD_OPTICS_TYPE_LW:", & DEFAULT='LUT', __RC__) diff --git a/GEOSsolar_GridComp/GEOS_SolarGridComp.F90 b/GEOSsolar_GridComp/GEOS_SolarGridComp.F90 index a486d5e..bb815c4 100644 --- a/GEOSsolar_GridComp/GEOS_SolarGridComp.F90 +++ b/GEOSsolar_GridComp/GEOS_SolarGridComp.F90 @@ -4578,8 +4578,8 @@ subroutine SORADCORE(IM,JM,LM,include_aerosols,CURRTIME,MaxPasses,LoadBalance,RC ! initialize k-distribution if not already done call MAPL_GetResource( & - MAPL, k_dist_file, "RRTMGP_DATA_SW:", & - DEFAULT='rrtmgp-data-sw.nc',__RC__) + MAPL, k_dist_file, "RRTMGP_GAS_SW:", & + DEFAULT='rrtmgp-gas-sw-g112.nc',__RC__) if (.not. rrtmgp_state%initialized) then ! gas_concs needed only to access required gas names call MAPL_TimerOn(MAPL,"--RRTMGP_IO_GAS",__RC__) @@ -4773,8 +4773,8 @@ subroutine SORADCORE(IM,JM,LM,include_aerosols,CURRTIME,MaxPasses,LoadBalance,RC ! gets appropriate coefficients needed to calculate ! cloud optical properties from cloud physical properties call MAPL_GetResource( & - MAPL, cloud_optics_file, "RRTMGP_CLOUD_OPTICS_COEFFS_SW:", & - DEFAULT='rrtmgp-cloud-optics-coeffs-reordered-sw.nc', __RC__) + MAPL, cloud_optics_file, "RRTMGP_CLOUD_OPTICS_SW:", & + DEFAULT='rrtmgp-clouds-sw.nc', __RC__) call MAPL_GetResource( & MAPL, cloud_optics_type, "RRTMGP_CLOUD_OPTICS_TYPE_SW:", & DEFAULT='LUT', __RC__)