diff --git a/physics/GFS_rrtmgp_sw_pre.F90 b/physics/GFS_rrtmgp_sw_pre.F90 index 8fc126392..6987c3e4a 100644 --- a/physics/GFS_rrtmgp_sw_pre.F90 +++ b/physics/GFS_rrtmgp_sw_pre.F90 @@ -2,6 +2,14 @@ module GFS_rrtmgp_sw_pre use physparam use machine, only: & kind_phys ! Working type + use GFS_typedefs, only: & + GFS_sfcprop_type, & ! Surface fields + GFS_control_type, & ! Model control parameters + GFS_grid_type, & ! Grid and interpolation related data + GFS_coupling_type, & ! + GFS_statein_type, & ! + GFS_radtend_type, & ! Radiation tendencies needed in physics + GFS_interstitial_type use module_radiation_astronomy,only: & coszmn ! Function to compute cos(SZA) use module_radiation_surface, only: & @@ -27,57 +35,29 @@ end subroutine GFS_rrtmgp_sw_pre_init !> \section arg_table_GFS_rrtmgp_sw_pre_run !! \htmlinclude GFS_rrtmgp_sw_pre.html !! - subroutine GFS_rrtmgp_sw_pre_run(doLWrad, do_sfcperts, ncol, nlev, ntrac, nsfcpert, nmtvr,mpi_rank, solhr, & - pertalb, sfc_wts, xlon, coslat, sinlat, slmsk, snowd, sncovr, snoalb, zorl, coszen, coszdg, tsfc,& - hprime, alvsf, alnsf, alvwf, alnwf, facsf, facwf, fice, tisfc, p_lay, p_lev, tv_lay, & - relhum, tracer, sw_gas_props, nday, idxday, alb1d, sfalb, sfc_alb_nir_dir, sfc_alb_nir_dif, & - sfc_alb_uvvis_dir, sfc_alb_uvvis_dif, errmsg, errflg) + subroutine GFS_rrtmgp_sw_pre_run(Model, Grid, Sfcprop, Statein, ncol, p_lay, p_lev, & + tv_lay, relhum, tracer, sw_gas_props, nday, idxday, alb1d, sfc_alb_nir_dir, & + sfc_alb_nir_dif, sfc_alb_uvvis_dir, sfc_alb_uvvis_dif, RadTend, Coupling, & + errmsg, errflg) ! Inputs - logical, intent(in) :: & - doLWrad , & ! Flag for longwave radiation call - do_sfcperts ! Flag for stochastic surface perturbations option - + type(GFS_control_type), intent(in) :: & + Model ! DDT: FV3-GFS model control parameters + type(GFS_grid_type), intent(in) :: & + Grid ! DDT: FV3-GFS grid and interpolation related data + type(GFS_sfcprop_type), intent(in) :: & + Sfcprop ! DDT: FV3-GFS surface fields + type(GFS_statein_type), intent(in) :: & + Statein ! DDT: FV3-GFS prognostic state data in from dycore integer, intent(in) :: & - ncol, & ! Number of horizontal grid points - nlev, & ! Number of vertical levels - ntrac, & ! Number of tracers - nsfcpert, & ! number of surface perturbations - nmtvr, & ! number of topographic variables in GWD - mpi_rank ! Current MPI-rank - real(kind_phys), intent(in) :: & - solhr ! Time after 00z at the current timestep (hours) - real(kind_phys), dimension(nsfcpert), intent(in) :: & - pertalb ! Magnitude of surface albedo perturbation - real(kind_phys), dimension(ncol,nsfcpert), intent(in) :: & - sfc_wts ! Magnitude of surface albedo perturbation - real(kind_phys), dimension(ncol), intent(in) :: & - xlon, & ! Longitude - coslat, & ! Cosine of latitude - sinlat, & ! Sine of latitude - slmsk, & ! Lank/sea mask - snowd, & ! Water equivalent snow depth (mm) - sncovr, & ! Surface snow area fraction - snoalb, & ! Maximum snow albedo - zorl, & ! Surface roughness length - tsfc, & ! Surface skin temperature (K) - alvsf, & ! Mean vis albedo with strong cosz dependency - alnsf, & ! Mean nIR albedo with strong cosz dependency - alvwf, & ! Mean vis albedo with weak cosz dependency - alnwf, & ! Mean nIR albedo with weak cosz dependency - facsf, & ! Fractional coverage with strong cosz dependency - facwf, & ! Fractional coverage with weak cosz dependency - fice, & ! Ice fraction over open water - tisfc ! Sea ice surface skin temperature - real(kind_phys), dimension(ncol), intent(in) :: & - hprime ! orographic metrics - real(kind_phys), dimension(ncol,nlev),intent(in) :: & + ncol ! Number of horizontal grid points + real(kind_phys), dimension(ncol,Model%levs),intent(in) :: & p_lay, & ! Layer pressure tv_lay, & ! Layer virtual-temperature relhum ! Layer relative-humidity - real(kind_phys), dimension(ncol, nlev, 2:ntrac),intent(in) :: & - tracer ! Chemical tracers (g/g) - real(kind_phys), dimension(ncol,nlev+1),intent(in) :: & + real(kind_phys), dimension(ncol, Model%levs, 2:Model%ntrac),intent(in) :: & + tracer + real(kind_phys), dimension(ncol,Model%levs+1),intent(in) :: & p_lev ! Pressure @ layer interfaces (Pa) type(ty_gas_optics_rrtmgp),intent(in) :: & sw_gas_props ! RRTMGP DDT: spectral information for SW calculation @@ -88,15 +68,16 @@ subroutine GFS_rrtmgp_sw_pre_run(doLWrad, do_sfcperts, ncol, nlev, ntrac, nsfcpe integer, dimension(ncol), intent(out) :: & idxday ! Indices for daylit points real(kind_phys), dimension(ncol), intent(out) :: & - coszen, & ! mean cos of zenith angle over rad call period - coszdg, & ! daytime mean cosz over rad call period - sfalb, & ! mean surface diffused SW albedo - alb1d ! Surface albedo pertubation + alb1d ! Surface albedo pertubation real(kind_phys), dimension(sw_gas_props%get_nband(),ncol), intent(out) :: & sfc_alb_nir_dir, & ! Surface albedo (direct) sfc_alb_nir_dif, & ! Surface albedo (diffuse) sfc_alb_uvvis_dir, & ! Surface albedo (direct) sfc_alb_uvvis_dif ! Surface albedo (diffuse) + type(GFS_radtend_type), intent(inout) :: & + Radtend ! DDT: FV3-GFS radiation tendencies + type(GFS_coupling_type), intent(inout) :: & + Coupling ! DDT: FV3-GFS coupling arrays character(len=*), intent(out) :: & errmsg ! Error message integer, intent(out) :: & @@ -110,13 +91,13 @@ subroutine GFS_rrtmgp_sw_pre_run(doLWrad, do_sfcperts, ncol, nlev, ntrac, nsfcpe errmsg = '' errflg = 0 - if (.not. doLWrad) return + if (.not. Model%lsswr) return ! ####################################################################################### ! Compute cosine of zenith angle (only when SW is called) ! ####################################################################################### - call coszmn (xlon, sinlat, coslat, solhr, NCOL, mpi_rank, & - coszen, coszdg) + call coszmn (Grid%xlon, Grid%sinlat, Grid%coslat, Model%solhr, NCOL, Model%me, & + Radtend%coszen, Radtend%coszdg) ! ####################################################################################### ! For SW gather daylit points @@ -124,7 +105,7 @@ subroutine GFS_rrtmgp_sw_pre_run(doLWrad, do_sfcperts, ncol, nlev, ntrac, nsfcpe nday = 0 idxday = 0 do i = 1, NCOL - if (coszen(i) >= 0.0001) then + if (Radtend%coszen(i) >= 0.0001) then nday = nday + 1 idxday(nday) = i endif @@ -136,10 +117,10 @@ subroutine GFS_rrtmgp_sw_pre_run(doLWrad, do_sfcperts, ncol, nlev, ntrac, nsfcpe ! --- turn vegetation fraction pattern into percentile pattern ! ####################################################################################### alb1d(:) = 0. - if (do_sfcperts) then - if (pertalb(1) > 0.) then + if (Model%do_sfcperts) then + if (Model%pertalb(1) > 0.) then do i=1,ncol - call cdfnor(sfc_wts(i,5),alb1d(i)) + call cdfnor(Coupling%sfc_wts(i,5),alb1d(i)) enddo endif endif @@ -147,11 +128,13 @@ subroutine GFS_rrtmgp_sw_pre_run(doLWrad, do_sfcperts, ncol, nlev, ntrac, nsfcpe ! ####################################################################################### ! Call module_radiation_surface::setalb() to setup surface albedo. ! ####################################################################################### - call setalb (slmsk, snowd, sncovr, snoalb, zorl, coszen, tsfc, tsfc, hprime, alvsf, & - alnsf, alvwf, alnwf, facsf, facwf, fice, tisfc, NCOL, alb1d, pertalb, sfcalb) + call setalb (Sfcprop%slmsk, Sfcprop%snowd, Sfcprop%sncovr, Sfcprop%snoalb, Sfcprop%zorl, & + Radtend%coszen, Sfcprop%tsfc, Sfcprop%tsfc, Sfcprop%hprime(:,1), Sfcprop%alvsf, & + Sfcprop%alnsf, Sfcprop%alvwf, Sfcprop%alnwf, Sfcprop%facsf, Sfcprop%facwf, & + Sfcprop%fice, Sfcprop%tisfc, NCOL, alb1d, Model%pertalb, sfcalb) ! Approximate mean surface albedo from vis- and nir- diffuse values. - sfalb(:) = max(0.01, 0.5 * (sfcalb(:,2) + sfcalb(:,4))) + Radtend%sfalb(:) = max(0.01, 0.5 * (sfcalb(:,2) + sfcalb(:,4))) ! Spread across all SW bands do iBand=1,sw_gas_props%get_nband() diff --git a/physics/GFS_rrtmgp_sw_pre.meta b/physics/GFS_rrtmgp_sw_pre.meta index 453c12de2..73df740e1 100644 --- a/physics/GFS_rrtmgp_sw_pre.meta +++ b/physics/GFS_rrtmgp_sw_pre.meta @@ -1,259 +1,62 @@ [ccpp-arg-table] name = GFS_rrtmgp_sw_pre_run type = scheme -[xlon] - standard_name = longitude - long_name = longitude - units = radians - dimensions = (horizontal_dimension) - type = real - kind = kind_phys - intent = in - optional = F -[coslat] - standard_name = cosine_of_latitude - long_name = cosine of latitude - units = none - dimensions = (horizontal_dimension) - type = real - kind = kind_phys - intent = in - optional = F -[sinlat] - standard_name = sine_of_latitude - long_name = sine of latitude - units = none - dimensions = (horizontal_dimension) - type = real - kind = kind_phys - intent = in - optional = F -[ntrac] - standard_name = number_of_tracers - long_name = number of tracers - units = count - dimensions = () - type = integer - intent = in - optional = F -[nlev] - standard_name = vertical_dimension - long_name = number of vertical levels - units = count +[Model] + standard_name = GFS_control_type_instance + long_name = instance of derived type GFS_control_type + units = DDT dimensions = () - type = integer + type = GFS_control_type intent = in optional = F -[ncol] - standard_name = horizontal_loop_extent - long_name = horizontal loop extent - units = count +[Grid] + standard_name = GFS_grid_type_instance + long_name = instance of derived type GFS_grid_type + units = DDT dimensions = () - type = integer + type = GFS_grid_type intent = in optional = F -[nsfcpert] - standard_name = number_of_surface_perturbations - long_name = number of surface perturbations - units = count +[Sfcprop] + standard_name = GFS_sfcprop_type_instance + long_name = instance of derived type GFS_sfcprop_type + units = DDT dimensions = () - type = integer + type = GFS_sfcprop_type intent = in optional = F -[nmtvr] - standard_name = number_of_statistical_measures_of_subgrid_orography - long_name = number of topographic variables in GWD - units = count +[Statein] + standard_name = GFS_statein_type_instance + long_name = instance of derived type GFS_statein_type + units = DDT dimensions = () - type = integer + type = GFS_statein_type intent = in optional = F -[doLWrad] - standard_name = flag_to_calc_sw - long_name = logical flags for sw radiation calls - units = flag +[Radtend] + standard_name = GFS_radtend_type_instance + long_name = instance of derived type GFS_radtend_type + units = DDT dimensions = () - type = logical - intent = in + type = GFS_radtend_type + intent = inout optional = F -[solhr] - standard_name = forecast_hour_of_the_day - long_name = time in hours after 00z at the current timestep - units = h +[Coupling] + standard_name = GFS_coupling_type_instance + long_name = Fortran DDT containing FV3-GFS fields to/from coupling with other components + units = DDT dimensions = () - type = real - kind = kind_phys - intent = in + type = GFS_coupling_type + intent = inout optional = F -[mpi_rank] - standard_name = mpi_rank - long_name = current MPI-rank - units = index +[ncol] + standard_name = horizontal_loop_extent + long_name = horizontal loop extent + units = count dimensions = () type = integer intent = in optional = F -[do_sfcperts] - standard_name = flag_for_stochastic_surface_perturbations - long_name = flag for stochastic surface perturbations option - units = flag - dimensions = () - type = logical - intent = in - optional = F -[pertalb] - standard_name = magnitude_of_surface_albedo_perturbation - long_name = magnitude of surface albedo perturbation - units = frac - dimensions = (5) - type = real - kind = kind_phys - intent = in - optional = F -[slmsk] - standard_name = sea_land_ice_mask_real - long_name = landmask: sea/land/ice=0/1/2 - units = flag - dimensions = (horizontal_dimension) - type = real - kind = kind_phys - intent = in - optional = F -[snowd] - standard_name = surface_snow_thickness_water_equivalent - long_name = water equivalent snow depth - units = mm - dimensions = (horizontal_dimension) - type = real - kind = kind_phys - intent = in - optional = F -[sncovr] - standard_name = surface_snow_area_fraction_over_land - long_name = surface snow area fraction - units = frac - dimensions = (horizontal_dimension) - type = real - kind = kind_phys - intent = in - optional = F -[snoalb] - standard_name = upper_bound_on_max_albedo_over_deep_snow - long_name = maximum snow albedo - units = frac - dimensions = (horizontal_dimension) - type = real - kind = kind_phys - intent = in - optional = F -[zorl] - standard_name = surface_roughness_length - long_name = surface roughness length - units = cm - dimensions = (horizontal_dimension) - type = real - kind = kind_phys - intent = in - optional = F -[tsfc] - standard_name = surface_skin_temperature - long_name = surface skin temperature - units = K - dimensions = (horizontal_dimension) - type = real - kind = kind_phys - intent = in - optional = F -[hprime] - standard_name = standard_deviation_of_subgrid_orography - long_name = standard deviation of subgrid orography - units = m - dimensions = (horizontal_dimension) - type = real - kind = kind_phys - intent = in - optional = F -[alvwf] - standard_name = mean_vis_albedo_with_weak_cosz_dependency - long_name = mean vis albedo with weak cosz dependency - units = frac - dimensions = (horizontal_dimension) - type = real - kind = kind_phys - intent = in - optional = F -[alnwf] - standard_name = mean_nir_albedo_with_weak_cosz_dependency - long_name = mean nir albedo with weak cosz dependency - units = frac - dimensions = (horizontal_dimension) - type = real - kind = kind_phys - intent = in - optional = F -[alvsf] - standard_name = mean_vis_albedo_with_strong_cosz_dependency - long_name = mean vis albedo with strong cosz dependency - units = frac - dimensions = (horizontal_dimension) - type = real - kind = kind_phys - intent = in - optional = F -[alnsf] - standard_name = mean_nir_albedo_with_strong_cosz_dependency - long_name = mean nir albedo with strong cosz dependency - units = frac - dimensions = (horizontal_dimension) - type = real - kind = kind_phys - intent = in - optional = F -[facsf] - standard_name =fractional_coverage_with_strong_cosz_dependency - long_name = fractional coverage with strong cosz dependency - units = frac - dimensions = (horizontal_dimension) - type = real - kind = kind_phys - intent = in - optional = F -[facwf] - standard_name = fractional_coverage_with_weak_cosz_dependency - long_name = fractional coverage with weak cosz dependency - units = frac - dimensions = (horizontal_dimension) - type = real - kind = kind_phys - intent = in - optional = F -[fice] - standard_name = sea_ice_concentration - long_name = ice fraction over open water - units = frac - dimensions = (horizontal_dimension) - type = real - kind = kind_phys - intent = in - optional = F -[tisfc] - standard_name = sea_ice_temperature - long_name = sea ice surface skin temperature - units = K - dimensions = (horizontal_dimension) - type = real - kind = kind_phys - intent = in - optional = F -[sfc_wts] - standard_name = weights_for_stochastic_surface_physics_perturbation - long_name = weights for stochastic surface physics perturbation - units = none - dimensions = (horizontal_dimension,number_of_surface_perturbations) - type = real - kind = kind_phys - intent = in - optional = F [tv_lay] standard_name = virtual_temperature long_name = layer virtual temperature @@ -316,15 +119,6 @@ kind = kind_phys intent = out optional = F -[sfalb] - standard_name = surface_diffused_shortwave_albedo - long_name = mean surface diffused sw albedo - units = frac - dimensions = (horizontal_dimension) - type = real - kind = kind_phys - intent = out - optional = F [sfc_alb_nir_dir] standard_name = surface_albedo_nearIR_direct long_name = near-IR (direct) surface albedo (sfc_alb_nir_dir) @@ -361,24 +155,6 @@ kind = kind_phys intent = out optional = F -[coszen] - standard_name = cosine_of_zenith_angle - long_name = mean cos of zenith angle over rad call period - units = none - dimensions = (horizontal_dimension) - type = real - kind = kind_phys - intent = out - optional = F -[coszdg] - standard_name = daytime_mean_cosz_over_rad_call_period - long_name = daytime mean cosz over rad call period - units = none - dimensions = (horizontal_dimension) - type = real - kind = kind_phys - intent = out - optional = F [nday] standard_name = daytime_points_dimension long_name = daytime points dimension